diff --git a/.changelog/00fdc2bd91be44168cbe06dbcd471b87.json b/.changelog/00fdc2bd91be44168cbe06dbcd471b87.json new file mode 100644 index 00000000000..7fb3dd2a282 --- /dev/null +++ b/.changelog/00fdc2bd91be44168cbe06dbcd471b87.json @@ -0,0 +1,8 @@ +{ + "id": "00fdc2bd-91be-4416-8cbe-06dbcd471b87", + "type": "feature", + "description": "This release adds support for external access findings for S3 directory buckets to help you easily identify cross-account access. Updated service API, documentation, and paginators.", + "modules": [ + "service/accessanalyzer" + ] +} \ No newline at end of file diff --git a/.changelog/09f38f0508404eb19247d3091324936c.json b/.changelog/09f38f0508404eb19247d3091324936c.json new file mode 100644 index 00000000000..4b934453eca --- /dev/null +++ b/.changelog/09f38f0508404eb19247d3091324936c.json @@ -0,0 +1,8 @@ +{ + "id": "09f38f05-0840-4eb1-9247-d3091324936c", + "type": "feature", + "description": "This release adds support for minor versions/aliases for invoke model identifier.", + "modules": [ + "service/bedrockruntime" + ] +} \ No newline at end of file diff --git a/.changelog/195bca9fb5344dee8f3567e106f3d1bc.json b/.changelog/195bca9fb5344dee8f3567e106f3d1bc.json new file mode 100644 index 00000000000..9873a2a472b --- /dev/null +++ b/.changelog/195bca9fb5344dee8f3567e106f3d1bc.json @@ -0,0 +1,8 @@ +{ + "id": "195bca9f-b534-4dee-8f35-67e106f3d1bc", + "type": "feature", + "description": "Amazon Q in Connect, an LLM-enhanced evolution of Amazon Connect Wisdom. This release adds generative AI support to Amazon Q Connect QueryAssistant and GetRecommendations APIs.", + "modules": [ + "service/qconnect" + ] +} \ No newline at end of file diff --git a/.changelog/2be7eaeac04b4f1eba2812cc33e84ac7.json b/.changelog/2be7eaeac04b4f1eba2812cc33e84ac7.json new file mode 100644 index 00000000000..1ef5054f32a --- /dev/null +++ b/.changelog/2be7eaeac04b4f1eba2812cc33e84ac7.json @@ -0,0 +1,8 @@ +{ + "id": "2be7eaea-c04b-4f1e-ba28-12cc33e84ac7", + "type": "feature", + "description": "Adds support for S3 Express One Zone.", + "modules": [ + "service/s3" + ] +} \ No newline at end of file diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..97a90472463 --- /dev/null +++ b/.changelog/41575353444b40ffbf474f4155544f00.json @@ -0,0 +1,11 @@ +{ + "id": "41575353-444b-40ff-bf47-4f4155544f00", + "type": "release", + "description": "New AWS service client module", + "modules": [ + "service/bedrockagent", + "service/bedrockagentruntime", + "service/qbusiness", + "service/qconnect" + ] +} \ No newline at end of file diff --git a/.changelog/502d456971a34287bc99d096f41964e5.json b/.changelog/502d456971a34287bc99d096f41964e5.json new file mode 100644 index 00000000000..67549a612da --- /dev/null +++ b/.changelog/502d456971a34287bc99d096f41964e5.json @@ -0,0 +1,8 @@ +{ + "id": "502d4569-71a3-4287-bc99-d096f41964e5", + "type": "feature", + "description": "This release introduces Agents for Amazon Bedrock Runtime", + "modules": [ + "service/bedrockagentruntime" + ] +} \ No newline at end of file diff --git a/.changelog/697c81ef1847441aae91f3a10c9de25b.json b/.changelog/697c81ef1847441aae91f3a10c9de25b.json new file mode 100644 index 00000000000..5319cfc4c06 --- /dev/null +++ b/.changelog/697c81ef1847441aae91f3a10c9de25b.json @@ -0,0 +1,8 @@ +{ + "id": "697c81ef-1847-441a-ae91-f3a10c9de25b", + "type": "feature", + "description": "Added support for following capabilities: Amazon Connect's in-app, web, and video calling. Two-way SMS integrations. Contact Lens real-time chat analytics feature. Amazon Connect Analytics Datalake capability. Capability to configure real time chat rules.", + "modules": [ + "service/connect" + ] +} \ No newline at end of file diff --git a/.changelog/a45621160fdd4c03919370d7934b0dce.json b/.changelog/a45621160fdd4c03919370d7934b0dce.json new file mode 100644 index 00000000000..ff3e114a215 --- /dev/null +++ b/.changelog/a45621160fdd4c03919370d7934b0dce.json @@ -0,0 +1,8 @@ +{ + "id": "a4562116-0fdd-4c03-9193-70d7934b0dce", + "type": "feature", + "description": "This release introduces Agents for Amazon Bedrock", + "modules": [ + "service/bedrockagent" + ] +} \ No newline at end of file diff --git a/.changelog/a7965a1b16ac4363b1b2aa6e0e97227e.json b/.changelog/a7965a1b16ac4363b1b2aa6e0e97227e.json new file mode 100644 index 00000000000..6de0ecf5522 --- /dev/null +++ b/.changelog/a7965a1b16ac4363b1b2aa6e0e97227e.json @@ -0,0 +1,8 @@ +{ + "id": "a7965a1b-16ac-4363-b1b2-aa6e0e97227e", + "type": "feature", + "description": "This release introduces DetectProfileObjectType API to auto generate object type mapping.", + "modules": [ + "service/customerprofiles" + ] +} \ No newline at end of file diff --git a/.changelog/bee00d730be14dbfa2d0b531f33efe66.json b/.changelog/bee00d730be14dbfa2d0b531f33efe66.json new file mode 100644 index 00000000000..3aea9c97ed9 --- /dev/null +++ b/.changelog/bee00d730be14dbfa2d0b531f33efe66.json @@ -0,0 +1,8 @@ +{ + "id": "bee00d73-0be1-4dbf-a2d0-b531f33efe66", + "type": "feature", + "description": "This release adds support for customization types, model life cycle status and minor versions/aliases for model identifiers.", + "modules": [ + "service/bedrock" + ] +} \ No newline at end of file diff --git a/.changelog/d76a67e958ae4741adc638b0d983cf10.json b/.changelog/d76a67e958ae4741adc638b0d983cf10.json new file mode 100644 index 00000000000..c99704fed67 --- /dev/null +++ b/.changelog/d76a67e958ae4741adc638b0d983cf10.json @@ -0,0 +1,8 @@ +{ + "id": "d76a67e9-58ae-4741-adc6-38b0d983cf10", + "type": "feature", + "description": "Amazon Q - a generative AI powered application that your employees can use to ask questions and get answers from knowledge spread across disparate content repositories, summarize reports, write articles, take actions, and much more - all within their company's connected content repositories.", + "modules": [ + "service/qbusiness" + ] +} \ No newline at end of file diff --git a/.changelog/e094391fbd724700990152b108873389.json b/.changelog/e094391fbd724700990152b108873389.json new file mode 100644 index 00000000000..17eba36a5e9 --- /dev/null +++ b/.changelog/e094391fbd724700990152b108873389.json @@ -0,0 +1,8 @@ +{ + "id": "e094391f-bd72-4700-9901-52b108873389", + "type": "feature", + "description": "Adds support for S3 Express One Zone, and InvocationSchemaVersion 2.0 for S3 Batch Operations.", + "modules": [ + "service/s3control" + ] +} \ No newline at end of file diff --git a/service/accessanalyzer/deserializers.go b/service/accessanalyzer/deserializers.go index 766b15d3562..83b3fd7939c 100644 --- a/service/accessanalyzer/deserializers.go +++ b/service/accessanalyzer/deserializers.go @@ -6398,6 +6398,16 @@ loop: uv = &types.ConfigurationMemberS3Bucket{Value: mv} break loop + case "s3ExpressDirectoryBucket": + var mv types.S3ExpressDirectoryBucketConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentS3ExpressDirectoryBucketConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.ConfigurationMemberS3ExpressDirectoryBucket{Value: mv} + break loop + case "secretsManagerSecret": var mv types.SecretsManagerSecretConfiguration destAddr := &mv @@ -9559,6 +9569,46 @@ func awsRestjson1_deserializeDocumentS3BucketConfiguration(v **types.S3BucketCon return nil } +func awsRestjson1_deserializeDocumentS3ExpressDirectoryBucketConfiguration(v **types.S3ExpressDirectoryBucketConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.S3ExpressDirectoryBucketConfiguration + if *v == nil { + sv = &types.S3ExpressDirectoryBucketConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "bucketPolicy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3ExpressDirectoryBucketPolicy to be of type string, got %T instead", value) + } + sv.BucketPolicy = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentS3PublicAccessBlockConfiguration(v **types.S3PublicAccessBlockConfiguration, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/accessanalyzer/serializers.go b/service/accessanalyzer/serializers.go index 8e5ed76c576..05c11e76789 100644 --- a/service/accessanalyzer/serializers.go +++ b/service/accessanalyzer/serializers.go @@ -2799,6 +2799,12 @@ func awsRestjson1_serializeDocumentConfiguration(v types.Configuration, value sm return err } + case *types.ConfigurationMemberS3ExpressDirectoryBucket: + av := object.Key("s3ExpressDirectoryBucket") + if err := awsRestjson1_serializeDocumentS3ExpressDirectoryBucketConfiguration(&uv.Value, av); err != nil { + return err + } + case *types.ConfigurationMemberSecretsManagerSecret: av := object.Key("secretsManagerSecret") if err := awsRestjson1_serializeDocumentSecretsManagerSecretConfiguration(&uv.Value, av); err != nil { @@ -3425,6 +3431,18 @@ func awsRestjson1_serializeDocumentS3BucketConfiguration(v *types.S3BucketConfig return nil } +func awsRestjson1_serializeDocumentS3ExpressDirectoryBucketConfiguration(v *types.S3ExpressDirectoryBucketConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BucketPolicy != nil { + ok := object.Key("bucketPolicy") + ok.String(*v.BucketPolicy) + } + + return nil +} + func awsRestjson1_serializeDocumentS3PublicAccessBlockConfiguration(v *types.S3PublicAccessBlockConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/accessanalyzer/types/enums.go b/service/accessanalyzer/types/enums.go index c488c1a8aa4..7b5e280b3b3 100644 --- a/service/accessanalyzer/types/enums.go +++ b/service/accessanalyzer/types/enums.go @@ -429,19 +429,20 @@ type ResourceType string // Enum values for ResourceType const ( - ResourceTypeAwsS3Bucket ResourceType = "AWS::S3::Bucket" - ResourceTypeAwsIamRole ResourceType = "AWS::IAM::Role" - ResourceTypeAwsSqsQueue ResourceType = "AWS::SQS::Queue" - ResourceTypeAwsLambdaFunction ResourceType = "AWS::Lambda::Function" - ResourceTypeAwsLambdaLayerversion ResourceType = "AWS::Lambda::LayerVersion" - ResourceTypeAwsKmsKey ResourceType = "AWS::KMS::Key" - ResourceTypeAwsSecretsmanagerSecret ResourceType = "AWS::SecretsManager::Secret" - ResourceTypeAwsEfsFilesystem ResourceType = "AWS::EFS::FileSystem" - ResourceTypeAwsEc2Snapshot ResourceType = "AWS::EC2::Snapshot" - ResourceTypeAwsEcrRepository ResourceType = "AWS::ECR::Repository" - ResourceTypeAwsRdsDbsnapshot ResourceType = "AWS::RDS::DBSnapshot" - ResourceTypeAwsRdsDbclustersnapshot ResourceType = "AWS::RDS::DBClusterSnapshot" - ResourceTypeAwsSnsTopic ResourceType = "AWS::SNS::Topic" + ResourceTypeAwsS3Bucket ResourceType = "AWS::S3::Bucket" + ResourceTypeAwsIamRole ResourceType = "AWS::IAM::Role" + ResourceTypeAwsSqsQueue ResourceType = "AWS::SQS::Queue" + ResourceTypeAwsLambdaFunction ResourceType = "AWS::Lambda::Function" + ResourceTypeAwsLambdaLayerversion ResourceType = "AWS::Lambda::LayerVersion" + ResourceTypeAwsKmsKey ResourceType = "AWS::KMS::Key" + ResourceTypeAwsSecretsmanagerSecret ResourceType = "AWS::SecretsManager::Secret" + ResourceTypeAwsEfsFilesystem ResourceType = "AWS::EFS::FileSystem" + ResourceTypeAwsEc2Snapshot ResourceType = "AWS::EC2::Snapshot" + ResourceTypeAwsEcrRepository ResourceType = "AWS::ECR::Repository" + ResourceTypeAwsRdsDbsnapshot ResourceType = "AWS::RDS::DBSnapshot" + ResourceTypeAwsRdsDbclustersnapshot ResourceType = "AWS::RDS::DBClusterSnapshot" + ResourceTypeAwsSnsTopic ResourceType = "AWS::SNS::Topic" + ResourceTypeAwsS3expressDirectorybucket ResourceType = "AWS::S3Express::DirectoryBucket" ) // Values returns all known values for ResourceType. Note that this can be @@ -462,6 +463,7 @@ func (ResourceType) Values() []ResourceType { "AWS::RDS::DBSnapshot", "AWS::RDS::DBClusterSnapshot", "AWS::SNS::Topic", + "AWS::S3Express::DirectoryBucket", } } diff --git a/service/accessanalyzer/types/types.go b/service/accessanalyzer/types/types.go index 8e12fecdeec..eb1c2813ef1 100644 --- a/service/accessanalyzer/types/types.go +++ b/service/accessanalyzer/types/types.go @@ -474,6 +474,7 @@ type CloudTrailProperties struct { // ConfigurationMemberRdsDbClusterSnapshot // ConfigurationMemberRdsDbSnapshot // ConfigurationMemberS3Bucket +// ConfigurationMemberS3ExpressDirectoryBucket // ConfigurationMemberSecretsManagerSecret // ConfigurationMemberSnsTopic // ConfigurationMemberSqsQueue @@ -544,7 +545,7 @@ type ConfigurationMemberRdsDbSnapshot struct { func (*ConfigurationMemberRdsDbSnapshot) isConfiguration() {} -// The access control configuration is for an Amazon S3 Bucket. +// The access control configuration is for an Amazon S3 bucket. type ConfigurationMemberS3Bucket struct { Value S3BucketConfiguration @@ -553,6 +554,15 @@ type ConfigurationMemberS3Bucket struct { func (*ConfigurationMemberS3Bucket) isConfiguration() {} +// The access control configuration is for an Amazon S3 directory bucket. +type ConfigurationMemberS3ExpressDirectoryBucket struct { + Value S3ExpressDirectoryBucketConfiguration + + noSmithyDocumentSerde +} + +func (*ConfigurationMemberS3ExpressDirectoryBucket) isConfiguration() {} + // The access control configuration is for a Secrets Manager secret. type ConfigurationMemberSecretsManagerSecret struct { Value SecretsManagerSecretConfiguration @@ -1591,6 +1601,25 @@ type S3BucketConfiguration struct { noSmithyDocumentSerde } +// Proposed access control configuration for an Amazon S3 directory bucket. You +// can propose a configuration for a new Amazon S3 directory bucket or an existing +// Amazon S3 directory bucket that you own by specifying the Amazon S3 bucket +// policy. If the configuration is for an existing Amazon S3 directory bucket and +// you do not specify the Amazon S3 bucket policy, the access preview uses the +// existing policy attached to the directory bucket. If the access preview is for a +// new resource and you do not specify the Amazon S3 bucket policy, the access +// preview assumes an directory bucket without a policy. To propose deletion of an +// existing bucket policy, you can specify an empty string. For more information +// about bucket policy limits, see Example bucket policies (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-security-iam-example-bucket-policies.html) +// . +type S3ExpressDirectoryBucketConfiguration struct { + + // The proposed bucket policy for the Amazon S3 directory bucket. + BucketPolicy *string + + noSmithyDocumentSerde +} + // The PublicAccessBlock configuration to apply to this Amazon S3 bucket. If the // proposed configuration is for an existing Amazon S3 bucket and the configuration // is not specified, the access preview uses the existing setting. If the proposed diff --git a/service/accessanalyzer/types/types_exported_test.go b/service/accessanalyzer/types/types_exported_test.go index 8eba53efa35..a2dd8fde7ec 100644 --- a/service/accessanalyzer/types/types_exported_test.go +++ b/service/accessanalyzer/types/types_exported_test.go @@ -75,6 +75,9 @@ func ExampleConfiguration_outputUsage() { case *types.ConfigurationMemberS3Bucket: _ = v.Value // Value is types.S3BucketConfiguration + case *types.ConfigurationMemberS3ExpressDirectoryBucket: + _ = v.Value // Value is types.S3ExpressDirectoryBucketConfiguration + case *types.ConfigurationMemberSecretsManagerSecret: _ = v.Value // Value is types.SecretsManagerSecretConfiguration @@ -93,6 +96,7 @@ func ExampleConfiguration_outputUsage() { } } +var _ *types.S3ExpressDirectoryBucketConfiguration var _ *types.SnsTopicConfiguration var _ *types.SqsQueueConfiguration var _ *types.EcrRepositoryConfiguration diff --git a/service/bedrock/api_op_CreateModelCustomizationJob.go b/service/bedrock/api_op_CreateModelCustomizationJob.go index 2ab12a78d72..34f1719b5b9 100644 --- a/service/bedrock/api_op_CreateModelCustomizationJob.go +++ b/service/bedrock/api_op_CreateModelCustomizationJob.go @@ -17,7 +17,7 @@ import ( // model-customization job completes successfully, your custom model resource will // be ready to use. Training data contains input and output text for each record in // a JSONL format. Optionally, you can specify validation data in the same format -// as the training data. Bedrock returns validation loss metrics and output +// as the training data. Amazon Bedrock returns validation loss metrics and output // generations after the job completes. Model-customization jobs are asynchronous // and the completion time depends on the base model and the training/validation // data size. To monitor a job, use the GetModelCustomizationJob operation to @@ -65,11 +65,11 @@ type CreateModelCustomizationJobInput struct { // This member is required. OutputDataConfig *types.OutputDataConfig - // The Amazon Resource Name (ARN) of an IAM role that Bedrock can assume to - // perform tasks on your behalf. For example, during model training, Bedrock needs - // your permission to read input data from an S3 bucket, write model artifacts to - // an S3 bucket. To pass this role to Bedrock, the caller of this API must have the - // iam:PassRole permission. + // The Amazon Resource Name (ARN) of an IAM role that Amazon Bedrock can assume to + // perform tasks on your behalf. For example, during model training, Amazon Bedrock + // needs your permission to read input data from an S3 bucket, write model + // artifacts to an S3 bucket. To pass this role to Amazon Bedrock, the caller of + // this API must have the iam:PassRole permission. // // This member is required. RoleArn *string @@ -89,6 +89,9 @@ type CreateModelCustomizationJobInput struct { // Assign tags to the custom model. CustomModelTags []types.Tag + // The customization type. + CustomizationType types.CustomizationType + // Assign tags to the job. JobTags []types.Tag diff --git a/service/bedrock/api_op_CreateProvisionedModelThroughput.go b/service/bedrock/api_op_CreateProvisionedModelThroughput.go index d4ebc4a1c2d..7564d4d8b87 100644 --- a/service/bedrock/api_op_CreateProvisionedModelThroughput.go +++ b/service/bedrock/api_op_CreateProvisionedModelThroughput.go @@ -48,7 +48,7 @@ type CreateProvisionedModelThroughputInput struct { ProvisionedModelName *string // Unique token value that you can provide. If this token matches a previous - // request, Bedrock ignores the request, but does not return an error. + // request, Amazon Bedrock ignores the request, but does not return an error. ClientRequestToken *string // Commitment duration requested for the provisioned throughput. diff --git a/service/bedrock/api_op_GetCustomModel.go b/service/bedrock/api_op_GetCustomModel.go index 0436171327d..220ce00d998 100644 --- a/service/bedrock/api_op_GetCustomModel.go +++ b/service/bedrock/api_op_GetCustomModel.go @@ -13,7 +13,7 @@ import ( "time" ) -// Get the properties associated with a Bedrock custom model that you have +// Get the properties associated with a Amazon Bedrock custom model that you have // created.For more information, see Custom models (https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html) // in the Bedrock User Guide. func (c *Client) GetCustomModel(ctx context.Context, params *GetCustomModelInput, optFns ...func(*Options)) (*GetCustomModelOutput, error) { @@ -78,6 +78,9 @@ type GetCustomModelOutput struct { // This member is required. TrainingDataConfig *types.TrainingDataConfig + // The type of model customization. + CustomizationType types.CustomizationType + // Hyperparameter values associated with this model. HyperParameters map[string]string diff --git a/service/bedrock/api_op_GetFoundationModel.go b/service/bedrock/api_op_GetFoundationModel.go index 42894b65670..7d21ae9885d 100644 --- a/service/bedrock/api_op_GetFoundationModel.go +++ b/service/bedrock/api_op_GetFoundationModel.go @@ -12,7 +12,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Get details about a Bedrock foundation model. +// Get details about a Amazon Bedrock foundation model. func (c *Client) GetFoundationModel(ctx context.Context, params *GetFoundationModelInput, optFns ...func(*Options)) (*GetFoundationModelOutput, error) { if params == nil { params = &GetFoundationModelInput{} diff --git a/service/bedrock/api_op_GetModelCustomizationJob.go b/service/bedrock/api_op_GetModelCustomizationJob.go index fa1e647461d..c4e67aa6e23 100644 --- a/service/bedrock/api_op_GetModelCustomizationJob.go +++ b/service/bedrock/api_op_GetModelCustomizationJob.go @@ -53,7 +53,9 @@ type GetModelCustomizationJobOutput struct { // This member is required. CreationTime *time.Time - // The hyperparameter values for the job. + // The hyperparameter values for the job. For information about hyperparameters + // for specific models, see Guidelines for model customization (https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-guidelines.html) + // . // // This member is required. HyperParameters map[string]string @@ -96,6 +98,9 @@ type GetModelCustomizationJobOutput struct { // The token that you specified in the CreateCustomizationJob request. ClientRequestToken *string + // The type of model customization. + CustomizationType types.CustomizationType + // Time that the resource transitioned to terminal state. EndTime *time.Time diff --git a/service/bedrock/api_op_ListCustomModels.go b/service/bedrock/api_op_ListCustomModels.go index d1fa16060a5..2749f491c64 100644 --- a/service/bedrock/api_op_ListCustomModels.go +++ b/service/bedrock/api_op_ListCustomModels.go @@ -51,8 +51,8 @@ type ListCustomModelsInput struct { // Return custom models only if the job name contains these characters. NameContains *string - // Continuation token from the previous response, for Bedrock to list the next set - // of results. + // Continuation token from the previous response, for Amazon Bedrock to list the + // next set of results. NextToken *string // The field to sort by in the returned list of models. diff --git a/service/bedrock/api_op_ListFoundationModels.go b/service/bedrock/api_op_ListFoundationModels.go index c3177e7896d..3c31b396b66 100644 --- a/service/bedrock/api_op_ListFoundationModels.go +++ b/service/bedrock/api_op_ListFoundationModels.go @@ -12,8 +12,8 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// List of Bedrock foundation models that you can use. For more information, see -// Foundation models (https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html) +// List of Amazon Bedrock foundation models that you can use. For more +// information, see Foundation models (https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html) // in the Bedrock User Guide. func (c *Client) ListFoundationModels(ctx context.Context, params *ListFoundationModelsInput, optFns ...func(*Options)) (*ListFoundationModelsOutput, error) { if params == nil { @@ -41,7 +41,7 @@ type ListFoundationModelsInput struct { // List by output modality type. ByOutputModality types.ModelModality - // A Bedrock model provider. + // A Amazon Bedrock model provider. ByProvider *string noSmithyDocumentSerde @@ -49,7 +49,7 @@ type ListFoundationModelsInput struct { type ListFoundationModelsOutput struct { - // A list of bedrock foundation models. + // A list of Amazon Bedrock foundation models. ModelSummaries []types.FoundationModelSummary // Metadata pertaining to the operation's result. diff --git a/service/bedrock/api_op_ListModelCustomizationJobs.go b/service/bedrock/api_op_ListModelCustomizationJobs.go index 39f3448fe01..6688aa3df2c 100644 --- a/service/bedrock/api_op_ListModelCustomizationJobs.go +++ b/service/bedrock/api_op_ListModelCustomizationJobs.go @@ -46,8 +46,8 @@ type ListModelCustomizationJobsInput struct { // Return customization jobs only if the job name contains these characters. NameContains *string - // Continuation token from the previous response, for Bedrock to list the next set - // of results. + // Continuation token from the previous response, for Amazon Bedrock to list the + // next set of results. NextToken *string // The field to sort by in the returned list of jobs. diff --git a/service/bedrock/api_op_ListProvisionedModelThroughputs.go b/service/bedrock/api_op_ListProvisionedModelThroughputs.go index dc7498e725e..203004660e4 100644 --- a/service/bedrock/api_op_ListProvisionedModelThroughputs.go +++ b/service/bedrock/api_op_ListProvisionedModelThroughputs.go @@ -50,8 +50,8 @@ type ListProvisionedModelThroughputsInput struct { // characters. NameContains *string - // Continuation token from the previous response, for Bedrock to list the next set - // of results. + // Continuation token from the previous response, for Amazon Bedrock to list the + // next set of results. NextToken *string // The field to sort by in the returned list of provisioned capacities. diff --git a/service/bedrock/deserializers.go b/service/bedrock/deserializers.go index 932b42020d8..20c641b9d9e 100644 --- a/service/bedrock/deserializers.go +++ b/service/bedrock/deserializers.go @@ -813,6 +813,15 @@ func awsRestjson1_deserializeOpDocumentGetCustomModelOutput(v **GetCustomModelOu sv.CreationTime = ptr.Time(t) } + case "customizationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomizationType to be of type string, got %T instead", value) + } + sv.CustomizationType = types.CustomizationType(jtv) + } + case "hyperParameters": if err := awsRestjson1_deserializeDocumentModelCustomizationHyperParameters(&sv.HyperParameters, value); err != nil { return err @@ -1232,6 +1241,15 @@ func awsRestjson1_deserializeOpDocumentGetModelCustomizationJobOutput(v **GetMod sv.CreationTime = ptr.Time(t) } + case "customizationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomizationType to be of type string, got %T instead", value) + } + sv.CustomizationType = types.CustomizationType(jtv) + } + case "endTime": if value != nil { jtv, ok := value.(string) @@ -3581,6 +3599,15 @@ func awsRestjson1_deserializeDocumentCustomModelSummary(v **types.CustomModelSum sv.CreationTime = ptr.Time(t) } + case "customizationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomizationType to be of type string, got %T instead", value) + } + sv.CustomizationType = types.CustomizationType(jtv) + } + case "modelArn": if value != nil { jtv, ok := value.(string) @@ -3697,6 +3724,11 @@ func awsRestjson1_deserializeDocumentFoundationModelDetails(v **types.Foundation sv.ModelId = ptr.String(jtv) } + case "modelLifecycle": + if err := awsRestjson1_deserializeDocumentFoundationModelLifecycle(&sv.ModelLifecycle, value); err != nil { + return err + } + case "modelName": if value != nil { jtv, ok := value.(string) @@ -3738,6 +3770,46 @@ func awsRestjson1_deserializeDocumentFoundationModelDetails(v **types.Foundation return nil } +func awsRestjson1_deserializeDocumentFoundationModelLifecycle(v **types.FoundationModelLifecycle, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FoundationModelLifecycle + if *v == nil { + sv = &types.FoundationModelLifecycle{} + } 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 FoundationModelLifecycleStatus to be of type string, got %T instead", value) + } + sv.Status = types.FoundationModelLifecycleStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentFoundationModelSummary(v **types.FoundationModelSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -3793,6 +3865,11 @@ func awsRestjson1_deserializeDocumentFoundationModelSummary(v **types.Foundation sv.ModelId = ptr.String(jtv) } + case "modelLifecycle": + if err := awsRestjson1_deserializeDocumentFoundationModelLifecycle(&sv.ModelLifecycle, value); err != nil { + return err + } + case "modelName": if value != nil { jtv, ok := value.(string) @@ -4126,6 +4203,15 @@ func awsRestjson1_deserializeDocumentModelCustomizationJobSummary(v **types.Mode sv.CreationTime = ptr.Time(t) } + case "customizationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomizationType to be of type string, got %T instead", value) + } + sv.CustomizationType = types.CustomizationType(jtv) + } + case "customModelArn": if value != nil { jtv, ok := value.(string) diff --git a/service/bedrock/doc.go b/service/bedrock/doc.go index bc176a99ada..2cac0bc309a 100644 --- a/service/bedrock/doc.go +++ b/service/bedrock/doc.go @@ -3,5 +3,5 @@ // Package bedrock provides the API client, operations, and parameter types for // Amazon Bedrock. // -// Describes the API operations for creating and managing Bedrock models. +// Describes the API operations for creating and managing Amazon Bedrock models. package bedrock diff --git a/service/bedrock/endpoints.go b/service/bedrock/endpoints.go index 5d01ea7c7be..3434ef052f2 100644 --- a/service/bedrock/endpoints.go +++ b/service/bedrock/endpoints.go @@ -366,7 +366,7 @@ func (r *resolver) ResolveEndpoint( } } if _UseFIPS == true { - if true == _PartitionResult.SupportsFIPS { + if _PartitionResult.SupportsFIPS == true { uriString := func() string { var out strings.Builder out.WriteString("https://bedrock-fips.") diff --git a/service/bedrock/serializers.go b/service/bedrock/serializers.go index 01ec4293377..722ed9b6fa3 100644 --- a/service/bedrock/serializers.go +++ b/service/bedrock/serializers.go @@ -92,6 +92,11 @@ func awsRestjson1_serializeOpDocumentCreateModelCustomizationJobInput(v *CreateM ok.String(*v.ClientRequestToken) } + if len(v.CustomizationType) > 0 { + ok := object.Key("customizationType") + ok.String(string(v.CustomizationType)) + } + if v.CustomModelKmsKeyId != nil { ok := object.Key("customModelKmsKeyId") ok.String(*v.CustomModelKmsKeyId) diff --git a/service/bedrock/types/enums.go b/service/bedrock/types/enums.go index f935b1703bd..ac0aae3615b 100644 --- a/service/bedrock/types/enums.go +++ b/service/bedrock/types/enums.go @@ -20,6 +20,24 @@ func (CommitmentDuration) Values() []CommitmentDuration { } } +type CustomizationType string + +// Enum values for CustomizationType +const ( + CustomizationTypeFineTuning CustomizationType = "FINE_TUNING" + CustomizationTypeContinuedPreTraining CustomizationType = "CONTINUED_PRE_TRAINING" +) + +// Values returns all known values for CustomizationType. 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 (CustomizationType) Values() []CustomizationType { + return []CustomizationType{ + "FINE_TUNING", + "CONTINUED_PRE_TRAINING", + } +} + type FineTuningJobStatus string // Enum values for FineTuningJobStatus @@ -44,6 +62,25 @@ func (FineTuningJobStatus) Values() []FineTuningJobStatus { } } +type FoundationModelLifecycleStatus string + +// Enum values for FoundationModelLifecycleStatus +const ( + FoundationModelLifecycleStatusActive FoundationModelLifecycleStatus = "ACTIVE" + FoundationModelLifecycleStatusLegacy FoundationModelLifecycleStatus = "LEGACY" +) + +// Values returns all known values for FoundationModelLifecycleStatus. 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 (FoundationModelLifecycleStatus) Values() []FoundationModelLifecycleStatus { + return []FoundationModelLifecycleStatus{ + "ACTIVE", + "LEGACY", + } +} + type InferenceType string // Enum values for InferenceType @@ -66,7 +103,8 @@ type ModelCustomization string // Enum values for ModelCustomization const ( - ModelCustomizationFineTuning ModelCustomization = "FINE_TUNING" + ModelCustomizationFineTuning ModelCustomization = "FINE_TUNING" + ModelCustomizationContinuedPreTraining ModelCustomization = "CONTINUED_PRE_TRAINING" ) // Values returns all known values for ModelCustomization. Note that this can be @@ -75,6 +113,7 @@ const ( func (ModelCustomization) Values() []ModelCustomization { return []ModelCustomization{ "FINE_TUNING", + "CONTINUED_PRE_TRAINING", } } diff --git a/service/bedrock/types/types.go b/service/bedrock/types/types.go index 9b69c04f6b5..dc7bd7c84fd 100644 --- a/service/bedrock/types/types.go +++ b/service/bedrock/types/types.go @@ -54,6 +54,11 @@ type CustomModelSummary struct { // This member is required. ModelName *string + // Specifies whether to carry out continued pre-training of a model or whether to + // fine-tune it. For more information, see Custom models (https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html) + // . + CustomizationType CustomizationType + noSmithyDocumentSerde } @@ -79,6 +84,9 @@ type FoundationModelDetails struct { // The input modalities that the model supports. InputModalities []ModelModality + // Contains details about whether a model version is available or deprecated + ModelLifecycle *FoundationModelLifecycle + // The model name. ModelName *string @@ -94,6 +102,18 @@ type FoundationModelDetails struct { noSmithyDocumentSerde } +// Details about whether a model version is available or deprecated. +type FoundationModelLifecycle struct { + + // Specifies whether a model version is available ( ACTIVE ) or deprecated ( LEGACY + // . + // + // This member is required. + Status FoundationModelLifecycleStatus + + noSmithyDocumentSerde +} + // Summary information for a foundation model. type FoundationModelSummary struct { @@ -116,6 +136,9 @@ type FoundationModelSummary struct { // The input modalities that the model supports. InputModalities []ModelModality + // Contains details about whether a model version is available or deprecated. + ModelLifecycle *FoundationModelLifecycle + // The name of the model. ModelName *string @@ -186,6 +209,11 @@ type ModelCustomizationJobSummary struct { // Name of the custom model. CustomModelName *string + // Specifies whether to carry out continued pre-training of a model or whether to + // fine-tune it. For more information, see Custom models (https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html) + // . + CustomizationType CustomizationType + // Time that the customization job ended. EndTime *time.Time diff --git a/service/bedrockagent/LICENSE.txt b/service/bedrockagent/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/bedrockagent/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/bedrockagent/api_client.go b/service/bedrockagent/api_client.go new file mode 100644 index 00000000000..91debbee2e9 --- /dev/null +++ b/service/bedrockagent/api_client.go @@ -0,0 +1,471 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +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" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + 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 = "Bedrock Agent" +const ServiceAPIVersion = "2023-06-05" + +// Client provides the API client to make operations call for Agents for Amazon +// Bedrock. +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) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveIdempotencyTokenProvider(&options) + + resolveEndpointResolverV2(&options) + + resolveAuthSchemeResolver(&options) + + for _, fn := range optFns { + fn(&options) + } + + resolveRetryer(&options) + + ignoreAnonymousAuth(&options) + + resolveAuthSchemes(&options) + + client := &Client{ + options: options, + } + + return client +} + +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttemptOptions(&options, *c) + + finalizeClientEndpointResolverOptions(&options) + + for _, fn := range stackFns { + if err := fn(stack, options); err != nil { + return nil, metadata, err + } + } + + for _, fn := range options.APIOptions { + if err := fn(stack); err != nil { + return nil, metadata, err + } + } + + handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) + result, metadata, err = handler.Handle(ctx, params) + if err != nil { + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + return result, metadata, err +} + +type operationInputKey struct{} + +func setOperationInput(ctx context.Context, input interface{}) context.Context { + return middleware.WithStackValue(ctx, operationInputKey{}, input) +} + +func getOperationInput(ctx context.Context) interface{} { + return middleware.GetStackValue(ctx, operationInputKey{}) +} + +type setOperationInputMiddleware struct { +} + +func (*setOperationInputMiddleware) ID() string { + return "setOperationInput" +} + +func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + ctx = setOperationInput(ctx, in.Parameters) + return next.HandleSerialize(ctx, in) +} + +func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { + if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { + return fmt.Errorf("add ResolveAuthScheme: %v", err) + } + if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { + return fmt.Errorf("add GetIdentity: %v", err) + } + if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { + return fmt.Errorf("add ResolveEndpointV2: %v", err) + } + if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil { + return fmt.Errorf("add Signing: %v", err) + } + return nil +} +func resolveAuthSchemeResolver(options *Options) { + if options.AuthSchemeResolver == nil { + options.AuthSchemeResolver = &defaultAuthSchemeResolver{} + } +} + +func resolveAuthSchemes(options *Options) { + if options.AuthSchemes == nil { + options.AuthSchemes = []smithyhttp.AuthScheme{ + internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ + Signer: options.HTTPSignerV4, + Logger: options.Logger, + LogSigning: options.ClientLogMode.IsSigning(), + }), + } + } +} + +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) + resolveBaseEndpoint(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, "bedrockagent", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +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 disableHTTPSMiddleware struct { + DisableHTTPS bool +} + +func (*disableHTTPSMiddleware) ID() string { + return "disableHTTPS" +} + +func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, 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.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleFinalize(ctx, in) +} + +func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Finalize.Insert(&disableHTTPSMiddleware{ + DisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "ResolveEndpointV2", middleware.After) +} diff --git a/service/bedrockagent/api_client_test.go b/service/bedrockagent/api_client_test.go new file mode 100644 index 00000000000..9a648ce8583 --- /dev/null +++ b/service/bedrockagent/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +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/bedrockagent/api_op_AssociateAgentKnowledgeBase.go b/service/bedrockagent/api_op_AssociateAgentKnowledgeBase.go new file mode 100644 index 00000000000..1320fff1acb --- /dev/null +++ b/service/bedrockagent/api_op_AssociateAgentKnowledgeBase.go @@ -0,0 +1,159 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Associate a Knowledge Base to an existing Amazon Bedrock Agent +func (c *Client) AssociateAgentKnowledgeBase(ctx context.Context, params *AssociateAgentKnowledgeBaseInput, optFns ...func(*Options)) (*AssociateAgentKnowledgeBaseOutput, error) { + if params == nil { + params = &AssociateAgentKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AssociateAgentKnowledgeBase", params, optFns, c.addOperationAssociateAgentKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AssociateAgentKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Associate Agent Knowledge Base Request +type AssociateAgentKnowledgeBaseInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Description of the Resource. + // + // This member is required. + Description *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // State of the knowledge base; whether it is enabled or disabled + KnowledgeBaseState types.KnowledgeBaseState + + noSmithyDocumentSerde +} + +// Associate Agent Knowledge Base Response +type AssociateAgentKnowledgeBaseOutput struct { + + // Contains the information of an Agent Knowledge Base. + // + // This member is required. + AgentKnowledgeBase *types.AgentKnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAssociateAgentKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpAssociateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAssociateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateAgentKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpAssociateAgentKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateAgentKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opAssociateAgentKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "AssociateAgentKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_CreateAgent.go b/service/bedrockagent/api_op_CreateAgent.go new file mode 100644 index 00000000000..86f40541033 --- /dev/null +++ b/service/bedrockagent/api_op_CreateAgent.go @@ -0,0 +1,206 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Bedrock Agent +func (c *Client) CreateAgent(ctx context.Context, params *CreateAgentInput, optFns ...func(*Options)) (*CreateAgentOutput, error) { + if params == nil { + params = &CreateAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAgent", params, optFns, c.addOperationCreateAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Create Agent Request +type CreateAgentInput struct { + + // Name for a resource. + // + // This member is required. + AgentName *string + + // ARN of a IAM role. + // + // This member is required. + AgentResourceRoleArn *string + + // Client specified token used for idempotency checks + ClientToken *string + + // A KMS key ARN + CustomerEncryptionKeyArn *string + + // Description of the Resource. + Description *string + + // ARN or name of a Bedrock model. + FoundationModel *string + + // Max Session Time. + IdleSessionTTLInSeconds *int32 + + // Instruction for the agent. + Instruction *string + + // Configuration for prompt override. + PromptOverrideConfiguration *types.PromptOverrideConfiguration + + // A map of tag keys and values + Tags map[string]string + + noSmithyDocumentSerde +} + +// Create Agent Response +type CreateAgentOutput struct { + + // Contains the information of an agent + // + // This member is required. + Agent *types.Agent + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateAgentMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateAgent struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateAgent) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateAgent) 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.(*CreateAgentInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAgentInput ") + } + + 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_opCreateAgentMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAgent{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateAgent", + } +} diff --git a/service/bedrockagent/api_op_CreateAgentActionGroup.go b/service/bedrockagent/api_op_CreateAgentActionGroup.go new file mode 100644 index 00000000000..a32841831c2 --- /dev/null +++ b/service/bedrockagent/api_op_CreateAgentActionGroup.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Action Group for existing Amazon Bedrock Agent +func (c *Client) CreateAgentActionGroup(ctx context.Context, params *CreateAgentActionGroupInput, optFns ...func(*Options)) (*CreateAgentActionGroupOutput, error) { + if params == nil { + params = &CreateAgentActionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAgentActionGroup", params, optFns, c.addOperationCreateAgentActionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAgentActionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Create Action Group Request +type CreateAgentActionGroupInput struct { + + // Name for a resource. + // + // This member is required. + ActionGroupName *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Type of Executors for an Action Group + ActionGroupExecutor types.ActionGroupExecutor + + // State of the action group + ActionGroupState types.ActionGroupState + + // Contains information about the API Schema for the Action Group + ApiSchema types.APISchema + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + // Action Group Signature for a BuiltIn Action + ParentActionGroupSignature types.ActionGroupSignature + + noSmithyDocumentSerde +} + +// Create Action Group Response +type CreateAgentActionGroupOutput struct { + + // Contains the information of an Agent Action Group + // + // This member is required. + AgentActionGroup *types.AgentActionGroup + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAgentActionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAgentActionGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateAgentActionGroupMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateAgentActionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAgentActionGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateAgentActionGroup struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateAgentActionGroup) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateAgentActionGroup) 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.(*CreateAgentActionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAgentActionGroupInput ") + } + + 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_opCreateAgentActionGroupMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAgentActionGroup{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateAgentActionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateAgentActionGroup", + } +} diff --git a/service/bedrockagent/api_op_CreateAgentAlias.go b/service/bedrockagent/api_op_CreateAgentAlias.go new file mode 100644 index 00000000000..f31dd99156a --- /dev/null +++ b/service/bedrockagent/api_op_CreateAgentAlias.go @@ -0,0 +1,194 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Alias for an existing Amazon Bedrock Agent +func (c *Client) CreateAgentAlias(ctx context.Context, params *CreateAgentAliasInput, optFns ...func(*Options)) (*CreateAgentAliasOutput, error) { + if params == nil { + params = &CreateAgentAliasInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAgentAlias", params, optFns, c.addOperationCreateAgentAliasMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAgentAliasOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Create Agent Alias Request +type CreateAgentAliasInput struct { + + // Name for a resource. + // + // This member is required. + AgentAliasName *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + // Routing configuration for an Agent alias. + RoutingConfiguration []types.AgentAliasRoutingConfigurationListItem + + // A map of tag keys and values + Tags map[string]string + + noSmithyDocumentSerde +} + +// Create Agent Alias Response +type CreateAgentAliasOutput struct { + + // Contains the information of an agent alias + // + // This member is required. + AgentAlias *types.AgentAlias + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAgentAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAgentAlias{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAgentAlias{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAgentAlias"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateAgentAliasMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateAgentAliasValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAgentAlias(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateAgentAlias struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateAgentAlias) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateAgentAlias) 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.(*CreateAgentAliasInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAgentAliasInput ") + } + + 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_opCreateAgentAliasMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAgentAlias{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateAgentAlias(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateAgentAlias", + } +} diff --git a/service/bedrockagent/api_op_CreateDataSource.go b/service/bedrockagent/api_op_CreateDataSource.go new file mode 100644 index 00000000000..40e2c09e697 --- /dev/null +++ b/service/bedrockagent/api_op_CreateDataSource.go @@ -0,0 +1,197 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Create a new data source +func (c *Client) CreateDataSource(ctx context.Context, params *CreateDataSourceInput, optFns ...func(*Options)) (*CreateDataSourceOutput, error) { + if params == nil { + params = &CreateDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateDataSource", params, optFns, c.addOperationCreateDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateDataSourceInput struct { + + // Specifies a raw data source location to ingest. + // + // This member is required. + DataSourceConfiguration *types.DataSourceConfiguration + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + // Server-side encryption configuration. + ServerSideEncryptionConfiguration *types.ServerSideEncryptionConfiguration + + // Configures ingestion for a vector knowledge base + VectorIngestionConfiguration *types.VectorIngestionConfiguration + + noSmithyDocumentSerde +} + +type CreateDataSourceOutput struct { + + // Contains the information of a data source. + // + // This member is required. + DataSource *types.DataSource + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateDataSourceMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateDataSource struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateDataSource) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateDataSource) 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.(*CreateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateDataSourceInput ") + } + + 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_opCreateDataSourceMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateDataSource{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateDataSource", + } +} diff --git a/service/bedrockagent/api_op_CreateKnowledgeBase.go b/service/bedrockagent/api_op_CreateKnowledgeBase.go new file mode 100644 index 00000000000..7abb5f45e40 --- /dev/null +++ b/service/bedrockagent/api_op_CreateKnowledgeBase.go @@ -0,0 +1,199 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Create a new knowledge base +func (c *Client) CreateKnowledgeBase(ctx context.Context, params *CreateKnowledgeBaseInput, optFns ...func(*Options)) (*CreateKnowledgeBaseOutput, error) { + if params == nil { + params = &CreateKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateKnowledgeBase", params, optFns, c.addOperationCreateKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateKnowledgeBaseInput struct { + + // Configures a bedrock knowledge base. + // + // This member is required. + KnowledgeBaseConfiguration *types.KnowledgeBaseConfiguration + + // Name for a resource. + // + // This member is required. + Name *string + + // ARN of a IAM role. + // + // This member is required. + RoleArn *string + + // Configures the physical storage of ingested data in a knowledge base. + // + // This member is required. + StorageConfiguration *types.StorageConfiguration + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + // A map of tag keys and values + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateKnowledgeBaseOutput struct { + + // Contains the information of a knowledge base. + // + // This member is required. + KnowledgeBase *types.KnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateKnowledgeBaseMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateKnowledgeBase struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateKnowledgeBase) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateKnowledgeBase) 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.(*CreateKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateKnowledgeBaseInput ") + } + + 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_opCreateKnowledgeBaseMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateKnowledgeBase{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_DeleteAgent.go b/service/bedrockagent/api_op_DeleteAgent.go new file mode 100644 index 00000000000..0e6f4024b89 --- /dev/null +++ b/service/bedrockagent/api_op_DeleteAgent.go @@ -0,0 +1,149 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Agent for existing Amazon Bedrock Agent +func (c *Client) DeleteAgent(ctx context.Context, params *DeleteAgentInput, optFns ...func(*Options)) (*DeleteAgentOutput, error) { + if params == nil { + params = &DeleteAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAgent", params, optFns, c.addOperationDeleteAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Delete Agent Request +type DeleteAgentInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Skips checking if resource is in use when set to true. Defaults to false + SkipResourceInUseCheck bool + + noSmithyDocumentSerde +} + +// Delete Agent Response +type DeleteAgentOutput struct { + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus types.AgentStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAgent", + } +} diff --git a/service/bedrockagent/api_op_DeleteAgentActionGroup.go b/service/bedrockagent/api_op_DeleteAgentActionGroup.go new file mode 100644 index 00000000000..0e167c74cd7 --- /dev/null +++ b/service/bedrockagent/api_op_DeleteAgentActionGroup.go @@ -0,0 +1,147 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Action Group for existing Amazon Bedrock Agent. +func (c *Client) DeleteAgentActionGroup(ctx context.Context, params *DeleteAgentActionGroupInput, optFns ...func(*Options)) (*DeleteAgentActionGroupOutput, error) { + if params == nil { + params = &DeleteAgentActionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAgentActionGroup", params, optFns, c.addOperationDeleteAgentActionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAgentActionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Delete Action Group Request +type DeleteAgentActionGroupInput struct { + + // Id generated at the server side when an Agent ActionGroup is created + // + // This member is required. + ActionGroupId *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Skips checking if resource is in use when set to true. Defaults to false + SkipResourceInUseCheck bool + + noSmithyDocumentSerde +} + +// Delete Action Group Response +type DeleteAgentActionGroupOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAgentActionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAgentActionGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAgentActionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAgentActionGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAgentActionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAgentActionGroup", + } +} diff --git a/service/bedrockagent/api_op_DeleteAgentAlias.go b/service/bedrockagent/api_op_DeleteAgentAlias.go new file mode 100644 index 00000000000..275a7fd93ac --- /dev/null +++ b/service/bedrockagent/api_op_DeleteAgentAlias.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Alias for a Amazon Bedrock Agent +func (c *Client) DeleteAgentAlias(ctx context.Context, params *DeleteAgentAliasInput, optFns ...func(*Options)) (*DeleteAgentAliasOutput, error) { + if params == nil { + params = &DeleteAgentAliasInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAgentAlias", params, optFns, c.addOperationDeleteAgentAliasMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAgentAliasOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Delete Agent Alias Request +type DeleteAgentAliasInput struct { + + // Id generated at the server side when an Agent Alias is created + // + // This member is required. + AgentAliasId *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + noSmithyDocumentSerde +} + +// Delete Agent Alias Response +type DeleteAgentAliasOutput struct { + + // Id for an Agent Alias generated at the server side. + // + // This member is required. + AgentAliasId *string + + // The statuses an Agent Alias can be in. + // + // This member is required. + AgentAliasStatus types.AgentAliasStatus + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAgentAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAgentAlias{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAgentAlias{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAgentAlias"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAgentAliasValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAgentAlias(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAgentAlias(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAgentAlias", + } +} diff --git a/service/bedrockagent/api_op_DeleteAgentVersion.go b/service/bedrockagent/api_op_DeleteAgentVersion.go new file mode 100644 index 00000000000..afda66a2c73 --- /dev/null +++ b/service/bedrockagent/api_op_DeleteAgentVersion.go @@ -0,0 +1,159 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Agent version for existing Amazon Bedrock Agent +func (c *Client) DeleteAgentVersion(ctx context.Context, params *DeleteAgentVersionInput, optFns ...func(*Options)) (*DeleteAgentVersionOutput, error) { + if params == nil { + params = &DeleteAgentVersionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAgentVersion", params, optFns, c.addOperationDeleteAgentVersionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAgentVersionOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Delete Agent Version Request +type DeleteAgentVersionInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Numerical Agent Version. + // + // This member is required. + AgentVersion *string + + // Skips checking if resource is in use when set to true. Defaults to false + SkipResourceInUseCheck bool + + noSmithyDocumentSerde +} + +// Delete Agent Version Response +type DeleteAgentVersionOutput struct { + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus types.AgentStatus + + // Numerical Agent Version. + // + // This member is required. + AgentVersion *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAgentVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAgentVersion{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAgentVersion{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAgentVersion"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAgentVersionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAgentVersion(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAgentVersion(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAgentVersion", + } +} diff --git a/service/bedrockagent/api_op_DeleteDataSource.go b/service/bedrockagent/api_op_DeleteDataSource.go new file mode 100644 index 00000000000..048153b213e --- /dev/null +++ b/service/bedrockagent/api_op_DeleteDataSource.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Delete an existing data source +func (c *Client) DeleteDataSource(ctx context.Context, params *DeleteDataSourceInput, optFns ...func(*Options)) (*DeleteDataSourceOutput, error) { + if params == nil { + params = &DeleteDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteDataSource", params, optFns, c.addOperationDeleteDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteDataSourceInput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type DeleteDataSourceOutput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // The status of a data source. + // + // This member is required. + Status types.DataSourceStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteDataSource", + } +} diff --git a/service/bedrockagent/api_op_DeleteKnowledgeBase.go b/service/bedrockagent/api_op_DeleteKnowledgeBase.go new file mode 100644 index 00000000000..3431e778c6d --- /dev/null +++ b/service/bedrockagent/api_op_DeleteKnowledgeBase.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Delete an existing knowledge base +func (c *Client) DeleteKnowledgeBase(ctx context.Context, params *DeleteKnowledgeBaseInput, optFns ...func(*Options)) (*DeleteKnowledgeBaseOutput, error) { + if params == nil { + params = &DeleteKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteKnowledgeBase", params, optFns, c.addOperationDeleteKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteKnowledgeBaseInput struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type DeleteKnowledgeBaseOutput struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // The status of a knowledge base. + // + // This member is required. + Status types.KnowledgeBaseStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_DisassociateAgentKnowledgeBase.go b/service/bedrockagent/api_op_DisassociateAgentKnowledgeBase.go new file mode 100644 index 00000000000..445131add21 --- /dev/null +++ b/service/bedrockagent/api_op_DisassociateAgentKnowledgeBase.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disassociate an existing Knowledge Base from an Amazon Bedrock Agent +func (c *Client) DisassociateAgentKnowledgeBase(ctx context.Context, params *DisassociateAgentKnowledgeBaseInput, optFns ...func(*Options)) (*DisassociateAgentKnowledgeBaseOutput, error) { + if params == nil { + params = &DisassociateAgentKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateAgentKnowledgeBase", params, optFns, c.addOperationDisassociateAgentKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateAgentKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Disassociate Agent Knowledge Base Request +type DisassociateAgentKnowledgeBaseInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Id generated at the server side when a Knowledge Base is associated to an Agent + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +// Disassociate Agent Knowledge Base Response +type DisassociateAgentKnowledgeBaseOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateAgentKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisassociateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisassociateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateAgentKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDisassociateAgentKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateAgentKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDisassociateAgentKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DisassociateAgentKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_GetAgent.go b/service/bedrockagent/api_op_GetAgent.go new file mode 100644 index 00000000000..a327a975f96 --- /dev/null +++ b/service/bedrockagent/api_op_GetAgent.go @@ -0,0 +1,141 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets an Agent for existing Amazon Bedrock Agent +func (c *Client) GetAgent(ctx context.Context, params *GetAgentInput, optFns ...func(*Options)) (*GetAgentOutput, error) { + if params == nil { + params = &GetAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAgent", params, optFns, c.addOperationGetAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Get Agent Request +type GetAgentInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + noSmithyDocumentSerde +} + +// Get Agent Response +type GetAgentOutput struct { + + // Contains the information of an agent + // + // This member is required. + Agent *types.Agent + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAgent", + } +} diff --git a/service/bedrockagent/api_op_GetAgentActionGroup.go b/service/bedrockagent/api_op_GetAgentActionGroup.go new file mode 100644 index 00000000000..5b398dd02d1 --- /dev/null +++ b/service/bedrockagent/api_op_GetAgentActionGroup.go @@ -0,0 +1,151 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets an Action Group for existing Amazon Bedrock Agent Version +func (c *Client) GetAgentActionGroup(ctx context.Context, params *GetAgentActionGroupInput, optFns ...func(*Options)) (*GetAgentActionGroupOutput, error) { + if params == nil { + params = &GetAgentActionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAgentActionGroup", params, optFns, c.addOperationGetAgentActionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAgentActionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Get Action Group Request +type GetAgentActionGroupInput struct { + + // Id generated at the server side when an Agent Action Group is created + // + // This member is required. + ActionGroupId *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Version number generated when a version is created + // + // This member is required. + AgentVersion *string + + noSmithyDocumentSerde +} + +// Get Action Group Response +type GetAgentActionGroupOutput struct { + + // Contains the information of an Agent Action Group + // + // This member is required. + AgentActionGroup *types.AgentActionGroup + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAgentActionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAgentActionGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAgentActionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAgentActionGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAgentActionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAgentActionGroup", + } +} diff --git a/service/bedrockagent/api_op_GetAgentAlias.go b/service/bedrockagent/api_op_GetAgentAlias.go new file mode 100644 index 00000000000..c876e999bdb --- /dev/null +++ b/service/bedrockagent/api_op_GetAgentAlias.go @@ -0,0 +1,146 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Describes an Alias for a Amazon Bedrock Agent +func (c *Client) GetAgentAlias(ctx context.Context, params *GetAgentAliasInput, optFns ...func(*Options)) (*GetAgentAliasOutput, error) { + if params == nil { + params = &GetAgentAliasInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAgentAlias", params, optFns, c.addOperationGetAgentAliasMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAgentAliasOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Get Agent Alias Request +type GetAgentAliasInput struct { + + // Id generated at the server side when an Agent Alias is created + // + // This member is required. + AgentAliasId *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + noSmithyDocumentSerde +} + +// Get Agent Alias Response +type GetAgentAliasOutput struct { + + // Contains the information of an agent alias + // + // This member is required. + AgentAlias *types.AgentAlias + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAgentAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAgentAlias{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAgentAlias{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAgentAlias"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAgentAliasValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAgentAlias(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAgentAlias(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAgentAlias", + } +} diff --git a/service/bedrockagent/api_op_GetAgentKnowledgeBase.go b/service/bedrockagent/api_op_GetAgentKnowledgeBase.go new file mode 100644 index 00000000000..fc879b3c136 --- /dev/null +++ b/service/bedrockagent/api_op_GetAgentKnowledgeBase.go @@ -0,0 +1,151 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a knowledge base associated to an existing Amazon Bedrock Agent Version +func (c *Client) GetAgentKnowledgeBase(ctx context.Context, params *GetAgentKnowledgeBaseInput, optFns ...func(*Options)) (*GetAgentKnowledgeBaseOutput, error) { + if params == nil { + params = &GetAgentKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAgentKnowledgeBase", params, optFns, c.addOperationGetAgentKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAgentKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Get Agent Knowledge Base Request +type GetAgentKnowledgeBaseInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Version number generated when a version is created + // + // This member is required. + AgentVersion *string + + // Id generated at the server side when a Knowledge Base is associated + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +// Get Agent Knowledge Base Response +type GetAgentKnowledgeBaseOutput struct { + + // Contains the information of an Agent Knowledge Base. + // + // This member is required. + AgentKnowledgeBase *types.AgentKnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAgentKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAgentKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAgentKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAgentKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAgentKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAgentKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_GetAgentVersion.go b/service/bedrockagent/api_op_GetAgentVersion.go new file mode 100644 index 00000000000..ac70a92d6a5 --- /dev/null +++ b/service/bedrockagent/api_op_GetAgentVersion.go @@ -0,0 +1,146 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets an Agent version for existing Amazon Bedrock Agent +func (c *Client) GetAgentVersion(ctx context.Context, params *GetAgentVersionInput, optFns ...func(*Options)) (*GetAgentVersionOutput, error) { + if params == nil { + params = &GetAgentVersionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAgentVersion", params, optFns, c.addOperationGetAgentVersionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAgentVersionOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Get Agent Version Request +type GetAgentVersionInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Numerical Agent Version. + // + // This member is required. + AgentVersion *string + + noSmithyDocumentSerde +} + +// Get Agent Version Response +type GetAgentVersionOutput struct { + + // Contains the information of an agent version. + // + // This member is required. + AgentVersion *types.AgentVersion + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAgentVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAgentVersion{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAgentVersion{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAgentVersion"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAgentVersionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAgentVersion(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAgentVersion(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAgentVersion", + } +} diff --git a/service/bedrockagent/api_op_GetDataSource.go b/service/bedrockagent/api_op_GetDataSource.go new file mode 100644 index 00000000000..72b67711d7a --- /dev/null +++ b/service/bedrockagent/api_op_GetDataSource.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Get an existing data source +func (c *Client) GetDataSource(ctx context.Context, params *GetDataSourceInput, optFns ...func(*Options)) (*GetDataSourceOutput, error) { + if params == nil { + params = &GetDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetDataSource", params, optFns, c.addOperationGetDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetDataSourceInput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetDataSourceOutput struct { + + // Contains the information of a data source. + // + // This member is required. + DataSource *types.DataSource + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetDataSource", + } +} diff --git a/service/bedrockagent/api_op_GetIngestionJob.go b/service/bedrockagent/api_op_GetIngestionJob.go new file mode 100644 index 00000000000..325bcfee07e --- /dev/null +++ b/service/bedrockagent/api_op_GetIngestionJob.go @@ -0,0 +1,149 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Get an ingestion job +func (c *Client) GetIngestionJob(ctx context.Context, params *GetIngestionJobInput, optFns ...func(*Options)) (*GetIngestionJobOutput, error) { + if params == nil { + params = &GetIngestionJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetIngestionJob", params, optFns, c.addOperationGetIngestionJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetIngestionJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetIngestionJobInput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + IngestionJobId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetIngestionJobOutput struct { + + // Contains the information of an ingestion job. + // + // This member is required. + IngestionJob *types.IngestionJob + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetIngestionJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetIngestionJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetIngestionJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetIngestionJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetIngestionJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetIngestionJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetIngestionJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetIngestionJob", + } +} diff --git a/service/bedrockagent/api_op_GetKnowledgeBase.go b/service/bedrockagent/api_op_GetKnowledgeBase.go new file mode 100644 index 00000000000..4032afc1a8f --- /dev/null +++ b/service/bedrockagent/api_op_GetKnowledgeBase.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Get an existing knowledge base +func (c *Client) GetKnowledgeBase(ctx context.Context, params *GetKnowledgeBaseInput, optFns ...func(*Options)) (*GetKnowledgeBaseOutput, error) { + if params == nil { + params = &GetKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetKnowledgeBase", params, optFns, c.addOperationGetKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetKnowledgeBaseInput struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetKnowledgeBaseOutput struct { + + // Contains the information of a knowledge base. + // + // This member is required. + KnowledgeBase *types.KnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_ListAgentActionGroups.go b/service/bedrockagent/api_op_ListAgentActionGroups.go new file mode 100644 index 00000000000..444fc88b7ac --- /dev/null +++ b/service/bedrockagent/api_op_ListAgentActionGroups.go @@ -0,0 +1,246 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists an Action Group for existing Amazon Bedrock Agent Version +func (c *Client) ListAgentActionGroups(ctx context.Context, params *ListAgentActionGroupsInput, optFns ...func(*Options)) (*ListAgentActionGroupsOutput, error) { + if params == nil { + params = &ListAgentActionGroupsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAgentActionGroups", params, optFns, c.addOperationListAgentActionGroupsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAgentActionGroupsOutput) + out.ResultMetadata = metadata + return out, nil +} + +// List Action Groups Request +type ListAgentActionGroupsInput struct { + + // Id generated at the server side when an Agent is Listed + // + // This member is required. + AgentId *string + + // Id generated at the server side when an Agent is Listed + // + // This member is required. + AgentVersion *string + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +// List Action Groups Response +type ListAgentActionGroupsOutput struct { + + // List of ActionGroup Summaries + // + // This member is required. + ActionGroupSummaries []types.ActionGroupSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAgentActionGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAgentActionGroups{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAgentActionGroups{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAgentActionGroups"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAgentActionGroupsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAgentActionGroups(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAgentActionGroupsAPIClient is a client that implements the +// ListAgentActionGroups operation. +type ListAgentActionGroupsAPIClient interface { + ListAgentActionGroups(context.Context, *ListAgentActionGroupsInput, ...func(*Options)) (*ListAgentActionGroupsOutput, error) +} + +var _ ListAgentActionGroupsAPIClient = (*Client)(nil) + +// ListAgentActionGroupsPaginatorOptions is the paginator options for +// ListAgentActionGroups +type ListAgentActionGroupsPaginatorOptions struct { + // Max Results. + 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 +} + +// ListAgentActionGroupsPaginator is a paginator for ListAgentActionGroups +type ListAgentActionGroupsPaginator struct { + options ListAgentActionGroupsPaginatorOptions + client ListAgentActionGroupsAPIClient + params *ListAgentActionGroupsInput + nextToken *string + firstPage bool +} + +// NewListAgentActionGroupsPaginator returns a new ListAgentActionGroupsPaginator +func NewListAgentActionGroupsPaginator(client ListAgentActionGroupsAPIClient, params *ListAgentActionGroupsInput, optFns ...func(*ListAgentActionGroupsPaginatorOptions)) *ListAgentActionGroupsPaginator { + if params == nil { + params = &ListAgentActionGroupsInput{} + } + + options := ListAgentActionGroupsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAgentActionGroupsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAgentActionGroupsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAgentActionGroups page. +func (p *ListAgentActionGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAgentActionGroupsOutput, 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.ListAgentActionGroups(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_opListAgentActionGroups(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAgentActionGroups", + } +} diff --git a/service/bedrockagent/api_op_ListAgentAliases.go b/service/bedrockagent/api_op_ListAgentAliases.go new file mode 100644 index 00000000000..6bdf7a50ee2 --- /dev/null +++ b/service/bedrockagent/api_op_ListAgentAliases.go @@ -0,0 +1,240 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all the Aliases for an Amazon Bedrock Agent +func (c *Client) ListAgentAliases(ctx context.Context, params *ListAgentAliasesInput, optFns ...func(*Options)) (*ListAgentAliasesOutput, error) { + if params == nil { + params = &ListAgentAliasesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAgentAliases", params, optFns, c.addOperationListAgentAliasesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAgentAliasesOutput) + out.ResultMetadata = metadata + return out, nil +} + +// List Agent Aliases Request +type ListAgentAliasesInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +// List Agent Aliases Response +type ListAgentAliasesOutput struct { + + // The list of summaries of all the aliases for an Agent. + // + // This member is required. + AgentAliasSummaries []types.AgentAliasSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAgentAliasesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAgentAliases{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAgentAliases{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAgentAliases"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAgentAliasesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAgentAliases(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAgentAliasesAPIClient is a client that implements the ListAgentAliases +// operation. +type ListAgentAliasesAPIClient interface { + ListAgentAliases(context.Context, *ListAgentAliasesInput, ...func(*Options)) (*ListAgentAliasesOutput, error) +} + +var _ ListAgentAliasesAPIClient = (*Client)(nil) + +// ListAgentAliasesPaginatorOptions is the paginator options for ListAgentAliases +type ListAgentAliasesPaginatorOptions struct { + // Max Results. + 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 +} + +// ListAgentAliasesPaginator is a paginator for ListAgentAliases +type ListAgentAliasesPaginator struct { + options ListAgentAliasesPaginatorOptions + client ListAgentAliasesAPIClient + params *ListAgentAliasesInput + nextToken *string + firstPage bool +} + +// NewListAgentAliasesPaginator returns a new ListAgentAliasesPaginator +func NewListAgentAliasesPaginator(client ListAgentAliasesAPIClient, params *ListAgentAliasesInput, optFns ...func(*ListAgentAliasesPaginatorOptions)) *ListAgentAliasesPaginator { + if params == nil { + params = &ListAgentAliasesInput{} + } + + options := ListAgentAliasesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAgentAliasesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAgentAliasesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAgentAliases page. +func (p *ListAgentAliasesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAgentAliasesOutput, 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.ListAgentAliases(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_opListAgentAliases(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAgentAliases", + } +} diff --git a/service/bedrockagent/api_op_ListAgentKnowledgeBases.go b/service/bedrockagent/api_op_ListAgentKnowledgeBases.go new file mode 100644 index 00000000000..3704c1d4897 --- /dev/null +++ b/service/bedrockagent/api_op_ListAgentKnowledgeBases.go @@ -0,0 +1,247 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List of Knowledge Bases associated to an existing Amazon Bedrock Agent Version +func (c *Client) ListAgentKnowledgeBases(ctx context.Context, params *ListAgentKnowledgeBasesInput, optFns ...func(*Options)) (*ListAgentKnowledgeBasesOutput, error) { + if params == nil { + params = &ListAgentKnowledgeBasesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAgentKnowledgeBases", params, optFns, c.addOperationListAgentKnowledgeBasesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAgentKnowledgeBasesOutput) + out.ResultMetadata = metadata + return out, nil +} + +// List Agent Knowledge Bases Request +type ListAgentKnowledgeBasesInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Version number generated when a version is created + // + // This member is required. + AgentVersion *string + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +// List Agent Knowledge Bases Response +type ListAgentKnowledgeBasesOutput struct { + + // List of Agent Knowledge Base Summaries + // + // This member is required. + AgentKnowledgeBaseSummaries []types.AgentKnowledgeBaseSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAgentKnowledgeBasesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAgentKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAgentKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAgentKnowledgeBases"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAgentKnowledgeBasesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAgentKnowledgeBases(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAgentKnowledgeBasesAPIClient is a client that implements the +// ListAgentKnowledgeBases operation. +type ListAgentKnowledgeBasesAPIClient interface { + ListAgentKnowledgeBases(context.Context, *ListAgentKnowledgeBasesInput, ...func(*Options)) (*ListAgentKnowledgeBasesOutput, error) +} + +var _ ListAgentKnowledgeBasesAPIClient = (*Client)(nil) + +// ListAgentKnowledgeBasesPaginatorOptions is the paginator options for +// ListAgentKnowledgeBases +type ListAgentKnowledgeBasesPaginatorOptions struct { + // Max Results. + 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 +} + +// ListAgentKnowledgeBasesPaginator is a paginator for ListAgentKnowledgeBases +type ListAgentKnowledgeBasesPaginator struct { + options ListAgentKnowledgeBasesPaginatorOptions + client ListAgentKnowledgeBasesAPIClient + params *ListAgentKnowledgeBasesInput + nextToken *string + firstPage bool +} + +// NewListAgentKnowledgeBasesPaginator returns a new +// ListAgentKnowledgeBasesPaginator +func NewListAgentKnowledgeBasesPaginator(client ListAgentKnowledgeBasesAPIClient, params *ListAgentKnowledgeBasesInput, optFns ...func(*ListAgentKnowledgeBasesPaginatorOptions)) *ListAgentKnowledgeBasesPaginator { + if params == nil { + params = &ListAgentKnowledgeBasesInput{} + } + + options := ListAgentKnowledgeBasesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAgentKnowledgeBasesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAgentKnowledgeBasesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAgentKnowledgeBases page. +func (p *ListAgentKnowledgeBasesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAgentKnowledgeBasesOutput, 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.ListAgentKnowledgeBases(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_opListAgentKnowledgeBases(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAgentKnowledgeBases", + } +} diff --git a/service/bedrockagent/api_op_ListAgentVersions.go b/service/bedrockagent/api_op_ListAgentVersions.go new file mode 100644 index 00000000000..6cd307a5a3e --- /dev/null +++ b/service/bedrockagent/api_op_ListAgentVersions.go @@ -0,0 +1,240 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists Agent Versions +func (c *Client) ListAgentVersions(ctx context.Context, params *ListAgentVersionsInput, optFns ...func(*Options)) (*ListAgentVersionsOutput, error) { + if params == nil { + params = &ListAgentVersionsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAgentVersions", params, optFns, c.addOperationListAgentVersionsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAgentVersionsOutput) + out.ResultMetadata = metadata + return out, nil +} + +// List Agent Versions Request +type ListAgentVersionsInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +// List Agent Versions Response +type ListAgentVersionsOutput struct { + + // List of AgentVersionSummary. + // + // This member is required. + AgentVersionSummaries []types.AgentVersionSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAgentVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAgentVersions{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAgentVersions{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAgentVersions"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAgentVersionsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAgentVersions(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAgentVersionsAPIClient is a client that implements the ListAgentVersions +// operation. +type ListAgentVersionsAPIClient interface { + ListAgentVersions(context.Context, *ListAgentVersionsInput, ...func(*Options)) (*ListAgentVersionsOutput, error) +} + +var _ ListAgentVersionsAPIClient = (*Client)(nil) + +// ListAgentVersionsPaginatorOptions is the paginator options for ListAgentVersions +type ListAgentVersionsPaginatorOptions struct { + // Max Results. + 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 +} + +// ListAgentVersionsPaginator is a paginator for ListAgentVersions +type ListAgentVersionsPaginator struct { + options ListAgentVersionsPaginatorOptions + client ListAgentVersionsAPIClient + params *ListAgentVersionsInput + nextToken *string + firstPage bool +} + +// NewListAgentVersionsPaginator returns a new ListAgentVersionsPaginator +func NewListAgentVersionsPaginator(client ListAgentVersionsAPIClient, params *ListAgentVersionsInput, optFns ...func(*ListAgentVersionsPaginatorOptions)) *ListAgentVersionsPaginator { + if params == nil { + params = &ListAgentVersionsInput{} + } + + options := ListAgentVersionsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAgentVersionsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAgentVersionsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAgentVersions page. +func (p *ListAgentVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAgentVersionsOutput, 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.ListAgentVersions(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_opListAgentVersions(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAgentVersions", + } +} diff --git a/service/bedrockagent/api_op_ListAgents.go b/service/bedrockagent/api_op_ListAgents.go new file mode 100644 index 00000000000..7b75a9b0c46 --- /dev/null +++ b/service/bedrockagent/api_op_ListAgents.go @@ -0,0 +1,231 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists Agents +func (c *Client) ListAgents(ctx context.Context, params *ListAgentsInput, optFns ...func(*Options)) (*ListAgentsOutput, error) { + if params == nil { + params = &ListAgentsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAgents", params, optFns, c.addOperationListAgentsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAgentsOutput) + out.ResultMetadata = metadata + return out, nil +} + +// List Agent Request +type ListAgentsInput struct { + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +// List Agent Response +type ListAgentsOutput struct { + + // List of AgentSummary. + // + // This member is required. + AgentSummaries []types.AgentSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAgentsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAgents{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAgents{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAgents"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAgents(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAgentsAPIClient is a client that implements the ListAgents operation. +type ListAgentsAPIClient interface { + ListAgents(context.Context, *ListAgentsInput, ...func(*Options)) (*ListAgentsOutput, error) +} + +var _ ListAgentsAPIClient = (*Client)(nil) + +// ListAgentsPaginatorOptions is the paginator options for ListAgents +type ListAgentsPaginatorOptions struct { + // Max Results. + 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 +} + +// ListAgentsPaginator is a paginator for ListAgents +type ListAgentsPaginator struct { + options ListAgentsPaginatorOptions + client ListAgentsAPIClient + params *ListAgentsInput + nextToken *string + firstPage bool +} + +// NewListAgentsPaginator returns a new ListAgentsPaginator +func NewListAgentsPaginator(client ListAgentsAPIClient, params *ListAgentsInput, optFns ...func(*ListAgentsPaginatorOptions)) *ListAgentsPaginator { + if params == nil { + params = &ListAgentsInput{} + } + + options := ListAgentsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAgentsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAgentsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAgents page. +func (p *ListAgentsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAgentsOutput, 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.ListAgents(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_opListAgents(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAgents", + } +} diff --git a/service/bedrockagent/api_op_ListDataSources.go b/service/bedrockagent/api_op_ListDataSources.go new file mode 100644 index 00000000000..2517a24bece --- /dev/null +++ b/service/bedrockagent/api_op_ListDataSources.go @@ -0,0 +1,238 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List data sources +func (c *Client) ListDataSources(ctx context.Context, params *ListDataSourcesInput, optFns ...func(*Options)) (*ListDataSourcesOutput, error) { + if params == nil { + params = &ListDataSourcesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListDataSources", params, optFns, c.addOperationListDataSourcesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListDataSourcesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListDataSourcesInput struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +type ListDataSourcesOutput struct { + + // list of data source summaries + // + // This member is required. + DataSourceSummaries []types.DataSourceSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListDataSourcesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListDataSources{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListDataSources{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListDataSources"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListDataSourcesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDataSources(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListDataSourcesAPIClient is a client that implements the ListDataSources +// operation. +type ListDataSourcesAPIClient interface { + ListDataSources(context.Context, *ListDataSourcesInput, ...func(*Options)) (*ListDataSourcesOutput, error) +} + +var _ ListDataSourcesAPIClient = (*Client)(nil) + +// ListDataSourcesPaginatorOptions is the paginator options for ListDataSources +type ListDataSourcesPaginatorOptions struct { + // Max Results. + 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 +} + +// ListDataSourcesPaginator is a paginator for ListDataSources +type ListDataSourcesPaginator struct { + options ListDataSourcesPaginatorOptions + client ListDataSourcesAPIClient + params *ListDataSourcesInput + nextToken *string + firstPage bool +} + +// NewListDataSourcesPaginator returns a new ListDataSourcesPaginator +func NewListDataSourcesPaginator(client ListDataSourcesAPIClient, params *ListDataSourcesInput, optFns ...func(*ListDataSourcesPaginatorOptions)) *ListDataSourcesPaginator { + if params == nil { + params = &ListDataSourcesInput{} + } + + options := ListDataSourcesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListDataSourcesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListDataSourcesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListDataSources page. +func (p *ListDataSourcesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDataSourcesOutput, 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.ListDataSources(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_opListDataSources(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListDataSources", + } +} diff --git a/service/bedrockagent/api_op_ListIngestionJobs.go b/service/bedrockagent/api_op_ListIngestionJobs.go new file mode 100644 index 00000000000..e1c53b81f1f --- /dev/null +++ b/service/bedrockagent/api_op_ListIngestionJobs.go @@ -0,0 +1,249 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List ingestion jobs +func (c *Client) ListIngestionJobs(ctx context.Context, params *ListIngestionJobsInput, optFns ...func(*Options)) (*ListIngestionJobsOutput, error) { + if params == nil { + params = &ListIngestionJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListIngestionJobs", params, optFns, c.addOperationListIngestionJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListIngestionJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListIngestionJobsInput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // List of IngestionJobFilters + Filters []types.IngestionJobFilter + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Sorts the response returned by ListIngestionJobs operation. + SortBy *types.IngestionJobSortBy + + noSmithyDocumentSerde +} + +type ListIngestionJobsOutput struct { + + // List of IngestionJobSummaries + // + // This member is required. + IngestionJobSummaries []types.IngestionJobSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListIngestionJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListIngestionJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListIngestionJobs{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListIngestionJobs"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListIngestionJobsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListIngestionJobs(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListIngestionJobsAPIClient is a client that implements the ListIngestionJobs +// operation. +type ListIngestionJobsAPIClient interface { + ListIngestionJobs(context.Context, *ListIngestionJobsInput, ...func(*Options)) (*ListIngestionJobsOutput, error) +} + +var _ ListIngestionJobsAPIClient = (*Client)(nil) + +// ListIngestionJobsPaginatorOptions is the paginator options for ListIngestionJobs +type ListIngestionJobsPaginatorOptions struct { + // Max Results. + 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 +} + +// ListIngestionJobsPaginator is a paginator for ListIngestionJobs +type ListIngestionJobsPaginator struct { + options ListIngestionJobsPaginatorOptions + client ListIngestionJobsAPIClient + params *ListIngestionJobsInput + nextToken *string + firstPage bool +} + +// NewListIngestionJobsPaginator returns a new ListIngestionJobsPaginator +func NewListIngestionJobsPaginator(client ListIngestionJobsAPIClient, params *ListIngestionJobsInput, optFns ...func(*ListIngestionJobsPaginatorOptions)) *ListIngestionJobsPaginator { + if params == nil { + params = &ListIngestionJobsInput{} + } + + options := ListIngestionJobsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListIngestionJobsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListIngestionJobsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListIngestionJobs page. +func (p *ListIngestionJobsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListIngestionJobsOutput, 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.ListIngestionJobs(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_opListIngestionJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListIngestionJobs", + } +} diff --git a/service/bedrockagent/api_op_ListKnowledgeBases.go b/service/bedrockagent/api_op_ListKnowledgeBases.go new file mode 100644 index 00000000000..1e3681bce1d --- /dev/null +++ b/service/bedrockagent/api_op_ListKnowledgeBases.go @@ -0,0 +1,231 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List Knowledge Bases +func (c *Client) ListKnowledgeBases(ctx context.Context, params *ListKnowledgeBasesInput, optFns ...func(*Options)) (*ListKnowledgeBasesOutput, error) { + if params == nil { + params = &ListKnowledgeBasesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListKnowledgeBases", params, optFns, c.addOperationListKnowledgeBasesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListKnowledgeBasesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListKnowledgeBasesInput struct { + + // Max Results. + MaxResults *int32 + + // Opaque continuation token of previous paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +type ListKnowledgeBasesOutput struct { + + // List of KnowledgeBaseSummaries + // + // This member is required. + KnowledgeBaseSummaries []types.KnowledgeBaseSummary + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListKnowledgeBasesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListKnowledgeBases"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListKnowledgeBases(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListKnowledgeBasesAPIClient is a client that implements the ListKnowledgeBases +// operation. +type ListKnowledgeBasesAPIClient interface { + ListKnowledgeBases(context.Context, *ListKnowledgeBasesInput, ...func(*Options)) (*ListKnowledgeBasesOutput, error) +} + +var _ ListKnowledgeBasesAPIClient = (*Client)(nil) + +// ListKnowledgeBasesPaginatorOptions is the paginator options for +// ListKnowledgeBases +type ListKnowledgeBasesPaginatorOptions struct { + // Max Results. + 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 +} + +// ListKnowledgeBasesPaginator is a paginator for ListKnowledgeBases +type ListKnowledgeBasesPaginator struct { + options ListKnowledgeBasesPaginatorOptions + client ListKnowledgeBasesAPIClient + params *ListKnowledgeBasesInput + nextToken *string + firstPage bool +} + +// NewListKnowledgeBasesPaginator returns a new ListKnowledgeBasesPaginator +func NewListKnowledgeBasesPaginator(client ListKnowledgeBasesAPIClient, params *ListKnowledgeBasesInput, optFns ...func(*ListKnowledgeBasesPaginatorOptions)) *ListKnowledgeBasesPaginator { + if params == nil { + params = &ListKnowledgeBasesInput{} + } + + options := ListKnowledgeBasesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListKnowledgeBasesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListKnowledgeBasesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListKnowledgeBases page. +func (p *ListKnowledgeBasesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListKnowledgeBasesOutput, 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.ListKnowledgeBases(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_opListKnowledgeBases(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListKnowledgeBases", + } +} diff --git a/service/bedrockagent/api_op_ListTagsForResource.go b/service/bedrockagent/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..0e2cab79557 --- /dev/null +++ b/service/bedrockagent/api_op_ListTagsForResource.go @@ -0,0 +1,136 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List tags for a 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 { + + // ARN of Taggable resources: [Agent, AgentAlias, Knowledge-Base] + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // A map of tag keys and values + 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListTagsForResource", + } +} diff --git a/service/bedrockagent/api_op_PrepareAgent.go b/service/bedrockagent/api_op_PrepareAgent.go new file mode 100644 index 00000000000..dcd71e78409 --- /dev/null +++ b/service/bedrockagent/api_op_PrepareAgent.go @@ -0,0 +1,157 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Prepares an existing Amazon Bedrock Agent to receive runtime requests +func (c *Client) PrepareAgent(ctx context.Context, params *PrepareAgentInput, optFns ...func(*Options)) (*PrepareAgentOutput, error) { + if params == nil { + params = &PrepareAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PrepareAgent", params, optFns, c.addOperationPrepareAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PrepareAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// PrepareAgent Request +type PrepareAgentInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + noSmithyDocumentSerde +} + +// PrepareAgent Response +type PrepareAgentOutput struct { + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus types.AgentStatus + + // Agent Version. + // + // This member is required. + AgentVersion *string + + // Time Stamp. + // + // This member is required. + PreparedAt *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPrepareAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpPrepareAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPrepareAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PrepareAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpPrepareAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPrepareAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opPrepareAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PrepareAgent", + } +} diff --git a/service/bedrockagent/api_op_StartIngestionJob.go b/service/bedrockagent/api_op_StartIngestionJob.go new file mode 100644 index 00000000000..61c61307650 --- /dev/null +++ b/service/bedrockagent/api_op_StartIngestionJob.go @@ -0,0 +1,186 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Start a new ingestion job +func (c *Client) StartIngestionJob(ctx context.Context, params *StartIngestionJobInput, optFns ...func(*Options)) (*StartIngestionJobOutput, error) { + if params == nil { + params = &StartIngestionJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartIngestionJob", params, optFns, c.addOperationStartIngestionJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartIngestionJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartIngestionJobInput struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +type StartIngestionJobOutput struct { + + // Contains the information of an ingestion job. + // + // This member is required. + IngestionJob *types.IngestionJob + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartIngestionJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartIngestionJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartIngestionJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartIngestionJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opStartIngestionJobMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartIngestionJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartIngestionJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpStartIngestionJob struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpStartIngestionJob) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpStartIngestionJob) 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.(*StartIngestionJobInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *StartIngestionJobInput ") + } + + 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_opStartIngestionJobMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpStartIngestionJob{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opStartIngestionJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartIngestionJob", + } +} diff --git a/service/bedrockagent/api_op_TagResource.go b/service/bedrockagent/api_op_TagResource.go new file mode 100644 index 00000000000..b013b063c17 --- /dev/null +++ b/service/bedrockagent/api_op_TagResource.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Tag a 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 { + + // ARN of Taggable resources: [Agent, AgentAlias, Knowledge-Base] + // + // This member is required. + ResourceArn *string + + // A map of tag keys and values + // + // 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "TagResource", + } +} diff --git a/service/bedrockagent/api_op_UntagResource.go b/service/bedrockagent/api_op_UntagResource.go new file mode 100644 index 00000000000..d375f7883e5 --- /dev/null +++ b/service/bedrockagent/api_op_UntagResource.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Untag a 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 { + + // ARN of Taggable resources: [Agent, AgentAlias, Knowledge-Base] + // + // This member is required. + ResourceArn *string + + // List of Tag Keys + // + // 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UntagResource", + } +} diff --git a/service/bedrockagent/api_op_UpdateAgent.go b/service/bedrockagent/api_op_UpdateAgent.go new file mode 100644 index 00000000000..f092130cbdf --- /dev/null +++ b/service/bedrockagent/api_op_UpdateAgent.go @@ -0,0 +1,169 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Amazon Bedrock Agent +func (c *Client) UpdateAgent(ctx context.Context, params *UpdateAgentInput, optFns ...func(*Options)) (*UpdateAgentOutput, error) { + if params == nil { + params = &UpdateAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateAgent", params, optFns, c.addOperationUpdateAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Update Agent Request +type UpdateAgentInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Name for a resource. + // + // This member is required. + AgentName *string + + // ARN of a IAM role. + // + // This member is required. + AgentResourceRoleArn *string + + // A KMS key ARN + CustomerEncryptionKeyArn *string + + // Description of the Resource. + Description *string + + // ARN or name of a Bedrock model. + FoundationModel *string + + // Max Session Time. + IdleSessionTTLInSeconds *int32 + + // Instruction for the agent. + Instruction *string + + // Configuration for prompt override. + PromptOverrideConfiguration *types.PromptOverrideConfiguration + + noSmithyDocumentSerde +} + +// Update Agent Response +type UpdateAgentOutput struct { + + // Contains the information of an agent + // + // This member is required. + Agent *types.Agent + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateAgent", + } +} diff --git a/service/bedrockagent/api_op_UpdateAgentActionGroup.go b/service/bedrockagent/api_op_UpdateAgentActionGroup.go new file mode 100644 index 00000000000..f81c1ae2042 --- /dev/null +++ b/service/bedrockagent/api_op_UpdateAgentActionGroup.go @@ -0,0 +1,171 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Action Group for Amazon Bedrock Agent +func (c *Client) UpdateAgentActionGroup(ctx context.Context, params *UpdateAgentActionGroupInput, optFns ...func(*Options)) (*UpdateAgentActionGroupOutput, error) { + if params == nil { + params = &UpdateAgentActionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateAgentActionGroup", params, optFns, c.addOperationUpdateAgentActionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateAgentActionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Update Action Group Request +type UpdateAgentActionGroupInput struct { + + // Id generated at the server side when an Action Group is created under Agent + // + // This member is required. + ActionGroupId *string + + // Name for a resource. + // + // This member is required. + ActionGroupName *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Type of Executors for an Action Group + ActionGroupExecutor types.ActionGroupExecutor + + // State of the action group + ActionGroupState types.ActionGroupState + + // Contains information about the API Schema for the Action Group + ApiSchema types.APISchema + + // Description of the Resource. + Description *string + + // Action Group Signature for a BuiltIn Action + ParentActionGroupSignature types.ActionGroupSignature + + noSmithyDocumentSerde +} + +// Update Action Group Response +type UpdateAgentActionGroupOutput struct { + + // Contains the information of an Agent Action Group + // + // This member is required. + AgentActionGroup *types.AgentActionGroup + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateAgentActionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAgentActionGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAgentActionGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateAgentActionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAgentActionGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateAgentActionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateAgentActionGroup", + } +} diff --git a/service/bedrockagent/api_op_UpdateAgentAlias.go b/service/bedrockagent/api_op_UpdateAgentAlias.go new file mode 100644 index 00000000000..630004b2f48 --- /dev/null +++ b/service/bedrockagent/api_op_UpdateAgentAlias.go @@ -0,0 +1,157 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Alias for an Amazon Bedrock Agent +func (c *Client) UpdateAgentAlias(ctx context.Context, params *UpdateAgentAliasInput, optFns ...func(*Options)) (*UpdateAgentAliasOutput, error) { + if params == nil { + params = &UpdateAgentAliasInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateAgentAlias", params, optFns, c.addOperationUpdateAgentAliasMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateAgentAliasOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Update Agent Alias Request +type UpdateAgentAliasInput struct { + + // Id generated at the server side when an Agent Alias is created + // + // This member is required. + AgentAliasId *string + + // Name for a resource. + // + // This member is required. + AgentAliasName *string + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Description of the Resource. + Description *string + + // Routing configuration for an Agent alias. + RoutingConfiguration []types.AgentAliasRoutingConfigurationListItem + + noSmithyDocumentSerde +} + +// Update Agent Alias Response +type UpdateAgentAliasOutput struct { + + // Contains the information of an agent alias + // + // This member is required. + AgentAlias *types.AgentAlias + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateAgentAliasMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAgentAlias{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAgentAlias{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAgentAlias"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateAgentAliasValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAgentAlias(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateAgentAlias(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateAgentAlias", + } +} diff --git a/service/bedrockagent/api_op_UpdateAgentKnowledgeBase.go b/service/bedrockagent/api_op_UpdateAgentKnowledgeBase.go new file mode 100644 index 00000000000..d510c7ef755 --- /dev/null +++ b/service/bedrockagent/api_op_UpdateAgentKnowledgeBase.go @@ -0,0 +1,157 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Knowledge Base associated to an Amazon Bedrock Agent +func (c *Client) UpdateAgentKnowledgeBase(ctx context.Context, params *UpdateAgentKnowledgeBaseInput, optFns ...func(*Options)) (*UpdateAgentKnowledgeBaseOutput, error) { + if params == nil { + params = &UpdateAgentKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateAgentKnowledgeBase", params, optFns, c.addOperationUpdateAgentKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateAgentKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +// Update Agent Knowledge Base Request +type UpdateAgentKnowledgeBaseInput struct { + + // Id generated at the server side when an Agent is created + // + // This member is required. + AgentId *string + + // Draft Version of the Agent. + // + // This member is required. + AgentVersion *string + + // Id generated at the server side when a Knowledge Base is associated to an Agent + // + // This member is required. + KnowledgeBaseId *string + + // Description of the Resource. + Description *string + + // State of the knowledge base; whether it is enabled or disabled + KnowledgeBaseState types.KnowledgeBaseState + + noSmithyDocumentSerde +} + +// Update Agent Knowledge Base Response +type UpdateAgentKnowledgeBaseOutput struct { + + // Contains the information of an Agent Knowledge Base. + // + // This member is required. + AgentKnowledgeBase *types.AgentKnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateAgentKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAgentKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAgentKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateAgentKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAgentKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateAgentKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateAgentKnowledgeBase", + } +} diff --git a/service/bedrockagent/api_op_UpdateDataSource.go b/service/bedrockagent/api_op_UpdateDataSource.go new file mode 100644 index 00000000000..c1a929c85fb --- /dev/null +++ b/service/bedrockagent/api_op_UpdateDataSource.go @@ -0,0 +1,163 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Update an existing data source +func (c *Client) UpdateDataSource(ctx context.Context, params *UpdateDataSourceInput, optFns ...func(*Options)) (*UpdateDataSourceOutput, error) { + if params == nil { + params = &UpdateDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateDataSource", params, optFns, c.addOperationUpdateDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateDataSourceInput struct { + + // Specifies a raw data source location to ingest. + // + // This member is required. + DataSourceConfiguration *types.DataSourceConfiguration + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // Description of the Resource. + Description *string + + // Server-side encryption configuration. + ServerSideEncryptionConfiguration *types.ServerSideEncryptionConfiguration + + // Configures ingestion for a vector knowledge base + VectorIngestionConfiguration *types.VectorIngestionConfiguration + + noSmithyDocumentSerde +} + +type UpdateDataSourceOutput struct { + + // Contains the information of a data source. + // + // This member is required. + DataSource *types.DataSource + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateDataSource", + } +} diff --git a/service/bedrockagent/api_op_UpdateKnowledgeBase.go b/service/bedrockagent/api_op_UpdateKnowledgeBase.go new file mode 100644 index 00000000000..e3f488932d1 --- /dev/null +++ b/service/bedrockagent/api_op_UpdateKnowledgeBase.go @@ -0,0 +1,162 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Update an existing knowledge base +func (c *Client) UpdateKnowledgeBase(ctx context.Context, params *UpdateKnowledgeBaseInput, optFns ...func(*Options)) (*UpdateKnowledgeBaseOutput, error) { + if params == nil { + params = &UpdateKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateKnowledgeBase", params, optFns, c.addOperationUpdateKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateKnowledgeBaseInput struct { + + // Configures a bedrock knowledge base. + // + // This member is required. + KnowledgeBaseConfiguration *types.KnowledgeBaseConfiguration + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // ARN of a IAM role. + // + // This member is required. + RoleArn *string + + // Configures the physical storage of ingested data in a knowledge base. + // + // This member is required. + StorageConfiguration *types.StorageConfiguration + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +type UpdateKnowledgeBaseOutput struct { + + // Contains the information of a knowledge base. + // + // This member is required. + KnowledgeBase *types.KnowledgeBase + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateKnowledgeBase", + } +} diff --git a/service/bedrockagent/auth.go b/service/bedrockagent/auth.go new file mode 100644 index 00000000000..6040af199d7 --- /dev/null +++ b/service/bedrockagent/auth.go @@ -0,0 +1,256 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +func bindAuthParamsRegion(params *AuthResolverParameters, _ interface{}, options Options) { + params.Region = options.Region +} + +type setLegacyContextSigningOptionsMiddleware struct { +} + +func (*setLegacyContextSigningOptionsMiddleware) ID() string { + return "setLegacyContextSigningOptions" +} + +func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + schemeID := rscheme.Scheme.SchemeID() + + if sn := awsmiddleware.GetSigningName(ctx); sn != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) + } + } + + if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) + } + } + + return next.HandleFinalize(ctx, in) +} + +func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { + return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) +} + +// AuthResolverParameters contains the set of inputs necessary for auth scheme +// resolution. +type AuthResolverParameters struct { + // The name of the operation being invoked. + Operation string + + // The region in which the operation is being invoked. + Region string +} + +func bindAuthResolverParams(operation string, input interface{}, options Options) *AuthResolverParameters { + params := &AuthResolverParameters{ + Operation: operation, + } + + bindAuthParamsRegion(params, input, options) + + return params +} + +// AuthSchemeResolver returns a set of possible authentication options for an +// operation. +type AuthSchemeResolver interface { + ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) +} + +type defaultAuthSchemeResolver struct{} + +var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) + +func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + if overrides, ok := operationAuthOptions[params.Operation]; ok { + return overrides(params), nil + } + return serviceAuthOptions(params), nil +} + +var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} + +func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { + return []*smithyauth.Option{ + { + SchemeID: smithyauth.SchemeIDSigV4, + SignerProperties: func() smithy.Properties { + var props smithy.Properties + smithyhttp.SetSigV4SigningName(&props, "bedrock") + smithyhttp.SetSigV4SigningRegion(&props, params.Region) + return props + }(), + }, + } +} + +type resolveAuthSchemeMiddleware struct { + operation string + options Options +} + +func (*resolveAuthSchemeMiddleware) ID() string { + return "ResolveAuthScheme" +} + +func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + params := bindAuthResolverParams(m.operation, getOperationInput(ctx), m.options) + options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("resolve auth scheme: %v", err) + } + + scheme, ok := m.selectScheme(options) + if !ok { + return out, metadata, fmt.Errorf("could not select an auth scheme") + } + + ctx = setResolvedAuthScheme(ctx, scheme) + return next.HandleFinalize(ctx, in) +} + +func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { + for _, option := range options { + if option.SchemeID == smithyauth.SchemeIDAnonymous { + return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true + } + + for _, scheme := range m.options.AuthSchemes { + if scheme.SchemeID() != option.SchemeID { + continue + } + + if scheme.IdentityResolver(m.options) != nil { + return newResolvedAuthScheme(scheme, option), true + } + } + } + + return nil, false +} + +type resolvedAuthSchemeKey struct{} + +type resolvedAuthScheme struct { + Scheme smithyhttp.AuthScheme + IdentityProperties smithy.Properties + SignerProperties smithy.Properties +} + +func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { + return &resolvedAuthScheme{ + Scheme: scheme, + IdentityProperties: option.IdentityProperties, + SignerProperties: option.SignerProperties, + } +} + +func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { + return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) +} + +func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { + v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) + return v +} + +type getIdentityMiddleware struct { + options Options +} + +func (*getIdentityMiddleware) ID() string { + return "GetIdentity" +} + +func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + resolver := rscheme.Scheme.IdentityResolver(m.options) + if resolver == nil { + return out, metadata, fmt.Errorf("no identity resolver") + } + + identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties) + if err != nil { + return out, metadata, fmt.Errorf("get identity: %v", err) + } + + ctx = setIdentity(ctx, identity) + return next.HandleFinalize(ctx, in) +} + +type identityKey struct{} + +func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { + return middleware.WithStackValue(ctx, identityKey{}, identity) +} + +func getIdentity(ctx context.Context) smithyauth.Identity { + v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) + return v +} + +type signRequestMiddleware struct { +} + +func (*signRequestMiddleware) ID() string { + return "Signing" +} + +func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + identity := getIdentity(ctx) + if identity == nil { + return out, metadata, fmt.Errorf("no identity") + } + + signer := rscheme.Scheme.Signer() + if signer == nil { + return out, metadata, fmt.Errorf("no signer") + } + + if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil { + return out, metadata, fmt.Errorf("sign request: %v", err) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/bedrockagent/deserializers.go b/service/bedrockagent/deserializers.go new file mode 100644 index 00000000000..896671fac8c --- /dev/null +++ b/service/bedrockagent/deserializers.go @@ -0,0 +1,10737 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/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" + "math" + "strings" +) + +type awsRestjson1_deserializeOpAssociateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpAssociateAgentKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpAssociateAgentKnowledgeBase) 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_deserializeOpErrorAssociateAgentKnowledgeBase(response, &metadata) + } + output := &AssociateAgentKnowledgeBaseOutput{} + 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_deserializeOpDocumentAssociateAgentKnowledgeBaseOutput(&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_deserializeOpErrorAssociateAgentKnowledgeBase(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_deserializeOpDocumentAssociateAgentKnowledgeBaseOutput(v **AssociateAgentKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *AssociateAgentKnowledgeBaseOutput + if *v == nil { + sv = &AssociateAgentKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentKnowledgeBase": + if err := awsRestjson1_deserializeDocumentAgentKnowledgeBase(&sv.AgentKnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateAgent struct { +} + +func (*awsRestjson1_deserializeOpCreateAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAgent) 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_deserializeOpErrorCreateAgent(response, &metadata) + } + output := &CreateAgentOutput{} + 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_deserializeOpDocumentCreateAgentOutput(&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_deserializeOpErrorCreateAgent(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateAgentOutput(v **CreateAgentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAgentOutput + if *v == nil { + sv = &CreateAgentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agent": + if err := awsRestjson1_deserializeDocumentAgent(&sv.Agent, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateAgentActionGroup struct { +} + +func (*awsRestjson1_deserializeOpCreateAgentActionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAgentActionGroup) 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_deserializeOpErrorCreateAgentActionGroup(response, &metadata) + } + output := &CreateAgentActionGroupOutput{} + 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_deserializeOpDocumentCreateAgentActionGroupOutput(&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_deserializeOpErrorCreateAgentActionGroup(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_deserializeOpDocumentCreateAgentActionGroupOutput(v **CreateAgentActionGroupOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAgentActionGroupOutput + if *v == nil { + sv = &CreateAgentActionGroupOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentActionGroup": + if err := awsRestjson1_deserializeDocumentAgentActionGroup(&sv.AgentActionGroup, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateAgentAlias struct { +} + +func (*awsRestjson1_deserializeOpCreateAgentAlias) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAgentAlias) 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_deserializeOpErrorCreateAgentAlias(response, &metadata) + } + output := &CreateAgentAliasOutput{} + 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_deserializeOpDocumentCreateAgentAliasOutput(&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_deserializeOpErrorCreateAgentAlias(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_deserializeOpDocumentCreateAgentAliasOutput(v **CreateAgentAliasOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAgentAliasOutput + if *v == nil { + sv = &CreateAgentAliasOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAlias": + if err := awsRestjson1_deserializeDocumentAgentAlias(&sv.AgentAlias, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateDataSource struct { +} + +func (*awsRestjson1_deserializeOpCreateDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateDataSource) 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_deserializeOpErrorCreateDataSource(response, &metadata) + } + output := &CreateDataSourceOutput{} + 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_deserializeOpDocumentCreateDataSourceOutput(&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_deserializeOpErrorCreateDataSource(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_deserializeOpDocumentCreateDataSourceOutput(v **CreateDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateDataSourceOutput + if *v == nil { + sv = &CreateDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSource": + if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpCreateKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateKnowledgeBase) 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_deserializeOpErrorCreateKnowledgeBase(response, &metadata) + } + output := &CreateKnowledgeBaseOutput{} + 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_deserializeOpDocumentCreateKnowledgeBaseOutput(&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_deserializeOpErrorCreateKnowledgeBase(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateKnowledgeBaseOutput(v **CreateKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateKnowledgeBaseOutput + if *v == nil { + sv = &CreateKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBase(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteAgent struct { +} + +func (*awsRestjson1_deserializeOpDeleteAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAgent) 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_deserializeOpErrorDeleteAgent(response, &metadata) + } + output := &DeleteAgentOutput{} + 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_deserializeOpDocumentDeleteAgentOutput(&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_deserializeOpErrorDeleteAgent(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_deserializeOpDocumentDeleteAgentOutput(v **DeleteAgentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteAgentOutput + if *v == nil { + sv = &DeleteAgentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteAgentActionGroup struct { +} + +func (*awsRestjson1_deserializeOpDeleteAgentActionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAgentActionGroup) 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_deserializeOpErrorDeleteAgentActionGroup(response, &metadata) + } + output := &DeleteAgentActionGroupOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteAgentActionGroup(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_deserializeOpDeleteAgentAlias struct { +} + +func (*awsRestjson1_deserializeOpDeleteAgentAlias) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAgentAlias) 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_deserializeOpErrorDeleteAgentAlias(response, &metadata) + } + output := &DeleteAgentAliasOutput{} + 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_deserializeOpDocumentDeleteAgentAliasOutput(&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_deserializeOpErrorDeleteAgentAlias(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_deserializeOpDocumentDeleteAgentAliasOutput(v **DeleteAgentAliasOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteAgentAliasOutput + if *v == nil { + sv = &DeleteAgentAliasOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAliasId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasId to be of type string, got %T instead", value) + } + sv.AgentAliasId = ptr.String(jtv) + } + + case "agentAliasStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasStatus to be of type string, got %T instead", value) + } + sv.AgentAliasStatus = types.AgentAliasStatus(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteAgentVersion struct { +} + +func (*awsRestjson1_deserializeOpDeleteAgentVersion) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAgentVersion) 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_deserializeOpErrorDeleteAgentVersion(response, &metadata) + } + output := &DeleteAgentVersionOutput{} + 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_deserializeOpDocumentDeleteAgentVersionOutput(&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_deserializeOpErrorDeleteAgentVersion(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_deserializeOpDocumentDeleteAgentVersionOutput(v **DeleteAgentVersionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteAgentVersionOutput + if *v == nil { + sv = &DeleteAgentVersionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NumericalVersion to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteDataSource struct { +} + +func (*awsRestjson1_deserializeOpDeleteDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteDataSource) 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_deserializeOpErrorDeleteDataSource(response, &metadata) + } + output := &DeleteDataSourceOutput{} + 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_deserializeOpDocumentDeleteDataSourceOutput(&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_deserializeOpErrorDeleteDataSource(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_deserializeOpDocumentDeleteDataSourceOutput(v **DeleteDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteDataSourceOutput + if *v == nil { + sv = &DeleteDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpDeleteKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteKnowledgeBase) 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_deserializeOpErrorDeleteKnowledgeBase(response, &metadata) + } + output := &DeleteKnowledgeBaseOutput{} + 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_deserializeOpDocumentDeleteKnowledgeBaseOutput(&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_deserializeOpErrorDeleteKnowledgeBase(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_deserializeOpDocumentDeleteKnowledgeBaseOutput(v **DeleteKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteKnowledgeBaseOutput + if *v == nil { + sv = &DeleteKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.KnowledgeBaseStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDisassociateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpDisassociateAgentKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisassociateAgentKnowledgeBase) 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_deserializeOpErrorDisassociateAgentKnowledgeBase(response, &metadata) + } + output := &DisassociateAgentKnowledgeBaseOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDisassociateAgentKnowledgeBase(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_deserializeOpGetAgent struct { +} + +func (*awsRestjson1_deserializeOpGetAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAgent) 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_deserializeOpErrorGetAgent(response, &metadata) + } + output := &GetAgentOutput{} + 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_deserializeOpDocumentGetAgentOutput(&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_deserializeOpErrorGetAgent(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_deserializeOpDocumentGetAgentOutput(v **GetAgentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAgentOutput + if *v == nil { + sv = &GetAgentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agent": + if err := awsRestjson1_deserializeDocumentAgent(&sv.Agent, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetAgentActionGroup struct { +} + +func (*awsRestjson1_deserializeOpGetAgentActionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAgentActionGroup) 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_deserializeOpErrorGetAgentActionGroup(response, &metadata) + } + output := &GetAgentActionGroupOutput{} + 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_deserializeOpDocumentGetAgentActionGroupOutput(&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_deserializeOpErrorGetAgentActionGroup(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_deserializeOpDocumentGetAgentActionGroupOutput(v **GetAgentActionGroupOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAgentActionGroupOutput + if *v == nil { + sv = &GetAgentActionGroupOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentActionGroup": + if err := awsRestjson1_deserializeDocumentAgentActionGroup(&sv.AgentActionGroup, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetAgentAlias struct { +} + +func (*awsRestjson1_deserializeOpGetAgentAlias) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAgentAlias) 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_deserializeOpErrorGetAgentAlias(response, &metadata) + } + output := &GetAgentAliasOutput{} + 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_deserializeOpDocumentGetAgentAliasOutput(&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_deserializeOpErrorGetAgentAlias(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_deserializeOpDocumentGetAgentAliasOutput(v **GetAgentAliasOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAgentAliasOutput + if *v == nil { + sv = &GetAgentAliasOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAlias": + if err := awsRestjson1_deserializeDocumentAgentAlias(&sv.AgentAlias, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetAgentKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpGetAgentKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAgentKnowledgeBase) 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_deserializeOpErrorGetAgentKnowledgeBase(response, &metadata) + } + output := &GetAgentKnowledgeBaseOutput{} + 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_deserializeOpDocumentGetAgentKnowledgeBaseOutput(&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_deserializeOpErrorGetAgentKnowledgeBase(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_deserializeOpDocumentGetAgentKnowledgeBaseOutput(v **GetAgentKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAgentKnowledgeBaseOutput + if *v == nil { + sv = &GetAgentKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentKnowledgeBase": + if err := awsRestjson1_deserializeDocumentAgentKnowledgeBase(&sv.AgentKnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetAgentVersion struct { +} + +func (*awsRestjson1_deserializeOpGetAgentVersion) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAgentVersion) 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_deserializeOpErrorGetAgentVersion(response, &metadata) + } + output := &GetAgentVersionOutput{} + 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_deserializeOpDocumentGetAgentVersionOutput(&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_deserializeOpErrorGetAgentVersion(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_deserializeOpDocumentGetAgentVersionOutput(v **GetAgentVersionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAgentVersionOutput + if *v == nil { + sv = &GetAgentVersionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentVersion": + if err := awsRestjson1_deserializeDocumentAgentVersion(&sv.AgentVersion, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetDataSource struct { +} + +func (*awsRestjson1_deserializeOpGetDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetDataSource) 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_deserializeOpErrorGetDataSource(response, &metadata) + } + output := &GetDataSourceOutput{} + 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_deserializeOpDocumentGetDataSourceOutput(&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_deserializeOpErrorGetDataSource(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_deserializeOpDocumentGetDataSourceOutput(v **GetDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetDataSourceOutput + if *v == nil { + sv = &GetDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSource": + if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetIngestionJob struct { +} + +func (*awsRestjson1_deserializeOpGetIngestionJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetIngestionJob) 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_deserializeOpErrorGetIngestionJob(response, &metadata) + } + output := &GetIngestionJobOutput{} + 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_deserializeOpDocumentGetIngestionJobOutput(&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_deserializeOpErrorGetIngestionJob(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_deserializeOpDocumentGetIngestionJobOutput(v **GetIngestionJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetIngestionJobOutput + if *v == nil { + sv = &GetIngestionJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ingestionJob": + if err := awsRestjson1_deserializeDocumentIngestionJob(&sv.IngestionJob, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpGetKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetKnowledgeBase) 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_deserializeOpErrorGetKnowledgeBase(response, &metadata) + } + output := &GetKnowledgeBaseOutput{} + 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_deserializeOpDocumentGetKnowledgeBaseOutput(&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_deserializeOpErrorGetKnowledgeBase(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_deserializeOpDocumentGetKnowledgeBaseOutput(v **GetKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetKnowledgeBaseOutput + if *v == nil { + sv = &GetKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBase(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListAgentActionGroups struct { +} + +func (*awsRestjson1_deserializeOpListAgentActionGroups) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAgentActionGroups) 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_deserializeOpErrorListAgentActionGroups(response, &metadata) + } + output := &ListAgentActionGroupsOutput{} + 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_deserializeOpDocumentListAgentActionGroupsOutput(&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_deserializeOpErrorListAgentActionGroups(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_deserializeOpDocumentListAgentActionGroupsOutput(v **ListAgentActionGroupsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAgentActionGroupsOutput + if *v == nil { + sv = &ListAgentActionGroupsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupSummaries": + if err := awsRestjson1_deserializeDocumentActionGroupSummaries(&sv.ActionGroupSummaries, 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_deserializeOpListAgentAliases struct { +} + +func (*awsRestjson1_deserializeOpListAgentAliases) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAgentAliases) 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_deserializeOpErrorListAgentAliases(response, &metadata) + } + output := &ListAgentAliasesOutput{} + 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_deserializeOpDocumentListAgentAliasesOutput(&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_deserializeOpErrorListAgentAliases(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_deserializeOpDocumentListAgentAliasesOutput(v **ListAgentAliasesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAgentAliasesOutput + if *v == nil { + sv = &ListAgentAliasesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAliasSummaries": + if err := awsRestjson1_deserializeDocumentAgentAliasSummaries(&sv.AgentAliasSummaries, 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_deserializeOpListAgentKnowledgeBases struct { +} + +func (*awsRestjson1_deserializeOpListAgentKnowledgeBases) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAgentKnowledgeBases) 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_deserializeOpErrorListAgentKnowledgeBases(response, &metadata) + } + output := &ListAgentKnowledgeBasesOutput{} + 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_deserializeOpDocumentListAgentKnowledgeBasesOutput(&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_deserializeOpErrorListAgentKnowledgeBases(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_deserializeOpDocumentListAgentKnowledgeBasesOutput(v **ListAgentKnowledgeBasesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAgentKnowledgeBasesOutput + if *v == nil { + sv = &ListAgentKnowledgeBasesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentKnowledgeBaseSummaries": + if err := awsRestjson1_deserializeDocumentAgentKnowledgeBaseSummaries(&sv.AgentKnowledgeBaseSummaries, 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_deserializeOpListAgents struct { +} + +func (*awsRestjson1_deserializeOpListAgents) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAgents) 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_deserializeOpErrorListAgents(response, &metadata) + } + output := &ListAgentsOutput{} + 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_deserializeOpDocumentListAgentsOutput(&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_deserializeOpErrorListAgents(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_deserializeOpDocumentListAgentsOutput(v **ListAgentsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAgentsOutput + if *v == nil { + sv = &ListAgentsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentSummaries": + if err := awsRestjson1_deserializeDocumentAgentSummaries(&sv.AgentSummaries, 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_deserializeOpListAgentVersions struct { +} + +func (*awsRestjson1_deserializeOpListAgentVersions) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAgentVersions) 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_deserializeOpErrorListAgentVersions(response, &metadata) + } + output := &ListAgentVersionsOutput{} + 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_deserializeOpDocumentListAgentVersionsOutput(&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_deserializeOpErrorListAgentVersions(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_deserializeOpDocumentListAgentVersionsOutput(v **ListAgentVersionsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAgentVersionsOutput + if *v == nil { + sv = &ListAgentVersionsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentVersionSummaries": + if err := awsRestjson1_deserializeDocumentAgentVersionSummaries(&sv.AgentVersionSummaries, 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_deserializeOpListDataSources struct { +} + +func (*awsRestjson1_deserializeOpListDataSources) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListDataSources) 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_deserializeOpErrorListDataSources(response, &metadata) + } + output := &ListDataSourcesOutput{} + 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_deserializeOpDocumentListDataSourcesOutput(&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_deserializeOpErrorListDataSources(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_deserializeOpDocumentListDataSourcesOutput(v **ListDataSourcesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListDataSourcesOutput + if *v == nil { + sv = &ListDataSourcesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceSummaries": + if err := awsRestjson1_deserializeDocumentDataSourceSummaries(&sv.DataSourceSummaries, 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_deserializeOpListIngestionJobs struct { +} + +func (*awsRestjson1_deserializeOpListIngestionJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListIngestionJobs) 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_deserializeOpErrorListIngestionJobs(response, &metadata) + } + output := &ListIngestionJobsOutput{} + 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_deserializeOpDocumentListIngestionJobsOutput(&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_deserializeOpErrorListIngestionJobs(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_deserializeOpDocumentListIngestionJobsOutput(v **ListIngestionJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListIngestionJobsOutput + if *v == nil { + sv = &ListIngestionJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ingestionJobSummaries": + if err := awsRestjson1_deserializeDocumentIngestionJobSummaries(&sv.IngestionJobSummaries, 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_deserializeOpListKnowledgeBases struct { +} + +func (*awsRestjson1_deserializeOpListKnowledgeBases) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListKnowledgeBases) 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_deserializeOpErrorListKnowledgeBases(response, &metadata) + } + output := &ListKnowledgeBasesOutput{} + 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_deserializeOpDocumentListKnowledgeBasesOutput(&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_deserializeOpErrorListKnowledgeBases(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_deserializeOpDocumentListKnowledgeBasesOutput(v **ListKnowledgeBasesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListKnowledgeBasesOutput + if *v == nil { + sv = &ListKnowledgeBasesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBaseSummaries": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseSummaries(&sv.KnowledgeBaseSummaries, value); err != nil { + return err + } + + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTagsForResource struct { +} + +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_deserializeDocumentTagsMap(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpPrepareAgent struct { +} + +func (*awsRestjson1_deserializeOpPrepareAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpPrepareAgent) 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_deserializeOpErrorPrepareAgent(response, &metadata) + } + output := &PrepareAgentOutput{} + 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_deserializeOpDocumentPrepareAgentOutput(&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_deserializeOpErrorPrepareAgent(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_deserializeOpDocumentPrepareAgentOutput(v **PrepareAgentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *PrepareAgentOutput + if *v == nil { + sv = &PrepareAgentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + case "preparedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.PreparedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartIngestionJob struct { +} + +func (*awsRestjson1_deserializeOpStartIngestionJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartIngestionJob) 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_deserializeOpErrorStartIngestionJob(response, &metadata) + } + output := &StartIngestionJobOutput{} + 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_deserializeOpDocumentStartIngestionJobOutput(&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_deserializeOpErrorStartIngestionJob(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_deserializeOpDocumentStartIngestionJobOutput(v **StartIngestionJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartIngestionJobOutput + if *v == nil { + sv = &StartIngestionJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ingestionJob": + if err := awsRestjson1_deserializeDocumentIngestionJob(&sv.IngestionJob, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpTagResource struct { +} + +func (*awsRestjson1_deserializeOpTagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + } + output := &TagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + } + output := &UntagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("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_deserializeOpUpdateAgent struct { +} + +func (*awsRestjson1_deserializeOpUpdateAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateAgent) 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_deserializeOpErrorUpdateAgent(response, &metadata) + } + output := &UpdateAgentOutput{} + 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_deserializeOpDocumentUpdateAgentOutput(&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_deserializeOpErrorUpdateAgent(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_deserializeOpDocumentUpdateAgentOutput(v **UpdateAgentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateAgentOutput + if *v == nil { + sv = &UpdateAgentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agent": + if err := awsRestjson1_deserializeDocumentAgent(&sv.Agent, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateAgentActionGroup struct { +} + +func (*awsRestjson1_deserializeOpUpdateAgentActionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateAgentActionGroup) 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_deserializeOpErrorUpdateAgentActionGroup(response, &metadata) + } + output := &UpdateAgentActionGroupOutput{} + 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_deserializeOpDocumentUpdateAgentActionGroupOutput(&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_deserializeOpErrorUpdateAgentActionGroup(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_deserializeOpDocumentUpdateAgentActionGroupOutput(v **UpdateAgentActionGroupOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateAgentActionGroupOutput + if *v == nil { + sv = &UpdateAgentActionGroupOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentActionGroup": + if err := awsRestjson1_deserializeDocumentAgentActionGroup(&sv.AgentActionGroup, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateAgentAlias struct { +} + +func (*awsRestjson1_deserializeOpUpdateAgentAlias) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateAgentAlias) 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_deserializeOpErrorUpdateAgentAlias(response, &metadata) + } + output := &UpdateAgentAliasOutput{} + 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_deserializeOpDocumentUpdateAgentAliasOutput(&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_deserializeOpErrorUpdateAgentAlias(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_deserializeOpDocumentUpdateAgentAliasOutput(v **UpdateAgentAliasOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateAgentAliasOutput + if *v == nil { + sv = &UpdateAgentAliasOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAlias": + if err := awsRestjson1_deserializeDocumentAgentAlias(&sv.AgentAlias, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpUpdateAgentKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateAgentKnowledgeBase) 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_deserializeOpErrorUpdateAgentKnowledgeBase(response, &metadata) + } + output := &UpdateAgentKnowledgeBaseOutput{} + 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_deserializeOpDocumentUpdateAgentKnowledgeBaseOutput(&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_deserializeOpErrorUpdateAgentKnowledgeBase(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_deserializeOpDocumentUpdateAgentKnowledgeBaseOutput(v **UpdateAgentKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateAgentKnowledgeBaseOutput + if *v == nil { + sv = &UpdateAgentKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentKnowledgeBase": + if err := awsRestjson1_deserializeDocumentAgentKnowledgeBase(&sv.AgentKnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateDataSource struct { +} + +func (*awsRestjson1_deserializeOpUpdateDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateDataSource) 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_deserializeOpErrorUpdateDataSource(response, &metadata) + } + output := &UpdateDataSourceOutput{} + 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_deserializeOpDocumentUpdateDataSourceOutput(&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_deserializeOpErrorUpdateDataSource(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_deserializeOpDocumentUpdateDataSourceOutput(v **UpdateDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateDataSourceOutput + if *v == nil { + sv = &UpdateDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSource": + if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpUpdateKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateKnowledgeBase) 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_deserializeOpErrorUpdateKnowledgeBase(response, &metadata) + } + output := &UpdateKnowledgeBaseOutput{} + 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_deserializeOpDocumentUpdateKnowledgeBaseOutput(&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_deserializeOpErrorUpdateKnowledgeBase(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_deserializeOpDocumentUpdateKnowledgeBaseOutput(v **UpdateKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateKnowledgeBaseOutput + if *v == nil { + sv = &UpdateKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBase(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConflictException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentConflictException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InternalServerException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotFoundException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ServiceQuotaExceededException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ThrottlingException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AccessDeniedException + if *v == nil { + sv = &types.AccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionGroupExecutor(v *types.ActionGroupExecutor, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.ActionGroupExecutor +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "lambda": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LambdaArn to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.ActionGroupExecutorMemberLambda{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentActionGroupSummaries(v *[]types.ActionGroupSummary, 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.ActionGroupSummary + if *v == nil { + cv = []types.ActionGroupSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ActionGroupSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentActionGroupSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentActionGroupSummary(v **types.ActionGroupSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionGroupSummary + if *v == nil { + sv = &types.ActionGroupSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.ActionGroupId = ptr.String(jtv) + } + + case "actionGroupName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.ActionGroupName = ptr.String(jtv) + } + + case "actionGroupState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionGroupState to be of type string, got %T instead", value) + } + sv.ActionGroupState = types.ActionGroupState(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgent(v **types.Agent, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Agent + if *v == nil { + sv = &types.Agent{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentArn to be of type string, got %T instead", value) + } + sv.AgentArn = ptr.String(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentName = ptr.String(jtv) + } + + case "agentResourceRoleArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentRoleArn to be of type string, got %T instead", value) + } + sv.AgentResourceRoleArn = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DraftVersion to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + case "clientToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientToken to be of type string, got %T instead", value) + } + sv.ClientToken = ptr.String(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "customerEncryptionKeyArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KmsKeyArn to be of type string, got %T instead", value) + } + sv.CustomerEncryptionKeyArn = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "failureReasons": + if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { + return err + } + + case "foundationModel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ModelIdentifier to be of type string, got %T instead", value) + } + sv.FoundationModel = ptr.String(jtv) + } + + case "idleSessionTTLInSeconds": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) + } + + case "instruction": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Instruction to be of type string, got %T instead", value) + } + sv.Instruction = ptr.String(jtv) + } + + case "preparedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.PreparedAt = ptr.Time(t) + } + + case "promptOverrideConfiguration": + if err := awsRestjson1_deserializeDocumentPromptOverrideConfiguration(&sv.PromptOverrideConfiguration, value); err != nil { + return err + } + + case "recommendedActions": + if err := awsRestjson1_deserializeDocumentRecommendedActions(&sv.RecommendedActions, value); err != nil { + return err + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentActionGroup(v **types.AgentActionGroup, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentActionGroup + if *v == nil { + sv = &types.AgentActionGroup{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupExecutor": + if err := awsRestjson1_deserializeDocumentActionGroupExecutor(&sv.ActionGroupExecutor, value); err != nil { + return err + } + + case "actionGroupId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.ActionGroupId = ptr.String(jtv) + } + + case "actionGroupName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.ActionGroupName = ptr.String(jtv) + } + + case "actionGroupState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionGroupState to be of type string, got %T instead", value) + } + sv.ActionGroupState = types.ActionGroupState(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + case "apiSchema": + if err := awsRestjson1_deserializeDocumentAPISchema(&sv.ApiSchema, value); err != nil { + return err + } + + case "clientToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientToken to be of type string, got %T instead", value) + } + sv.ClientToken = ptr.String(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "parentActionSignature": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionGroupSignature to be of type string, got %T instead", value) + } + sv.ParentActionSignature = types.ActionGroupSignature(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAlias(v **types.AgentAlias, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentAlias + if *v == nil { + sv = &types.AgentAlias{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAliasArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasArn to be of type string, got %T instead", value) + } + sv.AgentAliasArn = ptr.String(jtv) + } + + case "agentAliasHistoryEvents": + if err := awsRestjson1_deserializeDocumentAgentAliasHistoryEvents(&sv.AgentAliasHistoryEvents, value); err != nil { + return err + } + + case "agentAliasId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasId to be of type string, got %T instead", value) + } + sv.AgentAliasId = ptr.String(jtv) + } + + case "agentAliasName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentAliasName = ptr.String(jtv) + } + + case "agentAliasStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasStatus to be of type string, got %T instead", value) + } + sv.AgentAliasStatus = types.AgentAliasStatus(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "clientToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientToken to be of type string, got %T instead", value) + } + sv.ClientToken = ptr.String(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "routingConfiguration": + if err := awsRestjson1_deserializeDocumentAgentAliasRoutingConfiguration(&sv.RoutingConfiguration, value); err != nil { + return err + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasHistoryEvent(v **types.AgentAliasHistoryEvent, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentAliasHistoryEvent + if *v == nil { + sv = &types.AgentAliasHistoryEvent{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "endDate": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.EndDate = ptr.Time(t) + } + + case "routingConfiguration": + if err := awsRestjson1_deserializeDocumentAgentAliasRoutingConfiguration(&sv.RoutingConfiguration, value); err != nil { + return err + } + + case "startDate": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.StartDate = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasHistoryEvents(v *[]types.AgentAliasHistoryEvent, 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.AgentAliasHistoryEvent + if *v == nil { + cv = []types.AgentAliasHistoryEvent{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentAliasHistoryEvent + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentAliasHistoryEvent(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasRoutingConfiguration(v *[]types.AgentAliasRoutingConfigurationListItem, 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.AgentAliasRoutingConfigurationListItem + if *v == nil { + cv = []types.AgentAliasRoutingConfigurationListItem{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentAliasRoutingConfigurationListItem + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentAliasRoutingConfigurationListItem(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasRoutingConfigurationListItem(v **types.AgentAliasRoutingConfigurationListItem, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentAliasRoutingConfigurationListItem + if *v == nil { + sv = &types.AgentAliasRoutingConfigurationListItem{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasSummaries(v *[]types.AgentAliasSummary, 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.AgentAliasSummary + if *v == nil { + cv = []types.AgentAliasSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentAliasSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentAliasSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentAliasSummary(v **types.AgentAliasSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentAliasSummary + if *v == nil { + sv = &types.AgentAliasSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAliasId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasId to be of type string, got %T instead", value) + } + sv.AgentAliasId = ptr.String(jtv) + } + + case "agentAliasName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentAliasName = ptr.String(jtv) + } + + case "agentAliasStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasStatus to be of type string, got %T instead", value) + } + sv.AgentAliasStatus = types.AgentAliasStatus(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "routingConfiguration": + if err := awsRestjson1_deserializeDocumentAgentAliasRoutingConfiguration(&sv.RoutingConfiguration, value); err != nil { + return err + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentKnowledgeBase(v **types.AgentKnowledgeBase, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentKnowledgeBase + if *v == nil { + sv = &types.AgentKnowledgeBase{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "knowledgeBaseState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseState to be of type string, got %T instead", value) + } + sv.KnowledgeBaseState = types.KnowledgeBaseState(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentKnowledgeBaseSummaries(v *[]types.AgentKnowledgeBaseSummary, 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.AgentKnowledgeBaseSummary + if *v == nil { + cv = []types.AgentKnowledgeBaseSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentKnowledgeBaseSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentKnowledgeBaseSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentKnowledgeBaseSummary(v **types.AgentKnowledgeBaseSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentKnowledgeBaseSummary + if *v == nil { + sv = &types.AgentKnowledgeBaseSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "knowledgeBaseState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseState to be of type string, got %T instead", value) + } + sv.KnowledgeBaseState = types.KnowledgeBaseState(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentSummaries(v *[]types.AgentSummary, 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.AgentSummary + if *v == nil { + cv = []types.AgentSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentSummary(v **types.AgentSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentSummary + if *v == nil { + sv = &types.AgentSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentName = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "latestAgentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.LatestAgentVersion = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentVersion(v **types.AgentVersion, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentVersion + if *v == nil { + sv = &types.AgentVersion{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentArn to be of type string, got %T instead", value) + } + sv.AgentArn = ptr.String(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "agentName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentName = ptr.String(jtv) + } + + case "agentResourceRoleArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentRoleArn to be of type string, got %T instead", value) + } + sv.AgentResourceRoleArn = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "customerEncryptionKeyArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KmsKeyArn to be of type string, got %T instead", value) + } + sv.CustomerEncryptionKeyArn = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "failureReasons": + if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { + return err + } + + case "foundationModel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ModelIdentifier to be of type string, got %T instead", value) + } + sv.FoundationModel = ptr.String(jtv) + } + + case "idleSessionTTLInSeconds": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) + } + + case "instruction": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Instruction to be of type string, got %T instead", value) + } + sv.Instruction = ptr.String(jtv) + } + + case "promptOverrideConfiguration": + if err := awsRestjson1_deserializeDocumentPromptOverrideConfiguration(&sv.PromptOverrideConfiguration, value); err != nil { + return err + } + + case "recommendedActions": + if err := awsRestjson1_deserializeDocumentRecommendedActions(&sv.RecommendedActions, value); err != nil { + return err + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + case "version": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NumericalVersion to be of type string, got %T instead", value) + } + sv.Version = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentVersionSummaries(v *[]types.AgentVersionSummary, 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.AgentVersionSummary + if *v == nil { + cv = []types.AgentVersionSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentVersionSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentVersionSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentVersionSummary(v **types.AgentVersionSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AgentVersionSummary + if *v == nil { + sv = &types.AgentVersionSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.AgentName = ptr.String(jtv) + } + + case "agentStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentStatus to be of type string, got %T instead", value) + } + sv.AgentStatus = types.AgentStatus(jtv) + } + + case "agentVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Version to be of type string, got %T instead", value) + } + sv.AgentVersion = ptr.String(jtv) + } + + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAPISchema(v *types.APISchema, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.APISchema +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "payload": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Payload to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.APISchemaMemberPayload{Value: mv} + break loop + + case "s3": + var mv types.S3Identifier + destAddr := &mv + if err := awsRestjson1_deserializeDocumentS3Identifier(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.APISchemaMemberS3{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentChunkingConfiguration(v **types.ChunkingConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ChunkingConfiguration + if *v == nil { + sv = &types.ChunkingConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "chunkingStrategy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ChunkingStrategy to be of type string, got %T instead", value) + } + sv.ChunkingStrategy = types.ChunkingStrategy(jtv) + } + + case "fixedSizeChunkingConfiguration": + if err := awsRestjson1_deserializeDocumentFixedSizeChunkingConfiguration(&sv.FixedSizeChunkingConfiguration, 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSource(v **types.DataSource, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSource + if *v == nil { + sv = &types.DataSource{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "dataSourceConfiguration": + if err := awsRestjson1_deserializeDocumentDataSourceConfiguration(&sv.DataSourceConfiguration, value); err != nil { + return err + } + + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "serverSideEncryptionConfiguration": + if err := awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(&sv.ServerSideEncryptionConfiguration, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceStatus(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + case "vectorIngestionConfiguration": + if err := awsRestjson1_deserializeDocumentVectorIngestionConfiguration(&sv.VectorIngestionConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceConfiguration(v **types.DataSourceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSourceConfiguration + if *v == nil { + sv = &types.DataSourceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "s3Configuration": + if err := awsRestjson1_deserializeDocumentS3DataSourceConfiguration(&sv.S3Configuration, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceType to be of type string, got %T instead", value) + } + sv.Type = types.DataSourceType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceSummaries(v *[]types.DataSourceSummary, 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.DataSourceSummary + if *v == nil { + cv = []types.DataSourceSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DataSourceSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentDataSourceSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceSummary(v **types.DataSourceSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSourceSummary + if *v == nil { + sv = &types.DataSourceSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceStatus(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFailureReasons(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 FailureReason to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentFixedSizeChunkingConfiguration(v **types.FixedSizeChunkingConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FixedSizeChunkingConfiguration + if *v == nil { + sv = &types.FixedSizeChunkingConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "maxTokens": + 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.MaxTokens = ptr.Int32(int32(i64)) + } + + case "overlapPercentage": + 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.OverlapPercentage = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInferenceConfiguration(v **types.InferenceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InferenceConfiguration + if *v == nil { + sv = &types.InferenceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "maximumLength": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected MaximumLength to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumLength = ptr.Int32(int32(i64)) + } + + case "stopSequences": + if err := awsRestjson1_deserializeDocumentStopSequences(&sv.StopSequences, value); err != nil { + return err + } + + case "temperature": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Temperature = ptr.Float32(float32(f64)) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Temperature = ptr.Float32(float32(f64)) + + default: + return fmt.Errorf("expected Temperature to be a JSON Number, got %T instead", value) + + } + } + + case "topK": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected TopK to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.TopK = ptr.Int32(int32(i64)) + } + + case "topP": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.TopP = ptr.Float32(float32(f64)) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.TopP = ptr.Float32(float32(f64)) + + default: + return fmt.Errorf("expected TopP to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIngestionJob(v **types.IngestionJob, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IngestionJob + if *v == nil { + sv = &types.IngestionJob{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "failureReasons": + if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { + return err + } + + case "ingestionJobId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.IngestionJobId = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "startedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.StartedAt = ptr.Time(t) + } + + case "statistics": + if err := awsRestjson1_deserializeDocumentIngestionJobStatistics(&sv.Statistics, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IngestionJobStatus to be of type string, got %T instead", value) + } + sv.Status = types.IngestionJobStatus(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIngestionJobStatistics(v **types.IngestionJobStatistics, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IngestionJobStatistics + if *v == nil { + sv = &types.IngestionJobStatistics{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "numberOfDocumentsDeleted": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected PrimitiveLong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumberOfDocumentsDeleted = i64 + } + + case "numberOfDocumentsFailed": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected PrimitiveLong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumberOfDocumentsFailed = i64 + } + + case "numberOfDocumentsScanned": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected PrimitiveLong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumberOfDocumentsScanned = i64 + } + + case "numberOfModifiedDocumentsIndexed": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected PrimitiveLong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumberOfModifiedDocumentsIndexed = i64 + } + + case "numberOfNewDocumentsIndexed": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected PrimitiveLong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumberOfNewDocumentsIndexed = i64 + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIngestionJobSummaries(v *[]types.IngestionJobSummary, 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.IngestionJobSummary + if *v == nil { + cv = []types.IngestionJobSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.IngestionJobSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentIngestionJobSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentIngestionJobSummary(v **types.IngestionJobSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IngestionJobSummary + if *v == nil { + sv = &types.IngestionJobSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "ingestionJobId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.IngestionJobId = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "startedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.StartedAt = ptr.Time(t) + } + + case "statistics": + if err := awsRestjson1_deserializeDocumentIngestionJobStatistics(&sv.Statistics, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IngestionJobStatus to be of type string, got %T instead", value) + } + sv.Status = types.IngestionJobStatus(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBase(v **types.KnowledgeBase, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBase + if *v == nil { + sv = &types.KnowledgeBase{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "failureReasons": + if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { + return err + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseArn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseConfiguration": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseConfiguration(&sv.KnowledgeBaseConfiguration, value); err != nil { + return err + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "roleArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseRoleArn to be of type string, got %T instead", value) + } + sv.RoleArn = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.KnowledgeBaseStatus(jtv) + } + + case "storageConfiguration": + if err := awsRestjson1_deserializeDocumentStorageConfiguration(&sv.StorageConfiguration, value); err != nil { + return err + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseConfiguration(v **types.KnowledgeBaseConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseConfiguration + if *v == nil { + sv = &types.KnowledgeBaseConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseType to be of type string, got %T instead", value) + } + sv.Type = types.KnowledgeBaseType(jtv) + } + + case "vectorKnowledgeBaseConfiguration": + if err := awsRestjson1_deserializeDocumentVectorKnowledgeBaseConfiguration(&sv.VectorKnowledgeBaseConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseSummaries(v *[]types.KnowledgeBaseSummary, 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.KnowledgeBaseSummary + if *v == nil { + cv = []types.KnowledgeBaseSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.KnowledgeBaseSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentKnowledgeBaseSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseSummary(v **types.KnowledgeBaseSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseSummary + if *v == nil { + sv = &types.KnowledgeBaseSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Id to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.KnowledgeBaseStatus(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTimestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentOpenSearchServerlessConfiguration(v **types.OpenSearchServerlessConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.OpenSearchServerlessConfiguration + if *v == nil { + sv = &types.OpenSearchServerlessConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "collectionArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected OpenSearchServerlessCollectionArn to be of type string, got %T instead", value) + } + sv.CollectionArn = ptr.String(jtv) + } + + case "fieldMapping": + if err := awsRestjson1_deserializeDocumentOpenSearchServerlessFieldMapping(&sv.FieldMapping, value); err != nil { + return err + } + + case "vectorIndexName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected OpenSearchServerlessIndexName to be of type string, got %T instead", value) + } + sv.VectorIndexName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentOpenSearchServerlessFieldMapping(v **types.OpenSearchServerlessFieldMapping, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.OpenSearchServerlessFieldMapping + if *v == nil { + sv = &types.OpenSearchServerlessFieldMapping{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "metadataField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.MetadataField = ptr.String(jtv) + } + + case "textField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.TextField = ptr.String(jtv) + } + + case "vectorField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.VectorField = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPineconeConfiguration(v **types.PineconeConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PineconeConfiguration + if *v == nil { + sv = &types.PineconeConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "connectionString": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PineconeConnectionString to be of type string, got %T instead", value) + } + sv.ConnectionString = ptr.String(jtv) + } + + case "credentialsSecretArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SecretArn to be of type string, got %T instead", value) + } + sv.CredentialsSecretArn = ptr.String(jtv) + } + + case "fieldMapping": + if err := awsRestjson1_deserializeDocumentPineconeFieldMapping(&sv.FieldMapping, value); err != nil { + return err + } + + case "namespace": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PineconeNamespace to be of type string, got %T instead", value) + } + sv.Namespace = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPineconeFieldMapping(v **types.PineconeFieldMapping, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PineconeFieldMapping + if *v == nil { + sv = &types.PineconeFieldMapping{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "metadataField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.MetadataField = ptr.String(jtv) + } + + case "textField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.TextField = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPromptConfiguration(v **types.PromptConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PromptConfiguration + if *v == nil { + sv = &types.PromptConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "basePromptTemplate": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected BasePromptTemplate to be of type string, got %T instead", value) + } + sv.BasePromptTemplate = ptr.String(jtv) + } + + case "inferenceConfiguration": + if err := awsRestjson1_deserializeDocumentInferenceConfiguration(&sv.InferenceConfiguration, value); err != nil { + return err + } + + case "parserMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CreationMode to be of type string, got %T instead", value) + } + sv.ParserMode = types.CreationMode(jtv) + } + + case "promptCreationMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CreationMode to be of type string, got %T instead", value) + } + sv.PromptCreationMode = types.CreationMode(jtv) + } + + case "promptState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptState to be of type string, got %T instead", value) + } + sv.PromptState = types.PromptState(jtv) + } + + case "promptType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptType to be of type string, got %T instead", value) + } + sv.PromptType = types.PromptType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPromptConfigurations(v *[]types.PromptConfiguration, 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.PromptConfiguration + if *v == nil { + cv = []types.PromptConfiguration{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.PromptConfiguration + destAddr := &col + if err := awsRestjson1_deserializeDocumentPromptConfiguration(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentPromptOverrideConfiguration(v **types.PromptOverrideConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PromptOverrideConfiguration + if *v == nil { + sv = &types.PromptOverrideConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "overrideLambda": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LambdaArn to be of type string, got %T instead", value) + } + sv.OverrideLambda = ptr.String(jtv) + } + + case "promptConfigurations": + if err := awsRestjson1_deserializeDocumentPromptConfigurations(&sv.PromptConfigurations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendedActions(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 RecommendedAction to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRedisEnterpriseCloudConfiguration(v **types.RedisEnterpriseCloudConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RedisEnterpriseCloudConfiguration + if *v == nil { + sv = &types.RedisEnterpriseCloudConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "credentialsSecretArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SecretArn to be of type string, got %T instead", value) + } + sv.CredentialsSecretArn = ptr.String(jtv) + } + + case "endpoint": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RedisEnterpriseCloudEndpoint to be of type string, got %T instead", value) + } + sv.Endpoint = ptr.String(jtv) + } + + case "fieldMapping": + if err := awsRestjson1_deserializeDocumentRedisEnterpriseCloudFieldMapping(&sv.FieldMapping, value); err != nil { + return err + } + + case "vectorIndexName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RedisEnterpriseCloudIndexName to be of type string, got %T instead", value) + } + sv.VectorIndexName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRedisEnterpriseCloudFieldMapping(v **types.RedisEnterpriseCloudFieldMapping, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RedisEnterpriseCloudFieldMapping + if *v == nil { + sv = &types.RedisEnterpriseCloudFieldMapping{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "metadataField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.MetadataField = ptr.String(jtv) + } + + case "textField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.TextField = ptr.String(jtv) + } + + case "vectorField": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldName to be of type string, got %T instead", value) + } + sv.VectorField = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentS3DataSourceConfiguration(v **types.S3DataSourceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.S3DataSourceConfiguration + if *v == nil { + sv = &types.S3DataSourceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "bucketArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3BucketArn to be of type string, got %T instead", value) + } + sv.BucketArn = ptr.String(jtv) + } + + case "inclusionPrefixes": + if err := awsRestjson1_deserializeDocumentS3Prefixes(&sv.InclusionPrefixes, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentS3Identifier(v **types.S3Identifier, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.S3Identifier + if *v == nil { + sv = &types.S3Identifier{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "s3BucketName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3BucketName to be of type string, got %T instead", value) + } + sv.S3BucketName = ptr.String(jtv) + } + + case "s3ObjectKey": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3ObjectKey to be of type string, got %T instead", value) + } + sv.S3ObjectKey = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentS3Prefixes(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 S3Prefix to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(v **types.ServerSideEncryptionConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ServerSideEncryptionConfiguration + if *v == nil { + sv = &types.ServerSideEncryptionConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "kmsKeyArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KmsKeyArn to be of type string, got %T instead", value) + } + sv.KmsKeyArn = ptr.String(jtv) + } + + 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentStopSequences(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_deserializeDocumentStorageConfiguration(v **types.StorageConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.StorageConfiguration + if *v == nil { + sv = &types.StorageConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "opensearchServerlessConfiguration": + if err := awsRestjson1_deserializeDocumentOpenSearchServerlessConfiguration(&sv.OpensearchServerlessConfiguration, value); err != nil { + return err + } + + case "pineconeConfiguration": + if err := awsRestjson1_deserializeDocumentPineconeConfiguration(&sv.PineconeConfiguration, value); err != nil { + return err + } + + case "redisEnterpriseCloudConfiguration": + if err := awsRestjson1_deserializeDocumentRedisEnterpriseCloudConfiguration(&sv.RedisEnterpriseCloudConfiguration, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStorageType to be of type string, got %T instead", value) + } + sv.Type = types.KnowledgeBaseStorageType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTagsMap(v *map[string]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]string + if *v == nil { + mv = map[string]string{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ThrottlingException + if *v == nil { + sv = &types.ThrottlingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ValidationException + if *v == nil { + sv = &types.ValidationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "fieldList": + if err := awsRestjson1_deserializeDocumentValidationExceptionFieldList(&sv.FieldList, value); err != nil { + return err + } + + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ValidationExceptionField + if *v == nil { + sv = &types.ValidationExceptionField{} + } 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationExceptionFieldList(v *[]types.ValidationExceptionField, 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.ValidationExceptionField + if *v == nil { + cv = []types.ValidationExceptionField{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ValidationExceptionField + destAddr := &col + if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentVectorIngestionConfiguration(v **types.VectorIngestionConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.VectorIngestionConfiguration + if *v == nil { + sv = &types.VectorIngestionConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "chunkingConfiguration": + if err := awsRestjson1_deserializeDocumentChunkingConfiguration(&sv.ChunkingConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentVectorKnowledgeBaseConfiguration(v **types.VectorKnowledgeBaseConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.VectorKnowledgeBaseConfiguration + if *v == nil { + sv = &types.VectorKnowledgeBaseConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "embeddingModelArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected BedrockEmbeddingModelArn to be of type string, got %T instead", value) + } + sv.EmbeddingModelArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/bedrockagent/doc.go b/service/bedrockagent/doc.go new file mode 100644 index 00000000000..25a9b74c76d --- /dev/null +++ b/service/bedrockagent/doc.go @@ -0,0 +1,8 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package bedrockagent provides the API client, operations, and parameter types +// for Agents for Amazon Bedrock. +// +// An example service, deployed with the Octane Service creator, which will echo +// the string +package bedrockagent diff --git a/service/bedrockagent/endpoints.go b/service/bedrockagent/endpoints.go new file mode 100644 index 00000000000..068db137928 --- /dev/null +++ b/service/bedrockagent/endpoints.go @@ -0,0 +1,509 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + "github.com/aws/aws-sdk-go-v2/internal/endpoints" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/bedrockagent/internal/endpoints" + smithyauth "github.com/aws/smithy-go/auth" + 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" + "os" + "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 = "bedrock" + } + 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() + } +} + +func resolveBaseEndpoint(cfg aws.Config, o *Options) { + if cfg.BaseEndpoint != nil { + o.BaseEndpoint = cfg.BaseEndpoint + } + + _, g := os.LookupEnv("AWS_ENDPOINT_URL") + _, s := os.LookupEnv("AWS_ENDPOINT_URL_BEDROCK_AGENT") + + if g && !s { + return + } + + value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "Bedrock Agent", cfg.ConfigSources) + if found && err == nil { + o.BaseEndpoint = &value + } +} + +// 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://bedrock-agent-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 _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://bedrock-agent-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://bedrock-agent.") + 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://bedrock-agent.") + 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") +} + +type endpointParamsBinder interface { + bindEndpointParams(*EndpointParameters) +} + +func bindEndpointParams(input interface{}, options Options) *EndpointParameters { + params := &EndpointParameters{} + + params.Region = aws.String(endpoints.MapFIPSRegion(options.Region)) + params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled) + params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) + params.Endpoint = options.BaseEndpoint + + if b, ok := input.(endpointParamsBinder); ok { + b.bindEndpointParams(params) + } + + return params +} + +type resolveEndpointV2Middleware struct { + options Options +} + +func (*resolveEndpointV2Middleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleFinalize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.options.EndpointResolverV2 == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := bindEndpointParams(getOperationInput(ctx), m.options) + endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + if endpt.URI.RawPath == "" && req.URL.RawPath != "" { + endpt.URI.RawPath = endpt.URI.Path + } + req.URL.Scheme = endpt.URI.Scheme + req.URL.Host = endpt.URI.Host + req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) + req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) + for k := range endpt.Headers { + req.Header.Set(k, endpt.Headers.Get(k)) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) + for _, o := range opts { + rscheme.SignerProperties.SetAll(&o.SignerProperties) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/bedrockagent/endpoints_config_test.go b/service/bedrockagent/endpoints_config_test.go new file mode 100644 index 00000000000..0ee962835af --- /dev/null +++ b/service/bedrockagent/endpoints_config_test.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "os" + "reflect" + "testing" +) + +type mockConfigSource struct { + global string + service string + ignore bool +} + +// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured +// endpoints feature. +func (m mockConfigSource) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) { + return m.ignore, m.ignore, nil +} + +// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use +// with configured endpoints. +func (m mockConfigSource) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) { + if m.service != "" { + return m.service, true, nil + } + return "", false, nil +} + +func TestResolveBaseEndpoint(t *testing.T) { + cases := map[string]struct { + envGlobal string + envService string + envIgnore bool + configGlobal string + configService string + configIgnore bool + clientEndpoint *string + expectURL *string + }{ + "env ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent.dev", + envIgnore: true, + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + expectURL: nil, + }, + "env global": { + envGlobal: "https://env-global.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + expectURL: aws.String("https://env-global.dev"), + }, + "env service": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + expectURL: aws.String("https://env-bedrock-agent.dev"), + }, + "config ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + configIgnore: true, + expectURL: nil, + }, + "config global": { + configGlobal: "http://config-global.dev", + expectURL: aws.String("http://config-global.dev"), + }, + "config service": { + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + expectURL: aws.String("http://config-bedrock-agent.dev"), + }, + "client": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent.dev", + clientEndpoint: aws.String("https://client-bedrock-agent.dev"), + expectURL: aws.String("https://client-bedrock-agent.dev"), + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + os.Clearenv() + + awsConfig := aws.Config{} + ignore := c.envIgnore || c.configIgnore + + if c.configGlobal != "" && !ignore { + awsConfig.BaseEndpoint = aws.String(c.configGlobal) + } + + if c.envGlobal != "" { + t.Setenv("AWS_ENDPOINT_URL", c.envGlobal) + if !ignore { + awsConfig.BaseEndpoint = aws.String(c.envGlobal) + } + } + + if c.envService != "" { + t.Setenv("AWS_ENDPOINT_URL_BEDROCK_AGENT", c.envService) + } + + awsConfig.ConfigSources = []interface{}{ + mockConfigSource{ + global: c.envGlobal, + service: c.envService, + ignore: c.envIgnore, + }, + mockConfigSource{ + global: c.configGlobal, + service: c.configService, + ignore: c.configIgnore, + }, + } + + client := NewFromConfig(awsConfig, func(o *Options) { + if c.clientEndpoint != nil { + o.BaseEndpoint = c.clientEndpoint + } + }) + + if e, a := c.expectURL, client.options.BaseEndpoint; !reflect.DeepEqual(e, a) { + t.Errorf("expect endpoint %v , got %v", e, a) + } + }) + } +} diff --git a/service/bedrockagent/endpoints_test.go b/service/bedrockagent/endpoints_test.go new file mode 100644 index 00000000000..f8100d4ae1f --- /dev/null +++ b/service/bedrockagent/endpoints_test.go @@ -0,0 +1,856 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +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://bedrock-agent-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://bedrock-agent-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://bedrock-agent.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://bedrock-agent.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://bedrock-agent-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://bedrock-agent-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://bedrock-agent.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://bedrock-agent.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://bedrock-agent-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://bedrock-agent-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://bedrock-agent.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://bedrock-agent.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://bedrock-agent-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://bedrock-agent.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://bedrock-agent-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://bedrock-agent.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/bedrockagent/generated.json b/service/bedrockagent/generated.json new file mode 100644 index 00000000000..f6d18b4ff61 --- /dev/null +++ b/service/bedrockagent/generated.json @@ -0,0 +1,73 @@ +{ + "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_AssociateAgentKnowledgeBase.go", + "api_op_CreateAgent.go", + "api_op_CreateAgentActionGroup.go", + "api_op_CreateAgentAlias.go", + "api_op_CreateDataSource.go", + "api_op_CreateKnowledgeBase.go", + "api_op_DeleteAgent.go", + "api_op_DeleteAgentActionGroup.go", + "api_op_DeleteAgentAlias.go", + "api_op_DeleteAgentVersion.go", + "api_op_DeleteDataSource.go", + "api_op_DeleteKnowledgeBase.go", + "api_op_DisassociateAgentKnowledgeBase.go", + "api_op_GetAgent.go", + "api_op_GetAgentActionGroup.go", + "api_op_GetAgentAlias.go", + "api_op_GetAgentKnowledgeBase.go", + "api_op_GetAgentVersion.go", + "api_op_GetDataSource.go", + "api_op_GetIngestionJob.go", + "api_op_GetKnowledgeBase.go", + "api_op_ListAgentActionGroups.go", + "api_op_ListAgentAliases.go", + "api_op_ListAgentKnowledgeBases.go", + "api_op_ListAgentVersions.go", + "api_op_ListAgents.go", + "api_op_ListDataSources.go", + "api_op_ListIngestionJobs.go", + "api_op_ListKnowledgeBases.go", + "api_op_ListTagsForResource.go", + "api_op_PrepareAgent.go", + "api_op_StartIngestionJob.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateAgent.go", + "api_op_UpdateAgentActionGroup.go", + "api_op_UpdateAgentAlias.go", + "api_op_UpdateAgentKnowledgeBase.go", + "api_op_UpdateDataSource.go", + "api_op_UpdateKnowledgeBase.go", + "auth.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "endpoints_config_test.go", + "endpoints_test.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "options.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/bedrockagent", + "unstable": false +} diff --git a/service/bedrockagent/go.mod b/service/bedrockagent/go.mod new file mode 100644 index 00000000000..47e83e9fa79 --- /dev/null +++ b/service/bedrockagent/go.mod @@ -0,0 +1,17 @@ +module github.com/aws/aws-sdk-go-v2/service/bedrockagent + +go 1.19 + +require ( + github.com/aws/aws-sdk-go-v2 v1.23.1 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 + github.com/aws/smithy-go v1.17.0 + 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/bedrockagent/go.sum b/service/bedrockagent/go.sum new file mode 100644 index 00000000000..42e4fc806b4 --- /dev/null +++ b/service/bedrockagent/go.sum @@ -0,0 +1,4 @@ +github.com/aws/smithy-go v1.17.0 h1:wWJD7LX6PBV6etBUwO0zElG0nWN9rUhp0WdYeHSHAaI= +github.com/aws/smithy-go v1.17.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/bedrockagent/go_module_metadata.go b/service/bedrockagent/go_module_metadata.go new file mode 100644 index 00000000000..12ad42db1d3 --- /dev/null +++ b/service/bedrockagent/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package bedrockagent + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/bedrockagent/internal/endpoints/endpoints.go b/service/bedrockagent/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..a69f94d0053 --- /dev/null +++ b/service/bedrockagent/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 Bedrock Agent 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: "bedrock-agent.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{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: "bedrock-agent.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/bedrockagent/internal/endpoints/endpoints_test.go b/service/bedrockagent/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/bedrockagent/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/bedrockagent/options.go b/service/bedrockagent/options.go new file mode 100644 index 00000000000..b52f7c2bd95 --- /dev/null +++ b/service/bedrockagent/options.go @@ -0,0 +1,223 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" +) + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +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 operation. 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 + + // The auth scheme resolver which determines how to authenticate for each + // operation. + AuthSchemeResolver AuthSchemeResolver + + // The list of auth schemes supported by the client. + AuthSchemes []smithyhttp.AuthScheme +} + +// 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 (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { + if schemeID == "aws.auth#sigv4" { + return getSigV4IdentityResolver(o) + } + if schemeID == "smithy.api#noAuth" { + return &smithyauth.AnonymousIdentityResolver{} + } + return nil +} + +// 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 + } +} + +func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { + if o.Credentials != nil { + return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} + } + return nil +} + +// WithSigV4SigningName applies an override to the authentication workflow to +// use the given signing name for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing name from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningName(name string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), + middleware.Before, + ) + }) + } +} + +// WithSigV4SigningRegion applies an override to the authentication workflow to +// use the given signing region for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing region from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningRegion(region string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), + middleware.Before, + ) + }) + } +} + +func ignoreAnonymousAuth(options *Options) { + if _, ok := options.Credentials.(aws.AnonymousCredentials); ok { + options.Credentials = nil + } +} diff --git a/service/bedrockagent/protocol_test.go b/service/bedrockagent/protocol_test.go new file mode 100644 index 00000000000..a92a83dce15 --- /dev/null +++ b/service/bedrockagent/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent diff --git a/service/bedrockagent/serializers.go b/service/bedrockagent/serializers.go new file mode 100644 index 00000000000..cc7852f6150 --- /dev/null +++ b/service/bedrockagent/serializers.go @@ -0,0 +1,4334 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/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" + "math" +) + +type awsRestjson1_serializeOpAssociateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpAssociateAgentKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAssociateAgentKnowledgeBase) 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.(*AssociateAgentKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/knowledgebases/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsAssociateAgentKnowledgeBaseInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentAssociateAgentKnowledgeBaseInput(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_serializeOpHttpBindingsAssociateAgentKnowledgeBaseInput(v *AssociateAgentKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentAssociateAgentKnowledgeBaseInput(v *AssociateAgentKnowledgeBaseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.KnowledgeBaseId != nil { + ok := object.Key("knowledgeBaseId") + ok.String(*v.KnowledgeBaseId) + } + + if len(v.KnowledgeBaseState) > 0 { + ok := object.Key("knowledgeBaseState") + ok.String(string(v.KnowledgeBaseState)) + } + + return nil +} + +type awsRestjson1_serializeOpCreateAgent struct { +} + +func (*awsRestjson1_serializeOpCreateAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAgent) 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.(*CreateAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpDocumentCreateAgentInput(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_serializeOpHttpBindingsCreateAgentInput(v *CreateAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAgentInput(v *CreateAgentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AgentName != nil { + ok := object.Key("agentName") + ok.String(*v.AgentName) + } + + if v.AgentResourceRoleArn != nil { + ok := object.Key("agentResourceRoleArn") + ok.String(*v.AgentResourceRoleArn) + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.CustomerEncryptionKeyArn != nil { + ok := object.Key("customerEncryptionKeyArn") + ok.String(*v.CustomerEncryptionKeyArn) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.FoundationModel != nil { + ok := object.Key("foundationModel") + ok.String(*v.FoundationModel) + } + + if v.IdleSessionTTLInSeconds != nil { + ok := object.Key("idleSessionTTLInSeconds") + ok.Integer(*v.IdleSessionTTLInSeconds) + } + + if v.Instruction != nil { + ok := object.Key("instruction") + ok.String(*v.Instruction) + } + + if v.PromptOverrideConfiguration != nil { + ok := object.Key("promptOverrideConfiguration") + if err := awsRestjson1_serializeDocumentPromptOverrideConfiguration(v.PromptOverrideConfiguration, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagsMap(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateAgentActionGroup struct { +} + +func (*awsRestjson1_serializeOpCreateAgentActionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAgentActionGroup) 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.(*CreateAgentActionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/actiongroups/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsCreateAgentActionGroupInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateAgentActionGroupInput(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_serializeOpHttpBindingsCreateAgentActionGroupInput(v *CreateAgentActionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAgentActionGroupInput(v *CreateAgentActionGroupInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ActionGroupExecutor != nil { + ok := object.Key("actionGroupExecutor") + if err := awsRestjson1_serializeDocumentActionGroupExecutor(v.ActionGroupExecutor, ok); err != nil { + return err + } + } + + if v.ActionGroupName != nil { + ok := object.Key("actionGroupName") + ok.String(*v.ActionGroupName) + } + + if len(v.ActionGroupState) > 0 { + ok := object.Key("actionGroupState") + ok.String(string(v.ActionGroupState)) + } + + if v.ApiSchema != nil { + ok := object.Key("apiSchema") + if err := awsRestjson1_serializeDocumentAPISchema(v.ApiSchema, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if len(v.ParentActionGroupSignature) > 0 { + ok := object.Key("parentActionGroupSignature") + ok.String(string(v.ParentActionGroupSignature)) + } + + return nil +} + +type awsRestjson1_serializeOpCreateAgentAlias struct { +} + +func (*awsRestjson1_serializeOpCreateAgentAlias) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAgentAlias) 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.(*CreateAgentAliasInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentaliases/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsCreateAgentAliasInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateAgentAliasInput(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_serializeOpHttpBindingsCreateAgentAliasInput(v *CreateAgentAliasInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAgentAliasInput(v *CreateAgentAliasInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AgentAliasName != nil { + ok := object.Key("agentAliasName") + ok.String(*v.AgentAliasName) + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.RoutingConfiguration != nil { + ok := object.Key("routingConfiguration") + if err := awsRestjson1_serializeDocumentAgentAliasRoutingConfiguration(v.RoutingConfiguration, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagsMap(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateDataSource struct { +} + +func (*awsRestjson1_serializeOpCreateDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateDataSource) 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.(*CreateDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsCreateDataSourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateDataSourceInput(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_serializeOpHttpBindingsCreateDataSourceInput(v *CreateDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateDataSourceInput(v *CreateDataSourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.DataSourceConfiguration != nil { + ok := object.Key("dataSourceConfiguration") + if err := awsRestjson1_serializeDocumentDataSourceConfiguration(v.DataSourceConfiguration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.ServerSideEncryptionConfiguration != nil { + ok := object.Key("serverSideEncryptionConfiguration") + if err := awsRestjson1_serializeDocumentServerSideEncryptionConfiguration(v.ServerSideEncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.VectorIngestionConfiguration != nil { + ok := object.Key("vectorIngestionConfiguration") + if err := awsRestjson1_serializeDocumentVectorIngestionConfiguration(v.VectorIngestionConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpCreateKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateKnowledgeBase) 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.(*CreateKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpDocumentCreateKnowledgeBaseInput(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_serializeOpHttpBindingsCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.KnowledgeBaseConfiguration != nil { + ok := object.Key("knowledgeBaseConfiguration") + if err := awsRestjson1_serializeDocumentKnowledgeBaseConfiguration(v.KnowledgeBaseConfiguration, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.StorageConfiguration != nil { + ok := object.Key("storageConfiguration") + if err := awsRestjson1_serializeDocumentStorageConfiguration(v.StorageConfiguration, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagsMap(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteAgent struct { +} + +func (*awsRestjson1_serializeOpDeleteAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAgent) 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.(*DeleteAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/") + 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_serializeOpHttpBindingsDeleteAgentInput(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_serializeOpHttpBindingsDeleteAgentInput(v *DeleteAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.SkipResourceInUseCheck { + encoder.SetQuery("skipResourceInUseCheck").Boolean(v.SkipResourceInUseCheck) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteAgentActionGroup struct { +} + +func (*awsRestjson1_serializeOpDeleteAgentActionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAgentActionGroup) 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.(*DeleteAgentActionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/actiongroups/{actionGroupId}/") + 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_serializeOpHttpBindingsDeleteAgentActionGroupInput(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_serializeOpHttpBindingsDeleteAgentActionGroupInput(v *DeleteAgentActionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ActionGroupId == nil || len(*v.ActionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member actionGroupId must not be empty")} + } + if v.ActionGroupId != nil { + if err := encoder.SetURI("actionGroupId").String(*v.ActionGroupId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + if v.SkipResourceInUseCheck { + encoder.SetQuery("skipResourceInUseCheck").Boolean(v.SkipResourceInUseCheck) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteAgentAlias struct { +} + +func (*awsRestjson1_serializeOpDeleteAgentAlias) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAgentAlias) 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.(*DeleteAgentAliasInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentaliases/{agentAliasId}/") + 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_serializeOpHttpBindingsDeleteAgentAliasInput(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_serializeOpHttpBindingsDeleteAgentAliasInput(v *DeleteAgentAliasInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentAliasId == nil || len(*v.AgentAliasId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentAliasId must not be empty")} + } + if v.AgentAliasId != nil { + if err := encoder.SetURI("agentAliasId").String(*v.AgentAliasId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteAgentVersion struct { +} + +func (*awsRestjson1_serializeOpDeleteAgentVersion) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAgentVersion) 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.(*DeleteAgentVersionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/") + 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_serializeOpHttpBindingsDeleteAgentVersionInput(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_serializeOpHttpBindingsDeleteAgentVersionInput(v *DeleteAgentVersionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + if v.SkipResourceInUseCheck { + encoder.SetQuery("skipResourceInUseCheck").Boolean(v.SkipResourceInUseCheck) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteDataSource struct { +} + +func (*awsRestjson1_serializeOpDeleteDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteDataSource) 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.(*DeleteDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}") + 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_serializeOpHttpBindingsDeleteDataSourceInput(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_serializeOpHttpBindingsDeleteDataSourceInput(v *DeleteDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpDeleteKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteKnowledgeBase) 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.(*DeleteKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}") + 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_serializeOpHttpBindingsDeleteKnowledgeBaseInput(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_serializeOpHttpBindingsDeleteKnowledgeBaseInput(v *DeleteKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDisassociateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpDisassociateAgentKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisassociateAgentKnowledgeBase) 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.(*DisassociateAgentKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/knowledgebases/{knowledgeBaseId}/") + 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_serializeOpHttpBindingsDisassociateAgentKnowledgeBaseInput(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_serializeOpHttpBindingsDisassociateAgentKnowledgeBaseInput(v *DisassociateAgentKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAgent struct { +} + +func (*awsRestjson1_serializeOpGetAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAgent) 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.(*GetAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/") + 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_serializeOpHttpBindingsGetAgentInput(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_serializeOpHttpBindingsGetAgentInput(v *GetAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAgentActionGroup struct { +} + +func (*awsRestjson1_serializeOpGetAgentActionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAgentActionGroup) 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.(*GetAgentActionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/actiongroups/{actionGroupId}/") + 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_serializeOpHttpBindingsGetAgentActionGroupInput(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_serializeOpHttpBindingsGetAgentActionGroupInput(v *GetAgentActionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ActionGroupId == nil || len(*v.ActionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member actionGroupId must not be empty")} + } + if v.ActionGroupId != nil { + if err := encoder.SetURI("actionGroupId").String(*v.ActionGroupId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAgentAlias struct { +} + +func (*awsRestjson1_serializeOpGetAgentAlias) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAgentAlias) 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.(*GetAgentAliasInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentaliases/{agentAliasId}/") + 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_serializeOpHttpBindingsGetAgentAliasInput(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_serializeOpHttpBindingsGetAgentAliasInput(v *GetAgentAliasInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentAliasId == nil || len(*v.AgentAliasId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentAliasId must not be empty")} + } + if v.AgentAliasId != nil { + if err := encoder.SetURI("agentAliasId").String(*v.AgentAliasId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAgentKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpGetAgentKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAgentKnowledgeBase) 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.(*GetAgentKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/knowledgebases/{knowledgeBaseId}/") + 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_serializeOpHttpBindingsGetAgentKnowledgeBaseInput(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_serializeOpHttpBindingsGetAgentKnowledgeBaseInput(v *GetAgentKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAgentVersion struct { +} + +func (*awsRestjson1_serializeOpGetAgentVersion) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAgentVersion) 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.(*GetAgentVersionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/") + 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_serializeOpHttpBindingsGetAgentVersionInput(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_serializeOpHttpBindingsGetAgentVersionInput(v *GetAgentVersionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetDataSource struct { +} + +func (*awsRestjson1_serializeOpGetDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetDataSource) 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.(*GetDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}") + 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_serializeOpHttpBindingsGetDataSourceInput(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_serializeOpHttpBindingsGetDataSourceInput(v *GetDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetIngestionJob struct { +} + +func (*awsRestjson1_serializeOpGetIngestionJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetIngestionJob) 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.(*GetIngestionJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/ingestionjobs/{ingestionJobId}") + 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_serializeOpHttpBindingsGetIngestionJobInput(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_serializeOpHttpBindingsGetIngestionJobInput(v *GetIngestionJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IngestionJobId == nil || len(*v.IngestionJobId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ingestionJobId must not be empty")} + } + if v.IngestionJobId != nil { + if err := encoder.SetURI("ingestionJobId").String(*v.IngestionJobId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpGetKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetKnowledgeBase) 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.(*GetKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}") + 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_serializeOpHttpBindingsGetKnowledgeBaseInput(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_serializeOpHttpBindingsGetKnowledgeBaseInput(v *GetKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListAgentActionGroups struct { +} + +func (*awsRestjson1_serializeOpListAgentActionGroups) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAgentActionGroups) 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.(*ListAgentActionGroupsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/actiongroups/") + 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_serializeOpHttpBindingsListAgentActionGroupsInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListAgentActionGroupsInput(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_serializeOpHttpBindingsListAgentActionGroupsInput(v *ListAgentActionGroupsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListAgentActionGroupsInput(v *ListAgentActionGroupsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListAgentAliases struct { +} + +func (*awsRestjson1_serializeOpListAgentAliases) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAgentAliases) 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.(*ListAgentAliasesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentaliases/") + 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_serializeOpHttpBindingsListAgentAliasesInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListAgentAliasesInput(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_serializeOpHttpBindingsListAgentAliasesInput(v *ListAgentAliasesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListAgentAliasesInput(v *ListAgentAliasesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListAgentKnowledgeBases struct { +} + +func (*awsRestjson1_serializeOpListAgentKnowledgeBases) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAgentKnowledgeBases) 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.(*ListAgentKnowledgeBasesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/knowledgebases/") + 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_serializeOpHttpBindingsListAgentKnowledgeBasesInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListAgentKnowledgeBasesInput(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_serializeOpHttpBindingsListAgentKnowledgeBasesInput(v *ListAgentKnowledgeBasesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListAgentKnowledgeBasesInput(v *ListAgentKnowledgeBasesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListAgents struct { +} + +func (*awsRestjson1_serializeOpListAgents) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAgents) 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.(*ListAgentsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/") + 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_serializeOpDocumentListAgentsInput(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_serializeOpHttpBindingsListAgentsInput(v *ListAgentsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListAgentsInput(v *ListAgentsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListAgentVersions struct { +} + +func (*awsRestjson1_serializeOpListAgentVersions) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAgentVersions) 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.(*ListAgentVersionsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/") + 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_serializeOpHttpBindingsListAgentVersionsInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListAgentVersionsInput(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_serializeOpHttpBindingsListAgentVersionsInput(v *ListAgentVersionsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListAgentVersionsInput(v *ListAgentVersionsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListDataSources struct { +} + +func (*awsRestjson1_serializeOpListDataSources) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListDataSources) 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.(*ListDataSourcesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/") + 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_serializeOpHttpBindingsListDataSourcesInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListDataSourcesInput(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_serializeOpHttpBindingsListDataSourcesInput(v *ListDataSourcesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListDataSourcesInput(v *ListDataSourcesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListIngestionJobs struct { +} + +func (*awsRestjson1_serializeOpListIngestionJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListIngestionJobs) 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.(*ListIngestionJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/ingestionjobs/") + 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_serializeOpHttpBindingsListIngestionJobsInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListIngestionJobsInput(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_serializeOpHttpBindingsListIngestionJobsInput(v *ListIngestionJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListIngestionJobsInput(v *ListIngestionJobsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Filters != nil { + ok := object.Key("filters") + if err := awsRestjson1_serializeDocumentIngestionJobFilters(v.Filters, ok); err != nil { + return err + } + } + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + if v.SortBy != nil { + ok := object.Key("sortBy") + if err := awsRestjson1_serializeDocumentIngestionJobSortBy(v.SortBy, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListKnowledgeBases struct { +} + +func (*awsRestjson1_serializeOpListKnowledgeBases) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListKnowledgeBases) 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.(*ListKnowledgeBasesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/") + 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_serializeOpDocumentListKnowledgeBasesInput(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_serializeOpHttpBindingsListKnowledgeBasesInput(v *ListKnowledgeBasesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListKnowledgeBasesInput(v *ListKnowledgeBasesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + 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_serializeOpPrepareAgent struct { +} + +func (*awsRestjson1_serializeOpPrepareAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpPrepareAgent) 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.(*PrepareAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/") + 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_serializeOpHttpBindingsPrepareAgentInput(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_serializeOpHttpBindingsPrepareAgentInput(v *PrepareAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpStartIngestionJob struct { +} + +func (*awsRestjson1_serializeOpStartIngestionJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartIngestionJob) 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.(*StartIngestionJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/ingestionjobs/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsStartIngestionJobInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentStartIngestionJobInput(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_serializeOpHttpBindingsStartIngestionJobInput(v *StartIngestionJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartIngestionJobInput(v *StartIngestionJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + 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_serializeDocumentTagsMap(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_serializeOpUpdateAgent struct { +} + +func (*awsRestjson1_serializeOpUpdateAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateAgent) 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.(*UpdateAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateAgentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateAgentInput(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_serializeOpHttpBindingsUpdateAgentInput(v *UpdateAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateAgentInput(v *UpdateAgentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AgentName != nil { + ok := object.Key("agentName") + ok.String(*v.AgentName) + } + + if v.AgentResourceRoleArn != nil { + ok := object.Key("agentResourceRoleArn") + ok.String(*v.AgentResourceRoleArn) + } + + if v.CustomerEncryptionKeyArn != nil { + ok := object.Key("customerEncryptionKeyArn") + ok.String(*v.CustomerEncryptionKeyArn) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.FoundationModel != nil { + ok := object.Key("foundationModel") + ok.String(*v.FoundationModel) + } + + if v.IdleSessionTTLInSeconds != nil { + ok := object.Key("idleSessionTTLInSeconds") + ok.Integer(*v.IdleSessionTTLInSeconds) + } + + if v.Instruction != nil { + ok := object.Key("instruction") + ok.String(*v.Instruction) + } + + if v.PromptOverrideConfiguration != nil { + ok := object.Key("promptOverrideConfiguration") + if err := awsRestjson1_serializeDocumentPromptOverrideConfiguration(v.PromptOverrideConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateAgentActionGroup struct { +} + +func (*awsRestjson1_serializeOpUpdateAgentActionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateAgentActionGroup) 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.(*UpdateAgentActionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/actiongroups/{actionGroupId}/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateAgentActionGroupInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateAgentActionGroupInput(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_serializeOpHttpBindingsUpdateAgentActionGroupInput(v *UpdateAgentActionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ActionGroupId == nil || len(*v.ActionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member actionGroupId must not be empty")} + } + if v.ActionGroupId != nil { + if err := encoder.SetURI("actionGroupId").String(*v.ActionGroupId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateAgentActionGroupInput(v *UpdateAgentActionGroupInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ActionGroupExecutor != nil { + ok := object.Key("actionGroupExecutor") + if err := awsRestjson1_serializeDocumentActionGroupExecutor(v.ActionGroupExecutor, ok); err != nil { + return err + } + } + + if v.ActionGroupName != nil { + ok := object.Key("actionGroupName") + ok.String(*v.ActionGroupName) + } + + if len(v.ActionGroupState) > 0 { + ok := object.Key("actionGroupState") + ok.String(string(v.ActionGroupState)) + } + + if v.ApiSchema != nil { + ok := object.Key("apiSchema") + if err := awsRestjson1_serializeDocumentAPISchema(v.ApiSchema, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if len(v.ParentActionGroupSignature) > 0 { + ok := object.Key("parentActionGroupSignature") + ok.String(string(v.ParentActionGroupSignature)) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateAgentAlias struct { +} + +func (*awsRestjson1_serializeOpUpdateAgentAlias) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateAgentAlias) 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.(*UpdateAgentAliasInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentaliases/{agentAliasId}/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateAgentAliasInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateAgentAliasInput(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_serializeOpHttpBindingsUpdateAgentAliasInput(v *UpdateAgentAliasInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentAliasId == nil || len(*v.AgentAliasId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentAliasId must not be empty")} + } + if v.AgentAliasId != nil { + if err := encoder.SetURI("agentAliasId").String(*v.AgentAliasId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateAgentAliasInput(v *UpdateAgentAliasInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AgentAliasName != nil { + ok := object.Key("agentAliasName") + ok.String(*v.AgentAliasName) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.RoutingConfiguration != nil { + ok := object.Key("routingConfiguration") + if err := awsRestjson1_serializeDocumentAgentAliasRoutingConfiguration(v.RoutingConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateAgentKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpUpdateAgentKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateAgentKnowledgeBase) 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.(*UpdateAgentKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentversions/{agentVersion}/knowledgebases/{knowledgeBaseId}/") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateAgentKnowledgeBaseInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateAgentKnowledgeBaseInput(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_serializeOpHttpBindingsUpdateAgentKnowledgeBaseInput(v *UpdateAgentKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.AgentVersion == nil || len(*v.AgentVersion) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentVersion must not be empty")} + } + if v.AgentVersion != nil { + if err := encoder.SetURI("agentVersion").String(*v.AgentVersion); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateAgentKnowledgeBaseInput(v *UpdateAgentKnowledgeBaseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if len(v.KnowledgeBaseState) > 0 { + ok := object.Key("knowledgeBaseState") + ok.String(string(v.KnowledgeBaseState)) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateDataSource struct { +} + +func (*awsRestjson1_serializeOpUpdateDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateDataSource) 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.(*UpdateDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateDataSourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateDataSourceInput(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_serializeOpHttpBindingsUpdateDataSourceInput(v *UpdateDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateDataSourceInput(v *UpdateDataSourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceConfiguration != nil { + ok := object.Key("dataSourceConfiguration") + if err := awsRestjson1_serializeDocumentDataSourceConfiguration(v.DataSourceConfiguration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.ServerSideEncryptionConfiguration != nil { + ok := object.Key("serverSideEncryptionConfiguration") + if err := awsRestjson1_serializeDocumentServerSideEncryptionConfiguration(v.ServerSideEncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.VectorIngestionConfiguration != nil { + ok := object.Key("vectorIngestionConfiguration") + if err := awsRestjson1_serializeDocumentVectorIngestionConfiguration(v.VectorIngestionConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpUpdateKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateKnowledgeBase) 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.(*UpdateKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateKnowledgeBaseInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateKnowledgeBaseInput(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_serializeOpHttpBindingsUpdateKnowledgeBaseInput(v *UpdateKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateKnowledgeBaseInput(v *UpdateKnowledgeBaseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.KnowledgeBaseConfiguration != nil { + ok := object.Key("knowledgeBaseConfiguration") + if err := awsRestjson1_serializeDocumentKnowledgeBaseConfiguration(v.KnowledgeBaseConfiguration, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.StorageConfiguration != nil { + ok := object.Key("storageConfiguration") + if err := awsRestjson1_serializeDocumentStorageConfiguration(v.StorageConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentActionGroupExecutor(v types.ActionGroupExecutor, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.ActionGroupExecutorMemberLambda: + av := object.Key("lambda") + av.String(uv.Value) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentAgentAliasRoutingConfiguration(v []types.AgentAliasRoutingConfigurationListItem, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentAgentAliasRoutingConfigurationListItem(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentAgentAliasRoutingConfigurationListItem(v *types.AgentAliasRoutingConfigurationListItem, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AgentVersion != nil { + ok := object.Key("agentVersion") + ok.String(*v.AgentVersion) + } + + return nil +} + +func awsRestjson1_serializeDocumentAPISchema(v types.APISchema, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.APISchemaMemberPayload: + av := object.Key("payload") + av.String(uv.Value) + + case *types.APISchemaMemberS3: + av := object.Key("s3") + if err := awsRestjson1_serializeDocumentS3Identifier(&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_serializeDocumentChunkingConfiguration(v *types.ChunkingConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ChunkingStrategy) > 0 { + ok := object.Key("chunkingStrategy") + ok.String(string(v.ChunkingStrategy)) + } + + if v.FixedSizeChunkingConfiguration != nil { + ok := object.Key("fixedSizeChunkingConfiguration") + if err := awsRestjson1_serializeDocumentFixedSizeChunkingConfiguration(v.FixedSizeChunkingConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDataSourceConfiguration(v *types.DataSourceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.S3Configuration != nil { + ok := object.Key("s3Configuration") + if err := awsRestjson1_serializeDocumentS3DataSourceConfiguration(v.S3Configuration, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +func awsRestjson1_serializeDocumentFixedSizeChunkingConfiguration(v *types.FixedSizeChunkingConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxTokens != nil { + ok := object.Key("maxTokens") + ok.Integer(*v.MaxTokens) + } + + if v.OverlapPercentage != nil { + ok := object.Key("overlapPercentage") + ok.Integer(*v.OverlapPercentage) + } + + return nil +} + +func awsRestjson1_serializeDocumentInferenceConfiguration(v *types.InferenceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaximumLength != nil { + ok := object.Key("maximumLength") + ok.Integer(*v.MaximumLength) + } + + if v.StopSequences != nil { + ok := object.Key("stopSequences") + if err := awsRestjson1_serializeDocumentStopSequences(v.StopSequences, ok); err != nil { + return err + } + } + + if v.Temperature != nil { + ok := object.Key("temperature") + switch { + case math.IsNaN(float64(*v.Temperature)): + ok.String("NaN") + + case math.IsInf(float64(*v.Temperature), 1): + ok.String("Infinity") + + case math.IsInf(float64(*v.Temperature), -1): + ok.String("-Infinity") + + default: + ok.Float(*v.Temperature) + + } + } + + if v.TopK != nil { + ok := object.Key("topK") + ok.Integer(*v.TopK) + } + + if v.TopP != nil { + ok := object.Key("topP") + switch { + case math.IsNaN(float64(*v.TopP)): + ok.String("NaN") + + case math.IsInf(float64(*v.TopP), 1): + ok.String("Infinity") + + case math.IsInf(float64(*v.TopP), -1): + ok.String("-Infinity") + + default: + ok.Float(*v.TopP) + + } + } + + return nil +} + +func awsRestjson1_serializeDocumentIngestionJobFilter(v *types.IngestionJobFilter, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Attribute) > 0 { + ok := object.Key("attribute") + ok.String(string(v.Attribute)) + } + + if len(v.Operator) > 0 { + ok := object.Key("operator") + ok.String(string(v.Operator)) + } + + if v.Values != nil { + ok := object.Key("values") + if err := awsRestjson1_serializeDocumentIngestionJobFilterValues(v.Values, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentIngestionJobFilters(v []types.IngestionJobFilter, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentIngestionJobFilter(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentIngestionJobFilterValues(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_serializeDocumentIngestionJobSortBy(v *types.IngestionJobSortBy, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Attribute) > 0 { + ok := object.Key("attribute") + ok.String(string(v.Attribute)) + } + + if len(v.Order) > 0 { + ok := object.Key("order") + ok.String(string(v.Order)) + } + + return nil +} + +func awsRestjson1_serializeDocumentKnowledgeBaseConfiguration(v *types.KnowledgeBaseConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + if v.VectorKnowledgeBaseConfiguration != nil { + ok := object.Key("vectorKnowledgeBaseConfiguration") + if err := awsRestjson1_serializeDocumentVectorKnowledgeBaseConfiguration(v.VectorKnowledgeBaseConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentOpenSearchServerlessConfiguration(v *types.OpenSearchServerlessConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CollectionArn != nil { + ok := object.Key("collectionArn") + ok.String(*v.CollectionArn) + } + + if v.FieldMapping != nil { + ok := object.Key("fieldMapping") + if err := awsRestjson1_serializeDocumentOpenSearchServerlessFieldMapping(v.FieldMapping, ok); err != nil { + return err + } + } + + if v.VectorIndexName != nil { + ok := object.Key("vectorIndexName") + ok.String(*v.VectorIndexName) + } + + return nil +} + +func awsRestjson1_serializeDocumentOpenSearchServerlessFieldMapping(v *types.OpenSearchServerlessFieldMapping, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetadataField != nil { + ok := object.Key("metadataField") + ok.String(*v.MetadataField) + } + + if v.TextField != nil { + ok := object.Key("textField") + ok.String(*v.TextField) + } + + if v.VectorField != nil { + ok := object.Key("vectorField") + ok.String(*v.VectorField) + } + + return nil +} + +func awsRestjson1_serializeDocumentPineconeConfiguration(v *types.PineconeConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ConnectionString != nil { + ok := object.Key("connectionString") + ok.String(*v.ConnectionString) + } + + if v.CredentialsSecretArn != nil { + ok := object.Key("credentialsSecretArn") + ok.String(*v.CredentialsSecretArn) + } + + if v.FieldMapping != nil { + ok := object.Key("fieldMapping") + if err := awsRestjson1_serializeDocumentPineconeFieldMapping(v.FieldMapping, ok); err != nil { + return err + } + } + + if v.Namespace != nil { + ok := object.Key("namespace") + ok.String(*v.Namespace) + } + + return nil +} + +func awsRestjson1_serializeDocumentPineconeFieldMapping(v *types.PineconeFieldMapping, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetadataField != nil { + ok := object.Key("metadataField") + ok.String(*v.MetadataField) + } + + if v.TextField != nil { + ok := object.Key("textField") + ok.String(*v.TextField) + } + + return nil +} + +func awsRestjson1_serializeDocumentPromptConfiguration(v *types.PromptConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BasePromptTemplate != nil { + ok := object.Key("basePromptTemplate") + ok.String(*v.BasePromptTemplate) + } + + if v.InferenceConfiguration != nil { + ok := object.Key("inferenceConfiguration") + if err := awsRestjson1_serializeDocumentInferenceConfiguration(v.InferenceConfiguration, ok); err != nil { + return err + } + } + + if len(v.ParserMode) > 0 { + ok := object.Key("parserMode") + ok.String(string(v.ParserMode)) + } + + if len(v.PromptCreationMode) > 0 { + ok := object.Key("promptCreationMode") + ok.String(string(v.PromptCreationMode)) + } + + if len(v.PromptState) > 0 { + ok := object.Key("promptState") + ok.String(string(v.PromptState)) + } + + if len(v.PromptType) > 0 { + ok := object.Key("promptType") + ok.String(string(v.PromptType)) + } + + return nil +} + +func awsRestjson1_serializeDocumentPromptConfigurations(v []types.PromptConfiguration, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentPromptConfiguration(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentPromptOverrideConfiguration(v *types.PromptOverrideConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.OverrideLambda != nil { + ok := object.Key("overrideLambda") + ok.String(*v.OverrideLambda) + } + + if v.PromptConfigurations != nil { + ok := object.Key("promptConfigurations") + if err := awsRestjson1_serializeDocumentPromptConfigurations(v.PromptConfigurations, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentRedisEnterpriseCloudConfiguration(v *types.RedisEnterpriseCloudConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CredentialsSecretArn != nil { + ok := object.Key("credentialsSecretArn") + ok.String(*v.CredentialsSecretArn) + } + + if v.Endpoint != nil { + ok := object.Key("endpoint") + ok.String(*v.Endpoint) + } + + if v.FieldMapping != nil { + ok := object.Key("fieldMapping") + if err := awsRestjson1_serializeDocumentRedisEnterpriseCloudFieldMapping(v.FieldMapping, ok); err != nil { + return err + } + } + + if v.VectorIndexName != nil { + ok := object.Key("vectorIndexName") + ok.String(*v.VectorIndexName) + } + + return nil +} + +func awsRestjson1_serializeDocumentRedisEnterpriseCloudFieldMapping(v *types.RedisEnterpriseCloudFieldMapping, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetadataField != nil { + ok := object.Key("metadataField") + ok.String(*v.MetadataField) + } + + if v.TextField != nil { + ok := object.Key("textField") + ok.String(*v.TextField) + } + + if v.VectorField != nil { + ok := object.Key("vectorField") + ok.String(*v.VectorField) + } + + return nil +} + +func awsRestjson1_serializeDocumentS3DataSourceConfiguration(v *types.S3DataSourceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BucketArn != nil { + ok := object.Key("bucketArn") + ok.String(*v.BucketArn) + } + + if v.InclusionPrefixes != nil { + ok := object.Key("inclusionPrefixes") + if err := awsRestjson1_serializeDocumentS3Prefixes(v.InclusionPrefixes, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentS3Identifier(v *types.S3Identifier, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.S3BucketName != nil { + ok := object.Key("s3BucketName") + ok.String(*v.S3BucketName) + } + + if v.S3ObjectKey != nil { + ok := object.Key("s3ObjectKey") + ok.String(*v.S3ObjectKey) + } + + return nil +} + +func awsRestjson1_serializeDocumentS3Prefixes(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_serializeDocumentServerSideEncryptionConfiguration(v *types.ServerSideEncryptionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KmsKeyArn != nil { + ok := object.Key("kmsKeyArn") + ok.String(*v.KmsKeyArn) + } + + return nil +} + +func awsRestjson1_serializeDocumentStopSequences(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_serializeDocumentStorageConfiguration(v *types.StorageConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.OpensearchServerlessConfiguration != nil { + ok := object.Key("opensearchServerlessConfiguration") + if err := awsRestjson1_serializeDocumentOpenSearchServerlessConfiguration(v.OpensearchServerlessConfiguration, ok); err != nil { + return err + } + } + + if v.PineconeConfiguration != nil { + ok := object.Key("pineconeConfiguration") + if err := awsRestjson1_serializeDocumentPineconeConfiguration(v.PineconeConfiguration, ok); err != nil { + return err + } + } + + if v.RedisEnterpriseCloudConfiguration != nil { + ok := object.Key("redisEnterpriseCloudConfiguration") + if err := awsRestjson1_serializeDocumentRedisEnterpriseCloudConfiguration(v.RedisEnterpriseCloudConfiguration, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +func awsRestjson1_serializeDocumentTagsMap(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_serializeDocumentVectorIngestionConfiguration(v *types.VectorIngestionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ChunkingConfiguration != nil { + ok := object.Key("chunkingConfiguration") + if err := awsRestjson1_serializeDocumentChunkingConfiguration(v.ChunkingConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentVectorKnowledgeBaseConfiguration(v *types.VectorKnowledgeBaseConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EmbeddingModelArn != nil { + ok := object.Key("embeddingModelArn") + ok.String(*v.EmbeddingModelArn) + } + + return nil +} diff --git a/service/bedrockagent/types/enums.go b/service/bedrockagent/types/enums.go new file mode 100644 index 00000000000..1f83ce046a8 --- /dev/null +++ b/service/bedrockagent/types/enums.go @@ -0,0 +1,369 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type ActionGroupSignature string + +// Enum values for ActionGroupSignature +const ( + ActionGroupSignatureAmazonUserinput ActionGroupSignature = "AMAZON.UserInput" +) + +// Values returns all known values for ActionGroupSignature. 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 (ActionGroupSignature) Values() []ActionGroupSignature { + return []ActionGroupSignature{ + "AMAZON.UserInput", + } +} + +type ActionGroupState string + +// Enum values for ActionGroupState +const ( + ActionGroupStateEnabled ActionGroupState = "ENABLED" + ActionGroupStateDisabled ActionGroupState = "DISABLED" +) + +// Values returns all known values for ActionGroupState. 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 (ActionGroupState) Values() []ActionGroupState { + return []ActionGroupState{ + "ENABLED", + "DISABLED", + } +} + +type AgentAliasStatus string + +// Enum values for AgentAliasStatus +const ( + AgentAliasStatusCreating AgentAliasStatus = "CREATING" + AgentAliasStatusPrepared AgentAliasStatus = "PREPARED" + AgentAliasStatusFailed AgentAliasStatus = "FAILED" + AgentAliasStatusUpdating AgentAliasStatus = "UPDATING" + AgentAliasStatusDeleting AgentAliasStatus = "DELETING" +) + +// Values returns all known values for AgentAliasStatus. 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 (AgentAliasStatus) Values() []AgentAliasStatus { + return []AgentAliasStatus{ + "CREATING", + "PREPARED", + "FAILED", + "UPDATING", + "DELETING", + } +} + +type AgentStatus string + +// Enum values for AgentStatus +const ( + AgentStatusCreating AgentStatus = "CREATING" + AgentStatusPreparing AgentStatus = "PREPARING" + AgentStatusPrepared AgentStatus = "PREPARED" + AgentStatusNotPrepared AgentStatus = "NOT_PREPARED" + AgentStatusDeleting AgentStatus = "DELETING" + AgentStatusFailed AgentStatus = "FAILED" + AgentStatusVersioning AgentStatus = "VERSIONING" + AgentStatusUpdating AgentStatus = "UPDATING" +) + +// Values returns all known values for AgentStatus. 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 (AgentStatus) Values() []AgentStatus { + return []AgentStatus{ + "CREATING", + "PREPARING", + "PREPARED", + "NOT_PREPARED", + "DELETING", + "FAILED", + "VERSIONING", + "UPDATING", + } +} + +type ChunkingStrategy string + +// Enum values for ChunkingStrategy +const ( + ChunkingStrategyFixedSize ChunkingStrategy = "FIXED_SIZE" + ChunkingStrategyNone ChunkingStrategy = "NONE" +) + +// Values returns all known values for ChunkingStrategy. 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 (ChunkingStrategy) Values() []ChunkingStrategy { + return []ChunkingStrategy{ + "FIXED_SIZE", + "NONE", + } +} + +type CreationMode string + +// Enum values for CreationMode +const ( + CreationModeDefault CreationMode = "DEFAULT" + CreationModeOverridden CreationMode = "OVERRIDDEN" +) + +// Values returns all known values for CreationMode. 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 (CreationMode) Values() []CreationMode { + return []CreationMode{ + "DEFAULT", + "OVERRIDDEN", + } +} + +type DataSourceStatus string + +// Enum values for DataSourceStatus +const ( + DataSourceStatusAvailable DataSourceStatus = "AVAILABLE" + DataSourceStatusDeleting DataSourceStatus = "DELETING" +) + +// Values returns all known values for DataSourceStatus. 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 (DataSourceStatus) Values() []DataSourceStatus { + return []DataSourceStatus{ + "AVAILABLE", + "DELETING", + } +} + +type DataSourceType string + +// Enum values for DataSourceType +const ( + DataSourceTypeS3 DataSourceType = "S3" +) + +// Values returns all known values for DataSourceType. 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 (DataSourceType) Values() []DataSourceType { + return []DataSourceType{ + "S3", + } +} + +type IngestionJobFilterAttribute string + +// Enum values for IngestionJobFilterAttribute +const ( + IngestionJobFilterAttributeStatus IngestionJobFilterAttribute = "STATUS" +) + +// Values returns all known values for IngestionJobFilterAttribute. 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 (IngestionJobFilterAttribute) Values() []IngestionJobFilterAttribute { + return []IngestionJobFilterAttribute{ + "STATUS", + } +} + +type IngestionJobFilterOperator string + +// Enum values for IngestionJobFilterOperator +const ( + IngestionJobFilterOperatorEq IngestionJobFilterOperator = "EQ" +) + +// Values returns all known values for IngestionJobFilterOperator. 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 (IngestionJobFilterOperator) Values() []IngestionJobFilterOperator { + return []IngestionJobFilterOperator{ + "EQ", + } +} + +type IngestionJobSortByAttribute string + +// Enum values for IngestionJobSortByAttribute +const ( + IngestionJobSortByAttributeStatus IngestionJobSortByAttribute = "STATUS" + IngestionJobSortByAttributeStartedAt IngestionJobSortByAttribute = "STARTED_AT" +) + +// Values returns all known values for IngestionJobSortByAttribute. 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 (IngestionJobSortByAttribute) Values() []IngestionJobSortByAttribute { + return []IngestionJobSortByAttribute{ + "STATUS", + "STARTED_AT", + } +} + +type IngestionJobStatus string + +// Enum values for IngestionJobStatus +const ( + IngestionJobStatusStarting IngestionJobStatus = "STARTING" + IngestionJobStatusInProgress IngestionJobStatus = "IN_PROGRESS" + IngestionJobStatusComplete IngestionJobStatus = "COMPLETE" + IngestionJobStatusFailed IngestionJobStatus = "FAILED" +) + +// Values returns all known values for IngestionJobStatus. 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 (IngestionJobStatus) Values() []IngestionJobStatus { + return []IngestionJobStatus{ + "STARTING", + "IN_PROGRESS", + "COMPLETE", + "FAILED", + } +} + +type KnowledgeBaseState string + +// Enum values for KnowledgeBaseState +const ( + KnowledgeBaseStateEnabled KnowledgeBaseState = "ENABLED" + KnowledgeBaseStateDisabled KnowledgeBaseState = "DISABLED" +) + +// Values returns all known values for KnowledgeBaseState. 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 (KnowledgeBaseState) Values() []KnowledgeBaseState { + return []KnowledgeBaseState{ + "ENABLED", + "DISABLED", + } +} + +type KnowledgeBaseStatus string + +// Enum values for KnowledgeBaseStatus +const ( + KnowledgeBaseStatusCreating KnowledgeBaseStatus = "CREATING" + KnowledgeBaseStatusActive KnowledgeBaseStatus = "ACTIVE" + KnowledgeBaseStatusDeleting KnowledgeBaseStatus = "DELETING" + KnowledgeBaseStatusUpdating KnowledgeBaseStatus = "UPDATING" + KnowledgeBaseStatusFailed KnowledgeBaseStatus = "FAILED" +) + +// Values returns all known values for KnowledgeBaseStatus. 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 (KnowledgeBaseStatus) Values() []KnowledgeBaseStatus { + return []KnowledgeBaseStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "UPDATING", + "FAILED", + } +} + +type KnowledgeBaseStorageType string + +// Enum values for KnowledgeBaseStorageType +const ( + KnowledgeBaseStorageTypeOpensearchServerless KnowledgeBaseStorageType = "OPENSEARCH_SERVERLESS" + KnowledgeBaseStorageTypePinecone KnowledgeBaseStorageType = "PINECONE" + KnowledgeBaseStorageTypeRedisEnterpriseCloud KnowledgeBaseStorageType = "REDIS_ENTERPRISE_CLOUD" +) + +// Values returns all known values for KnowledgeBaseStorageType. 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 (KnowledgeBaseStorageType) Values() []KnowledgeBaseStorageType { + return []KnowledgeBaseStorageType{ + "OPENSEARCH_SERVERLESS", + "PINECONE", + "REDIS_ENTERPRISE_CLOUD", + } +} + +type KnowledgeBaseType string + +// Enum values for KnowledgeBaseType +const ( + KnowledgeBaseTypeVector KnowledgeBaseType = "VECTOR" +) + +// Values returns all known values for KnowledgeBaseType. 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 (KnowledgeBaseType) Values() []KnowledgeBaseType { + return []KnowledgeBaseType{ + "VECTOR", + } +} + +type PromptState string + +// Enum values for PromptState +const ( + PromptStateEnabled PromptState = "ENABLED" + PromptStateDisabled PromptState = "DISABLED" +) + +// Values returns all known values for PromptState. 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 (PromptState) Values() []PromptState { + return []PromptState{ + "ENABLED", + "DISABLED", + } +} + +type PromptType string + +// Enum values for PromptType +const ( + PromptTypePreProcessing PromptType = "PRE_PROCESSING" + PromptTypeOrchestration PromptType = "ORCHESTRATION" + PromptTypePostProcessing PromptType = "POST_PROCESSING" + PromptTypeKnowledgeBaseResponseGeneration PromptType = "KNOWLEDGE_BASE_RESPONSE_GENERATION" +) + +// Values returns all known values for PromptType. 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 (PromptType) Values() []PromptType { + return []PromptType{ + "PRE_PROCESSING", + "ORCHESTRATION", + "POST_PROCESSING", + "KNOWLEDGE_BASE_RESPONSE_GENERATION", + } +} + +type SortOrder string + +// Enum values for SortOrder +const ( + SortOrderAscending SortOrder = "ASCENDING" + SortOrderDescending SortOrder = "DESCENDING" +) + +// Values returns all known values for SortOrder. 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 (SortOrder) Values() []SortOrder { + return []SortOrder{ + "ASCENDING", + "DESCENDING", + } +} diff --git a/service/bedrockagent/types/errors.go b/service/bedrockagent/types/errors.go new file mode 100644 index 00000000000..e50be30bd16 --- /dev/null +++ b/service/bedrockagent/types/errors.go @@ -0,0 +1,194 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// This exception is thrown when a request is denied per access permissions +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 exception is thrown when there is a conflict performing an operation +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown if there was an unexpected error during processing of +// request +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 } + +// This exception is thrown when a resource referenced by the operation does not +// exist +type ResourceNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ResourceNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ResourceNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when a request is made beyond the service quota +type ServiceQuotaExceededException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceQuotaExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceQuotaExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServiceQuotaExceededException" + } + return *e.ErrorCodeOverride +} +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when the number of requests exceeds the limit +type ThrottlingException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ThrottlingException" + } + return *e.ErrorCodeOverride +} +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when the request's input validation fails +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + FieldList []ValidationExceptionField + + 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/bedrockagent/types/types.go b/service/bedrockagent/types/types.go new file mode 100644 index 00000000000..d663d88275d --- /dev/null +++ b/service/bedrockagent/types/types.go @@ -0,0 +1,1209 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// Type of Executors for an Action Group +// +// The following types satisfy this interface: +// +// ActionGroupExecutorMemberLambda +type ActionGroupExecutor interface { + isActionGroupExecutor() +} + +// ARN of a Lambda. +type ActionGroupExecutorMemberLambda struct { + Value string + + noSmithyDocumentSerde +} + +func (*ActionGroupExecutorMemberLambda) isActionGroupExecutor() {} + +// ActionGroup Summary +type ActionGroupSummary struct { + + // Identifier for a resource. + // + // This member is required. + ActionGroupId *string + + // Name for a resource. + // + // This member is required. + ActionGroupName *string + + // State of the action group + // + // This member is required. + ActionGroupState ActionGroupState + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// Contains the information of an agent +type Agent struct { + + // Arn representation of the Agent. + // + // This member is required. + AgentArn *string + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Name for a resource. + // + // This member is required. + AgentName *string + + // ARN of a IAM role. + // + // This member is required. + AgentResourceRoleArn *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus AgentStatus + + // Draft Agent Version. + // + // This member is required. + AgentVersion *string + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Max Session Time. + // + // This member is required. + IdleSessionTTLInSeconds *int32 + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Client specified token used for idempotency checks + ClientToken *string + + // A KMS key ARN + CustomerEncryptionKeyArn *string + + // Description of the Resource. + Description *string + + // Failure Reasons for Error. + FailureReasons []string + + // ARN or name of a Bedrock model. + FoundationModel *string + + // Instruction for the agent. + Instruction *string + + // Time Stamp. + PreparedAt *time.Time + + // Configuration for prompt override. + PromptOverrideConfiguration *PromptOverrideConfiguration + + // The recommended actions users can take to resolve an error in failureReasons. + RecommendedActions []string + + noSmithyDocumentSerde +} + +// Contains the information of an Agent Action Group +type AgentActionGroup struct { + + // Identifier for a resource. + // + // This member is required. + ActionGroupId *string + + // Name for a resource. + // + // This member is required. + ActionGroupName *string + + // State of the action group + // + // This member is required. + ActionGroupState ActionGroupState + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Agent Version. + // + // This member is required. + AgentVersion *string + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Type of Executors for an Action Group + ActionGroupExecutor ActionGroupExecutor + + // Contains information about the API Schema for the Action Group + ApiSchema APISchema + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + // Action Group Signature for a BuiltIn Action + ParentActionSignature ActionGroupSignature + + noSmithyDocumentSerde +} + +// Contains the information of an agent alias +type AgentAlias struct { + + // Arn representation of the Agent Alias. + // + // This member is required. + AgentAliasArn *string + + // Id for an Agent Alias generated at the server side. + // + // This member is required. + AgentAliasId *string + + // Name for a resource. + // + // This member is required. + AgentAliasName *string + + // The statuses an Agent Alias can be in. + // + // This member is required. + AgentAliasStatus AgentAliasStatus + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Routing configuration for an Agent alias. + // + // This member is required. + RoutingConfiguration []AgentAliasRoutingConfigurationListItem + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // The list of history events for an alias for an Agent. + AgentAliasHistoryEvents []AgentAliasHistoryEvent + + // Client specified token used for idempotency checks + ClientToken *string + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// History event for an alias for an Agent. +type AgentAliasHistoryEvent struct { + + // Time Stamp. + EndDate *time.Time + + // Routing configuration for an Agent alias. + RoutingConfiguration []AgentAliasRoutingConfigurationListItem + + // Time Stamp. + StartDate *time.Time + + noSmithyDocumentSerde +} + +// Details about the routing configuration for an Agent alias. +type AgentAliasRoutingConfigurationListItem struct { + + // Agent Version. + // + // This member is required. + AgentVersion *string + + noSmithyDocumentSerde +} + +// Summary of an alias for an Agent. +type AgentAliasSummary struct { + + // Id for an Agent Alias generated at the server side. + // + // This member is required. + AgentAliasId *string + + // Name for a resource. + // + // This member is required. + AgentAliasName *string + + // The statuses an Agent Alias can be in. + // + // This member is required. + AgentAliasStatus AgentAliasStatus + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // Routing configuration for an Agent alias. + RoutingConfiguration []AgentAliasRoutingConfigurationListItem + + noSmithyDocumentSerde +} + +// Contains the information of an Agent Knowledge Base. +type AgentKnowledgeBase struct { + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Agent Version. + // + // This member is required. + AgentVersion *string + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Description of the Resource. + // + // This member is required. + Description *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // State of the knowledge base; whether it is enabled or disabled + // + // This member is required. + KnowledgeBaseState KnowledgeBaseState + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Agent Knowledge Base Summary +type AgentKnowledgeBaseSummary struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // State of the knowledge base; whether it is enabled or disabled + // + // This member is required. + KnowledgeBaseState KnowledgeBaseState + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// Summary of Agent. +type AgentSummary struct { + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Name for a resource. + // + // This member is required. + AgentName *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus AgentStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // Agent Version. + LatestAgentVersion *string + + noSmithyDocumentSerde +} + +// Contains the information of an agent version. +type AgentVersion struct { + + // Arn representation of the Agent. + // + // This member is required. + AgentArn *string + + // Identifier for a resource. + // + // This member is required. + AgentId *string + + // Name for a resource. + // + // This member is required. + AgentName *string + + // ARN of a IAM role. + // + // This member is required. + AgentResourceRoleArn *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus AgentStatus + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Max Session Time. + // + // This member is required. + IdleSessionTTLInSeconds *int32 + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Numerical Agent Version. + // + // This member is required. + Version *string + + // A KMS key ARN + CustomerEncryptionKeyArn *string + + // Description of the Resource. + Description *string + + // Failure Reasons for Error. + FailureReasons []string + + // ARN or name of a Bedrock model. + FoundationModel *string + + // Instruction for the agent. + Instruction *string + + // Configuration for prompt override. + PromptOverrideConfiguration *PromptOverrideConfiguration + + // The recommended actions users can take to resolve an error in failureReasons. + RecommendedActions []string + + noSmithyDocumentSerde +} + +// Summary of agent version. +type AgentVersionSummary struct { + + // Name for a resource. + // + // This member is required. + AgentName *string + + // Schema Type for Action APIs. + // + // This member is required. + AgentStatus AgentStatus + + // Agent Version. + // + // This member is required. + AgentVersion *string + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// Contains information about the API Schema for the Action Group +// +// The following types satisfy this interface: +// +// APISchemaMemberPayload +// APISchemaMemberS3 +type APISchema interface { + isAPISchema() +} + +// String OpenAPI Payload +type APISchemaMemberPayload struct { + Value string + + noSmithyDocumentSerde +} + +func (*APISchemaMemberPayload) isAPISchema() {} + +// The identifier for the S3 resource. +type APISchemaMemberS3 struct { + Value S3Identifier + + noSmithyDocumentSerde +} + +func (*APISchemaMemberS3) isAPISchema() {} + +// Configures chunking strategy +type ChunkingConfiguration struct { + + // The type of chunking strategy + // + // This member is required. + ChunkingStrategy ChunkingStrategy + + // Configures fixed size chunking strategy + FixedSizeChunkingConfiguration *FixedSizeChunkingConfiguration + + noSmithyDocumentSerde +} + +// Contains the information of a data source. +type DataSource struct { + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // Specifies a raw data source location to ingest. + // + // This member is required. + DataSourceConfiguration *DataSourceConfiguration + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // The status of a data source. + // + // This member is required. + Status DataSourceStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // Server-side encryption configuration. + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration + + // Configures ingestion for a vector knowledge base + VectorIngestionConfiguration *VectorIngestionConfiguration + + noSmithyDocumentSerde +} + +// Specifies a raw data source location to ingest. +type DataSourceConfiguration struct { + + // The type of the data source location. + // + // This member is required. + Type DataSourceType + + // Configures an S3 data source location. + S3Configuration *S3DataSourceConfiguration + + noSmithyDocumentSerde +} + +// Summary information of a data source. +type DataSourceSummary struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // The status of a data source. + // + // This member is required. + Status DataSourceStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// Configures fixed size chunking strategy +type FixedSizeChunkingConfiguration struct { + + // The maximum number of tokens per chunk. + // + // This member is required. + MaxTokens *int32 + + // The overlap percentage between adjacent chunks. + // + // This member is required. + OverlapPercentage *int32 + + noSmithyDocumentSerde +} + +// Configuration for inference in prompt configuration +type InferenceConfiguration struct { + + // Maximum length of output + MaximumLength *int32 + + // List of stop sequences + StopSequences []string + + // Controls randomness, higher values increase diversity + Temperature *float32 + + // Sample from the k most likely next tokens + TopK *int32 + + // Cumulative probability cutoff for token selection + TopP *float32 + + noSmithyDocumentSerde +} + +// Contains the information of an ingestion job. +type IngestionJob struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + IngestionJobId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Time Stamp. + // + // This member is required. + StartedAt *time.Time + + // The status of an ingestion job. + // + // This member is required. + Status IngestionJobStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // Failure Reasons for Error. + FailureReasons []string + + // The document level statistics of an ingestion job + Statistics *IngestionJobStatistics + + noSmithyDocumentSerde +} + +// Filters the response returned by ListIngestionJobs operation. +type IngestionJobFilter struct { + + // The name of the field to filter ingestion jobs. + // + // This member is required. + Attribute IngestionJobFilterAttribute + + // The operator used to filter ingestion jobs. + // + // This member is required. + Operator IngestionJobFilterOperator + + // The list of values used to filter ingestion jobs. + // + // This member is required. + Values []string + + noSmithyDocumentSerde +} + +// Sorts the response returned by ListIngestionJobs operation. +type IngestionJobSortBy struct { + + // The name of the field to sort ingestion jobs. + // + // This member is required. + Attribute IngestionJobSortByAttribute + + // Order to sort results by. + // + // This member is required. + Order SortOrder + + noSmithyDocumentSerde +} + +// The document level statistics of an ingestion job +type IngestionJobStatistics struct { + + // Number of deleted documents + NumberOfDocumentsDeleted int64 + + // Number of failed documents + NumberOfDocumentsFailed int64 + + // Number of scanned documents + NumberOfDocumentsScanned int64 + + // Number of modified documents indexed + NumberOfModifiedDocumentsIndexed int64 + + // Number of indexed documents + NumberOfNewDocumentsIndexed int64 + + noSmithyDocumentSerde +} + +// Summary information of an ingestion job. +type IngestionJobSummary struct { + + // Identifier for a resource. + // + // This member is required. + DataSourceId *string + + // Identifier for a resource. + // + // This member is required. + IngestionJobId *string + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Time Stamp. + // + // This member is required. + StartedAt *time.Time + + // The status of an ingestion job. + // + // This member is required. + Status IngestionJobStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // The document level statistics of an ingestion job + Statistics *IngestionJobStatistics + + noSmithyDocumentSerde +} + +// Contains the information of a knowledge base. +type KnowledgeBase struct { + + // Time Stamp. + // + // This member is required. + CreatedAt *time.Time + + // ARN of a KnowledgeBase + // + // This member is required. + KnowledgeBaseArn *string + + // Configures a bedrock knowledge base. + // + // This member is required. + KnowledgeBaseConfiguration *KnowledgeBaseConfiguration + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // ARN of a IAM role. + // + // This member is required. + RoleArn *string + + // The status of a knowledge base. + // + // This member is required. + Status KnowledgeBaseStatus + + // Configures the physical storage of ingested data in a knowledge base. + // + // This member is required. + StorageConfiguration *StorageConfiguration + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + // Failure Reasons for Error. + FailureReasons []string + + noSmithyDocumentSerde +} + +// Configures a bedrock knowledge base. +type KnowledgeBaseConfiguration struct { + + // The type of a knowledge base. + // + // This member is required. + Type KnowledgeBaseType + + // Configurations for a vector knowledge base. + VectorKnowledgeBaseConfiguration *VectorKnowledgeBaseConfiguration + + noSmithyDocumentSerde +} + +// Summary information of a knowledge base. +type KnowledgeBaseSummary struct { + + // Identifier for a resource. + // + // This member is required. + KnowledgeBaseId *string + + // Name for a resource. + // + // This member is required. + Name *string + + // The status of a knowledge base. + // + // This member is required. + Status KnowledgeBaseStatus + + // Time Stamp. + // + // This member is required. + UpdatedAt *time.Time + + // Description of the Resource. + Description *string + + noSmithyDocumentSerde +} + +// Contains the configurations to use OpenSearch Serverless to store knowledge +// base data. +type OpenSearchServerlessConfiguration struct { + + // Arn of an OpenSearch Serverless collection. + // + // This member is required. + CollectionArn *string + + // A mapping of Bedrock Knowledge Base fields to OpenSearch Serverless field names + // + // This member is required. + FieldMapping *OpenSearchServerlessFieldMapping + + // Arn of an OpenSearch Serverless index. + // + // This member is required. + VectorIndexName *string + + noSmithyDocumentSerde +} + +// A mapping of Bedrock Knowledge Base fields to OpenSearch Serverless field names +type OpenSearchServerlessFieldMapping struct { + + // Name of the field + // + // This member is required. + MetadataField *string + + // Name of the field + // + // This member is required. + TextField *string + + // Name of the field + // + // This member is required. + VectorField *string + + noSmithyDocumentSerde +} + +// Contains the configurations to use Pinecone to store knowledge base data. +type PineconeConfiguration struct { + + // Pinecone connection string + // + // This member is required. + ConnectionString *string + + // Arn of a SecretsManager Secret. + // + // This member is required. + CredentialsSecretArn *string + + // A mapping of Bedrock Knowledge Base fields to Pinecone field names + // + // This member is required. + FieldMapping *PineconeFieldMapping + + // Pinecone namespace + Namespace *string + + noSmithyDocumentSerde +} + +// A mapping of Bedrock Knowledge Base fields to Pinecone field names +type PineconeFieldMapping struct { + + // Name of the field + // + // This member is required. + MetadataField *string + + // Name of the field + // + // This member is required. + TextField *string + + noSmithyDocumentSerde +} + +// BasePromptConfiguration per Prompt Type. +type PromptConfiguration struct { + + // Base Prompt Template. + BasePromptTemplate *string + + // Configuration for inference in prompt configuration + InferenceConfiguration *InferenceConfiguration + + // Creation Mode for Prompt Configuration. + ParserMode CreationMode + + // Creation Mode for Prompt Configuration. + PromptCreationMode CreationMode + + // Prompt State. + PromptState PromptState + + // Prompt Type. + PromptType PromptType + + noSmithyDocumentSerde +} + +// Configuration for prompt override. +type PromptOverrideConfiguration struct { + + // List of BasePromptConfiguration + // + // This member is required. + PromptConfigurations []PromptConfiguration + + // ARN of a Lambda. + OverrideLambda *string + + noSmithyDocumentSerde +} + +// Contains the configurations to use Redis Enterprise Cloud to store knowledge +// base data. +type RedisEnterpriseCloudConfiguration struct { + + // Arn of a SecretsManager Secret. + // + // This member is required. + CredentialsSecretArn *string + + // Redis enterprise cloud endpoint + // + // This member is required. + Endpoint *string + + // A mapping of Bedrock Knowledge Base fields to Redis Cloud field names + // + // This member is required. + FieldMapping *RedisEnterpriseCloudFieldMapping + + // Name of a redis enterprise cloud index + // + // This member is required. + VectorIndexName *string + + noSmithyDocumentSerde +} + +// A mapping of Bedrock Knowledge Base fields to Redis Cloud field names +type RedisEnterpriseCloudFieldMapping struct { + + // Name of the field + // + // This member is required. + MetadataField *string + + // Name of the field + // + // This member is required. + TextField *string + + // Name of the field + // + // This member is required. + VectorField *string + + noSmithyDocumentSerde +} + +// Configures an S3 data source location. +type S3DataSourceConfiguration struct { + + // A S3 bucket ARN + // + // This member is required. + BucketArn *string + + // A list of S3 prefixes. + InclusionPrefixes []string + + noSmithyDocumentSerde +} + +// The identifier for the S3 resource. +type S3Identifier struct { + + // A bucket in S3. + S3BucketName *string + + // A object key in S3. + S3ObjectKey *string + + noSmithyDocumentSerde +} + +// Server-side encryption configuration. +type ServerSideEncryptionConfiguration struct { + + // A KMS key ARN + KmsKeyArn *string + + noSmithyDocumentSerde +} + +// Configures the physical storage of ingested data in a knowledge base. +type StorageConfiguration struct { + + // The storage type of a knowledge base. + // + // This member is required. + Type KnowledgeBaseStorageType + + // Contains the configurations to use OpenSearch Serverless to store knowledge + // base data. + OpensearchServerlessConfiguration *OpenSearchServerlessConfiguration + + // Contains the configurations to use Pinecone to store knowledge base data. + PineconeConfiguration *PineconeConfiguration + + // Contains the configurations to use Redis Enterprise Cloud to store knowledge + // base data. + RedisEnterpriseCloudConfiguration *RedisEnterpriseCloudConfiguration + + noSmithyDocumentSerde +} + +// Stores information about a field passed inside a request that resulted in an +// exception +type ValidationExceptionField struct { + + // Non Blank String + // + // This member is required. + Message *string + + // Non Blank String + // + // This member is required. + Name *string + + noSmithyDocumentSerde +} + +// Configures ingestion for a vector knowledge base +type VectorIngestionConfiguration struct { + + // Configures chunking strategy + ChunkingConfiguration *ChunkingConfiguration + + noSmithyDocumentSerde +} + +// Configurations for a vector knowledge base. +type VectorKnowledgeBaseConfiguration struct { + + // Arn of a Bedrock model. + // + // This member is required. + EmbeddingModelArn *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) isActionGroupExecutor() {} +func (*UnknownUnionMember) isAPISchema() {} diff --git a/service/bedrockagent/types/types_exported_test.go b/service/bedrockagent/types/types_exported_test.go new file mode 100644 index 00000000000..713f7406e5d --- /dev/null +++ b/service/bedrockagent/types/types_exported_test.go @@ -0,0 +1,48 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" +) + +func ExampleActionGroupExecutor_outputUsage() { + var union types.ActionGroupExecutor + // type switches can be used to check the union value + switch v := union.(type) { + case *types.ActionGroupExecutorMemberLambda: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string + +func ExampleAPISchema_outputUsage() { + var union types.APISchema + // type switches can be used to check the union value + switch v := union.(type) { + case *types.APISchemaMemberPayload: + _ = v.Value // Value is string + + case *types.APISchemaMemberS3: + _ = v.Value // Value is types.S3Identifier + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string +var _ *types.S3Identifier diff --git a/service/bedrockagent/validators.go b/service/bedrockagent/validators.go new file mode 100644 index 00000000000..db6e13d0e8b --- /dev/null +++ b/service/bedrockagent/validators.go @@ -0,0 +1,2103 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagent + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagent/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpAssociateAgentKnowledgeBase struct { +} + +func (*validateOpAssociateAgentKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAssociateAgentKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AssociateAgentKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAssociateAgentKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateAgentActionGroup struct { +} + +func (*validateOpCreateAgentActionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAgentActionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAgentActionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAgentActionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateAgentAlias struct { +} + +func (*validateOpCreateAgentAlias) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAgentAlias) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAgentAliasInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAgentAliasInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateAgent struct { +} + +func (*validateOpCreateAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateDataSource struct { +} + +func (*validateOpCreateDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateKnowledgeBase struct { +} + +func (*validateOpCreateKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAgentActionGroup struct { +} + +func (*validateOpDeleteAgentActionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAgentActionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAgentActionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAgentActionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAgentAlias struct { +} + +func (*validateOpDeleteAgentAlias) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAgentAlias) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAgentAliasInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAgentAliasInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAgent struct { +} + +func (*validateOpDeleteAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAgentVersion struct { +} + +func (*validateOpDeleteAgentVersion) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAgentVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAgentVersionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAgentVersionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteDataSource struct { +} + +func (*validateOpDeleteDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteKnowledgeBase struct { +} + +func (*validateOpDeleteKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDisassociateAgentKnowledgeBase struct { +} + +func (*validateOpDisassociateAgentKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateAgentKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateAgentKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateAgentKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAgentActionGroup struct { +} + +func (*validateOpGetAgentActionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAgentActionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAgentActionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAgentActionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAgentAlias struct { +} + +func (*validateOpGetAgentAlias) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAgentAlias) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAgentAliasInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAgentAliasInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAgent struct { +} + +func (*validateOpGetAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAgentKnowledgeBase struct { +} + +func (*validateOpGetAgentKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAgentKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAgentKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAgentKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAgentVersion struct { +} + +func (*validateOpGetAgentVersion) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAgentVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAgentVersionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAgentVersionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetDataSource struct { +} + +func (*validateOpGetDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetIngestionJob struct { +} + +func (*validateOpGetIngestionJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetIngestionJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetIngestionJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetIngestionJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetKnowledgeBase struct { +} + +func (*validateOpGetKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListAgentActionGroups struct { +} + +func (*validateOpListAgentActionGroups) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAgentActionGroups) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAgentActionGroupsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAgentActionGroupsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListAgentAliases struct { +} + +func (*validateOpListAgentAliases) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAgentAliases) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAgentAliasesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAgentAliasesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListAgentKnowledgeBases struct { +} + +func (*validateOpListAgentKnowledgeBases) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAgentKnowledgeBases) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAgentKnowledgeBasesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAgentKnowledgeBasesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListAgentVersions struct { +} + +func (*validateOpListAgentVersions) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAgentVersions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAgentVersionsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAgentVersionsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListDataSources struct { +} + +func (*validateOpListDataSources) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListDataSources) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListDataSourcesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListDataSourcesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListIngestionJobs struct { +} + +func (*validateOpListIngestionJobs) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListIngestionJobs) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListIngestionJobsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListIngestionJobsInput(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 validateOpPrepareAgent struct { +} + +func (*validateOpPrepareAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPrepareAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PrepareAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPrepareAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartIngestionJob struct { +} + +func (*validateOpStartIngestionJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartIngestionJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartIngestionJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartIngestionJobInput(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 validateOpUpdateAgentActionGroup struct { +} + +func (*validateOpUpdateAgentActionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateAgentActionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateAgentActionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateAgentActionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateAgentAlias struct { +} + +func (*validateOpUpdateAgentAlias) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateAgentAlias) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateAgentAliasInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateAgentAliasInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateAgent struct { +} + +func (*validateOpUpdateAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateAgentKnowledgeBase struct { +} + +func (*validateOpUpdateAgentKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateAgentKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateAgentKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateAgentKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateDataSource struct { +} + +func (*validateOpUpdateDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateKnowledgeBase struct { +} + +func (*validateOpUpdateKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpAssociateAgentKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAssociateAgentKnowledgeBase{}, middleware.After) +} + +func addOpCreateAgentActionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAgentActionGroup{}, middleware.After) +} + +func addOpCreateAgentAliasValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAgentAlias{}, middleware.After) +} + +func addOpCreateAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAgent{}, middleware.After) +} + +func addOpCreateDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateDataSource{}, middleware.After) +} + +func addOpCreateKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateKnowledgeBase{}, middleware.After) +} + +func addOpDeleteAgentActionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAgentActionGroup{}, middleware.After) +} + +func addOpDeleteAgentAliasValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAgentAlias{}, middleware.After) +} + +func addOpDeleteAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAgent{}, middleware.After) +} + +func addOpDeleteAgentVersionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAgentVersion{}, middleware.After) +} + +func addOpDeleteDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteDataSource{}, middleware.After) +} + +func addOpDeleteKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteKnowledgeBase{}, middleware.After) +} + +func addOpDisassociateAgentKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateAgentKnowledgeBase{}, middleware.After) +} + +func addOpGetAgentActionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAgentActionGroup{}, middleware.After) +} + +func addOpGetAgentAliasValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAgentAlias{}, middleware.After) +} + +func addOpGetAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAgent{}, middleware.After) +} + +func addOpGetAgentKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAgentKnowledgeBase{}, middleware.After) +} + +func addOpGetAgentVersionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAgentVersion{}, middleware.After) +} + +func addOpGetDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetDataSource{}, middleware.After) +} + +func addOpGetIngestionJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetIngestionJob{}, middleware.After) +} + +func addOpGetKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetKnowledgeBase{}, middleware.After) +} + +func addOpListAgentActionGroupsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAgentActionGroups{}, middleware.After) +} + +func addOpListAgentAliasesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAgentAliases{}, middleware.After) +} + +func addOpListAgentKnowledgeBasesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAgentKnowledgeBases{}, middleware.After) +} + +func addOpListAgentVersionsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAgentVersions{}, middleware.After) +} + +func addOpListDataSourcesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListDataSources{}, middleware.After) +} + +func addOpListIngestionJobsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListIngestionJobs{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpPrepareAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPrepareAgent{}, middleware.After) +} + +func addOpStartIngestionJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartIngestionJob{}, 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 addOpUpdateAgentActionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateAgentActionGroup{}, middleware.After) +} + +func addOpUpdateAgentAliasValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateAgentAlias{}, middleware.After) +} + +func addOpUpdateAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateAgent{}, middleware.After) +} + +func addOpUpdateAgentKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateAgentKnowledgeBase{}, middleware.After) +} + +func addOpUpdateDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateDataSource{}, middleware.After) +} + +func addOpUpdateKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateKnowledgeBase{}, middleware.After) +} + +func validateAgentAliasRoutingConfiguration(v []types.AgentAliasRoutingConfigurationListItem) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AgentAliasRoutingConfiguration"} + for i := range v { + if err := validateAgentAliasRoutingConfigurationListItem(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAgentAliasRoutingConfigurationListItem(v *types.AgentAliasRoutingConfigurationListItem) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AgentAliasRoutingConfigurationListItem"} + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateChunkingConfiguration(v *types.ChunkingConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ChunkingConfiguration"} + if len(v.ChunkingStrategy) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ChunkingStrategy")) + } + if v.FixedSizeChunkingConfiguration != nil { + if err := validateFixedSizeChunkingConfiguration(v.FixedSizeChunkingConfiguration); err != nil { + invalidParams.AddNested("FixedSizeChunkingConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDataSourceConfiguration(v *types.DataSourceConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DataSourceConfiguration"} + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.S3Configuration != nil { + if err := validateS3DataSourceConfiguration(v.S3Configuration); err != nil { + invalidParams.AddNested("S3Configuration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateFixedSizeChunkingConfiguration(v *types.FixedSizeChunkingConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "FixedSizeChunkingConfiguration"} + if v.MaxTokens == nil { + invalidParams.Add(smithy.NewErrParamRequired("MaxTokens")) + } + if v.OverlapPercentage == nil { + invalidParams.Add(smithy.NewErrParamRequired("OverlapPercentage")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateIngestionJobFilter(v *types.IngestionJobFilter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "IngestionJobFilter"} + if len(v.Attribute) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Attribute")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if v.Values == nil { + invalidParams.Add(smithy.NewErrParamRequired("Values")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateIngestionJobFilters(v []types.IngestionJobFilter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "IngestionJobFilters"} + for i := range v { + if err := validateIngestionJobFilter(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateIngestionJobSortBy(v *types.IngestionJobSortBy) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "IngestionJobSortBy"} + if len(v.Attribute) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Attribute")) + } + if len(v.Order) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Order")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKnowledgeBaseConfiguration(v *types.KnowledgeBaseConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KnowledgeBaseConfiguration"} + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.VectorKnowledgeBaseConfiguration != nil { + if err := validateVectorKnowledgeBaseConfiguration(v.VectorKnowledgeBaseConfiguration); err != nil { + invalidParams.AddNested("VectorKnowledgeBaseConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpenSearchServerlessConfiguration(v *types.OpenSearchServerlessConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "OpenSearchServerlessConfiguration"} + if v.CollectionArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("CollectionArn")) + } + if v.VectorIndexName == nil { + invalidParams.Add(smithy.NewErrParamRequired("VectorIndexName")) + } + if v.FieldMapping == nil { + invalidParams.Add(smithy.NewErrParamRequired("FieldMapping")) + } else if v.FieldMapping != nil { + if err := validateOpenSearchServerlessFieldMapping(v.FieldMapping); err != nil { + invalidParams.AddNested("FieldMapping", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpenSearchServerlessFieldMapping(v *types.OpenSearchServerlessFieldMapping) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "OpenSearchServerlessFieldMapping"} + if v.VectorField == nil { + invalidParams.Add(smithy.NewErrParamRequired("VectorField")) + } + if v.TextField == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextField")) + } + if v.MetadataField == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetadataField")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePineconeConfiguration(v *types.PineconeConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PineconeConfiguration"} + if v.ConnectionString == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectionString")) + } + if v.CredentialsSecretArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("CredentialsSecretArn")) + } + if v.FieldMapping == nil { + invalidParams.Add(smithy.NewErrParamRequired("FieldMapping")) + } else if v.FieldMapping != nil { + if err := validatePineconeFieldMapping(v.FieldMapping); err != nil { + invalidParams.AddNested("FieldMapping", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePineconeFieldMapping(v *types.PineconeFieldMapping) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PineconeFieldMapping"} + if v.TextField == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextField")) + } + if v.MetadataField == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetadataField")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePromptOverrideConfiguration(v *types.PromptOverrideConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PromptOverrideConfiguration"} + if v.PromptConfigurations == nil { + invalidParams.Add(smithy.NewErrParamRequired("PromptConfigurations")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRedisEnterpriseCloudConfiguration(v *types.RedisEnterpriseCloudConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RedisEnterpriseCloudConfiguration"} + if v.Endpoint == nil { + invalidParams.Add(smithy.NewErrParamRequired("Endpoint")) + } + if v.VectorIndexName == nil { + invalidParams.Add(smithy.NewErrParamRequired("VectorIndexName")) + } + if v.CredentialsSecretArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("CredentialsSecretArn")) + } + if v.FieldMapping == nil { + invalidParams.Add(smithy.NewErrParamRequired("FieldMapping")) + } else if v.FieldMapping != nil { + if err := validateRedisEnterpriseCloudFieldMapping(v.FieldMapping); err != nil { + invalidParams.AddNested("FieldMapping", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRedisEnterpriseCloudFieldMapping(v *types.RedisEnterpriseCloudFieldMapping) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RedisEnterpriseCloudFieldMapping"} + if v.VectorField == nil { + invalidParams.Add(smithy.NewErrParamRequired("VectorField")) + } + if v.TextField == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextField")) + } + if v.MetadataField == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetadataField")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateS3DataSourceConfiguration(v *types.S3DataSourceConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "S3DataSourceConfiguration"} + if v.BucketArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("BucketArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateStorageConfiguration(v *types.StorageConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StorageConfiguration"} + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.OpensearchServerlessConfiguration != nil { + if err := validateOpenSearchServerlessConfiguration(v.OpensearchServerlessConfiguration); err != nil { + invalidParams.AddNested("OpensearchServerlessConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.PineconeConfiguration != nil { + if err := validatePineconeConfiguration(v.PineconeConfiguration); err != nil { + invalidParams.AddNested("PineconeConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.RedisEnterpriseCloudConfiguration != nil { + if err := validateRedisEnterpriseCloudConfiguration(v.RedisEnterpriseCloudConfiguration); err != nil { + invalidParams.AddNested("RedisEnterpriseCloudConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateVectorIngestionConfiguration(v *types.VectorIngestionConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "VectorIngestionConfiguration"} + if v.ChunkingConfiguration != nil { + if err := validateChunkingConfiguration(v.ChunkingConfiguration); err != nil { + invalidParams.AddNested("ChunkingConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateVectorKnowledgeBaseConfiguration(v *types.VectorKnowledgeBaseConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "VectorKnowledgeBaseConfiguration"} + if v.EmbeddingModelArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("EmbeddingModelArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpAssociateAgentKnowledgeBaseInput(v *AssociateAgentKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AssociateAgentKnowledgeBaseInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.Description == nil { + invalidParams.Add(smithy.NewErrParamRequired("Description")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateAgentActionGroupInput(v *CreateAgentActionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAgentActionGroupInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.ActionGroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("ActionGroupName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateAgentAliasInput(v *CreateAgentAliasInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAgentAliasInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentAliasName == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasName")) + } + if v.RoutingConfiguration != nil { + if err := validateAgentAliasRoutingConfiguration(v.RoutingConfiguration); err != nil { + invalidParams.AddNested("RoutingConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateAgentInput(v *CreateAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAgentInput"} + if v.AgentName == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentName")) + } + if v.AgentResourceRoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentResourceRoleArn")) + } + if v.PromptOverrideConfiguration != nil { + if err := validatePromptOverrideConfiguration(v.PromptOverrideConfiguration); err != nil { + invalidParams.AddNested("PromptOverrideConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateDataSourceInput(v *CreateDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateDataSourceInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.DataSourceConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceConfiguration")) + } else if v.DataSourceConfiguration != nil { + if err := validateDataSourceConfiguration(v.DataSourceConfiguration); err != nil { + invalidParams.AddNested("DataSourceConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.VectorIngestionConfiguration != nil { + if err := validateVectorIngestionConfiguration(v.VectorIngestionConfiguration); err != nil { + invalidParams.AddNested("VectorIngestionConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateKnowledgeBaseInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if v.KnowledgeBaseConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseConfiguration")) + } else if v.KnowledgeBaseConfiguration != nil { + if err := validateKnowledgeBaseConfiguration(v.KnowledgeBaseConfiguration); err != nil { + invalidParams.AddNested("KnowledgeBaseConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.StorageConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("StorageConfiguration")) + } else if v.StorageConfiguration != nil { + if err := validateStorageConfiguration(v.StorageConfiguration); err != nil { + invalidParams.AddNested("StorageConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAgentActionGroupInput(v *DeleteAgentActionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAgentActionGroupInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.ActionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ActionGroupId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAgentAliasInput(v *DeleteAgentAliasInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAgentAliasInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentAliasId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAgentInput(v *DeleteAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAgentInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAgentVersionInput(v *DeleteAgentVersionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAgentVersionInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteDataSourceInput(v *DeleteDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteDataSourceInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteKnowledgeBaseInput(v *DeleteKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteKnowledgeBaseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDisassociateAgentKnowledgeBaseInput(v *DisassociateAgentKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateAgentKnowledgeBaseInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAgentActionGroupInput(v *GetAgentActionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAgentActionGroupInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.ActionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ActionGroupId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAgentAliasInput(v *GetAgentAliasInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAgentAliasInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentAliasId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAgentInput(v *GetAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAgentInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAgentKnowledgeBaseInput(v *GetAgentKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAgentKnowledgeBaseInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAgentVersionInput(v *GetAgentVersionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAgentVersionInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetDataSourceInput(v *GetDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetDataSourceInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetIngestionJobInput(v *GetIngestionJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetIngestionJobInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.IngestionJobId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IngestionJobId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetKnowledgeBaseInput(v *GetKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetKnowledgeBaseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListAgentActionGroupsInput(v *ListAgentActionGroupsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAgentActionGroupsInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListAgentAliasesInput(v *ListAgentAliasesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAgentAliasesInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListAgentKnowledgeBasesInput(v *ListAgentKnowledgeBasesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAgentKnowledgeBasesInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListAgentVersionsInput(v *ListAgentVersionsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAgentVersionsInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListDataSourcesInput(v *ListDataSourcesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListDataSourcesInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListIngestionJobsInput(v *ListIngestionJobsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListIngestionJobsInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.Filters != nil { + if err := validateIngestionJobFilters(v.Filters); err != nil { + invalidParams.AddNested("Filters", err.(smithy.InvalidParamsError)) + } + } + if v.SortBy != nil { + if err := validateIngestionJobSortBy(v.SortBy); err != nil { + invalidParams.AddNested("SortBy", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListTagsForResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpPrepareAgentInput(v *PrepareAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrepareAgentInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartIngestionJobInput(v *StartIngestionJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartIngestionJobInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + 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 validateOpUpdateAgentActionGroupInput(v *UpdateAgentActionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateAgentActionGroupInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.ActionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ActionGroupId")) + } + if v.ActionGroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("ActionGroupName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateAgentAliasInput(v *UpdateAgentAliasInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateAgentAliasInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentAliasId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasId")) + } + if v.AgentAliasName == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasName")) + } + if v.RoutingConfiguration != nil { + if err := validateAgentAliasRoutingConfiguration(v.RoutingConfiguration); err != nil { + invalidParams.AddNested("RoutingConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateAgentInput(v *UpdateAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateAgentInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentName == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentName")) + } + if v.AgentResourceRoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentResourceRoleArn")) + } + if v.PromptOverrideConfiguration != nil { + if err := validatePromptOverrideConfiguration(v.PromptOverrideConfiguration); err != nil { + invalidParams.AddNested("PromptOverrideConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateAgentKnowledgeBaseInput(v *UpdateAgentKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateAgentKnowledgeBaseInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentVersion == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentVersion")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateDataSourceInput(v *UpdateDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateDataSourceInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.DataSourceConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceConfiguration")) + } else if v.DataSourceConfiguration != nil { + if err := validateDataSourceConfiguration(v.DataSourceConfiguration); err != nil { + invalidParams.AddNested("DataSourceConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.VectorIngestionConfiguration != nil { + if err := validateVectorIngestionConfiguration(v.VectorIngestionConfiguration); err != nil { + invalidParams.AddNested("VectorIngestionConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateKnowledgeBaseInput(v *UpdateKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateKnowledgeBaseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if v.KnowledgeBaseConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseConfiguration")) + } else if v.KnowledgeBaseConfiguration != nil { + if err := validateKnowledgeBaseConfiguration(v.KnowledgeBaseConfiguration); err != nil { + invalidParams.AddNested("KnowledgeBaseConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.StorageConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("StorageConfiguration")) + } else if v.StorageConfiguration != nil { + if err := validateStorageConfiguration(v.StorageConfiguration); err != nil { + invalidParams.AddNested("StorageConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/bedrockagentruntime/LICENSE.txt b/service/bedrockagentruntime/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/bedrockagentruntime/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/bedrockagentruntime/api_client.go b/service/bedrockagentruntime/api_client.go new file mode 100644 index 00000000000..6ddb90ec514 --- /dev/null +++ b/service/bedrockagentruntime/api_client.go @@ -0,0 +1,457 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +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" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + 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 = "Bedrock Agent Runtime" +const ServiceAPIVersion = "2023-07-26" + +// Client provides the API client to make operations call for Agents for Amazon +// Bedrock Runtime. +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) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveEndpointResolverV2(&options) + + resolveAuthSchemeResolver(&options) + + for _, fn := range optFns { + fn(&options) + } + + resolveRetryer(&options) + + ignoreAnonymousAuth(&options) + + resolveAuthSchemes(&options) + + client := &Client{ + options: options, + } + + return client +} + +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + + for _, fn := range optFns { + fn(&options) + } + + setSafeEventStreamClientLogMode(&options, opID) + + 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 operationInputKey struct{} + +func setOperationInput(ctx context.Context, input interface{}) context.Context { + return middleware.WithStackValue(ctx, operationInputKey{}, input) +} + +func getOperationInput(ctx context.Context) interface{} { + return middleware.GetStackValue(ctx, operationInputKey{}) +} + +type setOperationInputMiddleware struct { +} + +func (*setOperationInputMiddleware) ID() string { + return "setOperationInput" +} + +func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + ctx = setOperationInput(ctx, in.Parameters) + return next.HandleSerialize(ctx, in) +} + +func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { + if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { + return fmt.Errorf("add ResolveAuthScheme: %v", err) + } + if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { + return fmt.Errorf("add GetIdentity: %v", err) + } + if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { + return fmt.Errorf("add ResolveEndpointV2: %v", err) + } + if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil { + return fmt.Errorf("add Signing: %v", err) + } + return nil +} +func resolveAuthSchemeResolver(options *Options) { + if options.AuthSchemeResolver == nil { + options.AuthSchemeResolver = &defaultAuthSchemeResolver{} + } +} + +func resolveAuthSchemes(options *Options) { + if options.AuthSchemes == nil { + options.AuthSchemes = []smithyhttp.AuthScheme{ + internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ + Signer: options.HTTPSignerV4, + Logger: options.Logger, + LogSigning: options.ClientLogMode.IsSigning(), + }), + } + } +} + +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) + resolveBaseEndpoint(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, "bedrockagentruntime", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +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 disableHTTPSMiddleware struct { + DisableHTTPS bool +} + +func (*disableHTTPSMiddleware) ID() string { + return "disableHTTPS" +} + +func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, 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.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleFinalize(ctx, in) +} + +func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Finalize.Insert(&disableHTTPSMiddleware{ + DisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "ResolveEndpointV2", middleware.After) +} diff --git a/service/bedrockagentruntime/api_client_test.go b/service/bedrockagentruntime/api_client_test.go new file mode 100644 index 00000000000..78010b7b546 --- /dev/null +++ b/service/bedrockagentruntime/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +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/bedrockagentruntime/api_op_InvokeAgent.go b/service/bedrockagentruntime/api_op_InvokeAgent.go new file mode 100644 index 00000000000..4035ab8d5d3 --- /dev/null +++ b/service/bedrockagentruntime/api_op_InvokeAgent.go @@ -0,0 +1,278 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + "github.com/aws/smithy-go/middleware" + smithysync "github.com/aws/smithy-go/sync" + smithyhttp "github.com/aws/smithy-go/transport/http" + "sync" +) + +// Invokes the specified Bedrock model to run inference using the input provided +// in the request body. +func (c *Client) InvokeAgent(ctx context.Context, params *InvokeAgentInput, optFns ...func(*Options)) (*InvokeAgentOutput, error) { + if params == nil { + params = &InvokeAgentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "InvokeAgent", params, optFns, c.addOperationInvokeAgentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*InvokeAgentOutput) + out.ResultMetadata = metadata + return out, nil +} + +// InvokeAgent Request +type InvokeAgentInput struct { + + // Identifier for Agent Alias + // + // This member is required. + AgentAliasId *string + + // Identifier for Agent + // + // This member is required. + AgentId *string + + // Input data in the format specified in the Content-Type request header. + // + // This member is required. + InputText *string + + // Identifier used for the current session + // + // This member is required. + SessionId *string + + // Enable agent trace events for improved debugging + EnableTrace *bool + + // End current session + EndSession *bool + + // Session state passed by customer. Base64 encoded json string representation of + // SessionState. + SessionState *types.SessionState + + noSmithyDocumentSerde +} + +// InvokeAgent Response +type InvokeAgentOutput struct { + + // streaming response mimetype of the model + // + // This member is required. + ContentType *string + + // streaming response mimetype of the model + // + // This member is required. + SessionId *string + + eventStream *InvokeAgentEventStream + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +// GetStream returns the type to interact with the event stream. +func (o *InvokeAgentOutput) GetStream() *InvokeAgentEventStream { + return o.eventStream +} + +func (c *Client) addOperationInvokeAgentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpInvokeAgent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpInvokeAgent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "InvokeAgent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addEventStreamInvokeAgentMiddleware(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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpInvokeAgentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInvokeAgent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opInvokeAgent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "InvokeAgent", + } +} + +// InvokeAgentEventStream provides the event stream handling for the InvokeAgent operation. +// +// For testing and mocking the event stream this type should be initialized via +// the NewInvokeAgentEventStream constructor function. Using the functional options +// to pass in nested mock behavior. +type InvokeAgentEventStream struct { + // ResponseStreamReader is the EventStream reader for the ResponseStream events. + // This value is automatically set by the SDK when the API call is made Use this + // member when unit testing your code with the SDK to mock out the EventStream + // Reader. + // + // Must not be nil. + Reader ResponseStreamReader + + done chan struct{} + closeOnce sync.Once + err *smithysync.OnceErr +} + +// NewInvokeAgentEventStream initializes an InvokeAgentEventStream. +// This function should only be used for testing and mocking the InvokeAgentEventStream +// stream within your application. +// +// The Reader member must be set before reading events from the stream. +func NewInvokeAgentEventStream(optFns ...func(*InvokeAgentEventStream)) *InvokeAgentEventStream { + es := &InvokeAgentEventStream{ + done: make(chan struct{}), + err: smithysync.NewOnceErr(), + } + for _, fn := range optFns { + fn(es) + } + return es +} + +// Events returns a channel to read events from. +func (es *InvokeAgentEventStream) Events() <-chan types.ResponseStream { + return es.Reader.Events() +} + +// Close closes the stream. This will also cause the stream to be closed. +// Close must be called when done using the stream API. Not calling Close +// may result in resource leaks. +// +// Will close the underlying EventStream writer and reader, and no more events can be +// sent or received. +func (es *InvokeAgentEventStream) Close() error { + es.closeOnce.Do(es.safeClose) + return es.Err() +} + +func (es *InvokeAgentEventStream) safeClose() { + close(es.done) + + es.Reader.Close() +} + +// Err returns any error that occurred while reading or writing EventStream Events +// from the service API's response. Returns nil if there were no errors. +func (es *InvokeAgentEventStream) Err() error { + if err := es.err.Err(); err != nil { + return err + } + + if err := es.Reader.Err(); err != nil { + return err + } + + return nil +} + +func (es *InvokeAgentEventStream) waitStreamClose() { + type errorSet interface { + ErrorSet() <-chan struct{} + } + + var outputErrCh <-chan struct{} + if v, ok := es.Reader.(errorSet); ok { + outputErrCh = v.ErrorSet() + } + var outputClosedCh <-chan struct{} + if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok { + outputClosedCh = v.Closed() + } + + select { + case <-es.done: + case <-outputErrCh: + es.err.SetError(es.Reader.Err()) + es.Close() + + case <-outputClosedCh: + if err := es.Reader.Err(); err != nil { + es.err.SetError(es.Reader.Err()) + } + es.Close() + + } +} diff --git a/service/bedrockagentruntime/api_op_Retrieve.go b/service/bedrockagentruntime/api_op_Retrieve.go new file mode 100644 index 00000000000..83d3b2c3500 --- /dev/null +++ b/service/bedrockagentruntime/api_op_Retrieve.go @@ -0,0 +1,230 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieve from knowledge base. +func (c *Client) Retrieve(ctx context.Context, params *RetrieveInput, optFns ...func(*Options)) (*RetrieveOutput, error) { + if params == nil { + params = &RetrieveInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "Retrieve", params, optFns, c.addOperationRetrieveMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*RetrieveOutput) + out.ResultMetadata = metadata + return out, nil +} + +type RetrieveInput struct { + + // Identifier of the KnowledgeBase + // + // This member is required. + KnowledgeBaseId *string + + // Knowledge base input query. + // + // This member is required. + RetrievalQuery *types.KnowledgeBaseQuery + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Search parameters for retrieving from knowledge base. + RetrievalConfiguration *types.KnowledgeBaseRetrievalConfiguration + + noSmithyDocumentSerde +} + +type RetrieveOutput struct { + + // List of knowledge base retrieval results + // + // This member is required. + RetrievalResults []types.KnowledgeBaseRetrievalResult + + // Opaque continuation token of previous paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationRetrieveMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpRetrieve{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRetrieve{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "Retrieve"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpRetrieveValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRetrieve(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// RetrieveAPIClient is a client that implements the Retrieve operation. +type RetrieveAPIClient interface { + Retrieve(context.Context, *RetrieveInput, ...func(*Options)) (*RetrieveOutput, error) +} + +var _ RetrieveAPIClient = (*Client)(nil) + +// RetrievePaginatorOptions is the paginator options for Retrieve +type RetrievePaginatorOptions struct { + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// RetrievePaginator is a paginator for Retrieve +type RetrievePaginator struct { + options RetrievePaginatorOptions + client RetrieveAPIClient + params *RetrieveInput + nextToken *string + firstPage bool +} + +// NewRetrievePaginator returns a new RetrievePaginator +func NewRetrievePaginator(client RetrieveAPIClient, params *RetrieveInput, optFns ...func(*RetrievePaginatorOptions)) *RetrievePaginator { + if params == nil { + params = &RetrieveInput{} + } + + options := RetrievePaginatorOptions{} + + for _, fn := range optFns { + fn(&options) + } + + return &RetrievePaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *RetrievePaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next Retrieve page. +func (p *RetrievePaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*RetrieveOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + result, err := p.client.Retrieve(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_opRetrieve(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "Retrieve", + } +} diff --git a/service/bedrockagentruntime/api_op_RetrieveAndGenerate.go b/service/bedrockagentruntime/api_op_RetrieveAndGenerate.go new file mode 100644 index 00000000000..36358de925c --- /dev/null +++ b/service/bedrockagentruntime/api_op_RetrieveAndGenerate.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// RetrieveAndGenerate API +func (c *Client) RetrieveAndGenerate(ctx context.Context, params *RetrieveAndGenerateInput, optFns ...func(*Options)) (*RetrieveAndGenerateOutput, error) { + if params == nil { + params = &RetrieveAndGenerateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "RetrieveAndGenerate", params, optFns, c.addOperationRetrieveAndGenerateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*RetrieveAndGenerateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type RetrieveAndGenerateInput struct { + + // Customer input of the turn + // + // This member is required. + Input *types.RetrieveAndGenerateInput + + // Configures the retrieval and generation for the session. + RetrieveAndGenerateConfiguration *types.RetrieveAndGenerateConfiguration + + // Configures common parameters of the session. + SessionConfiguration *types.RetrieveAndGenerateSessionConfiguration + + // Identifier of the session. + SessionId *string + + noSmithyDocumentSerde +} + +type RetrieveAndGenerateOutput struct { + + // Service response of the turn + // + // This member is required. + Output *types.RetrieveAndGenerateOutput + + // Identifier of the session. + // + // This member is required. + SessionId *string + + // List of citations + Citations []types.Citation + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationRetrieveAndGenerateMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpRetrieveAndGenerate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRetrieveAndGenerate{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "RetrieveAndGenerate"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpRetrieveAndGenerateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRetrieveAndGenerate(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opRetrieveAndGenerate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "RetrieveAndGenerate", + } +} diff --git a/service/bedrockagentruntime/auth.go b/service/bedrockagentruntime/auth.go new file mode 100644 index 00000000000..0cd067bf3d2 --- /dev/null +++ b/service/bedrockagentruntime/auth.go @@ -0,0 +1,256 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +func bindAuthParamsRegion(params *AuthResolverParameters, _ interface{}, options Options) { + params.Region = options.Region +} + +type setLegacyContextSigningOptionsMiddleware struct { +} + +func (*setLegacyContextSigningOptionsMiddleware) ID() string { + return "setLegacyContextSigningOptions" +} + +func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + schemeID := rscheme.Scheme.SchemeID() + + if sn := awsmiddleware.GetSigningName(ctx); sn != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) + } + } + + if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) + } + } + + return next.HandleFinalize(ctx, in) +} + +func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { + return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) +} + +// AuthResolverParameters contains the set of inputs necessary for auth scheme +// resolution. +type AuthResolverParameters struct { + // The name of the operation being invoked. + Operation string + + // The region in which the operation is being invoked. + Region string +} + +func bindAuthResolverParams(operation string, input interface{}, options Options) *AuthResolverParameters { + params := &AuthResolverParameters{ + Operation: operation, + } + + bindAuthParamsRegion(params, input, options) + + return params +} + +// AuthSchemeResolver returns a set of possible authentication options for an +// operation. +type AuthSchemeResolver interface { + ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) +} + +type defaultAuthSchemeResolver struct{} + +var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) + +func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + if overrides, ok := operationAuthOptions[params.Operation]; ok { + return overrides(params), nil + } + return serviceAuthOptions(params), nil +} + +var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} + +func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { + return []*smithyauth.Option{ + { + SchemeID: smithyauth.SchemeIDSigV4, + SignerProperties: func() smithy.Properties { + var props smithy.Properties + smithyhttp.SetSigV4SigningName(&props, "bedrock") + smithyhttp.SetSigV4SigningRegion(&props, params.Region) + return props + }(), + }, + } +} + +type resolveAuthSchemeMiddleware struct { + operation string + options Options +} + +func (*resolveAuthSchemeMiddleware) ID() string { + return "ResolveAuthScheme" +} + +func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + params := bindAuthResolverParams(m.operation, getOperationInput(ctx), m.options) + options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("resolve auth scheme: %v", err) + } + + scheme, ok := m.selectScheme(options) + if !ok { + return out, metadata, fmt.Errorf("could not select an auth scheme") + } + + ctx = setResolvedAuthScheme(ctx, scheme) + return next.HandleFinalize(ctx, in) +} + +func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { + for _, option := range options { + if option.SchemeID == smithyauth.SchemeIDAnonymous { + return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true + } + + for _, scheme := range m.options.AuthSchemes { + if scheme.SchemeID() != option.SchemeID { + continue + } + + if scheme.IdentityResolver(m.options) != nil { + return newResolvedAuthScheme(scheme, option), true + } + } + } + + return nil, false +} + +type resolvedAuthSchemeKey struct{} + +type resolvedAuthScheme struct { + Scheme smithyhttp.AuthScheme + IdentityProperties smithy.Properties + SignerProperties smithy.Properties +} + +func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { + return &resolvedAuthScheme{ + Scheme: scheme, + IdentityProperties: option.IdentityProperties, + SignerProperties: option.SignerProperties, + } +} + +func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { + return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) +} + +func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { + v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) + return v +} + +type getIdentityMiddleware struct { + options Options +} + +func (*getIdentityMiddleware) ID() string { + return "GetIdentity" +} + +func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + resolver := rscheme.Scheme.IdentityResolver(m.options) + if resolver == nil { + return out, metadata, fmt.Errorf("no identity resolver") + } + + identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties) + if err != nil { + return out, metadata, fmt.Errorf("get identity: %v", err) + } + + ctx = setIdentity(ctx, identity) + return next.HandleFinalize(ctx, in) +} + +type identityKey struct{} + +func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { + return middleware.WithStackValue(ctx, identityKey{}, identity) +} + +func getIdentity(ctx context.Context) smithyauth.Identity { + v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) + return v +} + +type signRequestMiddleware struct { +} + +func (*signRequestMiddleware) ID() string { + return "Signing" +} + +func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + identity := getIdentity(ctx) + if identity == nil { + return out, metadata, fmt.Errorf("no identity") + } + + signer := rscheme.Scheme.Signer() + if signer == nil { + return out, metadata, fmt.Errorf("no signer") + } + + if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil { + return out, metadata, fmt.Errorf("sign request: %v", err) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/bedrockagentruntime/deserializers.go b/service/bedrockagentruntime/deserializers.go new file mode 100644 index 00000000000..57ae086ff27 --- /dev/null +++ b/service/bedrockagentruntime/deserializers.go @@ -0,0 +1,3763 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream" + "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + smithy "github.com/aws/smithy-go" + smithyio "github.com/aws/smithy-go/io" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" + "math" + "strings" +) + +type awsRestjson1_deserializeOpInvokeAgent struct { +} + +func (*awsRestjson1_deserializeOpInvokeAgent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpInvokeAgent) 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_deserializeOpErrorInvokeAgent(response, &metadata) + } + output := &InvokeAgentOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsInvokeAgentOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorInvokeAgent(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("BadGatewayException", errorCode): + return awsRestjson1_deserializeErrorBadGatewayException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("DependencyFailedException", errorCode): + return awsRestjson1_deserializeErrorDependencyFailedException(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_deserializeOpHttpBindingsInvokeAgentOutput(v *InvokeAgentOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("x-amzn-bedrock-agent-content-type"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.ContentType = ptr.String(headerValues[0]) + } + + if headerValues := response.Header.Values("x-amz-bedrock-agent-session-id"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.SessionId = ptr.String(headerValues[0]) + } + + return nil +} + +type awsRestjson1_deserializeOpRetrieve struct { +} + +func (*awsRestjson1_deserializeOpRetrieve) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpRetrieve) 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_deserializeOpErrorRetrieve(response, &metadata) + } + output := &RetrieveOutput{} + 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_deserializeOpDocumentRetrieveOutput(&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_deserializeOpErrorRetrieve(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("BadGatewayException", errorCode): + return awsRestjson1_deserializeErrorBadGatewayException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("DependencyFailedException", errorCode): + return awsRestjson1_deserializeErrorDependencyFailedException(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_deserializeOpDocumentRetrieveOutput(v **RetrieveOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *RetrieveOutput + if *v == nil { + sv = &RetrieveOutput{} + } 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 "retrievalResults": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseRetrievalResults(&sv.RetrievalResults, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpRetrieveAndGenerate struct { +} + +func (*awsRestjson1_deserializeOpRetrieveAndGenerate) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpRetrieveAndGenerate) 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_deserializeOpErrorRetrieveAndGenerate(response, &metadata) + } + output := &RetrieveAndGenerateOutput{} + 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_deserializeOpDocumentRetrieveAndGenerateOutput(&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_deserializeOpErrorRetrieveAndGenerate(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("BadGatewayException", errorCode): + return awsRestjson1_deserializeErrorBadGatewayException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("DependencyFailedException", errorCode): + return awsRestjson1_deserializeErrorDependencyFailedException(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_deserializeOpDocumentRetrieveAndGenerateOutput(v **RetrieveAndGenerateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *RetrieveAndGenerateOutput + if *v == nil { + sv = &RetrieveAndGenerateOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "citations": + if err := awsRestjson1_deserializeDocumentCitations(&sv.Citations, value); err != nil { + return err + } + + case "output": + if err := awsRestjson1_deserializeDocumentRetrieveAndGenerateOutput(&sv.Output, value); err != nil { + return err + } + + case "sessionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SessionId to be of type string, got %T instead", value) + } + sv.SessionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeEventStreamResponseStream(v *types.ResponseStream, msg *eventstream.Message) error { + if v == nil { + return fmt.Errorf("unexpected serialization of nil %T", v) + } + + eventType := msg.Headers.Get(eventstreamapi.EventTypeHeader) + if eventType == nil { + return fmt.Errorf("%s event header not present", eventstreamapi.EventTypeHeader) + } + + switch { + case strings.EqualFold("chunk", eventType.String()): + vv := &types.ResponseStreamMemberChunk{} + if err := awsRestjson1_deserializeEventMessagePayloadPart(&vv.Value, msg); err != nil { + return err + } + *v = vv + return nil + + case strings.EqualFold("trace", eventType.String()): + vv := &types.ResponseStreamMemberTrace{} + if err := awsRestjson1_deserializeEventMessageTracePart(&vv.Value, msg); err != nil { + return err + } + *v = vv + return nil + + default: + buffer := bytes.NewBuffer(nil) + eventstream.NewEncoder().Encode(buffer, *msg) + *v = &types.UnknownUnionMember{ + Tag: eventType.String(), + Value: buffer.Bytes(), + } + return nil + + } +} + +func awsRestjson1_deserializeEventStreamExceptionResponseStream(msg *eventstream.Message) error { + exceptionType := msg.Headers.Get(eventstreamapi.ExceptionTypeHeader) + if exceptionType == nil { + return fmt.Errorf("%s event header not present", eventstreamapi.ExceptionTypeHeader) + } + + switch { + case strings.EqualFold("accessDeniedException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionAccessDeniedException(msg) + + case strings.EqualFold("badGatewayException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionBadGatewayException(msg) + + case strings.EqualFold("conflictException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionConflictException(msg) + + case strings.EqualFold("dependencyFailedException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionDependencyFailedException(msg) + + case strings.EqualFold("internalServerException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionInternalServerException(msg) + + case strings.EqualFold("resourceNotFoundException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionResourceNotFoundException(msg) + + case strings.EqualFold("serviceQuotaExceededException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionServiceQuotaExceededException(msg) + + case strings.EqualFold("throttlingException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionThrottlingException(msg) + + case strings.EqualFold("validationException", exceptionType.String()): + return awsRestjson1_deserializeEventMessageExceptionValidationException(msg) + + default: + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + return err + } + errorCode := "UnknownError" + errorMessage := errorCode + if ev := exceptionType.String(); len(ev) > 0 { + errorCode = ev + } else if ev := code; len(ev) > 0 { + errorCode = ev + } + if ev := message; len(ev) > 0 { + errorMessage = ev + } + return &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + + } +} + +func awsRestjson1_deserializeEventMessagePayloadPart(v *types.PayloadPart, msg *eventstream.Message) error { + if v == nil { + return fmt.Errorf("unexpected serialization of nil %T", v) + } + + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + if err := awsRestjson1_deserializeDocumentPayloadPart(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return nil +} + +func awsRestjson1_deserializeEventMessageTracePart(v *types.TracePart, msg *eventstream.Message) error { + if v == nil { + return fmt.Errorf("unexpected serialization of nil %T", v) + } + + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + if err := awsRestjson1_deserializeDocumentTracePart(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return nil +} + +func awsRestjson1_deserializeEventMessageExceptionInternalServerException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.InternalServerException{} + if err := awsRestjson1_deserializeDocumentInternalServerException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionValidationException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.ValidationException{} + if err := awsRestjson1_deserializeDocumentValidationException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionResourceNotFoundException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.ResourceNotFoundException{} + if err := awsRestjson1_deserializeDocumentResourceNotFoundException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionServiceQuotaExceededException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.ServiceQuotaExceededException{} + if err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionThrottlingException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.ThrottlingException{} + if err := awsRestjson1_deserializeDocumentThrottlingException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionAccessDeniedException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.AccessDeniedException{} + if err := awsRestjson1_deserializeDocumentAccessDeniedException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionConflictException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.ConflictException{} + if err := awsRestjson1_deserializeDocumentConflictException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionDependencyFailedException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.DependencyFailedException{} + if err := awsRestjson1_deserializeDocumentDependencyFailedException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +func awsRestjson1_deserializeEventMessageExceptionBadGatewayException(msg *eventstream.Message) error { + br := bytes.NewReader(msg.Payload) + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(br, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + v := &types.BadGatewayException{} + if err := awsRestjson1_deserializeDocumentBadGatewayException(&v, shape); err != nil { + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + } + return v +} + +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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionGroupInvocationInput(v **types.ActionGroupInvocationInput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionGroupInvocationInput + if *v == nil { + sv = &types.ActionGroupInvocationInput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionGroupName to be of type string, got %T instead", value) + } + sv.ActionGroupName = ptr.String(jtv) + } + + case "apiPath": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApiPath to be of type string, got %T instead", value) + } + sv.ApiPath = ptr.String(jtv) + } + + case "parameters": + if err := awsRestjson1_deserializeDocumentParameters(&sv.Parameters, value); err != nil { + return err + } + + case "requestBody": + if err := awsRestjson1_deserializeDocumentRequestBody(&sv.RequestBody, value); err != nil { + return err + } + + case "verb": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Verb to be of type string, got %T instead", value) + } + sv.Verb = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionGroupInvocationOutput(v **types.ActionGroupInvocationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionGroupInvocationOutput + if *v == nil { + sv = &types.ActionGroupInvocationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionGroupOutputString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAttribution(v **types.Attribution, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Attribution + if *v == nil { + sv = &types.Attribution{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "citations": + if err := awsRestjson1_deserializeDocumentCitations(&sv.Citations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentBadGatewayException(v **types.BadGatewayException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.BadGatewayException + if *v == nil { + sv = &types.BadGatewayException{} + } 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "resourceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.ResourceName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCitation(v **types.Citation, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Citation + if *v == nil { + sv = &types.Citation{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "generatedResponsePart": + if err := awsRestjson1_deserializeDocumentGeneratedResponsePart(&sv.GeneratedResponsePart, value); err != nil { + return err + } + + case "retrievedReferences": + if err := awsRestjson1_deserializeDocumentRetrievedReferences(&sv.RetrievedReferences, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCitations(v *[]types.Citation, 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.Citation + if *v == nil { + cv = []types.Citation{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Citation + destAddr := &col + if err := awsRestjson1_deserializeDocumentCitation(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContentMap(v *map[string][]types.Parameter, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string][]types.Parameter + if *v == nil { + mv = map[string][]types.Parameter{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal []types.Parameter + mapVar := parsedVal + if err := awsRestjson1_deserializeDocumentParameters(&mapVar, value); err != nil { + return err + } + parsedVal = mapVar + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentDependencyFailedException(v **types.DependencyFailedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DependencyFailedException + if *v == nil { + sv = &types.DependencyFailedException{} + } 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "resourceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.ResourceName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFailureTrace(v **types.FailureTrace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FailureTrace + if *v == nil { + sv = &types.FailureTrace{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "failureReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailureReasonString to be of type string, got %T instead", value) + } + sv.FailureReason = ptr.String(jtv) + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFinalResponse(v **types.FinalResponse, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FinalResponse + if *v == nil { + sv = &types.FinalResponse{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FinalResponseString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGeneratedResponsePart(v **types.GeneratedResponsePart, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GeneratedResponsePart + if *v == nil { + sv = &types.GeneratedResponsePart{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "textResponsePart": + if err := awsRestjson1_deserializeDocumentTextResponsePart(&sv.TextResponsePart, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInferenceConfiguration(v **types.InferenceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InferenceConfiguration + if *v == nil { + sv = &types.InferenceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "maximumLength": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected MaximumLength to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumLength = ptr.Int32(int32(i64)) + } + + case "stopSequences": + if err := awsRestjson1_deserializeDocumentStopSequences(&sv.StopSequences, value); err != nil { + return err + } + + case "temperature": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Temperature = ptr.Float32(float32(f64)) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Temperature = ptr.Float32(float32(f64)) + + default: + return fmt.Errorf("expected Temperature to be a JSON Number, got %T instead", value) + + } + } + + case "topK": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected TopK to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.TopK = ptr.Int32(int32(i64)) + } + + case "topP": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.TopP = ptr.Float32(float32(f64)) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.TopP = ptr.Float32(float32(f64)) + + default: + return fmt.Errorf("expected TopP to be a JSON Number, got %T instead", value) + + } + } + + 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInvocationInput(v **types.InvocationInput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InvocationInput + if *v == nil { + sv = &types.InvocationInput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupInvocationInput": + if err := awsRestjson1_deserializeDocumentActionGroupInvocationInput(&sv.ActionGroupInvocationInput, value); err != nil { + return err + } + + case "invocationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected InvocationType to be of type string, got %T instead", value) + } + sv.InvocationType = types.InvocationType(jtv) + } + + case "knowledgeBaseLookupInput": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseLookupInput(&sv.KnowledgeBaseLookupInput, value); err != nil { + return err + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseLookupInput(v **types.KnowledgeBaseLookupInput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseLookupInput + if *v == nil { + sv = &types.KnowledgeBaseLookupInput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceKnowledgeBaseId to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseLookupInputString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseLookupOutput(v **types.KnowledgeBaseLookupOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseLookupOutput + if *v == nil { + sv = &types.KnowledgeBaseLookupOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "retrievedReferences": + if err := awsRestjson1_deserializeDocumentRetrievedReferences(&sv.RetrievedReferences, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentModelInvocationInput(v **types.ModelInvocationInput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ModelInvocationInput + if *v == nil { + sv = &types.ModelInvocationInput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "inferenceConfiguration": + if err := awsRestjson1_deserializeDocumentInferenceConfiguration(&sv.InferenceConfiguration, value); err != nil { + return err + } + + case "overrideLambda": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LambdaArn to be of type string, got %T instead", value) + } + sv.OverrideLambda = ptr.String(jtv) + } + + case "parserMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CreationMode to be of type string, got %T instead", value) + } + sv.ParserMode = types.CreationMode(jtv) + } + + case "promptCreationMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CreationMode to be of type string, got %T instead", value) + } + sv.PromptCreationMode = types.CreationMode(jtv) + } + + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptText to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptType to be of type string, got %T instead", value) + } + sv.Type = types.PromptType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentObservation(v **types.Observation, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Observation + if *v == nil { + sv = &types.Observation{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionGroupInvocationOutput": + if err := awsRestjson1_deserializeDocumentActionGroupInvocationOutput(&sv.ActionGroupInvocationOutput, value); err != nil { + return err + } + + case "finalResponse": + if err := awsRestjson1_deserializeDocumentFinalResponse(&sv.FinalResponse, value); err != nil { + return err + } + + case "knowledgeBaseLookupOutput": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseLookupOutput(&sv.KnowledgeBaseLookupOutput, value); err != nil { + return err + } + + case "repromptResponse": + if err := awsRestjson1_deserializeDocumentRepromptResponse(&sv.RepromptResponse, value); err != nil { + return err + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Type to be of type string, got %T instead", value) + } + sv.Type = types.Type(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentOrchestrationTrace(v *types.OrchestrationTrace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.OrchestrationTrace +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "invocationInput": + var mv types.InvocationInput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentInvocationInput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.OrchestrationTraceMemberInvocationInput{Value: mv} + break loop + + case "modelInvocationInput": + var mv types.ModelInvocationInput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentModelInvocationInput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.OrchestrationTraceMemberModelInvocationInput{Value: mv} + break loop + + case "observation": + var mv types.Observation + destAddr := &mv + if err := awsRestjson1_deserializeDocumentObservation(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.OrchestrationTraceMemberObservation{Value: mv} + break loop + + case "rationale": + var mv types.Rationale + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRationale(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.OrchestrationTraceMemberRationale{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentParameter(v **types.Parameter, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Parameter + if *v == nil { + sv = &types.Parameter{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Name = 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 value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Value = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentParameters(v *[]types.Parameter, 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.Parameter + if *v == nil { + cv = []types.Parameter{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Parameter + destAddr := &col + if err := awsRestjson1_deserializeDocumentParameter(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentPayloadPart(v **types.PayloadPart, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PayloadPart + if *v == nil { + sv = &types.PayloadPart{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attribution": + if err := awsRestjson1_deserializeDocumentAttribution(&sv.Attribution, value); err != nil { + return err + } + + case "bytes": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PartBody to be []byte, got %T instead", value) + } + dv, err := base64.StdEncoding.DecodeString(jtv) + if err != nil { + return fmt.Errorf("failed to base64 decode PartBody, %w", err) + } + sv.Bytes = dv + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPostProcessingModelInvocationOutput(v **types.PostProcessingModelInvocationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PostProcessingModelInvocationOutput + if *v == nil { + sv = &types.PostProcessingModelInvocationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "parsedResponse": + if err := awsRestjson1_deserializeDocumentPostProcessingParsedResponse(&sv.ParsedResponse, value); err != nil { + return err + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPostProcessingParsedResponse(v **types.PostProcessingParsedResponse, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PostProcessingParsedResponse + if *v == nil { + sv = &types.PostProcessingParsedResponse{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected OutputString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPostProcessingTrace(v *types.PostProcessingTrace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.PostProcessingTrace +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "modelInvocationInput": + var mv types.ModelInvocationInput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentModelInvocationInput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PostProcessingTraceMemberModelInvocationInput{Value: mv} + break loop + + case "modelInvocationOutput": + var mv types.PostProcessingModelInvocationOutput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentPostProcessingModelInvocationOutput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PostProcessingTraceMemberModelInvocationOutput{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentPreProcessingModelInvocationOutput(v **types.PreProcessingModelInvocationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PreProcessingModelInvocationOutput + if *v == nil { + sv = &types.PreProcessingModelInvocationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "parsedResponse": + if err := awsRestjson1_deserializeDocumentPreProcessingParsedResponse(&sv.ParsedResponse, value); err != nil { + return err + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPreProcessingParsedResponse(v **types.PreProcessingParsedResponse, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PreProcessingParsedResponse + if *v == nil { + sv = &types.PreProcessingParsedResponse{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "isValid": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsValid = ptr.Bool(jtv) + } + + case "rationale": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RationaleString to be of type string, got %T instead", value) + } + sv.Rationale = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPreProcessingTrace(v *types.PreProcessingTrace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.PreProcessingTrace +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "modelInvocationInput": + var mv types.ModelInvocationInput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentModelInvocationInput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PreProcessingTraceMemberModelInvocationInput{Value: mv} + break loop + + case "modelInvocationOutput": + var mv types.PreProcessingModelInvocationOutput + destAddr := &mv + if err := awsRestjson1_deserializeDocumentPreProcessingModelInvocationOutput(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PreProcessingTraceMemberModelInvocationOutput{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRationale(v **types.Rationale, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Rationale + if *v == nil { + sv = &types.Rationale{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RationaleString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + case "traceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TraceId to be of type string, got %T instead", value) + } + sv.TraceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRepromptResponse(v **types.RepromptResponse, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RepromptResponse + if *v == nil { + sv = &types.RepromptResponse{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "source": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Source to be of type string, got %T instead", value) + } + sv.Source = types.Source(jtv) + } + + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRequestBody(v **types.RequestBody, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RequestBody + if *v == nil { + sv = &types.RequestBody{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentContentMap(&sv.Content, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievalResultContent(v **types.RetrievalResultContent, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RetrievalResultContent + if *v == nil { + sv = &types.RetrievalResultContent{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievalResultLocation(v **types.RetrievalResultLocation, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RetrievalResultLocation + if *v == nil { + sv = &types.RetrievalResultLocation{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "s3Location": + if err := awsRestjson1_deserializeDocumentRetrievalResultS3Location(&sv.S3Location, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrievalResultLocationType to be of type string, got %T instead", value) + } + sv.Type = types.RetrievalResultLocationType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievalResultS3Location(v **types.RetrievalResultS3Location, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RetrievalResultS3Location + if *v == nil { + sv = &types.RetrievalResultS3Location{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "uri": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Uri = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievedReference(v **types.RetrievedReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RetrievedReference + if *v == nil { + sv = &types.RetrievedReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentRetrievalResultContent(&sv.Content, value); err != nil { + return err + } + + case "location": + if err := awsRestjson1_deserializeDocumentRetrievalResultLocation(&sv.Location, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievedReferences(v *[]types.RetrievedReference, 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.RetrievedReference + if *v == nil { + cv = []types.RetrievedReference{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RetrievedReference + destAddr := &col + if err := awsRestjson1_deserializeDocumentRetrievedReference(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ServiceQuotaExceededException + if *v == nil { + sv = &types.ServiceQuotaExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSpan(v **types.Span, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Span + if *v == nil { + sv = &types.Span{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "end": + 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.End = ptr.Int32(int32(i64)) + } + + case "start": + 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.Start = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentStopSequences(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_deserializeDocumentTextResponsePart(v **types.TextResponsePart, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TextResponsePart + if *v == nil { + sv = &types.TextResponsePart{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "span": + if err := awsRestjson1_deserializeDocumentSpan(&sv.Span, value); err != nil { + return err + } + + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ThrottlingException + if *v == nil { + sv = &types.ThrottlingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonBlankString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTrace(v *types.Trace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.Trace +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "failureTrace": + var mv types.FailureTrace + destAddr := &mv + if err := awsRestjson1_deserializeDocumentFailureTrace(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.TraceMemberFailureTrace{Value: mv} + break loop + + case "orchestrationTrace": + var mv types.OrchestrationTrace + if err := awsRestjson1_deserializeDocumentOrchestrationTrace(&mv, value); err != nil { + return err + } + uv = &types.TraceMemberOrchestrationTrace{Value: mv} + break loop + + case "postProcessingTrace": + var mv types.PostProcessingTrace + if err := awsRestjson1_deserializeDocumentPostProcessingTrace(&mv, value); err != nil { + return err + } + uv = &types.TraceMemberPostProcessingTrace{Value: mv} + break loop + + case "preProcessingTrace": + var mv types.PreProcessingTrace + if err := awsRestjson1_deserializeDocumentPreProcessingTrace(&mv, value); err != nil { + return err + } + uv = &types.TraceMemberPreProcessingTrace{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentTracePart(v **types.TracePart, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TracePart + if *v == nil { + sv = &types.TracePart{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "agentAliasId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentAliasId to be of type string, got %T instead", value) + } + sv.AgentAliasId = ptr.String(jtv) + } + + case "agentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentId to be of type string, got %T instead", value) + } + sv.AgentId = ptr.String(jtv) + } + + case "sessionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SessionId to be of type string, got %T instead", value) + } + sv.SessionId = ptr.String(jtv) + } + + case "trace": + if err := awsRestjson1_deserializeDocumentTrace(&sv.Trace, value); err != nil { + return err + } + + 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 NonBlankString to be of type string, got %T instead", value) + } + sv.Message = 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_deserializeErrorBadGatewayException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.BadGatewayException{} + 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_deserializeDocumentBadGatewayException(&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_deserializeErrorDependencyFailedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.DependencyFailedException{} + 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_deserializeDocumentDependencyFailedException(&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_deserializeDocumentKnowledgeBaseRetrievalResult(v **types.KnowledgeBaseRetrievalResult, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseRetrievalResult + if *v == nil { + sv = &types.KnowledgeBaseRetrievalResult{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentRetrievalResultContent(&sv.Content, value); err != nil { + return err + } + + case "location": + if err := awsRestjson1_deserializeDocumentRetrievalResultLocation(&sv.Location, value); err != nil { + return err + } + + case "score": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Score = ptr.Float64(f64) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Score = ptr.Float64(f64) + + default: + return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseRetrievalResults(v *[]types.KnowledgeBaseRetrievalResult, 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.KnowledgeBaseRetrievalResult + if *v == nil { + cv = []types.KnowledgeBaseRetrievalResult{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.KnowledgeBaseRetrievalResult + destAddr := &col + if err := awsRestjson1_deserializeDocumentKnowledgeBaseRetrievalResult(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRetrieveAndGenerateOutput(v **types.RetrieveAndGenerateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RetrieveAndGenerateOutput + if *v == nil { + sv = &types.RetrieveAndGenerateOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/bedrockagentruntime/doc.go b/service/bedrockagentruntime/doc.go new file mode 100644 index 00000000000..bee0714696f --- /dev/null +++ b/service/bedrockagentruntime/doc.go @@ -0,0 +1,7 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package bedrockagentruntime provides the API client, operations, and parameter +// types for Agents for Amazon Bedrock Runtime. +// +// Amazon Bedrock Agent +package bedrockagentruntime diff --git a/service/bedrockagentruntime/endpoints.go b/service/bedrockagentruntime/endpoints.go new file mode 100644 index 00000000000..b14a1aef363 --- /dev/null +++ b/service/bedrockagentruntime/endpoints.go @@ -0,0 +1,509 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + "github.com/aws/aws-sdk-go-v2/internal/endpoints" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/internal/endpoints" + smithyauth "github.com/aws/smithy-go/auth" + 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" + "os" + "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 = "bedrock" + } + 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() + } +} + +func resolveBaseEndpoint(cfg aws.Config, o *Options) { + if cfg.BaseEndpoint != nil { + o.BaseEndpoint = cfg.BaseEndpoint + } + + _, g := os.LookupEnv("AWS_ENDPOINT_URL") + _, s := os.LookupEnv("AWS_ENDPOINT_URL_BEDROCK_AGENT_RUNTIME") + + if g && !s { + return + } + + value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "Bedrock Agent Runtime", cfg.ConfigSources) + if found && err == nil { + o.BaseEndpoint = &value + } +} + +// 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://bedrock-agent-runtime-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 _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://bedrock-agent-runtime-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://bedrock-agent-runtime.") + 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://bedrock-agent-runtime.") + 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") +} + +type endpointParamsBinder interface { + bindEndpointParams(*EndpointParameters) +} + +func bindEndpointParams(input interface{}, options Options) *EndpointParameters { + params := &EndpointParameters{} + + params.Region = aws.String(endpoints.MapFIPSRegion(options.Region)) + params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled) + params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) + params.Endpoint = options.BaseEndpoint + + if b, ok := input.(endpointParamsBinder); ok { + b.bindEndpointParams(params) + } + + return params +} + +type resolveEndpointV2Middleware struct { + options Options +} + +func (*resolveEndpointV2Middleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleFinalize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.options.EndpointResolverV2 == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := bindEndpointParams(getOperationInput(ctx), m.options) + endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + if endpt.URI.RawPath == "" && req.URL.RawPath != "" { + endpt.URI.RawPath = endpt.URI.Path + } + req.URL.Scheme = endpt.URI.Scheme + req.URL.Host = endpt.URI.Host + req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) + req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) + for k := range endpt.Headers { + req.Header.Set(k, endpt.Headers.Get(k)) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) + for _, o := range opts { + rscheme.SignerProperties.SetAll(&o.SignerProperties) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/bedrockagentruntime/endpoints_config_test.go b/service/bedrockagentruntime/endpoints_config_test.go new file mode 100644 index 00000000000..9e31ee1b87e --- /dev/null +++ b/service/bedrockagentruntime/endpoints_config_test.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "os" + "reflect" + "testing" +) + +type mockConfigSource struct { + global string + service string + ignore bool +} + +// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured +// endpoints feature. +func (m mockConfigSource) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) { + return m.ignore, m.ignore, nil +} + +// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use +// with configured endpoints. +func (m mockConfigSource) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) { + if m.service != "" { + return m.service, true, nil + } + return "", false, nil +} + +func TestResolveBaseEndpoint(t *testing.T) { + cases := map[string]struct { + envGlobal string + envService string + envIgnore bool + configGlobal string + configService string + configIgnore bool + clientEndpoint *string + expectURL *string + }{ + "env ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent-runtime.dev", + envIgnore: true, + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + expectURL: nil, + }, + "env global": { + envGlobal: "https://env-global.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + expectURL: aws.String("https://env-global.dev"), + }, + "env service": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent-runtime.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + expectURL: aws.String("https://env-bedrock-agent-runtime.dev"), + }, + "config ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent-runtime.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + configIgnore: true, + expectURL: nil, + }, + "config global": { + configGlobal: "http://config-global.dev", + expectURL: aws.String("http://config-global.dev"), + }, + "config service": { + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + expectURL: aws.String("http://config-bedrock-agent-runtime.dev"), + }, + "client": { + envGlobal: "https://env-global.dev", + envService: "https://env-bedrock-agent-runtime.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-bedrock-agent-runtime.dev", + clientEndpoint: aws.String("https://client-bedrock-agent-runtime.dev"), + expectURL: aws.String("https://client-bedrock-agent-runtime.dev"), + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + os.Clearenv() + + awsConfig := aws.Config{} + ignore := c.envIgnore || c.configIgnore + + if c.configGlobal != "" && !ignore { + awsConfig.BaseEndpoint = aws.String(c.configGlobal) + } + + if c.envGlobal != "" { + t.Setenv("AWS_ENDPOINT_URL", c.envGlobal) + if !ignore { + awsConfig.BaseEndpoint = aws.String(c.envGlobal) + } + } + + if c.envService != "" { + t.Setenv("AWS_ENDPOINT_URL_BEDROCK_AGENT_RUNTIME", c.envService) + } + + awsConfig.ConfigSources = []interface{}{ + mockConfigSource{ + global: c.envGlobal, + service: c.envService, + ignore: c.envIgnore, + }, + mockConfigSource{ + global: c.configGlobal, + service: c.configService, + ignore: c.configIgnore, + }, + } + + client := NewFromConfig(awsConfig, func(o *Options) { + if c.clientEndpoint != nil { + o.BaseEndpoint = c.clientEndpoint + } + }) + + if e, a := c.expectURL, client.options.BaseEndpoint; !reflect.DeepEqual(e, a) { + t.Errorf("expect endpoint %v , got %v", e, a) + } + }) + } +} diff --git a/service/bedrockagentruntime/endpoints_test.go b/service/bedrockagentruntime/endpoints_test.go new file mode 100644 index 00000000000..e7a5e0a26ec --- /dev/null +++ b/service/bedrockagentruntime/endpoints_test.go @@ -0,0 +1,856 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +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://bedrock-agent-runtime-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://bedrock-agent-runtime-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://bedrock-agent-runtime.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://bedrock-agent-runtime.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://bedrock-agent-runtime-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://bedrock-agent-runtime-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://bedrock-agent-runtime.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://bedrock-agent-runtime.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://bedrock-agent-runtime-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://bedrock-agent-runtime-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://bedrock-agent-runtime.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://bedrock-agent-runtime.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://bedrock-agent-runtime-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://bedrock-agent-runtime.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://bedrock-agent-runtime-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://bedrock-agent-runtime.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/bedrockagentruntime/eventstream.go b/service/bedrockagentruntime/eventstream.go new file mode 100644 index 00000000000..5086a2334e2 --- /dev/null +++ b/service/bedrockagentruntime/eventstream.go @@ -0,0 +1,284 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream" + "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" + smithysync "github.com/aws/smithy-go/sync" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" + "io/ioutil" + "sync" +) + +// ResponseStreamReader provides the interface for reading events from a stream. +// +// The writer's Close method must allow multiple concurrent calls. +type ResponseStreamReader interface { + Events() <-chan types.ResponseStream + Close() error + Err() error +} + +type responseStreamReader struct { + stream chan types.ResponseStream + decoder *eventstream.Decoder + eventStream io.ReadCloser + err *smithysync.OnceErr + payloadBuf []byte + done chan struct{} + closeOnce sync.Once +} + +func newResponseStreamReader(readCloser io.ReadCloser, decoder *eventstream.Decoder) *responseStreamReader { + w := &responseStreamReader{ + stream: make(chan types.ResponseStream), + decoder: decoder, + eventStream: readCloser, + err: smithysync.NewOnceErr(), + done: make(chan struct{}), + payloadBuf: make([]byte, 10*1024), + } + + go w.readEventStream() + + return w +} + +func (r *responseStreamReader) Events() <-chan types.ResponseStream { + return r.stream +} + +func (r *responseStreamReader) readEventStream() { + defer r.Close() + defer close(r.stream) + + for { + r.payloadBuf = r.payloadBuf[0:0] + decodedMessage, err := r.decoder.Decode(r.eventStream, r.payloadBuf) + if err != nil { + if err == io.EOF { + return + } + select { + case <-r.done: + return + default: + r.err.SetError(err) + return + } + } + + event, err := r.deserializeEventMessage(&decodedMessage) + if err != nil { + r.err.SetError(err) + return + } + + select { + case r.stream <- event: + case <-r.done: + return + } + + } +} + +func (r *responseStreamReader) deserializeEventMessage(msg *eventstream.Message) (types.ResponseStream, error) { + messageType := msg.Headers.Get(eventstreamapi.MessageTypeHeader) + if messageType == nil { + return nil, fmt.Errorf("%s event header not present", eventstreamapi.MessageTypeHeader) + } + + switch messageType.String() { + case eventstreamapi.EventMessageType: + var v types.ResponseStream + if err := awsRestjson1_deserializeEventStreamResponseStream(&v, msg); err != nil { + return nil, err + } + return v, nil + + case eventstreamapi.ExceptionMessageType: + return nil, awsRestjson1_deserializeEventStreamExceptionResponseStream(msg) + + case eventstreamapi.ErrorMessageType: + errorCode := "UnknownError" + errorMessage := errorCode + if header := msg.Headers.Get(eventstreamapi.ErrorCodeHeader); header != nil { + errorCode = header.String() + } + if header := msg.Headers.Get(eventstreamapi.ErrorMessageHeader); header != nil { + errorMessage = header.String() + } + return nil, &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + + default: + mc := msg.Clone() + return nil, &UnknownEventMessageError{ + Type: messageType.String(), + Message: &mc, + } + + } +} + +func (r *responseStreamReader) ErrorSet() <-chan struct{} { + return r.err.ErrorSet() +} + +func (r *responseStreamReader) Close() error { + r.closeOnce.Do(r.safeClose) + return r.Err() +} + +func (r *responseStreamReader) safeClose() { + close(r.done) + r.eventStream.Close() + +} + +func (r *responseStreamReader) Err() error { + return r.err.Err() +} + +func (r *responseStreamReader) Closed() <-chan struct{} { + return r.done +} + +type awsRestjson1_deserializeOpEventStreamInvokeAgent struct { + LogEventStreamWrites bool + LogEventStreamReads bool +} + +func (*awsRestjson1_deserializeOpEventStreamInvokeAgent) ID() string { + return "OperationEventStreamDeserializer" +} + +func (m *awsRestjson1_deserializeOpEventStreamInvokeAgent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + defer func() { + if err == nil { + return + } + m.closeResponseBody(out) + }() + + logger := middleware.GetLogger(ctx) + + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type: %T", in.Request) + } + _ = request + + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + deserializeOutput, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type: %T", out.RawResponse) + } + _ = deserializeOutput + + output, ok := out.Result.(*InvokeAgentOutput) + if out.Result != nil && !ok { + return out, metadata, fmt.Errorf("unexpected output result type: %T", out.Result) + } else if out.Result == nil { + output = &InvokeAgentOutput{} + out.Result = output + } + + eventReader := newResponseStreamReader( + deserializeOutput.Body, + eventstream.NewDecoder(func(options *eventstream.DecoderOptions) { + options.Logger = logger + options.LogMessages = m.LogEventStreamReads + + }), + ) + defer func() { + if err == nil { + return + } + _ = eventReader.Close() + }() + + output.eventStream = NewInvokeAgentEventStream(func(stream *InvokeAgentEventStream) { + stream.Reader = eventReader + }) + + go output.eventStream.waitStreamClose() + + return out, metadata, nil +} + +func (*awsRestjson1_deserializeOpEventStreamInvokeAgent) closeResponseBody(out middleware.DeserializeOutput) { + if resp, ok := out.RawResponse.(*smithyhttp.Response); ok && resp != nil && resp.Body != nil { + _, _ = io.Copy(ioutil.Discard, resp.Body) + _ = resp.Body.Close() + } +} + +func addEventStreamInvokeAgentMiddleware(stack *middleware.Stack, options Options) error { + if err := stack.Deserialize.Insert(&awsRestjson1_deserializeOpEventStreamInvokeAgent{ + LogEventStreamWrites: options.ClientLogMode.IsRequestEventMessage(), + LogEventStreamReads: options.ClientLogMode.IsResponseEventMessage(), + }, "OperationDeserializer", middleware.Before); err != nil { + return err + } + return nil + +} + +// UnknownEventMessageError provides an error when a message is received from the stream, +// but the reader is unable to determine what kind of message it is. +type UnknownEventMessageError struct { + Type string + Message *eventstream.Message +} + +// Error retruns the error message string. +func (e *UnknownEventMessageError) Error() string { + return "unknown event stream message type, " + e.Type +} + +func setSafeEventStreamClientLogMode(o *Options, operation string) { + switch operation { + case "InvokeAgent": + toggleEventStreamClientLogMode(o, false, true) + return + + default: + return + + } +} +func toggleEventStreamClientLogMode(o *Options, request, response bool) { + mode := o.ClientLogMode + + if request && mode.IsRequestWithBody() { + mode.ClearRequestWithBody() + mode |= aws.LogRequest + } + + if response && mode.IsResponseWithBody() { + mode.ClearResponseWithBody() + mode |= aws.LogResponse + } + + o.ClientLogMode = mode + +} diff --git a/service/bedrockagentruntime/generated.json b/service/bedrockagentruntime/generated.json new file mode 100644 index 00000000000..4b62903c464 --- /dev/null +++ b/service/bedrockagentruntime/generated.json @@ -0,0 +1,38 @@ +{ + "dependencies": { + "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream": "v0.0.0-00010101000000-000000000000", + "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_InvokeAgent.go", + "api_op_Retrieve.go", + "api_op_RetrieveAndGenerate.go", + "auth.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "endpoints_config_test.go", + "endpoints_test.go", + "eventstream.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "options.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/bedrockagentruntime", + "unstable": false +} diff --git a/service/bedrockagentruntime/go.mod b/service/bedrockagentruntime/go.mod new file mode 100644 index 00000000000..b9b57d4a7b6 --- /dev/null +++ b/service/bedrockagentruntime/go.mod @@ -0,0 +1,20 @@ +module github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime + +go 1.19 + +require ( + github.com/aws/aws-sdk-go-v2 v1.23.1 + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 + github.com/aws/smithy-go v1.17.0 + github.com/google/go-cmp v0.5.8 +) + +replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream => ../../aws/protocol/eventstream/ + +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/bedrockagentruntime/go.sum b/service/bedrockagentruntime/go.sum new file mode 100644 index 00000000000..42e4fc806b4 --- /dev/null +++ b/service/bedrockagentruntime/go.sum @@ -0,0 +1,4 @@ +github.com/aws/smithy-go v1.17.0 h1:wWJD7LX6PBV6etBUwO0zElG0nWN9rUhp0WdYeHSHAaI= +github.com/aws/smithy-go v1.17.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/bedrockagentruntime/go_module_metadata.go b/service/bedrockagentruntime/go_module_metadata.go new file mode 100644 index 00000000000..0e580b56427 --- /dev/null +++ b/service/bedrockagentruntime/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package bedrockagentruntime + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/bedrockagentruntime/internal/endpoints/endpoints.go b/service/bedrockagentruntime/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..7195d9d8a91 --- /dev/null +++ b/service/bedrockagentruntime/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 Bedrock Agent Runtime 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: "bedrock-agent-runtime.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{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: "bedrock-agent-runtime.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "bedrock-agent-runtime-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "bedrock-agent-runtime.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/bedrockagentruntime/internal/endpoints/endpoints_test.go b/service/bedrockagentruntime/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/bedrockagentruntime/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/bedrockagentruntime/options.go b/service/bedrockagentruntime/options.go new file mode 100644 index 00000000000..1c8693acce7 --- /dev/null +++ b/service/bedrockagentruntime/options.go @@ -0,0 +1,219 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" +) + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +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 operation. 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 + + // The auth scheme resolver which determines how to authenticate for each + // operation. + AuthSchemeResolver AuthSchemeResolver + + // The list of auth schemes supported by the client. + AuthSchemes []smithyhttp.AuthScheme +} + +// 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 (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { + if schemeID == "aws.auth#sigv4" { + return getSigV4IdentityResolver(o) + } + if schemeID == "smithy.api#noAuth" { + return &smithyauth.AnonymousIdentityResolver{} + } + return nil +} + +// 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 + } +} + +func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { + if o.Credentials != nil { + return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} + } + return nil +} + +// WithSigV4SigningName applies an override to the authentication workflow to +// use the given signing name for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing name from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningName(name string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), + middleware.Before, + ) + }) + } +} + +// WithSigV4SigningRegion applies an override to the authentication workflow to +// use the given signing region for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing region from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningRegion(region string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), + middleware.Before, + ) + }) + } +} + +func ignoreAnonymousAuth(options *Options) { + if _, ok := options.Credentials.(aws.AnonymousCredentials); ok { + options.Credentials = nil + } +} diff --git a/service/bedrockagentruntime/protocol_test.go b/service/bedrockagentruntime/protocol_test.go new file mode 100644 index 00000000000..07503ff1405 --- /dev/null +++ b/service/bedrockagentruntime/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime diff --git a/service/bedrockagentruntime/serializers.go b/service/bedrockagentruntime/serializers.go new file mode 100644 index 00000000000..2a1031666e9 --- /dev/null +++ b/service/bedrockagentruntime/serializers.go @@ -0,0 +1,477 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/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_serializeOpInvokeAgent struct { +} + +func (*awsRestjson1_serializeOpInvokeAgent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpInvokeAgent) 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.(*InvokeAgentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text") + 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_serializeOpHttpBindingsInvokeAgentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentInvokeAgentInput(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_serializeOpHttpBindingsInvokeAgentInput(v *InvokeAgentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AgentAliasId == nil || len(*v.AgentAliasId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentAliasId must not be empty")} + } + if v.AgentAliasId != nil { + if err := encoder.SetURI("agentAliasId").String(*v.AgentAliasId); err != nil { + return err + } + } + + if v.AgentId == nil || len(*v.AgentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member agentId must not be empty")} + } + if v.AgentId != nil { + if err := encoder.SetURI("agentId").String(*v.AgentId); err != nil { + return err + } + } + + if v.SessionId == nil || len(*v.SessionId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member sessionId must not be empty")} + } + if v.SessionId != nil { + if err := encoder.SetURI("sessionId").String(*v.SessionId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentInvokeAgentInput(v *InvokeAgentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EnableTrace != nil { + ok := object.Key("enableTrace") + ok.Boolean(*v.EnableTrace) + } + + if v.EndSession != nil { + ok := object.Key("endSession") + ok.Boolean(*v.EndSession) + } + + if v.InputText != nil { + ok := object.Key("inputText") + ok.String(*v.InputText) + } + + if v.SessionState != nil { + ok := object.Key("sessionState") + if err := awsRestjson1_serializeDocumentSessionState(v.SessionState, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpRetrieve struct { +} + +func (*awsRestjson1_serializeOpRetrieve) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpRetrieve) 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.(*RetrieveInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgebases/{knowledgeBaseId}/retrieve") + 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_serializeOpHttpBindingsRetrieveInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentRetrieveInput(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_serializeOpHttpBindingsRetrieveInput(v *RetrieveInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentRetrieveInput(v *RetrieveInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + if v.RetrievalConfiguration != nil { + ok := object.Key("retrievalConfiguration") + if err := awsRestjson1_serializeDocumentKnowledgeBaseRetrievalConfiguration(v.RetrievalConfiguration, ok); err != nil { + return err + } + } + + if v.RetrievalQuery != nil { + ok := object.Key("retrievalQuery") + if err := awsRestjson1_serializeDocumentKnowledgeBaseQuery(v.RetrievalQuery, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpRetrieveAndGenerate struct { +} + +func (*awsRestjson1_serializeOpRetrieveAndGenerate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpRetrieveAndGenerate) 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.(*RetrieveAndGenerateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/retrieveAndGenerate") + 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_serializeOpDocumentRetrieveAndGenerateInput(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_serializeOpHttpBindingsRetrieveAndGenerateInput(v *RetrieveAndGenerateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentRetrieveAndGenerateInput(v *RetrieveAndGenerateInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Input != nil { + ok := object.Key("input") + if err := awsRestjson1_serializeDocumentRetrieveAndGenerateInput(v.Input, ok); err != nil { + return err + } + } + + if v.RetrieveAndGenerateConfiguration != nil { + ok := object.Key("retrieveAndGenerateConfiguration") + if err := awsRestjson1_serializeDocumentRetrieveAndGenerateConfiguration(v.RetrieveAndGenerateConfiguration, ok); err != nil { + return err + } + } + + if v.SessionConfiguration != nil { + ok := object.Key("sessionConfiguration") + if err := awsRestjson1_serializeDocumentRetrieveAndGenerateSessionConfiguration(v.SessionConfiguration, ok); err != nil { + return err + } + } + + if v.SessionId != nil { + ok := object.Key("sessionId") + ok.String(*v.SessionId) + } + + return nil +} + +func awsRestjson1_serializeDocumentKnowledgeBaseQuery(v *types.KnowledgeBaseQuery, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Text != nil { + ok := object.Key("text") + ok.String(*v.Text) + } + + return nil +} + +func awsRestjson1_serializeDocumentKnowledgeBaseRetrievalConfiguration(v *types.KnowledgeBaseRetrievalConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.VectorSearchConfiguration != nil { + ok := object.Key("vectorSearchConfiguration") + if err := awsRestjson1_serializeDocumentKnowledgeBaseVectorSearchConfiguration(v.VectorSearchConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentKnowledgeBaseRetrieveAndGenerateConfiguration(v *types.KnowledgeBaseRetrieveAndGenerateConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KnowledgeBaseId != nil { + ok := object.Key("knowledgeBaseId") + ok.String(*v.KnowledgeBaseId) + } + + if v.ModelArn != nil { + ok := object.Key("modelArn") + ok.String(*v.ModelArn) + } + + return nil +} + +func awsRestjson1_serializeDocumentKnowledgeBaseVectorSearchConfiguration(v *types.KnowledgeBaseVectorSearchConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.NumberOfResults != nil { + ok := object.Key("numberOfResults") + ok.Integer(*v.NumberOfResults) + } + + return nil +} + +func awsRestjson1_serializeDocumentPromptSessionAttributesMap(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_serializeDocumentRetrieveAndGenerateConfiguration(v *types.RetrieveAndGenerateConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KnowledgeBaseConfiguration != nil { + ok := object.Key("knowledgeBaseConfiguration") + if err := awsRestjson1_serializeDocumentKnowledgeBaseRetrieveAndGenerateConfiguration(v.KnowledgeBaseConfiguration, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +func awsRestjson1_serializeDocumentRetrieveAndGenerateInput(v *types.RetrieveAndGenerateInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Text != nil { + ok := object.Key("text") + ok.String(*v.Text) + } + + return nil +} + +func awsRestjson1_serializeDocumentRetrieveAndGenerateSessionConfiguration(v *types.RetrieveAndGenerateSessionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KmsKeyArn != nil { + ok := object.Key("kmsKeyArn") + ok.String(*v.KmsKeyArn) + } + + return nil +} + +func awsRestjson1_serializeDocumentSessionAttributesMap(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_serializeDocumentSessionState(v *types.SessionState, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.PromptSessionAttributes != nil { + ok := object.Key("promptSessionAttributes") + if err := awsRestjson1_serializeDocumentPromptSessionAttributesMap(v.PromptSessionAttributes, ok); err != nil { + return err + } + } + + if v.SessionAttributes != nil { + ok := object.Key("sessionAttributes") + if err := awsRestjson1_serializeDocumentSessionAttributesMap(v.SessionAttributes, ok); err != nil { + return err + } + } + + return nil +} diff --git a/service/bedrockagentruntime/types/enums.go b/service/bedrockagentruntime/types/enums.go new file mode 100644 index 00000000000..2b07674ee45 --- /dev/null +++ b/service/bedrockagentruntime/types/enums.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type CreationMode string + +// Enum values for CreationMode +const ( + CreationModeDefault CreationMode = "DEFAULT" + CreationModeOverridden CreationMode = "OVERRIDDEN" +) + +// Values returns all known values for CreationMode. 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 (CreationMode) Values() []CreationMode { + return []CreationMode{ + "DEFAULT", + "OVERRIDDEN", + } +} + +type InvocationType string + +// Enum values for InvocationType +const ( + InvocationTypeActionGroup InvocationType = "ACTION_GROUP" + InvocationTypeKnowledgeBase InvocationType = "KNOWLEDGE_BASE" + InvocationTypeFinish InvocationType = "FINISH" +) + +// Values returns all known values for InvocationType. 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 (InvocationType) Values() []InvocationType { + return []InvocationType{ + "ACTION_GROUP", + "KNOWLEDGE_BASE", + "FINISH", + } +} + +type PromptType string + +// Enum values for PromptType +const ( + PromptTypePreProcessing PromptType = "PRE_PROCESSING" + PromptTypeOrchestration PromptType = "ORCHESTRATION" + PromptTypeKnowledgeBaseResponseGeneration PromptType = "KNOWLEDGE_BASE_RESPONSE_GENERATION" + PromptTypePostProcessing PromptType = "POST_PROCESSING" +) + +// Values returns all known values for PromptType. 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 (PromptType) Values() []PromptType { + return []PromptType{ + "PRE_PROCESSING", + "ORCHESTRATION", + "KNOWLEDGE_BASE_RESPONSE_GENERATION", + "POST_PROCESSING", + } +} + +type RetrievalResultLocationType string + +// Enum values for RetrievalResultLocationType +const ( + RetrievalResultLocationTypeS3 RetrievalResultLocationType = "S3" +) + +// Values returns all known values for RetrievalResultLocationType. 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 (RetrievalResultLocationType) Values() []RetrievalResultLocationType { + return []RetrievalResultLocationType{ + "S3", + } +} + +type RetrieveAndGenerateType string + +// Enum values for RetrieveAndGenerateType +const ( + RetrieveAndGenerateTypeKnowledgeBase RetrieveAndGenerateType = "KNOWLEDGE_BASE" +) + +// Values returns all known values for RetrieveAndGenerateType. 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 (RetrieveAndGenerateType) Values() []RetrieveAndGenerateType { + return []RetrieveAndGenerateType{ + "KNOWLEDGE_BASE", + } +} + +type Source string + +// Enum values for Source +const ( + SourceActionGroup Source = "ACTION_GROUP" + SourceKnowledgeBase Source = "KNOWLEDGE_BASE" + SourceParser Source = "PARSER" +) + +// Values returns all known values for Source. 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 (Source) Values() []Source { + return []Source{ + "ACTION_GROUP", + "KNOWLEDGE_BASE", + "PARSER", + } +} + +type Type string + +// Enum values for Type +const ( + TypeActionGroup Type = "ACTION_GROUP" + TypeKnowledgeBase Type = "KNOWLEDGE_BASE" + TypeFinish Type = "FINISH" + TypeAskUser Type = "ASK_USER" + TypeReprompt Type = "REPROMPT" +) + +// Values returns all known values for Type. Note that this can be expanded in the +// future, and so it is only as up to date as the client. The ordering of this +// slice is not guaranteed to be stable across updates. +func (Type) Values() []Type { + return []Type{ + "ACTION_GROUP", + "KNOWLEDGE_BASE", + "FINISH", + "ASK_USER", + "REPROMPT", + } +} diff --git a/service/bedrockagentruntime/types/errors.go b/service/bedrockagentruntime/types/errors.go new file mode 100644 index 00000000000..7fef7c5c22f --- /dev/null +++ b/service/bedrockagentruntime/types/errors.go @@ -0,0 +1,250 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// This exception is thrown when a request is denied per access permissions +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 exception is thrown when a request fails due to dependency like Lambda, +// Bedrock, STS resource +type BadGatewayException struct { + Message *string + + ErrorCodeOverride *string + + ResourceName *string + + noSmithyDocumentSerde +} + +func (e *BadGatewayException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *BadGatewayException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *BadGatewayException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "BadGatewayException" + } + return *e.ErrorCodeOverride +} +func (e *BadGatewayException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// This exception is thrown when there is a conflict performing an operation +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when a request fails due to dependency like Lambda, +// Bedrock, STS resource due to a customer fault (i.e. bad configuration) +type DependencyFailedException struct { + Message *string + + ErrorCodeOverride *string + + ResourceName *string + + noSmithyDocumentSerde +} + +func (e *DependencyFailedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *DependencyFailedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *DependencyFailedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "DependencyFailedException" + } + return *e.ErrorCodeOverride +} +func (e *DependencyFailedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown if there was an unexpected error during processing of +// request +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 } + +// This exception is thrown when a resource referenced by the operation does not +// exist +type ResourceNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ResourceNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ResourceNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when a request is made beyond the service quota +type ServiceQuotaExceededException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceQuotaExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceQuotaExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServiceQuotaExceededException" + } + return *e.ErrorCodeOverride +} +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when the number of requests exceeds the limit +type ThrottlingException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ThrottlingException" + } + return *e.ErrorCodeOverride +} +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This exception is thrown when the request's input validation fails +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ValidationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ValidationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ValidationException" + } + return *e.ErrorCodeOverride +} +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/bedrockagentruntime/types/types.go b/service/bedrockagentruntime/types/types.go new file mode 100644 index 00000000000..90f9789ac2e --- /dev/null +++ b/service/bedrockagentruntime/types/types.go @@ -0,0 +1,716 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" +) + +// input to lambda used in action group +type ActionGroupInvocationInput struct { + + // Agent Trace Action Group Name + ActionGroupName *string + + // Agent Trace Action Group API path + ApiPath *string + + // list of parameters included in action group invocation + Parameters []Parameter + + // Request Body Content Map + RequestBody *RequestBody + + // Agent Trace Action Group Action verb + Verb *string + + noSmithyDocumentSerde +} + +// output from lambda used in action group +type ActionGroupInvocationOutput struct { + + // Agent Trace Action Group Lambda Invocation Output String + Text *string + + noSmithyDocumentSerde +} + +// Citations associated with final agent response +type Attribution struct { + + // List of citations + Citations []Citation + + noSmithyDocumentSerde +} + +// Citation associated with the agent response +type Citation struct { + + // Generate response part + GeneratedResponsePart *GeneratedResponsePart + + // list of retrieved references + RetrievedReferences []RetrievedReference + + noSmithyDocumentSerde +} + +// Trace Part which is emitted when agent trace could not be generated +type FailureTrace struct { + + // Agent Trace Failed Reason String + FailureReason *string + + // Identifier for trace + TraceId *string + + noSmithyDocumentSerde +} + +// Agent finish output +type FinalResponse struct { + + // Agent Trace Action Group Lambda Invocation Output String + Text *string + + noSmithyDocumentSerde +} + +// Generate response part +type GeneratedResponsePart struct { + + // Text response part + TextResponsePart *TextResponsePart + + noSmithyDocumentSerde +} + +// Configurations for controlling the inference response of an InvokeAgent API call +type InferenceConfiguration struct { + + // Maximum length of output + MaximumLength *int32 + + // List of stop sequences + StopSequences []string + + // Controls randomness, higher values increase diversity + Temperature *float32 + + // Sample from the k most likely next tokens + TopK *int32 + + // Cumulative probability cutoff for token selection + TopP *float32 + + noSmithyDocumentSerde +} + +// Trace Part which contains input details for action group or knowledge base +type InvocationInput struct { + + // input to lambda used in action group + ActionGroupInvocationInput *ActionGroupInvocationInput + + // types of invocations + InvocationType InvocationType + + // Input to lambda used in action group + KnowledgeBaseLookupInput *KnowledgeBaseLookupInput + + // Identifier for trace + TraceId *string + + noSmithyDocumentSerde +} + +// Input to lambda used in action group +type KnowledgeBaseLookupInput struct { + + // Agent Trace Action Group Knowledge Base Id + KnowledgeBaseId *string + + // Agent Trace Action Group Lambda Invocation Output String + Text *string + + noSmithyDocumentSerde +} + +// Input to lambda used in action group +type KnowledgeBaseLookupOutput struct { + + // list of retrieved references + RetrievedReferences []RetrievedReference + + noSmithyDocumentSerde +} + +// Knowledge base input query. +type KnowledgeBaseQuery struct { + + // Knowledge base input query in text + // + // This member is required. + Text *string + + noSmithyDocumentSerde +} + +// Search parameters for retrieving from knowledge base. +type KnowledgeBaseRetrievalConfiguration struct { + + // Knowledge base vector search configuration + // + // This member is required. + VectorSearchConfiguration *KnowledgeBaseVectorSearchConfiguration + + noSmithyDocumentSerde +} + +// Result item returned from a knowledge base retrieval. +type KnowledgeBaseRetrievalResult struct { + + // Content of a retrieval result. + // + // This member is required. + Content *RetrievalResultContent + + // The source location of a retrieval result. + Location *RetrievalResultLocation + + // The relevance score of a result. + Score *float64 + + noSmithyDocumentSerde +} + +// Configurations for retrieval and generation for knowledge base. +type KnowledgeBaseRetrieveAndGenerateConfiguration struct { + + // Identifier of the KnowledgeBase + // + // This member is required. + KnowledgeBaseId *string + + // Arn of a Bedrock model. + // + // This member is required. + ModelArn *string + + noSmithyDocumentSerde +} + +// Knowledge base vector search configuration +type KnowledgeBaseVectorSearchConfiguration struct { + + // Top-K results to retrieve from knowledge base. + // + // This member is required. + NumberOfResults *int32 + + noSmithyDocumentSerde +} + +// Trace Part which contains information used to call Invoke Model +type ModelInvocationInput struct { + + // Configurations for controlling the inference response of an InvokeAgent API call + InferenceConfiguration *InferenceConfiguration + + // ARN of a Lambda. + OverrideLambda *string + + // indicates if agent uses default prompt or overriden prompt + ParserMode CreationMode + + // indicates if agent uses default prompt or overriden prompt + PromptCreationMode CreationMode + + // Prompt Message + Text *string + + // Identifier for trace + TraceId *string + + // types of prompts + Type PromptType + + noSmithyDocumentSerde +} + +// Trace Part which contains output details for action group or knowledge base or +// final response +type Observation struct { + + // output from lambda used in action group + ActionGroupInvocationOutput *ActionGroupInvocationOutput + + // Agent finish output + FinalResponse *FinalResponse + + // Input to lambda used in action group + KnowledgeBaseLookupOutput *KnowledgeBaseLookupOutput + + // Observation information if there were reprompts + RepromptResponse *RepromptResponse + + // Identifier for trace + TraceId *string + + // types of observations + Type Type + + noSmithyDocumentSerde +} + +// Trace contains intermidate response during orchestration +// +// The following types satisfy this interface: +// +// OrchestrationTraceMemberInvocationInput +// OrchestrationTraceMemberModelInvocationInput +// OrchestrationTraceMemberObservation +// OrchestrationTraceMemberRationale +type OrchestrationTrace interface { + isOrchestrationTrace() +} + +// Trace Part which contains input details for action group or knowledge base +type OrchestrationTraceMemberInvocationInput struct { + Value InvocationInput + + noSmithyDocumentSerde +} + +func (*OrchestrationTraceMemberInvocationInput) isOrchestrationTrace() {} + +// Trace Part which contains information used to call Invoke Model +type OrchestrationTraceMemberModelInvocationInput struct { + Value ModelInvocationInput + + noSmithyDocumentSerde +} + +func (*OrchestrationTraceMemberModelInvocationInput) isOrchestrationTrace() {} + +// Trace Part which contains output details for action group or knowledge base or +// final response +type OrchestrationTraceMemberObservation struct { + Value Observation + + noSmithyDocumentSerde +} + +func (*OrchestrationTraceMemberObservation) isOrchestrationTrace() {} + +// Trace Part which contains information related to reasoning +type OrchestrationTraceMemberRationale struct { + Value Rationale + + noSmithyDocumentSerde +} + +func (*OrchestrationTraceMemberRationale) isOrchestrationTrace() {} + +// parameters included in action group invocation +type Parameter struct { + + // Name of parameter + Name *string + + // Type of parameter + Type *string + + // Value of parameter + Value *string + + noSmithyDocumentSerde +} + +// Base 64 endoded byte response +type PayloadPart struct { + + // Citations associated with final agent response + Attribution *Attribution + + // PartBody of the payload in bytes + Bytes []byte + + noSmithyDocumentSerde +} + +// Trace Part which contains information related to postprocessing +type PostProcessingModelInvocationOutput struct { + + // Trace Part which contains information if preprocessing was successful + ParsedResponse *PostProcessingParsedResponse + + // Identifier for trace + TraceId *string + + noSmithyDocumentSerde +} + +// Trace Part which contains information if preprocessing was successful +type PostProcessingParsedResponse struct { + + // Agent Trace Output String + Text *string + + noSmithyDocumentSerde +} + +// Trace Part which contains information related to post processing step +// +// The following types satisfy this interface: +// +// PostProcessingTraceMemberModelInvocationInput +// PostProcessingTraceMemberModelInvocationOutput +type PostProcessingTrace interface { + isPostProcessingTrace() +} + +// Trace Part which contains information used to call Invoke Model +type PostProcessingTraceMemberModelInvocationInput struct { + Value ModelInvocationInput + + noSmithyDocumentSerde +} + +func (*PostProcessingTraceMemberModelInvocationInput) isPostProcessingTrace() {} + +// Trace Part which contains information related to postprocessing +type PostProcessingTraceMemberModelInvocationOutput struct { + Value PostProcessingModelInvocationOutput + + noSmithyDocumentSerde +} + +func (*PostProcessingTraceMemberModelInvocationOutput) isPostProcessingTrace() {} + +// Trace Part which contains information related to preprocessing +type PreProcessingModelInvocationOutput struct { + + // Trace Part which contains information if preprocessing was successful + ParsedResponse *PreProcessingParsedResponse + + // Identifier for trace + TraceId *string + + noSmithyDocumentSerde +} + +// Trace Part which contains information if preprocessing was successful +type PreProcessingParsedResponse struct { + + // Boolean value + IsValid *bool + + // Agent Trace Rationale String + Rationale *string + + noSmithyDocumentSerde +} + +// Trace Part which contains information related to preprocessing step +// +// The following types satisfy this interface: +// +// PreProcessingTraceMemberModelInvocationInput +// PreProcessingTraceMemberModelInvocationOutput +type PreProcessingTrace interface { + isPreProcessingTrace() +} + +// Trace Part which contains information used to call Invoke Model +type PreProcessingTraceMemberModelInvocationInput struct { + Value ModelInvocationInput + + noSmithyDocumentSerde +} + +func (*PreProcessingTraceMemberModelInvocationInput) isPreProcessingTrace() {} + +// Trace Part which contains information related to preprocessing +type PreProcessingTraceMemberModelInvocationOutput struct { + Value PreProcessingModelInvocationOutput + + noSmithyDocumentSerde +} + +func (*PreProcessingTraceMemberModelInvocationOutput) isPreProcessingTrace() {} + +// Trace Part which contains information related to reasoning +type Rationale struct { + + // Agent Trace Rationale String + Text *string + + // Identifier for trace + TraceId *string + + noSmithyDocumentSerde +} + +// Observation information if there were reprompts +type RepromptResponse struct { + + // Parsing error source + Source Source + + // Reprompt response text + Text *string + + noSmithyDocumentSerde +} + +// Request Body Content Map +type RequestBody struct { + + // Content type paramter map + Content map[string][]Parameter + + noSmithyDocumentSerde +} + +// Response body of is a stream +// +// The following types satisfy this interface: +// +// ResponseStreamMemberChunk +// ResponseStreamMemberTrace +type ResponseStream interface { + isResponseStream() +} + +// Base 64 endoded byte response +type ResponseStreamMemberChunk struct { + Value PayloadPart + + noSmithyDocumentSerde +} + +func (*ResponseStreamMemberChunk) isResponseStream() {} + +// Trace Part which contains intermidate response for customer +type ResponseStreamMemberTrace struct { + Value TracePart + + noSmithyDocumentSerde +} + +func (*ResponseStreamMemberTrace) isResponseStream() {} + +// Content of a retrieval result. +type RetrievalResultContent struct { + + // Content of a retrieval result in text + // + // This member is required. + Text *string + + noSmithyDocumentSerde +} + +// The source location of a retrieval result. +type RetrievalResultLocation struct { + + // The location type of a retrieval result. + // + // This member is required. + Type RetrievalResultLocationType + + // The S3 location of a retrieval result. + S3Location *RetrievalResultS3Location + + noSmithyDocumentSerde +} + +// The S3 location of a retrieval result. +type RetrievalResultS3Location struct { + + // URI of S3 location + Uri *string + + noSmithyDocumentSerde +} + +// Configures the retrieval and generation for the session. +type RetrieveAndGenerateConfiguration struct { + + // The type of RetrieveAndGenerate. + // + // This member is required. + Type RetrieveAndGenerateType + + // Configurations for retrieval and generation for knowledge base. + KnowledgeBaseConfiguration *KnowledgeBaseRetrieveAndGenerateConfiguration + + noSmithyDocumentSerde +} + +// Customer input of the turn +type RetrieveAndGenerateInput struct { + + // Customer input of the turn in text + // + // This member is required. + Text *string + + noSmithyDocumentSerde +} + +// Service response of the turn +type RetrieveAndGenerateOutput struct { + + // Service response of the turn in text + // + // This member is required. + Text *string + + noSmithyDocumentSerde +} + +// Configures common parameters of the session. +type RetrieveAndGenerateSessionConfiguration struct { + + // The KMS key arn to encrypt the customer data of the session. + // + // This member is required. + KmsKeyArn *string + + noSmithyDocumentSerde +} + +// Retrieved reference +type RetrievedReference struct { + + // Content of a retrieval result. + Content *RetrievalResultContent + + // The source location of a retrieval result. + Location *RetrievalResultLocation + + noSmithyDocumentSerde +} + +// Session state provided +type SessionState struct { + + // Prompt Session Attributes + PromptSessionAttributes map[string]string + + // Session Attributes + SessionAttributes map[string]string + + noSmithyDocumentSerde +} + +// Span of text +type Span struct { + + // End of span + End *int32 + + // Start of span + Start *int32 + + noSmithyDocumentSerde +} + +// Text response part +type TextResponsePart struct { + + // Span of text + Span *Span + + // Response part in text + Text *string + + noSmithyDocumentSerde +} + +// Trace contains intermidate response for customer +// +// The following types satisfy this interface: +// +// TraceMemberFailureTrace +// TraceMemberOrchestrationTrace +// TraceMemberPostProcessingTrace +// TraceMemberPreProcessingTrace +type Trace interface { + isTrace() +} + +// Trace Part which is emitted when agent trace could not be generated +type TraceMemberFailureTrace struct { + Value FailureTrace + + noSmithyDocumentSerde +} + +func (*TraceMemberFailureTrace) isTrace() {} + +// Trace contains intermidate response during orchestration +type TraceMemberOrchestrationTrace struct { + Value OrchestrationTrace + + noSmithyDocumentSerde +} + +func (*TraceMemberOrchestrationTrace) isTrace() {} + +// Trace Part which contains information related to post processing step +type TraceMemberPostProcessingTrace struct { + Value PostProcessingTrace + + noSmithyDocumentSerde +} + +func (*TraceMemberPostProcessingTrace) isTrace() {} + +// Trace Part which contains information related to preprocessing step +type TraceMemberPreProcessingTrace struct { + Value PreProcessingTrace + + noSmithyDocumentSerde +} + +func (*TraceMemberPreProcessingTrace) isTrace() {} + +// Trace Part which contains intermidate response for customer +type TracePart struct { + + // Identifier of the agent alias. + AgentAliasId *string + + // Identifier of the agent. + AgentId *string + + // Identifier of the session. + SessionId *string + + // Trace contains intermidate response for customer + Trace Trace + + 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) isOrchestrationTrace() {} +func (*UnknownUnionMember) isPostProcessingTrace() {} +func (*UnknownUnionMember) isPreProcessingTrace() {} +func (*UnknownUnionMember) isResponseStream() {} +func (*UnknownUnionMember) isTrace() {} diff --git a/service/bedrockagentruntime/types/types_exported_test.go b/service/bedrockagentruntime/types/types_exported_test.go new file mode 100644 index 00000000000..71fe709aa37 --- /dev/null +++ b/service/bedrockagentruntime/types/types_exported_test.go @@ -0,0 +1,134 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" +) + +func ExampleOrchestrationTrace_outputUsage() { + var union types.OrchestrationTrace + // type switches can be used to check the union value + switch v := union.(type) { + case *types.OrchestrationTraceMemberInvocationInput: + _ = v.Value // Value is types.InvocationInput + + case *types.OrchestrationTraceMemberModelInvocationInput: + _ = v.Value // Value is types.ModelInvocationInput + + case *types.OrchestrationTraceMemberObservation: + _ = v.Value // Value is types.Observation + + case *types.OrchestrationTraceMemberRationale: + _ = v.Value // Value is types.Rationale + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.InvocationInput +var _ *types.ModelInvocationInput +var _ *types.Rationale +var _ *types.Observation + +func ExamplePostProcessingTrace_outputUsage() { + var union types.PostProcessingTrace + // type switches can be used to check the union value + switch v := union.(type) { + case *types.PostProcessingTraceMemberModelInvocationInput: + _ = v.Value // Value is types.ModelInvocationInput + + case *types.PostProcessingTraceMemberModelInvocationOutput: + _ = v.Value // Value is types.PostProcessingModelInvocationOutput + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ModelInvocationInput +var _ *types.PostProcessingModelInvocationOutput + +func ExamplePreProcessingTrace_outputUsage() { + var union types.PreProcessingTrace + // type switches can be used to check the union value + switch v := union.(type) { + case *types.PreProcessingTraceMemberModelInvocationInput: + _ = v.Value // Value is types.ModelInvocationInput + + case *types.PreProcessingTraceMemberModelInvocationOutput: + _ = v.Value // Value is types.PreProcessingModelInvocationOutput + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ModelInvocationInput +var _ *types.PreProcessingModelInvocationOutput + +func ExampleResponseStream_outputUsage() { + var union types.ResponseStream + // type switches can be used to check the union value + switch v := union.(type) { + case *types.ResponseStreamMemberChunk: + _ = v.Value // Value is types.PayloadPart + + case *types.ResponseStreamMemberTrace: + _ = v.Value // Value is types.TracePart + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.PayloadPart +var _ *types.TracePart + +func ExampleTrace_outputUsage() { + var union types.Trace + // type switches can be used to check the union value + switch v := union.(type) { + case *types.TraceMemberFailureTrace: + _ = v.Value // Value is types.FailureTrace + + case *types.TraceMemberOrchestrationTrace: + _ = v.Value // Value is types.OrchestrationTrace + + case *types.TraceMemberPostProcessingTrace: + _ = v.Value // Value is types.PostProcessingTrace + + case *types.TraceMemberPreProcessingTrace: + _ = v.Value // Value is types.PreProcessingTrace + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.FailureTrace +var _ types.PreProcessingTrace +var _ types.PostProcessingTrace +var _ types.OrchestrationTrace diff --git a/service/bedrockagentruntime/validators.go b/service/bedrockagentruntime/validators.go new file mode 100644 index 00000000000..bebb0967d31 --- /dev/null +++ b/service/bedrockagentruntime/validators.go @@ -0,0 +1,280 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package bedrockagentruntime + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/bedrockagentruntime/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpInvokeAgent struct { +} + +func (*validateOpInvokeAgent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpInvokeAgent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*InvokeAgentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpInvokeAgentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpRetrieveAndGenerate struct { +} + +func (*validateOpRetrieveAndGenerate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpRetrieveAndGenerate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*RetrieveAndGenerateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpRetrieveAndGenerateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpRetrieve struct { +} + +func (*validateOpRetrieve) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpRetrieve) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*RetrieveInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpRetrieveInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpInvokeAgentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpInvokeAgent{}, middleware.After) +} + +func addOpRetrieveAndGenerateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpRetrieveAndGenerate{}, middleware.After) +} + +func addOpRetrieveValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpRetrieve{}, middleware.After) +} + +func validateKnowledgeBaseQuery(v *types.KnowledgeBaseQuery) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KnowledgeBaseQuery"} + if v.Text == nil { + invalidParams.Add(smithy.NewErrParamRequired("Text")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKnowledgeBaseRetrievalConfiguration(v *types.KnowledgeBaseRetrievalConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KnowledgeBaseRetrievalConfiguration"} + if v.VectorSearchConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("VectorSearchConfiguration")) + } else if v.VectorSearchConfiguration != nil { + if err := validateKnowledgeBaseVectorSearchConfiguration(v.VectorSearchConfiguration); err != nil { + invalidParams.AddNested("VectorSearchConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKnowledgeBaseRetrieveAndGenerateConfiguration(v *types.KnowledgeBaseRetrieveAndGenerateConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KnowledgeBaseRetrieveAndGenerateConfiguration"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.ModelArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ModelArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKnowledgeBaseVectorSearchConfiguration(v *types.KnowledgeBaseVectorSearchConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KnowledgeBaseVectorSearchConfiguration"} + if v.NumberOfResults == nil { + invalidParams.Add(smithy.NewErrParamRequired("NumberOfResults")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRetrieveAndGenerateConfiguration(v *types.RetrieveAndGenerateConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieveAndGenerateConfiguration"} + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.KnowledgeBaseConfiguration != nil { + if err := validateKnowledgeBaseRetrieveAndGenerateConfiguration(v.KnowledgeBaseConfiguration); err != nil { + invalidParams.AddNested("KnowledgeBaseConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRetrieveAndGenerateInput(v *types.RetrieveAndGenerateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieveAndGenerateInput"} + if v.Text == nil { + invalidParams.Add(smithy.NewErrParamRequired("Text")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRetrieveAndGenerateSessionConfiguration(v *types.RetrieveAndGenerateSessionConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieveAndGenerateSessionConfiguration"} + if v.KmsKeyArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("KmsKeyArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpInvokeAgentInput(v *InvokeAgentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "InvokeAgentInput"} + if v.AgentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentId")) + } + if v.AgentAliasId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AgentAliasId")) + } + if v.SessionId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SessionId")) + } + if v.InputText == nil { + invalidParams.Add(smithy.NewErrParamRequired("InputText")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpRetrieveAndGenerateInput(v *RetrieveAndGenerateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieveAndGenerateInput"} + if v.Input == nil { + invalidParams.Add(smithy.NewErrParamRequired("Input")) + } else if v.Input != nil { + if err := validateRetrieveAndGenerateInput(v.Input); err != nil { + invalidParams.AddNested("Input", err.(smithy.InvalidParamsError)) + } + } + if v.RetrieveAndGenerateConfiguration != nil { + if err := validateRetrieveAndGenerateConfiguration(v.RetrieveAndGenerateConfiguration); err != nil { + invalidParams.AddNested("RetrieveAndGenerateConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.SessionConfiguration != nil { + if err := validateRetrieveAndGenerateSessionConfiguration(v.SessionConfiguration); err != nil { + invalidParams.AddNested("SessionConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpRetrieveInput(v *RetrieveInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieveInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.RetrievalQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("RetrievalQuery")) + } else if v.RetrievalQuery != nil { + if err := validateKnowledgeBaseQuery(v.RetrievalQuery); err != nil { + invalidParams.AddNested("RetrievalQuery", err.(smithy.InvalidParamsError)) + } + } + if v.RetrievalConfiguration != nil { + if err := validateKnowledgeBaseRetrievalConfiguration(v.RetrievalConfiguration); err != nil { + invalidParams.AddNested("RetrievalConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/bedrockruntime/endpoints.go b/service/bedrockruntime/endpoints.go index 504676b3703..91afc6d87a2 100644 --- a/service/bedrockruntime/endpoints.go +++ b/service/bedrockruntime/endpoints.go @@ -366,7 +366,7 @@ func (r *resolver) ResolveEndpoint( } } if _UseFIPS == true { - if true == _PartitionResult.SupportsFIPS { + if _PartitionResult.SupportsFIPS == true { uriString := func() string { var out strings.Builder out.WriteString("https://bedrock-runtime-fips.") diff --git a/service/connect/api_op_AssociateAnalyticsDataSet.go b/service/connect/api_op_AssociateAnalyticsDataSet.go new file mode 100644 index 00000000000..1a1f3393384 --- /dev/null +++ b/service/connect/api_op_AssociateAnalyticsDataSet.go @@ -0,0 +1,159 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This API is in preview release for Amazon Connect and is subject to change. +// Associates the specified dataset for a Amazon Connect instance with the target +// account. You can associate only one dataset in a single call. +func (c *Client) AssociateAnalyticsDataSet(ctx context.Context, params *AssociateAnalyticsDataSetInput, optFns ...func(*Options)) (*AssociateAnalyticsDataSetOutput, error) { + if params == nil { + params = &AssociateAnalyticsDataSetInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AssociateAnalyticsDataSet", params, optFns, c.addOperationAssociateAnalyticsDataSetMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AssociateAnalyticsDataSetOutput) + out.ResultMetadata = metadata + return out, nil +} + +type AssociateAnalyticsDataSetInput struct { + + // The identifier of the dataset to associate with the target account. + // + // This member is required. + DataSetId *string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the target account. Use to associate a dataset to a different + // account than the one containing the Amazon Connect instance. If not specified, + // by default this value is the Amazon Web Services account that has the Amazon + // Connect instance. + TargetAccountId *string + + noSmithyDocumentSerde +} + +type AssociateAnalyticsDataSetOutput struct { + + // The identifier of the dataset that was associated. + DataSetId *string + + // The Amazon Resource Name (ARN) of the Resource Access Manager share. + ResourceShareArn *string + + // The Resource Access Manager share ID that is generated. + ResourceShareId *string + + // The identifier of the target account. + TargetAccountId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAssociateAnalyticsDataSetMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpAssociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAssociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateAnalyticsDataSet"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpAssociateAnalyticsDataSetValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateAnalyticsDataSet(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opAssociateAnalyticsDataSet(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "AssociateAnalyticsDataSet", + } +} diff --git a/service/connect/api_op_AssociateFlow.go b/service/connect/api_op_AssociateFlow.go new file mode 100644 index 00000000000..d49527a3e52 --- /dev/null +++ b/service/connect/api_op_AssociateFlow.go @@ -0,0 +1,149 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Associates a connect resource to a flow. +func (c *Client) AssociateFlow(ctx context.Context, params *AssociateFlowInput, optFns ...func(*Options)) (*AssociateFlowOutput, error) { + if params == nil { + params = &AssociateFlowInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AssociateFlow", params, optFns, c.addOperationAssociateFlowMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AssociateFlowOutput) + out.ResultMetadata = metadata + return out, nil +} + +type AssociateFlowInput struct { + + // The identifier of the flow. + // + // This member is required. + FlowId *string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the resource. + // + // This member is required. + ResourceId *string + + // A valid resource type. + // + // This member is required. + ResourceType types.FlowAssociationResourceType + + noSmithyDocumentSerde +} + +type AssociateFlowOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAssociateFlowMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpAssociateFlow{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAssociateFlow{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateFlow"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpAssociateFlowValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateFlow(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opAssociateFlow(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "AssociateFlow", + } +} diff --git a/service/connect/api_op_BatchAssociateAnalyticsDataSet.go b/service/connect/api_op_BatchAssociateAnalyticsDataSet.go new file mode 100644 index 00000000000..a4c705940b2 --- /dev/null +++ b/service/connect/api_op_BatchAssociateAnalyticsDataSet.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This API is in preview release for Amazon Connect and is subject to change. +// Associates a list of analytics datasets for a given Amazon Connect instance to a +// target account. You can associate multiple datasets in a single call. +func (c *Client) BatchAssociateAnalyticsDataSet(ctx context.Context, params *BatchAssociateAnalyticsDataSetInput, optFns ...func(*Options)) (*BatchAssociateAnalyticsDataSetOutput, error) { + if params == nil { + params = &BatchAssociateAnalyticsDataSetInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "BatchAssociateAnalyticsDataSet", params, optFns, c.addOperationBatchAssociateAnalyticsDataSetMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*BatchAssociateAnalyticsDataSetOutput) + out.ResultMetadata = metadata + return out, nil +} + +type BatchAssociateAnalyticsDataSetInput struct { + + // An array of dataset identifiers to associate. + // + // This member is required. + DataSetIds []string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the target account. Use to associate a dataset to a different + // account than the one containing the Amazon Connect instance. If not specified, + // by default this value is the Amazon Web Services account that has the Amazon + // Connect instance. + TargetAccountId *string + + noSmithyDocumentSerde +} + +type BatchAssociateAnalyticsDataSetOutput struct { + + // Information about associations that are successfully created: DataSetId , + // TargetAccountId , ResourceShareId , ResourceShareArn . + Created []types.AnalyticsDataAssociationResult + + // A list of errors for datasets that aren't successfully associated with the + // target account. + Errors []types.ErrorResult + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationBatchAssociateAnalyticsDataSetMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchAssociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchAssociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "BatchAssociateAnalyticsDataSet"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpBatchAssociateAnalyticsDataSetValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchAssociateAnalyticsDataSet(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opBatchAssociateAnalyticsDataSet(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "BatchAssociateAnalyticsDataSet", + } +} diff --git a/service/connect/api_op_BatchDisassociateAnalyticsDataSet.go b/service/connect/api_op_BatchDisassociateAnalyticsDataSet.go new file mode 100644 index 00000000000..f8ba1d3f8e5 --- /dev/null +++ b/service/connect/api_op_BatchDisassociateAnalyticsDataSet.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This API is in preview release for Amazon Connect and is subject to change. +// Removes a list of analytics datasets associated with a given Amazon Connect +// instance. You can disassociate multiple datasets in a single call. +func (c *Client) BatchDisassociateAnalyticsDataSet(ctx context.Context, params *BatchDisassociateAnalyticsDataSetInput, optFns ...func(*Options)) (*BatchDisassociateAnalyticsDataSetOutput, error) { + if params == nil { + params = &BatchDisassociateAnalyticsDataSetInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "BatchDisassociateAnalyticsDataSet", params, optFns, c.addOperationBatchDisassociateAnalyticsDataSetMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*BatchDisassociateAnalyticsDataSetOutput) + out.ResultMetadata = metadata + return out, nil +} + +type BatchDisassociateAnalyticsDataSetInput struct { + + // An array of associated dataset identifiers to remove. + // + // This member is required. + DataSetIds []string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the target account. Use to disassociate a dataset from a + // different account than the one containing the Amazon Connect instance. If not + // specified, by default this value is the Amazon Web Services account that has the + // Amazon Connect instance. + TargetAccountId *string + + noSmithyDocumentSerde +} + +type BatchDisassociateAnalyticsDataSetOutput struct { + + // An array of successfully disassociated dataset identifiers. + Deleted []string + + // A list of errors for any datasets not successfully removed. + Errors []types.ErrorResult + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationBatchDisassociateAnalyticsDataSetMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchDisassociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchDisassociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "BatchDisassociateAnalyticsDataSet"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpBatchDisassociateAnalyticsDataSetValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchDisassociateAnalyticsDataSet(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opBatchDisassociateAnalyticsDataSet(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "BatchDisassociateAnalyticsDataSet", + } +} diff --git a/service/connect/api_op_CreateUser.go b/service/connect/api_op_CreateUser.go index 9a1110cb89f..6c8f3f37b63 100644 --- a/service/connect/api_op_CreateUser.go +++ b/service/connect/api_op_CreateUser.go @@ -17,8 +17,7 @@ import ( // parameters are required in some situations. For example, Email is required if // you are using SAML for identity management. FirstName and LastName are required // if you are using Amazon Connect or SAML for identity management. For information -// about how to create user accounts using the Amazon Connect console, see Add -// Users (https://docs.aws.amazon.com/connect/latest/adminguide/user-management.html) +// about how to create users using the Amazon Connect admin website, see Add Users (https://docs.aws.amazon.com/connect/latest/adminguide/user-management.html) // in the Amazon Connect Administrator Guide. func (c *Client) CreateUser(ctx context.Context, params *CreateUserInput, optFns ...func(*Options)) (*CreateUserOutput, error) { if params == nil { diff --git a/service/connect/api_op_DescribeUser.go b/service/connect/api_op_DescribeUser.go index 64857f45267..5a6d42a2fb2 100644 --- a/service/connect/api_op_DescribeUser.go +++ b/service/connect/api_op_DescribeUser.go @@ -12,8 +12,8 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Describes the specified user account. You can find the instance ID in the -// Amazon Connect console (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) +// Describes the specified user. You can find the instance ID in the Amazon +// Connect console (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) // (it’s the final part of the ARN). The console does not display the user IDs. // Instead, list the users and note the IDs provided in the output. func (c *Client) DescribeUser(ctx context.Context, params *DescribeUserInput, optFns ...func(*Options)) (*DescribeUserOutput, error) { diff --git a/service/connect/api_op_DisassociateAnalyticsDataSet.go b/service/connect/api_op_DisassociateAnalyticsDataSet.go new file mode 100644 index 00000000000..f68ead3329e --- /dev/null +++ b/service/connect/api_op_DisassociateAnalyticsDataSet.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This API is in preview release for Amazon Connect and is subject to change. +// Removes the dataset ID associated with a given Amazon Connect instance. +func (c *Client) DisassociateAnalyticsDataSet(ctx context.Context, params *DisassociateAnalyticsDataSetInput, optFns ...func(*Options)) (*DisassociateAnalyticsDataSetOutput, error) { + if params == nil { + params = &DisassociateAnalyticsDataSetInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateAnalyticsDataSet", params, optFns, c.addOperationDisassociateAnalyticsDataSetMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateAnalyticsDataSetOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisassociateAnalyticsDataSetInput struct { + + // The identifier of the dataset to remove. + // + // This member is required. + DataSetId *string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the target account. Use to associate a dataset to a different + // account than the one containing the Amazon Connect instance. If not specified, + // by default this value is the Amazon Web Services account that has the Amazon + // Connect instance. + TargetAccountId *string + + noSmithyDocumentSerde +} + +type DisassociateAnalyticsDataSetOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateAnalyticsDataSetMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisassociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisassociateAnalyticsDataSet{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateAnalyticsDataSet"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDisassociateAnalyticsDataSetValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateAnalyticsDataSet(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDisassociateAnalyticsDataSet(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DisassociateAnalyticsDataSet", + } +} diff --git a/service/connect/api_op_DisassociateFlow.go b/service/connect/api_op_DisassociateFlow.go new file mode 100644 index 00000000000..317a1bda31c --- /dev/null +++ b/service/connect/api_op_DisassociateFlow.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disassociates a connect resource from a flow. +func (c *Client) DisassociateFlow(ctx context.Context, params *DisassociateFlowInput, optFns ...func(*Options)) (*DisassociateFlowOutput, error) { + if params == nil { + params = &DisassociateFlowInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateFlow", params, optFns, c.addOperationDisassociateFlowMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateFlowOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisassociateFlowInput struct { + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the resource. + // + // This member is required. + ResourceId *string + + // A valid resource type. + // + // This member is required. + ResourceType types.FlowAssociationResourceType + + noSmithyDocumentSerde +} + +type DisassociateFlowOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateFlowMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisassociateFlow{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisassociateFlow{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateFlow"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDisassociateFlowValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateFlow(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDisassociateFlow(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DisassociateFlow", + } +} diff --git a/service/connect/api_op_GetFlowAssociation.go b/service/connect/api_op_GetFlowAssociation.go new file mode 100644 index 00000000000..65d41360e63 --- /dev/null +++ b/service/connect/api_op_GetFlowAssociation.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the flow associated for a given resource. +func (c *Client) GetFlowAssociation(ctx context.Context, params *GetFlowAssociationInput, optFns ...func(*Options)) (*GetFlowAssociationOutput, error) { + if params == nil { + params = &GetFlowAssociationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetFlowAssociation", params, optFns, c.addOperationGetFlowAssociationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetFlowAssociationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetFlowAssociationInput struct { + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the resource. + // + // This member is required. + ResourceId *string + + // A valid resource type. + // + // This member is required. + ResourceType types.FlowAssociationResourceType + + noSmithyDocumentSerde +} + +type GetFlowAssociationOutput struct { + + // The identifier of the flow. + FlowId *string + + // The identifier of the resource. + ResourceId *string + + // A valid resource type. + ResourceType types.FlowAssociationResourceType + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetFlowAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetFlowAssociation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetFlowAssociation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetFlowAssociation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetFlowAssociationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetFlowAssociation(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetFlowAssociation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetFlowAssociation", + } +} diff --git a/service/connect/api_op_GetMetricDataV2.go b/service/connect/api_op_GetMetricDataV2.go index c75cbffa644..491d52a9780 100644 --- a/service/connect/api_op_GetMetricDataV2.go +++ b/service/connect/api_op_GetMetricDataV2.go @@ -62,7 +62,8 @@ type GetMetricDataV2Input struct { // Valid filter keys: QUEUE | ROUTING_PROFILE | AGENT | CHANNEL | // AGENT_HIERARCHY_LEVEL_ONE | AGENT_HIERARCHY_LEVEL_TWO | // AGENT_HIERARCHY_LEVEL_THREE | AGENT_HIERARCHY_LEVEL_FOUR | - // AGENT_HIERARCHY_LEVEL_FIVE | FEATURE + // AGENT_HIERARCHY_LEVEL_FIVE | FEATURE | + // contact/segmentAttributes/connect:Subtype // - Filter values: A maximum of 100 filter values are supported in a single // request. VOICE, CHAT, and TASK are valid filterValue for the CHANNEL filter // key. They do not count towards limitation of 100 filter values. For example, a @@ -70,7 +71,9 @@ type GetMetricDataV2Input struct { // profiles for a total of 100 filter values, along with 3 channel filters. // contact_lens_conversational_analytics is a valid filterValue for the FEATURE // filter key. It is available only to contacts analyzed by Contact Lens - // conversational analytics. + // conversational analytics. connect:Chat , connect:SMS , connect:Telephony , and + // connect:WebRTC are valid filterValue examples (not exhaustive) for the + // contact/segmentAttributes/connect:Subtype filter key. // // This member is required. Filters []types.FilterV2 @@ -80,117 +83,175 @@ type GetMetricDataV2Input struct { // each metric, see Historical metrics definitions (https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html) // in the Amazon Connect Administrator's Guide. ABANDONMENT_RATE Unit: Percent // Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent - // Hierarchy AGENT_ADHERENT_TIME This metric is available only in Amazon Web - // Services Regions where Forecasting, capacity planning, and scheduling (https://docs.aws.amazon.com/connect/latest/adminguide/regions.html#optimization_region) + // Hierarchy, Feature, contact/segmentAttributes/connect:Subtype + // AGENT_ADHERENT_TIME This metric is available only in Amazon Web Services Regions + // where Forecasting, capacity planning, and scheduling (https://docs.aws.amazon.com/connect/latest/adminguide/regions.html#optimization_region) // is available. Unit: Seconds Valid groupings and filters: Queue, Channel, Routing - // Profile, Agent, Agent Hierarchy AGENT_NON_RESPONSE Unit: Count Valid groupings + // Profile, Agent, Agent Hierarchy AGENT_ANSWER_RATE Unit: Percent Valid groupings // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // AGENT_NON_RESPONSE_WITHOUT_CUSTOMER_ABANDONS Unit: Count Valid groupings and - // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy Data for this - // metric is available starting from October 1, 2023 0:00:00 GMT. AGENT_OCCUPANCY - // Unit: Percentage Valid groupings and filters: Routing Profile, Agent, Agent - // Hierarchy AGENT_SCHEDULE_ADHERENCE This metric is available only in Amazon Web - // Services Regions where Forecasting, capacity planning, and scheduling (https://docs.aws.amazon.com/connect/latest/adminguide/regions.html#optimization_region) + // AGENT_NON_ADHERENT_TIME Unit: Seconds Valid groupings and filters: Queue, + // Channel, Routing Profile, Agent, Agent Hierarchy AGENT_NON_RESPONSE Unit: Count + // Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent + // Hierarchy AGENT_NON_RESPONSE_WITHOUT_CUSTOMER_ABANDONS Unit: Count Valid + // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // Data for this metric is available starting from October 1, 2023 0:00:00 GMT. + // AGENT_OCCUPANCY Unit: Percentage Valid groupings and filters: Routing Profile, + // Agent, Agent Hierarchy AGENT_SCHEDULE_ADHERENCE This metric is available only in + // Amazon Web Services Regions where Forecasting, capacity planning, and scheduling (https://docs.aws.amazon.com/connect/latest/adminguide/regions.html#optimization_region) // is available. Unit: Percent Valid groupings and filters: Queue, Channel, Routing // Profile, Agent, Agent Hierarchy AGENT_SCHEDULED_TIME This metric is available // only in Amazon Web Services Regions where Forecasting, capacity planning, and // scheduling (https://docs.aws.amazon.com/connect/latest/adminguide/regions.html#optimization_region) // is available. Unit: Seconds Valid groupings and filters: Queue, Channel, Routing // Profile, Agent, Agent Hierarchy AVG_ABANDON_TIME Unit: Seconds Valid groupings - // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // AVG_AFTER_CONTACT_WORK_TIME Unit: Seconds Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy, Feature Feature is a valid - // filter but not a valid grouping. AVG_AGENT_CONNECTING_TIME Unit: Seconds Valid - // metric filter key: INITIATION_METHOD . For now, this metric only supports the - // following as INITIATION_METHOD : INBOUND | OUTBOUND | CALLBACK | API Valid - // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // The Negate key in Metric Level Filters is not applicable for this metric. - // AVG_CONTACT_DURATION Unit: Seconds Valid groupings and filters: Queue, Channel, - // Routing Profile, Agent, Agent Hierarchy, Feature Feature is a valid filter but - // not a valid grouping. AVG_CONVERSATION_DURATION Unit: Seconds Valid groupings - // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, Feature, + // contact/segmentAttributes/connect:Subtype AVG_AFTER_CONTACT_WORK_TIME Unit: + // Seconds Valid metric filter key: INITIATION_METHOD Valid groupings and filters: + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy, Feature, + // contact/segmentAttributes/connect:Subtype Feature is a valid filter but not a + // valid grouping. AVG_AGENT_CONNECTING_TIME Unit: Seconds Valid metric filter key: + // INITIATION_METHOD . For now, this metric only supports the following as + // INITIATION_METHOD : INBOUND | OUTBOUND | CALLBACK | API Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy The Negate key + // in Metric Level Filters is not applicable for this metric. AVG_CONTACT_DURATION + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, Feature, contact/segmentAttributes/connect:Subtype + // Feature is a valid filter but not a valid grouping. AVG_CONVERSATION_DURATION + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, Feature, contact/segmentAttributes/connect:Subtype // AVG_GREETING_TIME_AGENT This metric is available only for contacts analyzed by // Contact Lens conversational analytics. Unit: Seconds Valid groupings and - // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy AVG_HANDLE_TIME - // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, - // Agent, Agent Hierarchy, Feature Feature is a valid filter but not a valid - // grouping. AVG_HOLD_TIME Unit: Seconds Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy, Feature Feature is a valid - // filter but not a valid grouping. AVG_HOLD_TIME_ALL_CONTACTS Unit: Seconds Valid - // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // AVG_HOLDS Unit: Count Valid groupings and filters: Queue, Channel, Routing - // Profile, Agent, Agent Hierarchy, Feature Feature is a valid filter but not a + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype AVG_HANDLE_TIME Unit: Seconds Valid + // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // Feature, contact/segmentAttributes/connect:Subtype Feature is a valid filter but + // not a valid grouping. AVG_HOLD_TIME Unit: Seconds Valid groupings and filters: + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy, Feature, + // contact/segmentAttributes/connect:Subtype Feature is a valid filter but not a + // valid grouping. AVG_HOLD_TIME_ALL_CONTACTS Unit: Seconds Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype AVG_HOLDS Unit: Count Valid groupings + // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, Feature, + // contact/segmentAttributes/connect:Subtype Feature is a valid filter but not a // valid grouping. AVG_INTERACTION_AND_HOLD_TIME Unit: Seconds Valid groupings and - // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // AVG_INTERACTION_TIME Unit: Seconds Valid groupings and filters: Queue, Channel, - // Routing Profile, Feature Feature is a valid filter but not a valid grouping. - // AVG_INTERRUPTIONS_AGENT This metric is available only for contacts analyzed by - // Contact Lens conversational analytics. Unit: Count Valid groupings and filters: - // Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype AVG_INTERACTION_TIME Unit: Seconds + // Valid metric filter key: INITIATION_METHOD Valid groupings and filters: Queue, + // Channel, Routing Profile, Feature, contact/segmentAttributes/connect:Subtype + // Feature is a valid filter but not a valid grouping. AVG_INTERRUPTIONS_AGENT This + // metric is available only for contacts analyzed by Contact Lens conversational + // analytics. Unit: Count Valid groupings and filters: Queue, Channel, Routing + // Profile, Agent, Agent Hierarchy, contact/segmentAttributes/connect:Subtype // AVG_INTERRUPTION_TIME_AGENT This metric is available only for contacts analyzed // by Contact Lens conversational analytics. Unit: Seconds Valid groupings and - // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // AVG_NON_TALK_TIME This metric is available only for contacts analyzed by Contact - // Lens conversational analytics. Unit: Seconds Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy AVG_QUEUE_ANSWER_TIME Unit: - // Seconds Valid groupings and filters: Queue, Channel, Routing Profile, Feature - // Feature is a valid filter but not a valid grouping. AVG_RESOLUTION_TIME Unit: - // Seconds Valid groupings and filters: Queue, Channel, Routing Profile - // AVG_TALK_TIME This metric is available only for contacts analyzed by Contact - // Lens conversational analytics. Unit: Seconds Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy AVG_TALK_TIME_AGENT This metric - // is available only for contacts analyzed by Contact Lens conversational - // analytics. Unit: Seconds Valid groupings and filters: Queue, Channel, Routing - // Profile, Agent, Agent Hierarchy AVG_TALK_TIME_CUSTOMER This metric is available + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype AVG_NON_TALK_TIME This metric is + // available only for contacts analyzed by Contact Lens conversational analytics. + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, contact/segmentAttributes/connect:Subtype + // AVG_QUEUE_ANSWER_TIME Unit: Seconds Valid groupings and filters: Queue, Channel, + // Routing Profile, Feature, contact/segmentAttributes/connect:Subtype Feature is a + // valid filter but not a valid grouping. AVG_RESOLUTION_TIME Unit: Seconds Valid + // groupings and filters: Queue, Channel, Routing Profile, + // contact/segmentAttributes/connect:Subtype AVG_TALK_TIME This metric is available // only for contacts analyzed by Contact Lens conversational analytics. Unit: // Seconds Valid groupings and filters: Queue, Channel, Routing Profile, Agent, - // Agent Hierarchy CONTACTS_ABANDONED Unit: Count Valid groupings and filters: - // Queue, Channel, Routing Profile, Agent, Agent Hierarchy CONTACTS_CREATED Unit: - // Count Valid metric filter key: INITIATION_METHOD Valid groupings and filters: - // Queue, Channel, Routing Profile, Feature Feature is a valid filter but not a - // valid grouping. CONTACTS_HANDLED Unit: Count Valid metric filter key: - // INITIATION_METHOD , DISCONNECT_REASON Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy, Feature Feature is a valid - // filter but not a valid grouping. CONTACTS_HOLD_ABANDONS Unit: Count Valid - // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy - // CONTACTS_QUEUED Unit: Count Valid groupings and filters: Queue, Channel, Routing - // Profile, Agent, Agent Hierarchy CONTACTS_RESOLVED_IN_X Unit: Count Valid - // groupings and filters: Queue, Channel, Routing Profile Threshold: For + // Agent Hierarchy, contact/segmentAttributes/connect:Subtype AVG_TALK_TIME_AGENT + // This metric is available only for contacts analyzed by Contact Lens + // conversational analytics. Unit: Seconds Valid groupings and filters: Queue, + // Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype AVG_TALK_TIME_CUSTOMER This metric is + // available only for contacts analyzed by Contact Lens conversational analytics. + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, contact/segmentAttributes/connect:Subtype + // CONTACTS_ABANDONED Unit: Count Valid groupings and filters: Queue, Channel, + // Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype CONTACTS_CREATED Unit: Count Valid + // metric filter key: INITIATION_METHOD Valid groupings and filters: Queue, + // Channel, Routing Profile, Feature, contact/segmentAttributes/connect:Subtype + // Feature is a valid filter but not a valid grouping. CONTACTS_HANDLED Unit: Count + // Valid metric filter key: INITIATION_METHOD , DISCONNECT_REASON Valid groupings + // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, Feature, + // contact/segmentAttributes/connect:Subtype Feature is a valid filter but not a + // valid grouping. CONTACTS_HOLD_ABANDONS Unit: Count Valid groupings and filters: + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype CONTACTS_ON_HOLD_AGENT_DISCONNECT + // Unit: Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, + // Agent Hierarchy CONTACTS_ON_HOLD_CUSTOMER_DISCONNECT Unit: Count Valid groupings + // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // CONTACTS_PUT_ON_HOLD Unit: Count Valid groupings and filters: Queue, Channel, + // Routing Profile, Agent, Agent Hierarchy CONTACTS_TRANSFERRED_OUT_EXTERNAL Unit: + // Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent + // Hierarchy CONTACTS_TRANSFERRED_OUT_INTERNAL Unit: Percent Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy CONTACTS_QUEUED + // Unit: Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, + // Agent Hierarchy, contact/segmentAttributes/connect:Subtype + // CONTACTS_RESOLVED_IN_X Unit: Count Valid groupings and filters: Queue, Channel, + // Routing Profile, contact/segmentAttributes/connect:Subtype Threshold: For // ThresholdValue enter any whole number from 1 to 604800 (inclusive), in seconds. // For Comparison , you must enter LT (for "Less than"). CONTACTS_TRANSFERRED_OUT // Unit: Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, - // Agent Hierarchy, Feature Feature is a valid filter but not a valid grouping. - // CONTACTS_TRANSFERRED_OUT_BY_AGENT Unit: Count Valid groupings and filters: - // Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // Agent Hierarchy, Feature, contact/segmentAttributes/connect:Subtype Feature is a + // valid filter but not a valid grouping. CONTACTS_TRANSFERRED_OUT_BY_AGENT Unit: + // Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent + // Hierarchy, contact/segmentAttributes/connect:Subtype // CONTACTS_TRANSFERRED_OUT_FROM_QUEUE Unit: Count Valid groupings and filters: - // Queue, Channel, Routing Profile, Agent, Agent Hierarchy MAX_QUEUED_TIME Unit: - // Seconds Valid groupings and filters: Queue, Channel, Routing Profile, Agent, - // Agent Hierarchy PERCENT_NON_TALK_TIME This metric is available only for contacts - // analyzed by Contact Lens conversational analytics. Unit: Percentage Valid - // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype MAX_QUEUED_TIME Unit: Seconds Valid + // groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype PERCENT_NON_TALK_TIME This metric is + // available only for contacts analyzed by Contact Lens conversational analytics. + // Unit: Percentage Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, contact/segmentAttributes/connect:Subtype // PERCENT_TALK_TIME This metric is available only for contacts analyzed by Contact // Lens conversational analytics. Unit: Percentage Valid groupings and filters: - // Queue, Channel, Routing Profile, Agent, Agent Hierarchy PERCENT_TALK_TIME_AGENT - // This metric is available only for contacts analyzed by Contact Lens - // conversational analytics. Unit: Percentage Valid groupings and filters: Queue, - // Channel, Routing Profile, Agent, Agent Hierarchy PERCENT_TALK_TIME_CUSTOMER This - // metric is available only for contacts analyzed by Contact Lens conversational - // analytics. Unit: Percentage Valid groupings and filters: Queue, Channel, Routing - // Profile, Agent, Agent Hierarchy SERVICE_LEVEL You can include up to 20 + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype PERCENT_TALK_TIME_AGENT This metric is + // available only for contacts analyzed by Contact Lens conversational analytics. + // Unit: Percentage Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy, contact/segmentAttributes/connect:Subtype + // PERCENT_TALK_TIME_CUSTOMER This metric is available only for contacts analyzed + // by Contact Lens conversational analytics. Unit: Percentage Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy, + // contact/segmentAttributes/connect:Subtype SERVICE_LEVEL You can include up to 20 // SERVICE_LEVEL metrics in a request. Unit: Percent Valid groupings and filters: // Queue, Channel, Routing Profile Threshold: For ThresholdValue , enter any whole // number from 1 to 604800 (inclusive), in seconds. For Comparison , you must enter - // LT (for "Less than"). SUM_CONTACTS_ANSWERED_IN_X Unit: Count Valid groupings and - // filters: Queue, Channel, Routing Profile Threshold: For ThresholdValue , enter - // any whole number from 1 to 604800 (inclusive), in seconds. For Comparison , you - // must enter LT (for "Less than"). SUM_CONTACTS_ABANDONED_IN_X Unit: Count Valid - // groupings and filters: Queue, Channel, Routing Profile Threshold: For - // ThresholdValue , enter any whole number from 1 to 604800 (inclusive), in + // LT (for "Less than"). SUM_AFTER_CONTACT_WORK_TIME Unit: Seconds Valid groupings + // and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // SUM_CONNECTING_TIME_AGENT Unit: Seconds Valid metric filter key: + // INITIATION_METHOD . This metric only supports the following filter keys as + // INITIATION_METHOD : INBOUND | OUTBOUND | CALLBACK | API Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy The Negate key + // in Metric Level Filters is not applicable for this metric. SUM_CONTACT_FLOW_TIME + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy SUM_CONTACT_TIME_AGENT Unit: Seconds Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // SUM_CONTACTS_ANSWERED_IN_X Unit: Count Valid groupings and filters: Queue, + // Channel, Routing Profile, contact/segmentAttributes/connect:Subtype Threshold: + // For ThresholdValue , enter any whole number from 1 to 604800 (inclusive), in + // seconds. For Comparison , you must enter LT (for "Less than"). + // SUM_CONTACTS_ABANDONED_IN_X Unit: Count Valid groupings and filters: Queue, + // Channel, Routing Profile, contact/segmentAttributes/connect:Subtype Threshold: + // For ThresholdValue , enter any whole number from 1 to 604800 (inclusive), in // seconds. For Comparison , you must enter LT (for "Less than"). // SUM_CONTACTS_DISCONNECTED Valid metric filter key: DISCONNECT_REASON Unit: - // Count Valid groupings and filters: Queue, Channel, Routing Profile + // Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent + // Hierarchy, contact/segmentAttributes/connect:Subtype SUM_ERROR_STATUS_TIME_AGENT + // Unit: Seconds Valid groupings and filters: Queue, Channel, Routing Profile, + // Agent, Agent Hierarchy SUM_HANDLE_TIME Unit: Seconds Valid groupings and + // filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy SUM_HOLD_TIME + // Unit: Count Valid groupings and filters: Queue, Channel, Routing Profile, Agent, + // Agent Hierarchy SUM_IDLE_TIME_AGENT Unit: Seconds Valid groupings and filters: + // Routing Profile, Agent, Agent Hierarchy SUM_INTERACTION_AND_HOLD_TIME Unit: + // Seconds Valid groupings and filters: Queue, Channel, Routing Profile, Agent, + // Agent Hierarchy SUM_INTERACTION_TIME Unit: Seconds Valid groupings and filters: + // Queue, Channel, Routing Profile, Agent, Agent Hierarchy + // SUM_NON_PRODUCTIVE_TIME_AGENT Unit: Seconds Valid groupings and filters: Routing + // Profile, Agent, Agent Hierarchy SUM_ONLINE_TIME_AGENT Unit: Seconds Valid + // groupings and filters: Routing Profile, Agent, Agent Hierarchy // SUM_RETRY_CALLBACK_ATTEMPTS Unit: Count Valid groupings and filters: Queue, - // Channel, Routing Profile + // Channel, Routing Profile, contact/segmentAttributes/connect:Subtype // // This member is required. Metrics []types.MetricV2 @@ -217,7 +278,7 @@ type GetMetricDataV2Input struct { // is returned. Valid grouping keys: QUEUE | ROUTING_PROFILE | AGENT | CHANNEL | // AGENT_HIERARCHY_LEVEL_ONE | AGENT_HIERARCHY_LEVEL_TWO | // AGENT_HIERARCHY_LEVEL_THREE | AGENT_HIERARCHY_LEVEL_FOUR | - // AGENT_HIERARCHY_LEVEL_FIVE + // AGENT_HIERARCHY_LEVEL_FIVE , contact/segmentAttributes/connect:Subtype Groupings []string // The interval period and timezone to apply to returned metrics. diff --git a/service/connect/api_op_ImportPhoneNumber.go b/service/connect/api_op_ImportPhoneNumber.go new file mode 100644 index 00000000000..58677bf9e34 --- /dev/null +++ b/service/connect/api_op_ImportPhoneNumber.go @@ -0,0 +1,199 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Imports a claimed phone number from an external service, such as Amazon +// Pinpoint, into an Amazon Connect instance. You can call this API only in the +// same Amazon Web Services Region where the Amazon Connect instance was created. +func (c *Client) ImportPhoneNumber(ctx context.Context, params *ImportPhoneNumberInput, optFns ...func(*Options)) (*ImportPhoneNumberOutput, error) { + if params == nil { + params = &ImportPhoneNumberInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ImportPhoneNumber", params, optFns, c.addOperationImportPhoneNumberMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ImportPhoneNumberOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ImportPhoneNumberInput struct { + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The claimed phone number ARN being imported from the external service, such as + // Amazon Pinpoint. If it is from Amazon Pinpoint, it looks like the ARN of the + // phone number to import from Amazon Pinpoint. + // + // This member is required. + SourcePhoneNumberArn *string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The description of the phone number. + PhoneNumberDescription *string + + // The tags used to organize, track, or control access for this resource. For + // example, { "tags": {"key1":"value1", "key2":"value2"} }. + Tags map[string]string + + noSmithyDocumentSerde +} + +type ImportPhoneNumberOutput struct { + + // The Amazon Resource Name (ARN) of the phone number. + PhoneNumberArn *string + + // A unique identifier for the phone number. + PhoneNumberId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationImportPhoneNumberMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpImportPhoneNumber{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpImportPhoneNumber{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ImportPhoneNumber"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opImportPhoneNumberMiddleware(stack, options); err != nil { + return err + } + if err = addOpImportPhoneNumberValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opImportPhoneNumber(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpImportPhoneNumber struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpImportPhoneNumber) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpImportPhoneNumber) 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.(*ImportPhoneNumberInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *ImportPhoneNumberInput ") + } + + 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_opImportPhoneNumberMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpImportPhoneNumber{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opImportPhoneNumber(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ImportPhoneNumber", + } +} diff --git a/service/connect/api_op_ListAnalyticsDataAssociations.go b/service/connect/api_op_ListAnalyticsDataAssociations.go new file mode 100644 index 00000000000..c2dd876f12a --- /dev/null +++ b/service/connect/api_op_ListAnalyticsDataAssociations.go @@ -0,0 +1,155 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This API is in preview release for Amazon Connect and is subject to change. +// Lists the association status of requested dataset ID for a given Amazon Connect +// instance. +func (c *Client) ListAnalyticsDataAssociations(ctx context.Context, params *ListAnalyticsDataAssociationsInput, optFns ...func(*Options)) (*ListAnalyticsDataAssociationsOutput, error) { + if params == nil { + params = &ListAnalyticsDataAssociationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAnalyticsDataAssociations", params, optFns, c.addOperationListAnalyticsDataAssociationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAnalyticsDataAssociationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListAnalyticsDataAssociationsInput struct { + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The identifier of the dataset to get the association status. + DataSetId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListAnalyticsDataAssociationsOutput struct { + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // An array of successful results: DataSetId , TargetAccountId , ResourceShareId , + // ResourceShareArn . This is a paginated API, so nextToken is given if there are + // more results to be returned. + Results []types.AnalyticsDataAssociationResult + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAnalyticsDataAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAnalyticsDataAssociations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAnalyticsDataAssociations{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAnalyticsDataAssociations"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAnalyticsDataAssociationsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAnalyticsDataAssociations(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListAnalyticsDataAssociations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAnalyticsDataAssociations", + } +} diff --git a/service/connect/api_op_ListFlowAssociations.go b/service/connect/api_op_ListFlowAssociations.go new file mode 100644 index 00000000000..cbcff489a18 --- /dev/null +++ b/service/connect/api_op_ListFlowAssociations.go @@ -0,0 +1,242 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// List the flow association based on the filters. +func (c *Client) ListFlowAssociations(ctx context.Context, params *ListFlowAssociationsInput, optFns ...func(*Options)) (*ListFlowAssociationsOutput, error) { + if params == nil { + params = &ListFlowAssociationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListFlowAssociations", params, optFns, c.addOperationListFlowAssociationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListFlowAssociationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListFlowAssociationsInput struct { + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + // A valid resource type. + ResourceType types.ListFlowAssociationResourceType + + noSmithyDocumentSerde +} + +type ListFlowAssociationsOutput struct { + + // Summary of flow associations. + FlowAssociationSummaryList []types.FlowAssociationSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListFlowAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListFlowAssociations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListFlowAssociations{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListFlowAssociations"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListFlowAssociationsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListFlowAssociations(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListFlowAssociationsAPIClient is a client that implements the +// ListFlowAssociations operation. +type ListFlowAssociationsAPIClient interface { + ListFlowAssociations(context.Context, *ListFlowAssociationsInput, ...func(*Options)) (*ListFlowAssociationsOutput, error) +} + +var _ ListFlowAssociationsAPIClient = (*Client)(nil) + +// ListFlowAssociationsPaginatorOptions is the paginator options for +// ListFlowAssociations +type ListFlowAssociationsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListFlowAssociationsPaginator is a paginator for ListFlowAssociations +type ListFlowAssociationsPaginator struct { + options ListFlowAssociationsPaginatorOptions + client ListFlowAssociationsAPIClient + params *ListFlowAssociationsInput + nextToken *string + firstPage bool +} + +// NewListFlowAssociationsPaginator returns a new ListFlowAssociationsPaginator +func NewListFlowAssociationsPaginator(client ListFlowAssociationsAPIClient, params *ListFlowAssociationsInput, optFns ...func(*ListFlowAssociationsPaginatorOptions)) *ListFlowAssociationsPaginator { + if params == nil { + params = &ListFlowAssociationsInput{} + } + + options := ListFlowAssociationsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListFlowAssociationsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListFlowAssociationsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListFlowAssociations page. +func (p *ListFlowAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListFlowAssociationsOutput, 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.ListFlowAssociations(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_opListFlowAssociations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListFlowAssociations", + } +} diff --git a/service/connect/api_op_ListQuickConnects.go b/service/connect/api_op_ListQuickConnects.go index 3a020eadc58..a6fc34a5302 100644 --- a/service/connect/api_op_ListQuickConnects.go +++ b/service/connect/api_op_ListQuickConnects.go @@ -45,8 +45,8 @@ type ListQuickConnectsInput struct { // response in the next request to retrieve the next set of results. NextToken *string - // The type of quick connect. In the Amazon Connect console, when you create a - // quick connect, you are prompted to assign one of the following types: Agent + // The type of quick connect. In the Amazon Connect admin website, when you create + // a quick connect, you are prompted to assign one of the following types: Agent // (USER), External (PHONE_NUMBER), or Queue (QUEUE). QuickConnectTypes []types.QuickConnectType diff --git a/service/connect/api_op_ListRealtimeContactAnalysisSegmentsV2.go b/service/connect/api_op_ListRealtimeContactAnalysisSegmentsV2.go new file mode 100644 index 00000000000..314ac7087ef --- /dev/null +++ b/service/connect/api_op_ListRealtimeContactAnalysisSegmentsV2.go @@ -0,0 +1,270 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Provides a list of analysis segments for a real-time analysis session. +func (c *Client) ListRealtimeContactAnalysisSegmentsV2(ctx context.Context, params *ListRealtimeContactAnalysisSegmentsV2Input, optFns ...func(*Options)) (*ListRealtimeContactAnalysisSegmentsV2Output, error) { + if params == nil { + params = &ListRealtimeContactAnalysisSegmentsV2Input{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListRealtimeContactAnalysisSegmentsV2", params, optFns, c.addOperationListRealtimeContactAnalysisSegmentsV2Middlewares) + if err != nil { + return nil, err + } + + out := result.(*ListRealtimeContactAnalysisSegmentsV2Output) + out.ResultMetadata = metadata + return out, nil +} + +type ListRealtimeContactAnalysisSegmentsV2Input struct { + + // The identifier of the contact in this instance of Amazon Connect. + // + // This member is required. + ContactId *string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The Contact Lens output type to be returned. + // + // This member is required. + OutputType types.RealTimeContactAnalysisOutputType + + // Enum with segment types . Each value corresponds to a segment type returned in + // the segments list of the API. Each segment type has its own structure. Different + // channels may have different sets of supported segment types. + // + // This member is required. + SegmentTypes []types.RealTimeContactAnalysisSegmentType + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListRealtimeContactAnalysisSegmentsV2Output struct { + + // The channel of the contact. Voice will not be returned. + // + // This member is required. + Channel types.RealTimeContactAnalysisSupportedChannel + + // An analyzed transcript or category. + // + // This member is required. + Segments []types.RealtimeContactAnalysisSegment + + // Status of real-time contact analysis. + // + // This member is required. + Status types.RealTimeContactAnalysisStatus + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListRealtimeContactAnalysisSegmentsV2Middlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListRealtimeContactAnalysisSegmentsV2{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListRealtimeContactAnalysisSegmentsV2{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListRealtimeContactAnalysisSegmentsV2"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListRealtimeContactAnalysisSegmentsV2ValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRealtimeContactAnalysisSegmentsV2(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListRealtimeContactAnalysisSegmentsV2APIClient is a client that implements the +// ListRealtimeContactAnalysisSegmentsV2 operation. +type ListRealtimeContactAnalysisSegmentsV2APIClient interface { + ListRealtimeContactAnalysisSegmentsV2(context.Context, *ListRealtimeContactAnalysisSegmentsV2Input, ...func(*Options)) (*ListRealtimeContactAnalysisSegmentsV2Output, error) +} + +var _ ListRealtimeContactAnalysisSegmentsV2APIClient = (*Client)(nil) + +// ListRealtimeContactAnalysisSegmentsV2PaginatorOptions is the paginator options +// for ListRealtimeContactAnalysisSegmentsV2 +type ListRealtimeContactAnalysisSegmentsV2PaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListRealtimeContactAnalysisSegmentsV2Paginator is a paginator for +// ListRealtimeContactAnalysisSegmentsV2 +type ListRealtimeContactAnalysisSegmentsV2Paginator struct { + options ListRealtimeContactAnalysisSegmentsV2PaginatorOptions + client ListRealtimeContactAnalysisSegmentsV2APIClient + params *ListRealtimeContactAnalysisSegmentsV2Input + nextToken *string + firstPage bool +} + +// NewListRealtimeContactAnalysisSegmentsV2Paginator returns a new +// ListRealtimeContactAnalysisSegmentsV2Paginator +func NewListRealtimeContactAnalysisSegmentsV2Paginator(client ListRealtimeContactAnalysisSegmentsV2APIClient, params *ListRealtimeContactAnalysisSegmentsV2Input, optFns ...func(*ListRealtimeContactAnalysisSegmentsV2PaginatorOptions)) *ListRealtimeContactAnalysisSegmentsV2Paginator { + if params == nil { + params = &ListRealtimeContactAnalysisSegmentsV2Input{} + } + + options := ListRealtimeContactAnalysisSegmentsV2PaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListRealtimeContactAnalysisSegmentsV2Paginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListRealtimeContactAnalysisSegmentsV2Paginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListRealtimeContactAnalysisSegmentsV2 page. +func (p *ListRealtimeContactAnalysisSegmentsV2Paginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRealtimeContactAnalysisSegmentsV2Output, 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.ListRealtimeContactAnalysisSegmentsV2(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_opListRealtimeContactAnalysisSegmentsV2(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListRealtimeContactAnalysisSegmentsV2", + } +} diff --git a/service/connect/api_op_ReleasePhoneNumber.go b/service/connect/api_op_ReleasePhoneNumber.go index edb2cce8390..57693b876f1 100644 --- a/service/connect/api_op_ReleasePhoneNumber.go +++ b/service/connect/api_op_ReleasePhoneNumber.go @@ -15,22 +15,22 @@ import ( // traffic distribution group. You can call this API only in the Amazon Web // Services Region where the number was claimed. To release phone numbers from a // traffic distribution group, use the ReleasePhoneNumber API, not the Amazon -// Connect console. After releasing a phone number, the phone number enters into a -// cooldown period of 30 days. It cannot be searched for or claimed again until the -// period has ended. If you accidentally release a phone number, contact Amazon Web -// Services Support. If you plan to claim and release numbers frequently during a -// 30 day period, contact us for a service quota exception. Otherwise, it is -// possible you will be blocked from claiming and releasing any more numbers until -// 30 days past the oldest number released has expired. By default you can claim -// and release up to 200% of your maximum number of active phone numbers during any -// 30 day period. If you claim and release phone numbers using the UI or API during -// a rolling 30 day cycle that exceeds 200% of your phone number service level -// quota, you will be blocked from claiming any more numbers until 30 days past the -// oldest number released has expired. For example, if you already have 99 claimed -// numbers and a service level quota of 99 phone numbers, and in any 30 day period -// you release 99, claim 99, and then release 99, you will have exceeded the 200% -// limit. At that point you are blocked from claiming any more numbers until you -// open an Amazon Web Services support ticket. +// Connect admin website. After releasing a phone number, the phone number enters +// into a cooldown period of 30 days. It cannot be searched for or claimed again +// until the period has ended. If you accidentally release a phone number, contact +// Amazon Web Services Support. If you plan to claim and release numbers frequently +// during a 30 day period, contact us for a service quota exception. Otherwise, it +// is possible you will be blocked from claiming and releasing any more numbers +// until 30 days past the oldest number released has expired. By default you can +// claim and release up to 200% of your maximum number of active phone numbers +// during any 30 day period. If you claim and release phone numbers using the UI or +// API during a rolling 30 day cycle that exceeds 200% of your phone number service +// level quota, you will be blocked from claiming any more numbers until 30 days +// past the oldest number released has expired. For example, if you already have 99 +// claimed numbers and a service level quota of 99 phone numbers, and in any 30 day +// period you release 99, claim 99, and then release 99, you will have exceeded the +// 200% limit. At that point you are blocked from claiming any more numbers until +// you open an Amazon Web Services support ticket. func (c *Client) ReleasePhoneNumber(ctx context.Context, params *ReleasePhoneNumberInput, optFns ...func(*Options)) (*ReleasePhoneNumberOutput, error) { if params == nil { params = &ReleasePhoneNumberInput{} diff --git a/service/connect/api_op_SendChatIntegrationEvent.go b/service/connect/api_op_SendChatIntegrationEvent.go new file mode 100644 index 00000000000..cf5ced0d73f --- /dev/null +++ b/service/connect/api_op_SendChatIntegrationEvent.go @@ -0,0 +1,175 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Processes chat integration events from Amazon Web Services or external +// integrations to Amazon Connect. A chat integration event includes: +// - SourceId, DestinationId, and Subtype: a set of identifiers, uniquely +// representing a chat +// - ChatEvent: details of the chat action to perform such as sending a message, +// event, or disconnecting from a chat +// +// When a chat integration event is sent with chat identifiers that do not map to +// an active chat contact, a new chat contact is also created before handling chat +// action. Access to this API is currently restricted to Amazon Pinpoint for +// supporting SMS integration. +func (c *Client) SendChatIntegrationEvent(ctx context.Context, params *SendChatIntegrationEventInput, optFns ...func(*Options)) (*SendChatIntegrationEventOutput, error) { + if params == nil { + params = &SendChatIntegrationEventInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SendChatIntegrationEvent", params, optFns, c.addOperationSendChatIntegrationEventMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SendChatIntegrationEventOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SendChatIntegrationEventInput struct { + + // Chat system identifier, used in part to uniquely identify chat. This is + // associated with the Amazon Connect instance and flow to be used to start chats. + // For SMS, this is the phone number destination of inbound SMS messages + // represented by an Amazon Pinpoint phone number ARN. + // + // This member is required. + DestinationId *string + + // Chat integration event payload + // + // This member is required. + Event *types.ChatEvent + + // External identifier of chat customer participant, used in part to uniquely + // identify a chat. For SMS, this is the E164 phone number of the chat customer + // participant. + // + // This member is required. + SourceId *string + + // Contact properties to apply when starting a new chat. If the integration event + // is handled with an existing chat, this is ignored. + NewSessionDetails *types.NewSessionDetails + + // Classification of a channel. This is used in part to uniquely identify chat. + // Valid value: ["connect:sms"] + Subtype *string + + noSmithyDocumentSerde +} + +type SendChatIntegrationEventOutput struct { + + // Identifier of chat contact used to handle integration event. This may be null + // if the integration event is not valid without an already existing chat contact. + InitialContactId *string + + // Whether handling the integration event resulted in creating a new chat or + // acting on existing chat. + NewChatCreated *bool + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSendChatIntegrationEventMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpSendChatIntegrationEvent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSendChatIntegrationEvent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "SendChatIntegrationEvent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpSendChatIntegrationEventValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSendChatIntegrationEvent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opSendChatIntegrationEvent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "SendChatIntegrationEvent", + } +} diff --git a/service/connect/api_op_StartChatContact.go b/service/connect/api_op_StartChatContact.go index 7a7b9df3183..a5249126fa8 100644 --- a/service/connect/api_op_StartChatContact.go +++ b/service/connect/api_op_StartChatContact.go @@ -49,10 +49,10 @@ func (c *Client) StartChatContact(ctx context.Context, params *StartChatContactI type StartChatContactInput struct { // The identifier of the flow for initiating the chat. To see the ContactFlowId in - // the Amazon Connect console user interface, on the navigation menu go to Routing, - // Contact Flows. Choose the flow. On the flow page, under the name of the flow, - // choose Show additional flow information. The ContactFlowId is the last part of - // the ARN, shown here in bold: + // the Amazon Connect admin website, on the navigation menu go to Routing, Contact + // Flows. Choose the flow. On the flow page, under the name of the flow, choose + // Show additional flow information. The ContactFlowId is the last part of the ARN, + // shown here in bold: // arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx // // This member is required. diff --git a/service/connect/api_op_StartOutboundVoiceContact.go b/service/connect/api_op_StartOutboundVoiceContact.go index 83b3bad4ba3..0de2b2d40c8 100644 --- a/service/connect/api_op_StartOutboundVoiceContact.go +++ b/service/connect/api_op_StartOutboundVoiceContact.go @@ -43,10 +43,10 @@ func (c *Client) StartOutboundVoiceContact(ctx context.Context, params *StartOut type StartOutboundVoiceContactInput struct { // The identifier of the flow for the outbound call. To see the ContactFlowId in - // the Amazon Connect console user interface, on the navigation menu go to Routing, - // Contact Flows. Choose the flow. On the flow page, under the name of the flow, - // choose Show additional flow information. The ContactFlowId is the last part of - // the ARN, shown here in bold: + // the Amazon Connect admin website, on the navigation menu go to Routing, Contact + // Flows. Choose the flow. On the flow page, under the name of the flow, choose + // Show additional flow information. The ContactFlowId is the last part of the ARN, + // shown here in bold: // arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx // // This member is required. diff --git a/service/connect/api_op_StartTaskContact.go b/service/connect/api_op_StartTaskContact.go index 0fc805b7703..dc372641c9f 100644 --- a/service/connect/api_op_StartTaskContact.go +++ b/service/connect/api_op_StartTaskContact.go @@ -83,10 +83,10 @@ type StartTaskContactInput struct { ClientToken *string // The identifier of the flow for initiating the tasks. To see the ContactFlowId - // in the Amazon Connect console user interface, on the navigation menu go to - // Routing, Contact Flows. Choose the flow. On the flow page, under the name of the - // flow, choose Show additional flow information. The ContactFlowId is the last - // part of the ARN, shown here in bold: + // in the Amazon Connect admin website, on the navigation menu go to Routing, + // Contact Flows. Choose the flow. On the flow page, under the name of the flow, + // choose Show additional flow information. The ContactFlowId is the last part of + // the ARN, shown here in bold: // arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx ContactFlowId *string diff --git a/service/connect/api_op_StartWebRTCContact.go b/service/connect/api_op_StartWebRTCContact.go new file mode 100644 index 00000000000..88555e1e9b2 --- /dev/null +++ b/service/connect/api_op_StartWebRTCContact.go @@ -0,0 +1,238 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Places an inbound in-app, web, or video call to a contact, and then initiates +// the flow. It performs the actions in the flow that are specified (in +// ContactFlowId) and present in the Amazon Connect instance (specified as +// InstanceId). +func (c *Client) StartWebRTCContact(ctx context.Context, params *StartWebRTCContactInput, optFns ...func(*Options)) (*StartWebRTCContactOutput, error) { + if params == nil { + params = &StartWebRTCContactInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartWebRTCContact", params, optFns, c.addOperationStartWebRTCContactMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartWebRTCContactOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartWebRTCContactInput struct { + + // The identifier of the flow for the call. To see the ContactFlowId in the Amazon + // Connect admin website, on the navigation menu go to Routing, Contact Flows. + // Choose the flow. On the flow page, under the name of the flow, choose Show + // additional flow information. The ContactFlowId is the last part of the ARN, + // shown here in bold: + // arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx + // + // This member is required. + ContactFlowId *string + + // The identifier of the Amazon Connect instance. You can find the instance ID (https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html) + // in the Amazon Resource Name (ARN) of the instance. + // + // This member is required. + InstanceId *string + + // The customer's details. + // + // This member is required. + ParticipantDetails *types.ParticipantDetails + + // Information about the video sharing capabilities of the participants (customer, + // agent). + AllowedCapabilities *types.AllowedCapabilities + + // A custom key-value pair using an attribute map. The attributes are standard + // Amazon Connect attributes, and can be accessed in flows just like any other + // contact attributes. There can be up to 32,768 UTF-8 bytes across all key-value + // pairs per contact. Attribute keys can include only alphanumeric, -, and _ + // characters. + Attributes map[string]string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . The token is valid for 7 days after creation. If a contact is already started, + // the contact ID is returned. + ClientToken *string + + // A description of the task that is shown to an agent in the Contact Control + // Panel (CCP). + Description *string + + // A formatted URL that is shown to an agent in the Contact Control Panel (CCP). + // Tasks can have the following reference types at the time of creation: URL | + // NUMBER | STRING | DATE | EMAIL . ATTACHMENT is not a supported reference type + // during task creation. + References map[string]types.Reference + + // The unique identifier for an Amazon Connect contact. This identifier is related + // to the contact starting. + RelatedContactId *string + + noSmithyDocumentSerde +} + +type StartWebRTCContactOutput struct { + + // Information required for the client application (mobile application or website) + // to connect to the call. + ConnectionData *types.ConnectionData + + // The identifier of the contact in this instance of Amazon Connect. + ContactId *string + + // The identifier for a contact participant. The ParticipantId for a contact + // participant is the same throughout the contact lifecycle. + ParticipantId *string + + // The token used by the contact participant to call the + // CreateParticipantConnection (https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_CreateParticipantConnection.html) + // API. The participant token is valid for the lifetime of a contact participant. + ParticipantToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartWebRTCContactMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartWebRTCContact{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartWebRTCContact{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartWebRTCContact"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opStartWebRTCContactMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartWebRTCContactValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartWebRTCContact(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpStartWebRTCContact struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpStartWebRTCContact) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpStartWebRTCContact) 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.(*StartWebRTCContactInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *StartWebRTCContactInput ") + } + + 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_opStartWebRTCContactMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpStartWebRTCContact{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opStartWebRTCContact(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartWebRTCContact", + } +} diff --git a/service/connect/deserializers.go b/service/connect/deserializers.go index f4b26497ec0..5faf8fe1a5f 100644 --- a/service/connect/deserializers.go +++ b/service/connect/deserializers.go @@ -19,6 +19,7 @@ import ( "io/ioutil" "math" "strings" + "time" ) type awsRestjson1_deserializeOpActivateEvaluationForm struct { @@ -206,6 +207,196 @@ func awsRestjson1_deserializeOpDocumentActivateEvaluationFormOutput(v **Activate return nil } +type awsRestjson1_deserializeOpAssociateAnalyticsDataSet struct { +} + +func (*awsRestjson1_deserializeOpAssociateAnalyticsDataSet) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpAssociateAnalyticsDataSet) 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_deserializeOpErrorAssociateAnalyticsDataSet(response, &metadata) + } + output := &AssociateAnalyticsDataSetOutput{} + 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_deserializeOpDocumentAssociateAnalyticsDataSetOutput(&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_deserializeOpErrorAssociateAnalyticsDataSet(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentAssociateAnalyticsDataSetOutput(v **AssociateAnalyticsDataSetOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *AssociateAnalyticsDataSetOutput + if *v == nil { + sv = &AssociateAnalyticsDataSetOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DataSetId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSetId to be of type string, got %T instead", value) + } + sv.DataSetId = ptr.String(jtv) + } + + case "ResourceShareArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.ResourceShareArn = ptr.String(jtv) + } + + case "ResourceShareId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceShareId = ptr.String(jtv) + } + + case "TargetAccountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AWSAccountId to be of type string, got %T instead", value) + } + sv.TargetAccountId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpAssociateApprovedOrigin struct { } @@ -515,6 +706,104 @@ func awsRestjson1_deserializeOpErrorAssociateDefaultVocabulary(response *smithyh } } +type awsRestjson1_deserializeOpAssociateFlow struct { +} + +func (*awsRestjson1_deserializeOpAssociateFlow) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpAssociateFlow) 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_deserializeOpErrorAssociateFlow(response, &metadata) + } + output := &AssociateFlowOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorAssociateFlow(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsRestjson1_deserializeOpAssociateInstanceStorageConfig struct { } @@ -1468,14 +1757,14 @@ func awsRestjson1_deserializeOpErrorAssociateTrafficDistributionGroupUser(respon } } -type awsRestjson1_deserializeOpBatchGetFlowAssociation struct { +type awsRestjson1_deserializeOpBatchAssociateAnalyticsDataSet struct { } -func (*awsRestjson1_deserializeOpBatchGetFlowAssociation) ID() string { +func (*awsRestjson1_deserializeOpBatchAssociateAnalyticsDataSet) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpBatchGetFlowAssociation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpBatchAssociateAnalyticsDataSet) 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) @@ -1489,9 +1778,9 @@ func (m *awsRestjson1_deserializeOpBatchGetFlowAssociation) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorBatchAssociateAnalyticsDataSet(response, &metadata) } - output := &BatchGetFlowAssociationOutput{} + output := &BatchAssociateAnalyticsDataSetOutput{} out.Result = output var buff [1024]byte @@ -1512,7 +1801,7 @@ func (m *awsRestjson1_deserializeOpBatchGetFlowAssociation) HandleDeserialize(ct return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentBatchAssociateAnalyticsDataSetOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -1525,7 +1814,7 @@ func (m *awsRestjson1_deserializeOpBatchGetFlowAssociation) HandleDeserialize(ct return out, metadata, err } -func awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorBatchAssociateAnalyticsDataSet(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)} @@ -1566,9 +1855,6 @@ func awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(response *smithyhttp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -1594,7 +1880,7 @@ func awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(v **BatchGetFlowAssociationOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentBatchAssociateAnalyticsDataSetOutput(v **BatchAssociateAnalyticsDataSetOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -1607,17 +1893,22 @@ func awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(v **BatchGe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *BatchGetFlowAssociationOutput + var sv *BatchAssociateAnalyticsDataSetOutput if *v == nil { - sv = &BatchGetFlowAssociationOutput{} + sv = &BatchAssociateAnalyticsDataSetOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "FlowAssociationSummaryList": - if err := awsRestjson1_deserializeDocumentFlowAssociationSummaryList(&sv.FlowAssociationSummaryList, value); err != nil { + case "Created": + if err := awsRestjson1_deserializeDocumentAnalyticsDataAssociationResults(&sv.Created, value); err != nil { + return err + } + + case "Errors": + if err := awsRestjson1_deserializeDocumentErrorResults(&sv.Errors, value); err != nil { return err } @@ -1630,14 +1921,14 @@ func awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(v **BatchGe return nil } -type awsRestjson1_deserializeOpBatchPutContact struct { +type awsRestjson1_deserializeOpBatchDisassociateAnalyticsDataSet struct { } -func (*awsRestjson1_deserializeOpBatchPutContact) ID() string { +func (*awsRestjson1_deserializeOpBatchDisassociateAnalyticsDataSet) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpBatchPutContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpBatchDisassociateAnalyticsDataSet) 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) @@ -1651,9 +1942,9 @@ func (m *awsRestjson1_deserializeOpBatchPutContact) HandleDeserialize(ctx contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorBatchPutContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorBatchDisassociateAnalyticsDataSet(response, &metadata) } - output := &BatchPutContactOutput{} + output := &BatchDisassociateAnalyticsDataSetOutput{} out.Result = output var buff [1024]byte @@ -1674,7 +1965,7 @@ func (m *awsRestjson1_deserializeOpBatchPutContact) HandleDeserialize(ctx contex return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentBatchPutContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentBatchDisassociateAnalyticsDataSetOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -1687,7 +1978,7 @@ func (m *awsRestjson1_deserializeOpBatchPutContact) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorBatchPutContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorBatchDisassociateAnalyticsDataSet(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)} @@ -1728,24 +2019,21 @@ func awsRestjson1_deserializeOpErrorBatchPutContact(response *smithyhttp.Respons } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("LimitExceededException", errorCode): - return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -1756,7 +2044,7 @@ func awsRestjson1_deserializeOpErrorBatchPutContact(response *smithyhttp.Respons } } -func awsRestjson1_deserializeOpDocumentBatchPutContactOutput(v **BatchPutContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentBatchDisassociateAnalyticsDataSetOutput(v **BatchDisassociateAnalyticsDataSetOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -1769,22 +2057,22 @@ func awsRestjson1_deserializeOpDocumentBatchPutContactOutput(v **BatchPutContact return fmt.Errorf("unexpected JSON type %v", value) } - var sv *BatchPutContactOutput + var sv *BatchDisassociateAnalyticsDataSetOutput if *v == nil { - sv = &BatchPutContactOutput{} + sv = &BatchDisassociateAnalyticsDataSetOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "FailedRequestList": - if err := awsRestjson1_deserializeDocumentFailedRequestList(&sv.FailedRequestList, value); err != nil { + case "Deleted": + if err := awsRestjson1_deserializeDocumentDataSetIds(&sv.Deleted, value); err != nil { return err } - case "SuccessfulRequestList": - if err := awsRestjson1_deserializeDocumentSuccessfulRequestList(&sv.SuccessfulRequestList, value); err != nil { + case "Errors": + if err := awsRestjson1_deserializeDocumentErrorResults(&sv.Errors, value); err != nil { return err } @@ -1797,14 +2085,14 @@ func awsRestjson1_deserializeOpDocumentBatchPutContactOutput(v **BatchPutContact return nil } -type awsRestjson1_deserializeOpClaimPhoneNumber struct { +type awsRestjson1_deserializeOpBatchGetFlowAssociation struct { } -func (*awsRestjson1_deserializeOpClaimPhoneNumber) ID() string { +func (*awsRestjson1_deserializeOpBatchGetFlowAssociation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpClaimPhoneNumber) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpBatchGetFlowAssociation) 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) @@ -1818,9 +2106,9 @@ func (m *awsRestjson1_deserializeOpClaimPhoneNumber) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorClaimPhoneNumber(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(response, &metadata) } - output := &ClaimPhoneNumberOutput{} + output := &BatchGetFlowAssociationOutput{} out.Result = output var buff [1024]byte @@ -1841,7 +2129,7 @@ func (m *awsRestjson1_deserializeOpClaimPhoneNumber) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -1854,7 +2142,7 @@ func (m *awsRestjson1_deserializeOpClaimPhoneNumber) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorClaimPhoneNumber(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorBatchGetFlowAssociation(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)} @@ -1898,15 +2186,15 @@ func awsRestjson1_deserializeOpErrorClaimPhoneNumber(response *smithyhttp.Respon case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -1923,7 +2211,7 @@ func awsRestjson1_deserializeOpErrorClaimPhoneNumber(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(v **ClaimPhoneNumberOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentBatchGetFlowAssociationOutput(v **BatchGetFlowAssociationOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -1936,31 +2224,185 @@ func awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(v **ClaimPhoneNumb return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ClaimPhoneNumberOutput + var sv *BatchGetFlowAssociationOutput if *v == nil { - sv = &ClaimPhoneNumberOutput{} + sv = &BatchGetFlowAssociationOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "PhoneNumberArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.PhoneNumberArn = ptr.String(jtv) + case "FlowAssociationSummaryList": + if err := awsRestjson1_deserializeDocumentFlowAssociationSummaryList(&sv.FlowAssociationSummaryList, value); err != nil { + return err } - case "PhoneNumberId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) - } - sv.PhoneNumberId = ptr.String(jtv) + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpBatchPutContact struct { +} + +func (*awsRestjson1_deserializeOpBatchPutContact) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpBatchPutContact) 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_deserializeOpErrorBatchPutContact(response, &metadata) + } + output := &BatchPutContactOutput{} + 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_deserializeOpDocumentBatchPutContactOutput(&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_deserializeOpErrorBatchPutContact(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("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentBatchPutContactOutput(v **BatchPutContactOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *BatchPutContactOutput + if *v == nil { + sv = &BatchPutContactOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "FailedRequestList": + if err := awsRestjson1_deserializeDocumentFailedRequestList(&sv.FailedRequestList, value); err != nil { + return err + } + + case "SuccessfulRequestList": + if err := awsRestjson1_deserializeDocumentSuccessfulRequestList(&sv.SuccessfulRequestList, value); err != nil { + return err } default: @@ -1972,14 +2414,14 @@ func awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(v **ClaimPhoneNumb return nil } -type awsRestjson1_deserializeOpCreateAgentStatus struct { +type awsRestjson1_deserializeOpClaimPhoneNumber struct { } -func (*awsRestjson1_deserializeOpCreateAgentStatus) ID() string { +func (*awsRestjson1_deserializeOpClaimPhoneNumber) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpCreateAgentStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpClaimPhoneNumber) 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) @@ -1993,9 +2435,9 @@ func (m *awsRestjson1_deserializeOpCreateAgentStatus) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorCreateAgentStatus(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorClaimPhoneNumber(response, &metadata) } - output := &CreateAgentStatusOutput{} + output := &ClaimPhoneNumberOutput{} out.Result = output var buff [1024]byte @@ -2016,7 +2458,7 @@ func (m *awsRestjson1_deserializeOpCreateAgentStatus) HandleDeserialize(ctx cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentCreateAgentStatusOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -2029,7 +2471,182 @@ func (m *awsRestjson1_deserializeOpCreateAgentStatus) HandleDeserialize(ctx cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorCreateAgentStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorClaimPhoneNumber(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("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentClaimPhoneNumberOutput(v **ClaimPhoneNumberOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ClaimPhoneNumberOutput + if *v == nil { + sv = &ClaimPhoneNumberOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "PhoneNumberArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.PhoneNumberArn = ptr.String(jtv) + } + + case "PhoneNumberId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + } + sv.PhoneNumberId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateAgentStatus struct { +} + +func (*awsRestjson1_deserializeOpCreateAgentStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAgentStatus) 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_deserializeOpErrorCreateAgentStatus(response, &metadata) + } + output := &CreateAgentStatusOutput{} + 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_deserializeOpDocumentCreateAgentStatusOutput(&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_deserializeOpErrorCreateAgentStatus(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)} @@ -12057,14 +12674,14 @@ func awsRestjson1_deserializeOpDocumentDescribeVocabularyOutput(v **DescribeVoca return nil } -type awsRestjson1_deserializeOpDisassociateApprovedOrigin struct { +type awsRestjson1_deserializeOpDisassociateAnalyticsDataSet struct { } -func (*awsRestjson1_deserializeOpDisassociateApprovedOrigin) ID() string { +func (*awsRestjson1_deserializeOpDisassociateAnalyticsDataSet) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateApprovedOrigin) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateAnalyticsDataSet) 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) @@ -12078,9 +12695,9 @@ func (m *awsRestjson1_deserializeOpDisassociateApprovedOrigin) HandleDeserialize } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateAnalyticsDataSet(response, &metadata) } - output := &DisassociateApprovedOriginOutput{} + output := &DisassociateAnalyticsDataSetOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12092,7 +12709,7 @@ func (m *awsRestjson1_deserializeOpDisassociateApprovedOrigin) HandleDeserialize return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateAnalyticsDataSet(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)} @@ -12158,14 +12775,14 @@ func awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response *smithyh } } -type awsRestjson1_deserializeOpDisassociateBot struct { +type awsRestjson1_deserializeOpDisassociateApprovedOrigin struct { } -func (*awsRestjson1_deserializeOpDisassociateBot) ID() string { +func (*awsRestjson1_deserializeOpDisassociateApprovedOrigin) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateApprovedOrigin) 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) @@ -12179,9 +12796,9 @@ func (m *awsRestjson1_deserializeOpDisassociateBot) HandleDeserialize(ctx contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateBot(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response, &metadata) } - output := &DisassociateBotOutput{} + output := &DisassociateApprovedOriginOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12193,7 +12810,7 @@ func (m *awsRestjson1_deserializeOpDisassociateBot) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociateBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(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)} @@ -12237,6 +12854,9 @@ func awsRestjson1_deserializeOpErrorDisassociateBot(response *smithyhttp.Respons case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -12256,14 +12876,14 @@ func awsRestjson1_deserializeOpErrorDisassociateBot(response *smithyhttp.Respons } } -type awsRestjson1_deserializeOpDisassociateInstanceStorageConfig struct { +type awsRestjson1_deserializeOpDisassociateBot struct { } -func (*awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) ID() string { +func (*awsRestjson1_deserializeOpDisassociateBot) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateBot) 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) @@ -12277,9 +12897,9 @@ func (m *awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) HandleDese } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateBot(response, &metadata) } - output := &DisassociateInstanceStorageConfigOutput{} + output := &DisassociateBotOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12291,7 +12911,7 @@ func (m *awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) HandleDese return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateBot(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)} @@ -12335,9 +12955,6 @@ func awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response * case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -12357,14 +12974,14 @@ func awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response * } } -type awsRestjson1_deserializeOpDisassociateLambdaFunction struct { +type awsRestjson1_deserializeOpDisassociateFlow struct { } -func (*awsRestjson1_deserializeOpDisassociateLambdaFunction) ID() string { +func (*awsRestjson1_deserializeOpDisassociateFlow) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateLambdaFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateFlow) 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) @@ -12378,21 +12995,15 @@ func (m *awsRestjson1_deserializeOpDisassociateLambdaFunction) HandleDeserialize } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateFlow(response, &metadata) } - output := &DisassociateLambdaFunctionOutput{} + output := &DisassociateFlowOutput{} 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_deserializeOpErrorDisassociateLambdaFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateFlow(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)} @@ -12433,6 +13044,9 @@ func awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response *smithyh } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -12458,14 +13072,14 @@ func awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response *smithyh } } -type awsRestjson1_deserializeOpDisassociateLexBot struct { +type awsRestjson1_deserializeOpDisassociateInstanceStorageConfig struct { } -func (*awsRestjson1_deserializeOpDisassociateLexBot) ID() string { +func (*awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateLexBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) 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) @@ -12479,9 +13093,9 @@ func (m *awsRestjson1_deserializeOpDisassociateLexBot) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLexBot(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response, &metadata) } - output := &DisassociateLexBotOutput{} + output := &DisassociateInstanceStorageConfigOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12493,7 +13107,7 @@ func (m *awsRestjson1_deserializeOpDisassociateLexBot) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociateLexBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(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)} @@ -12559,14 +13173,14 @@ func awsRestjson1_deserializeOpErrorDisassociateLexBot(response *smithyhttp.Resp } } -type awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow struct { +type awsRestjson1_deserializeOpDisassociateLambdaFunction struct { } -func (*awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) ID() string { +func (*awsRestjson1_deserializeOpDisassociateLambdaFunction) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateLambdaFunction) 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) @@ -12580,9 +13194,9 @@ func (m *awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) HandleDes } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociatePhoneNumberContactFlow(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response, &metadata) } - output := &DisassociatePhoneNumberContactFlowOutput{} + output := &DisassociateLambdaFunctionOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12594,7 +13208,7 @@ func (m *awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) HandleDes return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociatePhoneNumberContactFlow(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(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)} @@ -12635,15 +13249,15 @@ func awsRestjson1_deserializeOpErrorDisassociatePhoneNumberContactFlow(response } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -12660,14 +13274,14 @@ func awsRestjson1_deserializeOpErrorDisassociatePhoneNumberContactFlow(response } } -type awsRestjson1_deserializeOpDisassociateQueueQuickConnects struct { +type awsRestjson1_deserializeOpDisassociateLexBot struct { } -func (*awsRestjson1_deserializeOpDisassociateQueueQuickConnects) ID() string { +func (*awsRestjson1_deserializeOpDisassociateLexBot) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDisassociateQueueQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDisassociateLexBot) 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) @@ -12681,9 +13295,9 @@ func (m *awsRestjson1_deserializeOpDisassociateQueueQuickConnects) HandleDeseria } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorDisassociateQueueQuickConnects(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLexBot(response, &metadata) } - output := &DisassociateQueueQuickConnectsOutput{} + output := &DisassociateLexBotOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -12695,7 +13309,209 @@ func (m *awsRestjson1_deserializeOpDisassociateQueueQuickConnects) HandleDeseria return out, metadata, err } -func awsRestjson1_deserializeOpErrorDisassociateQueueQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorDisassociateLexBot(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow struct { +} + +func (*awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisassociatePhoneNumberContactFlow) 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_deserializeOpErrorDisassociatePhoneNumberContactFlow(response, &metadata) + } + output := &DisassociatePhoneNumberContactFlowOutput{} + 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_deserializeOpErrorDisassociatePhoneNumberContactFlow(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDisassociateQueueQuickConnects struct { +} + +func (*awsRestjson1_deserializeOpDisassociateQueueQuickConnects) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisassociateQueueQuickConnects) 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_deserializeOpErrorDisassociateQueueQuickConnects(response, &metadata) + } + output := &DisassociateQueueQuickConnectsOutput{} + 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_deserializeOpErrorDisassociateQueueQuickConnects(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)} @@ -13879,14 +14695,14 @@ func awsRestjson1_deserializeOpDocumentGetFederationTokenOutput(v **GetFederatio return nil } -type awsRestjson1_deserializeOpGetMetricData struct { +type awsRestjson1_deserializeOpGetFlowAssociation struct { } -func (*awsRestjson1_deserializeOpGetMetricData) ID() string { +func (*awsRestjson1_deserializeOpGetFlowAssociation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetMetricData) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetFlowAssociation) 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) @@ -13900,9 +14716,9 @@ func (m *awsRestjson1_deserializeOpGetMetricData) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetMetricData(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetFlowAssociation(response, &metadata) } - output := &GetMetricDataOutput{} + output := &GetFlowAssociationOutput{} out.Result = output var buff [1024]byte @@ -13923,7 +14739,7 @@ func (m *awsRestjson1_deserializeOpGetMetricData) HandleDeserialize(ctx context. return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetMetricDataOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetFlowAssociationOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -13936,7 +14752,7 @@ func (m *awsRestjson1_deserializeOpGetMetricData) HandleDeserialize(ctx context. return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetMetricData(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetFlowAssociation(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)} @@ -13977,6 +14793,9 @@ func awsRestjson1_deserializeOpErrorGetMetricData(response *smithyhttp.Response, } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -14002,7 +14821,7 @@ func awsRestjson1_deserializeOpErrorGetMetricData(response *smithyhttp.Response, } } -func awsRestjson1_deserializeOpDocumentGetMetricDataOutput(v **GetMetricDataOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetFlowAssociationOutput(v **GetFlowAssociationOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -14015,27 +14834,40 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataOutput(v **GetMetricDataOutp return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetMetricDataOutput + var sv *GetFlowAssociationOutput if *v == nil { - sv = &GetMetricDataOutput{} + sv = &GetFlowAssociationOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "MetricResults": - if err := awsRestjson1_deserializeDocumentHistoricalMetricResults(&sv.MetricResults, value); err != nil { - return err + case "FlowId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.FlowId = ptr.String(jtv) } - case "NextToken": + case "ResourceId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.NextToken = ptr.String(jtv) + sv.ResourceId = ptr.String(jtv) + } + + case "ResourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FlowAssociationResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.FlowAssociationResourceType(jtv) } default: @@ -14047,14 +14879,14 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataOutput(v **GetMetricDataOutp return nil } -type awsRestjson1_deserializeOpGetMetricDataV2 struct { +type awsRestjson1_deserializeOpGetMetricData struct { } -func (*awsRestjson1_deserializeOpGetMetricDataV2) ID() string { +func (*awsRestjson1_deserializeOpGetMetricData) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetMetricDataV2) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetMetricData) 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) @@ -14068,9 +14900,9 @@ func (m *awsRestjson1_deserializeOpGetMetricDataV2) HandleDeserialize(ctx contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetMetricDataV2(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetMetricData(response, &metadata) } - output := &GetMetricDataV2Output{} + output := &GetMetricDataOutput{} out.Result = output var buff [1024]byte @@ -14091,7 +14923,7 @@ func (m *awsRestjson1_deserializeOpGetMetricDataV2) HandleDeserialize(ctx contex return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetMetricDataOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -14104,7 +14936,7 @@ func (m *awsRestjson1_deserializeOpGetMetricDataV2) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetMetricDataV2(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetMetricData(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)} @@ -14170,7 +15002,7 @@ func awsRestjson1_deserializeOpErrorGetMetricDataV2(response *smithyhttp.Respons } } -func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2Output, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetMetricDataOutput(v **GetMetricDataOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -14183,9 +15015,9 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2 return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetMetricDataV2Output + var sv *GetMetricDataOutput if *v == nil { - sv = &GetMetricDataV2Output{} + sv = &GetMetricDataOutput{} } else { sv = *v } @@ -14193,7 +15025,7 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2 for key, value := range shape { switch key { case "MetricResults": - if err := awsRestjson1_deserializeDocumentMetricResultsV2(&sv.MetricResults, value); err != nil { + if err := awsRestjson1_deserializeDocumentHistoricalMetricResults(&sv.MetricResults, value); err != nil { return err } @@ -14201,7 +15033,7 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2 if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } @@ -14215,14 +15047,14 @@ func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2 return nil } -type awsRestjson1_deserializeOpGetPromptFile struct { +type awsRestjson1_deserializeOpGetMetricDataV2 struct { } -func (*awsRestjson1_deserializeOpGetPromptFile) ID() string { +func (*awsRestjson1_deserializeOpGetMetricDataV2) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetPromptFile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetMetricDataV2) 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) @@ -14236,9 +15068,9 @@ func (m *awsRestjson1_deserializeOpGetPromptFile) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetPromptFile(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetMetricDataV2(response, &metadata) } - output := &GetPromptFileOutput{} + output := &GetMetricDataV2Output{} out.Result = output var buff [1024]byte @@ -14259,7 +15091,7 @@ func (m *awsRestjson1_deserializeOpGetPromptFile) HandleDeserialize(ctx context. return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetPromptFileOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -14272,7 +15104,175 @@ func (m *awsRestjson1_deserializeOpGetPromptFile) HandleDeserialize(ctx context. return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetPromptFile(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetMetricDataV2(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMetricDataV2Output(v **GetMetricDataV2Output, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetMetricDataV2Output + if *v == nil { + sv = &GetMetricDataV2Output{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "MetricResults": + if err := awsRestjson1_deserializeDocumentMetricResultsV2(&sv.MetricResults, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetPromptFile struct { +} + +func (*awsRestjson1_deserializeOpGetPromptFile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetPromptFile) 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_deserializeOpErrorGetPromptFile(response, &metadata) + } + output := &GetPromptFileOutput{} + 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_deserializeOpDocumentGetPromptFileOutput(&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_deserializeOpErrorGetPromptFile(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)} @@ -14859,14 +15859,14 @@ func awsRestjson1_deserializeOpDocumentGetTrafficDistributionOutput(v **GetTraff return nil } -type awsRestjson1_deserializeOpListAgentStatuses struct { +type awsRestjson1_deserializeOpImportPhoneNumber struct { } -func (*awsRestjson1_deserializeOpListAgentStatuses) ID() string { +func (*awsRestjson1_deserializeOpImportPhoneNumber) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListAgentStatuses) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpImportPhoneNumber) 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) @@ -14880,9 +15880,9 @@ func (m *awsRestjson1_deserializeOpListAgentStatuses) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListAgentStatuses(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorImportPhoneNumber(response, &metadata) } - output := &ListAgentStatusesOutput{} + output := &ImportPhoneNumberOutput{} out.Result = output var buff [1024]byte @@ -14903,7 +15903,7 @@ func (m *awsRestjson1_deserializeOpListAgentStatuses) HandleDeserialize(ctx cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentImportPhoneNumberOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -14916,7 +15916,7 @@ func (m *awsRestjson1_deserializeOpListAgentStatuses) HandleDeserialize(ctx cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListAgentStatuses(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorImportPhoneNumber(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)} @@ -14957,15 +15957,18 @@ func awsRestjson1_deserializeOpErrorListAgentStatuses(response *smithyhttp.Respo } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -14982,7 +15985,7 @@ func awsRestjson1_deserializeOpErrorListAgentStatuses(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(v **ListAgentStatusesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentImportPhoneNumberOutput(v **ImportPhoneNumberOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -14995,27 +15998,31 @@ func awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(v **ListAgentStat return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListAgentStatusesOutput + var sv *ImportPhoneNumberOutput if *v == nil { - sv = &ListAgentStatusesOutput{} + sv = &ImportPhoneNumberOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "AgentStatusSummaryList": - if err := awsRestjson1_deserializeDocumentAgentStatusSummaryList(&sv.AgentStatusSummaryList, value); err != nil { - return err + case "PhoneNumberArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.PhoneNumberArn = ptr.String(jtv) } - case "NextToken": + case "PhoneNumberId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) } - sv.NextToken = ptr.String(jtv) + sv.PhoneNumberId = ptr.String(jtv) } default: @@ -15027,14 +16034,14 @@ func awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(v **ListAgentStat return nil } -type awsRestjson1_deserializeOpListApprovedOrigins struct { +type awsRestjson1_deserializeOpListAgentStatuses struct { } -func (*awsRestjson1_deserializeOpListApprovedOrigins) ID() string { +func (*awsRestjson1_deserializeOpListAgentStatuses) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListApprovedOrigins) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListAgentStatuses) 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) @@ -15048,9 +16055,9 @@ func (m *awsRestjson1_deserializeOpListApprovedOrigins) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListApprovedOrigins(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListAgentStatuses(response, &metadata) } - output := &ListApprovedOriginsOutput{} + output := &ListAgentStatusesOutput{} out.Result = output var buff [1024]byte @@ -15071,7 +16078,7 @@ func (m *awsRestjson1_deserializeOpListApprovedOrigins) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15084,7 +16091,7 @@ func (m *awsRestjson1_deserializeOpListApprovedOrigins) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListApprovedOrigins(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListAgentStatuses(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)} @@ -15150,7 +16157,7 @@ func awsRestjson1_deserializeOpErrorListApprovedOrigins(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprovedOriginsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListAgentStatusesOutput(v **ListAgentStatusesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -15163,15 +16170,20 @@ func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprove return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListApprovedOriginsOutput + var sv *ListAgentStatusesOutput if *v == nil { - sv = &ListApprovedOriginsOutput{} + sv = &ListAgentStatusesOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "AgentStatusSummaryList": + if err := awsRestjson1_deserializeDocumentAgentStatusSummaryList(&sv.AgentStatusSummaryList, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -15181,11 +16193,6 @@ func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprove sv.NextToken = ptr.String(jtv) } - case "Origins": - if err := awsRestjson1_deserializeDocumentOriginsList(&sv.Origins, value); err != nil { - return err - } - default: _, _ = key, value @@ -15195,14 +16202,14 @@ func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprove return nil } -type awsRestjson1_deserializeOpListBots struct { +type awsRestjson1_deserializeOpListAnalyticsDataAssociations struct { } -func (*awsRestjson1_deserializeOpListBots) ID() string { +func (*awsRestjson1_deserializeOpListAnalyticsDataAssociations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListAnalyticsDataAssociations) 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) @@ -15216,9 +16223,9 @@ func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListBots(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListAnalyticsDataAssociations(response, &metadata) } - output := &ListBotsOutput{} + output := &ListAnalyticsDataAssociationsOutput{} out.Result = output var buff [1024]byte @@ -15239,7 +16246,7 @@ func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListBotsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListAnalyticsDataAssociationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15252,7 +16259,7 @@ func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorListBots(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListAnalyticsDataAssociations(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)} @@ -15296,6 +16303,9 @@ func awsRestjson1_deserializeOpErrorListBots(response *smithyhttp.Response, meta case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -15315,7 +16325,7 @@ func awsRestjson1_deserializeOpErrorListBots(response *smithyhttp.Response, meta } } -func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListAnalyticsDataAssociationsOutput(v **ListAnalyticsDataAssociationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -15328,20 +16338,15 @@ func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListBotsOutput + var sv *ListAnalyticsDataAssociationsOutput if *v == nil { - sv = &ListBotsOutput{} + sv = &ListAnalyticsDataAssociationsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "LexBots": - if err := awsRestjson1_deserializeDocumentLexBotConfigList(&sv.LexBots, value); err != nil { - return err - } - case "NextToken": if value != nil { jtv, ok := value.(string) @@ -15351,6 +16356,11 @@ func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value sv.NextToken = ptr.String(jtv) } + case "Results": + if err := awsRestjson1_deserializeDocumentAnalyticsDataAssociationResults(&sv.Results, value); err != nil { + return err + } + default: _, _ = key, value @@ -15360,14 +16370,14 @@ func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value return nil } -type awsRestjson1_deserializeOpListContactEvaluations struct { +type awsRestjson1_deserializeOpListApprovedOrigins struct { } -func (*awsRestjson1_deserializeOpListContactEvaluations) ID() string { +func (*awsRestjson1_deserializeOpListApprovedOrigins) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListContactEvaluations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListApprovedOrigins) 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) @@ -15381,9 +16391,9 @@ func (m *awsRestjson1_deserializeOpListContactEvaluations) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListContactEvaluations(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListApprovedOrigins(response, &metadata) } - output := &ListContactEvaluationsOutput{} + output := &ListApprovedOriginsOutput{} out.Result = output var buff [1024]byte @@ -15404,7 +16414,7 @@ func (m *awsRestjson1_deserializeOpListContactEvaluations) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15417,7 +16427,7 @@ func (m *awsRestjson1_deserializeOpListContactEvaluations) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListContactEvaluations(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListApprovedOrigins(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)} @@ -15464,6 +16474,9 @@ func awsRestjson1_deserializeOpErrorListContactEvaluations(response *smithyhttp. case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -15480,7 +16493,7 @@ func awsRestjson1_deserializeOpErrorListContactEvaluations(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(v **ListContactEvaluationsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprovedOriginsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -15493,20 +16506,15 @@ func awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(v **ListCont return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListContactEvaluationsOutput + var sv *ListApprovedOriginsOutput if *v == nil { - sv = &ListContactEvaluationsOutput{} + sv = &ListApprovedOriginsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "EvaluationSummaryList": - if err := awsRestjson1_deserializeDocumentEvaluationSummaryList(&sv.EvaluationSummaryList, value); err != nil { - return err - } - case "NextToken": if value != nil { jtv, ok := value.(string) @@ -15516,6 +16524,11 @@ func awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(v **ListCont sv.NextToken = ptr.String(jtv) } + case "Origins": + if err := awsRestjson1_deserializeDocumentOriginsList(&sv.Origins, value); err != nil { + return err + } + default: _, _ = key, value @@ -15525,14 +16538,14 @@ func awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(v **ListCont return nil } -type awsRestjson1_deserializeOpListContactFlowModules struct { +type awsRestjson1_deserializeOpListBots struct { } -func (*awsRestjson1_deserializeOpListContactFlowModules) ID() string { +func (*awsRestjson1_deserializeOpListBots) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListContactFlowModules) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListBots) 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) @@ -15546,9 +16559,9 @@ func (m *awsRestjson1_deserializeOpListContactFlowModules) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListContactFlowModules(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListBots(response, &metadata) } - output := &ListContactFlowModulesOutput{} + output := &ListBotsOutput{} out.Result = output var buff [1024]byte @@ -15569,7 +16582,7 @@ func (m *awsRestjson1_deserializeOpListContactFlowModules) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListBotsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15582,7 +16595,7 @@ func (m *awsRestjson1_deserializeOpListContactFlowModules) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListContactFlowModules(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListBots(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)} @@ -15623,15 +16636,9 @@ func awsRestjson1_deserializeOpErrorListContactFlowModules(response *smithyhttp. } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -15651,7 +16658,7 @@ func awsRestjson1_deserializeOpErrorListContactFlowModules(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(v **ListContactFlowModulesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -15664,17 +16671,17 @@ func awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(v **ListCont return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListContactFlowModulesOutput + var sv *ListBotsOutput if *v == nil { - sv = &ListContactFlowModulesOutput{} + sv = &ListBotsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactFlowModulesSummaryList": - if err := awsRestjson1_deserializeDocumentContactFlowModulesSummaryList(&sv.ContactFlowModulesSummaryList, value); err != nil { + case "LexBots": + if err := awsRestjson1_deserializeDocumentLexBotConfigList(&sv.LexBots, value); err != nil { return err } @@ -15696,14 +16703,14 @@ func awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(v **ListCont return nil } -type awsRestjson1_deserializeOpListContactFlows struct { +type awsRestjson1_deserializeOpListContactEvaluations struct { } -func (*awsRestjson1_deserializeOpListContactFlows) ID() string { +func (*awsRestjson1_deserializeOpListContactEvaluations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListContactFlows) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListContactEvaluations) 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) @@ -15717,9 +16724,9 @@ func (m *awsRestjson1_deserializeOpListContactFlows) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListContactFlows(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListContactEvaluations(response, &metadata) } - output := &ListContactFlowsOutput{} + output := &ListContactEvaluationsOutput{} out.Result = output var buff [1024]byte @@ -15740,7 +16747,7 @@ func (m *awsRestjson1_deserializeOpListContactFlows) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListContactFlowsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15753,7 +16760,7 @@ func (m *awsRestjson1_deserializeOpListContactFlows) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorListContactFlows(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListContactEvaluations(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)} @@ -15800,9 +16807,6 @@ func awsRestjson1_deserializeOpErrorListContactFlows(response *smithyhttp.Respon case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -15819,7 +16823,7 @@ func awsRestjson1_deserializeOpErrorListContactFlows(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentListContactFlowsOutput(v **ListContactFlowsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListContactEvaluationsOutput(v **ListContactEvaluationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -15832,17 +16836,17 @@ func awsRestjson1_deserializeOpDocumentListContactFlowsOutput(v **ListContactFlo return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListContactFlowsOutput + var sv *ListContactEvaluationsOutput if *v == nil { - sv = &ListContactFlowsOutput{} + sv = &ListContactEvaluationsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactFlowSummaryList": - if err := awsRestjson1_deserializeDocumentContactFlowSummaryList(&sv.ContactFlowSummaryList, value); err != nil { + case "EvaluationSummaryList": + if err := awsRestjson1_deserializeDocumentEvaluationSummaryList(&sv.EvaluationSummaryList, value); err != nil { return err } @@ -15864,14 +16868,14 @@ func awsRestjson1_deserializeOpDocumentListContactFlowsOutput(v **ListContactFlo return nil } -type awsRestjson1_deserializeOpListContactReferences struct { +type awsRestjson1_deserializeOpListContactFlowModules struct { } -func (*awsRestjson1_deserializeOpListContactReferences) ID() string { +func (*awsRestjson1_deserializeOpListContactFlowModules) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListContactReferences) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListContactFlowModules) 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) @@ -15885,9 +16889,9 @@ func (m *awsRestjson1_deserializeOpListContactReferences) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListContactReferences(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListContactFlowModules(response, &metadata) } - output := &ListContactReferencesOutput{} + output := &ListContactFlowModulesOutput{} out.Result = output var buff [1024]byte @@ -15908,7 +16912,7 @@ func (m *awsRestjson1_deserializeOpListContactReferences) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListContactReferencesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -15921,7 +16925,7 @@ func (m *awsRestjson1_deserializeOpListContactReferences) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListContactReferences(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListContactFlowModules(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)} @@ -15962,6 +16966,9 @@ func awsRestjson1_deserializeOpErrorListContactReferences(response *smithyhttp.R } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -15987,7 +16994,7 @@ func awsRestjson1_deserializeOpErrorListContactReferences(response *smithyhttp.R } } -func awsRestjson1_deserializeOpDocumentListContactReferencesOutput(v **ListContactReferencesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListContactFlowModulesOutput(v **ListContactFlowModulesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16000,15 +17007,20 @@ func awsRestjson1_deserializeOpDocumentListContactReferencesOutput(v **ListConta return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListContactReferencesOutput + var sv *ListContactFlowModulesOutput if *v == nil { - sv = &ListContactReferencesOutput{} + sv = &ListContactFlowModulesOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "ContactFlowModulesSummaryList": + if err := awsRestjson1_deserializeDocumentContactFlowModulesSummaryList(&sv.ContactFlowModulesSummaryList, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -16018,11 +17030,6 @@ func awsRestjson1_deserializeOpDocumentListContactReferencesOutput(v **ListConta sv.NextToken = ptr.String(jtv) } - case "ReferenceSummaryList": - if err := awsRestjson1_deserializeDocumentReferenceSummaryList(&sv.ReferenceSummaryList, value); err != nil { - return err - } - default: _, _ = key, value @@ -16032,14 +17039,14 @@ func awsRestjson1_deserializeOpDocumentListContactReferencesOutput(v **ListConta return nil } -type awsRestjson1_deserializeOpListDefaultVocabularies struct { +type awsRestjson1_deserializeOpListContactFlows struct { } -func (*awsRestjson1_deserializeOpListDefaultVocabularies) ID() string { +func (*awsRestjson1_deserializeOpListContactFlows) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListDefaultVocabularies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListContactFlows) 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) @@ -16053,9 +17060,9 @@ func (m *awsRestjson1_deserializeOpListDefaultVocabularies) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListDefaultVocabularies(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListContactFlows(response, &metadata) } - output := &ListDefaultVocabulariesOutput{} + output := &ListContactFlowsOutput{} out.Result = output var buff [1024]byte @@ -16076,7 +17083,7 @@ func (m *awsRestjson1_deserializeOpListDefaultVocabularies) HandleDeserialize(ct return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListContactFlowsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16089,7 +17096,7 @@ func (m *awsRestjson1_deserializeOpListDefaultVocabularies) HandleDeserialize(ct return out, metadata, err } -func awsRestjson1_deserializeOpErrorListDefaultVocabularies(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListContactFlows(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)} @@ -16130,15 +17137,18 @@ func awsRestjson1_deserializeOpErrorListDefaultVocabularies(response *smithyhttp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -16152,7 +17162,7 @@ func awsRestjson1_deserializeOpErrorListDefaultVocabularies(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(v **ListDefaultVocabulariesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListContactFlowsOutput(v **ListContactFlowsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16165,17 +17175,17 @@ func awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(v **ListDef return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListDefaultVocabulariesOutput + var sv *ListContactFlowsOutput if *v == nil { - sv = &ListDefaultVocabulariesOutput{} + sv = &ListContactFlowsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "DefaultVocabularyList": - if err := awsRestjson1_deserializeDocumentDefaultVocabularyList(&sv.DefaultVocabularyList, value); err != nil { + case "ContactFlowSummaryList": + if err := awsRestjson1_deserializeDocumentContactFlowSummaryList(&sv.ContactFlowSummaryList, value); err != nil { return err } @@ -16183,7 +17193,7 @@ func awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(v **ListDef if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected VocabularyNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } @@ -16197,14 +17207,14 @@ func awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(v **ListDef return nil } -type awsRestjson1_deserializeOpListEvaluationForms struct { +type awsRestjson1_deserializeOpListContactReferences struct { } -func (*awsRestjson1_deserializeOpListEvaluationForms) ID() string { +func (*awsRestjson1_deserializeOpListContactReferences) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListEvaluationForms) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListContactReferences) 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) @@ -16218,9 +17228,9 @@ func (m *awsRestjson1_deserializeOpListEvaluationForms) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListEvaluationForms(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListContactReferences(response, &metadata) } - output := &ListEvaluationFormsOutput{} + output := &ListContactReferencesOutput{} out.Result = output var buff [1024]byte @@ -16241,7 +17251,7 @@ func (m *awsRestjson1_deserializeOpListEvaluationForms) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListContactReferencesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16254,7 +17264,7 @@ func (m *awsRestjson1_deserializeOpListEvaluationForms) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListEvaluationForms(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListContactReferences(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)} @@ -16301,6 +17311,9 @@ func awsRestjson1_deserializeOpErrorListEvaluationForms(response *smithyhttp.Res case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -16317,7 +17330,7 @@ func awsRestjson1_deserializeOpErrorListEvaluationForms(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(v **ListEvaluationFormsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListContactReferencesOutput(v **ListContactReferencesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16330,20 +17343,15 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(v **ListEvaluat return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListEvaluationFormsOutput + var sv *ListContactReferencesOutput if *v == nil { - sv = &ListEvaluationFormsOutput{} + sv = &ListContactReferencesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "EvaluationFormSummaryList": - if err := awsRestjson1_deserializeDocumentEvaluationFormSummaryList(&sv.EvaluationFormSummaryList, value); err != nil { - return err - } - case "NextToken": if value != nil { jtv, ok := value.(string) @@ -16353,6 +17361,11 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(v **ListEvaluat sv.NextToken = ptr.String(jtv) } + case "ReferenceSummaryList": + if err := awsRestjson1_deserializeDocumentReferenceSummaryList(&sv.ReferenceSummaryList, value); err != nil { + return err + } + default: _, _ = key, value @@ -16362,14 +17375,14 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(v **ListEvaluat return nil } -type awsRestjson1_deserializeOpListEvaluationFormVersions struct { +type awsRestjson1_deserializeOpListDefaultVocabularies struct { } -func (*awsRestjson1_deserializeOpListEvaluationFormVersions) ID() string { +func (*awsRestjson1_deserializeOpListDefaultVocabularies) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListEvaluationFormVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListDefaultVocabularies) 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) @@ -16383,9 +17396,9 @@ func (m *awsRestjson1_deserializeOpListEvaluationFormVersions) HandleDeserialize } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListEvaluationFormVersions(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListDefaultVocabularies(response, &metadata) } - output := &ListEvaluationFormVersionsOutput{} + output := &ListDefaultVocabulariesOutput{} out.Result = output var buff [1024]byte @@ -16406,7 +17419,7 @@ func (m *awsRestjson1_deserializeOpListEvaluationFormVersions) HandleDeserialize return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16419,7 +17432,7 @@ func (m *awsRestjson1_deserializeOpListEvaluationFormVersions) HandleDeserialize return out, metadata, err } -func awsRestjson1_deserializeOpErrorListEvaluationFormVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListDefaultVocabularies(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)} @@ -16460,14 +17473,14 @@ func awsRestjson1_deserializeOpErrorListEvaluationFormVersions(response *smithyh } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -16482,7 +17495,7 @@ func awsRestjson1_deserializeOpErrorListEvaluationFormVersions(response *smithyh } } -func awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(v **ListEvaluationFormVersionsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListDefaultVocabulariesOutput(v **ListDefaultVocabulariesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16495,17 +17508,17 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(v **List return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListEvaluationFormVersionsOutput + var sv *ListDefaultVocabulariesOutput if *v == nil { - sv = &ListEvaluationFormVersionsOutput{} + sv = &ListDefaultVocabulariesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "EvaluationFormVersionSummaryList": - if err := awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(&sv.EvaluationFormVersionSummaryList, value); err != nil { + case "DefaultVocabularyList": + if err := awsRestjson1_deserializeDocumentDefaultVocabularyList(&sv.DefaultVocabularyList, value); err != nil { return err } @@ -16513,7 +17526,7 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(v **List if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected VocabularyNextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } @@ -16527,14 +17540,14 @@ func awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(v **List return nil } -type awsRestjson1_deserializeOpListHoursOfOperations struct { +type awsRestjson1_deserializeOpListEvaluationForms struct { } -func (*awsRestjson1_deserializeOpListHoursOfOperations) ID() string { +func (*awsRestjson1_deserializeOpListEvaluationForms) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListHoursOfOperations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListEvaluationForms) 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) @@ -16548,9 +17561,9 @@ func (m *awsRestjson1_deserializeOpListHoursOfOperations) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListHoursOfOperations(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListEvaluationForms(response, &metadata) } - output := &ListHoursOfOperationsOutput{} + output := &ListEvaluationFormsOutput{} out.Result = output var buff [1024]byte @@ -16571,7 +17584,7 @@ func (m *awsRestjson1_deserializeOpListHoursOfOperations) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16584,7 +17597,7 @@ func (m *awsRestjson1_deserializeOpListHoursOfOperations) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListHoursOfOperations(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListEvaluationForms(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)} @@ -16631,9 +17644,6 @@ func awsRestjson1_deserializeOpErrorListHoursOfOperations(response *smithyhttp.R case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -16650,7 +17660,7 @@ func awsRestjson1_deserializeOpErrorListHoursOfOperations(response *smithyhttp.R } } -func awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(v **ListHoursOfOperationsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListEvaluationFormsOutput(v **ListEvaluationFormsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16663,17 +17673,17 @@ func awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(v **ListHours return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListHoursOfOperationsOutput + var sv *ListEvaluationFormsOutput if *v == nil { - sv = &ListHoursOfOperationsOutput{} + sv = &ListEvaluationFormsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "HoursOfOperationSummaryList": - if err := awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(&sv.HoursOfOperationSummaryList, value); err != nil { + case "EvaluationFormSummaryList": + if err := awsRestjson1_deserializeDocumentEvaluationFormSummaryList(&sv.EvaluationFormSummaryList, value); err != nil { return err } @@ -16695,14 +17705,14 @@ func awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(v **ListHours return nil } -type awsRestjson1_deserializeOpListInstanceAttributes struct { +type awsRestjson1_deserializeOpListEvaluationFormVersions struct { } -func (*awsRestjson1_deserializeOpListInstanceAttributes) ID() string { +func (*awsRestjson1_deserializeOpListEvaluationFormVersions) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListInstanceAttributes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListEvaluationFormVersions) 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) @@ -16716,9 +17726,9 @@ func (m *awsRestjson1_deserializeOpListInstanceAttributes) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListInstanceAttributes(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListEvaluationFormVersions(response, &metadata) } - output := &ListInstanceAttributesOutput{} + output := &ListEvaluationFormVersionsOutput{} out.Result = output var buff [1024]byte @@ -16739,7 +17749,7 @@ func (m *awsRestjson1_deserializeOpListInstanceAttributes) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16752,7 +17762,7 @@ func (m *awsRestjson1_deserializeOpListInstanceAttributes) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListInstanceAttributes(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListEvaluationFormVersions(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)} @@ -16799,9 +17809,6 @@ func awsRestjson1_deserializeOpErrorListInstanceAttributes(response *smithyhttp. case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -16818,7 +17825,7 @@ func awsRestjson1_deserializeOpErrorListInstanceAttributes(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(v **ListInstanceAttributesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListEvaluationFormVersionsOutput(v **ListEvaluationFormVersionsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -16831,17 +17838,17 @@ func awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(v **ListInst return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListInstanceAttributesOutput + var sv *ListEvaluationFormVersionsOutput if *v == nil { - sv = &ListInstanceAttributesOutput{} + sv = &ListEvaluationFormVersionsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "Attributes": - if err := awsRestjson1_deserializeDocumentAttributesList(&sv.Attributes, value); err != nil { + case "EvaluationFormVersionSummaryList": + if err := awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(&sv.EvaluationFormVersionSummaryList, value); err != nil { return err } @@ -16863,14 +17870,14 @@ func awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(v **ListInst return nil } -type awsRestjson1_deserializeOpListInstances struct { +type awsRestjson1_deserializeOpListFlowAssociations struct { } -func (*awsRestjson1_deserializeOpListInstances) ID() string { +func (*awsRestjson1_deserializeOpListFlowAssociations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListInstances) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListFlowAssociations) 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) @@ -16884,9 +17891,9 @@ func (m *awsRestjson1_deserializeOpListInstances) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListInstances(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListFlowAssociations(response, &metadata) } - output := &ListInstancesOutput{} + output := &ListFlowAssociationsOutput{} out.Result = output var buff [1024]byte @@ -16907,7 +17914,7 @@ func (m *awsRestjson1_deserializeOpListInstances) HandleDeserialize(ctx context. return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListInstancesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListFlowAssociationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -16920,7 +17927,7 @@ func (m *awsRestjson1_deserializeOpListInstances) HandleDeserialize(ctx context. return out, metadata, err } -func awsRestjson1_deserializeOpErrorListInstances(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListFlowAssociations(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)} @@ -16961,165 +17968,9 @@ func awsRestjson1_deserializeOpErrorListInstances(response *smithyhttp.Response, } switch { - case strings.EqualFold("InternalServiceException", errorCode): - return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -func awsRestjson1_deserializeOpDocumentListInstancesOutput(v **ListInstancesOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *ListInstancesOutput - if *v == nil { - sv = &ListInstancesOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "InstanceSummaryList": - if err := awsRestjson1_deserializeDocumentInstanceSummaryList(&sv.InstanceSummaryList, 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_deserializeOpListInstanceStorageConfigs struct { -} - -func (*awsRestjson1_deserializeOpListInstanceStorageConfigs) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpListInstanceStorageConfigs) 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_deserializeOpErrorListInstanceStorageConfigs(response, &metadata) - } - output := &ListInstanceStorageConfigsOutput{} - 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_deserializeOpDocumentListInstanceStorageConfigsOutput(&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_deserializeOpErrorListInstanceStorageConfigs(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 - } + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - switch { case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -17145,7 +17996,7 @@ func awsRestjson1_deserializeOpErrorListInstanceStorageConfigs(response *smithyh } } -func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **ListInstanceStorageConfigsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListFlowAssociationsOutput(v **ListFlowAssociationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17158,15 +18009,20 @@ func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **List return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListInstanceStorageConfigsOutput + var sv *ListFlowAssociationsOutput if *v == nil { - sv = &ListInstanceStorageConfigsOutput{} + sv = &ListFlowAssociationsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "FlowAssociationSummaryList": + if err := awsRestjson1_deserializeDocumentFlowAssociationSummaryList(&sv.FlowAssociationSummaryList, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -17176,11 +18032,6 @@ func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **List sv.NextToken = ptr.String(jtv) } - case "StorageConfigs": - if err := awsRestjson1_deserializeDocumentInstanceStorageConfigs(&sv.StorageConfigs, value); err != nil { - return err - } - default: _, _ = key, value @@ -17190,14 +18041,14 @@ func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **List return nil } -type awsRestjson1_deserializeOpListIntegrationAssociations struct { +type awsRestjson1_deserializeOpListHoursOfOperations struct { } -func (*awsRestjson1_deserializeOpListIntegrationAssociations) ID() string { +func (*awsRestjson1_deserializeOpListHoursOfOperations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListIntegrationAssociations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListHoursOfOperations) 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) @@ -17211,9 +18062,9 @@ func (m *awsRestjson1_deserializeOpListIntegrationAssociations) HandleDeserializ } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListIntegrationAssociations(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListHoursOfOperations(response, &metadata) } - output := &ListIntegrationAssociationsOutput{} + output := &ListHoursOfOperationsOutput{} out.Result = output var buff [1024]byte @@ -17234,7 +18085,7 @@ func (m *awsRestjson1_deserializeOpListIntegrationAssociations) HandleDeserializ return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -17247,7 +18098,7 @@ func (m *awsRestjson1_deserializeOpListIntegrationAssociations) HandleDeserializ return out, metadata, err } -func awsRestjson1_deserializeOpErrorListIntegrationAssociations(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListHoursOfOperations(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)} @@ -17291,6 +18142,9 @@ func awsRestjson1_deserializeOpErrorListIntegrationAssociations(response *smithy case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -17310,7 +18164,7 @@ func awsRestjson1_deserializeOpErrorListIntegrationAssociations(response *smithy } } -func awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(v **ListIntegrationAssociationsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(v **ListHoursOfOperationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17323,17 +18177,17 @@ func awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(v **Lis return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListIntegrationAssociationsOutput + var sv *ListHoursOfOperationsOutput if *v == nil { - sv = &ListIntegrationAssociationsOutput{} + sv = &ListHoursOfOperationsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "IntegrationAssociationSummaryList": - if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(&sv.IntegrationAssociationSummaryList, value); err != nil { + case "HoursOfOperationSummaryList": + if err := awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(&sv.HoursOfOperationSummaryList, value); err != nil { return err } @@ -17355,14 +18209,14 @@ func awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(v **Lis return nil } -type awsRestjson1_deserializeOpListLambdaFunctions struct { +type awsRestjson1_deserializeOpListInstanceAttributes struct { } -func (*awsRestjson1_deserializeOpListLambdaFunctions) ID() string { +func (*awsRestjson1_deserializeOpListInstanceAttributes) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListLambdaFunctions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListInstanceAttributes) 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) @@ -17376,9 +18230,9 @@ func (m *awsRestjson1_deserializeOpListLambdaFunctions) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListLambdaFunctions(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListInstanceAttributes(response, &metadata) } - output := &ListLambdaFunctionsOutput{} + output := &ListInstanceAttributesOutput{} out.Result = output var buff [1024]byte @@ -17399,7 +18253,7 @@ func (m *awsRestjson1_deserializeOpListLambdaFunctions) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -17412,7 +18266,7 @@ func (m *awsRestjson1_deserializeOpListLambdaFunctions) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListLambdaFunctions(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListInstanceAttributes(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)} @@ -17478,7 +18332,7 @@ func awsRestjson1_deserializeOpErrorListLambdaFunctions(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(v **ListLambdaFunctionsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(v **ListInstanceAttributesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17491,17 +18345,17 @@ func awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(v **ListLambdaF return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListLambdaFunctionsOutput + var sv *ListInstanceAttributesOutput if *v == nil { - sv = &ListLambdaFunctionsOutput{} + sv = &ListInstanceAttributesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "LambdaFunctions": - if err := awsRestjson1_deserializeDocumentFunctionArnsList(&sv.LambdaFunctions, value); err != nil { + case "Attributes": + if err := awsRestjson1_deserializeDocumentAttributesList(&sv.Attributes, value); err != nil { return err } @@ -17523,14 +18377,14 @@ func awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(v **ListLambdaF return nil } -type awsRestjson1_deserializeOpListLexBots struct { +type awsRestjson1_deserializeOpListInstances struct { } -func (*awsRestjson1_deserializeOpListLexBots) ID() string { +func (*awsRestjson1_deserializeOpListInstances) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListLexBots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListInstances) 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) @@ -17544,9 +18398,9 @@ func (m *awsRestjson1_deserializeOpListLexBots) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListLexBots(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListInstances(response, &metadata) } - output := &ListLexBotsOutput{} + output := &ListInstancesOutput{} out.Result = output var buff [1024]byte @@ -17567,7 +18421,7 @@ func (m *awsRestjson1_deserializeOpListLexBots) HandleDeserialize(ctx context.Co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListLexBotsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListInstancesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -17580,7 +18434,7 @@ func (m *awsRestjson1_deserializeOpListLexBots) HandleDeserialize(ctx context.Co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListLexBots(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListInstances(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)} @@ -17624,18 +18478,9 @@ func awsRestjson1_deserializeOpErrorListLexBots(response *smithyhttp.Response, m case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -17646,7 +18491,7 @@ func awsRestjson1_deserializeOpErrorListLexBots(response *smithyhttp.Response, m } } -func awsRestjson1_deserializeOpDocumentListLexBotsOutput(v **ListLexBotsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListInstancesOutput(v **ListInstancesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17659,17 +18504,17 @@ func awsRestjson1_deserializeOpDocumentListLexBotsOutput(v **ListLexBotsOutput, return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListLexBotsOutput + var sv *ListInstancesOutput if *v == nil { - sv = &ListLexBotsOutput{} + sv = &ListInstancesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "LexBots": - if err := awsRestjson1_deserializeDocumentLexBotsList(&sv.LexBots, value); err != nil { + case "InstanceSummaryList": + if err := awsRestjson1_deserializeDocumentInstanceSummaryList(&sv.InstanceSummaryList, value); err != nil { return err } @@ -17691,14 +18536,14 @@ func awsRestjson1_deserializeOpDocumentListLexBotsOutput(v **ListLexBotsOutput, return nil } -type awsRestjson1_deserializeOpListPhoneNumbers struct { +type awsRestjson1_deserializeOpListInstanceStorageConfigs struct { } -func (*awsRestjson1_deserializeOpListPhoneNumbers) ID() string { +func (*awsRestjson1_deserializeOpListInstanceStorageConfigs) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListPhoneNumbers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListInstanceStorageConfigs) 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) @@ -17712,9 +18557,9 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbers) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListPhoneNumbers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListInstanceStorageConfigs(response, &metadata) } - output := &ListPhoneNumbersOutput{} + output := &ListInstanceStorageConfigsOutput{} out.Result = output var buff [1024]byte @@ -17735,7 +18580,7 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbers) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -17748,7 +18593,7 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbers) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorListPhoneNumbers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListInstanceStorageConfigs(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)} @@ -17814,7 +18659,7 @@ func awsRestjson1_deserializeOpErrorListPhoneNumbers(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **ListInstanceStorageConfigsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17827,9 +18672,9 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListPhoneNumbersOutput + var sv *ListInstanceStorageConfigsOutput if *v == nil { - sv = &ListPhoneNumbersOutput{} + sv = &ListInstanceStorageConfigsOutput{} } else { sv = *v } @@ -17845,8 +18690,8 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbe sv.NextToken = ptr.String(jtv) } - case "PhoneNumberSummaryList": - if err := awsRestjson1_deserializeDocumentPhoneNumberSummaryList(&sv.PhoneNumberSummaryList, value); err != nil { + case "StorageConfigs": + if err := awsRestjson1_deserializeDocumentInstanceStorageConfigs(&sv.StorageConfigs, value); err != nil { return err } @@ -17859,14 +18704,14 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbe return nil } -type awsRestjson1_deserializeOpListPhoneNumbersV2 struct { +type awsRestjson1_deserializeOpListIntegrationAssociations struct { } -func (*awsRestjson1_deserializeOpListPhoneNumbersV2) ID() string { +func (*awsRestjson1_deserializeOpListIntegrationAssociations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListPhoneNumbersV2) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListIntegrationAssociations) 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) @@ -17880,9 +18725,9 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbersV2) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListPhoneNumbersV2(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListIntegrationAssociations(response, &metadata) } - output := &ListPhoneNumbersV2Output{} + output := &ListIntegrationAssociationsOutput{} out.Result = output var buff [1024]byte @@ -17903,7 +18748,7 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbersV2) HandleDeserialize(ctx con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(&output, shape) + err = awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -17916,7 +18761,7 @@ func (m *awsRestjson1_deserializeOpListPhoneNumbersV2) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeOpErrorListPhoneNumbersV2(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListIntegrationAssociations(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)} @@ -17957,14 +18802,11 @@ func awsRestjson1_deserializeOpErrorListPhoneNumbersV2(response *smithyhttp.Resp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -17982,7 +18824,7 @@ func awsRestjson1_deserializeOpErrorListPhoneNumbersV2(response *smithyhttp.Resp } } -func awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(v **ListPhoneNumbersV2Output, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(v **ListIntegrationAssociationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -17995,17 +18837,17 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(v **ListPhoneNum return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListPhoneNumbersV2Output + var sv *ListIntegrationAssociationsOutput if *v == nil { - sv = &ListPhoneNumbersV2Output{} + sv = &ListIntegrationAssociationsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ListPhoneNumbersSummaryList": - if err := awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(&sv.ListPhoneNumbersSummaryList, value); err != nil { + case "IntegrationAssociationSummaryList": + if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(&sv.IntegrationAssociationSummaryList, value); err != nil { return err } @@ -18013,7 +18855,7 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(v **ListPhoneNum if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected LargeNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } @@ -18027,14 +18869,14 @@ func awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(v **ListPhoneNum return nil } -type awsRestjson1_deserializeOpListPrompts struct { +type awsRestjson1_deserializeOpListLambdaFunctions struct { } -func (*awsRestjson1_deserializeOpListPrompts) ID() string { +func (*awsRestjson1_deserializeOpListLambdaFunctions) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListPrompts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListLambdaFunctions) 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) @@ -18048,9 +18890,9 @@ func (m *awsRestjson1_deserializeOpListPrompts) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListPrompts(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListLambdaFunctions(response, &metadata) } - output := &ListPromptsOutput{} + output := &ListLambdaFunctionsOutput{} out.Result = output var buff [1024]byte @@ -18071,7 +18913,7 @@ func (m *awsRestjson1_deserializeOpListPrompts) HandleDeserialize(ctx context.Co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListPromptsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18084,7 +18926,7 @@ func (m *awsRestjson1_deserializeOpListPrompts) HandleDeserialize(ctx context.Co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListPrompts(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListLambdaFunctions(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)} @@ -18150,7 +18992,7 @@ func awsRestjson1_deserializeOpErrorListPrompts(response *smithyhttp.Response, m } } -func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(v **ListLambdaFunctionsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -18163,15 +19005,20 @@ func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListPromptsOutput + var sv *ListLambdaFunctionsOutput if *v == nil { - sv = &ListPromptsOutput{} + sv = &ListLambdaFunctionsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "LambdaFunctions": + if err := awsRestjson1_deserializeDocumentFunctionArnsList(&sv.LambdaFunctions, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -18181,11 +19028,6 @@ func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, sv.NextToken = ptr.String(jtv) } - case "PromptSummaryList": - if err := awsRestjson1_deserializeDocumentPromptSummaryList(&sv.PromptSummaryList, value); err != nil { - return err - } - default: _, _ = key, value @@ -18195,14 +19037,14 @@ func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, return nil } -type awsRestjson1_deserializeOpListQueueQuickConnects struct { +type awsRestjson1_deserializeOpListLexBots struct { } -func (*awsRestjson1_deserializeOpListQueueQuickConnects) ID() string { +func (*awsRestjson1_deserializeOpListLexBots) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListQueueQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListLexBots) 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) @@ -18216,9 +19058,9 @@ func (m *awsRestjson1_deserializeOpListQueueQuickConnects) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListQueueQuickConnects(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListLexBots(response, &metadata) } - output := &ListQueueQuickConnectsOutput{} + output := &ListLexBotsOutput{} out.Result = output var buff [1024]byte @@ -18239,7 +19081,7 @@ func (m *awsRestjson1_deserializeOpListQueueQuickConnects) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListLexBotsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18252,7 +19094,7 @@ func (m *awsRestjson1_deserializeOpListQueueQuickConnects) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorListQueueQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListLexBots(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)} @@ -18318,7 +19160,7 @@ func awsRestjson1_deserializeOpErrorListQueueQuickConnects(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueueQuickConnectsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListLexBotsOutput(v **ListLexBotsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -18331,38 +19173,18 @@ func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListQueueQuickConnectsOutput + var sv *ListLexBotsOutput if *v == nil { - sv = &ListQueueQuickConnectsOutput{} + sv = &ListLexBotsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "LastModifiedRegion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } + case "LexBots": + if err := awsRestjson1_deserializeDocumentLexBotsList(&sv.LexBots, value); err != nil { + return err } case "NextToken": @@ -18374,11 +19196,6 @@ func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueu sv.NextToken = ptr.String(jtv) } - case "QuickConnectSummaryList": - if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { - return err - } - default: _, _ = key, value @@ -18388,14 +19205,14 @@ func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueu return nil } -type awsRestjson1_deserializeOpListQueues struct { +type awsRestjson1_deserializeOpListPhoneNumbers struct { } -func (*awsRestjson1_deserializeOpListQueues) ID() string { +func (*awsRestjson1_deserializeOpListPhoneNumbers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListPhoneNumbers) 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) @@ -18409,9 +19226,9 @@ func (m *awsRestjson1_deserializeOpListQueues) HandleDeserialize(ctx context.Con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListQueues(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListPhoneNumbers(response, &metadata) } - output := &ListQueuesOutput{} + output := &ListPhoneNumbersOutput{} out.Result = output var buff [1024]byte @@ -18432,7 +19249,7 @@ func (m *awsRestjson1_deserializeOpListQueues) HandleDeserialize(ctx context.Con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListQueuesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18445,7 +19262,7 @@ func (m *awsRestjson1_deserializeOpListQueues) HandleDeserialize(ctx context.Con return out, metadata, err } -func awsRestjson1_deserializeOpErrorListQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListPhoneNumbers(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)} @@ -18511,7 +19328,7 @@ func awsRestjson1_deserializeOpErrorListQueues(response *smithyhttp.Response, me } } -func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -18524,9 +19341,9 @@ func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListQueuesOutput + var sv *ListPhoneNumbersOutput if *v == nil { - sv = &ListQueuesOutput{} + sv = &ListPhoneNumbersOutput{} } else { sv = *v } @@ -18542,8 +19359,8 @@ func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, va sv.NextToken = ptr.String(jtv) } - case "QueueSummaryList": - if err := awsRestjson1_deserializeDocumentQueueSummaryList(&sv.QueueSummaryList, value); err != nil { + case "PhoneNumberSummaryList": + if err := awsRestjson1_deserializeDocumentPhoneNumberSummaryList(&sv.PhoneNumberSummaryList, value); err != nil { return err } @@ -18556,14 +19373,14 @@ func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, va return nil } -type awsRestjson1_deserializeOpListQuickConnects struct { +type awsRestjson1_deserializeOpListPhoneNumbersV2 struct { } -func (*awsRestjson1_deserializeOpListQuickConnects) ID() string { +func (*awsRestjson1_deserializeOpListPhoneNumbersV2) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListPhoneNumbersV2) 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) @@ -18577,9 +19394,9 @@ func (m *awsRestjson1_deserializeOpListQuickConnects) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListQuickConnects(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListPhoneNumbersV2(response, &metadata) } - output := &ListQuickConnectsOutput{} + output := &ListPhoneNumbersV2Output{} out.Result = output var buff [1024]byte @@ -18600,7 +19417,7 @@ func (m *awsRestjson1_deserializeOpListQuickConnects) HandleDeserialize(ctx cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18613,7 +19430,7 @@ func (m *awsRestjson1_deserializeOpListQuickConnects) HandleDeserialize(ctx cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListPhoneNumbersV2(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)} @@ -18654,15 +19471,15 @@ func awsRestjson1_deserializeOpErrorListQuickConnects(response *smithyhttp.Respo } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -18679,7 +19496,7 @@ func awsRestjson1_deserializeOpErrorListQuickConnects(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(v **ListQuickConnectsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListPhoneNumbersV2Output(v **ListPhoneNumbersV2Output, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -18692,29 +19509,29 @@ func awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(v **ListQuickConn return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListQuickConnectsOutput + var sv *ListPhoneNumbersV2Output if *v == nil { - sv = &ListQuickConnectsOutput{} + sv = &ListPhoneNumbersV2Output{} } else { sv = *v } for key, value := range shape { switch key { + case "ListPhoneNumbersSummaryList": + if err := awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(&sv.ListPhoneNumbersSummaryList, 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) + return fmt.Errorf("expected LargeNextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } - case "QuickConnectSummaryList": - if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { - return err - } - default: _, _ = key, value @@ -18724,14 +19541,14 @@ func awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(v **ListQuickConn return nil } -type awsRestjson1_deserializeOpListRoutingProfileQueues struct { +type awsRestjson1_deserializeOpListPrompts struct { } -func (*awsRestjson1_deserializeOpListRoutingProfileQueues) ID() string { +func (*awsRestjson1_deserializeOpListPrompts) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListPrompts) 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) @@ -18745,9 +19562,9 @@ func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) HandleDeserialize(c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListPrompts(response, &metadata) } - output := &ListRoutingProfileQueuesOutput{} + output := &ListPromptsOutput{} out.Result = output var buff [1024]byte @@ -18768,7 +19585,7 @@ func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) HandleDeserialize(c return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListPromptsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18781,7 +19598,7 @@ func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) HandleDeserialize(c return out, metadata, err } -func awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListPrompts(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)} @@ -18847,7 +19664,7 @@ func awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response *smithyhtt } } -func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRoutingProfileQueuesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -18860,40 +19677,15 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRo return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListRoutingProfileQueuesOutput + var sv *ListPromptsOutput if *v == nil { - sv = &ListRoutingProfileQueuesOutput{} + sv = &ListPromptsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "LastModifiedRegion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - case "NextToken": if value != nil { jtv, ok := value.(string) @@ -18903,8 +19695,8 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRo sv.NextToken = ptr.String(jtv) } - case "RoutingProfileQueueConfigSummaryList": - if err := awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummaryList(&sv.RoutingProfileQueueConfigSummaryList, value); err != nil { + case "PromptSummaryList": + if err := awsRestjson1_deserializeDocumentPromptSummaryList(&sv.PromptSummaryList, value); err != nil { return err } @@ -18917,14 +19709,14 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRo return nil } -type awsRestjson1_deserializeOpListRoutingProfiles struct { +type awsRestjson1_deserializeOpListQueueQuickConnects struct { } -func (*awsRestjson1_deserializeOpListRoutingProfiles) ID() string { +func (*awsRestjson1_deserializeOpListQueueQuickConnects) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListRoutingProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListQueueQuickConnects) 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) @@ -18938,9 +19730,9 @@ func (m *awsRestjson1_deserializeOpListRoutingProfiles) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfiles(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListQueueQuickConnects(response, &metadata) } - output := &ListRoutingProfilesOutput{} + output := &ListQueueQuickConnectsOutput{} out.Result = output var buff [1024]byte @@ -18961,7 +19753,7 @@ func (m *awsRestjson1_deserializeOpListRoutingProfiles) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -18974,7 +19766,7 @@ func (m *awsRestjson1_deserializeOpListRoutingProfiles) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListRoutingProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListQueueQuickConnects(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)} @@ -19040,7 +19832,7 @@ func awsRestjson1_deserializeOpErrorListRoutingProfiles(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRoutingProfilesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueueQuickConnectsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19053,15 +19845,40 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRouting return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListRoutingProfilesOutput + var sv *ListQueueQuickConnectsOutput if *v == nil { - sv = &ListRoutingProfilesOutput{} + sv = &ListQueueQuickConnectsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -19071,8 +19888,8 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRouting sv.NextToken = ptr.String(jtv) } - case "RoutingProfileSummaryList": - if err := awsRestjson1_deserializeDocumentRoutingProfileSummaryList(&sv.RoutingProfileSummaryList, value); err != nil { + case "QuickConnectSummaryList": + if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { return err } @@ -19085,14 +19902,14 @@ func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRouting return nil } -type awsRestjson1_deserializeOpListRules struct { +type awsRestjson1_deserializeOpListQueues struct { } -func (*awsRestjson1_deserializeOpListRules) ID() string { +func (*awsRestjson1_deserializeOpListQueues) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListRules) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListQueues) 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) @@ -19106,9 +19923,9 @@ func (m *awsRestjson1_deserializeOpListRules) HandleDeserialize(ctx context.Cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListRules(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListQueues(response, &metadata) } - output := &ListRulesOutput{} + output := &ListQueuesOutput{} out.Result = output var buff [1024]byte @@ -19129,7 +19946,7 @@ func (m *awsRestjson1_deserializeOpListRules) HandleDeserialize(ctx context.Cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListRulesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListQueuesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -19142,7 +19959,7 @@ func (m *awsRestjson1_deserializeOpListRules) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListRules(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListQueues(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)} @@ -19183,12 +20000,12 @@ func awsRestjson1_deserializeOpErrorListRules(response *smithyhttp.Response, met } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -19208,7 +20025,7 @@ func awsRestjson1_deserializeOpErrorListRules(response *smithyhttp.Response, met } } -func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19221,9 +20038,9 @@ func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListRulesOutput + var sv *ListQueuesOutput if *v == nil { - sv = &ListRulesOutput{} + sv = &ListQueuesOutput{} } else { sv = *v } @@ -19239,8 +20056,8 @@ func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, valu sv.NextToken = ptr.String(jtv) } - case "RuleSummaryList": - if err := awsRestjson1_deserializeDocumentRuleSummaryList(&sv.RuleSummaryList, value); err != nil { + case "QueueSummaryList": + if err := awsRestjson1_deserializeDocumentQueueSummaryList(&sv.QueueSummaryList, value); err != nil { return err } @@ -19253,14 +20070,14 @@ func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, valu return nil } -type awsRestjson1_deserializeOpListSecurityKeys struct { +type awsRestjson1_deserializeOpListQuickConnects struct { } -func (*awsRestjson1_deserializeOpListSecurityKeys) ID() string { +func (*awsRestjson1_deserializeOpListQuickConnects) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListSecurityKeys) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListQuickConnects) 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) @@ -19274,9 +20091,9 @@ func (m *awsRestjson1_deserializeOpListSecurityKeys) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListSecurityKeys(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListQuickConnects(response, &metadata) } - output := &ListSecurityKeysOutput{} + output := &ListQuickConnectsOutput{} out.Result = output var buff [1024]byte @@ -19297,7 +20114,7 @@ func (m *awsRestjson1_deserializeOpListSecurityKeys) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -19310,7 +20127,7 @@ func (m *awsRestjson1_deserializeOpListSecurityKeys) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorListSecurityKeys(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListQuickConnects(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)} @@ -19376,7 +20193,7 @@ func awsRestjson1_deserializeOpErrorListSecurityKeys(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKeysOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(v **ListQuickConnectsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19389,9 +20206,9 @@ func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListSecurityKeysOutput + var sv *ListQuickConnectsOutput if *v == nil { - sv = &ListSecurityKeysOutput{} + sv = &ListQuickConnectsOutput{} } else { sv = *v } @@ -19407,8 +20224,8 @@ func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKe sv.NextToken = ptr.String(jtv) } - case "SecurityKeys": - if err := awsRestjson1_deserializeDocumentSecurityKeysList(&sv.SecurityKeys, value); err != nil { + case "QuickConnectSummaryList": + if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { return err } @@ -19421,14 +20238,14 @@ func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKe return nil } -type awsRestjson1_deserializeOpListSecurityProfileApplications struct { +type awsRestjson1_deserializeOpListRealtimeContactAnalysisSegmentsV2 struct { } -func (*awsRestjson1_deserializeOpListSecurityProfileApplications) ID() string { +func (*awsRestjson1_deserializeOpListRealtimeContactAnalysisSegmentsV2) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListSecurityProfileApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListRealtimeContactAnalysisSegmentsV2) 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) @@ -19442,9 +20259,9 @@ func (m *awsRestjson1_deserializeOpListSecurityProfileApplications) HandleDeseri } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfileApplications(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListRealtimeContactAnalysisSegmentsV2(response, &metadata) } - output := &ListSecurityProfileApplicationsOutput{} + output := &ListRealtimeContactAnalysisSegmentsV2Output{} out.Result = output var buff [1024]byte @@ -19465,7 +20282,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfileApplications) HandleDeseri return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListRealtimeContactAnalysisSegmentsV2Output(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -19478,7 +20295,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfileApplications) HandleDeseri return out, metadata, err } -func awsRestjson1_deserializeOpErrorListSecurityProfileApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListRealtimeContactAnalysisSegmentsV2(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)} @@ -19519,15 +20336,18 @@ func awsRestjson1_deserializeOpErrorListSecurityProfileApplications(response *sm } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("OutputTypeNotFoundException", errorCode): + return awsRestjson1_deserializeErrorOutputTypeNotFoundException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -19544,7 +20364,7 @@ func awsRestjson1_deserializeOpErrorListSecurityProfileApplications(response *sm } } -func awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(v **ListSecurityProfileApplicationsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListRealtimeContactAnalysisSegmentsV2Output(v **ListRealtimeContactAnalysisSegmentsV2Output, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19557,52 +20377,45 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(v * return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListSecurityProfileApplicationsOutput + var sv *ListRealtimeContactAnalysisSegmentsV2Output if *v == nil { - sv = &ListSecurityProfileApplicationsOutput{} + sv = &ListRealtimeContactAnalysisSegmentsV2Output{} } else { sv = *v } for key, value := range shape { switch key { - case "Applications": - if err := awsRestjson1_deserializeDocumentApplications(&sv.Applications, value); err != nil { - return err - } - - case "LastModifiedRegion": + case "Channel": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisSupportedChannel to be of type string, got %T instead", value) } - sv.LastModifiedRegion = ptr.String(jtv) + sv.Channel = types.RealTimeContactAnalysisSupportedChannel(jtv) } - case "LastModifiedTime": + case "NextToken": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LargeNextToken to be of type string, got %T instead", value) } + sv.NextToken = ptr.String(jtv) } - case "NextToken": + case "Segments": + if err := awsRestjson1_deserializeDocumentRealtimeContactAnalysisSegments(&sv.Segments, value); err != nil { + return err + } + + case "Status": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisStatus to be of type string, got %T instead", value) } - sv.NextToken = ptr.String(jtv) + sv.Status = types.RealTimeContactAnalysisStatus(jtv) } default: @@ -19614,14 +20427,14 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(v * return nil } -type awsRestjson1_deserializeOpListSecurityProfilePermissions struct { +type awsRestjson1_deserializeOpListRoutingProfileQueues struct { } -func (*awsRestjson1_deserializeOpListSecurityProfilePermissions) ID() string { +func (*awsRestjson1_deserializeOpListRoutingProfileQueues) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListSecurityProfilePermissions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) 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) @@ -19635,9 +20448,9 @@ func (m *awsRestjson1_deserializeOpListSecurityProfilePermissions) HandleDeseria } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfilePermissions(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response, &metadata) } - output := &ListSecurityProfilePermissionsOutput{} + output := &ListRoutingProfileQueuesOutput{} out.Result = output var buff [1024]byte @@ -19658,7 +20471,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfilePermissions) HandleDeseria return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -19671,7 +20484,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfilePermissions) HandleDeseria return out, metadata, err } -func awsRestjson1_deserializeOpErrorListSecurityProfilePermissions(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListRoutingProfileQueues(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)} @@ -19737,7 +20550,7 @@ func awsRestjson1_deserializeOpErrorListSecurityProfilePermissions(response *smi } } -func awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(v **ListSecurityProfilePermissionsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRoutingProfileQueuesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19750,9 +20563,9 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(v ** return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListSecurityProfilePermissionsOutput + var sv *ListRoutingProfileQueuesOutput if *v == nil { - sv = &ListSecurityProfilePermissionsOutput{} + sv = &ListRoutingProfileQueuesOutput{} } else { sv = *v } @@ -19793,8 +20606,8 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(v ** sv.NextToken = ptr.String(jtv) } - case "Permissions": - if err := awsRestjson1_deserializeDocumentPermissionsList(&sv.Permissions, value); err != nil { + case "RoutingProfileQueueConfigSummaryList": + if err := awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummaryList(&sv.RoutingProfileQueueConfigSummaryList, value); err != nil { return err } @@ -19807,14 +20620,14 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(v ** return nil } -type awsRestjson1_deserializeOpListSecurityProfiles struct { +type awsRestjson1_deserializeOpListRoutingProfiles struct { } -func (*awsRestjson1_deserializeOpListSecurityProfiles) ID() string { +func (*awsRestjson1_deserializeOpListRoutingProfiles) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListSecurityProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListRoutingProfiles) 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) @@ -19828,9 +20641,9 @@ func (m *awsRestjson1_deserializeOpListSecurityProfiles) HandleDeserialize(ctx c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfiles(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfiles(response, &metadata) } - output := &ListSecurityProfilesOutput{} + output := &ListRoutingProfilesOutput{} out.Result = output var buff [1024]byte @@ -19851,7 +20664,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfiles) HandleDeserialize(ctx c return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -19864,7 +20677,7 @@ func (m *awsRestjson1_deserializeOpListSecurityProfiles) HandleDeserialize(ctx c return out, metadata, err } -func awsRestjson1_deserializeOpErrorListSecurityProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListRoutingProfiles(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)} @@ -19930,7 +20743,7 @@ func awsRestjson1_deserializeOpErrorListSecurityProfiles(response *smithyhttp.Re } } -func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecurityProfilesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRoutingProfilesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -19943,9 +20756,9 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecuri return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListSecurityProfilesOutput + var sv *ListRoutingProfilesOutput if *v == nil { - sv = &ListSecurityProfilesOutput{} + sv = &ListRoutingProfilesOutput{} } else { sv = *v } @@ -19961,8 +20774,8 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecuri sv.NextToken = ptr.String(jtv) } - case "SecurityProfileSummaryList": - if err := awsRestjson1_deserializeDocumentSecurityProfileSummaryList(&sv.SecurityProfileSummaryList, value); err != nil { + case "RoutingProfileSummaryList": + if err := awsRestjson1_deserializeDocumentRoutingProfileSummaryList(&sv.RoutingProfileSummaryList, value); err != nil { return err } @@ -19975,14 +20788,14 @@ func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecuri return nil } -type awsRestjson1_deserializeOpListTagsForResource struct { +type awsRestjson1_deserializeOpListRules struct { } -func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { +func (*awsRestjson1_deserializeOpListRules) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListRules) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -19996,9 +20809,9 @@ func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListRules(response, &metadata) } - output := &ListTagsForResourceOutput{} + output := &ListRulesOutput{} out.Result = output var buff [1024]byte @@ -20019,7 +20832,7 @@ func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListRulesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20032,7 +20845,7 @@ func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListRules(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -20073,12 +20886,12 @@ func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Res } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -20098,7 +20911,7 @@ func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20111,17 +20924,26 @@ func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsFor return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListTagsForResourceOutput + var sv *ListRulesOutput if *v == nil { - sv = &ListTagsForResourceOutput{} + sv = &ListRulesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + 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 "RuleSummaryList": + if err := awsRestjson1_deserializeDocumentRuleSummaryList(&sv.RuleSummaryList, value); err != nil { return err } @@ -20134,14 +20956,14 @@ func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsFor return nil } -type awsRestjson1_deserializeOpListTaskTemplates struct { +type awsRestjson1_deserializeOpListSecurityKeys struct { } -func (*awsRestjson1_deserializeOpListTaskTemplates) ID() string { +func (*awsRestjson1_deserializeOpListSecurityKeys) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListTaskTemplates) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListSecurityKeys) 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) @@ -20155,9 +20977,9 @@ func (m *awsRestjson1_deserializeOpListTaskTemplates) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListTaskTemplates(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListSecurityKeys(response, &metadata) } - output := &ListTaskTemplatesOutput{} + output := &ListSecurityKeysOutput{} out.Result = output var buff [1024]byte @@ -20178,7 +21000,7 @@ func (m *awsRestjson1_deserializeOpListTaskTemplates) HandleDeserialize(ctx cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20191,7 +21013,7 @@ func (m *awsRestjson1_deserializeOpListTaskTemplates) HandleDeserialize(ctx cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListTaskTemplates(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListSecurityKeys(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)} @@ -20257,7 +21079,7 @@ func awsRestjson1_deserializeOpErrorListTaskTemplates(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(v **ListTaskTemplatesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKeysOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20270,9 +21092,9 @@ func awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(v **ListTaskTempl return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListTaskTemplatesOutput + var sv *ListSecurityKeysOutput if *v == nil { - sv = &ListTaskTemplatesOutput{} + sv = &ListSecurityKeysOutput{} } else { sv = *v } @@ -20288,8 +21110,8 @@ func awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(v **ListTaskTempl sv.NextToken = ptr.String(jtv) } - case "TaskTemplates": - if err := awsRestjson1_deserializeDocumentTaskTemplateList(&sv.TaskTemplates, value); err != nil { + case "SecurityKeys": + if err := awsRestjson1_deserializeDocumentSecurityKeysList(&sv.SecurityKeys, value); err != nil { return err } @@ -20302,14 +21124,14 @@ func awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(v **ListTaskTempl return nil } -type awsRestjson1_deserializeOpListTrafficDistributionGroups struct { +type awsRestjson1_deserializeOpListSecurityProfileApplications struct { } -func (*awsRestjson1_deserializeOpListTrafficDistributionGroups) ID() string { +func (*awsRestjson1_deserializeOpListSecurityProfileApplications) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListTrafficDistributionGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListSecurityProfileApplications) 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) @@ -20323,9 +21145,9 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroups) HandleDeserial } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfileApplications(response, &metadata) } - output := &ListTrafficDistributionGroupsOutput{} + output := &ListSecurityProfileApplicationsOutput{} out.Result = output var buff [1024]byte @@ -20346,7 +21168,7 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroups) HandleDeserial return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20359,7 +21181,7 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroups) HandleDeserial return out, metadata, err } -func awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListSecurityProfileApplications(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)} @@ -20400,15 +21222,18 @@ func awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(response *smit } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -20422,7 +21247,7 @@ func awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(response *smit } } -func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(v **ListTrafficDistributionGroupsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListSecurityProfileApplicationsOutput(v **ListSecurityProfileApplicationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20435,15 +21260,45 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(v **L return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListTrafficDistributionGroupsOutput + var sv *ListSecurityProfileApplicationsOutput if *v == nil { - sv = &ListTrafficDistributionGroupsOutput{} + sv = &ListSecurityProfileApplicationsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "Applications": + if err := awsRestjson1_deserializeDocumentApplications(&sv.Applications, value); err != nil { + return err + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -20453,11 +21308,6 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(v **L sv.NextToken = ptr.String(jtv) } - case "TrafficDistributionGroupSummaryList": - if err := awsRestjson1_deserializeDocumentTrafficDistributionGroupSummaryList(&sv.TrafficDistributionGroupSummaryList, value); err != nil { - return err - } - default: _, _ = key, value @@ -20467,14 +21317,14 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(v **L return nil } -type awsRestjson1_deserializeOpListTrafficDistributionGroupUsers struct { +type awsRestjson1_deserializeOpListSecurityProfilePermissions struct { } -func (*awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) ID() string { +func (*awsRestjson1_deserializeOpListSecurityProfilePermissions) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListSecurityProfilePermissions) 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) @@ -20488,9 +21338,9 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) HandleDese } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfilePermissions(response, &metadata) } - output := &ListTrafficDistributionGroupUsersOutput{} + output := &ListSecurityProfilePermissionsOutput{} out.Result = output var buff [1024]byte @@ -20511,7 +21361,7 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) HandleDese return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20524,7 +21374,7 @@ func (m *awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) HandleDese return out, metadata, err } -func awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListSecurityProfilePermissions(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)} @@ -20565,12 +21415,12 @@ func awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(response * } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -20590,7 +21440,7 @@ func awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(response * } } -func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(v **ListTrafficDistributionGroupUsersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListSecurityProfilePermissionsOutput(v **ListSecurityProfilePermissionsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20603,15 +21453,40 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(v return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListTrafficDistributionGroupUsersOutput + var sv *ListSecurityProfilePermissionsOutput if *v == nil { - sv = &ListTrafficDistributionGroupUsersOutput{} + sv = &ListSecurityProfilePermissionsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -20621,8 +21496,8 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(v sv.NextToken = ptr.String(jtv) } - case "TrafficDistributionGroupUserSummaryList": - if err := awsRestjson1_deserializeDocumentTrafficDistributionGroupUserSummaryList(&sv.TrafficDistributionGroupUserSummaryList, value); err != nil { + case "Permissions": + if err := awsRestjson1_deserializeDocumentPermissionsList(&sv.Permissions, value); err != nil { return err } @@ -20635,14 +21510,14 @@ func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(v return nil } -type awsRestjson1_deserializeOpListUseCases struct { +type awsRestjson1_deserializeOpListSecurityProfiles struct { } -func (*awsRestjson1_deserializeOpListUseCases) ID() string { +func (*awsRestjson1_deserializeOpListSecurityProfiles) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListUseCases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListSecurityProfiles) 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) @@ -20656,9 +21531,9 @@ func (m *awsRestjson1_deserializeOpListUseCases) HandleDeserialize(ctx context.C } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListUseCases(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfiles(response, &metadata) } - output := &ListUseCasesOutput{} + output := &ListSecurityProfilesOutput{} out.Result = output var buff [1024]byte @@ -20679,7 +21554,7 @@ func (m *awsRestjson1_deserializeOpListUseCases) HandleDeserialize(ctx context.C return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListUseCasesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20692,7 +21567,7 @@ func (m *awsRestjson1_deserializeOpListUseCases) HandleDeserialize(ctx context.C return out, metadata, err } -func awsRestjson1_deserializeOpErrorListUseCases(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListSecurityProfiles(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)} @@ -20736,6 +21611,9 @@ func awsRestjson1_deserializeOpErrorListUseCases(response *smithyhttp.Response, case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -20755,7 +21633,7 @@ func awsRestjson1_deserializeOpErrorListUseCases(response *smithyhttp.Response, } } -func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecurityProfilesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20768,9 +21646,9 @@ func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListUseCasesOutput + var sv *ListSecurityProfilesOutput if *v == nil { - sv = &ListUseCasesOutput{} + sv = &ListSecurityProfilesOutput{} } else { sv = *v } @@ -20786,8 +21664,8 @@ func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput sv.NextToken = ptr.String(jtv) } - case "UseCaseSummaryList": - if err := awsRestjson1_deserializeDocumentUseCaseSummaryList(&sv.UseCaseSummaryList, value); err != nil { + case "SecurityProfileSummaryList": + if err := awsRestjson1_deserializeDocumentSecurityProfileSummaryList(&sv.SecurityProfileSummaryList, value); err != nil { return err } @@ -20800,14 +21678,14 @@ func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput return nil } -type awsRestjson1_deserializeOpListUserHierarchyGroups struct { +type awsRestjson1_deserializeOpListTagsForResource struct { } -func (*awsRestjson1_deserializeOpListUserHierarchyGroups) ID() string { +func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +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) @@ -20821,9 +21699,9 @@ func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) } - output := &ListUserHierarchyGroupsOutput{} + output := &ListTagsForResourceOutput{} out.Result = output var buff [1024]byte @@ -20844,7 +21722,7 @@ func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) HandleDeserialize(ct return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -20857,7 +21735,7 @@ func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) HandleDeserialize(ct return out, metadata, err } -func awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { +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)} @@ -20923,7 +21801,7 @@ func awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(v **ListUserHierarchyGroupsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -20936,26 +21814,17 @@ func awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(v **ListUse return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListUserHierarchyGroupsOutput + var sv *ListTagsForResourceOutput if *v == nil { - sv = &ListUserHierarchyGroupsOutput{} + sv = &ListTagsForResourceOutput{} } 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 "UserHierarchyGroupSummaryList": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(&sv.UserHierarchyGroupSummaryList, value); err != nil { + case "tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err } @@ -20968,14 +21837,14 @@ func awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(v **ListUse return nil } -type awsRestjson1_deserializeOpListUsers struct { +type awsRestjson1_deserializeOpListTaskTemplates struct { } -func (*awsRestjson1_deserializeOpListUsers) ID() string { +func (*awsRestjson1_deserializeOpListTaskTemplates) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListTaskTemplates) 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) @@ -20989,9 +21858,9 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListUsers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListTaskTemplates(response, &metadata) } - output := &ListUsersOutput{} + output := &ListTaskTemplatesOutput{} out.Result = output var buff [1024]byte @@ -21012,7 +21881,7 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListUsersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -21025,7 +21894,7 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListTaskTemplates(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)} @@ -21091,7 +21960,7 @@ func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, met } } -func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListTaskTemplatesOutput(v **ListTaskTemplatesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21104,9 +21973,9 @@ func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListUsersOutput + var sv *ListTaskTemplatesOutput if *v == nil { - sv = &ListUsersOutput{} + sv = &ListTaskTemplatesOutput{} } else { sv = *v } @@ -21122,8 +21991,8 @@ func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, valu sv.NextToken = ptr.String(jtv) } - case "UserSummaryList": - if err := awsRestjson1_deserializeDocumentUserSummaryList(&sv.UserSummaryList, value); err != nil { + case "TaskTemplates": + if err := awsRestjson1_deserializeDocumentTaskTemplateList(&sv.TaskTemplates, value); err != nil { return err } @@ -21136,14 +22005,14 @@ func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, valu return nil } -type awsRestjson1_deserializeOpListViews struct { +type awsRestjson1_deserializeOpListTrafficDistributionGroups struct { } -func (*awsRestjson1_deserializeOpListViews) ID() string { +func (*awsRestjson1_deserializeOpListTrafficDistributionGroups) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListViews) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListTrafficDistributionGroups) 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) @@ -21157,9 +22026,9 @@ func (m *awsRestjson1_deserializeOpListViews) HandleDeserialize(ctx context.Cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListViews(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(response, &metadata) } - output := &ListViewsOutput{} + output := &ListTrafficDistributionGroupsOutput{} out.Result = output var buff [1024]byte @@ -21180,7 +22049,7 @@ func (m *awsRestjson1_deserializeOpListViews) HandleDeserialize(ctx context.Cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListViewsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -21193,7 +22062,7 @@ func (m *awsRestjson1_deserializeOpListViews) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListViews(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListTrafficDistributionGroups(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)} @@ -21240,17 +22109,11 @@ func awsRestjson1_deserializeOpErrorListViews(response *smithyhttp.Response, met case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("TooManyRequestsException", errorCode): - return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -21262,7 +22125,7 @@ func awsRestjson1_deserializeOpErrorListViews(response *smithyhttp.Response, met } } -func awsRestjson1_deserializeOpDocumentListViewsOutput(v **ListViewsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupsOutput(v **ListTrafficDistributionGroupsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21275,9 +22138,9 @@ func awsRestjson1_deserializeOpDocumentListViewsOutput(v **ListViewsOutput, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListViewsOutput + var sv *ListTrafficDistributionGroupsOutput if *v == nil { - sv = &ListViewsOutput{} + sv = &ListTrafficDistributionGroupsOutput{} } else { sv = *v } @@ -21288,13 +22151,13 @@ func awsRestjson1_deserializeOpDocumentListViewsOutput(v **ListViewsOutput, valu if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ViewsNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } - case "ViewsSummaryList": - if err := awsRestjson1_deserializeDocumentViewsSummaryList(&sv.ViewsSummaryList, value); err != nil { + case "TrafficDistributionGroupSummaryList": + if err := awsRestjson1_deserializeDocumentTrafficDistributionGroupSummaryList(&sv.TrafficDistributionGroupSummaryList, value); err != nil { return err } @@ -21307,14 +22170,14 @@ func awsRestjson1_deserializeOpDocumentListViewsOutput(v **ListViewsOutput, valu return nil } -type awsRestjson1_deserializeOpListViewVersions struct { +type awsRestjson1_deserializeOpListTrafficDistributionGroupUsers struct { } -func (*awsRestjson1_deserializeOpListViewVersions) ID() string { +func (*awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListViewVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListTrafficDistributionGroupUsers) 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) @@ -21328,9 +22191,9 @@ func (m *awsRestjson1_deserializeOpListViewVersions) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListViewVersions(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(response, &metadata) } - output := &ListViewVersionsOutput{} + output := &ListTrafficDistributionGroupUsersOutput{} out.Result = output var buff [1024]byte @@ -21351,7 +22214,7 @@ func (m *awsRestjson1_deserializeOpListViewVersions) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListViewVersionsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -21364,7 +22227,7 @@ func (m *awsRestjson1_deserializeOpListViewVersions) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorListViewVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListTrafficDistributionGroupUsers(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)} @@ -21411,17 +22274,14 @@ func awsRestjson1_deserializeOpErrorListViewVersions(response *smithyhttp.Respon case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TooManyRequestsException", errorCode): - return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -21433,7 +22293,7 @@ func awsRestjson1_deserializeOpErrorListViewVersions(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentListViewVersionsOutput(v **ListViewVersionsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListTrafficDistributionGroupUsersOutput(v **ListTrafficDistributionGroupUsersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21446,9 +22306,9 @@ func awsRestjson1_deserializeOpDocumentListViewVersionsOutput(v **ListViewVersio return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListViewVersionsOutput + var sv *ListTrafficDistributionGroupUsersOutput if *v == nil { - sv = &ListViewVersionsOutput{} + sv = &ListTrafficDistributionGroupUsersOutput{} } else { sv = *v } @@ -21459,13 +22319,13 @@ func awsRestjson1_deserializeOpDocumentListViewVersionsOutput(v **ListViewVersio if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ViewsNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } - case "ViewVersionSummaryList": - if err := awsRestjson1_deserializeDocumentViewVersionSummaryList(&sv.ViewVersionSummaryList, value); err != nil { + case "TrafficDistributionGroupUserSummaryList": + if err := awsRestjson1_deserializeDocumentTrafficDistributionGroupUserSummaryList(&sv.TrafficDistributionGroupUserSummaryList, value); err != nil { return err } @@ -21478,14 +22338,14 @@ func awsRestjson1_deserializeOpDocumentListViewVersionsOutput(v **ListViewVersio return nil } -type awsRestjson1_deserializeOpMonitorContact struct { +type awsRestjson1_deserializeOpListUseCases struct { } -func (*awsRestjson1_deserializeOpMonitorContact) ID() string { +func (*awsRestjson1_deserializeOpListUseCases) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpMonitorContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListUseCases) 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) @@ -21499,9 +22359,9 @@ func (m *awsRestjson1_deserializeOpMonitorContact) HandleDeserialize(ctx context } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorMonitorContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListUseCases(response, &metadata) } - output := &MonitorContactOutput{} + output := &ListUseCasesOutput{} out.Result = output var buff [1024]byte @@ -21522,7 +22382,7 @@ func (m *awsRestjson1_deserializeOpMonitorContact) HandleDeserialize(ctx context return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentMonitorContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListUseCasesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -21535,7 +22395,7 @@ func (m *awsRestjson1_deserializeOpMonitorContact) HandleDeserialize(ctx context return out, metadata, err } -func awsRestjson1_deserializeOpErrorMonitorContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListUseCases(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)} @@ -21576,12 +22436,6 @@ func awsRestjson1_deserializeOpErrorMonitorContact(response *smithyhttp.Response } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -21591,9 +22445,6 @@ func awsRestjson1_deserializeOpErrorMonitorContact(response *smithyhttp.Response 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) @@ -21607,7 +22458,7 @@ func awsRestjson1_deserializeOpErrorMonitorContact(response *smithyhttp.Response } } -func awsRestjson1_deserializeOpDocumentMonitorContactOutput(v **MonitorContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21620,31 +22471,27 @@ func awsRestjson1_deserializeOpDocumentMonitorContactOutput(v **MonitorContactOu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *MonitorContactOutput + var sv *ListUseCasesOutput if *v == nil { - sv = &MonitorContactOutput{} + sv = &ListUseCasesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactArn": + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } - sv.ContactArn = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) } - case "ContactId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) - } - sv.ContactId = ptr.String(jtv) + case "UseCaseSummaryList": + if err := awsRestjson1_deserializeDocumentUseCaseSummaryList(&sv.UseCaseSummaryList, value); err != nil { + return err } default: @@ -21656,14 +22503,14 @@ func awsRestjson1_deserializeOpDocumentMonitorContactOutput(v **MonitorContactOu return nil } -type awsRestjson1_deserializeOpPutUserStatus struct { +type awsRestjson1_deserializeOpListUserHierarchyGroups struct { } -func (*awsRestjson1_deserializeOpPutUserStatus) ID() string { +func (*awsRestjson1_deserializeOpListUserHierarchyGroups) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpPutUserStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) 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) @@ -21677,119 +22524,43 @@ func (m *awsRestjson1_deserializeOpPutUserStatus) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorPutUserStatus(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response, &metadata) } - output := &PutUserStatusOutput{} + output := &ListUserHierarchyGroupsOutput{} out.Result = output - return out, metadata, err -} - -func awsRestjson1_deserializeOpErrorPutUserStatus(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) + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) decoder.UseNumber() - jsonCode, message, err := restjson.GetErrorInfo(decoder) - if err != nil { + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, 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("InternalServiceException", errorCode): - return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsRestjson1_deserializeOpReleasePhoneNumber struct { -} - -func (*awsRestjson1_deserializeOpReleasePhoneNumber) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpReleasePhoneNumber) 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_deserializeOpErrorReleasePhoneNumber(response, &metadata) - } - output := &ReleasePhoneNumberOutput{} - out.Result = output - - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + err = awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorReleasePhoneNumber(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListUserHierarchyGroups(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)} @@ -21830,20 +22601,14 @@ func awsRestjson1_deserializeOpErrorReleasePhoneNumber(response *smithyhttp.Resp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -21861,14 +22626,59 @@ func awsRestjson1_deserializeOpErrorReleasePhoneNumber(response *smithyhttp.Resp } } -type awsRestjson1_deserializeOpReplicateInstance struct { +func awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(v **ListUserHierarchyGroupsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListUserHierarchyGroupsOutput + if *v == nil { + sv = &ListUserHierarchyGroupsOutput{} + } 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 "UserHierarchyGroupSummaryList": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(&sv.UserHierarchyGroupSummaryList, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpReplicateInstance) ID() string { +type awsRestjson1_deserializeOpListUsers struct { +} + +func (*awsRestjson1_deserializeOpListUsers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpReplicateInstance) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -21882,9 +22692,9 @@ func (m *awsRestjson1_deserializeOpReplicateInstance) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorReplicateInstance(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListUsers(response, &metadata) } - output := &ReplicateInstanceOutput{} + output := &ListUsersOutput{} out.Result = output var buff [1024]byte @@ -21905,7 +22715,7 @@ func (m *awsRestjson1_deserializeOpReplicateInstance) HandleDeserialize(ctx cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListUsersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -21918,7 +22728,7 @@ func (m *awsRestjson1_deserializeOpReplicateInstance) HandleDeserialize(ctx cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorReplicateInstance(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -21959,27 +22769,18 @@ func awsRestjson1_deserializeOpErrorReplicateInstance(response *smithyhttp.Respo } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceConflictException", errorCode): - return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ResourceNotReadyException", errorCode): - return awsRestjson1_deserializeErrorResourceNotReadyException(response, errorBody) - - case strings.EqualFold("ServiceQuotaExceededException", errorCode): - return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -21993,7 +22794,7 @@ func awsRestjson1_deserializeOpErrorReplicateInstance(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(v **ReplicateInstanceOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -22006,31 +22807,27 @@ func awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(v **ReplicateInst return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ReplicateInstanceOutput + var sv *ListUsersOutput if *v == nil { - sv = &ReplicateInstanceOutput{} + sv = &ListUsersOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) } - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) + case "UserSummaryList": + if err := awsRestjson1_deserializeDocumentUserSummaryList(&sv.UserSummaryList, value); err != nil { + return err } default: @@ -22042,14 +22839,14 @@ func awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(v **ReplicateInst return nil } -type awsRestjson1_deserializeOpResumeContactRecording struct { +type awsRestjson1_deserializeOpListViews struct { } -func (*awsRestjson1_deserializeOpResumeContactRecording) ID() string { +func (*awsRestjson1_deserializeOpListViews) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpResumeContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListViews) 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) @@ -22063,15 +22860,43 @@ func (m *awsRestjson1_deserializeOpResumeContactRecording) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorResumeContactRecording(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListViews(response, &metadata) } - output := &ResumeContactRecordingOutput{} + output := &ListViewsOutput{} 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_deserializeOpDocumentListViewsOutput(&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_deserializeOpErrorResumeContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListViews(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)} @@ -22112,15 +22937,24 @@ func awsRestjson1_deserializeOpErrorResumeContactRecording(response *smithyhttp. } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -22131,14 +22965,59 @@ func awsRestjson1_deserializeOpErrorResumeContactRecording(response *smithyhttp. } } -type awsRestjson1_deserializeOpSearchAvailablePhoneNumbers struct { +func awsRestjson1_deserializeOpDocumentListViewsOutput(v **ListViewsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListViewsOutput + if *v == nil { + sv = &ListViewsOutput{} + } 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 ViewsNextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "ViewsSummaryList": + if err := awsRestjson1_deserializeDocumentViewsSummaryList(&sv.ViewsSummaryList, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) ID() string { +type awsRestjson1_deserializeOpListViewVersions struct { +} + +func (*awsRestjson1_deserializeOpListViewVersions) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListViewVersions) 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) @@ -22152,9 +23031,9 @@ func (m *awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) HandleDeserializ } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListViewVersions(response, &metadata) } - output := &SearchAvailablePhoneNumbersOutput{} + output := &ListViewVersionsOutput{} out.Result = output var buff [1024]byte @@ -22175,7 +23054,7 @@ func (m *awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) HandleDeserializ return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListViewVersionsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -22188,7 +23067,7 @@ func (m *awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) HandleDeserializ return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListViewVersions(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)} @@ -22238,8 +23117,14 @@ func awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(response *smithy case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -22251,7 +23136,7 @@ func awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(response *smithy } } -func awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(v **SearchAvailablePhoneNumbersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListViewVersionsOutput(v **ListViewVersionsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -22264,29 +23149,29 @@ func awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(v **Sea return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchAvailablePhoneNumbersOutput + var sv *ListViewVersionsOutput if *v == nil { - sv = &SearchAvailablePhoneNumbersOutput{} + sv = &ListViewVersionsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "AvailableNumbersList": - if err := awsRestjson1_deserializeDocumentAvailableNumbersList(&sv.AvailableNumbersList, value); err != nil { - return err - } - case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected LargeNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected ViewsNextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } + case "ViewVersionSummaryList": + if err := awsRestjson1_deserializeDocumentViewVersionSummaryList(&sv.ViewVersionSummaryList, value); err != nil { + return err + } + default: _, _ = key, value @@ -22296,14 +23181,14 @@ func awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(v **Sea return nil } -type awsRestjson1_deserializeOpSearchHoursOfOperations struct { +type awsRestjson1_deserializeOpMonitorContact struct { } -func (*awsRestjson1_deserializeOpSearchHoursOfOperations) ID() string { +func (*awsRestjson1_deserializeOpMonitorContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchHoursOfOperations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpMonitorContact) 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) @@ -22317,9 +23202,9 @@ func (m *awsRestjson1_deserializeOpSearchHoursOfOperations) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchHoursOfOperations(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorMonitorContact(response, &metadata) } - output := &SearchHoursOfOperationsOutput{} + output := &MonitorContactOutput{} out.Result = output var buff [1024]byte @@ -22340,7 +23225,7 @@ func (m *awsRestjson1_deserializeOpSearchHoursOfOperations) HandleDeserialize(ct return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentMonitorContactOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -22353,7 +23238,7 @@ func (m *awsRestjson1_deserializeOpSearchHoursOfOperations) HandleDeserialize(ct return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchHoursOfOperations(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorMonitorContact(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)} @@ -22394,18 +23279,24 @@ func awsRestjson1_deserializeOpErrorSearchHoursOfOperations(response *smithyhttp } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(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) @@ -22419,7 +23310,7 @@ func awsRestjson1_deserializeOpErrorSearchHoursOfOperations(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(v **SearchHoursOfOperationsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentMonitorContactOutput(v **MonitorContactOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -22432,40 +23323,31 @@ func awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(v **SearchH return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchHoursOfOperationsOutput + var sv *MonitorContactOutput if *v == nil { - sv = &SearchHoursOfOperationsOutput{} + sv = &MonitorContactOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ApproximateTotalCount": + case "ContactArn": if value != nil { - jtv, ok := value.(json.Number) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.ApproximateTotalCount = ptr.Int64(i64) - } - - case "HoursOfOperations": - if err := awsRestjson1_deserializeDocumentHoursOfOperationList(&sv.HoursOfOperations, value); err != nil { - return err + sv.ContactArn = ptr.String(jtv) } - case "NextToken": + case "ContactId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) } - sv.NextToken = ptr.String(jtv) + sv.ContactId = ptr.String(jtv) } default: @@ -22477,14 +23359,14 @@ func awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(v **SearchH return nil } -type awsRestjson1_deserializeOpSearchPrompts struct { +type awsRestjson1_deserializeOpPutUserStatus struct { } -func (*awsRestjson1_deserializeOpSearchPrompts) ID() string { +func (*awsRestjson1_deserializeOpPutUserStatus) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchPrompts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpPutUserStatus) 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) @@ -22498,43 +23380,119 @@ func (m *awsRestjson1_deserializeOpSearchPrompts) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchPrompts(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorPutUserStatus(response, &metadata) } - output := &SearchPromptsOutput{} + output := &PutUserStatusOutput{} out.Result = output + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorPutUserStatus(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(response.Body, ringBuffer) - + body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { + 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 out, metadata, err + return err } - err = awsRestjson1_deserializeOpDocumentSearchPromptsOutput(&output, shape) + 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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpReleasePhoneNumber struct { +} + +func (*awsRestjson1_deserializeOpReleasePhoneNumber) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpReleasePhoneNumber) 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 { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) + 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_deserializeOpErrorReleasePhoneNumber(response, &metadata) + } + output := &ReleasePhoneNumberOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), + Err: fmt.Errorf("failed to discard response body, %w", err), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchPrompts(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorReleasePhoneNumber(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)} @@ -22575,14 +23533,20 @@ func awsRestjson1_deserializeOpErrorSearchPrompts(response *smithyhttp.Response, } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -22600,72 +23564,14 @@ func awsRestjson1_deserializeOpErrorSearchPrompts(response *smithyhttp.Response, } } -func awsRestjson1_deserializeOpDocumentSearchPromptsOutput(v **SearchPromptsOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *SearchPromptsOutput - if *v == nil { - sv = &SearchPromptsOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "ApproximateTotalCount": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.ApproximateTotalCount = ptr.Int64(i64) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "Prompts": - if err := awsRestjson1_deserializeDocumentPromptList(&sv.Prompts, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type awsRestjson1_deserializeOpSearchQueues struct { +type awsRestjson1_deserializeOpReplicateInstance struct { } -func (*awsRestjson1_deserializeOpSearchQueues) ID() string { +func (*awsRestjson1_deserializeOpReplicateInstance) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpReplicateInstance) 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) @@ -22679,9 +23585,9 @@ func (m *awsRestjson1_deserializeOpSearchQueues) HandleDeserialize(ctx context.C } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchQueues(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorReplicateInstance(response, &metadata) } - output := &SearchQueuesOutput{} + output := &ReplicateInstanceOutput{} out.Result = output var buff [1024]byte @@ -22702,7 +23608,7 @@ func (m *awsRestjson1_deserializeOpSearchQueues) HandleDeserialize(ctx context.C return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchQueuesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -22715,7 +23621,7 @@ func (m *awsRestjson1_deserializeOpSearchQueues) HandleDeserialize(ctx context.C return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorReplicateInstance(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)} @@ -22756,18 +23662,27 @@ func awsRestjson1_deserializeOpErrorSearchQueues(response *smithyhttp.Response, } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceConflictException", errorCode): + return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ResourceNotReadyException", errorCode): + return awsRestjson1_deserializeErrorResourceNotReadyException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -22781,7 +23696,7 @@ func awsRestjson1_deserializeOpErrorSearchQueues(response *smithyhttp.Response, } } -func awsRestjson1_deserializeOpDocumentSearchQueuesOutput(v **SearchQueuesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentReplicateInstanceOutput(v **ReplicateInstanceOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -22794,40 +23709,31 @@ func awsRestjson1_deserializeOpDocumentSearchQueuesOutput(v **SearchQueuesOutput return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchQueuesOutput + var sv *ReplicateInstanceOutput if *v == nil { - sv = &SearchQueuesOutput{} + sv = &ReplicateInstanceOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ApproximateTotalCount": + case "Arn": if value != nil { - jtv, ok := value.(json.Number) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.ApproximateTotalCount = ptr.Int64(i64) + sv.Arn = ptr.String(jtv) } - case "NextToken": + case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) } - sv.NextToken = ptr.String(jtv) - } - - case "Queues": - if err := awsRestjson1_deserializeDocumentQueueSearchSummaryList(&sv.Queues, value); err != nil { - return err + sv.Id = ptr.String(jtv) } default: @@ -22839,14 +23745,14 @@ func awsRestjson1_deserializeOpDocumentSearchQueuesOutput(v **SearchQueuesOutput return nil } -type awsRestjson1_deserializeOpSearchQuickConnects struct { +type awsRestjson1_deserializeOpResumeContactRecording struct { } -func (*awsRestjson1_deserializeOpSearchQuickConnects) ID() string { +func (*awsRestjson1_deserializeOpResumeContactRecording) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpResumeContactRecording) 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) @@ -22860,43 +23766,15 @@ func (m *awsRestjson1_deserializeOpSearchQuickConnects) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchQuickConnects(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorResumeContactRecording(response, &metadata) } - output := &SearchQuickConnectsOutput{} + output := &ResumeContactRecordingOutput{} 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_deserializeOpDocumentSearchQuickConnectsOutput(&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_deserializeOpErrorSearchQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorResumeContactRecording(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)} @@ -22940,18 +23818,12 @@ func awsRestjson1_deserializeOpErrorSearchQuickConnects(response *smithyhttp.Res case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -22962,72 +23834,14 @@ func awsRestjson1_deserializeOpErrorSearchQuickConnects(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentSearchQuickConnectsOutput(v **SearchQuickConnectsOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *SearchQuickConnectsOutput - if *v == nil { - sv = &SearchQuickConnectsOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "ApproximateTotalCount": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.ApproximateTotalCount = ptr.Int64(i64) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "QuickConnects": - if err := awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(&sv.QuickConnects, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type awsRestjson1_deserializeOpSearchResourceTags struct { +type awsRestjson1_deserializeOpSearchAvailablePhoneNumbers struct { } -func (*awsRestjson1_deserializeOpSearchResourceTags) ID() string { +func (*awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchResourceTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchAvailablePhoneNumbers) 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) @@ -23041,9 +23855,9 @@ func (m *awsRestjson1_deserializeOpSearchResourceTags) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchResourceTags(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(response, &metadata) } - output := &SearchResourceTagsOutput{} + output := &SearchAvailablePhoneNumbersOutput{} out.Result = output var buff [1024]byte @@ -23064,7 +23878,7 @@ func (m *awsRestjson1_deserializeOpSearchResourceTags) HandleDeserialize(ctx con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23077,7 +23891,7 @@ func (m *awsRestjson1_deserializeOpSearchResourceTags) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchResourceTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchAvailablePhoneNumbers(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)} @@ -23118,21 +23932,15 @@ func awsRestjson1_deserializeOpErrorSearchResourceTags(response *smithyhttp.Resp } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - - case strings.EqualFold("MaximumResultReturnedException", errorCode): - return awsRestjson1_deserializeErrorMaximumResultReturnedException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -23146,7 +23954,7 @@ func awsRestjson1_deserializeOpErrorSearchResourceTags(response *smithyhttp.Resp } } -func awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(v **SearchResourceTagsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchAvailablePhoneNumbersOutput(v **SearchAvailablePhoneNumbersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -23159,29 +23967,29 @@ func awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(v **SearchResour return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchResourceTagsOutput + var sv *SearchAvailablePhoneNumbersOutput if *v == nil { - sv = &SearchResourceTagsOutput{} + sv = &SearchAvailablePhoneNumbersOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "AvailableNumbersList": + if err := awsRestjson1_deserializeDocumentAvailableNumbersList(&sv.AvailableNumbersList, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) + return fmt.Errorf("expected LargeNextToken to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } - case "Tags": - if err := awsRestjson1_deserializeDocumentTagsList(&sv.Tags, value); err != nil { - return err - } - default: _, _ = key, value @@ -23191,14 +23999,14 @@ func awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(v **SearchResour return nil } -type awsRestjson1_deserializeOpSearchRoutingProfiles struct { +type awsRestjson1_deserializeOpSearchHoursOfOperations struct { } -func (*awsRestjson1_deserializeOpSearchRoutingProfiles) ID() string { +func (*awsRestjson1_deserializeOpSearchHoursOfOperations) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchRoutingProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchHoursOfOperations) 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) @@ -23212,9 +24020,9 @@ func (m *awsRestjson1_deserializeOpSearchRoutingProfiles) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchRoutingProfiles(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchHoursOfOperations(response, &metadata) } - output := &SearchRoutingProfilesOutput{} + output := &SearchHoursOfOperationsOutput{} out.Result = output var buff [1024]byte @@ -23235,7 +24043,7 @@ func (m *awsRestjson1_deserializeOpSearchRoutingProfiles) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23248,7 +24056,7 @@ func (m *awsRestjson1_deserializeOpSearchRoutingProfiles) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchRoutingProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchHoursOfOperations(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)} @@ -23314,7 +24122,7 @@ func awsRestjson1_deserializeOpErrorSearchRoutingProfiles(response *smithyhttp.R } } -func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRoutingProfilesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchHoursOfOperationsOutput(v **SearchHoursOfOperationsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -23327,9 +24135,9 @@ func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRou return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchRoutingProfilesOutput + var sv *SearchHoursOfOperationsOutput if *v == nil { - sv = &SearchRoutingProfilesOutput{} + sv = &SearchHoursOfOperationsOutput{} } else { sv = *v } @@ -23349,6 +24157,11 @@ func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRou sv.ApproximateTotalCount = ptr.Int64(i64) } + case "HoursOfOperations": + if err := awsRestjson1_deserializeDocumentHoursOfOperationList(&sv.HoursOfOperations, value); err != nil { + return err + } + case "NextToken": if value != nil { jtv, ok := value.(string) @@ -23358,11 +24171,6 @@ func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRou sv.NextToken = ptr.String(jtv) } - case "RoutingProfiles": - if err := awsRestjson1_deserializeDocumentRoutingProfileList(&sv.RoutingProfiles, value); err != nil { - return err - } - default: _, _ = key, value @@ -23372,14 +24180,14 @@ func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRou return nil } -type awsRestjson1_deserializeOpSearchSecurityProfiles struct { +type awsRestjson1_deserializeOpSearchPrompts struct { } -func (*awsRestjson1_deserializeOpSearchSecurityProfiles) ID() string { +func (*awsRestjson1_deserializeOpSearchPrompts) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchSecurityProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchPrompts) 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) @@ -23393,9 +24201,9 @@ func (m *awsRestjson1_deserializeOpSearchSecurityProfiles) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchSecurityProfiles(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchPrompts(response, &metadata) } - output := &SearchSecurityProfilesOutput{} + output := &SearchPromptsOutput{} out.Result = output var buff [1024]byte @@ -23416,7 +24224,7 @@ func (m *awsRestjson1_deserializeOpSearchSecurityProfiles) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchPromptsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23429,7 +24237,7 @@ func (m *awsRestjson1_deserializeOpSearchSecurityProfiles) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchSecurityProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchPrompts(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)} @@ -23495,7 +24303,7 @@ func awsRestjson1_deserializeOpErrorSearchSecurityProfiles(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(v **SearchSecurityProfilesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchPromptsOutput(v **SearchPromptsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -23508,9 +24316,9 @@ func awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(v **SearchSe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchSecurityProfilesOutput + var sv *SearchPromptsOutput if *v == nil { - sv = &SearchSecurityProfilesOutput{} + sv = &SearchPromptsOutput{} } else { sv = *v } @@ -23539,8 +24347,8 @@ func awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(v **SearchSe sv.NextToken = ptr.String(jtv) } - case "SecurityProfiles": - if err := awsRestjson1_deserializeDocumentSecurityProfilesSearchSummaryList(&sv.SecurityProfiles, value); err != nil { + case "Prompts": + if err := awsRestjson1_deserializeDocumentPromptList(&sv.Prompts, value); err != nil { return err } @@ -23553,14 +24361,14 @@ func awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(v **SearchSe return nil } -type awsRestjson1_deserializeOpSearchUsers struct { +type awsRestjson1_deserializeOpSearchQueues struct { } -func (*awsRestjson1_deserializeOpSearchUsers) ID() string { +func (*awsRestjson1_deserializeOpSearchQueues) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchQueues) 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) @@ -23574,9 +24382,9 @@ func (m *awsRestjson1_deserializeOpSearchUsers) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchUsers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchQueues(response, &metadata) } - output := &SearchUsersOutput{} + output := &SearchQueuesOutput{} out.Result = output var buff [1024]byte @@ -23597,7 +24405,7 @@ func (m *awsRestjson1_deserializeOpSearchUsers) HandleDeserialize(ctx context.Co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchUsersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchQueuesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23610,7 +24418,7 @@ func (m *awsRestjson1_deserializeOpSearchUsers) HandleDeserialize(ctx context.Co return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchQueues(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)} @@ -23676,7 +24484,7 @@ func awsRestjson1_deserializeOpErrorSearchUsers(response *smithyhttp.Response, m } } -func awsRestjson1_deserializeOpDocumentSearchUsersOutput(v **SearchUsersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchQueuesOutput(v **SearchQueuesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -23689,9 +24497,9 @@ func awsRestjson1_deserializeOpDocumentSearchUsersOutput(v **SearchUsersOutput, return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchUsersOutput + var sv *SearchQueuesOutput if *v == nil { - sv = &SearchUsersOutput{} + sv = &SearchQueuesOutput{} } else { sv = *v } @@ -23720,8 +24528,8 @@ func awsRestjson1_deserializeOpDocumentSearchUsersOutput(v **SearchUsersOutput, sv.NextToken = ptr.String(jtv) } - case "Users": - if err := awsRestjson1_deserializeDocumentUserSearchSummaryList(&sv.Users, value); err != nil { + case "Queues": + if err := awsRestjson1_deserializeDocumentQueueSearchSummaryList(&sv.Queues, value); err != nil { return err } @@ -23734,14 +24542,14 @@ func awsRestjson1_deserializeOpDocumentSearchUsersOutput(v **SearchUsersOutput, return nil } -type awsRestjson1_deserializeOpSearchVocabularies struct { +type awsRestjson1_deserializeOpSearchQuickConnects struct { } -func (*awsRestjson1_deserializeOpSearchVocabularies) ID() string { +func (*awsRestjson1_deserializeOpSearchQuickConnects) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSearchVocabularies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchQuickConnects) 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) @@ -23755,9 +24563,9 @@ func (m *awsRestjson1_deserializeOpSearchVocabularies) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSearchVocabularies(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchQuickConnects(response, &metadata) } - output := &SearchVocabulariesOutput{} + output := &SearchQuickConnectsOutput{} out.Result = output var buff [1024]byte @@ -23778,7 +24586,7 @@ func (m *awsRestjson1_deserializeOpSearchVocabularies) HandleDeserialize(ctx con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchQuickConnectsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23791,7 +24599,7 @@ func (m *awsRestjson1_deserializeOpSearchVocabularies) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeOpErrorSearchVocabularies(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchQuickConnects(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)} @@ -23832,15 +24640,18 @@ func awsRestjson1_deserializeOpErrorSearchVocabularies(response *smithyhttp.Resp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -23854,7 +24665,7 @@ func awsRestjson1_deserializeOpErrorSearchVocabularies(response *smithyhttp.Resp } } -func awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(v **SearchVocabulariesOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchQuickConnectsOutput(v **SearchQuickConnectsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -23867,26 +24678,39 @@ func awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(v **SearchVocabu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SearchVocabulariesOutput + var sv *SearchQuickConnectsOutput if *v == nil { - sv = &SearchVocabulariesOutput{} + sv = &SearchQuickConnectsOutput{} } else { sv = *v } for key, value := range shape { switch key { + case "ApproximateTotalCount": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ApproximateTotalCount = ptr.Int64(i64) + } + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected VocabularyNextToken to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } - case "VocabularySummaryList": - if err := awsRestjson1_deserializeDocumentVocabularySummaryList(&sv.VocabularySummaryList, value); err != nil { + case "QuickConnects": + if err := awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(&sv.QuickConnects, value); err != nil { return err } @@ -23899,14 +24723,14 @@ func awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(v **SearchVocabu return nil } -type awsRestjson1_deserializeOpStartChatContact struct { +type awsRestjson1_deserializeOpSearchResourceTags struct { } -func (*awsRestjson1_deserializeOpStartChatContact) ID() string { +func (*awsRestjson1_deserializeOpSearchResourceTags) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStartChatContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchResourceTags) 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) @@ -23920,9 +24744,9 @@ func (m *awsRestjson1_deserializeOpStartChatContact) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStartChatContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchResourceTags(response, &metadata) } - output := &StartChatContactOutput{} + output := &SearchResourceTagsOutput{} out.Result = output var buff [1024]byte @@ -23943,7 +24767,7 @@ func (m *awsRestjson1_deserializeOpStartChatContact) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentStartChatContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -23956,7 +24780,7 @@ func (m *awsRestjson1_deserializeOpStartChatContact) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorStartChatContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchResourceTags(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)} @@ -24006,12 +24830,15 @@ func awsRestjson1_deserializeOpErrorStartChatContact(response *smithyhttp.Respon case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("LimitExceededException", errorCode): - return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("MaximumResultReturnedException", errorCode): + return awsRestjson1_deserializeErrorMaximumResultReturnedException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -24022,7 +24849,7 @@ func awsRestjson1_deserializeOpErrorStartChatContact(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentStartChatContactOutput(v **StartChatContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchResourceTagsOutput(v **SearchResourceTagsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -24035,49 +24862,27 @@ func awsRestjson1_deserializeOpDocumentStartChatContactOutput(v **StartChatConta return fmt.Errorf("unexpected JSON type %v", value) } - var sv *StartChatContactOutput + var sv *SearchResourceTagsOutput if *v == nil { - sv = &StartChatContactOutput{} + sv = &SearchResourceTagsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) - } - sv.ContactId = ptr.String(jtv) - } - - case "ContinuedFromContactId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) - } - sv.ContinuedFromContactId = ptr.String(jtv) - } - - case "ParticipantId": + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) } - sv.ParticipantId = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) } - case "ParticipantToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) - } - sv.ParticipantToken = ptr.String(jtv) + case "Tags": + if err := awsRestjson1_deserializeDocumentTagsList(&sv.Tags, value); err != nil { + return err } default: @@ -24089,14 +24894,14 @@ func awsRestjson1_deserializeOpDocumentStartChatContactOutput(v **StartChatConta return nil } -type awsRestjson1_deserializeOpStartContactEvaluation struct { +type awsRestjson1_deserializeOpSearchRoutingProfiles struct { } -func (*awsRestjson1_deserializeOpStartContactEvaluation) ID() string { +func (*awsRestjson1_deserializeOpSearchRoutingProfiles) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStartContactEvaluation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchRoutingProfiles) 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) @@ -24110,9 +24915,9 @@ func (m *awsRestjson1_deserializeOpStartContactEvaluation) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStartContactEvaluation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchRoutingProfiles(response, &metadata) } - output := &StartContactEvaluationOutput{} + output := &SearchRoutingProfilesOutput{} out.Result = output var buff [1024]byte @@ -24133,7 +24938,7 @@ func (m *awsRestjson1_deserializeOpStartContactEvaluation) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -24146,7 +24951,7 @@ func (m *awsRestjson1_deserializeOpStartContactEvaluation) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorStartContactEvaluation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchRoutingProfiles(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)} @@ -24193,15 +24998,12 @@ func awsRestjson1_deserializeOpErrorStartContactEvaluation(response *smithyhttp. case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("ResourceConflictException", errorCode): - return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(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) @@ -24215,7 +25017,7 @@ func awsRestjson1_deserializeOpErrorStartContactEvaluation(response *smithyhttp. } } -func awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(v **StartContactEvaluationOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchRoutingProfilesOutput(v **SearchRoutingProfilesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -24228,31 +25030,40 @@ func awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(v **StartCon return fmt.Errorf("unexpected JSON type %v", value) } - var sv *StartContactEvaluationOutput + var sv *SearchRoutingProfilesOutput if *v == nil { - sv = &StartContactEvaluationOutput{} + sv = &SearchRoutingProfilesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "EvaluationArn": + case "ApproximateTotalCount": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(json.Number) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) } - sv.EvaluationArn = ptr.String(jtv) + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ApproximateTotalCount = ptr.Int64(i64) } - case "EvaluationId": + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) } - sv.EvaluationId = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) + } + + case "RoutingProfiles": + if err := awsRestjson1_deserializeDocumentRoutingProfileList(&sv.RoutingProfiles, value); err != nil { + return err } default: @@ -24264,106 +25075,14 @@ func awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(v **StartCon return nil } -type awsRestjson1_deserializeOpStartContactRecording struct { -} - -func (*awsRestjson1_deserializeOpStartContactRecording) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpStartContactRecording) 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_deserializeOpErrorStartContactRecording(response, &metadata) - } - output := &StartContactRecordingOutput{} - out.Result = output - - return out, metadata, err -} - -func awsRestjson1_deserializeOpErrorStartContactRecording(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("InternalServiceException", errorCode): - return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsRestjson1_deserializeOpStartContactStreaming struct { +type awsRestjson1_deserializeOpSearchSecurityProfiles struct { } -func (*awsRestjson1_deserializeOpStartContactStreaming) ID() string { +func (*awsRestjson1_deserializeOpSearchSecurityProfiles) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStartContactStreaming) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchSecurityProfiles) 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) @@ -24377,9 +25096,9 @@ func (m *awsRestjson1_deserializeOpStartContactStreaming) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStartContactStreaming(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchSecurityProfiles(response, &metadata) } - output := &StartContactStreamingOutput{} + output := &SearchSecurityProfilesOutput{} out.Result = output var buff [1024]byte @@ -24400,7 +25119,7 @@ func (m *awsRestjson1_deserializeOpStartContactStreaming) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentStartContactStreamingOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -24413,7 +25132,7 @@ func (m *awsRestjson1_deserializeOpStartContactStreaming) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorStartContactStreaming(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchSecurityProfiles(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)} @@ -24463,12 +25182,12 @@ func awsRestjson1_deserializeOpErrorStartContactStreaming(response *smithyhttp.R case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("LimitExceededException", errorCode): - return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -24479,7 +25198,7 @@ func awsRestjson1_deserializeOpErrorStartContactStreaming(response *smithyhttp.R } } -func awsRestjson1_deserializeOpDocumentStartContactStreamingOutput(v **StartContactStreamingOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchSecurityProfilesOutput(v **SearchSecurityProfilesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -24492,22 +25211,40 @@ func awsRestjson1_deserializeOpDocumentStartContactStreamingOutput(v **StartCont return fmt.Errorf("unexpected JSON type %v", value) } - var sv *StartContactStreamingOutput + var sv *SearchSecurityProfilesOutput if *v == nil { - sv = &StartContactStreamingOutput{} + sv = &SearchSecurityProfilesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "StreamingId": + case "ApproximateTotalCount": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ApproximateTotalCount = ptr.Int64(i64) + } + + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected StreamingId to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) } - sv.StreamingId = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) + } + + case "SecurityProfiles": + if err := awsRestjson1_deserializeDocumentSecurityProfilesSearchSummaryList(&sv.SecurityProfiles, value); err != nil { + return err } default: @@ -24519,14 +25256,14 @@ func awsRestjson1_deserializeOpDocumentStartContactStreamingOutput(v **StartCont return nil } -type awsRestjson1_deserializeOpStartOutboundVoiceContact struct { +type awsRestjson1_deserializeOpSearchUsers struct { } -func (*awsRestjson1_deserializeOpStartOutboundVoiceContact) ID() string { +func (*awsRestjson1_deserializeOpSearchUsers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchUsers) 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) @@ -24540,9 +25277,9 @@ func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) HandleDeserialize( } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchUsers(response, &metadata) } - output := &StartOutboundVoiceContactOutput{} + output := &SearchUsersOutput{} out.Result = output var buff [1024]byte @@ -24563,7 +25300,7 @@ func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) HandleDeserialize( return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchUsersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -24576,7 +25313,7 @@ func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) HandleDeserialize( return out, metadata, err } -func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchUsers(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)} @@ -24617,9 +25354,6 @@ func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response *smithyht } switch { - case strings.EqualFold("DestinationNotAllowedException", errorCode): - return awsRestjson1_deserializeErrorDestinationNotAllowedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -24629,15 +25363,12 @@ func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response *smithyht case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("LimitExceededException", errorCode): - return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("OutboundContactNotPermittedException", errorCode): - return awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -24648,7 +25379,7 @@ func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response *smithyht } } -func awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(v **StartOutboundVoiceContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchUsersOutput(v **SearchUsersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -24661,22 +25392,40 @@ func awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(v **Start return fmt.Errorf("unexpected JSON type %v", value) } - var sv *StartOutboundVoiceContactOutput + var sv *SearchUsersOutput if *v == nil { - sv = &StartOutboundVoiceContactOutput{} + sv = &SearchUsersOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactId": + case "ApproximateTotalCount": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ApproximateTotalCount to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ApproximateTotalCount = ptr.Int64(i64) + } + + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + return fmt.Errorf("expected NextToken2500 to be of type string, got %T instead", value) } - sv.ContactId = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) + } + + case "Users": + if err := awsRestjson1_deserializeDocumentUserSearchSummaryList(&sv.Users, value); err != nil { + return err } default: @@ -24688,14 +25437,14 @@ func awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(v **Start return nil } -type awsRestjson1_deserializeOpStartTaskContact struct { +type awsRestjson1_deserializeOpSearchVocabularies struct { } -func (*awsRestjson1_deserializeOpStartTaskContact) ID() string { +func (*awsRestjson1_deserializeOpSearchVocabularies) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStartTaskContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSearchVocabularies) 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) @@ -24709,9 +25458,9 @@ func (m *awsRestjson1_deserializeOpStartTaskContact) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStartTaskContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSearchVocabularies(response, &metadata) } - output := &StartTaskContactOutput{} + output := &SearchVocabulariesOutput{} out.Result = output var buff [1024]byte @@ -24732,7 +25481,7 @@ func (m *awsRestjson1_deserializeOpStartTaskContact) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentStartTaskContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -24745,7 +25494,7 @@ func (m *awsRestjson1_deserializeOpStartTaskContact) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorStartTaskContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSearchVocabularies(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)} @@ -24786,21 +25535,15 @@ func awsRestjson1_deserializeOpErrorStartTaskContact(response *smithyhttp.Respon } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(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) @@ -24814,7 +25557,7 @@ func awsRestjson1_deserializeOpErrorStartTaskContact(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentStartTaskContactOutput(v **StartTaskContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSearchVocabulariesOutput(v **SearchVocabulariesOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -24827,22 +25570,27 @@ func awsRestjson1_deserializeOpDocumentStartTaskContactOutput(v **StartTaskConta return fmt.Errorf("unexpected JSON type %v", value) } - var sv *StartTaskContactOutput + var sv *SearchVocabulariesOutput if *v == nil { - sv = &StartTaskContactOutput{} + sv = &SearchVocabulariesOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactId": + case "NextToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + return fmt.Errorf("expected VocabularyNextToken to be of type string, got %T instead", value) } - sv.ContactId = ptr.String(jtv) + sv.NextToken = ptr.String(jtv) + } + + case "VocabularySummaryList": + if err := awsRestjson1_deserializeDocumentVocabularySummaryList(&sv.VocabularySummaryList, value); err != nil { + return err } default: @@ -24854,14 +25602,14 @@ func awsRestjson1_deserializeOpDocumentStartTaskContactOutput(v **StartTaskConta return nil } -type awsRestjson1_deserializeOpStopContact struct { +type awsRestjson1_deserializeOpSendChatIntegrationEvent struct { } -func (*awsRestjson1_deserializeOpStopContact) ID() string { +func (*awsRestjson1_deserializeOpSendChatIntegrationEvent) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStopContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSendChatIntegrationEvent) 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) @@ -24875,15 +25623,43 @@ func (m *awsRestjson1_deserializeOpStopContact) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStopContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSendChatIntegrationEvent(response, &metadata) } - output := &StopContactOutput{} + output := &SendChatIntegrationEventOutput{} 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_deserializeOpDocumentSendChatIntegrationEventOutput(&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_deserializeOpErrorStopContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSendChatIntegrationEvent(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)} @@ -24924,21 +25700,21 @@ func awsRestjson1_deserializeOpErrorStopContact(response *smithyhttp.Response, m } switch { - case strings.EqualFold("ContactNotFoundException", errorCode): - return awsRestjson1_deserializeErrorContactNotFoundException(response, errorBody) + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -24949,14 +25725,63 @@ func awsRestjson1_deserializeOpErrorStopContact(response *smithyhttp.Response, m } } -type awsRestjson1_deserializeOpStopContactRecording struct { +func awsRestjson1_deserializeOpDocumentSendChatIntegrationEventOutput(v **SendChatIntegrationEventOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SendChatIntegrationEventOutput + if *v == nil { + sv = &SendChatIntegrationEventOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "InitialContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.InitialContactId = ptr.String(jtv) + } + + case "NewChatCreated": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected NewChatCreated to be of type *bool, got %T instead", value) + } + sv.NewChatCreated = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpStopContactRecording) ID() string { +type awsRestjson1_deserializeOpStartChatContact struct { +} + +func (*awsRestjson1_deserializeOpStartChatContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpStopContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartChatContact) 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) @@ -24970,15 +25795,43 @@ func (m *awsRestjson1_deserializeOpStopContactRecording) HandleDeserialize(ctx c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorStopContactRecording(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartChatContact(response, &metadata) } - output := &StopContactRecordingOutput{} + output := &StartChatContactOutput{} 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_deserializeOpDocumentStartChatContactOutput(&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_deserializeOpErrorStopContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartChatContact(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)} @@ -25022,9 +25875,15 @@ func awsRestjson1_deserializeOpErrorStopContactRecording(response *smithyhttp.Re case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -25038,106 +25897,81 @@ func awsRestjson1_deserializeOpErrorStopContactRecording(response *smithyhttp.Re } } -type awsRestjson1_deserializeOpStopContactStreaming struct { -} - -func (*awsRestjson1_deserializeOpStopContactStreaming) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpStopContactStreaming) 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_deserializeOpErrorStopContactStreaming(response, &metadata) +func awsRestjson1_deserializeOpDocumentStartChatContactOutput(v **StartChatContactOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) } - output := &StopContactStreamingOutput{} - out.Result = output - - return out, metadata, err -} - -func awsRestjson1_deserializeOpErrorStopContactStreaming(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)} + if value == nil { + return nil } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - headerCode := response.Header.Get("X-Amzn-ErrorType") - if len(headerCode) != 0 { - errorCode = restjson.SanitizeErrorCode(headerCode) + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) } - 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 + var sv *StartChatContactOutput + if *v == nil { + sv = &StartChatContactOutput{} + } else { + sv = *v } - errorBody.Seek(0, io.SeekStart) - if len(headerCode) == 0 && len(jsonCode) != 0 { - errorCode = restjson.SanitizeErrorCode(jsonCode) - } - if len(message) != 0 { - errorMessage = message - } + for key, value := range shape { + switch key { + case "ContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } - switch { - case strings.EqualFold("InternalServiceException", errorCode): - return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case "ContinuedFromContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContinuedFromContactId = ptr.String(jtv) + } - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case "ParticipantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) + } + sv.ParticipantId = ptr.String(jtv) + } - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case "ParticipantToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) + } + sv.ParticipantToken = ptr.String(jtv) + } - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + default: + _, _ = key, value - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, } - return genericError - } + *v = sv + return nil } -type awsRestjson1_deserializeOpSubmitContactEvaluation struct { +type awsRestjson1_deserializeOpStartContactEvaluation struct { } -func (*awsRestjson1_deserializeOpSubmitContactEvaluation) ID() string { +func (*awsRestjson1_deserializeOpStartContactEvaluation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSubmitContactEvaluation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartContactEvaluation) 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) @@ -25151,9 +25985,9 @@ func (m *awsRestjson1_deserializeOpSubmitContactEvaluation) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSubmitContactEvaluation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartContactEvaluation(response, &metadata) } - output := &SubmitContactEvaluationOutput{} + output := &StartContactEvaluationOutput{} out.Result = output var buff [1024]byte @@ -25174,7 +26008,7 @@ func (m *awsRestjson1_deserializeOpSubmitContactEvaluation) HandleDeserialize(ct return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentSubmitContactEvaluationOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -25187,7 +26021,7 @@ func (m *awsRestjson1_deserializeOpSubmitContactEvaluation) HandleDeserialize(ct return out, metadata, err } -func awsRestjson1_deserializeOpErrorSubmitContactEvaluation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartContactEvaluation(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)} @@ -25240,6 +26074,9 @@ func awsRestjson1_deserializeOpErrorSubmitContactEvaluation(response *smithyhttp 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) @@ -25253,7 +26090,7 @@ func awsRestjson1_deserializeOpErrorSubmitContactEvaluation(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentSubmitContactEvaluationOutput(v **SubmitContactEvaluationOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentStartContactEvaluationOutput(v **StartContactEvaluationOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -25266,9 +26103,9 @@ func awsRestjson1_deserializeOpDocumentSubmitContactEvaluationOutput(v **SubmitC return fmt.Errorf("unexpected JSON type %v", value) } - var sv *SubmitContactEvaluationOutput + var sv *StartContactEvaluationOutput if *v == nil { - sv = &SubmitContactEvaluationOutput{} + sv = &StartContactEvaluationOutput{} } else { sv = *v } @@ -25302,14 +26139,14 @@ func awsRestjson1_deserializeOpDocumentSubmitContactEvaluationOutput(v **SubmitC return nil } -type awsRestjson1_deserializeOpSuspendContactRecording struct { +type awsRestjson1_deserializeOpStartContactRecording struct { } -func (*awsRestjson1_deserializeOpSuspendContactRecording) ID() string { +func (*awsRestjson1_deserializeOpStartContactRecording) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpSuspendContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartContactRecording) 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) @@ -25323,15 +26160,15 @@ func (m *awsRestjson1_deserializeOpSuspendContactRecording) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorSuspendContactRecording(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartContactRecording(response, &metadata) } - output := &SuspendContactRecordingOutput{} + output := &StartContactRecordingOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorSuspendContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartContactRecording(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)} @@ -25375,6 +26212,9 @@ func awsRestjson1_deserializeOpErrorSuspendContactRecording(response *smithyhttp case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -25391,14 +26231,14 @@ func awsRestjson1_deserializeOpErrorSuspendContactRecording(response *smithyhttp } } -type awsRestjson1_deserializeOpTagResource struct { +type awsRestjson1_deserializeOpStartContactStreaming struct { } -func (*awsRestjson1_deserializeOpTagResource) ID() string { +func (*awsRestjson1_deserializeOpStartContactStreaming) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartContactStreaming) 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) @@ -25412,21 +26252,43 @@ func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartContactStreaming(response, &metadata) } - output := &TagResourceOutput{} + output := &StartContactStreamingOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentStartContactStreamingOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartContactStreaming(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)} @@ -25476,12 +26338,12 @@ func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, m case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -25492,14 +26354,54 @@ func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, m } } -type awsRestjson1_deserializeOpTransferContact struct { +func awsRestjson1_deserializeOpDocumentStartContactStreamingOutput(v **StartContactStreamingOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartContactStreamingOutput + if *v == nil { + sv = &StartContactStreamingOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "StreamingId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected StreamingId to be of type string, got %T instead", value) + } + sv.StreamingId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpTransferContact) ID() string { +type awsRestjson1_deserializeOpStartOutboundVoiceContact struct { +} + +func (*awsRestjson1_deserializeOpStartOutboundVoiceContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpTransferContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) 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) @@ -25513,9 +26415,9 @@ func (m *awsRestjson1_deserializeOpTransferContact) HandleDeserialize(ctx contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorTransferContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response, &metadata) } - output := &TransferContactOutput{} + output := &StartOutboundVoiceContactOutput{} out.Result = output var buff [1024]byte @@ -25536,7 +26438,7 @@ func (m *awsRestjson1_deserializeOpTransferContact) HandleDeserialize(ctx contex return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentTransferContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -25549,7 +26451,7 @@ func (m *awsRestjson1_deserializeOpTransferContact) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorTransferContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(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)} @@ -25590,26 +26492,26 @@ func awsRestjson1_deserializeOpErrorTransferContact(response *smithyhttp.Respons } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("DestinationNotAllowedException", errorCode): + return awsRestjson1_deserializeErrorDestinationNotAllowedException(response, errorBody) case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) - case strings.EqualFold("ServiceQuotaExceededException", errorCode): - return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + case strings.EqualFold("OutboundContactNotPermittedException", errorCode): + return awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -25621,7 +26523,7 @@ func awsRestjson1_deserializeOpErrorTransferContact(response *smithyhttp.Respons } } -func awsRestjson1_deserializeOpDocumentTransferContactOutput(v **TransferContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(v **StartOutboundVoiceContactOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -25634,24 +26536,15 @@ func awsRestjson1_deserializeOpDocumentTransferContactOutput(v **TransferContact return fmt.Errorf("unexpected JSON type %v", value) } - var sv *TransferContactOutput + var sv *StartOutboundVoiceContactOutput if *v == nil { - sv = &TransferContactOutput{} + sv = &StartOutboundVoiceContactOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.ContactArn = ptr.String(jtv) - } - case "ContactId": if value != nil { jtv, ok := value.(string) @@ -25670,14 +26563,14 @@ func awsRestjson1_deserializeOpDocumentTransferContactOutput(v **TransferContact return nil } -type awsRestjson1_deserializeOpUntagResource struct { +type awsRestjson1_deserializeOpStartTaskContact struct { } -func (*awsRestjson1_deserializeOpUntagResource) ID() string { +func (*awsRestjson1_deserializeOpStartTaskContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartTaskContact) 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) @@ -25691,21 +26584,43 @@ func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartTaskContact(response, &metadata) } - output := &UntagResourceOutput{} + output := &StartTaskContactOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentStartTaskContactOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartTaskContact(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)} @@ -25758,6 +26673,9 @@ func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, 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) @@ -25771,14 +26689,54 @@ func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, } } -type awsRestjson1_deserializeOpUpdateAgentStatus struct { +func awsRestjson1_deserializeOpDocumentStartTaskContactOutput(v **StartTaskContactOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartTaskContactOutput + if *v == nil { + sv = &StartTaskContactOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateAgentStatus) ID() string { +type awsRestjson1_deserializeOpStartWebRTCContact struct { +} + +func (*awsRestjson1_deserializeOpStartWebRTCContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateAgentStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartWebRTCContact) 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) @@ -25792,21 +26750,43 @@ func (m *awsRestjson1_deserializeOpUpdateAgentStatus) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateAgentStatus(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartWebRTCContact(response, &metadata) } - output := &UpdateAgentStatusOutput{} + output := &StartWebRTCContactOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentStartWebRTCContactOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateAgentStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartWebRTCContact(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)} @@ -25847,9 +26827,6 @@ func awsRestjson1_deserializeOpErrorUpdateAgentStatus(response *smithyhttp.Respo } switch { - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -25865,9 +26842,6 @@ func awsRestjson1_deserializeOpErrorUpdateAgentStatus(response *smithyhttp.Respo case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -25878,14 +26852,77 @@ func awsRestjson1_deserializeOpErrorUpdateAgentStatus(response *smithyhttp.Respo } } -type awsRestjson1_deserializeOpUpdateContact struct { +func awsRestjson1_deserializeOpDocumentStartWebRTCContactOutput(v **StartWebRTCContactOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartWebRTCContactOutput + if *v == nil { + sv = &StartWebRTCContactOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConnectionData": + if err := awsRestjson1_deserializeDocumentConnectionData(&sv.ConnectionData, value); err != nil { + return err + } + + case "ContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } + + case "ParticipantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) + } + sv.ParticipantId = ptr.String(jtv) + } + + case "ParticipantToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) + } + sv.ParticipantToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateContact) ID() string { +type awsRestjson1_deserializeOpStopContact struct { +} + +func (*awsRestjson1_deserializeOpStopContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStopContact) 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) @@ -25899,15 +26936,15 @@ func (m *awsRestjson1_deserializeOpUpdateContact) HandleDeserialize(ctx context. } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStopContact(response, &metadata) } - output := &UpdateContactOutput{} + output := &StopContactOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStopContact(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)} @@ -25948,6 +26985,9 @@ func awsRestjson1_deserializeOpErrorUpdateContact(response *smithyhttp.Response, } switch { + case strings.EqualFold("ContactNotFoundException", errorCode): + return awsRestjson1_deserializeErrorContactNotFoundException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -25960,9 +27000,6 @@ func awsRestjson1_deserializeOpErrorUpdateContact(response *smithyhttp.Response, case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -25973,14 +27010,14 @@ func awsRestjson1_deserializeOpErrorUpdateContact(response *smithyhttp.Response, } } -type awsRestjson1_deserializeOpUpdateContactAttributes struct { +type awsRestjson1_deserializeOpStopContactRecording struct { } -func (*awsRestjson1_deserializeOpUpdateContactAttributes) ID() string { +func (*awsRestjson1_deserializeOpStopContactRecording) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactAttributes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStopContactRecording) 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) @@ -25994,15 +27031,15 @@ func (m *awsRestjson1_deserializeOpUpdateContactAttributes) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactAttributes(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStopContactRecording(response, &metadata) } - output := &UpdateContactAttributesOutput{} + output := &StopContactRecordingOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateContactAttributes(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStopContactRecording(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)} @@ -26046,9 +27083,6 @@ func awsRestjson1_deserializeOpErrorUpdateContactAttributes(response *smithyhttp case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -26065,14 +27099,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactAttributes(response *smithyhttp } } -type awsRestjson1_deserializeOpUpdateContactEvaluation struct { +type awsRestjson1_deserializeOpStopContactStreaming struct { } -func (*awsRestjson1_deserializeOpUpdateContactEvaluation) ID() string { +func (*awsRestjson1_deserializeOpStopContactStreaming) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactEvaluation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStopContactStreaming) 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) @@ -26086,43 +27120,135 @@ func (m *awsRestjson1_deserializeOpUpdateContactEvaluation) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactEvaluation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStopContactStreaming(response, &metadata) } - output := &UpdateContactEvaluationOutput{} + output := &StopContactStreamingOutput{} 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_deserializeOpDocumentUpdateContactEvaluationOutput(&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_deserializeOpErrorUpdateContactEvaluation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStopContactStreaming(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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpSubmitContactEvaluation struct { +} + +func (*awsRestjson1_deserializeOpSubmitContactEvaluation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSubmitContactEvaluation) 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_deserializeOpErrorSubmitContactEvaluation(response, &metadata) + } + output := &SubmitContactEvaluationOutput{} + 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_deserializeOpDocumentSubmitContactEvaluationOutput(&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_deserializeOpErrorSubmitContactEvaluation(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)} @@ -26188,7 +27314,7 @@ func awsRestjson1_deserializeOpErrorUpdateContactEvaluation(response *smithyhttp } } -func awsRestjson1_deserializeOpDocumentUpdateContactEvaluationOutput(v **UpdateContactEvaluationOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentSubmitContactEvaluationOutput(v **SubmitContactEvaluationOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -26201,9 +27327,9 @@ func awsRestjson1_deserializeOpDocumentUpdateContactEvaluationOutput(v **UpdateC return fmt.Errorf("unexpected JSON type %v", value) } - var sv *UpdateContactEvaluationOutput + var sv *SubmitContactEvaluationOutput if *v == nil { - sv = &UpdateContactEvaluationOutput{} + sv = &SubmitContactEvaluationOutput{} } else { sv = *v } @@ -26237,14 +27363,14 @@ func awsRestjson1_deserializeOpDocumentUpdateContactEvaluationOutput(v **UpdateC return nil } -type awsRestjson1_deserializeOpUpdateContactFlowContent struct { +type awsRestjson1_deserializeOpSuspendContactRecording struct { } -func (*awsRestjson1_deserializeOpUpdateContactFlowContent) ID() string { +func (*awsRestjson1_deserializeOpSuspendContactRecording) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactFlowContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpSuspendContactRecording) 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) @@ -26258,15 +27384,15 @@ func (m *awsRestjson1_deserializeOpUpdateContactFlowContent) HandleDeserialize(c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorSuspendContactRecording(response, &metadata) } - output := &UpdateContactFlowContentOutput{} + output := &SuspendContactRecordingOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorSuspendContactRecording(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)} @@ -26310,21 +27436,12 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response *smithyhtt case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidContactFlowException", errorCode): - return awsRestjson1_deserializeErrorInvalidContactFlowException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): - return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -26335,14 +27452,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response *smithyhtt } } -type awsRestjson1_deserializeOpUpdateContactFlowMetadata struct { +type awsRestjson1_deserializeOpTagResource struct { } -func (*awsRestjson1_deserializeOpUpdateContactFlowMetadata) ID() string { +func (*awsRestjson1_deserializeOpTagResource) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactFlowMetadata) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +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) @@ -26356,15 +27473,21 @@ func (m *awsRestjson1_deserializeOpUpdateContactFlowMetadata) HandleDeserialize( } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowMetadata(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) } - output := &UpdateContactFlowMetadataOutput{} + 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_deserializeOpErrorUpdateContactFlowMetadata(response *smithyhttp.Response, metadata *middleware.Metadata) error { +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)} @@ -26405,9 +27528,6 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowMetadata(response *smithyht } switch { - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -26433,14 +27553,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowMetadata(response *smithyht } } -type awsRestjson1_deserializeOpUpdateContactFlowModuleContent struct { +type awsRestjson1_deserializeOpTransferContact struct { } -func (*awsRestjson1_deserializeOpUpdateContactFlowModuleContent) ID() string { +func (*awsRestjson1_deserializeOpTransferContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpTransferContact) 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) @@ -26454,15 +27574,43 @@ func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleContent) HandleDeseria } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowModuleContent(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorTransferContact(response, &metadata) } - output := &UpdateContactFlowModuleContentOutput{} + output := &TransferContactOutput{} 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_deserializeOpDocumentTransferContactOutput(&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_deserializeOpErrorUpdateContactFlowModuleContent(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorTransferContact(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)} @@ -26506,18 +27654,21 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleContent(response *smi case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidContactFlowModuleException", errorCode): - return awsRestjson1_deserializeErrorInvalidContactFlowModuleException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(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) @@ -26531,14 +27682,63 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleContent(response *smi } } -type awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata struct { +func awsRestjson1_deserializeOpDocumentTransferContactOutput(v **TransferContactOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *TransferContactOutput + if *v == nil { + sv = &TransferContactOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ContactArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.ContactArn = ptr.String(jtv) + } + + case "ContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata) ID() string { +type awsRestjson1_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +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) @@ -26552,15 +27752,21 @@ func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata) HandleDeseri } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowModuleMetadata(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) } - output := &UpdateContactFlowModuleMetadataOutput{} + 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_deserializeOpErrorUpdateContactFlowModuleMetadata(response *smithyhttp.Response, metadata *middleware.Metadata) error { +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)} @@ -26601,12 +27807,6 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleMetadata(response *sm } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -26632,14 +27832,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleMetadata(response *sm } } -type awsRestjson1_deserializeOpUpdateContactFlowName struct { +type awsRestjson1_deserializeOpUpdateAgentStatus struct { } -func (*awsRestjson1_deserializeOpUpdateContactFlowName) ID() string { +func (*awsRestjson1_deserializeOpUpdateAgentStatus) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactFlowName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateAgentStatus) 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) @@ -26653,15 +27853,21 @@ func (m *awsRestjson1_deserializeOpUpdateContactFlowName) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowName(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateAgentStatus(response, &metadata) } - output := &UpdateContactFlowNameOutput{} + output := &UpdateAgentStatusOutput{} 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_deserializeOpErrorUpdateContactFlowName(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateAgentStatus(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)} @@ -26714,6 +27920,9 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowName(response *smithyhttp.R case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -26730,14 +27939,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactFlowName(response *smithyhttp.R } } -type awsRestjson1_deserializeOpUpdateContactSchedule struct { +type awsRestjson1_deserializeOpUpdateContact struct { } -func (*awsRestjson1_deserializeOpUpdateContactSchedule) ID() string { +func (*awsRestjson1_deserializeOpUpdateContact) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateContactSchedule) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContact) 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) @@ -26751,15 +27960,15 @@ func (m *awsRestjson1_deserializeOpUpdateContactSchedule) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactSchedule(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContact(response, &metadata) } - output := &UpdateContactScheduleOutput{} + output := &UpdateContactOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateContactSchedule(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContact(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)} @@ -26809,9 +28018,6 @@ func awsRestjson1_deserializeOpErrorUpdateContactSchedule(response *smithyhttp.R case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("LimitExceededException", errorCode): - return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -26828,14 +28034,14 @@ func awsRestjson1_deserializeOpErrorUpdateContactSchedule(response *smithyhttp.R } } -type awsRestjson1_deserializeOpUpdateEvaluationForm struct { +type awsRestjson1_deserializeOpUpdateContactAttributes struct { } -func (*awsRestjson1_deserializeOpUpdateEvaluationForm) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactAttributes) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateEvaluationForm) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactAttributes) 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) @@ -26849,43 +28055,15 @@ func (m *awsRestjson1_deserializeOpUpdateEvaluationForm) HandleDeserialize(ctx c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateEvaluationForm(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactAttributes(response, &metadata) } - output := &UpdateEvaluationFormOutput{} + output := &UpdateContactAttributesOutput{} 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_deserializeOpDocumentUpdateEvaluationFormOutput(&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_deserializeOpErrorUpdateEvaluationForm(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactAttributes(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)} @@ -26932,18 +28110,12 @@ func awsRestjson1_deserializeOpErrorUpdateEvaluationForm(response *smithyhttp.Re case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("ResourceConflictException", errorCode): - return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(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) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -26954,76 +28126,14 @@ func awsRestjson1_deserializeOpErrorUpdateEvaluationForm(response *smithyhttp.Re } } -func awsRestjson1_deserializeOpDocumentUpdateEvaluationFormOutput(v **UpdateEvaluationFormOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *UpdateEvaluationFormOutput - if *v == nil { - sv = &UpdateEvaluationFormOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "EvaluationFormArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.EvaluationFormArn = ptr.String(jtv) - } - - case "EvaluationFormId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) - } - sv.EvaluationFormId = ptr.String(jtv) - } - - case "EvaluationFormVersion": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected VersionNumber to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.EvaluationFormVersion = int32(i64) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type awsRestjson1_deserializeOpUpdateHoursOfOperation struct { +type awsRestjson1_deserializeOpUpdateContactEvaluation struct { } -func (*awsRestjson1_deserializeOpUpdateHoursOfOperation) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactEvaluation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateHoursOfOperation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactEvaluation) 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) @@ -27037,21 +28147,43 @@ func (m *awsRestjson1_deserializeOpUpdateHoursOfOperation) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactEvaluation(response, &metadata) } - output := &UpdateHoursOfOperationOutput{} + output := &UpdateContactEvaluationOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentUpdateContactEvaluationOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactEvaluation(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)} @@ -27092,17 +28224,14 @@ func awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(response *smithyhttp. } switch { - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceConflictException", errorCode): + return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -27120,14 +28249,63 @@ func awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(response *smithyhttp. } } -type awsRestjson1_deserializeOpUpdateInstanceAttribute struct { +func awsRestjson1_deserializeOpDocumentUpdateContactEvaluationOutput(v **UpdateContactEvaluationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateContactEvaluationOutput + if *v == nil { + sv = &UpdateContactEvaluationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EvaluationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.EvaluationArn = ptr.String(jtv) + } + + case "EvaluationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + } + sv.EvaluationId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateInstanceAttribute) ID() string { +type awsRestjson1_deserializeOpUpdateContactFlowContent struct { +} + +func (*awsRestjson1_deserializeOpUpdateContactFlowContent) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateInstanceAttribute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactFlowContent) 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) @@ -27141,21 +28319,15 @@ func (m *awsRestjson1_deserializeOpUpdateInstanceAttribute) HandleDeserialize(ct } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response, &metadata) } - output := &UpdateInstanceAttributeOutput{} + output := &UpdateContactFlowContentOutput{} 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_deserializeOpErrorUpdateInstanceAttribute(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactFlowContent(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)} @@ -27199,6 +28371,9 @@ func awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response *smithyhttp case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidContactFlowException", errorCode): + return awsRestjson1_deserializeErrorInvalidContactFlowException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) @@ -27221,14 +28396,14 @@ func awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response *smithyhttp } } -type awsRestjson1_deserializeOpUpdateInstanceStorageConfig struct { +type awsRestjson1_deserializeOpUpdateContactFlowMetadata struct { } -func (*awsRestjson1_deserializeOpUpdateInstanceStorageConfig) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactFlowMetadata) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactFlowMetadata) 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) @@ -27242,21 +28417,15 @@ func (m *awsRestjson1_deserializeOpUpdateInstanceStorageConfig) HandleDeserializ } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowMetadata(response, &metadata) } - output := &UpdateInstanceStorageConfigOutput{} + output := &UpdateContactFlowMetadataOutput{} 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_deserializeOpErrorUpdateInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactFlowMetadata(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)} @@ -27297,6 +28466,9 @@ func awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response *smithy } switch { + case strings.EqualFold("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -27322,14 +28494,14 @@ func awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response *smithy } } -type awsRestjson1_deserializeOpUpdateParticipantRoleConfig struct { +type awsRestjson1_deserializeOpUpdateContactFlowModuleContent struct { } -func (*awsRestjson1_deserializeOpUpdateParticipantRoleConfig) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactFlowModuleContent) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateParticipantRoleConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleContent) 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) @@ -27343,15 +28515,15 @@ func (m *awsRestjson1_deserializeOpUpdateParticipantRoleConfig) HandleDeserializ } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowModuleContent(response, &metadata) } - output := &UpdateParticipantRoleConfigOutput{} + output := &UpdateContactFlowModuleContentOutput{} out.Result = output return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleContent(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)} @@ -27398,8 +28570,8 @@ func awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(response *smithy case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidContactFlowModuleException", errorCode): + return awsRestjson1_deserializeErrorInvalidContactFlowModuleException(response, errorBody) case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) @@ -27420,14 +28592,14 @@ func awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(response *smithy } } -type awsRestjson1_deserializeOpUpdatePhoneNumber struct { +type awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata struct { } -func (*awsRestjson1_deserializeOpUpdatePhoneNumber) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdatePhoneNumber) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactFlowModuleMetadata) 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) @@ -27441,43 +28613,15 @@ func (m *awsRestjson1_deserializeOpUpdatePhoneNumber) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdatePhoneNumber(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowModuleMetadata(response, &metadata) } - output := &UpdatePhoneNumberOutput{} + output := &UpdateContactFlowModuleMetadataOutput{} 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_deserializeOpDocumentUpdatePhoneNumberOutput(&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_deserializeOpErrorUpdatePhoneNumber(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactFlowModuleMetadata(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)} @@ -27521,8 +28665,8 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumber(response *smithyhttp.Respo case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -27530,8 +28674,8 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumber(response *smithyhttp.Respo case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -27549,63 +28693,112 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumber(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentUpdatePhoneNumberOutput(v **UpdatePhoneNumberOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil +type awsRestjson1_deserializeOpUpdateContactFlowName struct { +} + +func (*awsRestjson1_deserializeOpUpdateContactFlowName) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateContactFlowName) 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 } - shape, ok := value.(map[string]interface{}) + response, ok := out.RawResponse.(*smithyhttp.Response) if !ok { - return fmt.Errorf("unexpected JSON type %v", value) + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - var sv *UpdatePhoneNumberOutput - if *v == nil { - sv = &UpdatePhoneNumberOutput{} - } else { - sv = *v + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowName(response, &metadata) } + output := &UpdateContactFlowNameOutput{} + out.Result = output - for key, value := range shape { - switch key { - case "PhoneNumberArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.PhoneNumberArn = ptr.String(jtv) - } + return out, metadata, err +} - case "PhoneNumberId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) - } - sv.PhoneNumberId = ptr.String(jtv) - } +func awsRestjson1_deserializeOpErrorUpdateContactFlowName(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()) - default: - _, _ = key, value + 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("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) + + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + } - *v = sv - return nil } -type awsRestjson1_deserializeOpUpdatePhoneNumberMetadata struct { +type awsRestjson1_deserializeOpUpdateContactSchedule struct { } -func (*awsRestjson1_deserializeOpUpdatePhoneNumberMetadata) ID() string { +func (*awsRestjson1_deserializeOpUpdateContactSchedule) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdatePhoneNumberMetadata) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateContactSchedule) 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) @@ -27619,21 +28812,15 @@ func (m *awsRestjson1_deserializeOpUpdatePhoneNumberMetadata) HandleDeserialize( } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactSchedule(response, &metadata) } - output := &UpdatePhoneNumberMetadataOutput{} + output := &UpdateContactScheduleOutput{} 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_deserializeOpErrorUpdatePhoneNumberMetadata(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateContactSchedule(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)} @@ -27674,12 +28861,6 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(response *smithyht } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("IdempotencyException", errorCode): - return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -27689,8 +28870,8 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(response *smithyht case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -27708,14 +28889,14 @@ func awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(response *smithyht } } -type awsRestjson1_deserializeOpUpdatePrompt struct { +type awsRestjson1_deserializeOpUpdateEvaluationForm struct { } -func (*awsRestjson1_deserializeOpUpdatePrompt) ID() string { +func (*awsRestjson1_deserializeOpUpdateEvaluationForm) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdatePrompt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateEvaluationForm) 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) @@ -27729,9 +28910,9 @@ func (m *awsRestjson1_deserializeOpUpdatePrompt) HandleDeserialize(ctx context.C } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdatePrompt(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateEvaluationForm(response, &metadata) } - output := &UpdatePromptOutput{} + output := &UpdateEvaluationFormOutput{} out.Result = output var buff [1024]byte @@ -27752,7 +28933,7 @@ func (m *awsRestjson1_deserializeOpUpdatePrompt) HandleDeserialize(ctx context.C return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentUpdatePromptOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentUpdateEvaluationFormOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -27765,7 +28946,7 @@ func (m *awsRestjson1_deserializeOpUpdatePrompt) HandleDeserialize(ctx context.C return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdatePrompt(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateEvaluationForm(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)} @@ -27812,12 +28993,15 @@ func awsRestjson1_deserializeOpErrorUpdatePrompt(response *smithyhttp.Response, case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceConflictException", errorCode): + return awsRestjson1_deserializeErrorResourceConflictException(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) @@ -27831,7 +29015,7 @@ func awsRestjson1_deserializeOpErrorUpdatePrompt(response *smithyhttp.Response, } } -func awsRestjson1_deserializeOpDocumentUpdatePromptOutput(v **UpdatePromptOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentUpdateEvaluationFormOutput(v **UpdateEvaluationFormOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -27844,31 +29028,44 @@ func awsRestjson1_deserializeOpDocumentUpdatePromptOutput(v **UpdatePromptOutput return fmt.Errorf("unexpected JSON type %v", value) } - var sv *UpdatePromptOutput + var sv *UpdateEvaluationFormOutput if *v == nil { - sv = &UpdatePromptOutput{} + sv = &UpdateEvaluationFormOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "PromptARN": + case "EvaluationFormArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.PromptARN = ptr.String(jtv) + sv.EvaluationFormArn = ptr.String(jtv) } - case "PromptId": + case "EvaluationFormId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) + return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) } - sv.PromptId = ptr.String(jtv) + sv.EvaluationFormId = ptr.String(jtv) + } + + case "EvaluationFormVersion": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected VersionNumber to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EvaluationFormVersion = int32(i64) } default: @@ -27880,14 +29077,14 @@ func awsRestjson1_deserializeOpDocumentUpdatePromptOutput(v **UpdatePromptOutput return nil } -type awsRestjson1_deserializeOpUpdateQueueHoursOfOperation struct { +type awsRestjson1_deserializeOpUpdateHoursOfOperation struct { } -func (*awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) ID() string { +func (*awsRestjson1_deserializeOpUpdateHoursOfOperation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateHoursOfOperation) 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) @@ -27901,9 +29098,9 @@ func (m *awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) HandleDeserializ } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(response, &metadata) } - output := &UpdateQueueHoursOfOperationOutput{} + output := &UpdateHoursOfOperationOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -27915,7 +29112,7 @@ func (m *awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) HandleDeserializ return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateHoursOfOperation(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)} @@ -27956,6 +29153,9 @@ func awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response *smithy } switch { + case strings.EqualFold("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -27981,14 +29181,14 @@ func awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response *smithy } } -type awsRestjson1_deserializeOpUpdateQueueMaxContacts struct { +type awsRestjson1_deserializeOpUpdateInstanceAttribute struct { } -func (*awsRestjson1_deserializeOpUpdateQueueMaxContacts) ID() string { +func (*awsRestjson1_deserializeOpUpdateInstanceAttribute) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQueueMaxContacts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateInstanceAttribute) 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) @@ -28002,9 +29202,9 @@ func (m *awsRestjson1_deserializeOpUpdateQueueMaxContacts) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response, &metadata) } - output := &UpdateQueueMaxContactsOutput{} + output := &UpdateInstanceAttributeOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28016,7 +29216,7 @@ func (m *awsRestjson1_deserializeOpUpdateQueueMaxContacts) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(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)} @@ -28082,14 +29282,14 @@ func awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response *smithyhttp. } } -type awsRestjson1_deserializeOpUpdateQueueName struct { +type awsRestjson1_deserializeOpUpdateInstanceStorageConfig struct { } -func (*awsRestjson1_deserializeOpUpdateQueueName) ID() string { +func (*awsRestjson1_deserializeOpUpdateInstanceStorageConfig) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQueueName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateInstanceStorageConfig) 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) @@ -28103,9 +29303,9 @@ func (m *awsRestjson1_deserializeOpUpdateQueueName) HandleDeserialize(ctx contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueName(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response, &metadata) } - output := &UpdateQueueNameOutput{} + output := &UpdateInstanceStorageConfigOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28117,7 +29317,7 @@ func (m *awsRestjson1_deserializeOpUpdateQueueName) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQueueName(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(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)} @@ -28158,9 +29358,6 @@ func awsRestjson1_deserializeOpErrorUpdateQueueName(response *smithyhttp.Respons } switch { - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -28186,14 +29383,14 @@ func awsRestjson1_deserializeOpErrorUpdateQueueName(response *smithyhttp.Respons } } -type awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig struct { +type awsRestjson1_deserializeOpUpdateParticipantRoleConfig struct { } -func (*awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) ID() string { +func (*awsRestjson1_deserializeOpUpdateParticipantRoleConfig) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateParticipantRoleConfig) 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) @@ -28207,21 +29404,15 @@ func (m *awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) HandleDeseri } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(response, &metadata) } - output := &UpdateQueueOutboundCallerConfigOutput{} + output := &UpdateParticipantRoleConfigOutput{} 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_deserializeOpErrorUpdateQueueOutboundCallerConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateParticipantRoleConfig(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)} @@ -28262,6 +29453,9 @@ func awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response *sm } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -28287,14 +29481,14 @@ func awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response *sm } } -type awsRestjson1_deserializeOpUpdateQueueStatus struct { +type awsRestjson1_deserializeOpUpdatePhoneNumber struct { } -func (*awsRestjson1_deserializeOpUpdateQueueStatus) ID() string { +func (*awsRestjson1_deserializeOpUpdatePhoneNumber) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQueueStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdatePhoneNumber) 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) @@ -28308,21 +29502,43 @@ func (m *awsRestjson1_deserializeOpUpdateQueueStatus) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueStatus(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdatePhoneNumber(response, &metadata) } - output := &UpdateQueueStatusOutput{} + output := &UpdatePhoneNumberOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentUpdatePhoneNumberOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQueueStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdatePhoneNumber(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)} @@ -28363,14 +29579,20 @@ func awsRestjson1_deserializeOpErrorUpdateQueueStatus(response *smithyhttp.Respo } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -28388,14 +29610,63 @@ func awsRestjson1_deserializeOpErrorUpdateQueueStatus(response *smithyhttp.Respo } } -type awsRestjson1_deserializeOpUpdateQuickConnectConfig struct { +func awsRestjson1_deserializeOpDocumentUpdatePhoneNumberOutput(v **UpdatePhoneNumberOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdatePhoneNumberOutput + if *v == nil { + sv = &UpdatePhoneNumberOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "PhoneNumberArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.PhoneNumberArn = ptr.String(jtv) + } + + case "PhoneNumberId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + } + sv.PhoneNumberId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateQuickConnectConfig) ID() string { +type awsRestjson1_deserializeOpUpdatePhoneNumberMetadata struct { +} + +func (*awsRestjson1_deserializeOpUpdatePhoneNumberMetadata) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQuickConnectConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdatePhoneNumberMetadata) 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) @@ -28409,9 +29680,9 @@ func (m *awsRestjson1_deserializeOpUpdateQuickConnectConfig) HandleDeserialize(c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(response, &metadata) } - output := &UpdateQuickConnectConfigOutput{} + output := &UpdatePhoneNumberMetadataOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28423,7 +29694,7 @@ func (m *awsRestjson1_deserializeOpUpdateQuickConnectConfig) HandleDeserialize(c return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdatePhoneNumberMetadata(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)} @@ -28464,6 +29735,12 @@ func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response *smithyhtt } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("IdempotencyException", errorCode): + return awsRestjson1_deserializeErrorIdempotencyException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -28473,6 +29750,9 @@ func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response *smithyhtt case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -28489,14 +29769,14 @@ func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response *smithyhtt } } -type awsRestjson1_deserializeOpUpdateQuickConnectName struct { +type awsRestjson1_deserializeOpUpdatePrompt struct { } -func (*awsRestjson1_deserializeOpUpdateQuickConnectName) ID() string { +func (*awsRestjson1_deserializeOpUpdatePrompt) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateQuickConnectName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdatePrompt) 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) @@ -28510,21 +29790,43 @@ func (m *awsRestjson1_deserializeOpUpdateQuickConnectName) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdatePrompt(response, &metadata) } - output := &UpdateQuickConnectNameOutput{} + output := &UpdatePromptOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentUpdatePromptOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdatePrompt(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)} @@ -28590,14 +29892,63 @@ func awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response *smithyhttp. } } -type awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer struct { +func awsRestjson1_deserializeOpDocumentUpdatePromptOutput(v **UpdatePromptOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdatePromptOutput + if *v == nil { + sv = &UpdatePromptOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "PromptARN": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.PromptARN = ptr.String(jtv) + } + + case "PromptId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) + } + sv.PromptId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) ID() string { +type awsRestjson1_deserializeOpUpdateQueueHoursOfOperation struct { +} + +func (*awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) 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) @@ -28611,9 +29962,9 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) H } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileAgentAvailabilityTimer(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response, &metadata) } - output := &UpdateRoutingProfileAgentAvailabilityTimerOutput{} + output := &UpdateQueueHoursOfOperationOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28625,7 +29976,7 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) H return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRoutingProfileAgentAvailabilityTimer(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(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)} @@ -28691,14 +30042,14 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileAgentAvailabilityTimer(r } } -type awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency struct { +type awsRestjson1_deserializeOpUpdateQueueMaxContacts struct { } -func (*awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) ID() string { +func (*awsRestjson1_deserializeOpUpdateQueueMaxContacts) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQueueMaxContacts) 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) @@ -28712,9 +30063,9 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) HandleDeseri } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response, &metadata) } - output := &UpdateRoutingProfileConcurrencyOutput{} + output := &UpdateQueueMaxContactsOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28726,7 +30077,7 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) HandleDeseri return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(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)} @@ -28792,14 +30143,14 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response *sm } } -type awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue struct { +type awsRestjson1_deserializeOpUpdateQueueName struct { } -func (*awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) ID() string { +func (*awsRestjson1_deserializeOpUpdateQueueName) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQueueName) 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) @@ -28813,9 +30164,9 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) Han } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueName(response, &metadata) } - output := &UpdateRoutingProfileDefaultOutboundQueueOutput{} + output := &UpdateQueueNameOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28827,7 +30178,7 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) Han return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQueueName(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)} @@ -28868,6 +30219,9 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(res } switch { + case strings.EqualFold("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -28893,14 +30247,14 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(res } } -type awsRestjson1_deserializeOpUpdateRoutingProfileName struct { +type awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig struct { } -func (*awsRestjson1_deserializeOpUpdateRoutingProfileName) ID() string { +func (*awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRoutingProfileName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) 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) @@ -28914,9 +30268,9 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileName) HandleDeserialize(c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response, &metadata) } - output := &UpdateRoutingProfileNameOutput{} + output := &UpdateQueueOutboundCallerConfigOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -28928,7 +30282,7 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileName) HandleDeserialize(c return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(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)} @@ -28969,9 +30323,6 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response *smithyhtt } switch { - case strings.EqualFold("DuplicateResourceException", errorCode): - return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -28997,14 +30348,14 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response *smithyhtt } } -type awsRestjson1_deserializeOpUpdateRoutingProfileQueues struct { +type awsRestjson1_deserializeOpUpdateQueueStatus struct { } -func (*awsRestjson1_deserializeOpUpdateRoutingProfileQueues) ID() string { +func (*awsRestjson1_deserializeOpUpdateQueueStatus) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQueueStatus) 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) @@ -29018,9 +30369,9 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileQueues) HandleDeserialize } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueStatus(response, &metadata) } - output := &UpdateRoutingProfileQueuesOutput{} + output := &UpdateQueueStatusOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29032,7 +30383,7 @@ func (m *awsRestjson1_deserializeOpUpdateRoutingProfileQueues) HandleDeserialize return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQueueStatus(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)} @@ -29098,14 +30449,14 @@ func awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response *smithyh } } -type awsRestjson1_deserializeOpUpdateRule struct { +type awsRestjson1_deserializeOpUpdateQuickConnectConfig struct { } -func (*awsRestjson1_deserializeOpUpdateRule) ID() string { +func (*awsRestjson1_deserializeOpUpdateQuickConnectConfig) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateRule) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQuickConnectConfig) 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) @@ -29119,9 +30470,9 @@ func (m *awsRestjson1_deserializeOpUpdateRule) HandleDeserialize(ctx context.Con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateRule(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response, &metadata) } - output := &UpdateRuleOutput{} + output := &UpdateQuickConnectConfigOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29133,7 +30484,7 @@ func (m *awsRestjson1_deserializeOpUpdateRule) HandleDeserialize(ctx context.Con return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateRule(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(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)} @@ -29174,18 +30525,15 @@ func awsRestjson1_deserializeOpErrorUpdateRule(response *smithyhttp.Response, me } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceConflictException", errorCode): - return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -29202,14 +30550,14 @@ func awsRestjson1_deserializeOpErrorUpdateRule(response *smithyhttp.Response, me } } -type awsRestjson1_deserializeOpUpdateSecurityProfile struct { +type awsRestjson1_deserializeOpUpdateQuickConnectName struct { } -func (*awsRestjson1_deserializeOpUpdateSecurityProfile) ID() string { +func (*awsRestjson1_deserializeOpUpdateQuickConnectName) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateSecurityProfile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateQuickConnectName) 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) @@ -29223,9 +30571,9 @@ func (m *awsRestjson1_deserializeOpUpdateSecurityProfile) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateSecurityProfile(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response, &metadata) } - output := &UpdateSecurityProfileOutput{} + output := &UpdateQuickConnectNameOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29237,7 +30585,7 @@ func (m *awsRestjson1_deserializeOpUpdateSecurityProfile) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateSecurityProfile(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateQuickConnectName(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)} @@ -29303,14 +30651,14 @@ func awsRestjson1_deserializeOpErrorUpdateSecurityProfile(response *smithyhttp.R } } -type awsRestjson1_deserializeOpUpdateTaskTemplate struct { +type awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer struct { } -func (*awsRestjson1_deserializeOpUpdateTaskTemplate) ID() string { +func (*awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateTaskTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRoutingProfileAgentAvailabilityTimer) 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) @@ -29324,43 +30672,21 @@ func (m *awsRestjson1_deserializeOpUpdateTaskTemplate) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateTaskTemplate(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileAgentAvailabilityTimer(response, &metadata) } - output := &UpdateTaskTemplateOutput{} + output := &UpdateRoutingProfileAgentAvailabilityTimerOutput{} 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_deserializeOpDocumentUpdateTaskTemplateOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), + Err: fmt.Errorf("failed to discard response body, %w", err), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateTaskTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRoutingProfileAgentAvailabilityTimer(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)} @@ -29407,15 +30733,12 @@ func awsRestjson1_deserializeOpErrorUpdateTaskTemplate(response *smithyhttp.Resp case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("PropertyValidationException", errorCode): - return awsRestjson1_deserializeErrorPropertyValidationException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(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) @@ -29429,155 +30752,14 @@ func awsRestjson1_deserializeOpErrorUpdateTaskTemplate(response *smithyhttp.Resp } } -func awsRestjson1_deserializeOpDocumentUpdateTaskTemplateOutput(v **UpdateTaskTemplateOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *UpdateTaskTemplateOutput - if *v == nil { - sv = &UpdateTaskTemplateOutput{} - } 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 TaskTemplateArn to be of type string, got %T instead", value) - } - sv.Arn = ptr.String(jtv) - } - - case "Constraints": - if err := awsRestjson1_deserializeDocumentTaskTemplateConstraints(&sv.Constraints, value); err != nil { - return err - } - - case "ContactFlowId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) - } - sv.ContactFlowId = ptr.String(jtv) - } - - case "CreatedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - - case "Defaults": - if err := awsRestjson1_deserializeDocumentTaskTemplateDefaults(&sv.Defaults, value); err != nil { - return err - } - - case "Description": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TaskTemplateDescription to be of type string, got %T instead", value) - } - sv.Description = ptr.String(jtv) - } - - case "Fields": - if err := awsRestjson1_deserializeDocumentTaskTemplateFields(&sv.Fields, value); err != nil { - return err - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TaskTemplateId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - case "InstanceId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) - } - sv.InstanceId = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - - case "Name": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TaskTemplateName to be of type string, got %T instead", value) - } - sv.Name = ptr.String(jtv) - } - - case "Status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TaskTemplateStatus to be of type string, got %T instead", value) - } - sv.Status = types.TaskTemplateStatus(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type awsRestjson1_deserializeOpUpdateTrafficDistribution struct { +type awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency struct { } -func (*awsRestjson1_deserializeOpUpdateTrafficDistribution) ID() string { +func (*awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateTrafficDistribution) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) 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) @@ -29591,15 +30773,21 @@ func (m *awsRestjson1_deserializeOpUpdateTrafficDistribution) HandleDeserialize( } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateTrafficDistribution(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response, &metadata) } - output := &UpdateTrafficDistributionOutput{} + output := &UpdateRoutingProfileConcurrencyOutput{} 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_deserializeOpErrorUpdateTrafficDistribution(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(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)} @@ -29640,18 +30828,15 @@ func awsRestjson1_deserializeOpErrorUpdateTrafficDistribution(response *smithyht } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceConflictException", errorCode): - return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -29668,14 +30853,14 @@ func awsRestjson1_deserializeOpErrorUpdateTrafficDistribution(response *smithyht } } -type awsRestjson1_deserializeOpUpdateUserHierarchy struct { +type awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue struct { } -func (*awsRestjson1_deserializeOpUpdateUserHierarchy) ID() string { +func (*awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserHierarchy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) 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) @@ -29689,9 +30874,9 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchy) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(response, &metadata) } - output := &UpdateUserHierarchyOutput{} + output := &UpdateRoutingProfileDefaultOutboundQueueOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29703,7 +30888,7 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchy) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(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)} @@ -29769,14 +30954,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response *smithyhttp.Res } } -type awsRestjson1_deserializeOpUpdateUserHierarchyGroupName struct { +type awsRestjson1_deserializeOpUpdateRoutingProfileName struct { } -func (*awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) ID() string { +func (*awsRestjson1_deserializeOpUpdateRoutingProfileName) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRoutingProfileName) 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) @@ -29790,9 +30975,9 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) HandleDeseriali } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response, &metadata) } - output := &UpdateUserHierarchyGroupNameOutput{} + output := &UpdateRoutingProfileNameOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29804,7 +30989,7 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) HandleDeseriali return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(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)} @@ -29873,14 +31058,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response *smith } } -type awsRestjson1_deserializeOpUpdateUserHierarchyStructure struct { +type awsRestjson1_deserializeOpUpdateRoutingProfileQueues struct { } -func (*awsRestjson1_deserializeOpUpdateUserHierarchyStructure) ID() string { +func (*awsRestjson1_deserializeOpUpdateRoutingProfileQueues) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserHierarchyStructure) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRoutingProfileQueues) 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) @@ -29894,9 +31079,9 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchyStructure) HandleDeseriali } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response, &metadata) } - output := &UpdateUserHierarchyStructureOutput{} + output := &UpdateRoutingProfileQueuesOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -29908,7 +31093,7 @@ func (m *awsRestjson1_deserializeOpUpdateUserHierarchyStructure) HandleDeseriali return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(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)} @@ -29958,9 +31143,6 @@ func awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response *smith case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -29977,14 +31159,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response *smith } } -type awsRestjson1_deserializeOpUpdateUserIdentityInfo struct { +type awsRestjson1_deserializeOpUpdateRule struct { } -func (*awsRestjson1_deserializeOpUpdateUserIdentityInfo) ID() string { +func (*awsRestjson1_deserializeOpUpdateRule) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserIdentityInfo) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateRule) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -29998,9 +31180,9 @@ func (m *awsRestjson1_deserializeOpUpdateUserIdentityInfo) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRule(response, &metadata) } - output := &UpdateUserIdentityInfoOutput{} + output := &UpdateRuleOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -30012,7 +31194,7 @@ func (m *awsRestjson1_deserializeOpUpdateUserIdentityInfo) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateRule(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -30053,15 +31235,18 @@ func awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response *smithyhttp. } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceConflictException", errorCode): + return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -30078,14 +31263,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response *smithyhttp. } } -type awsRestjson1_deserializeOpUpdateUserPhoneConfig struct { +type awsRestjson1_deserializeOpUpdateSecurityProfile struct { } -func (*awsRestjson1_deserializeOpUpdateUserPhoneConfig) ID() string { +func (*awsRestjson1_deserializeOpUpdateSecurityProfile) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserPhoneConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateSecurityProfile) 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) @@ -30099,9 +31284,9 @@ func (m *awsRestjson1_deserializeOpUpdateUserPhoneConfig) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateSecurityProfile(response, &metadata) } - output := &UpdateUserPhoneConfigOutput{} + output := &UpdateSecurityProfileOutput{} out.Result = output if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { @@ -30113,7 +31298,7 @@ func (m *awsRestjson1_deserializeOpUpdateUserPhoneConfig) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateSecurityProfile(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)} @@ -30179,14 +31364,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response *smithyhttp.R } } -type awsRestjson1_deserializeOpUpdateUserRoutingProfile struct { +type awsRestjson1_deserializeOpUpdateTaskTemplate struct { } -func (*awsRestjson1_deserializeOpUpdateUserRoutingProfile) ID() string { +func (*awsRestjson1_deserializeOpUpdateTaskTemplate) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserRoutingProfile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateTaskTemplate) 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) @@ -30200,21 +31385,43 @@ func (m *awsRestjson1_deserializeOpUpdateUserRoutingProfile) HandleDeserialize(c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateTaskTemplate(response, &metadata) } - output := &UpdateUserRoutingProfileOutput{} + output := &UpdateTaskTemplateOutput{} out.Result = output - if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + 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_deserializeOpDocumentUpdateTaskTemplateOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to discard response body, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateTaskTemplate(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)} @@ -30261,12 +31468,15 @@ func awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response *smithyhtt case strings.EqualFold("InvalidParameterException", errorCode): return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): - return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("PropertyValidationException", errorCode): + return awsRestjson1_deserializeErrorPropertyValidationException(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) @@ -30280,14 +31490,155 @@ func awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response *smithyhtt } } -type awsRestjson1_deserializeOpUpdateUserSecurityProfiles struct { +func awsRestjson1_deserializeOpDocumentUpdateTaskTemplateOutput(v **UpdateTaskTemplateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateTaskTemplateOutput + if *v == nil { + sv = &UpdateTaskTemplateOutput{} + } 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 TaskTemplateArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Constraints": + if err := awsRestjson1_deserializeDocumentTaskTemplateConstraints(&sv.Constraints, value); err != nil { + return err + } + + case "ContactFlowId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) + } + sv.ContactFlowId = ptr.String(jtv) + } + + case "CreatedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Defaults": + if err := awsRestjson1_deserializeDocumentTaskTemplateDefaults(&sv.Defaults, value); err != nil { + return err + } + + case "Description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TaskTemplateDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "Fields": + if err := awsRestjson1_deserializeDocumentTaskTemplateFields(&sv.Fields, value); err != nil { + return err + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TaskTemplateId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "InstanceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) + } + sv.InstanceId = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TaskTemplateName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TaskTemplateStatus to be of type string, got %T instead", value) + } + sv.Status = types.TaskTemplateStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil } -func (*awsRestjson1_deserializeOpUpdateUserSecurityProfiles) ID() string { +type awsRestjson1_deserializeOpUpdateTrafficDistribution struct { +} + +func (*awsRestjson1_deserializeOpUpdateTrafficDistribution) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateUserSecurityProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateTrafficDistribution) 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) @@ -30301,21 +31652,15 @@ func (m *awsRestjson1_deserializeOpUpdateUserSecurityProfiles) HandleDeserialize } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserSecurityProfiles(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateTrafficDistribution(response, &metadata) } - output := &UpdateUserSecurityProfilesOutput{} + output := &UpdateTrafficDistributionOutput{} 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_deserializeOpErrorUpdateUserSecurityProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateTrafficDistribution(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)} @@ -30356,15 +31701,18 @@ func awsRestjson1_deserializeOpErrorUpdateUserSecurityProfiles(response *smithyh } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) - case strings.EqualFold("InvalidParameterException", errorCode): - return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("ResourceConflictException", errorCode): + return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) @@ -30381,14 +31729,14 @@ func awsRestjson1_deserializeOpErrorUpdateUserSecurityProfiles(response *smithyh } } -type awsRestjson1_deserializeOpUpdateViewContent struct { +type awsRestjson1_deserializeOpUpdateUserHierarchy struct { } -func (*awsRestjson1_deserializeOpUpdateViewContent) ID() string { +func (*awsRestjson1_deserializeOpUpdateUserHierarchy) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateViewContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateUserHierarchy) 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) @@ -30402,43 +31750,21 @@ func (m *awsRestjson1_deserializeOpUpdateViewContent) HandleDeserialize(ctx cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateViewContent(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response, &metadata) } - output := &UpdateViewContentOutput{} + output := &UpdateUserHierarchyOutput{} 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_deserializeOpDocumentUpdateViewContentOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), + Err: fmt.Errorf("failed to discard response body, %w", err), } } return out, metadata, err } -func awsRestjson1_deserializeOpErrorUpdateViewContent(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateUserHierarchy(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)} @@ -30479,9 +31805,6 @@ func awsRestjson1_deserializeOpErrorUpdateViewContent(response *smithyhttp.Respo } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("InternalServiceException", errorCode): return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) @@ -30491,14 +31814,11 @@ func awsRestjson1_deserializeOpErrorUpdateViewContent(response *smithyhttp.Respo case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TooManyRequestsException", errorCode): - return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -30510,50 +31830,14 @@ func awsRestjson1_deserializeOpErrorUpdateViewContent(response *smithyhttp.Respo } } -func awsRestjson1_deserializeOpDocumentUpdateViewContentOutput(v **UpdateViewContentOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *UpdateViewContentOutput - if *v == nil { - sv = &UpdateViewContentOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "View": - if err := awsRestjson1_deserializeDocumentView(&sv.View, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type awsRestjson1_deserializeOpUpdateViewMetadata struct { +type awsRestjson1_deserializeOpUpdateUserHierarchyGroupName struct { } -func (*awsRestjson1_deserializeOpUpdateViewMetadata) ID() string { +func (*awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpUpdateViewMetadata) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) 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) @@ -30567,15 +31851,21 @@ func (m *awsRestjson1_deserializeOpUpdateViewMetadata) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorUpdateViewMetadata(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response, &metadata) } - output := &UpdateViewMetadataOutput{} + output := &UpdateUserHierarchyGroupNameOutput{} 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_deserializeOpErrorUpdateViewMetadata(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(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)} @@ -30616,9 +31906,6 @@ func awsRestjson1_deserializeOpErrorUpdateViewMetadata(response *smithyhttp.Resp } switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) - case strings.EqualFold("DuplicateResourceException", errorCode): return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) @@ -30631,14 +31918,11 @@ func awsRestjson1_deserializeOpErrorUpdateViewMetadata(response *smithyhttp.Resp case strings.EqualFold("InvalidRequestException", errorCode): return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - case strings.EqualFold("ResourceInUseException", errorCode): - return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TooManyRequestsException", errorCode): - return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) default: genericError := &smithy.GenericAPIError{ @@ -30650,99 +31934,63 @@ func awsRestjson1_deserializeOpErrorUpdateViewMetadata(response *smithyhttp.Resp } } -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 - } +type awsRestjson1_deserializeOpUpdateUserHierarchyStructure struct { +} - err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) +func (*awsRestjson1_deserializeOpUpdateUserHierarchyStructure) ID() string { + return "OperationDeserializer" +} +func (m *awsRestjson1_deserializeOpUpdateUserHierarchyStructure) 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 { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err + return out, metadata, err } - errorBody.Seek(0, io.SeekStart) - - return output -} + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } -func awsRestjson1_deserializeErrorContactFlowNotPublishedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ContactFlowNotPublishedException{} - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response, &metadata) + } + output := &UpdateUserHierarchyStructureOutput{} + out.Result = output - 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(), + 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 err } - err := awsRestjson1_deserializeDocumentContactFlowNotPublishedException(&output, shape) + return out, metadata, err +} - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err +func awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(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()) - errorBody.Seek(0, io.SeekStart) + errorCode := "UnknownError" + errorMessage := errorCode - return output -} + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } -func awsRestjson1_deserializeErrorContactNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ContactNotFoundException{} 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_deserializeDocumentContactNotFoundException(&output, shape) - + jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -30754,103 +32002,99 @@ func awsRestjson1_deserializeErrorContactNotFoundException(response *smithyhttp. } errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } - return output -} + switch { + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) -func awsRestjson1_deserializeErrorDestinationNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.DestinationNotAllowedException{} - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - 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 - } + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - err := awsRestjson1_deserializeDocumentDestinationNotAllowedException(&output, shape) + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, } - return err + return genericError + } +} - errorBody.Seek(0, io.SeekStart) +type awsRestjson1_deserializeOpUpdateUserIdentityInfo struct { +} - return output +func (*awsRestjson1_deserializeOpUpdateUserIdentityInfo) ID() string { + return "OperationDeserializer" } -func awsRestjson1_deserializeErrorDuplicateResourceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.DuplicateResourceException{} - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) +func (m *awsRestjson1_deserializeOpUpdateUserIdentityInfo) 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 + } - 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 + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - err := awsRestjson1_deserializeDocumentDuplicateResourceException(&output, shape) + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response, &metadata) + } + output := &UpdateUserIdentityInfoOutput{} + out.Result = output - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), + 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 err } - errorBody.Seek(0, io.SeekStart) - - return output + return out, metadata, err } -func awsRestjson1_deserializeErrorIdempotencyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.IdempotencyException{} +func awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(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() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot 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_deserializeDocumentIdempotencyException(&output, shape) - + jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -30862,103 +32106,96 @@ func awsRestjson1_deserializeErrorIdempotencyException(response *smithyhttp.Resp } errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } - return output -} + switch { + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) -func awsRestjson1_deserializeErrorInternalServiceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.InternalServiceException{} - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) - 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 - } + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) - err := awsRestjson1_deserializeDocumentInternalServiceException(&output, shape) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, } - return err + return genericError + } +} - errorBody.Seek(0, io.SeekStart) +type awsRestjson1_deserializeOpUpdateUserPhoneConfig struct { +} - return output +func (*awsRestjson1_deserializeOpUpdateUserPhoneConfig) ID() string { + return "OperationDeserializer" } -func awsRestjson1_deserializeErrorInvalidContactFlowException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.InvalidContactFlowException{} - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) +func (m *awsRestjson1_deserializeOpUpdateUserPhoneConfig) 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 + } - 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 + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - err := awsRestjson1_deserializeDocumentInvalidContactFlowException(&output, shape) + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response, &metadata) + } + output := &UpdateUserPhoneConfigOutput{} + out.Result = output - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), + 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 err } - errorBody.Seek(0, io.SeekStart) - - return output + return out, metadata, err } -func awsRestjson1_deserializeErrorInvalidContactFlowModuleException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.InvalidContactFlowModuleException{} +func awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(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() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot 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_deserializeDocumentInvalidContactFlowModuleException(&output, shape) - + jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -30970,20 +32207,97 @@ func awsRestjson1_deserializeErrorInvalidContactFlowModuleException(response *sm } 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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateUserRoutingProfile struct { +} + +func (*awsRestjson1_deserializeOpUpdateUserRoutingProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateUserRoutingProfile) 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_deserializeOpErrorUpdateUserRoutingProfile(response, &metadata) + } + output := &UpdateUserRoutingProfileOutput{} + 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_deserializeOpErrorUpdateUserRoutingProfile(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) + } - 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 { + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ @@ -30993,8 +32307,97 @@ func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp return err } - err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape) + 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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateUserSecurityProfiles struct { +} + +func (*awsRestjson1_deserializeOpUpdateUserSecurityProfiles) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateUserSecurityProfiles) 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_deserializeOpErrorUpdateUserSecurityProfiles(response, &metadata) + } + output := &UpdateUserSecurityProfilesOutput{} + 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_deserializeOpErrorUpdateUserSecurityProfiles(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) @@ -31006,16 +32409,70 @@ func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp } errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } - return output + switch { + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } } -func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.InvalidRequestException{} +type awsRestjson1_deserializeOpUpdateViewContent struct { +} + +func (*awsRestjson1_deserializeOpUpdateViewContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateViewContent) 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_deserializeOpErrorUpdateViewContent(response, &metadata) + } + output := &UpdateViewContentOutput{} + out.Result = output + var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) - body := io.TeeReader(errorBody, ringBuffer) + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} @@ -31026,36 +32483,45 @@ func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.R Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } - return err + return out, metadata, err } - err := awsRestjson1_deserializeDocumentInvalidRequestException(&output, shape) - + err = awsRestjson1_deserializeOpDocumentUpdateViewContentOutput(&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), + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), Snapshot: snapshot.Bytes(), } - return err } - errorBody.Seek(0, io.SeekStart) - - return output + return out, metadata, err } -func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.LimitExceededException{} +func awsRestjson1_deserializeOpErrorUpdateViewContent(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() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ @@ -31065,8 +32531,133 @@ func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Re return err } - err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) + 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("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateViewContentOutput(v **UpdateViewContentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateViewContentOutput + if *v == nil { + sv = &UpdateViewContentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "View": + if err := awsRestjson1_deserializeDocumentView(&sv.View, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateViewMetadata struct { +} + +func (*awsRestjson1_deserializeOpUpdateViewMetadata) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateViewMetadata) 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_deserializeOpErrorUpdateViewMetadata(response, &metadata) + } + output := &UpdateViewMetadataOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateViewMetadata(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) @@ -31078,12 +32669,50 @@ func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Re } errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } - return output + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("DuplicateResourceException", errorCode): + return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) + + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } } -func awsRestjson1_deserializeErrorMaximumResultReturnedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.MaximumResultReturnedException{} +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31101,7 +32730,7 @@ func awsRestjson1_deserializeErrorMaximumResultReturnedException(response *smith return err } - err := awsRestjson1_deserializeDocumentMaximumResultReturnedException(&output, shape) + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31118,8 +32747,8 @@ func awsRestjson1_deserializeErrorMaximumResultReturnedException(response *smith return output } -func awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.OutboundContactNotPermittedException{} +func awsRestjson1_deserializeErrorContactFlowNotPublishedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ContactFlowNotPublishedException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31137,7 +32766,7 @@ func awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response return err } - err := awsRestjson1_deserializeDocumentOutboundContactNotPermittedException(&output, shape) + err := awsRestjson1_deserializeDocumentContactFlowNotPublishedException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31154,8 +32783,8 @@ func awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response return output } -func awsRestjson1_deserializeErrorPropertyValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.PropertyValidationException{} +func awsRestjson1_deserializeErrorContactNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ContactNotFoundException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31173,7 +32802,7 @@ func awsRestjson1_deserializeErrorPropertyValidationException(response *smithyht return err } - err := awsRestjson1_deserializeDocumentPropertyValidationException(&output, shape) + err := awsRestjson1_deserializeDocumentContactNotFoundException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31190,8 +32819,8 @@ func awsRestjson1_deserializeErrorPropertyValidationException(response *smithyht return output } -func awsRestjson1_deserializeErrorResourceConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ResourceConflictException{} +func awsRestjson1_deserializeErrorDestinationNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.DestinationNotAllowedException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31209,7 +32838,7 @@ func awsRestjson1_deserializeErrorResourceConflictException(response *smithyhttp return err } - err := awsRestjson1_deserializeDocumentResourceConflictException(&output, shape) + err := awsRestjson1_deserializeDocumentDestinationNotAllowedException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31226,8 +32855,8 @@ func awsRestjson1_deserializeErrorResourceConflictException(response *smithyhttp return output } -func awsRestjson1_deserializeErrorResourceInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ResourceInUseException{} +func awsRestjson1_deserializeErrorDuplicateResourceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.DuplicateResourceException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31245,7 +32874,7 @@ func awsRestjson1_deserializeErrorResourceInUseException(response *smithyhttp.Re return err } - err := awsRestjson1_deserializeDocumentResourceInUseException(&output, shape) + err := awsRestjson1_deserializeDocumentDuplicateResourceException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31262,8 +32891,8 @@ func awsRestjson1_deserializeErrorResourceInUseException(response *smithyhttp.Re return output } -func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ResourceNotFoundException{} +func awsRestjson1_deserializeErrorIdempotencyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.IdempotencyException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31281,7 +32910,7 @@ func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp return err } - err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + err := awsRestjson1_deserializeDocumentIdempotencyException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31298,8 +32927,8 @@ func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp return output } -func awsRestjson1_deserializeErrorResourceNotReadyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ResourceNotReadyException{} +func awsRestjson1_deserializeErrorInternalServiceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InternalServiceException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31317,7 +32946,7 @@ func awsRestjson1_deserializeErrorResourceNotReadyException(response *smithyhttp return err } - err := awsRestjson1_deserializeDocumentResourceNotReadyException(&output, shape) + err := awsRestjson1_deserializeDocumentInternalServiceException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31334,8 +32963,8 @@ func awsRestjson1_deserializeErrorResourceNotReadyException(response *smithyhttp return output } -func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ServiceQuotaExceededException{} +func awsRestjson1_deserializeErrorInvalidContactFlowException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidContactFlowException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31353,7 +32982,7 @@ func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithy return err } - err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) + err := awsRestjson1_deserializeDocumentInvalidContactFlowException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31370,8 +32999,8 @@ func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithy return output } -func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.ThrottlingException{} +func awsRestjson1_deserializeErrorInvalidContactFlowModuleException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidContactFlowModuleException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31389,7 +33018,7 @@ func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Respo return err } - err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + err := awsRestjson1_deserializeDocumentInvalidContactFlowModuleException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31406,8 +33035,8 @@ func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Respo return output } -func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.TooManyRequestsException{} +func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidParameterException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31425,7 +33054,7 @@ func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp. return err } - err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) + err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31442,8 +33071,8 @@ func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp. return output } -func awsRestjson1_deserializeErrorUserNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - output := &types.UserNotFoundException{} +func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidRequestException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -31461,7 +33090,7 @@ func awsRestjson1_deserializeErrorUserNotFoundException(response *smithyhttp.Res return err } - err := awsRestjson1_deserializeDocumentUserNotFoundException(&output, shape) + err := awsRestjson1_deserializeDocumentInvalidRequestException(&output, shape) if err != nil { var snapshot bytes.Buffer @@ -31478,16 +33107,484 @@ func awsRestjson1_deserializeErrorUserNotFoundException(response *smithyhttp.Res 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 { +func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.LimitExceededException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorMaximumResultReturnedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MaximumResultReturnedException{} + 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_deserializeDocumentMaximumResultReturnedException(&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_deserializeErrorOutboundContactNotPermittedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.OutboundContactNotPermittedException{} + 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_deserializeDocumentOutboundContactNotPermittedException(&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_deserializeErrorOutputTypeNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.OutputTypeNotFoundException{} + 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_deserializeDocumentOutputTypeNotFoundException(&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_deserializeErrorPropertyValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.PropertyValidationException{} + 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_deserializeDocumentPropertyValidationException(&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_deserializeErrorResourceConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceConflictException{} + 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_deserializeDocumentResourceConflictException(&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_deserializeErrorResourceInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceInUseException{} + 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_deserializeDocumentResourceInUseException(&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_deserializeErrorResourceNotReadyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotReadyException{} + 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_deserializeDocumentResourceNotReadyException(&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_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_deserializeErrorUserNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.UserNotFoundException{} + 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_deserializeDocumentUserNotFoundException(&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) } @@ -32177,7 +34274,7 @@ func awsRestjson1_deserializeDocumentAllowedAccessControlTags(v *map[string]stri return nil } -func awsRestjson1_deserializeDocumentApplication(v **types.Application, value interface{}) error { +func awsRestjson1_deserializeDocumentAnalyticsDataAssociationResult(v **types.AnalyticsDataAssociationResult, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -32190,27 +34287,49 @@ func awsRestjson1_deserializeDocumentApplication(v **types.Application, value in return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.Application + var sv *types.AnalyticsDataAssociationResult if *v == nil { - sv = &types.Application{} + sv = &types.AnalyticsDataAssociationResult{} } else { sv = *v } for key, value := range shape { switch key { - case "ApplicationPermissions": - if err := awsRestjson1_deserializeDocumentApplicationPermissions(&sv.ApplicationPermissions, value); err != nil { - return err + case "DataSetId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSetId to be of type string, got %T instead", value) + } + sv.DataSetId = ptr.String(jtv) } - case "Namespace": + case "ResourceShareArn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Namespace to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.Namespace = ptr.String(jtv) + sv.ResourceShareArn = ptr.String(jtv) + } + + case "ResourceShareId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceShareId = ptr.String(jtv) + } + + case "TargetAccountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AWSAccountId to be of type string, got %T instead", value) + } + sv.TargetAccountId = ptr.String(jtv) } default: @@ -32222,7 +34341,7 @@ func awsRestjson1_deserializeDocumentApplication(v **types.Application, value in return nil } -func awsRestjson1_deserializeDocumentApplicationPermissions(v *[]string, value interface{}) error { +func awsRestjson1_deserializeDocumentAnalyticsDataAssociationResults(v *[]types.AnalyticsDataAssociationResult, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -32235,21 +34354,100 @@ func awsRestjson1_deserializeDocumentApplicationPermissions(v *[]string, value i return fmt.Errorf("unexpected JSON type %v", value) } - var cv []string + var cv []types.AnalyticsDataAssociationResult if *v == nil { - cv = []string{} + cv = []types.AnalyticsDataAssociationResult{} } else { cv = *v } for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Permission to be of type string, got %T instead", value) - } - col = jtv + var col types.AnalyticsDataAssociationResult + destAddr := &col + if err := awsRestjson1_deserializeDocumentAnalyticsDataAssociationResult(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentApplication(v **types.Application, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Application + if *v == nil { + sv = &types.Application{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ApplicationPermissions": + if err := awsRestjson1_deserializeDocumentApplicationPermissions(&sv.ApplicationPermissions, value); err != nil { + return err + } + + case "Namespace": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Namespace to be of type string, got %T instead", value) + } + sv.Namespace = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentApplicationPermissions(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 Permission to be of type string, got %T instead", value) + } + col = jtv } cv = append(cv, col) @@ -32381,6 +34579,55 @@ func awsRestjson1_deserializeDocumentAttachmentReference(v **types.AttachmentRef return nil } +func awsRestjson1_deserializeDocumentAttendee(v **types.Attendee, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Attendee + if *v == nil { + sv = &types.Attendee{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AttendeeId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttendeeId to be of type string, got %T instead", value) + } + sv.AttendeeId = ptr.String(jtv) + } + + case "JoinToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected JoinToken to be of type string, got %T instead", value) + } + sv.JoinToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentAttribute(v **types.Attribute, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -32500,6 +34747,46 @@ func awsRestjson1_deserializeDocumentAttributesList(v *[]types.Attribute, value return nil } +func awsRestjson1_deserializeDocumentAudioFeatures(v **types.AudioFeatures, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AudioFeatures + if *v == nil { + sv = &types.AudioFeatures{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EchoReduction": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MeetingFeatureStatus to be of type string, got %T instead", value) + } + sv.EchoReduction = types.MeetingFeatureStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentAvailableNumbersList(v *[]types.AvailableNumberSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -32722,6 +35009,15 @@ func awsRestjson1_deserializeDocumentClaimedPhoneNumberSummary(v **types.Claimed sv.PhoneNumberType = types.PhoneNumberType(jtv) } + case "SourcePhoneNumberArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.SourcePhoneNumberArn = ptr.String(jtv) + } + case "Tags": if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err @@ -32745,6 +35041,47 @@ func awsRestjson1_deserializeDocumentClaimedPhoneNumberSummary(v **types.Claimed return nil } +func awsRestjson1_deserializeDocumentConnectionData(v **types.ConnectionData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ConnectionData + if *v == nil { + sv = &types.ConnectionData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Attendee": + if err := awsRestjson1_deserializeDocumentAttendee(&sv.Attendee, value); err != nil { + return err + } + + case "Meeting": + if err := awsRestjson1_deserializeDocumentMeeting(&sv.Meeting, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentContact(v **types.Contact, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -33809,6 +36146,42 @@ func awsRestjson1_deserializeDocumentCurrentMetricResults(v *[]types.CurrentMetr return nil } +func awsRestjson1_deserializeDocumentDataSetIds(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 DataSetId to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentDateReference(v **types.DateReference, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -34310,6 +36683,89 @@ func awsRestjson1_deserializeDocumentEncryptionConfig(v **types.EncryptionConfig return nil } +func awsRestjson1_deserializeDocumentErrorResult(v **types.ErrorResult, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ErrorResult + if *v == nil { + sv = &types.ErrorResult{} + } 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 "ErrorMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ErrorMessage = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentErrorResults(v *[]types.ErrorResult, 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.ErrorResult + if *v == nil { + cv = []types.ErrorResult{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ErrorResult + destAddr := &col + if err := awsRestjson1_deserializeDocumentErrorResult(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentEvaluation(v **types.Evaluation, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -36020,28 +38476,1461 @@ func awsRestjson1_deserializeDocumentEvaluationFormVersionSummary(v **types.Eval } sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Locked": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected EvaluationFormVersionIsLocked to be of type *bool, got %T instead", value) + } + sv.Locked = jtv + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EvaluationFormVersionStatus to be of type string, got %T instead", value) + } + sv.Status = types.EvaluationFormVersionStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(v *[]types.EvaluationFormVersionSummary, 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.EvaluationFormVersionSummary + if *v == nil { + cv = []types.EvaluationFormVersionSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.EvaluationFormVersionSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentEvaluationFormVersionSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationMetadata(v **types.EvaluationMetadata, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EvaluationMetadata + if *v == nil { + sv = &types.EvaluationMetadata{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ContactAgentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + } + sv.ContactAgentId = ptr.String(jtv) + } + + case "ContactId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } + + case "EvaluatorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.EvaluatorArn = ptr.String(jtv) + } + + case "Score": + if err := awsRestjson1_deserializeDocumentEvaluationScore(&sv.Score, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationNote(v **types.EvaluationNote, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EvaluationNote + if *v == nil { + sv = &types.EvaluationNote{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Value": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EvaluationNoteString to be of type string, got %T instead", value) + } + sv.Value = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationNotesMap(v *map[string]types.EvaluationNote, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.EvaluationNote + if *v == nil { + mv = map[string]types.EvaluationNote{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.EvaluationNote + mapVar := parsedVal + destAddr := &mapVar + if err := awsRestjson1_deserializeDocumentEvaluationNote(&destAddr, value); err != nil { + return err + } + parsedVal = *destAddr + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationScore(v **types.EvaluationScore, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EvaluationScore + if *v == nil { + sv = &types.EvaluationScore{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AutomaticFail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.AutomaticFail = jtv + } + + case "NotApplicable": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.NotApplicable = jtv + } + + case "Percentage": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Percentage = f64 + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Percentage = f64 + + default: + return fmt.Errorf("expected EvaluationScorePercentage to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationScoresMap(v *map[string]types.EvaluationScore, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.EvaluationScore + if *v == nil { + mv = map[string]types.EvaluationScore{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.EvaluationScore + mapVar := parsedVal + destAddr := &mapVar + if err := awsRestjson1_deserializeDocumentEvaluationScore(&destAddr, value); err != nil { + return err + } + parsedVal = *destAddr + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationSummary(v **types.EvaluationSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EvaluationSummary + if *v == nil { + sv = &types.EvaluationSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CreatedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "EvaluationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.EvaluationArn = ptr.String(jtv) + } + + case "EvaluationFormId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + } + sv.EvaluationFormId = ptr.String(jtv) + } + + case "EvaluationFormTitle": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EvaluationFormTitle to be of type string, got %T instead", value) + } + sv.EvaluationFormTitle = ptr.String(jtv) + } + + case "EvaluationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + } + sv.EvaluationId = ptr.String(jtv) + } + + case "EvaluatorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.EvaluatorArn = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Score": + if err := awsRestjson1_deserializeDocumentEvaluationScore(&sv.Score, value); err != nil { + return err + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EvaluationStatus to be of type string, got %T instead", value) + } + sv.Status = types.EvaluationStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEvaluationSummaryList(v *[]types.EvaluationSummary, 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.EvaluationSummary + if *v == nil { + cv = []types.EvaluationSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.EvaluationSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentEvaluationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentEventBridgeActionDefinition(v **types.EventBridgeActionDefinition, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EventBridgeActionDefinition + if *v == nil { + sv = &types.EventBridgeActionDefinition{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EventBridgeActionName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFailedRequest(v **types.FailedRequest, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FailedRequest + if *v == nil { + sv = &types.FailedRequest{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "FailureReasonCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailureReasonCode to be of type string, got %T instead", value) + } + sv.FailureReasonCode = types.FailureReasonCode(jtv) + } + + case "FailureReasonMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.FailureReasonMessage = ptr.String(jtv) + } + + case "RequestIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RequestIdentifier to be of type string, got %T instead", value) + } + sv.RequestIdentifier = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFailedRequestList(v *[]types.FailedRequest, 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.FailedRequest + if *v == nil { + cv = []types.FailedRequest{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.FailedRequest + destAddr := &col + if err := awsRestjson1_deserializeDocumentFailedRequest(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentFlowAssociationSummary(v **types.FlowAssociationSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FlowAssociationSummary + if *v == nil { + sv = &types.FlowAssociationSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "FlowId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.FlowId = ptr.String(jtv) + } + + case "ResourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN 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 ListFlowAssociationResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ListFlowAssociationResourceType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFlowAssociationSummaryList(v *[]types.FlowAssociationSummary, 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.FlowAssociationSummary + if *v == nil { + cv = []types.FlowAssociationSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.FlowAssociationSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentFlowAssociationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentFunctionArnsList(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 FunctionArn to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyGroup + if *v == nil { + sv = &types.HierarchyGroup{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "HierarchyPath": + if err := awsRestjson1_deserializeDocumentHierarchyPath(&sv.HierarchyPath, value); err != nil { + return err + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "LevelId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) + } + sv.LevelId = ptr.String(jtv) + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "Tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyGroupSummary(v **types.HierarchyGroupSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyGroupSummary + if *v == nil { + sv = &types.HierarchyGroupSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.HierarchyGroupSummary, 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.HierarchyGroupSummary + if *v == nil { + cv = []types.HierarchyGroupSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.HierarchyGroupSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(v **types.HierarchyGroupSummaryReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyGroupSummaryReference + if *v == nil { + sv = &types.HierarchyGroupSummaryReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyLevel(v **types.HierarchyLevel, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyLevel + if *v == nil { + sv = &types.HierarchyLevel{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyLevelName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyPath + if *v == nil { + sv = &types.HierarchyPath{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "LevelFive": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFive, value); err != nil { + return err + } + + case "LevelFour": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFour, value); err != nil { + return err + } + + case "LevelOne": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelOne, value); err != nil { + return err + } + + case "LevelThree": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelThree, value); err != nil { + return err + } + + case "LevelTwo": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelTwo, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyPathReference(v **types.HierarchyPathReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyPathReference + if *v == nil { + sv = &types.HierarchyPathReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "LevelFive": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFive, value); err != nil { + return err + } + + case "LevelFour": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFour, value); err != nil { + return err + } + + case "LevelOne": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelOne, value); err != nil { + return err + } + + case "LevelThree": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelThree, value); err != nil { + return err + } + + case "LevelTwo": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelTwo, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStructure, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HierarchyStructure + if *v == nil { + sv = &types.HierarchyStructure{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "LevelFive": + if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFive, value); err != nil { + return err + } + + case "LevelFour": + if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFour, value); err != nil { + return err + } + + case "LevelOne": + if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelOne, value); err != nil { + return err + } + + case "LevelThree": + if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelThree, value); err != nil { + return err + } + + case "LevelTwo": + if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelTwo, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHistoricalMetric(v **types.HistoricalMetric, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HistoricalMetric + if *v == nil { + sv = &types.HistoricalMetric{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HistoricalMetricName to be of type string, got %T instead", value) + } + sv.Name = types.HistoricalMetricName(jtv) + } + + case "Statistic": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Statistic to be of type string, got %T instead", value) + } + sv.Statistic = types.Statistic(jtv) + } + + case "Threshold": + if err := awsRestjson1_deserializeDocumentThreshold(&sv.Threshold, value); err != nil { + return err + } + + case "Unit": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Unit to be of type string, got %T instead", value) + } + sv.Unit = types.Unit(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHistoricalMetricData(v **types.HistoricalMetricData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HistoricalMetricData + if *v == nil { + sv = &types.HistoricalMetricData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Metric": + if err := awsRestjson1_deserializeDocumentHistoricalMetric(&sv.Metric, value); err != nil { + return err + } + + case "Value": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Value = ptr.Float64(f64) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Value = ptr.Float64(f64) + + default: + return fmt.Errorf("expected Value to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(v *[]types.HistoricalMetricData, 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.HistoricalMetricData + if *v == nil { + cv = []types.HistoricalMetricData{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.HistoricalMetricData + destAddr := &col + if err := awsRestjson1_deserializeDocumentHistoricalMetricData(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentHistoricalMetricResult(v **types.HistoricalMetricResult, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HistoricalMetricResult + if *v == nil { + sv = &types.HistoricalMetricResult{} + } else { + sv = *v + } - case "Locked": - if value != nil { - jtv, ok := value.(bool) - if !ok { - return fmt.Errorf("expected EvaluationFormVersionIsLocked to be of type *bool, got %T instead", value) - } - sv.Locked = jtv + for key, value := range shape { + switch key { + case "Collections": + if err := awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(&sv.Collections, value); err != nil { + return err } - case "Status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected EvaluationFormVersionStatus to be of type string, got %T instead", value) - } - sv.Status = types.EvaluationFormVersionStatus(jtv) + case "Dimensions": + if err := awsRestjson1_deserializeDocumentDimensions(&sv.Dimensions, value); err != nil { + return err } default: @@ -36053,7 +39942,7 @@ func awsRestjson1_deserializeDocumentEvaluationFormVersionSummary(v **types.Eval return nil } -func awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(v *[]types.EvaluationFormVersionSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentHistoricalMetricResults(v *[]types.HistoricalMetricResult, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36066,17 +39955,17 @@ func awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(v *[]types return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.EvaluationFormVersionSummary + var cv []types.HistoricalMetricResult if *v == nil { - cv = []types.EvaluationFormVersionSummary{} + cv = []types.HistoricalMetricResult{} } else { cv = *v } for _, value := range shape { - var col types.EvaluationFormVersionSummary + var col types.HistoricalMetricResult destAddr := &col - if err := awsRestjson1_deserializeDocumentEvaluationFormVersionSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentHistoricalMetricResult(&destAddr, value); err != nil { return err } col = *destAddr @@ -36087,7 +39976,7 @@ func awsRestjson1_deserializeDocumentEvaluationFormVersionSummaryList(v *[]types return nil } -func awsRestjson1_deserializeDocumentEvaluationMetadata(v **types.EvaluationMetadata, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperation(v **types.HoursOfOperation, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36100,47 +39989,95 @@ func awsRestjson1_deserializeDocumentEvaluationMetadata(v **types.EvaluationMeta return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.EvaluationMetadata + var sv *types.HoursOfOperation if *v == nil { - sv = &types.EvaluationMetadata{} + sv = &types.HoursOfOperation{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactAgentId": + case "Config": + if err := awsRestjson1_deserializeDocumentHoursOfOperationConfigList(&sv.Config, value); err != nil { + return err + } + + case "Description": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationDescription to be of type string, got %T instead", value) } - sv.ContactAgentId = ptr.String(jtv) + sv.Description = ptr.String(jtv) } - case "ContactId": + case "HoursOfOperationArn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.ContactId = ptr.String(jtv) + sv.HoursOfOperationArn = ptr.String(jtv) } - case "EvaluatorArn": + case "HoursOfOperationId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) } - sv.EvaluatorArn = ptr.String(jtv) + sv.HoursOfOperationId = ptr.String(jtv) } - case "Score": - if err := awsRestjson1_deserializeDocumentEvaluationScore(&sv.Score, value); err != nil { + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "Tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err } + case "TimeZone": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TimeZone to be of type string, got %T instead", value) + } + sv.TimeZone = ptr.String(jtv) + } + default: _, _ = key, value @@ -36150,7 +40087,7 @@ func awsRestjson1_deserializeDocumentEvaluationMetadata(v **types.EvaluationMeta return nil } -func awsRestjson1_deserializeDocumentEvaluationNote(v **types.EvaluationNote, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationConfig(v **types.HoursOfOperationConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36163,22 +40100,32 @@ func awsRestjson1_deserializeDocumentEvaluationNote(v **types.EvaluationNote, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.EvaluationNote + var sv *types.HoursOfOperationConfig if *v == nil { - sv = &types.EvaluationNote{} + sv = &types.HoursOfOperationConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Value": + case "Day": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected EvaluationNoteString to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationDays to be of type string, got %T instead", value) } - sv.Value = ptr.String(jtv) + sv.Day = types.HoursOfOperationDays(jtv) + } + + case "EndTime": + if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.EndTime, value); err != nil { + return err + } + + case "StartTime": + if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.StartTime, value); err != nil { + return err } default: @@ -36190,7 +40137,7 @@ func awsRestjson1_deserializeDocumentEvaluationNote(v **types.EvaluationNote, va return nil } -func awsRestjson1_deserializeDocumentEvaluationNotesMap(v *map[string]types.EvaluationNote, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationConfigList(v *[]types.HoursOfOperationConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36198,117 +40145,33 @@ func awsRestjson1_deserializeDocumentEvaluationNotesMap(v *map[string]types.Eval return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var mv map[string]types.EvaluationNote + var cv []types.HoursOfOperationConfig if *v == nil { - mv = map[string]types.EvaluationNote{} + cv = []types.HoursOfOperationConfig{} } else { - mv = *v + cv = *v } - for key, value := range shape { - var parsedVal types.EvaluationNote - mapVar := parsedVal - destAddr := &mapVar - if err := awsRestjson1_deserializeDocumentEvaluationNote(&destAddr, value); err != nil { + for _, value := range shape { + var col types.HoursOfOperationConfig + destAddr := &col + if err := awsRestjson1_deserializeDocumentHoursOfOperationConfig(&destAddr, value); err != nil { return err } - parsedVal = *destAddr - mv[key] = parsedVal - - } - *v = mv - return nil -} - -func awsRestjson1_deserializeDocumentEvaluationScore(v **types.EvaluationScore, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", 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.EvaluationScore - if *v == nil { - sv = &types.EvaluationScore{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AutomaticFail": - if value != nil { - jtv, ok := value.(bool) - if !ok { - return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) - } - sv.AutomaticFail = jtv - } - - case "NotApplicable": - if value != nil { - jtv, ok := value.(bool) - if !ok { - return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) - } - sv.NotApplicable = jtv - } - - case "Percentage": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Percentage = f64 - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Percentage = f64 - - default: - return fmt.Errorf("expected EvaluationScorePercentage to be a JSON Number, got %T instead", value) - - } - } - - default: - _, _ = key, value + col = *destAddr + cv = append(cv, col) - } } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentEvaluationScoresMap(v *map[string]types.EvaluationScore, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationList(v *[]types.HoursOfOperation, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36316,34 +40179,33 @@ func awsRestjson1_deserializeDocumentEvaluationScoresMap(v *map[string]types.Eva return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var mv map[string]types.EvaluationScore + var cv []types.HoursOfOperation if *v == nil { - mv = map[string]types.EvaluationScore{} + cv = []types.HoursOfOperation{} } else { - mv = *v + cv = *v } - for key, value := range shape { - var parsedVal types.EvaluationScore - mapVar := parsedVal - destAddr := &mapVar - if err := awsRestjson1_deserializeDocumentEvaluationScore(&destAddr, value); err != nil { + for _, value := range shape { + var col types.HoursOfOperation + destAddr := &col + if err := awsRestjson1_deserializeDocumentHoursOfOperation(&destAddr, value); err != nil { return err } - parsedVal = *destAddr - mv[key] = parsedVal + col = *destAddr + cv = append(cv, col) } - *v = mv + *v = cv return nil } -func awsRestjson1_deserializeDocumentEvaluationSummary(v **types.EvaluationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationSummary(v **types.HoursOfOperationSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36356,74 +40218,40 @@ func awsRestjson1_deserializeDocumentEvaluationSummary(v **types.EvaluationSumma return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.EvaluationSummary + var sv *types.HoursOfOperationSummary if *v == nil { - sv = &types.EvaluationSummary{} + sv = &types.HoursOfOperationSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "CreatedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - - case "EvaluationArn": + case "Arn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.EvaluationArn = ptr.String(jtv) - } - - case "EvaluationFormId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) - } - sv.EvaluationFormId = ptr.String(jtv) - } - - case "EvaluationFormTitle": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected EvaluationFormTitle to be of type string, got %T instead", value) - } - sv.EvaluationFormTitle = ptr.String(jtv) + sv.Arn = ptr.String(jtv) } - case "EvaluationId": + case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ResourceId to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) } - sv.EvaluationId = ptr.String(jtv) + sv.Id = ptr.String(jtv) } - case "EvaluatorArn": + case "LastModifiedRegion": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) } - sv.EvaluatorArn = ptr.String(jtv) + sv.LastModifiedRegion = ptr.String(jtv) } case "LastModifiedTime": @@ -36442,18 +40270,13 @@ func awsRestjson1_deserializeDocumentEvaluationSummary(v **types.EvaluationSumma } } - case "Score": - if err := awsRestjson1_deserializeDocumentEvaluationScore(&sv.Score, value); err != nil { - return err - } - - case "Status": + case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected EvaluationStatus to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationName to be of type string, got %T instead", value) } - sv.Status = types.EvaluationStatus(jtv) + sv.Name = ptr.String(jtv) } default: @@ -36465,7 +40288,7 @@ func awsRestjson1_deserializeDocumentEvaluationSummary(v **types.EvaluationSumma return nil } -func awsRestjson1_deserializeDocumentEvaluationSummaryList(v *[]types.EvaluationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(v *[]types.HoursOfOperationSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36478,17 +40301,17 @@ func awsRestjson1_deserializeDocumentEvaluationSummaryList(v *[]types.Evaluation return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.EvaluationSummary + var cv []types.HoursOfOperationSummary if *v == nil { - cv = []types.EvaluationSummary{} + cv = []types.HoursOfOperationSummary{} } else { cv = *v } for _, value := range shape { - var col types.EvaluationSummary + var col types.HoursOfOperationSummary destAddr := &col - if err := awsRestjson1_deserializeDocumentEvaluationSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentHoursOfOperationSummary(&destAddr, value); err != nil { return err } col = *destAddr @@ -36499,7 +40322,7 @@ func awsRestjson1_deserializeDocumentEvaluationSummaryList(v *[]types.Evaluation return nil } -func awsRestjson1_deserializeDocumentEventBridgeActionDefinition(v **types.EventBridgeActionDefinition, value interface{}) error { +func awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(v **types.HoursOfOperationTimeSlice, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36512,22 +40335,79 @@ func awsRestjson1_deserializeDocumentEventBridgeActionDefinition(v **types.Event return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.EventBridgeActionDefinition + var sv *types.HoursOfOperationTimeSlice if *v == nil { - sv = &types.EventBridgeActionDefinition{} + sv = &types.HoursOfOperationTimeSlice{} } else { sv = *v } for key, value := range shape { switch key { - case "Name": + case "Hours": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Hours24Format to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Hours = ptr.Int32(int32(i64)) + } + + case "Minutes": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected MinutesLimit60 to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Minutes = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIdempotencyException(v **types.IdempotencyException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IdempotencyException + if *v == nil { + sv = &types.IdempotencyException{} + } 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 EventBridgeActionName to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.Message = ptr.String(jtv) } default: @@ -36539,7 +40419,7 @@ func awsRestjson1_deserializeDocumentEventBridgeActionDefinition(v **types.Event return nil } -func awsRestjson1_deserializeDocumentFailedRequest(v **types.FailedRequest, value interface{}) error { +func awsRestjson1_deserializeDocumentInstance(v **types.Instance, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36552,40 +40432,115 @@ func awsRestjson1_deserializeDocumentFailedRequest(v **types.FailedRequest, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.FailedRequest + var sv *types.Instance if *v == nil { - sv = &types.FailedRequest{} + sv = &types.Instance{} } else { sv = *v } for key, value := range shape { switch key { - case "FailureReasonCode": + case "Arn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected FailureReasonCode to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.FailureReasonCode = types.FailureReasonCode(jtv) + sv.Arn = ptr.String(jtv) } - case "FailureReasonMessage": + case "CreatedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "IdentityManagementType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) + } + sv.IdentityManagementType = types.DirectoryType(jtv) + } + + case "InboundCallsEnabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) + } + sv.InboundCallsEnabled = ptr.Bool(jtv) + } + + case "InstanceAccessUrl": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.InstanceAccessUrl = ptr.String(jtv) + } + + case "InstanceAlias": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) + } + sv.InstanceAlias = ptr.String(jtv) + } + + case "InstanceStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) + } + sv.InstanceStatus = types.InstanceStatus(jtv) + } + + case "OutboundCallsEnabled": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(bool) if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) + return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) } - sv.FailureReasonMessage = ptr.String(jtv) + sv.OutboundCallsEnabled = ptr.Bool(jtv) } - case "RequestIdentifier": + case "ServiceRole": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RequestIdentifier to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.RequestIdentifier = ptr.String(jtv) + sv.ServiceRole = ptr.String(jtv) + } + + case "StatusReason": + if err := awsRestjson1_deserializeDocumentInstanceStatusReason(&sv.StatusReason, value); err != nil { + return err } default: @@ -36597,7 +40552,7 @@ func awsRestjson1_deserializeDocumentFailedRequest(v **types.FailedRequest, valu return nil } -func awsRestjson1_deserializeDocumentFailedRequestList(v *[]types.FailedRequest, value interface{}) error { +func awsRestjson1_deserializeDocumentInstanceStatusReason(v **types.InstanceStatusReason, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36605,33 +40560,39 @@ func awsRestjson1_deserializeDocumentFailedRequestList(v *[]types.FailedRequest, return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.FailedRequest + var sv *types.InstanceStatusReason if *v == nil { - cv = []types.FailedRequest{} + sv = &types.InstanceStatusReason{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.FailedRequest - destAddr := &col - if err := awsRestjson1_deserializeDocumentFailedRequest(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + 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 = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentFlowAssociationSummary(v **types.FlowAssociationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentInstanceStorageConfig(v **types.InstanceStorageConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36644,40 +40605,51 @@ func awsRestjson1_deserializeDocumentFlowAssociationSummary(v **types.FlowAssoci return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.FlowAssociationSummary + var sv *types.InstanceStorageConfig if *v == nil { - sv = &types.FlowAssociationSummary{} + sv = &types.InstanceStorageConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "FlowId": + case "AssociationId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) } - sv.FlowId = ptr.String(jtv) + sv.AssociationId = ptr.String(jtv) } - case "ResourceId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.ResourceId = ptr.String(jtv) + case "KinesisFirehoseConfig": + if err := awsRestjson1_deserializeDocumentKinesisFirehoseConfig(&sv.KinesisFirehoseConfig, value); err != nil { + return err } - case "ResourceType": + case "KinesisStreamConfig": + if err := awsRestjson1_deserializeDocumentKinesisStreamConfig(&sv.KinesisStreamConfig, value); err != nil { + return err + } + + case "KinesisVideoStreamConfig": + if err := awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(&sv.KinesisVideoStreamConfig, value); err != nil { + return err + } + + case "S3Config": + if err := awsRestjson1_deserializeDocumentS3Config(&sv.S3Config, value); err != nil { + return err + } + + case "StorageType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ListFlowAssociationResourceType to be of type string, got %T instead", value) + return fmt.Errorf("expected StorageType to be of type string, got %T instead", value) } - sv.ResourceType = types.ListFlowAssociationResourceType(jtv) + sv.StorageType = types.StorageType(jtv) } default: @@ -36689,7 +40661,7 @@ func awsRestjson1_deserializeDocumentFlowAssociationSummary(v **types.FlowAssoci return nil } -func awsRestjson1_deserializeDocumentFlowAssociationSummaryList(v *[]types.FlowAssociationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentInstanceStorageConfigs(v *[]types.InstanceStorageConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36702,17 +40674,17 @@ func awsRestjson1_deserializeDocumentFlowAssociationSummaryList(v *[]types.FlowA return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.FlowAssociationSummary + var cv []types.InstanceStorageConfig if *v == nil { - cv = []types.FlowAssociationSummary{} + cv = []types.InstanceStorageConfig{} } else { cv = *v } for _, value := range shape { - var col types.FlowAssociationSummary + var col types.InstanceStorageConfig destAddr := &col - if err := awsRestjson1_deserializeDocumentFlowAssociationSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentInstanceStorageConfig(&destAddr, value); err != nil { return err } col = *destAddr @@ -36723,43 +40695,7 @@ func awsRestjson1_deserializeDocumentFlowAssociationSummaryList(v *[]types.FlowA return nil } -func awsRestjson1_deserializeDocumentFunctionArnsList(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 FunctionArn to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, value interface{}) error { +func awsRestjson1_deserializeDocumentInstanceSummary(v **types.InstanceSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36772,9 +40708,9 @@ func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HierarchyGroup + var sv *types.InstanceSummary if *v == nil { - sv = &types.HierarchyGroup{} + sv = &types.InstanceSummary{} } else { sv = *v } @@ -36790,30 +40726,7 @@ func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, va sv.Arn = ptr.String(jtv) } - case "HierarchyPath": - if err := awsRestjson1_deserializeDocumentHierarchyPath(&sv.HierarchyPath, value); err != nil { - return err - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - case "LastModifiedRegion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": + case "CreatedTime": if value != nil { switch jtv := value.(type) { case json.Number: @@ -36821,7 +40734,7 @@ func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, va if err != nil { return err } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) @@ -36829,110 +40742,76 @@ func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, va } } - case "LevelId": + case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) } - sv.LevelId = ptr.String(jtv) + sv.Id = ptr.String(jtv) } - case "Name": + case "IdentityManagementType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) + return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.IdentityManagementType = types.DirectoryType(jtv) } - case "Tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { - return err + case "InboundCallsEnabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) + } + sv.InboundCallsEnabled = ptr.Bool(jtv) } - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsRestjson1_deserializeDocumentHierarchyGroupSummary(v **types.HierarchyGroupSummary, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", 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.HierarchyGroupSummary - if *v == nil { - sv = &types.HierarchyGroupSummary{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Arn": + case "InstanceAccessUrl": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected Url to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.InstanceAccessUrl = ptr.String(jtv) } - case "Id": + case "InstanceAlias": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) } - sv.Id = ptr.String(jtv) + sv.InstanceAlias = ptr.String(jtv) } - case "LastModifiedRegion": + case "InstanceStatus": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) } - sv.LastModifiedRegion = ptr.String(jtv) + sv.InstanceStatus = types.InstanceStatus(jtv) } - case "LastModifiedTime": + case "OutboundCallsEnabled": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) } + sv.OutboundCallsEnabled = ptr.Bool(jtv) } - case "Name": + case "ServiceRole": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.ServiceRole = ptr.String(jtv) } default: @@ -36944,7 +40823,7 @@ func awsRestjson1_deserializeDocumentHierarchyGroupSummary(v **types.HierarchyGr return nil } -func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.HierarchyGroupSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentInstanceSummaryList(v *[]types.InstanceSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36957,17 +40836,17 @@ func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.Hierar return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HierarchyGroupSummary + var cv []types.InstanceSummary if *v == nil { - cv = []types.HierarchyGroupSummary{} + cv = []types.InstanceSummary{} } else { cv = *v } for _, value := range shape { - var col types.HierarchyGroupSummary + var col types.InstanceSummary destAddr := &col - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentInstanceSummary(&destAddr, value); err != nil { return err } col = *destAddr @@ -36978,7 +40857,7 @@ func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.Hierar return nil } -func awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(v **types.HierarchyGroupSummaryReference, value interface{}) error { +func awsRestjson1_deserializeDocumentIntegrationAssociationSummary(v **types.IntegrationAssociationSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -36991,114 +40870,85 @@ func awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(v **types.Hi return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HierarchyGroupSummaryReference + var sv *types.IntegrationAssociationSummary if *v == nil { - sv = &types.HierarchyGroupSummaryReference{} + sv = &types.IntegrationAssociationSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "InstanceId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.InstanceId = ptr.String(jtv) } - case "Id": + case "IntegrationArn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.Id = ptr.String(jtv) + sv.IntegrationArn = ptr.String(jtv) } - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsRestjson1_deserializeDocumentHierarchyLevel(v **types.HierarchyLevel, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", 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.HierarchyLevel - if *v == nil { - sv = &types.HierarchyLevel{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Arn": + case "IntegrationAssociationArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.IntegrationAssociationArn = ptr.String(jtv) } - case "Id": + case "IntegrationAssociationId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) + return fmt.Errorf("expected IntegrationAssociationId to be of type string, got %T instead", value) } - sv.Id = ptr.String(jtv) + sv.IntegrationAssociationId = ptr.String(jtv) } - case "LastModifiedRegion": + case "IntegrationType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) } - sv.LastModifiedRegion = ptr.String(jtv) + sv.IntegrationType = types.IntegrationType(jtv) } - case "LastModifiedTime": + case "SourceApplicationName": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SourceApplicationName to be of type string, got %T instead", value) + } + sv.SourceApplicationName = ptr.String(jtv) + } + case "SourceApplicationUrl": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } + sv.SourceApplicationUrl = ptr.String(jtv) } - case "Name": + case "SourceType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HierarchyLevelName to be of type string, got %T instead", value) + return fmt.Errorf("expected SourceType to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.SourceType = types.SourceType(jtv) } default: @@ -37110,7 +40960,7 @@ func awsRestjson1_deserializeDocumentHierarchyLevel(v **types.HierarchyLevel, va return nil } -func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, value interface{}) error { +func awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(v *[]types.IntegrationAssociationSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37118,43 +40968,61 @@ func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, valu return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HierarchyPath + var cv []types.IntegrationAssociationSummary if *v == nil { - sv = &types.HierarchyPath{} + cv = []types.IntegrationAssociationSummary{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "LevelFive": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFive, value); err != nil { - return err - } + for _, value := range shape { + var col types.IntegrationAssociationSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) - case "LevelFour": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFour, value); err != nil { - return err - } + } + *v = cv + return nil +} - case "LevelOne": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelOne, value); err != nil { - return err - } +func awsRestjson1_deserializeDocumentInternalServiceException(v **types.InternalServiceException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } - case "LevelThree": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelThree, value); err != nil { - return err - } + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } - case "LevelTwo": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelTwo, value); err != nil { - return err + var sv *types.InternalServiceException + if *v == nil { + sv = &types.InternalServiceException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Message to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) } default: @@ -37166,7 +41034,7 @@ func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, valu return nil } -func awsRestjson1_deserializeDocumentHierarchyPathReference(v **types.HierarchyPathReference, value interface{}) error { +func awsRestjson1_deserializeDocumentInvalidContactFlowException(v **types.InvalidContactFlowException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37179,37 +41047,17 @@ func awsRestjson1_deserializeDocumentHierarchyPathReference(v **types.HierarchyP return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HierarchyPathReference + var sv *types.InvalidContactFlowException if *v == nil { - sv = &types.HierarchyPathReference{} + sv = &types.InvalidContactFlowException{} } else { sv = *v } for key, value := range shape { switch key { - case "LevelFive": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFive, value); err != nil { - return err - } - - case "LevelFour": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFour, value); err != nil { - return err - } - - case "LevelOne": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelOne, value); err != nil { - return err - } - - case "LevelThree": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelThree, value); err != nil { - return err - } - - case "LevelTwo": - if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelTwo, value); err != nil { + case "problems": + if err := awsRestjson1_deserializeDocumentProblems(&sv.Problems, value); err != nil { return err } @@ -37222,7 +41070,7 @@ func awsRestjson1_deserializeDocumentHierarchyPathReference(v **types.HierarchyP return nil } -func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStructure, value interface{}) error { +func awsRestjson1_deserializeDocumentInvalidContactFlowModuleException(v **types.InvalidContactFlowModuleException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37235,38 +41083,58 @@ func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStruc return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HierarchyStructure + var sv *types.InvalidContactFlowModuleException if *v == nil { - sv = &types.HierarchyStructure{} + sv = &types.InvalidContactFlowModuleException{} } else { sv = *v } for key, value := range shape { switch key { - case "LevelFive": - if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFive, value); err != nil { + case "Problems": + if err := awsRestjson1_deserializeDocumentProblems(&sv.Problems, value); err != nil { return err } - case "LevelFour": - if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFour, value); err != nil { - return err - } + default: + _, _ = key, value - case "LevelOne": - if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelOne, value); err != nil { - return err - } + } + } + *v = sv + return nil +} - case "LevelThree": - if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelThree, value); err != nil { - return err - } +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) + } - case "LevelTwo": - if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelTwo, value); err != nil { - return err + var sv *types.InvalidParameterException + if *v == nil { + sv = &types.InvalidParameterException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Message to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) } default: @@ -37278,7 +41146,7 @@ func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStruc return nil } -func awsRestjson1_deserializeDocumentHistoricalMetric(v **types.HistoricalMetric, value interface{}) error { +func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37291,45 +41159,22 @@ func awsRestjson1_deserializeDocumentHistoricalMetric(v **types.HistoricalMetric return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HistoricalMetric + var sv *types.InvalidRequestException if *v == nil { - sv = &types.HistoricalMetric{} + sv = &types.InvalidRequestException{} } else { sv = *v } for key, value := range shape { switch key { - case "Name": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HistoricalMetricName to be of type string, got %T instead", value) - } - sv.Name = types.HistoricalMetricName(jtv) - } - - case "Statistic": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Statistic to be of type string, got %T instead", value) - } - sv.Statistic = types.Statistic(jtv) - } - - case "Threshold": - if err := awsRestjson1_deserializeDocumentThreshold(&sv.Threshold, value); err != nil { - return err - } - - case "Unit": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Unit to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.Unit = types.Unit(jtv) + sv.Message = ptr.String(jtv) } default: @@ -37341,7 +41186,7 @@ func awsRestjson1_deserializeDocumentHistoricalMetric(v **types.HistoricalMetric return nil } -func awsRestjson1_deserializeDocumentHistoricalMetricData(v **types.HistoricalMetricData, value interface{}) error { +func awsRestjson1_deserializeDocumentInvisibleFieldInfo(v **types.InvisibleFieldInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37354,54 +41199,20 @@ func awsRestjson1_deserializeDocumentHistoricalMetricData(v **types.HistoricalMe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HistoricalMetricData + var sv *types.InvisibleFieldInfo if *v == nil { - sv = &types.HistoricalMetricData{} + sv = &types.InvisibleFieldInfo{} } else { sv = *v } for key, value := range shape { switch key { - case "Metric": - if err := awsRestjson1_deserializeDocumentHistoricalMetric(&sv.Metric, value); err != nil { + case "Id": + if err := awsRestjson1_deserializeDocumentTaskTemplateFieldIdentifier(&sv.Id, value); err != nil { return err } - case "Value": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Value = ptr.Float64(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Value = ptr.Float64(f64) - - default: - return fmt.Errorf("expected Value to be a JSON Number, got %T instead", value) - - } - } - default: _, _ = key, value @@ -37411,7 +41222,7 @@ func awsRestjson1_deserializeDocumentHistoricalMetricData(v **types.HistoricalMe return nil } -func awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(v *[]types.HistoricalMetricData, value interface{}) error { +func awsRestjson1_deserializeDocumentInvisibleTaskTemplateFields(v *[]types.InvisibleFieldInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37424,17 +41235,17 @@ func awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(v *[]types. return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HistoricalMetricData + var cv []types.InvisibleFieldInfo if *v == nil { - cv = []types.HistoricalMetricData{} + cv = []types.InvisibleFieldInfo{} } else { cv = *v } for _, value := range shape { - var col types.HistoricalMetricData + var col types.InvisibleFieldInfo destAddr := &col - if err := awsRestjson1_deserializeDocumentHistoricalMetricData(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentInvisibleFieldInfo(&destAddr, value); err != nil { return err } col = *destAddr @@ -37445,7 +41256,7 @@ func awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(v *[]types. return nil } -func awsRestjson1_deserializeDocumentHistoricalMetricResult(v **types.HistoricalMetricResult, value interface{}) error { +func awsRestjson1_deserializeDocumentKinesisFirehoseConfig(v **types.KinesisFirehoseConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37458,23 +41269,22 @@ func awsRestjson1_deserializeDocumentHistoricalMetricResult(v **types.Historical return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HistoricalMetricResult + var sv *types.KinesisFirehoseConfig if *v == nil { - sv = &types.HistoricalMetricResult{} + sv = &types.KinesisFirehoseConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Collections": - if err := awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(&sv.Collections, value); err != nil { - return err - } - - case "Dimensions": - if err := awsRestjson1_deserializeDocumentDimensions(&sv.Dimensions, value); err != nil { - return err + case "FirehoseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.FirehoseArn = ptr.String(jtv) } default: @@ -37486,7 +41296,7 @@ func awsRestjson1_deserializeDocumentHistoricalMetricResult(v **types.Historical return nil } -func awsRestjson1_deserializeDocumentHistoricalMetricResults(v *[]types.HistoricalMetricResult, value interface{}) error { +func awsRestjson1_deserializeDocumentKinesisStreamConfig(v **types.KinesisStreamConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37494,33 +41304,39 @@ func awsRestjson1_deserializeDocumentHistoricalMetricResults(v *[]types.Historic return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HistoricalMetricResult + var sv *types.KinesisStreamConfig if *v == nil { - cv = []types.HistoricalMetricResult{} + sv = &types.KinesisStreamConfig{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.HistoricalMetricResult - destAddr := &col - if err := awsRestjson1_deserializeDocumentHistoricalMetricResult(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "StreamArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.StreamArn = ptr.String(jtv) + } + + default: + _, _ = key, value + } } - *v = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentHoursOfOperation(v **types.HoursOfOperation, value interface{}) error { +func awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(v **types.KinesisVideoStreamConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37533,93 +41349,40 @@ func awsRestjson1_deserializeDocumentHoursOfOperation(v **types.HoursOfOperation return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HoursOfOperation + var sv *types.KinesisVideoStreamConfig if *v == nil { - sv = &types.HoursOfOperation{} + sv = &types.KinesisVideoStreamConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Config": - if err := awsRestjson1_deserializeDocumentHoursOfOperationConfigList(&sv.Config, value); err != nil { + case "EncryptionConfig": + if err := awsRestjson1_deserializeDocumentEncryptionConfig(&sv.EncryptionConfig, value); err != nil { return err } - case "Description": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HoursOfOperationDescription to be of type string, got %T instead", value) - } - sv.Description = ptr.String(jtv) - } - - case "HoursOfOperationArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.HoursOfOperationArn = ptr.String(jtv) - } - - case "HoursOfOperationId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) - } - sv.HoursOfOperationId = ptr.String(jtv) - } - - case "LastModifiedRegion": + case "Prefix": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + return fmt.Errorf("expected Prefix to be of type string, got %T instead", value) } + sv.Prefix = ptr.String(jtv) } - case "Name": + case "RetentionPeriodHours": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(json.Number) if !ok { - return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) + return fmt.Errorf("expected Hours to be json.Number, got %T instead", value) } - sv.Name = ptr.String(jtv) - } - - case "Tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { - return err - } - - case "TimeZone": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TimeZone to be of type string, got %T instead", value) + i64, err := jtv.Int64() + if err != nil { + return err } - sv.TimeZone = ptr.String(jtv) + sv.RetentionPeriodHours = int32(i64) } default: @@ -37631,7 +41394,7 @@ func awsRestjson1_deserializeDocumentHoursOfOperation(v **types.HoursOfOperation return nil } -func awsRestjson1_deserializeDocumentHoursOfOperationConfig(v **types.HoursOfOperationConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentLexBot(v **types.LexBot, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37644,32 +41407,31 @@ func awsRestjson1_deserializeDocumentHoursOfOperationConfig(v **types.HoursOfOpe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HoursOfOperationConfig + var sv *types.LexBot if *v == nil { - sv = &types.HoursOfOperationConfig{} + sv = &types.LexBot{} } else { sv = *v } for key, value := range shape { switch key { - case "Day": + case "LexRegion": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected HoursOfOperationDays to be of type string, got %T instead", value) + return fmt.Errorf("expected LexRegion to be of type string, got %T instead", value) } - sv.Day = types.HoursOfOperationDays(jtv) - } - - case "EndTime": - if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.EndTime, value); err != nil { - return err + sv.LexRegion = ptr.String(jtv) } - case "StartTime": - if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.StartTime, value); err != nil { - return err + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected BotName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) } default: @@ -37681,7 +41443,7 @@ func awsRestjson1_deserializeDocumentHoursOfOperationConfig(v **types.HoursOfOpe return nil } -func awsRestjson1_deserializeDocumentHoursOfOperationConfigList(v *[]types.HoursOfOperationConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentLexBotConfig(v **types.LexBotConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37689,33 +41451,40 @@ func awsRestjson1_deserializeDocumentHoursOfOperationConfigList(v *[]types.Hours return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HoursOfOperationConfig + var sv *types.LexBotConfig if *v == nil { - cv = []types.HoursOfOperationConfig{} + sv = &types.LexBotConfig{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.HoursOfOperationConfig - destAddr := &col - if err := awsRestjson1_deserializeDocumentHoursOfOperationConfig(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "LexBot": + if err := awsRestjson1_deserializeDocumentLexBot(&sv.LexBot, value); err != nil { + return err + } + + case "LexV2Bot": + if err := awsRestjson1_deserializeDocumentLexV2Bot(&sv.LexV2Bot, value); err != nil { + return err + } + default: + _, _ = key, value + + } } - *v = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentHoursOfOperationList(v *[]types.HoursOfOperation, value interface{}) error { +func awsRestjson1_deserializeDocumentLexBotConfigList(v *[]types.LexBotConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37728,17 +41497,17 @@ func awsRestjson1_deserializeDocumentHoursOfOperationList(v *[]types.HoursOfOper return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HoursOfOperation + var cv []types.LexBotConfig if *v == nil { - cv = []types.HoursOfOperation{} + cv = []types.LexBotConfig{} } else { cv = *v } for _, value := range shape { - var col types.HoursOfOperation + var col types.LexBotConfig destAddr := &col - if err := awsRestjson1_deserializeDocumentHoursOfOperation(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentLexBotConfig(&destAddr, value); err != nil { return err } col = *destAddr @@ -37749,90 +41518,7 @@ func awsRestjson1_deserializeDocumentHoursOfOperationList(v *[]types.HoursOfOper return nil } -func awsRestjson1_deserializeDocumentHoursOfOperationSummary(v **types.HoursOfOperationSummary, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", 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.HoursOfOperationSummary - if *v == nil { - sv = &types.HoursOfOperationSummary{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Arn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.Arn = ptr.String(jtv) - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - case "LastModifiedRegion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - - case "Name": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HoursOfOperationName to be of type string, got %T instead", value) - } - sv.Name = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(v *[]types.HoursOfOperationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentLexBotsList(v *[]types.LexBot, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37845,17 +41531,17 @@ func awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(v *[]types.Hour return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.HoursOfOperationSummary + var cv []types.LexBot if *v == nil { - cv = []types.HoursOfOperationSummary{} + cv = []types.LexBot{} } else { cv = *v } for _, value := range shape { - var col types.HoursOfOperationSummary + var col types.LexBot destAddr := &col - if err := awsRestjson1_deserializeDocumentHoursOfOperationSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentLexBot(&destAddr, value); err != nil { return err } col = *destAddr @@ -37866,7 +41552,7 @@ func awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(v *[]types.Hour return nil } -func awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(v **types.HoursOfOperationTimeSlice, value interface{}) error { +func awsRestjson1_deserializeDocumentLexV2Bot(v **types.LexV2Bot, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37879,39 +41565,22 @@ func awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(v **types.HoursOf return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.HoursOfOperationTimeSlice + var sv *types.LexV2Bot if *v == nil { - sv = &types.HoursOfOperationTimeSlice{} + sv = &types.LexV2Bot{} } else { sv = *v } for key, value := range shape { switch key { - case "Hours": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected Hours24Format to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Hours = ptr.Int32(int32(i64)) - } - - case "Minutes": + case "AliasArn": if value != nil { - jtv, ok := value.(json.Number) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected MinutesLimit60 to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err + return fmt.Errorf("expected AliasArn to be of type string, got %T instead", value) } - sv.Minutes = ptr.Int32(int32(i64)) + sv.AliasArn = ptr.String(jtv) } default: @@ -37923,7 +41592,7 @@ func awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(v **types.HoursOf return nil } -func awsRestjson1_deserializeDocumentIdempotencyException(v **types.IdempotencyException, value interface{}) error { +func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37936,9 +41605,9 @@ func awsRestjson1_deserializeDocumentIdempotencyException(v **types.IdempotencyE return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.IdempotencyException + var sv *types.LimitExceededException if *v == nil { - sv = &types.IdempotencyException{} + sv = &types.LimitExceededException{} } else { sv = *v } @@ -37963,7 +41632,7 @@ func awsRestjson1_deserializeDocumentIdempotencyException(v **types.IdempotencyE return nil } -func awsRestjson1_deserializeDocumentInstance(v **types.Instance, value interface{}) error { +func awsRestjson1_deserializeDocumentListPhoneNumbersSummary(v **types.ListPhoneNumbersSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -37976,115 +41645,94 @@ func awsRestjson1_deserializeDocumentInstance(v **types.Instance, value interfac return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.Instance + var sv *types.ListPhoneNumbersSummary if *v == nil { - sv = &types.Instance{} + sv = &types.ListPhoneNumbersSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "InstanceId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.Arn = ptr.String(jtv) - } - - case "CreatedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) } + sv.InstanceId = ptr.String(jtv) } - case "Id": + case "PhoneNumber": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) } - sv.Id = ptr.String(jtv) + sv.PhoneNumber = ptr.String(jtv) } - case "IdentityManagementType": + case "PhoneNumberArn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.IdentityManagementType = types.DirectoryType(jtv) + sv.PhoneNumberArn = ptr.String(jtv) } - case "InboundCallsEnabled": + case "PhoneNumberCountryCode": if value != nil { - jtv, ok := value.(bool) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) + return fmt.Errorf("expected PhoneNumberCountryCode to be of type string, got %T instead", value) } - sv.InboundCallsEnabled = ptr.Bool(jtv) + sv.PhoneNumberCountryCode = types.PhoneNumberCountryCode(jtv) } - case "InstanceAccessUrl": + case "PhoneNumberDescription": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Url to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumberDescription to be of type string, got %T instead", value) } - sv.InstanceAccessUrl = ptr.String(jtv) + sv.PhoneNumberDescription = ptr.String(jtv) } - case "InstanceAlias": + case "PhoneNumberId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) } - sv.InstanceAlias = ptr.String(jtv) + sv.PhoneNumberId = ptr.String(jtv) } - case "InstanceStatus": + case "PhoneNumberType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumberType to be of type string, got %T instead", value) } - sv.InstanceStatus = types.InstanceStatus(jtv) + sv.PhoneNumberType = types.PhoneNumberType(jtv) } - case "OutboundCallsEnabled": + case "SourcePhoneNumberArn": if value != nil { - jtv, ok := value.(bool) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.OutboundCallsEnabled = ptr.Bool(jtv) + sv.SourcePhoneNumberArn = ptr.String(jtv) } - case "ServiceRole": + case "TargetArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.ServiceRole = ptr.String(jtv) - } - - case "StatusReason": - if err := awsRestjson1_deserializeDocumentInstanceStatusReason(&sv.StatusReason, value); err != nil { - return err + sv.TargetArn = ptr.String(jtv) } default: @@ -38096,7 +41744,7 @@ func awsRestjson1_deserializeDocumentInstance(v **types.Instance, value interfac return nil } -func awsRestjson1_deserializeDocumentInstanceStatusReason(v **types.InstanceStatusReason, value interface{}) error { +func awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(v *[]types.ListPhoneNumbersSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38104,39 +41752,33 @@ func awsRestjson1_deserializeDocumentInstanceStatusReason(v **types.InstanceStat return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InstanceStatusReason + var cv []types.ListPhoneNumbersSummary if *v == nil { - sv = &types.InstanceStatusReason{} + cv = []types.ListPhoneNumbersSummary{} } else { - sv = *v + cv = *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 - + for _, value := range shape { + var col types.ListPhoneNumbersSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentListPhoneNumbersSummary(&destAddr, value); err != nil { + return err } + col = *destAddr + cv = append(cv, col) + } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentInstanceStorageConfig(v **types.InstanceStorageConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentMaximumResultReturnedException(v **types.MaximumResultReturnedException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38149,51 +41791,22 @@ func awsRestjson1_deserializeDocumentInstanceStorageConfig(v **types.InstanceSto return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InstanceStorageConfig + var sv *types.MaximumResultReturnedException if *v == nil { - sv = &types.InstanceStorageConfig{} + sv = &types.MaximumResultReturnedException{} } else { sv = *v } for key, value := range shape { switch key { - case "AssociationId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) - } - sv.AssociationId = ptr.String(jtv) - } - - case "KinesisFirehoseConfig": - if err := awsRestjson1_deserializeDocumentKinesisFirehoseConfig(&sv.KinesisFirehoseConfig, value); err != nil { - return err - } - - case "KinesisStreamConfig": - if err := awsRestjson1_deserializeDocumentKinesisStreamConfig(&sv.KinesisStreamConfig, value); err != nil { - return err - } - - case "KinesisVideoStreamConfig": - if err := awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(&sv.KinesisVideoStreamConfig, value); err != nil { - return err - } - - case "S3Config": - if err := awsRestjson1_deserializeDocumentS3Config(&sv.S3Config, value); err != nil { - return err - } - - case "StorageType": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected StorageType to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.StorageType = types.StorageType(jtv) + sv.Message = ptr.String(jtv) } default: @@ -38205,7 +41818,7 @@ func awsRestjson1_deserializeDocumentInstanceStorageConfig(v **types.InstanceSto return nil } -func awsRestjson1_deserializeDocumentInstanceStorageConfigs(v *[]types.InstanceStorageConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentMediaConcurrencies(v *[]types.MediaConcurrency, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38218,17 +41831,17 @@ func awsRestjson1_deserializeDocumentInstanceStorageConfigs(v *[]types.InstanceS return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.InstanceStorageConfig + var cv []types.MediaConcurrency if *v == nil { - cv = []types.InstanceStorageConfig{} + cv = []types.MediaConcurrency{} } else { cv = *v } for _, value := range shape { - var col types.InstanceStorageConfig + var col types.MediaConcurrency destAddr := &col - if err := awsRestjson1_deserializeDocumentInstanceStorageConfig(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentMediaConcurrency(&destAddr, value); err != nil { return err } col = *destAddr @@ -38239,7 +41852,7 @@ func awsRestjson1_deserializeDocumentInstanceStorageConfigs(v *[]types.InstanceS return nil } -func awsRestjson1_deserializeDocumentInstanceSummary(v **types.InstanceSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentMediaConcurrency(v **types.MediaConcurrency, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38252,110 +41865,116 @@ func awsRestjson1_deserializeDocumentInstanceSummary(v **types.InstanceSummary, return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InstanceSummary + var sv *types.MediaConcurrency if *v == nil { - sv = &types.InstanceSummary{} + sv = &types.MediaConcurrency{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "Channel": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.Arn = ptr.String(jtv) - } - - case "CreatedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + return fmt.Errorf("expected Channel to be of type string, got %T instead", value) } + sv.Channel = types.Channel(jtv) } - case "Id": + case "Concurrency": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(json.Number) if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) + return fmt.Errorf("expected Concurrency to be json.Number, got %T instead", value) } - sv.Id = ptr.String(jtv) - } - - case "IdentityManagementType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) + i64, err := jtv.Int64() + if err != nil { + return err } - sv.IdentityManagementType = types.DirectoryType(jtv) + sv.Concurrency = ptr.Int32(int32(i64)) } - case "InboundCallsEnabled": - if value != nil { - jtv, ok := value.(bool) - if !ok { - return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) - } - sv.InboundCallsEnabled = ptr.Bool(jtv) + case "CrossChannelBehavior": + if err := awsRestjson1_deserializeDocumentCrossChannelBehavior(&sv.CrossChannelBehavior, value); err != nil { + return err } - case "InstanceAccessUrl": + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMediaPlacement(v **types.MediaPlacement, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MediaPlacement + if *v == nil { + sv = &types.MediaPlacement{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AudioFallbackUrl": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Url to be of type string, got %T instead", value) + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } - sv.InstanceAccessUrl = ptr.String(jtv) + sv.AudioFallbackUrl = ptr.String(jtv) } - case "InstanceAlias": + case "AudioHostUrl": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } - sv.InstanceAlias = ptr.String(jtv) + sv.AudioHostUrl = ptr.String(jtv) } - case "InstanceStatus": + case "EventIngestionUrl": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } - sv.InstanceStatus = types.InstanceStatus(jtv) + sv.EventIngestionUrl = ptr.String(jtv) } - case "OutboundCallsEnabled": + case "SignalingUrl": if value != nil { - jtv, ok := value.(bool) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } - sv.OutboundCallsEnabled = ptr.Bool(jtv) + sv.SignalingUrl = ptr.String(jtv) } - case "ServiceRole": + case "TurnControlUrl": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected URI to be of type string, got %T instead", value) } - sv.ServiceRole = ptr.String(jtv) + sv.TurnControlUrl = ptr.String(jtv) } default: @@ -38367,7 +41986,7 @@ func awsRestjson1_deserializeDocumentInstanceSummary(v **types.InstanceSummary, return nil } -func awsRestjson1_deserializeDocumentInstanceSummaryList(v *[]types.InstanceSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentMeeting(v **types.Meeting, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38375,33 +41994,58 @@ func awsRestjson1_deserializeDocumentInstanceSummaryList(v *[]types.InstanceSumm return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.InstanceSummary + var sv *types.Meeting if *v == nil { - cv = []types.InstanceSummary{} + sv = &types.Meeting{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.InstanceSummary - destAddr := &col - if err := awsRestjson1_deserializeDocumentInstanceSummary(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "MediaPlacement": + if err := awsRestjson1_deserializeDocumentMediaPlacement(&sv.MediaPlacement, value); err != nil { + return err + } + + case "MediaRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MediaRegion to be of type string, got %T instead", value) + } + sv.MediaRegion = ptr.String(jtv) + } + + case "MeetingFeatures": + if err := awsRestjson1_deserializeDocumentMeetingFeaturesConfiguration(&sv.MeetingFeatures, value); err != nil { + return err + } + + case "MeetingId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MeetingId to be of type string, got %T instead", value) + } + sv.MeetingId = ptr.String(jtv) + } + + default: + _, _ = key, value + } } - *v = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentIntegrationAssociationSummary(v **types.IntegrationAssociationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentMeetingFeaturesConfiguration(v **types.MeetingFeaturesConfiguration, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38414,85 +42058,18 @@ func awsRestjson1_deserializeDocumentIntegrationAssociationSummary(v **types.Int return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.IntegrationAssociationSummary + var sv *types.MeetingFeaturesConfiguration if *v == nil { - sv = &types.IntegrationAssociationSummary{} + sv = &types.MeetingFeaturesConfiguration{} } else { sv = *v } for key, value := range shape { switch key { - case "InstanceId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) - } - sv.InstanceId = ptr.String(jtv) - } - - case "IntegrationArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.IntegrationArn = ptr.String(jtv) - } - - case "IntegrationAssociationArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.IntegrationAssociationArn = ptr.String(jtv) - } - - case "IntegrationAssociationId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected IntegrationAssociationId to be of type string, got %T instead", value) - } - sv.IntegrationAssociationId = ptr.String(jtv) - } - - case "IntegrationType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) - } - sv.IntegrationType = types.IntegrationType(jtv) - } - - case "SourceApplicationName": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SourceApplicationName to be of type string, got %T instead", value) - } - sv.SourceApplicationName = ptr.String(jtv) - } - - case "SourceApplicationUrl": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected URI to be of type string, got %T instead", value) - } - sv.SourceApplicationUrl = ptr.String(jtv) - } - - case "SourceType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SourceType to be of type string, got %T instead", value) - } - sv.SourceType = types.SourceType(jtv) + case "Audio": + if err := awsRestjson1_deserializeDocumentAudioFeatures(&sv.Audio, value); err != nil { + return err } default: @@ -38504,7 +42081,7 @@ func awsRestjson1_deserializeDocumentIntegrationAssociationSummary(v **types.Int return nil } -func awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(v *[]types.IntegrationAssociationSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricDataCollectionsV2(v *[]types.MetricDataV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38517,17 +42094,17 @@ func awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(v *[]type return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.IntegrationAssociationSummary + var cv []types.MetricDataV2 if *v == nil { - cv = []types.IntegrationAssociationSummary{} + cv = []types.MetricDataV2{} } else { cv = *v } for _, value := range shape { - var col types.IntegrationAssociationSummary + var col types.MetricDataV2 destAddr := &col - if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentMetricDataV2(&destAddr, value); err != nil { return err } col = *destAddr @@ -38538,7 +42115,7 @@ func awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(v *[]type return nil } -func awsRestjson1_deserializeDocumentInternalServiceException(v **types.InternalServiceException, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricDataV2(v **types.MetricDataV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38551,22 +42128,52 @@ func awsRestjson1_deserializeDocumentInternalServiceException(v **types.Internal return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InternalServiceException + var sv *types.MetricDataV2 if *v == nil { - sv = &types.InternalServiceException{} + sv = &types.MetricDataV2{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "Metric": + if err := awsRestjson1_deserializeDocumentMetricV2(&sv.Metric, value); err != nil { + return err + } + + case "Value": if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Value = ptr.Float64(f64) + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.Value = ptr.Float64(f64) + + default: + return fmt.Errorf("expected Value to be a JSON Number, got %T instead", value) + } - sv.Message = ptr.String(jtv) } default: @@ -38578,7 +42185,7 @@ func awsRestjson1_deserializeDocumentInternalServiceException(v **types.Internal return nil } -func awsRestjson1_deserializeDocumentInvalidContactFlowException(v **types.InvalidContactFlowException, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricFiltersV2List(v *[]types.MetricFilterV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38586,35 +42193,33 @@ func awsRestjson1_deserializeDocumentInvalidContactFlowException(v **types.Inval return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InvalidContactFlowException + var cv []types.MetricFilterV2 if *v == nil { - sv = &types.InvalidContactFlowException{} + cv = []types.MetricFilterV2{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "problems": - if err := awsRestjson1_deserializeDocumentProblems(&sv.Problems, value); err != nil { - return err - } - - default: - _, _ = key, value - + for _, value := range shape { + var col types.MetricFilterV2 + destAddr := &col + if err := awsRestjson1_deserializeDocumentMetricFilterV2(&destAddr, value); err != nil { + return err } + col = *destAddr + cv = append(cv, col) + } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentInvalidContactFlowModuleException(v **types.InvalidContactFlowModuleException, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricFilterV2(v **types.MetricFilterV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38627,20 +42232,38 @@ func awsRestjson1_deserializeDocumentInvalidContactFlowModuleException(v **types return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InvalidContactFlowModuleException + var sv *types.MetricFilterV2 if *v == nil { - sv = &types.InvalidContactFlowModuleException{} + sv = &types.MetricFilterV2{} } else { sv = *v } for key, value := range shape { switch key { - case "Problems": - if err := awsRestjson1_deserializeDocumentProblems(&sv.Problems, value); err != nil { + case "MetricFilterKey": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.MetricFilterKey = ptr.String(jtv) + } + + case "MetricFilterValues": + if err := awsRestjson1_deserializeDocumentMetricFilterValueList(&sv.MetricFilterValues, value); err != nil { return err } + case "Negate": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Negate = jtv + } + default: _, _ = key, value @@ -38650,7 +42273,7 @@ func awsRestjson1_deserializeDocumentInvalidContactFlowModuleException(v **types return nil } -func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricFilterValueList(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38658,39 +42281,35 @@ func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.Invalid return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InvalidParameterException + var cv []string if *v == nil { - sv = &types.InvalidParameterException{} + cv = []string{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) + 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) } - - default: - _, _ = key, value - + col = jtv } + cv = append(cv, col) + } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38703,58 +42322,54 @@ func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRe return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.InvalidRequestException + var sv *types.MetricInterval if *v == nil { - sv = &types.InvalidRequestException{} + sv = &types.MetricInterval{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "EndTime": if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) -func awsRestjson1_deserializeDocumentInvisibleFieldInfo(v **types.InvisibleFieldInfo, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } + } + } - var sv *types.InvisibleFieldInfo - if *v == nil { - sv = &types.InvisibleFieldInfo{} - } else { - sv = *v - } + case "Interval": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IntervalPeriod to be of type string, got %T instead", value) + } + sv.Interval = types.IntervalPeriod(jtv) + } - for key, value := range shape { - switch key { - case "Id": - if err := awsRestjson1_deserializeDocumentTaskTemplateFieldIdentifier(&sv.Id, value); err != nil { - return err + case "StartTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } } default: @@ -38766,7 +42381,7 @@ func awsRestjson1_deserializeDocumentInvisibleFieldInfo(v **types.InvisibleField return nil } -func awsRestjson1_deserializeDocumentInvisibleTaskTemplateFields(v *[]types.InvisibleFieldInfo, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricResultsV2(v *[]types.MetricResultV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38779,17 +42394,17 @@ func awsRestjson1_deserializeDocumentInvisibleTaskTemplateFields(v *[]types.Invi return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.InvisibleFieldInfo + var cv []types.MetricResultV2 if *v == nil { - cv = []types.InvisibleFieldInfo{} + cv = []types.MetricResultV2{} } else { cv = *v } for _, value := range shape { - var col types.InvisibleFieldInfo + var col types.MetricResultV2 destAddr := &col - if err := awsRestjson1_deserializeDocumentInvisibleFieldInfo(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentMetricResultV2(&destAddr, value); err != nil { return err } col = *destAddr @@ -38800,7 +42415,7 @@ func awsRestjson1_deserializeDocumentInvisibleTaskTemplateFields(v *[]types.Invi return nil } -func awsRestjson1_deserializeDocumentKinesisFirehoseConfig(v **types.KinesisFirehoseConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricResultV2(v **types.MetricResultV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38813,22 +42428,28 @@ func awsRestjson1_deserializeDocumentKinesisFirehoseConfig(v **types.KinesisFire return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.KinesisFirehoseConfig + var sv *types.MetricResultV2 if *v == nil { - sv = &types.KinesisFirehoseConfig{} + sv = &types.MetricResultV2{} } else { sv = *v } for key, value := range shape { switch key { - case "FirehoseArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.FirehoseArn = ptr.String(jtv) + case "Collections": + if err := awsRestjson1_deserializeDocumentMetricDataCollectionsV2(&sv.Collections, value); err != nil { + return err + } + + case "Dimensions": + if err := awsRestjson1_deserializeDocumentDimensionsV2Map(&sv.Dimensions, value); err != nil { + return err + } + + case "MetricInterval": + if err := awsRestjson1_deserializeDocumentMetricInterval(&sv.MetricInterval, value); err != nil { + return err } default: @@ -38840,7 +42461,7 @@ func awsRestjson1_deserializeDocumentKinesisFirehoseConfig(v **types.KinesisFire return nil } -func awsRestjson1_deserializeDocumentKinesisStreamConfig(v **types.KinesisStreamConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentMetricV2(v **types.MetricV2, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38853,22 +42474,32 @@ func awsRestjson1_deserializeDocumentKinesisStreamConfig(v **types.KinesisStream return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.KinesisStreamConfig + var sv *types.MetricV2 if *v == nil { - sv = &types.KinesisStreamConfig{} + sv = &types.MetricV2{} } else { sv = *v } for key, value := range shape { switch key { - case "StreamArn": + case "MetricFilters": + if err := awsRestjson1_deserializeDocumentMetricFiltersV2List(&sv.MetricFilters, value); err != nil { + return err + } + + case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected MetricNameV2 to be of type string, got %T instead", value) } - sv.StreamArn = ptr.String(jtv) + sv.Name = ptr.String(jtv) + } + + case "Threshold": + if err := awsRestjson1_deserializeDocumentThresholdCollections(&sv.Threshold, value); err != nil { + return err } default: @@ -38880,7 +42511,7 @@ func awsRestjson1_deserializeDocumentKinesisStreamConfig(v **types.KinesisStream return nil } -func awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(v **types.KinesisVideoStreamConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentNotificationRecipientType(v **types.NotificationRecipientType, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38893,40 +42524,23 @@ func awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(v **types.KinesisV return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.KinesisVideoStreamConfig + var sv *types.NotificationRecipientType if *v == nil { - sv = &types.KinesisVideoStreamConfig{} + sv = &types.NotificationRecipientType{} } else { sv = *v } for key, value := range shape { switch key { - case "EncryptionConfig": - if err := awsRestjson1_deserializeDocumentEncryptionConfig(&sv.EncryptionConfig, value); err != nil { + case "UserIds": + if err := awsRestjson1_deserializeDocumentUserIdList(&sv.UserIds, value); err != nil { return err } - case "Prefix": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Prefix to be of type string, got %T instead", value) - } - sv.Prefix = ptr.String(jtv) - } - - case "RetentionPeriodHours": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected Hours to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.RetentionPeriodHours = int32(i64) + case "UserTags": + if err := awsRestjson1_deserializeDocumentUserTagMap(&sv.UserTags, value); err != nil { + return err } default: @@ -38938,7 +42552,7 @@ func awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(v **types.KinesisV return nil } -func awsRestjson1_deserializeDocumentLexBot(v **types.LexBot, value interface{}) error { +func awsRestjson1_deserializeDocumentNumberReference(v **types.NumberReference, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -38951,31 +42565,31 @@ func awsRestjson1_deserializeDocumentLexBot(v **types.LexBot, value interface{}) return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.LexBot + var sv *types.NumberReference if *v == nil { - sv = &types.LexBot{} + sv = &types.NumberReference{} } else { sv = *v } for key, value := range shape { switch key { - case "LexRegion": + case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected LexRegion to be of type string, got %T instead", value) + return fmt.Errorf("expected ReferenceKey to be of type string, got %T instead", value) } - sv.LexRegion = ptr.String(jtv) + sv.Name = ptr.String(jtv) } - case "Name": + case "Value": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected BotName to be of type string, got %T instead", value) + return fmt.Errorf("expected ReferenceValue to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.Value = ptr.String(jtv) } default: @@ -38987,7 +42601,7 @@ func awsRestjson1_deserializeDocumentLexBot(v **types.LexBot, value interface{}) return nil } -func awsRestjson1_deserializeDocumentLexBotConfig(v **types.LexBotConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentNumericQuestionPropertyValueAutomation(v **types.NumericQuestionPropertyValueAutomation, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39000,23 +42614,22 @@ func awsRestjson1_deserializeDocumentLexBotConfig(v **types.LexBotConfig, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.LexBotConfig + var sv *types.NumericQuestionPropertyValueAutomation if *v == nil { - sv = &types.LexBotConfig{} + sv = &types.NumericQuestionPropertyValueAutomation{} } else { sv = *v } for key, value := range shape { switch key { - case "LexBot": - if err := awsRestjson1_deserializeDocumentLexBot(&sv.LexBot, value); err != nil { - return err - } - - case "LexV2Bot": - if err := awsRestjson1_deserializeDocumentLexV2Bot(&sv.LexV2Bot, value); err != nil { - return err + case "Label": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NumericQuestionPropertyAutomationLabel to be of type string, got %T instead", value) + } + sv.Label = types.NumericQuestionPropertyAutomationLabel(jtv) } default: @@ -39028,7 +42641,7 @@ func awsRestjson1_deserializeDocumentLexBotConfig(v **types.LexBotConfig, value return nil } -func awsRestjson1_deserializeDocumentLexBotConfigList(v *[]types.LexBotConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentOriginsList(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39041,20 +42654,22 @@ func awsRestjson1_deserializeDocumentLexBotConfigList(v *[]types.LexBotConfig, v return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.LexBotConfig + var cv []string if *v == nil { - cv = []types.LexBotConfig{} + cv = []string{} } else { cv = *v } for _, value := range shape { - var col types.LexBotConfig - destAddr := &col - if err := awsRestjson1_deserializeDocumentLexBotConfig(&destAddr, value); err != nil { - return err + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Origin to be of type string, got %T instead", value) + } + col = jtv } - col = *destAddr cv = append(cv, col) } @@ -39062,7 +42677,7 @@ func awsRestjson1_deserializeDocumentLexBotConfigList(v *[]types.LexBotConfig, v return nil } -func awsRestjson1_deserializeDocumentLexBotsList(v *[]types.LexBot, value interface{}) error { +func awsRestjson1_deserializeDocumentOutboundCallerConfig(v **types.OutboundCallerConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39070,33 +42685,57 @@ func awsRestjson1_deserializeDocumentLexBotsList(v *[]types.LexBot, value interf return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.LexBot + var sv *types.OutboundCallerConfig if *v == nil { - cv = []types.LexBot{} + sv = &types.OutboundCallerConfig{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.LexBot - destAddr := &col - if err := awsRestjson1_deserializeDocumentLexBot(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "OutboundCallerIdName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected OutboundCallerIdName to be of type string, got %T instead", value) + } + sv.OutboundCallerIdName = ptr.String(jtv) + } + + case "OutboundCallerIdNumberId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + } + sv.OutboundCallerIdNumberId = ptr.String(jtv) + } + case "OutboundFlowId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) + } + sv.OutboundFlowId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } } - *v = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentLexV2Bot(v **types.LexV2Bot, value interface{}) error { +func awsRestjson1_deserializeDocumentOutboundContactNotPermittedException(v **types.OutboundContactNotPermittedException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39109,22 +42748,22 @@ func awsRestjson1_deserializeDocumentLexV2Bot(v **types.LexV2Bot, value interfac return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.LexV2Bot + var sv *types.OutboundContactNotPermittedException if *v == nil { - sv = &types.LexV2Bot{} + sv = &types.OutboundContactNotPermittedException{} } else { sv = *v } for key, value := range shape { switch key { - case "AliasArn": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected AliasArn to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.AliasArn = ptr.String(jtv) + sv.Message = ptr.String(jtv) } default: @@ -39136,7 +42775,7 @@ func awsRestjson1_deserializeDocumentLexV2Bot(v **types.LexV2Bot, value interfac return nil } -func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { +func awsRestjson1_deserializeDocumentOutputTypeNotFoundException(v **types.OutputTypeNotFoundException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39149,9 +42788,9 @@ func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExcee return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.LimitExceededException + var sv *types.OutputTypeNotFoundException if *v == nil { - sv = &types.LimitExceededException{} + sv = &types.OutputTypeNotFoundException{} } else { sv = *v } @@ -39176,7 +42815,7 @@ func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExcee return nil } -func awsRestjson1_deserializeDocumentListPhoneNumbersSummary(v **types.ListPhoneNumbersSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentParticipantTokenCredentials(v **types.ParticipantTokenCredentials, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39189,76 +42828,31 @@ func awsRestjson1_deserializeDocumentListPhoneNumbersSummary(v **types.ListPhone return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.ListPhoneNumbersSummary + var sv *types.ParticipantTokenCredentials if *v == nil { - sv = &types.ListPhoneNumbersSummary{} + sv = &types.ParticipantTokenCredentials{} } else { sv = *v } for key, value := range shape { switch key { - case "InstanceId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) - } - sv.InstanceId = ptr.String(jtv) - } - - case "PhoneNumber": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) - } - sv.PhoneNumber = ptr.String(jtv) - } - - case "PhoneNumberArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.PhoneNumberArn = ptr.String(jtv) - } - - case "PhoneNumberCountryCode": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberCountryCode to be of type string, got %T instead", value) - } - sv.PhoneNumberCountryCode = types.PhoneNumberCountryCode(jtv) - } - - case "PhoneNumberId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) - } - sv.PhoneNumberId = ptr.String(jtv) - } - - case "PhoneNumberType": + case "Expiry": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumberType to be of type string, got %T instead", value) + return fmt.Errorf("expected ISO8601Datetime to be of type string, got %T instead", value) } - sv.PhoneNumberType = types.PhoneNumberType(jtv) + sv.Expiry = ptr.String(jtv) } - case "TargetArn": + case "ParticipantToken": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) } - sv.TargetArn = ptr.String(jtv) + sv.ParticipantToken = ptr.String(jtv) } default: @@ -39270,7 +42864,7 @@ func awsRestjson1_deserializeDocumentListPhoneNumbersSummary(v **types.ListPhone return nil } -func awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(v *[]types.ListPhoneNumbersSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentPermissionsList(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39283,20 +42877,22 @@ func awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(v *[]types.List return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.ListPhoneNumbersSummary + var cv []string if *v == nil { - cv = []types.ListPhoneNumbersSummary{} + cv = []string{} } else { cv = *v } for _, value := range shape { - var col types.ListPhoneNumbersSummary - destAddr := &col - if err := awsRestjson1_deserializeDocumentListPhoneNumbersSummary(&destAddr, value); err != nil { - return err + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SecurityProfilePermission to be of type string, got %T instead", value) + } + col = jtv } - col = *destAddr cv = append(cv, col) } @@ -39304,7 +42900,7 @@ func awsRestjson1_deserializeDocumentListPhoneNumbersSummaryList(v *[]types.List return nil } -func awsRestjson1_deserializeDocumentMaximumResultReturnedException(v **types.MaximumResultReturnedException, value interface{}) error { +func awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(v **types.PhoneNumberQuickConnectConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39317,22 +42913,22 @@ func awsRestjson1_deserializeDocumentMaximumResultReturnedException(v **types.Ma return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MaximumResultReturnedException + var sv *types.PhoneNumberQuickConnectConfig if *v == nil { - sv = &types.MaximumResultReturnedException{} + sv = &types.PhoneNumberQuickConnectConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "PhoneNumber": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) } - sv.Message = ptr.String(jtv) + sv.PhoneNumber = ptr.String(jtv) } default: @@ -39344,41 +42940,7 @@ func awsRestjson1_deserializeDocumentMaximumResultReturnedException(v **types.Ma return nil } -func awsRestjson1_deserializeDocumentMediaConcurrencies(v *[]types.MediaConcurrency, 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.MediaConcurrency - if *v == nil { - cv = []types.MediaConcurrency{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.MediaConcurrency - destAddr := &col - if err := awsRestjson1_deserializeDocumentMediaConcurrency(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsRestjson1_deserializeDocumentMediaConcurrency(v **types.MediaConcurrency, value interface{}) error { +func awsRestjson1_deserializeDocumentPhoneNumberStatus(v **types.PhoneNumberStatus, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39391,40 +42953,31 @@ func awsRestjson1_deserializeDocumentMediaConcurrency(v **types.MediaConcurrency return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MediaConcurrency + var sv *types.PhoneNumberStatus if *v == nil { - sv = &types.MediaConcurrency{} + sv = &types.PhoneNumberStatus{} } else { sv = *v } for key, value := range shape { switch key { - case "Channel": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Channel to be of type string, got %T instead", value) + return fmt.Errorf("expected PhoneNumberWorkflowMessage to be of type string, got %T instead", value) } - sv.Channel = types.Channel(jtv) + sv.Message = ptr.String(jtv) } - case "Concurrency": + case "Status": if value != nil { - jtv, ok := value.(json.Number) + jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Concurrency to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err + return fmt.Errorf("expected PhoneNumberWorkflowStatus to be of type string, got %T instead", value) } - sv.Concurrency = ptr.Int32(int32(i64)) - } - - case "CrossChannelBehavior": - if err := awsRestjson1_deserializeDocumentCrossChannelBehavior(&sv.CrossChannelBehavior, value); err != nil { - return err + sv.Status = types.PhoneNumberWorkflowStatus(jtv) } default: @@ -39436,41 +42989,7 @@ func awsRestjson1_deserializeDocumentMediaConcurrency(v **types.MediaConcurrency return nil } -func awsRestjson1_deserializeDocumentMetricDataCollectionsV2(v *[]types.MetricDataV2, 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.MetricDataV2 - if *v == nil { - cv = []types.MetricDataV2{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.MetricDataV2 - destAddr := &col - if err := awsRestjson1_deserializeDocumentMetricDataV2(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsRestjson1_deserializeDocumentMetricDataV2(v **types.MetricDataV2, value interface{}) error { +func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39483,52 +43002,58 @@ func awsRestjson1_deserializeDocumentMetricDataV2(v **types.MetricDataV2, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MetricDataV2 + var sv *types.PhoneNumberSummary if *v == nil { - sv = &types.MetricDataV2{} + sv = &types.PhoneNumberSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "Metric": - if err := awsRestjson1_deserializeDocumentMetricV2(&sv.Metric, value); err != nil { - return err + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) } - case "Value": + case "Id": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Value = ptr.Float64(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } - } - sv.Value = ptr.Float64(f64) + case "PhoneNumber": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) + } + sv.PhoneNumber = ptr.String(jtv) + } - default: - return fmt.Errorf("expected Value to be a JSON Number, got %T instead", value) + case "PhoneNumberCountryCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberCountryCode to be of type string, got %T instead", value) + } + sv.PhoneNumberCountryCode = types.PhoneNumberCountryCode(jtv) + } + case "PhoneNumberType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhoneNumberType to be of type string, got %T instead", value) } + sv.PhoneNumberType = types.PhoneNumberType(jtv) } default: @@ -39540,7 +43065,7 @@ func awsRestjson1_deserializeDocumentMetricDataV2(v **types.MetricDataV2, value return nil } -func awsRestjson1_deserializeDocumentMetricFiltersV2List(v *[]types.MetricFilterV2, value interface{}) error { +func awsRestjson1_deserializeDocumentPhoneNumberSummaryList(v *[]types.PhoneNumberSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39553,17 +43078,17 @@ func awsRestjson1_deserializeDocumentMetricFiltersV2List(v *[]types.MetricFilter return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.MetricFilterV2 + var cv []types.PhoneNumberSummary if *v == nil { - cv = []types.MetricFilterV2{} + cv = []types.PhoneNumberSummary{} } else { cv = *v } for _, value := range shape { - var col types.MetricFilterV2 + var col types.PhoneNumberSummary destAddr := &col - if err := awsRestjson1_deserializeDocumentMetricFilterV2(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentPhoneNumberSummary(&destAddr, value); err != nil { return err } col = *destAddr @@ -39574,7 +43099,7 @@ func awsRestjson1_deserializeDocumentMetricFiltersV2List(v *[]types.MetricFilter return nil } -func awsRestjson1_deserializeDocumentMetricFilterV2(v **types.MetricFilterV2, value interface{}) error { +func awsRestjson1_deserializeDocumentProblemDetail(v **types.ProblemDetail, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39587,36 +43112,22 @@ func awsRestjson1_deserializeDocumentMetricFilterV2(v **types.MetricFilterV2, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MetricFilterV2 + var sv *types.ProblemDetail if *v == nil { - sv = &types.MetricFilterV2{} + sv = &types.ProblemDetail{} } else { sv = *v } for key, value := range shape { switch key { - case "MetricFilterKey": + 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.MetricFilterKey = ptr.String(jtv) - } - - case "MetricFilterValues": - if err := awsRestjson1_deserializeDocumentMetricFilterValueList(&sv.MetricFilterValues, value); err != nil { - return err - } - - case "Negate": - if value != nil { - jtv, ok := value.(bool) - if !ok { - return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + return fmt.Errorf("expected ProblemMessageString to be of type string, got %T instead", value) } - sv.Negate = jtv + sv.Message = ptr.String(jtv) } default: @@ -39628,7 +43139,7 @@ func awsRestjson1_deserializeDocumentMetricFilterV2(v **types.MetricFilterV2, va return nil } -func awsRestjson1_deserializeDocumentMetricFilterValueList(v *[]string, value interface{}) error { +func awsRestjson1_deserializeDocumentProblems(v *[]types.ProblemDetail, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39641,22 +43152,20 @@ func awsRestjson1_deserializeDocumentMetricFilterValueList(v *[]string, value in return fmt.Errorf("unexpected JSON type %v", value) } - var cv []string + var cv []types.ProblemDetail if *v == nil { - cv = []string{} + cv = []types.ProblemDetail{} } 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 + var col types.ProblemDetail + destAddr := &col + if err := awsRestjson1_deserializeDocumentProblemDetail(&destAddr, value); err != nil { + return err } + col = *destAddr cv = append(cv, col) } @@ -39664,7 +43173,7 @@ func awsRestjson1_deserializeDocumentMetricFilterValueList(v *[]string, value in return nil } -func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, value interface{}) error { +func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39677,16 +43186,34 @@ func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MetricInterval + var sv *types.Prompt if *v == nil { - sv = &types.MetricInterval{} + sv = &types.Prompt{} } else { sv = *v } for key, value := range shape { switch key { - case "EndTime": + case "Description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": if value != nil { switch jtv := value.(type) { case json.Number: @@ -39694,7 +43221,7 @@ func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, va if err != nil { return err } - sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) @@ -39702,29 +43229,36 @@ func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, va } } - case "Interval": + case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected IntervalPeriod to be of type string, got %T instead", value) + return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) } - sv.Interval = types.IntervalPeriod(jtv) + sv.Name = ptr.String(jtv) } - case "StartTime": + case "PromptARN": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.PromptARN = ptr.String(jtv) + } + case "PromptId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) } + sv.PromptId = ptr.String(jtv) + } + + case "Tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + return err } default: @@ -39736,7 +43270,7 @@ func awsRestjson1_deserializeDocumentMetricInterval(v **types.MetricInterval, va return nil } -func awsRestjson1_deserializeDocumentMetricResultsV2(v *[]types.MetricResultV2, value interface{}) error { +func awsRestjson1_deserializeDocumentPromptList(v *[]types.Prompt, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39749,17 +43283,17 @@ func awsRestjson1_deserializeDocumentMetricResultsV2(v *[]types.MetricResultV2, return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.MetricResultV2 + var cv []types.Prompt if *v == nil { - cv = []types.MetricResultV2{} + cv = []types.Prompt{} } else { cv = *v } for _, value := range shape { - var col types.MetricResultV2 + var col types.Prompt destAddr := &col - if err := awsRestjson1_deserializeDocumentMetricResultV2(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentPrompt(&destAddr, value); err != nil { return err } col = *destAddr @@ -39770,7 +43304,7 @@ func awsRestjson1_deserializeDocumentMetricResultsV2(v *[]types.MetricResultV2, return nil } -func awsRestjson1_deserializeDocumentMetricResultV2(v **types.MetricResultV2, value interface{}) error { +func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39783,80 +43317,67 @@ func awsRestjson1_deserializeDocumentMetricResultV2(v **types.MetricResultV2, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.MetricResultV2 + var sv *types.PromptSummary if *v == nil { - sv = &types.MetricResultV2{} + sv = &types.PromptSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "Collections": - if err := awsRestjson1_deserializeDocumentMetricDataCollectionsV2(&sv.Collections, value); err != nil { - return err + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) } - case "Dimensions": - if err := awsRestjson1_deserializeDocumentDimensionsV2Map(&sv.Dimensions, value); err != nil { - return err + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) } - case "MetricInterval": - if err := awsRestjson1_deserializeDocumentMetricInterval(&sv.MetricInterval, value); err != nil { - return err + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) } - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsRestjson1_deserializeDocumentMetricV2(v **types.MetricV2, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - var sv *types.MetricV2 - if *v == nil { - sv = &types.MetricV2{} - } else { - sv = *v - } + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - for key, value := range shape { - switch key { - case "MetricFilters": - if err := awsRestjson1_deserializeDocumentMetricFiltersV2List(&sv.MetricFilters, value); err != nil { - return err + } } case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected MetricNameV2 to be of type string, got %T instead", value) + return fmt.Errorf("expected PromptName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } - case "Threshold": - if err := awsRestjson1_deserializeDocumentThresholdCollections(&sv.Threshold, value); err != nil { - return err - } - default: _, _ = key, value @@ -39866,7 +43387,7 @@ func awsRestjson1_deserializeDocumentMetricV2(v **types.MetricV2, value interfac return nil } -func awsRestjson1_deserializeDocumentNotificationRecipientType(v **types.NotificationRecipientType, value interface{}) error { +func awsRestjson1_deserializeDocumentPromptSummaryList(v *[]types.PromptSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39874,40 +43395,33 @@ func awsRestjson1_deserializeDocumentNotificationRecipientType(v **types.Notific return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.NotificationRecipientType + var cv []types.PromptSummary if *v == nil { - sv = &types.NotificationRecipientType{} + cv = []types.PromptSummary{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "UserIds": - if err := awsRestjson1_deserializeDocumentUserIdList(&sv.UserIds, value); err != nil { - return err - } - - case "UserTags": - if err := awsRestjson1_deserializeDocumentUserTagMap(&sv.UserTags, value); err != nil { - return err - } - - default: - _, _ = key, value - + for _, value := range shape { + var col types.PromptSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentPromptSummary(&destAddr, value); err != nil { + return err } + col = *destAddr + cv = append(cv, col) + } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentNumberReference(v **types.NumberReference, value interface{}) error { +func awsRestjson1_deserializeDocumentPropertyValidationException(v **types.PropertyValidationException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39920,31 +43434,27 @@ func awsRestjson1_deserializeDocumentNumberReference(v **types.NumberReference, return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.NumberReference + var sv *types.PropertyValidationException if *v == nil { - sv = &types.NumberReference{} + sv = &types.PropertyValidationException{} } else { sv = *v } for key, value := range shape { switch key { - case "Name": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ReferenceKey to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.Message = ptr.String(jtv) } - case "Value": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ReferenceValue to be of type string, got %T instead", value) - } - sv.Value = ptr.String(jtv) + case "PropertyList": + if err := awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(&sv.PropertyList, value); err != nil { + return err } default: @@ -39956,7 +43466,7 @@ func awsRestjson1_deserializeDocumentNumberReference(v **types.NumberReference, return nil } -func awsRestjson1_deserializeDocumentNumericQuestionPropertyValueAutomation(v **types.NumericQuestionPropertyValueAutomation, value interface{}) error { +func awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(v **types.PropertyValidationExceptionProperty, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -39969,22 +43479,40 @@ func awsRestjson1_deserializeDocumentNumericQuestionPropertyValueAutomation(v ** return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.NumericQuestionPropertyValueAutomation + var sv *types.PropertyValidationExceptionProperty if *v == nil { - sv = &types.NumericQuestionPropertyValueAutomation{} + sv = &types.PropertyValidationExceptionProperty{} } else { sv = *v } for key, value := range shape { switch key { - case "Label": + case "Message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected NumericQuestionPropertyAutomationLabel to be of type string, got %T instead", value) + return fmt.Errorf("expected Message to be of type string, got %T instead", value) } - sv.Label = types.NumericQuestionPropertyAutomationLabel(jtv) + sv.Message = ptr.String(jtv) + } + + case "PropertyPath": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.PropertyPath = ptr.String(jtv) + } + + case "Reason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PropertyValidationExceptionReason to be of type string, got %T instead", value) + } + sv.Reason = types.PropertyValidationExceptionReason(jtv) } default: @@ -39996,7 +43524,7 @@ func awsRestjson1_deserializeDocumentNumericQuestionPropertyValueAutomation(v ** return nil } -func awsRestjson1_deserializeDocumentOriginsList(v *[]string, value interface{}) error { +func awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(v *[]types.PropertyValidationExceptionProperty, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40009,22 +43537,20 @@ func awsRestjson1_deserializeDocumentOriginsList(v *[]string, value interface{}) return fmt.Errorf("unexpected JSON type %v", value) } - var cv []string + var cv []types.PropertyValidationExceptionProperty if *v == nil { - cv = []string{} + cv = []types.PropertyValidationExceptionProperty{} } else { cv = *v } for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Origin to be of type string, got %T instead", value) - } - col = jtv + var col types.PropertyValidationExceptionProperty + destAddr := &col + if err := awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(&destAddr, value); err != nil { + return err } + col = *destAddr cv = append(cv, col) } @@ -40032,7 +43558,7 @@ func awsRestjson1_deserializeDocumentOriginsList(v *[]string, value interface{}) return nil } -func awsRestjson1_deserializeDocumentOutboundCallerConfig(v **types.OutboundCallerConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentQueue(v **types.Queue, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40045,129 +43571,115 @@ func awsRestjson1_deserializeDocumentOutboundCallerConfig(v **types.OutboundCall return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.OutboundCallerConfig + var sv *types.Queue if *v == nil { - sv = &types.OutboundCallerConfig{} + sv = &types.Queue{} } else { sv = *v } for key, value := range shape { switch key { - case "OutboundCallerIdName": + case "Description": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected OutboundCallerIdName to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueDescription to be of type string, got %T instead", value) } - sv.OutboundCallerIdName = ptr.String(jtv) + sv.Description = ptr.String(jtv) } - case "OutboundCallerIdNumberId": + case "HoursOfOperationId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) } - sv.OutboundCallerIdNumberId = ptr.String(jtv) + sv.HoursOfOperationId = ptr.String(jtv) } - case "OutboundFlowId": + case "LastModifiedRegion": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) } - sv.OutboundFlowId = ptr.String(jtv) + sv.LastModifiedRegion = ptr.String(jtv) } - default: - _, _ = key, value - - } - } - *v = sv - return nil -} + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) -func awsRestjson1_deserializeDocumentOutboundContactNotPermittedException(v **types.OutboundContactNotPermittedException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } + } + } - var sv *types.OutboundContactNotPermittedException - if *v == nil { - sv = &types.OutboundContactNotPermittedException{} - } else { - sv = *v - } + case "MaxContacts": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected QueueMaxContacts to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaxContacts = ptr.Int32(int32(i64)) + } - for key, value := range shape { - switch key { - case "Message": + case "Name": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) + return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) } - sv.Message = ptr.String(jtv) + sv.Name = ptr.String(jtv) } - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsRestjson1_deserializeDocumentParticipantTokenCredentials(v **types.ParticipantTokenCredentials, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } + case "OutboundCallerConfig": + if err := awsRestjson1_deserializeDocumentOutboundCallerConfig(&sv.OutboundCallerConfig, value); err != nil { + return err + } - var sv *types.ParticipantTokenCredentials - if *v == nil { - sv = &types.ParticipantTokenCredentials{} - } else { - sv = *v - } + case "QueueArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.QueueArn = ptr.String(jtv) + } - for key, value := range shape { - switch key { - case "Expiry": + case "QueueId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ISO8601Datetime to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) } - sv.Expiry = ptr.String(jtv) + sv.QueueId = ptr.String(jtv) } - case "ParticipantToken": + case "Status": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueStatus to be of type string, got %T instead", value) } - sv.ParticipantToken = ptr.String(jtv) + sv.Status = types.QueueStatus(jtv) + } + + case "Tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + return err } default: @@ -40179,7 +43691,7 @@ func awsRestjson1_deserializeDocumentParticipantTokenCredentials(v **types.Parti return nil } -func awsRestjson1_deserializeDocumentPermissionsList(v *[]string, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueInfo(v **types.QueueInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40187,63 +43699,43 @@ func awsRestjson1_deserializeDocumentPermissionsList(v *[]string, value interfac return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []string + var sv *types.QueueInfo if *v == nil { - cv = []string{} + sv = &types.QueueInfo{} } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SecurityProfilePermission to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(v **types.PhoneNumberQuickConnectConfig, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil + sv = *v } - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } + for key, value := range shape { + switch key { + case "EnqueueTimestamp": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.EnqueueTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) - var sv *types.PhoneNumberQuickConnectConfig - if *v == nil { - sv = &types.PhoneNumberQuickConnectConfig{} - } else { - sv = *v - } + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - for key, value := range shape { - switch key { - case "PhoneNumber": + } + } + + case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) } - sv.PhoneNumber = ptr.String(jtv) + sv.Id = ptr.String(jtv) } default: @@ -40255,7 +43747,7 @@ func awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(v **types.Pho return nil } -func awsRestjson1_deserializeDocumentPhoneNumberStatus(v **types.PhoneNumberStatus, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueQuickConnectConfig(v **types.QueueQuickConnectConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40268,31 +43760,31 @@ func awsRestjson1_deserializeDocumentPhoneNumberStatus(v **types.PhoneNumberStat return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.PhoneNumberStatus + var sv *types.QueueQuickConnectConfig if *v == nil { - sv = &types.PhoneNumberStatus{} + sv = &types.QueueQuickConnectConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "ContactFlowId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumberWorkflowMessage to be of type string, got %T instead", value) + return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) } - sv.Message = ptr.String(jtv) + sv.ContactFlowId = ptr.String(jtv) } - case "Status": + case "QueueId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumberWorkflowStatus to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) } - sv.Status = types.PhoneNumberWorkflowStatus(jtv) + sv.QueueId = ptr.String(jtv) } default: @@ -40304,7 +43796,7 @@ func awsRestjson1_deserializeDocumentPhoneNumberStatus(v **types.PhoneNumberStat return nil } -func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueReference(v **types.QueueReference, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40317,9 +43809,9 @@ func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSum return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.PhoneNumberSummary + var sv *types.QueueReference if *v == nil { - sv = &types.PhoneNumberSummary{} + sv = &types.QueueReference{} } else { sv = *v } @@ -40339,38 +43831,11 @@ func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSum if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) + return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } - case "PhoneNumber": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) - } - sv.PhoneNumber = ptr.String(jtv) - } - - case "PhoneNumberCountryCode": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberCountryCode to be of type string, got %T instead", value) - } - sv.PhoneNumberCountryCode = types.PhoneNumberCountryCode(jtv) - } - - case "PhoneNumberType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PhoneNumberType to be of type string, got %T instead", value) - } - sv.PhoneNumberType = types.PhoneNumberType(jtv) - } - default: _, _ = key, value @@ -40380,7 +43845,7 @@ func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSum return nil } -func awsRestjson1_deserializeDocumentPhoneNumberSummaryList(v *[]types.PhoneNumberSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueSearchSummaryList(v *[]types.Queue, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40393,17 +43858,17 @@ func awsRestjson1_deserializeDocumentPhoneNumberSummaryList(v *[]types.PhoneNumb return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.PhoneNumberSummary + var cv []types.Queue if *v == nil { - cv = []types.PhoneNumberSummary{} + cv = []types.Queue{} } else { cv = *v } for _, value := range shape { - var col types.PhoneNumberSummary + var col types.Queue destAddr := &col - if err := awsRestjson1_deserializeDocumentPhoneNumberSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentQueue(&destAddr, value); err != nil { return err } col = *destAddr @@ -40414,7 +43879,7 @@ func awsRestjson1_deserializeDocumentPhoneNumberSummaryList(v *[]types.PhoneNumb return nil } -func awsRestjson1_deserializeDocumentProblemDetail(v **types.ProblemDetail, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueSummary(v **types.QueueSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40427,22 +43892,74 @@ func awsRestjson1_deserializeDocumentProblemDetail(v **types.ProblemDetail, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.ProblemDetail + var sv *types.QueueSummary if *v == nil { - sv = &types.ProblemDetail{} + sv = &types.QueueSummary{} } else { sv = *v } for key, value := range shape { switch key { - case "message": + case "Arn": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ProblemMessageString to be of type string, got %T instead", value) + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "LastModifiedRegion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.LastModifiedRegion = ptr.String(jtv) + } + + case "LastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + } - sv.Message = ptr.String(jtv) + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueueName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "QueueType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueueType to be of type string, got %T instead", value) + } + sv.QueueType = types.QueueType(jtv) } default: @@ -40454,7 +43971,7 @@ func awsRestjson1_deserializeDocumentProblemDetail(v **types.ProblemDetail, valu return nil } -func awsRestjson1_deserializeDocumentProblems(v *[]types.ProblemDetail, value interface{}) error { +func awsRestjson1_deserializeDocumentQueueSummaryList(v *[]types.QueueSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40467,17 +43984,17 @@ func awsRestjson1_deserializeDocumentProblems(v *[]types.ProblemDetail, value in return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.ProblemDetail + var cv []types.QueueSummary if *v == nil { - cv = []types.ProblemDetail{} + cv = []types.QueueSummary{} } else { cv = *v } for _, value := range shape { - var col types.ProblemDetail + var col types.QueueSummary destAddr := &col - if err := awsRestjson1_deserializeDocumentProblemDetail(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentQueueSummary(&destAddr, value); err != nil { return err } col = *destAddr @@ -40488,7 +44005,7 @@ func awsRestjson1_deserializeDocumentProblems(v *[]types.ProblemDetail, value in return nil } -func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) error { +func awsRestjson1_deserializeDocumentQuickConnect(v **types.QuickConnect, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40501,9 +44018,9 @@ func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.Prompt + var sv *types.QuickConnect if *v == nil { - sv = &types.Prompt{} + sv = &types.QuickConnect{} } else { sv = *v } @@ -40514,7 +44031,7 @@ func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PromptDescription to be of type string, got %T instead", value) + return fmt.Errorf("expected QuickConnectDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } @@ -40548,27 +44065,32 @@ func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) + return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } - case "PromptARN": + case "QuickConnectARN": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) } - sv.PromptARN = ptr.String(jtv) + sv.QuickConnectARN = ptr.String(jtv) } - case "PromptId": + case "QuickConnectConfig": + if err := awsRestjson1_deserializeDocumentQuickConnectConfig(&sv.QuickConnectConfig, value); err != nil { + return err + } + + case "QuickConnectId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) + return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) } - sv.PromptId = ptr.String(jtv) + sv.QuickConnectId = ptr.String(jtv) } case "Tags": @@ -40585,7 +44107,62 @@ func awsRestjson1_deserializeDocumentPrompt(v **types.Prompt, value interface{}) return nil } -func awsRestjson1_deserializeDocumentPromptList(v *[]types.Prompt, value interface{}) error { +func awsRestjson1_deserializeDocumentQuickConnectConfig(v **types.QuickConnectConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QuickConnectConfig + if *v == nil { + sv = &types.QuickConnectConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "PhoneConfig": + if err := awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(&sv.PhoneConfig, value); err != nil { + return err + } + + case "QueueConfig": + if err := awsRestjson1_deserializeDocumentQueueQuickConnectConfig(&sv.QueueConfig, value); err != nil { + return err + } + + case "QuickConnectType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) + } + sv.QuickConnectType = types.QuickConnectType(jtv) + } + + case "UserConfig": + if err := awsRestjson1_deserializeDocumentUserQuickConnectConfig(&sv.UserConfig, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(v *[]types.QuickConnect, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40598,17 +44175,17 @@ func awsRestjson1_deserializeDocumentPromptList(v *[]types.Prompt, value interfa return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.Prompt + var cv []types.QuickConnect if *v == nil { - cv = []types.Prompt{} + cv = []types.QuickConnect{} } else { cv = *v } for _, value := range shape { - var col types.Prompt + var col types.QuickConnect destAddr := &col - if err := awsRestjson1_deserializeDocumentPrompt(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentQuickConnect(&destAddr, value); err != nil { return err } col = *destAddr @@ -40619,7 +44196,7 @@ func awsRestjson1_deserializeDocumentPromptList(v *[]types.Prompt, value interfa return nil } -func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentQuickConnectSummary(v **types.QuickConnectSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40632,9 +44209,9 @@ func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.PromptSummary + var sv *types.QuickConnectSummary if *v == nil { - sv = &types.PromptSummary{} + sv = &types.QuickConnectSummary{} } else { sv = *v } @@ -40654,7 +44231,7 @@ func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, valu if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) + return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } @@ -40688,11 +44265,20 @@ func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, valu if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PromptName to be of type string, got %T instead", value) + return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } + case "QuickConnectType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) + } + sv.QuickConnectType = types.QuickConnectType(jtv) + } + default: _, _ = key, value @@ -40702,7 +44288,7 @@ func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, valu return nil } -func awsRestjson1_deserializeDocumentPromptSummaryList(v *[]types.PromptSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentQuickConnectSummaryList(v *[]types.QuickConnectSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40715,17 +44301,17 @@ func awsRestjson1_deserializeDocumentPromptSummaryList(v *[]types.PromptSummary, return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.PromptSummary + var cv []types.QuickConnectSummary if *v == nil { - cv = []types.PromptSummary{} + cv = []types.QuickConnectSummary{} } else { cv = *v } for _, value := range shape { - var col types.PromptSummary + var col types.QuickConnectSummary destAddr := &col - if err := awsRestjson1_deserializeDocumentPromptSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentQuickConnectSummary(&destAddr, value); err != nil { return err } col = *destAddr @@ -40736,7 +44322,7 @@ func awsRestjson1_deserializeDocumentPromptSummaryList(v *[]types.PromptSummary, return nil } -func awsRestjson1_deserializeDocumentPropertyValidationException(v **types.PropertyValidationException, value interface{}) error { +func awsRestjson1_deserializeDocumentReadOnlyFieldInfo(v **types.ReadOnlyFieldInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40749,26 +44335,17 @@ func awsRestjson1_deserializeDocumentPropertyValidationException(v **types.Prope return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.PropertyValidationException + var sv *types.ReadOnlyFieldInfo if *v == nil { - sv = &types.PropertyValidationException{} + sv = &types.ReadOnlyFieldInfo{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - case "PropertyList": - if err := awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(&sv.PropertyList, value); err != nil { + case "Id": + if err := awsRestjson1_deserializeDocumentTaskTemplateFieldIdentifier(&sv.Id, value); err != nil { return err } @@ -40781,7 +44358,41 @@ func awsRestjson1_deserializeDocumentPropertyValidationException(v **types.Prope return nil } -func awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(v **types.PropertyValidationExceptionProperty, value interface{}) error { +func awsRestjson1_deserializeDocumentReadOnlyTaskTemplateFields(v *[]types.ReadOnlyFieldInfo, 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.ReadOnlyFieldInfo + if *v == nil { + cv = []types.ReadOnlyFieldInfo{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ReadOnlyFieldInfo + destAddr := &col + if err := awsRestjson1_deserializeDocumentReadOnlyFieldInfo(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisAttachment(v **types.RealTimeContactAnalysisAttachment, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40794,40 +44405,49 @@ func awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(v **typ return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.PropertyValidationExceptionProperty + var sv *types.RealTimeContactAnalysisAttachment if *v == nil { - sv = &types.PropertyValidationExceptionProperty{} + sv = &types.RealTimeContactAnalysisAttachment{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "AttachmentId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected Message to be of type string, got %T instead", value) + return fmt.Errorf("expected ArtifactId to be of type string, got %T instead", value) } - sv.Message = ptr.String(jtv) + sv.AttachmentId = ptr.String(jtv) } - case "PropertyPath": + case "AttachmentName": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) + return fmt.Errorf("expected AttachmentName to be of type string, got %T instead", value) } - sv.PropertyPath = ptr.String(jtv) + sv.AttachmentName = ptr.String(jtv) } - case "Reason": + case "ContentType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected PropertyValidationExceptionReason to be of type string, got %T instead", value) + return fmt.Errorf("expected ContentType to be of type string, got %T instead", value) } - sv.Reason = types.PropertyValidationExceptionReason(jtv) + sv.ContentType = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ArtifactStatus to be of type string, got %T instead", value) + } + sv.Status = types.ArtifactStatus(jtv) } default: @@ -40839,7 +44459,7 @@ func awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(v **typ return nil } -func awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(v *[]types.PropertyValidationExceptionProperty, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisAttachments(v *[]types.RealTimeContactAnalysisAttachment, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40852,17 +44472,17 @@ func awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(v * return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.PropertyValidationExceptionProperty + var cv []types.RealTimeContactAnalysisAttachment if *v == nil { - cv = []types.PropertyValidationExceptionProperty{} + cv = []types.RealTimeContactAnalysisAttachment{} } else { cv = *v } for _, value := range shape { - var col types.PropertyValidationExceptionProperty + var col types.RealTimeContactAnalysisAttachment destAddr := &col - if err := awsRestjson1_deserializeDocumentPropertyValidationExceptionProperty(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisAttachment(&destAddr, value); err != nil { return err } col = *destAddr @@ -40873,7 +44493,7 @@ func awsRestjson1_deserializeDocumentPropertyValidationExceptionPropertyList(v * return nil } -func awsRestjson1_deserializeDocumentQueue(v **types.Queue, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisCategoryDetails(v **types.RealTimeContactAnalysisCategoryDetails, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -40886,114 +44506,144 @@ func awsRestjson1_deserializeDocumentQueue(v **types.Queue, value interface{}) e return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.Queue + var sv *types.RealTimeContactAnalysisCategoryDetails if *v == nil { - sv = &types.Queue{} + sv = &types.RealTimeContactAnalysisCategoryDetails{} } else { sv = *v } for key, value := range shape { switch key { - case "Description": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueDescription to be of type string, got %T instead", value) - } - sv.Description = ptr.String(jtv) + case "PointsOfInterest": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisPointsOfInterest(&sv.PointsOfInterest, value); err != nil { + return err } - case "HoursOfOperationId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) - } - sv.HoursOfOperationId = ptr.String(jtv) - } + default: + _, _ = key, value - case "LastModifiedRegion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } + } + } + *v = sv + return nil +} - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterInterval(v **types.RealTimeContactAnalysisCharacterInterval, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } - } - } + var sv *types.RealTimeContactAnalysisCharacterInterval + if *v == nil { + sv = &types.RealTimeContactAnalysisCharacterInterval{} + } else { + sv = *v + } - case "MaxContacts": + for key, value := range shape { + switch key { + case "BeginOffsetChar": if value != nil { jtv, ok := value.(json.Number) if !ok { - return fmt.Errorf("expected QueueMaxContacts to be json.Number, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisOffset to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } - sv.MaxContacts = ptr.Int32(int32(i64)) + sv.BeginOffsetChar = int32(i64) } - case "Name": + case "EndOffsetChar": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(json.Number) if !ok { - return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisOffset to be json.Number, got %T instead", value) } - sv.Name = ptr.String(jtv) + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EndOffsetChar = int32(i64) } - case "OutboundCallerConfig": - if err := awsRestjson1_deserializeDocumentOutboundCallerConfig(&sv.OutboundCallerConfig, value); err != nil { - return err - } + default: + _, _ = key, value - case "QueueArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.QueueArn = ptr.String(jtv) - } + } + } + *v = sv + return nil +} - case "QueueId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) - } - sv.QueueId = ptr.String(jtv) - } +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterIntervals(v *[]types.RealTimeContactAnalysisCharacterInterval, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } - case "Status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueStatus to be of type string, got %T instead", value) - } - sv.Status = types.QueueStatus(jtv) - } + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } - case "Tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + var cv []types.RealTimeContactAnalysisCharacterInterval + if *v == nil { + cv = []types.RealTimeContactAnalysisCharacterInterval{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RealTimeContactAnalysisCharacterInterval + destAddr := &col + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterInterval(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisIssueDetected(v **types.RealTimeContactAnalysisIssueDetected, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RealTimeContactAnalysisIssueDetected + if *v == nil { + sv = &types.RealTimeContactAnalysisIssueDetected{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "TranscriptItems": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemsWithContent(&sv.TranscriptItems, value); err != nil { return err } @@ -41006,7 +44656,7 @@ func awsRestjson1_deserializeDocumentQueue(v **types.Queue, value interface{}) e return nil } -func awsRestjson1_deserializeDocumentQueueInfo(v **types.QueueInfo, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisIssuesDetected(v *[]types.RealTimeContactAnalysisIssueDetected, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41014,55 +44664,33 @@ func awsRestjson1_deserializeDocumentQueueInfo(v **types.QueueInfo, value interf return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QueueInfo + var cv []types.RealTimeContactAnalysisIssueDetected if *v == nil { - sv = &types.QueueInfo{} + cv = []types.RealTimeContactAnalysisIssueDetected{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "EnqueueTimestamp": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.EnqueueTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - - } - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - default: - _, _ = key, value - + for _, value := range shape { + var col types.RealTimeContactAnalysisIssueDetected + destAddr := &col + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisIssueDetected(&destAddr, value); err != nil { + return err } + col = *destAddr + cv = append(cv, col) + } - *v = sv + *v = cv return nil } -func awsRestjson1_deserializeDocumentQueueQuickConnectConfig(v **types.QueueQuickConnectConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisMatchedDetails(v *map[string]types.RealTimeContactAnalysisCategoryDetails, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41075,43 +44703,29 @@ func awsRestjson1_deserializeDocumentQueueQuickConnectConfig(v **types.QueueQuic return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QueueQuickConnectConfig + var mv map[string]types.RealTimeContactAnalysisCategoryDetails if *v == nil { - sv = &types.QueueQuickConnectConfig{} + mv = map[string]types.RealTimeContactAnalysisCategoryDetails{} } else { - sv = *v + mv = *v } for key, value := range shape { - switch key { - case "ContactFlowId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) - } - sv.ContactFlowId = ptr.String(jtv) - } - - case "QueueId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) - } - sv.QueueId = ptr.String(jtv) - } - - default: - _, _ = key, value - + var parsedVal types.RealTimeContactAnalysisCategoryDetails + mapVar := parsedVal + destAddr := &mapVar + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisCategoryDetails(&destAddr, value); err != nil { + return err } + parsedVal = *destAddr + mv[key] = parsedVal + } - *v = sv + *v = mv return nil } -func awsRestjson1_deserializeDocumentQueueReference(v **types.QueueReference, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisPointOfInterest(v **types.RealTimeContactAnalysisPointOfInterest, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41124,31 +44738,18 @@ func awsRestjson1_deserializeDocumentQueueReference(v **types.QueueReference, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QueueReference + var sv *types.RealTimeContactAnalysisPointOfInterest if *v == nil { - sv = &types.QueueReference{} + sv = &types.RealTimeContactAnalysisPointOfInterest{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.Arn = ptr.String(jtv) - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) + case "TranscriptItems": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemsWithCharacterOffsets(&sv.TranscriptItems, value); err != nil { + return err } default: @@ -41160,7 +44761,7 @@ func awsRestjson1_deserializeDocumentQueueReference(v **types.QueueReference, va return nil } -func awsRestjson1_deserializeDocumentQueueSearchSummaryList(v *[]types.Queue, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisPointsOfInterest(v *[]types.RealTimeContactAnalysisPointOfInterest, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41173,17 +44774,17 @@ func awsRestjson1_deserializeDocumentQueueSearchSummaryList(v *[]types.Queue, va return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.Queue + var cv []types.RealTimeContactAnalysisPointOfInterest if *v == nil { - cv = []types.Queue{} + cv = []types.RealTimeContactAnalysisPointOfInterest{} } else { cv = *v } for _, value := range shape { - var col types.Queue + var col types.RealTimeContactAnalysisPointOfInterest destAddr := &col - if err := awsRestjson1_deserializeDocumentQueue(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisPointOfInterest(&destAddr, value); err != nil { return err } col = *destAddr @@ -41194,7 +44795,7 @@ func awsRestjson1_deserializeDocumentQueueSearchSummaryList(v *[]types.Queue, va return nil } -func awsRestjson1_deserializeDocumentQueueSummary(v **types.QueueSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentRealtimeContactAnalysisSegment(v *types.RealtimeContactAnalysisSegment, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41207,74 +44808,139 @@ func awsRestjson1_deserializeDocumentQueueSummary(v **types.QueueSummary, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QueueSummary + var uv types.RealtimeContactAnalysisSegment +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "Attachments": + var mv types.RealTimeContactAnalysisSegmentAttachments + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentAttachments(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RealtimeContactAnalysisSegmentMemberAttachments{Value: mv} + break loop + + case "Categories": + var mv types.RealTimeContactAnalysisSegmentCategories + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentCategories(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RealtimeContactAnalysisSegmentMemberCategories{Value: mv} + break loop + + case "Event": + var mv types.RealTimeContactAnalysisSegmentEvent + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentEvent(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RealtimeContactAnalysisSegmentMemberEvent{Value: mv} + break loop + + case "Issues": + var mv types.RealTimeContactAnalysisSegmentIssues + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentIssues(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RealtimeContactAnalysisSegmentMemberIssues{Value: mv} + break loop + + case "Transcript": + var mv types.RealTimeContactAnalysisSegmentTranscript + destAddr := &mv + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentTranscript(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RealtimeContactAnalysisSegmentMemberTranscript{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentAttachments(v **types.RealTimeContactAnalysisSegmentAttachments, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RealTimeContactAnalysisSegmentAttachments if *v == nil { - sv = &types.QueueSummary{} + sv = &types.RealTimeContactAnalysisSegmentAttachments{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "Attachments": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisAttachments(&sv.Attachments, value); err != nil { + return err + } + + case "DisplayName": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.DisplayName = ptr.String(jtv) } case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisId256 to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } - case "LastModifiedRegion": + case "ParticipantId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) } + sv.ParticipantId = ptr.String(jtv) } - case "Name": + case "ParticipantRole": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QueueName to be of type string, got %T instead", value) + return fmt.Errorf("expected ParticipantRole to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.ParticipantRole = types.ParticipantRole(jtv) } - case "QueueType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueueType to be of type string, got %T instead", value) - } - sv.QueueType = types.QueueType(jtv) + case "Time": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTimeData(&sv.Time, value); err != nil { + return err } default: @@ -41286,7 +44952,7 @@ func awsRestjson1_deserializeDocumentQueueSummary(v **types.QueueSummary, value return nil } -func awsRestjson1_deserializeDocumentQueueSummaryList(v *[]types.QueueSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentCategories(v **types.RealTimeContactAnalysisSegmentCategories, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41294,33 +44960,35 @@ func awsRestjson1_deserializeDocumentQueueSummaryList(v *[]types.QueueSummary, v return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.QueueSummary + var sv *types.RealTimeContactAnalysisSegmentCategories if *v == nil { - cv = []types.QueueSummary{} + sv = &types.RealTimeContactAnalysisSegmentCategories{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.QueueSummary - destAddr := &col - if err := awsRestjson1_deserializeDocumentQueueSummary(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "MatchedDetails": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisMatchedDetails(&sv.MatchedDetails, value); err != nil { + return err + } + default: + _, _ = key, value + + } } - *v = cv + *v = sv return nil } -func awsRestjson1_deserializeDocumentQuickConnect(v **types.QuickConnect, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentEvent(v **types.RealTimeContactAnalysisSegmentEvent, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41333,83 +45001,62 @@ func awsRestjson1_deserializeDocumentQuickConnect(v **types.QuickConnect, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QuickConnect + var sv *types.RealTimeContactAnalysisSegmentEvent if *v == nil { - sv = &types.QuickConnect{} + sv = &types.RealTimeContactAnalysisSegmentEvent{} } else { sv = *v } for key, value := range shape { switch key { - case "Description": + case "DisplayName": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectDescription to be of type string, got %T instead", value) + return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value) } - sv.Description = ptr.String(jtv) + sv.DisplayName = ptr.String(jtv) } - case "LastModifiedRegion": + case "EventType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) - } - sv.LastModifiedRegion = ptr.String(jtv) - } - - case "LastModifiedTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) - + return fmt.Errorf("expected RealTimeContactAnalysisEventType to be of type string, got %T instead", value) } + sv.EventType = ptr.String(jtv) } - case "Name": + case "Id": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisId256 to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.Id = ptr.String(jtv) } - case "QuickConnectARN": + case "ParticipantId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) } - sv.QuickConnectARN = ptr.String(jtv) - } - - case "QuickConnectConfig": - if err := awsRestjson1_deserializeDocumentQuickConnectConfig(&sv.QuickConnectConfig, value); err != nil { - return err + sv.ParticipantId = ptr.String(jtv) } - case "QuickConnectId": + case "ParticipantRole": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) + return fmt.Errorf("expected ParticipantRole to be of type string, got %T instead", value) } - sv.QuickConnectId = ptr.String(jtv) + sv.ParticipantRole = types.ParticipantRole(jtv) } - case "Tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + case "Time": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTimeData(&sv.Time, value); err != nil { return err } @@ -41422,7 +45069,7 @@ func awsRestjson1_deserializeDocumentQuickConnect(v **types.QuickConnect, value return nil } -func awsRestjson1_deserializeDocumentQuickConnectConfig(v **types.QuickConnectConfig, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentIssues(v **types.RealTimeContactAnalysisSegmentIssues, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41435,36 +45082,17 @@ func awsRestjson1_deserializeDocumentQuickConnectConfig(v **types.QuickConnectCo return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QuickConnectConfig + var sv *types.RealTimeContactAnalysisSegmentIssues if *v == nil { - sv = &types.QuickConnectConfig{} + sv = &types.RealTimeContactAnalysisSegmentIssues{} } else { sv = *v } for key, value := range shape { switch key { - case "PhoneConfig": - if err := awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(&sv.PhoneConfig, value); err != nil { - return err - } - - case "QueueConfig": - if err := awsRestjson1_deserializeDocumentQueueQuickConnectConfig(&sv.QueueConfig, value); err != nil { - return err - } - - case "QuickConnectType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) - } - sv.QuickConnectType = types.QuickConnectType(jtv) - } - - case "UserConfig": - if err := awsRestjson1_deserializeDocumentUserQuickConnectConfig(&sv.UserConfig, value); err != nil { + case "IssuesDetected": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisIssuesDetected(&sv.IssuesDetected, value); err != nil { return err } @@ -41477,7 +45105,7 @@ func awsRestjson1_deserializeDocumentQuickConnectConfig(v **types.QuickConnectCo return nil } -func awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(v *[]types.QuickConnect, value interface{}) error { +func awsRestjson1_deserializeDocumentRealtimeContactAnalysisSegments(v *[]types.RealtimeContactAnalysisSegment, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41490,20 +45118,18 @@ func awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(v *[]types.Qu return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.QuickConnect + var cv []types.RealtimeContactAnalysisSegment if *v == nil { - cv = []types.QuickConnect{} + cv = []types.RealtimeContactAnalysisSegment{} } else { cv = *v } for _, value := range shape { - var col types.QuickConnect - destAddr := &col - if err := awsRestjson1_deserializeDocumentQuickConnect(&destAddr, value); err != nil { + var col types.RealtimeContactAnalysisSegment + if err := awsRestjson1_deserializeDocumentRealtimeContactAnalysisSegment(&col, value); err != nil { return err } - col = *destAddr cv = append(cv, col) } @@ -41511,7 +45137,7 @@ func awsRestjson1_deserializeDocumentQuickConnectSearchSummaryList(v *[]types.Qu return nil } -func awsRestjson1_deserializeDocumentQuickConnectSummary(v **types.QuickConnectSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisSegmentTranscript(v **types.RealTimeContactAnalysisSegmentTranscript, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41524,74 +45150,168 @@ func awsRestjson1_deserializeDocumentQuickConnectSummary(v **types.QuickConnectS return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.QuickConnectSummary + var sv *types.RealTimeContactAnalysisSegmentTranscript if *v == nil { - sv = &types.QuickConnectSummary{} + sv = &types.RealTimeContactAnalysisSegmentTranscript{} } else { sv = *v } for key, value := range shape { switch key { - case "Arn": + case "Content": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisTranscriptContent to be of type string, got %T instead", value) } - sv.Arn = ptr.String(jtv) + sv.Content = ptr.String(jtv) } - case "Id": + case "ContentType": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisContentType to be of type string, got %T instead", value) } - sv.Id = ptr.String(jtv) + sv.ContentType = ptr.String(jtv) } - case "LastModifiedRegion": + case "DisplayName": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value) } - sv.LastModifiedRegion = ptr.String(jtv) + sv.DisplayName = ptr.String(jtv) } - case "LastModifiedTime": + case "Id": if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RealTimeContactAnalysisId256 to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } - default: - return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + case "ParticipantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) + } + sv.ParticipantId = ptr.String(jtv) + } + case "ParticipantRole": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ParticipantRole to be of type string, got %T instead", value) } + sv.ParticipantRole = types.ParticipantRole(jtv) } - case "Name": + case "Redaction": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemRedaction(&sv.Redaction, value); err != nil { + return err + } + + case "Sentiment": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisSentimentLabel to be of type string, got %T instead", value) } - sv.Name = ptr.String(jtv) + sv.Sentiment = types.RealTimeContactAnalysisSentimentLabel(jtv) } - case "QuickConnectType": + case "Time": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTimeData(&sv.Time, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTimeData(v *types.RealTimeContactAnalysisTimeData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.RealTimeContactAnalysisTimeData +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "AbsoluteTime": + var mv time.Time if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) + return fmt.Errorf("expected RealTimeContactAnalysisTimeInstant to be of type string, got %T instead", value) } - sv.QuickConnectType = types.QuickConnectType(jtv) + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + mv = t + } + uv = &types.RealTimeContactAnalysisTimeDataMemberAbsoluteTime{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemRedaction(v **types.RealTimeContactAnalysisTranscriptItemRedaction, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RealTimeContactAnalysisTranscriptItemRedaction + if *v == nil { + sv = &types.RealTimeContactAnalysisTranscriptItemRedaction{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CharacterOffsets": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterIntervals(&sv.CharacterOffsets, value); err != nil { + return err } default: @@ -41603,7 +45323,7 @@ func awsRestjson1_deserializeDocumentQuickConnectSummary(v **types.QuickConnectS return nil } -func awsRestjson1_deserializeDocumentQuickConnectSummaryList(v *[]types.QuickConnectSummary, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemsWithCharacterOffsets(v *[]types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41616,17 +45336,17 @@ func awsRestjson1_deserializeDocumentQuickConnectSummaryList(v *[]types.QuickCon return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.QuickConnectSummary + var cv []types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets if *v == nil { - cv = []types.QuickConnectSummary{} + cv = []types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets{} } else { cv = *v } for _, value := range shape { - var col types.QuickConnectSummary + var col types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets destAddr := &col - if err := awsRestjson1_deserializeDocumentQuickConnectSummary(&destAddr, value); err != nil { + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemWithCharacterOffsets(&destAddr, value); err != nil { return err } col = *destAddr @@ -41637,7 +45357,41 @@ func awsRestjson1_deserializeDocumentQuickConnectSummaryList(v *[]types.QuickCon return nil } -func awsRestjson1_deserializeDocumentReadOnlyFieldInfo(v **types.ReadOnlyFieldInfo, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemsWithContent(v *[]types.RealTimeContactAnalysisTranscriptItemWithContent, 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.RealTimeContactAnalysisTranscriptItemWithContent + if *v == nil { + cv = []types.RealTimeContactAnalysisTranscriptItemWithContent{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RealTimeContactAnalysisTranscriptItemWithContent + destAddr := &col + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemWithContent(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemWithCharacterOffsets(v **types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41650,20 +45404,29 @@ func awsRestjson1_deserializeDocumentReadOnlyFieldInfo(v **types.ReadOnlyFieldIn return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.ReadOnlyFieldInfo + var sv *types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets if *v == nil { - sv = &types.ReadOnlyFieldInfo{} + sv = &types.RealTimeContactAnalysisTranscriptItemWithCharacterOffsets{} } else { sv = *v } for key, value := range shape { switch key { - case "Id": - if err := awsRestjson1_deserializeDocumentTaskTemplateFieldIdentifier(&sv.Id, value); err != nil { + case "CharacterOffsets": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterInterval(&sv.CharacterOffsets, value); err != nil { return err } + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RealTimeContactAnalysisId256 to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + default: _, _ = key, value @@ -41673,7 +45436,7 @@ func awsRestjson1_deserializeDocumentReadOnlyFieldInfo(v **types.ReadOnlyFieldIn return nil } -func awsRestjson1_deserializeDocumentReadOnlyTaskTemplateFields(v *[]types.ReadOnlyFieldInfo, value interface{}) error { +func awsRestjson1_deserializeDocumentRealTimeContactAnalysisTranscriptItemWithContent(v **types.RealTimeContactAnalysisTranscriptItemWithContent, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -41681,29 +45444,49 @@ func awsRestjson1_deserializeDocumentReadOnlyTaskTemplateFields(v *[]types.ReadO return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.ReadOnlyFieldInfo + var sv *types.RealTimeContactAnalysisTranscriptItemWithContent if *v == nil { - cv = []types.ReadOnlyFieldInfo{} + sv = &types.RealTimeContactAnalysisTranscriptItemWithContent{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col types.ReadOnlyFieldInfo - destAddr := &col - if err := awsRestjson1_deserializeDocumentReadOnlyFieldInfo(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) + for key, value := range shape { + switch key { + case "CharacterOffsets": + if err := awsRestjson1_deserializeDocumentRealTimeContactAnalysisCharacterInterval(&sv.CharacterOffsets, value); err != nil { + return err + } + + case "Content": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RealTimeContactAnalysisTranscriptContent to be of type string, got %T instead", value) + } + sv.Content = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RealTimeContactAnalysisId256 to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + } } - *v = cv + *v = sv return nil } diff --git a/service/connect/generated.json b/service/connect/generated.json index 283aedf8a4f..3e3d84f7d65 100644 --- a/service/connect/generated.json +++ b/service/connect/generated.json @@ -10,9 +10,11 @@ "api_client.go", "api_client_test.go", "api_op_ActivateEvaluationForm.go", + "api_op_AssociateAnalyticsDataSet.go", "api_op_AssociateApprovedOrigin.go", "api_op_AssociateBot.go", "api_op_AssociateDefaultVocabulary.go", + "api_op_AssociateFlow.go", "api_op_AssociateInstanceStorageConfig.go", "api_op_AssociateLambdaFunction.go", "api_op_AssociateLexBot.go", @@ -21,6 +23,8 @@ "api_op_AssociateRoutingProfileQueues.go", "api_op_AssociateSecurityKey.go", "api_op_AssociateTrafficDistributionGroupUser.go", + "api_op_BatchAssociateAnalyticsDataSet.go", + "api_op_BatchDisassociateAnalyticsDataSet.go", "api_op_BatchGetFlowAssociation.go", "api_op_BatchPutContact.go", "api_op_ClaimPhoneNumber.go", @@ -92,8 +96,10 @@ "api_op_DescribeUserHierarchyStructure.go", "api_op_DescribeView.go", "api_op_DescribeVocabulary.go", + "api_op_DisassociateAnalyticsDataSet.go", "api_op_DisassociateApprovedOrigin.go", "api_op_DisassociateBot.go", + "api_op_DisassociateFlow.go", "api_op_DisassociateInstanceStorageConfig.go", "api_op_DisassociateLambdaFunction.go", "api_op_DisassociateLexBot.go", @@ -107,12 +113,15 @@ "api_op_GetCurrentMetricData.go", "api_op_GetCurrentUserData.go", "api_op_GetFederationToken.go", + "api_op_GetFlowAssociation.go", "api_op_GetMetricData.go", "api_op_GetMetricDataV2.go", "api_op_GetPromptFile.go", "api_op_GetTaskTemplate.go", "api_op_GetTrafficDistribution.go", + "api_op_ImportPhoneNumber.go", "api_op_ListAgentStatuses.go", + "api_op_ListAnalyticsDataAssociations.go", "api_op_ListApprovedOrigins.go", "api_op_ListBots.go", "api_op_ListContactEvaluations.go", @@ -122,6 +131,7 @@ "api_op_ListDefaultVocabularies.go", "api_op_ListEvaluationFormVersions.go", "api_op_ListEvaluationForms.go", + "api_op_ListFlowAssociations.go", "api_op_ListHoursOfOperations.go", "api_op_ListInstanceAttributes.go", "api_op_ListInstanceStorageConfigs.go", @@ -135,6 +145,7 @@ "api_op_ListQueueQuickConnects.go", "api_op_ListQueues.go", "api_op_ListQuickConnects.go", + "api_op_ListRealtimeContactAnalysisSegmentsV2.go", "api_op_ListRoutingProfileQueues.go", "api_op_ListRoutingProfiles.go", "api_op_ListRules.go", @@ -166,12 +177,14 @@ "api_op_SearchSecurityProfiles.go", "api_op_SearchUsers.go", "api_op_SearchVocabularies.go", + "api_op_SendChatIntegrationEvent.go", "api_op_StartChatContact.go", "api_op_StartContactEvaluation.go", "api_op_StartContactRecording.go", "api_op_StartContactStreaming.go", "api_op_StartOutboundVoiceContact.go", "api_op_StartTaskContact.go", + "api_op_StartWebRTCContact.go", "api_op_StopContact.go", "api_op_StopContactRecording.go", "api_op_StopContactStreaming.go", diff --git a/service/connect/serializers.go b/service/connect/serializers.go index 1e8f26d331f..540fb787bdb 100644 --- a/service/connect/serializers.go +++ b/service/connect/serializers.go @@ -113,6 +113,99 @@ func awsRestjson1_serializeOpDocumentActivateEvaluationFormInput(v *ActivateEval return nil } +type awsRestjson1_serializeOpAssociateAnalyticsDataSet struct { +} + +func (*awsRestjson1_serializeOpAssociateAnalyticsDataSet) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAssociateAnalyticsDataSet) 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.(*AssociateAnalyticsDataSetInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/analytics-data/instance/{InstanceId}/association") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsAssociateAnalyticsDataSetInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentAssociateAnalyticsDataSetInput(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_serializeOpHttpBindingsAssociateAnalyticsDataSetInput(v *AssociateAnalyticsDataSetInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentAssociateAnalyticsDataSetInput(v *AssociateAnalyticsDataSetInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSetId != nil { + ok := object.Key("DataSetId") + ok.String(*v.DataSetId) + } + + if v.TargetAccountId != nil { + ok := object.Key("TargetAccountId") + ok.String(*v.TargetAccountId) + } + + return nil +} + type awsRestjson1_serializeOpAssociateApprovedOrigin struct { } @@ -395,6 +488,104 @@ func awsRestjson1_serializeOpDocumentAssociateDefaultVocabularyInput(v *Associat return nil } +type awsRestjson1_serializeOpAssociateFlow struct { +} + +func (*awsRestjson1_serializeOpAssociateFlow) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAssociateFlow) 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.(*AssociateFlowInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/flow-associations/{InstanceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsAssociateFlowInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentAssociateFlowInput(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_serializeOpHttpBindingsAssociateFlowInput(v *AssociateFlowInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentAssociateFlowInput(v *AssociateFlowInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.FlowId != nil { + ok := object.Key("FlowId") + ok.String(*v.FlowId) + } + + if v.ResourceId != nil { + ok := object.Key("ResourceId") + ok.String(*v.ResourceId) + } + + if len(v.ResourceType) > 0 { + ok := object.Key("ResourceType") + ok.String(string(v.ResourceType)) + } + + return nil +} + type awsRestjson1_serializeOpAssociateInstanceStorageConfig struct { } @@ -1140,14 +1331,14 @@ func awsRestjson1_serializeOpDocumentAssociateTrafficDistributionGroupUserInput( return nil } -type awsRestjson1_serializeOpBatchGetFlowAssociation struct { +type awsRestjson1_serializeOpBatchAssociateAnalyticsDataSet struct { } -func (*awsRestjson1_serializeOpBatchGetFlowAssociation) ID() string { +func (*awsRestjson1_serializeOpBatchAssociateAnalyticsDataSet) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpBatchGetFlowAssociation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpBatchAssociateAnalyticsDataSet) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1155,16 +1346,16 @@ func (m *awsRestjson1_serializeOpBatchGetFlowAssociation) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*BatchGetFlowAssociationInput) + input, ok := in.Parameters.(*BatchAssociateAnalyticsDataSetInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/flow-associations-batch/{InstanceId}") + opPath, opQuery := httpbinding.SplitURI("/analytics-data/instance/{InstanceId}/associations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) - request.Method = "POST" + request.Method = "PUT" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) @@ -1177,14 +1368,14 @@ func (m *awsRestjson1_serializeOpBatchGetFlowAssociation) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsBatchGetFlowAssociationInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsBatchAssociateAnalyticsDataSetInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeOpDocumentBatchGetFlowAssociationInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeOpDocumentBatchAssociateAnalyticsDataSetInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1199,7 +1390,7 @@ func (m *awsRestjson1_serializeOpBatchGetFlowAssociation) HandleSerialize(ctx co return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsBatchGetFlowAssociationInput(v *BatchGetFlowAssociationInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsBatchAssociateAnalyticsDataSetInput(v *BatchAssociateAnalyticsDataSetInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1216,33 +1407,33 @@ func awsRestjson1_serializeOpHttpBindingsBatchGetFlowAssociationInput(v *BatchGe return nil } -func awsRestjson1_serializeOpDocumentBatchGetFlowAssociationInput(v *BatchGetFlowAssociationInput, value smithyjson.Value) error { +func awsRestjson1_serializeOpDocumentBatchAssociateAnalyticsDataSetInput(v *BatchAssociateAnalyticsDataSetInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if v.ResourceIds != nil { - ok := object.Key("ResourceIds") - if err := awsRestjson1_serializeDocumentResourceArnListMaxLimit100(v.ResourceIds, ok); err != nil { + if v.DataSetIds != nil { + ok := object.Key("DataSetIds") + if err := awsRestjson1_serializeDocumentDataSetIds(v.DataSetIds, ok); err != nil { return err } } - if len(v.ResourceType) > 0 { - ok := object.Key("ResourceType") - ok.String(string(v.ResourceType)) + if v.TargetAccountId != nil { + ok := object.Key("TargetAccountId") + ok.String(*v.TargetAccountId) } return nil } -type awsRestjson1_serializeOpBatchPutContact struct { +type awsRestjson1_serializeOpBatchDisassociateAnalyticsDataSet struct { } -func (*awsRestjson1_serializeOpBatchPutContact) ID() string { +func (*awsRestjson1_serializeOpBatchDisassociateAnalyticsDataSet) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpBatchPutContact) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpBatchDisassociateAnalyticsDataSet) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1250,16 +1441,16 @@ func (m *awsRestjson1_serializeOpBatchPutContact) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*BatchPutContactInput) + input, ok := in.Parameters.(*BatchDisassociateAnalyticsDataSetInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/contact/batch/{InstanceId}") + opPath, opQuery := httpbinding.SplitURI("/analytics-data/instance/{InstanceId}/associations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) - request.Method = "PUT" + request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) @@ -1272,14 +1463,14 @@ func (m *awsRestjson1_serializeOpBatchPutContact) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsBatchPutContactInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsBatchDisassociateAnalyticsDataSetInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeOpDocumentBatchPutContactInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeOpDocumentBatchDisassociateAnalyticsDataSetInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1294,7 +1485,7 @@ func (m *awsRestjson1_serializeOpBatchPutContact) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsBatchPutContactInput(v *BatchPutContactInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsBatchDisassociateAnalyticsDataSetInput(v *BatchDisassociateAnalyticsDataSetInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1311,33 +1502,33 @@ func awsRestjson1_serializeOpHttpBindingsBatchPutContactInput(v *BatchPutContact return nil } -func awsRestjson1_serializeOpDocumentBatchPutContactInput(v *BatchPutContactInput, value smithyjson.Value) error { +func awsRestjson1_serializeOpDocumentBatchDisassociateAnalyticsDataSetInput(v *BatchDisassociateAnalyticsDataSetInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if v.ClientToken != nil { - ok := object.Key("ClientToken") - ok.String(*v.ClientToken) - } - - if v.ContactDataRequestList != nil { - ok := object.Key("ContactDataRequestList") - if err := awsRestjson1_serializeDocumentContactDataRequestList(v.ContactDataRequestList, ok); err != nil { + if v.DataSetIds != nil { + ok := object.Key("DataSetIds") + if err := awsRestjson1_serializeDocumentDataSetIds(v.DataSetIds, ok); err != nil { return err } } + if v.TargetAccountId != nil { + ok := object.Key("TargetAccountId") + ok.String(*v.TargetAccountId) + } + return nil } -type awsRestjson1_serializeOpClaimPhoneNumber struct { +type awsRestjson1_serializeOpBatchGetFlowAssociation struct { } -func (*awsRestjson1_serializeOpClaimPhoneNumber) ID() string { +func (*awsRestjson1_serializeOpBatchGetFlowAssociation) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpClaimPhoneNumber) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpBatchGetFlowAssociation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1345,13 +1536,13 @@ func (m *awsRestjson1_serializeOpClaimPhoneNumber) HandleSerialize(ctx context.C return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ClaimPhoneNumberInput) + input, ok := in.Parameters.(*BatchGetFlowAssociationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/phone-number/claim") + opPath, opQuery := httpbinding.SplitURI("/flow-associations-batch/{InstanceId}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" @@ -1367,10 +1558,14 @@ func (m *awsRestjson1_serializeOpClaimPhoneNumber) HandleSerialize(ctx context.C return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestjson1_serializeOpHttpBindingsBatchGetFlowAssociationInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeOpDocumentClaimPhoneNumberInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeOpDocumentBatchGetFlowAssociationInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1385,40 +1580,226 @@ func (m *awsRestjson1_serializeOpClaimPhoneNumber) HandleSerialize(ctx context.C return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsClaimPhoneNumberInput(v *ClaimPhoneNumberInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsBatchGetFlowAssociationInput(v *BatchGetFlowAssociationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + return nil } -func awsRestjson1_serializeOpDocumentClaimPhoneNumberInput(v *ClaimPhoneNumberInput, value smithyjson.Value) error { +func awsRestjson1_serializeOpDocumentBatchGetFlowAssociationInput(v *BatchGetFlowAssociationInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if v.ClientToken != nil { - ok := object.Key("ClientToken") - ok.String(*v.ClientToken) + if v.ResourceIds != nil { + ok := object.Key("ResourceIds") + if err := awsRestjson1_serializeDocumentResourceArnListMaxLimit100(v.ResourceIds, ok); err != nil { + return err + } } - if v.InstanceId != nil { - ok := object.Key("InstanceId") - ok.String(*v.InstanceId) + if len(v.ResourceType) > 0 { + ok := object.Key("ResourceType") + ok.String(string(v.ResourceType)) } - if v.PhoneNumber != nil { - ok := object.Key("PhoneNumber") - ok.String(*v.PhoneNumber) - } + return nil +} - if v.PhoneNumberDescription != nil { - ok := object.Key("PhoneNumberDescription") - ok.String(*v.PhoneNumberDescription) - } +type awsRestjson1_serializeOpBatchPutContact struct { +} - if v.Tags != nil { - ok := object.Key("Tags") +func (*awsRestjson1_serializeOpBatchPutContact) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpBatchPutContact) 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.(*BatchPutContactInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/contact/batch/{InstanceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsBatchPutContactInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentBatchPutContactInput(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_serializeOpHttpBindingsBatchPutContactInput(v *BatchPutContactInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentBatchPutContactInput(v *BatchPutContactInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.ContactDataRequestList != nil { + ok := object.Key("ContactDataRequestList") + if err := awsRestjson1_serializeDocumentContactDataRequestList(v.ContactDataRequestList, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpClaimPhoneNumber struct { +} + +func (*awsRestjson1_serializeOpClaimPhoneNumber) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpClaimPhoneNumber) 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.(*ClaimPhoneNumberInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/phone-number/claim") + 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_serializeOpDocumentClaimPhoneNumberInput(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_serializeOpHttpBindingsClaimPhoneNumberInput(v *ClaimPhoneNumberInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentClaimPhoneNumberInput(v *ClaimPhoneNumberInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.InstanceId != nil { + ok := object.Key("InstanceId") + ok.String(*v.InstanceId) + } + + if v.PhoneNumber != nil { + ok := object.Key("PhoneNumber") + ok.String(*v.PhoneNumber) + } + + if v.PhoneNumberDescription != nil { + ok := object.Key("PhoneNumberDescription") + ok.String(*v.PhoneNumberDescription) + } + + if v.Tags != nil { + ok := object.Key("Tags") if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil { return err } @@ -7329,14 +7710,14 @@ func awsRestjson1_serializeOpHttpBindingsDescribeVocabularyInput(v *DescribeVoca return nil } -type awsRestjson1_serializeOpDisassociateApprovedOrigin struct { +type awsRestjson1_serializeOpDisassociateAnalyticsDataSet struct { } -func (*awsRestjson1_serializeOpDisassociateApprovedOrigin) ID() string { +func (*awsRestjson1_serializeOpDisassociateAnalyticsDataSet) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpDisassociateApprovedOrigin) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpDisassociateAnalyticsDataSet) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -7344,16 +7725,16 @@ func (m *awsRestjson1_serializeOpDisassociateApprovedOrigin) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*DisassociateApprovedOriginInput) + input, ok := in.Parameters.(*DisassociateAnalyticsDataSetInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/instance/{InstanceId}/approved-origin") + opPath, opQuery := httpbinding.SplitURI("/analytics-data/instance/{InstanceId}/association") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) - request.Method = "DELETE" + request.Method = "POST" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) @@ -7366,7 +7747,18 @@ func (m *awsRestjson1_serializeOpDisassociateApprovedOrigin) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsDisassociateApprovedOriginInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsDisassociateAnalyticsDataSetInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDisassociateAnalyticsDataSetInput(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} } @@ -7377,7 +7769,7 @@ func (m *awsRestjson1_serializeOpDisassociateApprovedOrigin) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsDisassociateApprovedOriginInput(v *DisassociateApprovedOriginInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsDisassociateAnalyticsDataSetInput(v *DisassociateAnalyticsDataSetInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -7391,21 +7783,34 @@ func awsRestjson1_serializeOpHttpBindingsDisassociateApprovedOriginInput(v *Disa } } - if v.Origin != nil { - encoder.SetQuery("origin").String(*v.Origin) + return nil +} + +func awsRestjson1_serializeOpDocumentDisassociateAnalyticsDataSetInput(v *DisassociateAnalyticsDataSetInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSetId != nil { + ok := object.Key("DataSetId") + ok.String(*v.DataSetId) + } + + if v.TargetAccountId != nil { + ok := object.Key("TargetAccountId") + ok.String(*v.TargetAccountId) } return nil } -type awsRestjson1_serializeOpDisassociateBot struct { +type awsRestjson1_serializeOpDisassociateApprovedOrigin struct { } -func (*awsRestjson1_serializeOpDisassociateBot) ID() string { +func (*awsRestjson1_serializeOpDisassociateApprovedOrigin) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpDisassociateBot) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpDisassociateApprovedOrigin) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -7413,16 +7818,16 @@ func (m *awsRestjson1_serializeOpDisassociateBot) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*DisassociateBotInput) + input, ok := in.Parameters.(*DisassociateApprovedOriginInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/instance/{InstanceId}/bot") + opPath, opQuery := httpbinding.SplitURI("/instance/{InstanceId}/approved-origin") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) - request.Method = "POST" + request.Method = "DELETE" var restEncoder *httpbinding.Encoder if request.URL.RawPath == "" { restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) @@ -7435,18 +7840,7 @@ func (m *awsRestjson1_serializeOpDisassociateBot) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsDisassociateBotInput(input, restEncoder); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - restEncoder.SetHeader("Content-Type").String("application/json") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeOpDocumentDisassociateBotInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsDisassociateApprovedOriginInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -7457,7 +7851,7 @@ func (m *awsRestjson1_serializeOpDisassociateBot) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsDisassociateBotInput(v *DisassociateBotInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsDisassociateApprovedOriginInput(v *DisassociateApprovedOriginInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -7471,21 +7865,101 @@ func awsRestjson1_serializeOpHttpBindingsDisassociateBotInput(v *DisassociateBot } } + if v.Origin != nil { + encoder.SetQuery("origin").String(*v.Origin) + } + return nil } -func awsRestjson1_serializeOpDocumentDisassociateBotInput(v *DisassociateBotInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() +type awsRestjson1_serializeOpDisassociateBot struct { +} - if v.LexBot != nil { - ok := object.Key("LexBot") - if err := awsRestjson1_serializeDocumentLexBot(v.LexBot, ok); err != nil { - return err - } - } +func (*awsRestjson1_serializeOpDisassociateBot) ID() string { + return "OperationSerializer" +} - if v.LexV2Bot != nil { +func (m *awsRestjson1_serializeOpDisassociateBot) 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.(*DisassociateBotInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/instance/{InstanceId}/bot") + 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_serializeOpHttpBindingsDisassociateBotInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDisassociateBotInput(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_serializeOpHttpBindingsDisassociateBotInput(v *DisassociateBotInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDisassociateBotInput(v *DisassociateBotInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.LexBot != nil { + ok := object.Key("LexBot") + if err := awsRestjson1_serializeDocumentLexBot(v.LexBot, ok); err != nil { + return err + } + } + + if v.LexV2Bot != nil { ok := object.Key("LexV2Bot") if err := awsRestjson1_serializeDocumentLexV2Bot(v.LexV2Bot, ok); err != nil { return err @@ -7495,6 +7969,89 @@ func awsRestjson1_serializeOpDocumentDisassociateBotInput(v *DisassociateBotInpu return nil } +type awsRestjson1_serializeOpDisassociateFlow struct { +} + +func (*awsRestjson1_serializeOpDisassociateFlow) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisassociateFlow) 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.(*DisassociateFlowInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/flow-associations/{InstanceId}/{ResourceId}/{ResourceType}") + 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_serializeOpHttpBindingsDisassociateFlowInput(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_serializeOpHttpBindingsDisassociateFlowInput(v *DisassociateFlowInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + if v.ResourceId == nil || len(*v.ResourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceId must not be empty")} + } + if v.ResourceId != nil { + if err := encoder.SetURI("ResourceId").String(*v.ResourceId); err != nil { + return err + } + } + + if len(v.ResourceType) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceType must not be empty")} + } + if len(v.ResourceType) > 0 { + if err := encoder.SetURI("ResourceType").String(string(v.ResourceType)); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpDisassociateInstanceStorageConfig struct { } @@ -8586,6 +9143,89 @@ func awsRestjson1_serializeOpHttpBindingsGetFederationTokenInput(v *GetFederatio return nil } +type awsRestjson1_serializeOpGetFlowAssociation struct { +} + +func (*awsRestjson1_serializeOpGetFlowAssociation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetFlowAssociation) 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.(*GetFlowAssociationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/flow-associations/{InstanceId}/{ResourceId}/{ResourceType}") + 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_serializeOpHttpBindingsGetFlowAssociationInput(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_serializeOpHttpBindingsGetFlowAssociationInput(v *GetFlowAssociationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + if v.ResourceId == nil || len(*v.ResourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceId must not be empty")} + } + if v.ResourceId != nil { + if err := encoder.SetURI("ResourceId").String(*v.ResourceId); err != nil { + return err + } + } + + if len(v.ResourceType) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceType must not be empty")} + } + if len(v.ResourceType) > 0 { + if err := encoder.SetURI("ResourceType").String(string(v.ResourceType)); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpGetMetricData struct { } @@ -9050,6 +9690,103 @@ func awsRestjson1_serializeOpHttpBindingsGetTrafficDistributionInput(v *GetTraff return nil } +type awsRestjson1_serializeOpImportPhoneNumber struct { +} + +func (*awsRestjson1_serializeOpImportPhoneNumber) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpImportPhoneNumber) 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.(*ImportPhoneNumberInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/phone-number/import") + 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_serializeOpDocumentImportPhoneNumberInput(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_serializeOpHttpBindingsImportPhoneNumberInput(v *ImportPhoneNumberInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentImportPhoneNumberInput(v *ImportPhoneNumberInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.InstanceId != nil { + ok := object.Key("InstanceId") + ok.String(*v.InstanceId) + } + + if v.PhoneNumberDescription != nil { + ok := object.Key("PhoneNumberDescription") + ok.String(*v.PhoneNumberDescription) + } + + if v.SourcePhoneNumberArn != nil { + ok := object.Key("SourcePhoneNumberArn") + ok.String(*v.SourcePhoneNumberArn) + } + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpListAgentStatuses struct { } @@ -9129,6 +9866,83 @@ func awsRestjson1_serializeOpHttpBindingsListAgentStatusesInput(v *ListAgentStat return nil } +type awsRestjson1_serializeOpListAnalyticsDataAssociations struct { +} + +func (*awsRestjson1_serializeOpListAnalyticsDataAssociations) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAnalyticsDataAssociations) 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.(*ListAnalyticsDataAssociationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/analytics-data/instance/{InstanceId}/association") + 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_serializeOpHttpBindingsListAnalyticsDataAssociationsInput(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_serializeOpHttpBindingsListAnalyticsDataAssociationsInput(v *ListAnalyticsDataAssociationsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DataSetId != nil { + encoder.SetQuery("DataSetId").String(*v.DataSetId) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); 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_serializeOpListApprovedOrigins struct { } @@ -9678,26 +10492,99 @@ func awsRestjson1_serializeOpDocumentListDefaultVocabulariesInput(v *ListDefault } if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListEvaluationForms struct { +} + +func (*awsRestjson1_serializeOpListEvaluationForms) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListEvaluationForms) 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.(*ListEvaluationFormsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/evaluation-forms/{InstanceId}") + 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_serializeOpHttpBindingsListEvaluationFormsInput(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_serializeOpHttpBindingsListEvaluationFormsInput(v *ListEvaluationFormsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) } if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) + encoder.SetQuery("nextToken").String(*v.NextToken) } return nil } -type awsRestjson1_serializeOpListEvaluationForms struct { +type awsRestjson1_serializeOpListEvaluationFormVersions struct { } -func (*awsRestjson1_serializeOpListEvaluationForms) ID() string { +func (*awsRestjson1_serializeOpListEvaluationFormVersions) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpListEvaluationForms) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpListEvaluationFormVersions) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -9705,13 +10592,13 @@ func (m *awsRestjson1_serializeOpListEvaluationForms) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ListEvaluationFormsInput) + input, ok := in.Parameters.(*ListEvaluationFormVersionsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/evaluation-forms/{InstanceId}") + opPath, opQuery := httpbinding.SplitURI("/evaluation-forms/{InstanceId}/{EvaluationFormId}/versions") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" @@ -9727,7 +10614,7 @@ func (m *awsRestjson1_serializeOpListEvaluationForms) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsListEvaluationFormsInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsListEvaluationFormVersionsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -9738,11 +10625,20 @@ func (m *awsRestjson1_serializeOpListEvaluationForms) HandleSerialize(ctx contex return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsListEvaluationFormsInput(v *ListEvaluationFormsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsListEvaluationFormVersionsInput(v *ListEvaluationFormVersionsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.EvaluationFormId == nil || len(*v.EvaluationFormId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member EvaluationFormId must not be empty")} + } + if v.EvaluationFormId != nil { + if err := encoder.SetURI("EvaluationFormId").String(*v.EvaluationFormId); err != nil { + return err + } + } + if v.InstanceId == nil || len(*v.InstanceId) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} } @@ -9763,14 +10659,14 @@ func awsRestjson1_serializeOpHttpBindingsListEvaluationFormsInput(v *ListEvaluat return nil } -type awsRestjson1_serializeOpListEvaluationFormVersions struct { +type awsRestjson1_serializeOpListFlowAssociations struct { } -func (*awsRestjson1_serializeOpListEvaluationFormVersions) ID() string { +func (*awsRestjson1_serializeOpListFlowAssociations) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpListEvaluationFormVersions) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpListFlowAssociations) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -9778,13 +10674,13 @@ func (m *awsRestjson1_serializeOpListEvaluationFormVersions) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ListEvaluationFormVersionsInput) + input, ok := in.Parameters.(*ListFlowAssociationsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/evaluation-forms/{InstanceId}/{EvaluationFormId}/versions") + opPath, opQuery := httpbinding.SplitURI("/flow-associations-summary/{InstanceId}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" @@ -9800,7 +10696,7 @@ func (m *awsRestjson1_serializeOpListEvaluationFormVersions) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsListEvaluationFormVersionsInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeOpHttpBindingsListFlowAssociationsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -9811,20 +10707,11 @@ func (m *awsRestjson1_serializeOpListEvaluationFormVersions) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsListEvaluationFormVersionsInput(v *ListEvaluationFormVersionsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsListFlowAssociationsInput(v *ListFlowAssociationsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.EvaluationFormId == nil || len(*v.EvaluationFormId) == 0 { - return &smithy.SerializationError{Err: fmt.Errorf("input member EvaluationFormId must not be empty")} - } - if v.EvaluationFormId != nil { - if err := encoder.SetURI("EvaluationFormId").String(*v.EvaluationFormId); err != nil { - return err - } - } - if v.InstanceId == nil || len(*v.InstanceId) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} } @@ -9842,6 +10729,10 @@ func awsRestjson1_serializeOpHttpBindingsListEvaluationFormVersionsInput(v *List encoder.SetQuery("nextToken").String(*v.NextToken) } + if len(v.ResourceType) > 0 { + encoder.SetQuery("ResourceType").String(string(v.ResourceType)) + } + return nil } @@ -10866,6 +11757,120 @@ func awsRestjson1_serializeOpHttpBindingsListQuickConnectsInput(v *ListQuickConn return nil } +type awsRestjson1_serializeOpListRealtimeContactAnalysisSegmentsV2 struct { +} + +func (*awsRestjson1_serializeOpListRealtimeContactAnalysisSegmentsV2) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListRealtimeContactAnalysisSegmentsV2) 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.(*ListRealtimeContactAnalysisSegmentsV2Input) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/contact/list-real-time-analysis-segments-v2/{InstanceId}/{ContactId}") + 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_serializeOpHttpBindingsListRealtimeContactAnalysisSegmentsV2Input(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListRealtimeContactAnalysisSegmentsV2Input(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_serializeOpHttpBindingsListRealtimeContactAnalysisSegmentsV2Input(v *ListRealtimeContactAnalysisSegmentsV2Input, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ContactId == nil || len(*v.ContactId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ContactId must not be empty")} + } + if v.ContactId != nil { + if err := encoder.SetURI("ContactId").String(*v.ContactId); err != nil { + return err + } + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListRealtimeContactAnalysisSegmentsV2Input(v *ListRealtimeContactAnalysisSegmentsV2Input, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if len(v.OutputType) > 0 { + ok := object.Key("OutputType") + ok.String(string(v.OutputType)) + } + + if v.SegmentTypes != nil { + ok := object.Key("SegmentTypes") + if err := awsRestjson1_serializeDocumentRealTimeContactAnalysisSegmentTypes(v.SegmentTypes, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpListRoutingProfileQueues struct { } @@ -13419,24 +14424,132 @@ func awsRestjson1_serializeOpDocumentSearchUsersInput(v *SearchUsersInput, value } } - if v.SearchFilter != nil { - ok := object.Key("SearchFilter") - if err := awsRestjson1_serializeDocumentUserSearchFilter(v.SearchFilter, ok); err != nil { - return err - } + if v.SearchFilter != nil { + ok := object.Key("SearchFilter") + if err := awsRestjson1_serializeDocumentUserSearchFilter(v.SearchFilter, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpSearchVocabularies struct { +} + +func (*awsRestjson1_serializeOpSearchVocabularies) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSearchVocabularies) 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.(*SearchVocabulariesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/vocabulary-summary/{InstanceId}") + 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_serializeOpHttpBindingsSearchVocabulariesInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSearchVocabulariesInput(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_serializeOpHttpBindingsSearchVocabulariesInput(v *SearchVocabulariesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentSearchVocabulariesInput(v *SearchVocabulariesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.LanguageCode) > 0 { + ok := object.Key("LanguageCode") + ok.String(string(v.LanguageCode)) + } + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NameStartsWith != nil { + ok := object.Key("NameStartsWith") + ok.String(*v.NameStartsWith) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if len(v.State) > 0 { + ok := object.Key("State") + ok.String(string(v.State)) } return nil } -type awsRestjson1_serializeOpSearchVocabularies struct { +type awsRestjson1_serializeOpSendChatIntegrationEvent struct { } -func (*awsRestjson1_serializeOpSearchVocabularies) ID() string { +func (*awsRestjson1_serializeOpSendChatIntegrationEvent) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpSearchVocabularies) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpSendChatIntegrationEvent) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -13444,13 +14557,13 @@ func (m *awsRestjson1_serializeOpSearchVocabularies) HandleSerialize(ctx context return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*SearchVocabulariesInput) + input, ok := in.Parameters.(*SendChatIntegrationEventInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/vocabulary-summary/{InstanceId}") + opPath, opQuery := httpbinding.SplitURI("/chat-integration-event") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "POST" @@ -13466,14 +14579,10 @@ func (m *awsRestjson1_serializeOpSearchVocabularies) HandleSerialize(ctx context return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeOpHttpBindingsSearchVocabulariesInput(input, restEncoder); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeOpDocumentSearchVocabulariesInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeOpDocumentSendChatIntegrationEventInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -13488,50 +14597,45 @@ func (m *awsRestjson1_serializeOpSearchVocabularies) HandleSerialize(ctx context return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeOpHttpBindingsSearchVocabulariesInput(v *SearchVocabulariesInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeOpHttpBindingsSendChatIntegrationEventInput(v *SendChatIntegrationEventInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.InstanceId == nil || len(*v.InstanceId) == 0 { - return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} - } - if v.InstanceId != nil { - if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { - return err - } - } - return nil } -func awsRestjson1_serializeOpDocumentSearchVocabulariesInput(v *SearchVocabulariesInput, value smithyjson.Value) error { +func awsRestjson1_serializeOpDocumentSendChatIntegrationEventInput(v *SendChatIntegrationEventInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if len(v.LanguageCode) > 0 { - ok := object.Key("LanguageCode") - ok.String(string(v.LanguageCode)) + if v.DestinationId != nil { + ok := object.Key("DestinationId") + ok.String(*v.DestinationId) } - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) + if v.Event != nil { + ok := object.Key("Event") + if err := awsRestjson1_serializeDocumentChatEvent(v.Event, ok); err != nil { + return err + } } - if v.NameStartsWith != nil { - ok := object.Key("NameStartsWith") - ok.String(*v.NameStartsWith) + if v.NewSessionDetails != nil { + ok := object.Key("NewSessionDetails") + if err := awsRestjson1_serializeDocumentNewSessionDetails(v.NewSessionDetails, ok); err != nil { + return err + } } - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) + if v.SourceId != nil { + ok := object.Key("SourceId") + ok.String(*v.SourceId) } - if len(v.State) > 0 { - ok := object.Key("State") - ok.String(string(v.State)) + if v.Subtype != nil { + ok := object.Key("Subtype") + ok.String(*v.Subtype) } return nil @@ -14214,6 +15318,129 @@ func awsRestjson1_serializeOpDocumentStartTaskContactInput(v *StartTaskContactIn return nil } +type awsRestjson1_serializeOpStartWebRTCContact struct { +} + +func (*awsRestjson1_serializeOpStartWebRTCContact) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartWebRTCContact) 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.(*StartWebRTCContactInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/contact/webrtc") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpDocumentStartWebRTCContactInput(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_serializeOpHttpBindingsStartWebRTCContactInput(v *StartWebRTCContactInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartWebRTCContactInput(v *StartWebRTCContactInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AllowedCapabilities != nil { + ok := object.Key("AllowedCapabilities") + if err := awsRestjson1_serializeDocumentAllowedCapabilities(v.AllowedCapabilities, ok); err != nil { + return err + } + } + + if v.Attributes != nil { + ok := object.Key("Attributes") + if err := awsRestjson1_serializeDocumentAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.ContactFlowId != nil { + ok := object.Key("ContactFlowId") + ok.String(*v.ContactFlowId) + } + + if v.Description != nil { + ok := object.Key("Description") + ok.String(*v.Description) + } + + if v.InstanceId != nil { + ok := object.Key("InstanceId") + ok.String(*v.InstanceId) + } + + if v.ParticipantDetails != nil { + ok := object.Key("ParticipantDetails") + if err := awsRestjson1_serializeDocumentParticipantDetails(v.ParticipantDetails, ok); err != nil { + return err + } + } + + if v.References != nil { + ok := object.Key("References") + if err := awsRestjson1_serializeDocumentContactReferences(v.References, ok); err != nil { + return err + } + } + + if v.RelatedContactId != nil { + ok := object.Key("RelatedContactId") + ok.String(*v.RelatedContactId) + } + + return nil +} + type awsRestjson1_serializeOpStopContact struct { } @@ -19362,6 +20589,27 @@ func awsRestjson1_serializeDocumentAllowedAccessControlTags(v map[string]string, return nil } +func awsRestjson1_serializeDocumentAllowedCapabilities(v *types.AllowedCapabilities, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Agent != nil { + ok := object.Key("Agent") + if err := awsRestjson1_serializeDocumentParticipantCapabilities(v.Agent, ok); err != nil { + return err + } + } + + if v.Customer != nil { + ok := object.Key("Customer") + if err := awsRestjson1_serializeDocumentParticipantCapabilities(v.Customer, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentAllowedMonitorCapabilities(v []types.MonitorCapability, value smithyjson.Value) error { array := value.Array() defer array.Close() @@ -19474,6 +20722,28 @@ func awsRestjson1_serializeDocumentChannels(v []types.Channel, value smithyjson. return nil } +func awsRestjson1_serializeDocumentChatEvent(v *types.ChatEvent, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Content != nil { + ok := object.Key("Content") + ok.String(*v.Content) + } + + if v.ContentType != nil { + ok := object.Key("ContentType") + ok.String(*v.ContentType) + } + + if len(v.Type) > 0 { + ok := object.Key("Type") + ok.String(string(v.Type)) + } + + return nil +} + func awsRestjson1_serializeDocumentChatMessage(v *types.ChatMessage, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -19714,6 +20984,17 @@ func awsRestjson1_serializeDocumentCurrentMetricSortCriteriaMaxOne(v []types.Cur return nil } +func awsRestjson1_serializeDocumentDataSetIds(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_serializeDocumentDisconnectReason(v *types.DisconnectReason, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -20893,6 +22174,41 @@ func awsRestjson1_serializeDocumentMetricV2(v *types.MetricV2, value smithyjson. return nil } +func awsRestjson1_serializeDocumentNewSessionDetails(v *types.NewSessionDetails, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Attributes != nil { + ok := object.Key("Attributes") + if err := awsRestjson1_serializeDocumentAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.ParticipantDetails != nil { + ok := object.Key("ParticipantDetails") + if err := awsRestjson1_serializeDocumentParticipantDetails(v.ParticipantDetails, ok); err != nil { + return err + } + } + + if v.StreamingConfiguration != nil { + ok := object.Key("StreamingConfiguration") + if err := awsRestjson1_serializeDocumentChatStreamingConfiguration(v.StreamingConfiguration, ok); err != nil { + return err + } + } + + if v.SupportedMessagingContentTypes != nil { + ok := object.Key("SupportedMessagingContentTypes") + if err := awsRestjson1_serializeDocumentSupportedMessagingContentTypes(v.SupportedMessagingContentTypes, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentNotificationRecipientType(v *types.NotificationRecipientType, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -20948,6 +22264,18 @@ func awsRestjson1_serializeDocumentOutboundCallerConfig(v *types.OutboundCallerC return nil } +func awsRestjson1_serializeDocumentParticipantCapabilities(v *types.ParticipantCapabilities, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Video) > 0 { + ok := object.Key("Video") + ok.String(string(v.Video)) + } + + return nil +} + func awsRestjson1_serializeDocumentParticipantDetails(v *types.ParticipantDetails, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -21365,6 +22693,17 @@ func awsRestjson1_serializeDocumentReadOnlyTaskTemplateFields(v []types.ReadOnly return nil } +func awsRestjson1_serializeDocumentRealTimeContactAnalysisSegmentTypes(v []types.RealTimeContactAnalysisSegmentType, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(string(v[i])) + } + return nil +} + func awsRestjson1_serializeDocumentReference(v *types.Reference, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/connect/types/enums.go b/service/connect/types/enums.go index 8cd05a7896d..ede5326aaaa 100644 --- a/service/connect/types/enums.go +++ b/service/connect/types/enums.go @@ -80,6 +80,26 @@ func (AgentStatusType) Values() []AgentStatusType { } } +type ArtifactStatus string + +// Enum values for ArtifactStatus +const ( + ArtifactStatusApproved ArtifactStatus = "APPROVED" + ArtifactStatusRejected ArtifactStatus = "REJECTED" + ArtifactStatusInProgress ArtifactStatus = "IN_PROGRESS" +) + +// Values returns all known values for ArtifactStatus. 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 (ArtifactStatus) Values() []ArtifactStatus { + return []ArtifactStatus{ + "APPROVED", + "REJECTED", + "IN_PROGRESS", + } +} + type BehaviorType string // Enum values for BehaviorType @@ -118,6 +138,26 @@ func (Channel) Values() []Channel { } } +type ChatEventType string + +// Enum values for ChatEventType +const ( + ChatEventTypeDisconnect ChatEventType = "DISCONNECT" + ChatEventTypeMessage ChatEventType = "MESSAGE" + ChatEventTypeEvent ChatEventType = "EVENT" +) + +// Values returns all known values for ChatEventType. 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 (ChatEventType) Values() []ChatEventType { + return []ChatEventType{ + "DISCONNECT", + "MESSAGE", + "EVENT", + } +} + type Comparison string // Enum values for Comparison @@ -497,6 +537,7 @@ type EventSourceName string const ( EventSourceNameOnPostCallAnalysisAvailable EventSourceName = "OnPostCallAnalysisAvailable" EventSourceNameOnRealTimeCallAnalysisAvailable EventSourceName = "OnRealTimeCallAnalysisAvailable" + EventSourceNameOnRealTimeChatAnalysisAvailable EventSourceName = "OnRealTimeChatAnalysisAvailable" EventSourceNameOnPostChatAnalysisAvailable EventSourceName = "OnPostChatAnalysisAvailable" EventSourceNameOnZendeskTicketCreate EventSourceName = "OnZendeskTicketCreate" EventSourceNameOnZendeskTicketStatusUpdate EventSourceName = "OnZendeskTicketStatusUpdate" @@ -512,6 +553,7 @@ func (EventSourceName) Values() []EventSourceName { return []EventSourceName{ "OnPostCallAnalysisAvailable", "OnRealTimeCallAnalysisAvailable", + "OnRealTimeChatAnalysisAvailable", "OnPostChatAnalysisAvailable", "OnZendeskTicketCreate", "OnZendeskTicketStatusUpdate", @@ -555,6 +597,22 @@ func (FailureReasonCode) Values() []FailureReasonCode { } } +type FlowAssociationResourceType string + +// Enum values for FlowAssociationResourceType +const ( + FlowAssociationResourceTypeSmsPhoneNumber FlowAssociationResourceType = "SMS_PHONE_NUMBER" +) + +// Values returns all known values for FlowAssociationResourceType. 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 (FlowAssociationResourceType) Values() []FlowAssociationResourceType { + return []FlowAssociationResourceType{ + "SMS_PHONE_NUMBER", + } +} + type Grouping string // Enum values for Grouping @@ -866,6 +924,24 @@ func (ListFlowAssociationResourceType) Values() []ListFlowAssociationResourceTyp } } +type MeetingFeatureStatus string + +// Enum values for MeetingFeatureStatus +const ( + MeetingFeatureStatusAvailable MeetingFeatureStatus = "AVAILABLE" + MeetingFeatureStatusUnavailable MeetingFeatureStatus = "UNAVAILABLE" +) + +// Values returns all known values for MeetingFeatureStatus. 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 (MeetingFeatureStatus) Values() []MeetingFeatureStatus { + return []MeetingFeatureStatus{ + "AVAILABLE", + "UNAVAILABLE", + } +} + type MonitorCapability string // Enum values for MonitorCapability @@ -1501,6 +1577,7 @@ const ( PhoneNumberTypeShared PhoneNumberType = "SHARED" PhoneNumberTypeThirdPartyTf PhoneNumberType = "THIRD_PARTY_TF" PhoneNumberTypeThirdPartyDid PhoneNumberType = "THIRD_PARTY_DID" + PhoneNumberTypeShortCode PhoneNumberType = "SHORT_CODE" ) // Values returns all known values for PhoneNumberType. Note that this can be @@ -1514,6 +1591,7 @@ func (PhoneNumberType) Values() []PhoneNumberType { "SHARED", "THIRD_PARTY_TF", "THIRD_PARTY_DID", + "SHORT_CODE", } } @@ -1638,6 +1716,111 @@ func (QuickConnectType) Values() []QuickConnectType { } } +type RealTimeContactAnalysisOutputType string + +// Enum values for RealTimeContactAnalysisOutputType +const ( + RealTimeContactAnalysisOutputTypeRaw RealTimeContactAnalysisOutputType = "Raw" + RealTimeContactAnalysisOutputTypeRedacted RealTimeContactAnalysisOutputType = "Redacted" +) + +// Values returns all known values for RealTimeContactAnalysisOutputType. 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 (RealTimeContactAnalysisOutputType) Values() []RealTimeContactAnalysisOutputType { + return []RealTimeContactAnalysisOutputType{ + "Raw", + "Redacted", + } +} + +type RealTimeContactAnalysisSegmentType string + +// Enum values for RealTimeContactAnalysisSegmentType +const ( + RealTimeContactAnalysisSegmentTypeTranscript RealTimeContactAnalysisSegmentType = "Transcript" + RealTimeContactAnalysisSegmentTypeCategories RealTimeContactAnalysisSegmentType = "Categories" + RealTimeContactAnalysisSegmentTypeIssues RealTimeContactAnalysisSegmentType = "Issues" + RealTimeContactAnalysisSegmentTypeEvent RealTimeContactAnalysisSegmentType = "Event" + RealTimeContactAnalysisSegmentTypeAttachments RealTimeContactAnalysisSegmentType = "Attachments" +) + +// Values returns all known values for RealTimeContactAnalysisSegmentType. 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 (RealTimeContactAnalysisSegmentType) Values() []RealTimeContactAnalysisSegmentType { + return []RealTimeContactAnalysisSegmentType{ + "Transcript", + "Categories", + "Issues", + "Event", + "Attachments", + } +} + +type RealTimeContactAnalysisSentimentLabel string + +// Enum values for RealTimeContactAnalysisSentimentLabel +const ( + RealTimeContactAnalysisSentimentLabelPositive RealTimeContactAnalysisSentimentLabel = "POSITIVE" + RealTimeContactAnalysisSentimentLabelNegative RealTimeContactAnalysisSentimentLabel = "NEGATIVE" + RealTimeContactAnalysisSentimentLabelNeutral RealTimeContactAnalysisSentimentLabel = "NEUTRAL" +) + +// Values returns all known values for RealTimeContactAnalysisSentimentLabel. 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 (RealTimeContactAnalysisSentimentLabel) Values() []RealTimeContactAnalysisSentimentLabel { + return []RealTimeContactAnalysisSentimentLabel{ + "POSITIVE", + "NEGATIVE", + "NEUTRAL", + } +} + +type RealTimeContactAnalysisStatus string + +// Enum values for RealTimeContactAnalysisStatus +const ( + RealTimeContactAnalysisStatusInProgress RealTimeContactAnalysisStatus = "IN_PROGRESS" + RealTimeContactAnalysisStatusFailed RealTimeContactAnalysisStatus = "FAILED" + RealTimeContactAnalysisStatusCompleted RealTimeContactAnalysisStatus = "COMPLETED" +) + +// Values returns all known values for RealTimeContactAnalysisStatus. 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 (RealTimeContactAnalysisStatus) Values() []RealTimeContactAnalysisStatus { + return []RealTimeContactAnalysisStatus{ + "IN_PROGRESS", + "FAILED", + "COMPLETED", + } +} + +type RealTimeContactAnalysisSupportedChannel string + +// Enum values for RealTimeContactAnalysisSupportedChannel +const ( + RealTimeContactAnalysisSupportedChannelVoice RealTimeContactAnalysisSupportedChannel = "VOICE" + RealTimeContactAnalysisSupportedChannelChat RealTimeContactAnalysisSupportedChannel = "CHAT" +) + +// Values returns all known values for RealTimeContactAnalysisSupportedChannel. +// 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 (RealTimeContactAnalysisSupportedChannel) Values() []RealTimeContactAnalysisSupportedChannel { + return []RealTimeContactAnalysisSupportedChannel{ + "VOICE", + "CHAT", + } +} + type ReferenceStatus string // Enum values for ReferenceStatus @@ -1711,6 +1894,7 @@ const ( ResourceTypeHierarchyLevel ResourceType = "HIERARCHY_LEVEL" ResourceTypeHierarchyGroup ResourceType = "HIERARCHY_GROUP" ResourceTypeUser ResourceType = "USER" + ResourceTypePhoneNumber ResourceType = "PHONE_NUMBER" ) // Values returns all known values for ResourceType. Note that this can be @@ -1725,6 +1909,7 @@ func (ResourceType) Values() []ResourceType { "HIERARCHY_LEVEL", "HIERARCHY_GROUP", "USER", + "PHONE_NUMBER", } } @@ -2037,6 +2222,22 @@ func (UseCaseType) Values() []UseCaseType { } } +type VideoCapability string + +// Enum values for VideoCapability +const ( + VideoCapabilitySend VideoCapability = "SEND" +) + +// Values returns all known values for VideoCapability. 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 (VideoCapability) Values() []VideoCapability { + return []VideoCapability{ + "SEND", + } +} + type ViewStatus string // Enum values for ViewStatus diff --git a/service/connect/types/errors.go b/service/connect/types/errors.go index 2077163be3c..3bd9d7832bb 100644 --- a/service/connect/types/errors.go +++ b/service/connect/types/errors.go @@ -379,6 +379,34 @@ func (e *OutboundContactNotPermittedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } +// Thrown for analyzed content when requested OutputType was not enabled for a +// given contact. For example, if an OutputType.Raw was requested for a contact +// that had `RedactedOnly` Redaction policy set in Contact flow. +type OutputTypeNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *OutputTypeNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *OutputTypeNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *OutputTypeNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "OutputTypeNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *OutputTypeNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + // The property is not valid. type PropertyValidationException struct { Message *string diff --git a/service/connect/types/types.go b/service/connect/types/types.go index 9a278926069..b856fb92166 100644 --- a/service/connect/types/types.go +++ b/service/connect/types/types.go @@ -146,6 +146,38 @@ type AgentStatusSummary struct { noSmithyDocumentSerde } +// Information about the capabilities enabled for participants of the contact. +type AllowedCapabilities struct { + + // Information about the agent's video sharing capabilities. + Agent *ParticipantCapabilities + + // Information about the customer's video sharing capabilities. + Customer *ParticipantCapabilities + + noSmithyDocumentSerde +} + +// This API is in preview release for Amazon Connect and is subject to change. +// Information about associations that are successfully created: DataSetId , +// TargetAccountId , ResourceShareId , ResourceShareArn . +type AnalyticsDataAssociationResult struct { + + // The identifier of the dataset. + DataSetId *string + + // The Amazon Resource Name (ARN) of the Resource Access Manager share. + ResourceShareArn *string + + // The Resource Access Manager share ID. + ResourceShareId *string + + // The identifier of the target account. + TargetAccountId *string + + noSmithyDocumentSerde +} + // Configuration of the answering machine detection. type AnswerMachineDetectionConfig struct { @@ -175,8 +207,8 @@ type Application struct { // This action must be set if TriggerEventSource is one of the following values: // OnPostCallAnalysisAvailable | OnRealTimeCallAnalysisAvailable | -// OnPostChatAnalysisAvailable . Contact is categorized using the rule name. -// RuleName is used as ContactCategory . +// OnRealTimeChatAnalysisAvailable | OnPostChatAnalysisAvailable . Contact is +// categorized using the rule name. RuleName is used as ContactCategory . type AssignContactCategoryActionDefinition struct { noSmithyDocumentSerde } @@ -197,6 +229,18 @@ type AttachmentReference struct { noSmithyDocumentSerde } +// The attendee information, including attendee ID and join token. +type Attendee struct { + + // The Amazon Chime SDK attendee ID. + AttendeeId *string + + // The join token used by the Amazon Chime SDK attendee. + JoinToken *string + + noSmithyDocumentSerde +} + // A toggle for an individual feature at the instance level. type Attribute struct { @@ -209,6 +253,15 @@ type Attribute struct { noSmithyDocumentSerde } +// Has audio-specific configurations as the operating parameter for Echo Reduction. +type AudioFeatures struct { + + // Makes echo reduction available to clients who connect to the meeting. + EchoReduction MeetingFeatureStatus + + noSmithyDocumentSerde +} + // Information about available phone numbers. type AvailableNumberSummary struct { @@ -234,6 +287,38 @@ type Campaign struct { noSmithyDocumentSerde } +// Chat integration event containing payload to perform different chat actions +// such as: +// - Sending a chat message +// - Sending a chat event, such as typing +// - Disconnecting from a chat +type ChatEvent struct { + + // Type of chat integration event. + // + // This member is required. + Type ChatEventType + + // Content of the message or event. This is required when Type is MESSAGE and for + // certain ContentTypes when Type is EVENT . + // - For allowed message content, see the Content parameter in the SendMessage (https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_SendMessage.html) + // topic in the Amazon Connect Participant Service API Reference. + // - For allowed event content, see the Content parameter in the SendEvent (https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_SendEvent.html) + // topic in the Amazon Connect Participant Service API Reference. + Content *string + + // Type of content. This is required when Type is MESSAGE or EVENT . + // - For allowed message content types, see the ContentType parameter in the + // SendMessage (https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_SendMessage.html) + // topic in the Amazon Connect Participant Service API Reference. + // - For allowed event content types, see the ContentType parameter in the + // SendEvent (https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_SendEvent.html) + // topic in the Amazon Connect Participant Service API Reference. + ContentType *string + + noSmithyDocumentSerde +} + // A chat message. type ChatMessage struct { @@ -333,6 +418,11 @@ type ClaimedPhoneNumberSummary struct { // The type of phone number. PhoneNumberType PhoneNumberType + // The claimed phone number ARN that was previously imported from the external + // service, such as Amazon Pinpoint. If it is from Amazon Pinpoint, it looks like + // the ARN of the phone number that was imported from Amazon Pinpoint. + SourcePhoneNumberArn *string + // The tags used to organize, track, or control access for this resource. For // example, { "tags": {"key1":"value1", "key2":"value2"} }. Tags map[string]string @@ -344,6 +434,18 @@ type ClaimedPhoneNumberSummary struct { noSmithyDocumentSerde } +// Information required to join the call. +type ConnectionData struct { + + // The attendee information, including attendee ID and join token. + Attendee *Attendee + + // A meeting created using the Amazon Chime SDK. + Meeting *Meeting + + noSmithyDocumentSerde +} + // Contains information about a contact. type Contact struct { @@ -781,6 +883,19 @@ type Endpoint struct { noSmithyDocumentSerde } +// This API is in preview release for Amazon Connect and is subject to change. +// List of errors for dataset association failures. +type ErrorResult struct { + + // The error code. + ErrorCode *string + + // The corresponding error message for the error code. + ErrorMessage *string + + noSmithyDocumentSerde +} + // Information about a contact evaluation. type Evaluation struct { @@ -2207,12 +2322,20 @@ type ListPhoneNumbersSummary struct { // The ISO country code. PhoneNumberCountryCode PhoneNumberCountryCode + // The description of the phone number. + PhoneNumberDescription *string + // A unique identifier for the phone number. PhoneNumberId *string // The type of phone number. PhoneNumberType PhoneNumberType + // The claimed phone number ARN that was previously imported from the external + // service, such as Amazon Pinpoint. If it is from Amazon Pinpoint, it looks like + // the ARN of the phone number that was imported from Amazon Pinpoint. + SourcePhoneNumberArn *string + // The Amazon Resource Name (ARN) for Amazon Connect instances or traffic // distribution groups that phone number inbound traffic is routed through. TargetArn *string @@ -2246,6 +2369,55 @@ type MediaConcurrency struct { noSmithyDocumentSerde } +// A set of endpoints used by clients to connect to the media service group for an +// Amazon Chime SDK meeting. +type MediaPlacement struct { + + // The audio fallback URL. + AudioFallbackUrl *string + + // The audio host URL. + AudioHostUrl *string + + // The event ingestion URL to which you send client meeting events. + EventIngestionUrl *string + + // The signaling URL. + SignalingUrl *string + + // The turn control URL. + TurnControlUrl *string + + noSmithyDocumentSerde +} + +// A meeting created using the Amazon Chime SDK. +type Meeting struct { + + // The media placement for the meeting. + MediaPlacement *MediaPlacement + + // The Amazon Web Services Region in which you create the meeting. + MediaRegion *string + + // The configuration settings of the features available to a meeting. + MeetingFeatures *MeetingFeaturesConfiguration + + // The Amazon Chime SDK meeting ID. + MeetingId *string + + noSmithyDocumentSerde +} + +// The configuration settings of the features available to a meeting. +type MeetingFeaturesConfiguration struct { + + // The configuration settings for the audio features available to a meeting. + Audio *AudioFeatures + + noSmithyDocumentSerde +} + // Contains the name, thresholds, and metric filters. type MetricDataV2 struct { @@ -2336,6 +2508,36 @@ type MetricV2 struct { noSmithyDocumentSerde } +// Payload of chat properties to apply when starting a new contact. +type NewSessionDetails struct { + + // A custom key-value pair using an attribute map. The attributes are standard + // Amazon Connect attributes. They can be accessed in flows just like any other + // contact attributes. There can be up to 32,768 UTF-8 bytes across all key-value + // pairs per contact. Attribute keys can include only alphanumeric, dash, and + // underscore characters. + Attributes map[string]string + + // The customer's details. + ParticipantDetails *ParticipantDetails + + // The streaming configuration, such as the Amazon SNS streaming endpoint. + StreamingConfiguration *ChatStreamingConfiguration + + // The supported chat message content types. Supported types are text/plain , + // text/markdown , application/json , + // application/vnd.amazonaws.connect.message.interactive , and + // application/vnd.amazonaws.connect.message.interactive.response . Content types + // must always contain text/plain . You can then put any other supported type in + // the list. For example, all the following lists are valid because they contain + // text/plain : [text/plain, text/markdown, application/json] , [text/markdown, + // text/plain] , [text/plain, application/json, + // application/vnd.amazonaws.connect.message.interactive.response] . + SupportedMessagingContentTypes []string + + noSmithyDocumentSerde +} + // The type of notification recipient. type NotificationRecipientType struct { @@ -2396,6 +2598,17 @@ type OutboundCallerConfig struct { noSmithyDocumentSerde } +// The configuration for the allowed capabilities for participants present over +// the call. +type ParticipantCapabilities struct { + + // The configuration having the video sharing capabilities for participants over + // the call. + Video VideoCapability + + noSmithyDocumentSerde +} + // The customer's details. type ParticipantDetails struct { @@ -2864,8 +3077,8 @@ type QuickConnect struct { // Contains configuration settings for a quick connect. type QuickConnectConfig struct { - // The type of quick connect. In the Amazon Connect console, when you create a - // quick connect, you are prompted to assign one of the following types: Agent + // The type of quick connect. In the Amazon Connect admin website, when you create + // a quick connect, you are prompted to assign one of the following types: Agent // (USER), External (PHONE_NUMBER), or Queue (QUEUE). // // This member is required. @@ -2931,8 +3144,8 @@ type QuickConnectSummary struct { // The name of the quick connect. Name *string - // The type of quick connect. In the Amazon Connect console, when you create a - // quick connect, you are prompted to assign one of the following types: Agent + // The type of quick connect. In the Amazon Connect admin website, when you create + // a quick connect, you are prompted to assign one of the following types: Agent // (USER), External (PHONE_NUMBER), or Queue (QUEUE). QuickConnectType QuickConnectType @@ -2948,6 +3161,342 @@ type ReadOnlyFieldInfo struct { noSmithyDocumentSerde } +// Object that describes attached file. +type RealTimeContactAnalysisAttachment struct { + + // A unique identifier for the attachment. + // + // This member is required. + AttachmentId *string + + // A case-sensitive name of the attachment being uploaded. Can be redacted. + // + // This member is required. + AttachmentName *string + + // Describes the MIME file type of the attachment. For a list of supported file + // types, see Feature specifications (https://docs.aws.amazon.com/connect/latest/adminguide/feature-limits.html) + // in the Amazon Connect Administrator Guide. + ContentType *string + + // Status of the attachment. + Status ArtifactStatus + + noSmithyDocumentSerde +} + +// Provides information about the category rule that was matched. +type RealTimeContactAnalysisCategoryDetails struct { + + // List of PointOfInterest - objects describing a single match of a rule. + // + // This member is required. + PointsOfInterest []RealTimeContactAnalysisPointOfInterest + + noSmithyDocumentSerde +} + +// Begin and end offsets for a part of text. +type RealTimeContactAnalysisCharacterInterval struct { + + // The beginning of the character interval. + // + // This member is required. + BeginOffsetChar int32 + + // The end of the character interval. + // + // This member is required. + EndOffsetChar int32 + + noSmithyDocumentSerde +} + +// Potential issues that are detected based on an artificial intelligence analysis +// of each turn in the conversation. +type RealTimeContactAnalysisIssueDetected struct { + + // List of the transcript items (segments) that are associated with a given issue. + // + // This member is required. + TranscriptItems []RealTimeContactAnalysisTranscriptItemWithContent + + noSmithyDocumentSerde +} + +// The section of the contact transcript segment that category rule was detected. +type RealTimeContactAnalysisPointOfInterest struct { + + // List of the transcript items (segments) that are associated with a given point + // of interest. + TranscriptItems []RealTimeContactAnalysisTranscriptItemWithCharacterOffsets + + noSmithyDocumentSerde +} + +// An analyzed segment for a real-time analysis session. +// +// The following types satisfy this interface: +// +// RealtimeContactAnalysisSegmentMemberAttachments +// RealtimeContactAnalysisSegmentMemberCategories +// RealtimeContactAnalysisSegmentMemberEvent +// RealtimeContactAnalysisSegmentMemberIssues +// RealtimeContactAnalysisSegmentMemberTranscript +type RealtimeContactAnalysisSegment interface { + isRealtimeContactAnalysisSegment() +} + +// The analyzed attachments. +type RealtimeContactAnalysisSegmentMemberAttachments struct { + Value RealTimeContactAnalysisSegmentAttachments + + noSmithyDocumentSerde +} + +func (*RealtimeContactAnalysisSegmentMemberAttachments) isRealtimeContactAnalysisSegment() {} + +// The matched category rules. +type RealtimeContactAnalysisSegmentMemberCategories struct { + Value RealTimeContactAnalysisSegmentCategories + + noSmithyDocumentSerde +} + +func (*RealtimeContactAnalysisSegmentMemberCategories) isRealtimeContactAnalysisSegment() {} + +// Segment type describing a contact event. +type RealtimeContactAnalysisSegmentMemberEvent struct { + Value RealTimeContactAnalysisSegmentEvent + + noSmithyDocumentSerde +} + +func (*RealtimeContactAnalysisSegmentMemberEvent) isRealtimeContactAnalysisSegment() {} + +// Segment type containing a list of detected issues. +type RealtimeContactAnalysisSegmentMemberIssues struct { + Value RealTimeContactAnalysisSegmentIssues + + noSmithyDocumentSerde +} + +func (*RealtimeContactAnalysisSegmentMemberIssues) isRealtimeContactAnalysisSegment() {} + +// The analyzed transcript segment. +type RealtimeContactAnalysisSegmentMemberTranscript struct { + Value RealTimeContactAnalysisSegmentTranscript + + noSmithyDocumentSerde +} + +func (*RealtimeContactAnalysisSegmentMemberTranscript) isRealtimeContactAnalysisSegment() {} + +// Segment containing list of attachments. +type RealTimeContactAnalysisSegmentAttachments struct { + + // List of objects describing an individual attachment. + // + // This member is required. + Attachments []RealTimeContactAnalysisAttachment + + // The identifier of the segment. + // + // This member is required. + Id *string + + // The identifier of the participant. + // + // This member is required. + ParticipantId *string + + // The role of the participant. For example, is it a customer, agent, or system. + // + // This member is required. + ParticipantRole ParticipantRole + + // Field describing the time of the event. It can have different representations + // of time. + // + // This member is required. + Time RealTimeContactAnalysisTimeData + + // The display name of the participant. Can be redacted. + DisplayName *string + + noSmithyDocumentSerde +} + +// The matched category rules. +type RealTimeContactAnalysisSegmentCategories struct { + + // Map between the name of the matched rule and + // RealTimeContactAnalysisCategoryDetails. + // + // This member is required. + MatchedDetails map[string]RealTimeContactAnalysisCategoryDetails + + noSmithyDocumentSerde +} + +// Segment type describing a contact event. +type RealTimeContactAnalysisSegmentEvent struct { + + // Type of the event. For example, + // application/vnd.amazonaws.connect.event.participant.left . + // + // This member is required. + EventType *string + + // The identifier of the contact event. + // + // This member is required. + Id *string + + // Field describing the time of the event. It can have different representations + // of time. + // + // This member is required. + Time RealTimeContactAnalysisTimeData + + // The display name of the participant. Can be redacted. + DisplayName *string + + // The identifier of the participant. + ParticipantId *string + + // The role of the participant. For example, is it a customer, agent, or system. + ParticipantRole ParticipantRole + + noSmithyDocumentSerde +} + +// Segment type containing a list of detected issues. +type RealTimeContactAnalysisSegmentIssues struct { + + // List of the issues detected. + // + // This member is required. + IssuesDetected []RealTimeContactAnalysisIssueDetected + + noSmithyDocumentSerde +} + +// The analyzed transcript segment. +type RealTimeContactAnalysisSegmentTranscript struct { + + // The content of the transcript. Can be redacted. + // + // This member is required. + Content *string + + // The identifier of the transcript. + // + // This member is required. + Id *string + + // The identifier of the participant. + // + // This member is required. + ParticipantId *string + + // The role of the participant. For example, is it a customer, agent, or system. + // + // This member is required. + ParticipantRole ParticipantRole + + // Field describing the time of the event. It can have different representations + // of time. + // + // This member is required. + Time RealTimeContactAnalysisTimeData + + // The type of content of the item. For example, text/plain . + ContentType *string + + // The display name of the participant. + DisplayName *string + + // Object describing redaction that was applied to the transcript. If transcript + // has the field it means part of the transcript was redacted. + Redaction *RealTimeContactAnalysisTranscriptItemRedaction + + // The sentiment detected for this piece of transcript. + Sentiment RealTimeContactAnalysisSentimentLabel + + noSmithyDocumentSerde +} + +// Object describing time with which the segment is associated. It can have +// different representations of time. Currently supported: absoluteTime +// +// The following types satisfy this interface: +// +// RealTimeContactAnalysisTimeDataMemberAbsoluteTime +type RealTimeContactAnalysisTimeData interface { + isRealTimeContactAnalysisTimeData() +} + +// Time represented in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, +// 2019-11-08T02:41:28.172Z. +type RealTimeContactAnalysisTimeDataMemberAbsoluteTime struct { + Value time.Time + + noSmithyDocumentSerde +} + +func (*RealTimeContactAnalysisTimeDataMemberAbsoluteTime) isRealTimeContactAnalysisTimeData() {} + +// Object describing redaction applied to the segment. +type RealTimeContactAnalysisTranscriptItemRedaction struct { + + // List of character intervals each describing a part of the text that was + // redacted. For OutputType.Raw , part of the original text that contains data that + // can be redacted. For OutputType.Redacted , part of the string with redaction tag. + CharacterOffsets []RealTimeContactAnalysisCharacterInterval + + noSmithyDocumentSerde +} + +// Transcript representation containing Id and list of character intervals that +// are associated with analysis data. For example, this object within a +// RealTimeContactAnalysisPointOfInterest in Category.MatchedDetails would have +// character interval describing part of the text that matched category. +type RealTimeContactAnalysisTranscriptItemWithCharacterOffsets struct { + + // Transcript identifier. Matches the identifier from one of the + // TranscriptSegments. + // + // This member is required. + Id *string + + // List of character intervals within transcript content/text. + CharacterOffsets *RealTimeContactAnalysisCharacterInterval + + noSmithyDocumentSerde +} + +// Transcript representation containing Id, Content and list of character +// intervals that are associated with analysis data. For example, this object +// within an issue detected would describe both content that contains identified +// issue and intervals where that content is taken from. +type RealTimeContactAnalysisTranscriptItemWithContent struct { + + // Transcript identifier. Matches the identifier from one of the + // TranscriptSegments. + // + // This member is required. + Id *string + + // Begin and end offsets for a part of text. + CharacterOffsets *RealTimeContactAnalysisCharacterInterval + + // Part of the transcript content that contains identified issue. Can be redacted + Content *string + + noSmithyDocumentSerde +} + // Well-formed data on a contact, used by agents to complete a contact request. // You can have up to 4,096 UTF-8 bytes across all references for a contact. type Reference struct { @@ -3325,19 +3874,21 @@ type RuleAction struct { // Information about the contact category action. Supported only for // TriggerEventSource values: OnPostCallAnalysisAvailable | - // OnRealTimeCallAnalysisAvailable | OnPostChatAnalysisAvailable | - // OnZendeskTicketCreate | OnZendeskTicketStatusUpdate | OnSalesforceCaseCreate + // OnRealTimeCallAnalysisAvailable | OnRealTimeChatAnalysisAvailable | + // OnPostChatAnalysisAvailable | OnZendeskTicketCreate | + // OnZendeskTicketStatusUpdate | OnSalesforceCaseCreate AssignContactCategoryAction *AssignContactCategoryActionDefinition // Information about the EventBridge action. Supported only for TriggerEventSource // values: OnPostCallAnalysisAvailable | OnRealTimeCallAnalysisAvailable | - // OnPostChatAnalysisAvailable | OnContactEvaluationSubmit | OnMetricDataUpdate + // OnRealTimeChatAnalysisAvailable | OnPostChatAnalysisAvailable | + // OnContactEvaluationSubmit | OnMetricDataUpdate EventBridgeAction *EventBridgeActionDefinition // Information about the send notification action. Supported only for // TriggerEventSource values: OnPostCallAnalysisAvailable | - // OnRealTimeCallAnalysisAvailable | OnPostChatAnalysisAvailable | - // OnContactEvaluationSubmit | OnMetricDataUpdate + // OnRealTimeCallAnalysisAvailable | OnRealTimeChatAnalysisAvailable | + // OnPostChatAnalysisAvailable | OnContactEvaluationSubmit | OnMetricDataUpdate SendNotificationAction *SendNotificationActionDefinition // Information about the task action. This field is required if TriggerEventSource @@ -4588,5 +5139,7 @@ func (*UnknownUnionMember) isEvaluationFormNumericQuestionAutomation() func (*UnknownUnionMember) isEvaluationFormQuestionTypeProperties() {} func (*UnknownUnionMember) isEvaluationFormSingleSelectQuestionAutomationOption() {} func (*UnknownUnionMember) isParticipantTimerValue() {} +func (*UnknownUnionMember) isRealtimeContactAnalysisSegment() {} +func (*UnknownUnionMember) isRealTimeContactAnalysisTimeData() {} func (*UnknownUnionMember) isReferenceSummary() {} func (*UnknownUnionMember) isUpdateParticipantRoleConfigChannelInfo() {} diff --git a/service/connect/types/types_exported_test.go b/service/connect/types/types_exported_test.go index 633702dd137..f3bcfc7d3d9 100644 --- a/service/connect/types/types_exported_test.go +++ b/service/connect/types/types_exported_test.go @@ -5,6 +5,7 @@ package types_test import ( "fmt" "github.com/aws/aws-sdk-go-v2/service/connect/types" + "time" ) func ExampleEvaluationAnswerData_outputUsage() { @@ -135,6 +136,58 @@ func ExampleParticipantTimerValue_outputUsage() { var _ *int32 var _ types.ParticipantTimerAction +func ExampleRealtimeContactAnalysisSegment_outputUsage() { + var union types.RealtimeContactAnalysisSegment + // type switches can be used to check the union value + switch v := union.(type) { + case *types.RealtimeContactAnalysisSegmentMemberAttachments: + _ = v.Value // Value is types.RealTimeContactAnalysisSegmentAttachments + + case *types.RealtimeContactAnalysisSegmentMemberCategories: + _ = v.Value // Value is types.RealTimeContactAnalysisSegmentCategories + + case *types.RealtimeContactAnalysisSegmentMemberEvent: + _ = v.Value // Value is types.RealTimeContactAnalysisSegmentEvent + + case *types.RealtimeContactAnalysisSegmentMemberIssues: + _ = v.Value // Value is types.RealTimeContactAnalysisSegmentIssues + + case *types.RealtimeContactAnalysisSegmentMemberTranscript: + _ = v.Value // Value is types.RealTimeContactAnalysisSegmentTranscript + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.RealTimeContactAnalysisSegmentEvent +var _ *types.RealTimeContactAnalysisSegmentIssues +var _ *types.RealTimeContactAnalysisSegmentCategories +var _ *types.RealTimeContactAnalysisSegmentAttachments +var _ *types.RealTimeContactAnalysisSegmentTranscript + +func ExampleRealTimeContactAnalysisTimeData_outputUsage() { + var union types.RealTimeContactAnalysisTimeData + // type switches can be used to check the union value + switch v := union.(type) { + case *types.RealTimeContactAnalysisTimeDataMemberAbsoluteTime: + _ = v.Value // Value is time.Time + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *time.Time + func ExampleReferenceSummary_outputUsage() { var union types.ReferenceSummary // type switches can be used to check the union value diff --git a/service/connect/validators.go b/service/connect/validators.go index 21bffc73451..36d26a4e1ce 100644 --- a/service/connect/validators.go +++ b/service/connect/validators.go @@ -30,6 +30,26 @@ func (m *validateOpActivateEvaluationForm) HandleInitialize(ctx context.Context, return next.HandleInitialize(ctx, in) } +type validateOpAssociateAnalyticsDataSet struct { +} + +func (*validateOpAssociateAnalyticsDataSet) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAssociateAnalyticsDataSet) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AssociateAnalyticsDataSetInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAssociateAnalyticsDataSetInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpAssociateApprovedOrigin struct { } @@ -90,6 +110,26 @@ func (m *validateOpAssociateDefaultVocabulary) HandleInitialize(ctx context.Cont return next.HandleInitialize(ctx, in) } +type validateOpAssociateFlow struct { +} + +func (*validateOpAssociateFlow) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAssociateFlow) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AssociateFlowInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAssociateFlowInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpAssociateInstanceStorageConfig struct { } @@ -250,6 +290,46 @@ func (m *validateOpAssociateTrafficDistributionGroupUser) HandleInitialize(ctx c return next.HandleInitialize(ctx, in) } +type validateOpBatchAssociateAnalyticsDataSet struct { +} + +func (*validateOpBatchAssociateAnalyticsDataSet) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpBatchAssociateAnalyticsDataSet) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*BatchAssociateAnalyticsDataSetInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpBatchAssociateAnalyticsDataSetInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpBatchDisassociateAnalyticsDataSet struct { +} + +func (*validateOpBatchDisassociateAnalyticsDataSet) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpBatchDisassociateAnalyticsDataSet) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*BatchDisassociateAnalyticsDataSetInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpBatchDisassociateAnalyticsDataSetInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpBatchGetFlowAssociation struct { } @@ -1670,6 +1750,26 @@ func (m *validateOpDescribeVocabulary) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpDisassociateAnalyticsDataSet struct { +} + +func (*validateOpDisassociateAnalyticsDataSet) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateAnalyticsDataSet) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateAnalyticsDataSetInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateAnalyticsDataSetInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDisassociateApprovedOrigin struct { } @@ -1710,6 +1810,26 @@ func (m *validateOpDisassociateBot) HandleInitialize(ctx context.Context, in mid return next.HandleInitialize(ctx, in) } +type validateOpDisassociateFlow struct { +} + +func (*validateOpDisassociateFlow) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateFlow) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateFlowInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateFlowInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDisassociateInstanceStorageConfig struct { } @@ -1970,6 +2090,26 @@ func (m *validateOpGetFederationToken) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpGetFlowAssociation struct { +} + +func (*validateOpGetFlowAssociation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetFlowAssociation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetFlowAssociationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetFlowAssociationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetMetricData struct { } @@ -2070,6 +2210,26 @@ func (m *validateOpGetTrafficDistribution) HandleInitialize(ctx context.Context, return next.HandleInitialize(ctx, in) } +type validateOpImportPhoneNumber struct { +} + +func (*validateOpImportPhoneNumber) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpImportPhoneNumber) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ImportPhoneNumberInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpImportPhoneNumberInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListAgentStatuses struct { } @@ -2090,6 +2250,26 @@ func (m *validateOpListAgentStatuses) HandleInitialize(ctx context.Context, in m return next.HandleInitialize(ctx, in) } +type validateOpListAnalyticsDataAssociations struct { +} + +func (*validateOpListAnalyticsDataAssociations) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAnalyticsDataAssociations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAnalyticsDataAssociationsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAnalyticsDataAssociationsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListApprovedOrigins struct { } @@ -2270,6 +2450,26 @@ func (m *validateOpListEvaluationFormVersions) HandleInitialize(ctx context.Cont return next.HandleInitialize(ctx, in) } +type validateOpListFlowAssociations struct { +} + +func (*validateOpListFlowAssociations) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListFlowAssociations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListFlowAssociationsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListFlowAssociationsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListHoursOfOperations struct { } @@ -2490,6 +2690,26 @@ func (m *validateOpListQuickConnects) HandleInitialize(ctx context.Context, in m return next.HandleInitialize(ctx, in) } +type validateOpListRealtimeContactAnalysisSegmentsV2 struct { +} + +func (*validateOpListRealtimeContactAnalysisSegmentsV2) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListRealtimeContactAnalysisSegmentsV2) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListRealtimeContactAnalysisSegmentsV2Input) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListRealtimeContactAnalysisSegmentsV2Input(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListRoutingProfileQueues struct { } @@ -3090,6 +3310,26 @@ func (m *validateOpSearchVocabularies) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpSendChatIntegrationEvent struct { +} + +func (*validateOpSendChatIntegrationEvent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSendChatIntegrationEvent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SendChatIntegrationEventInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSendChatIntegrationEventInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpStartChatContact struct { } @@ -3210,6 +3450,26 @@ func (m *validateOpStartTaskContact) HandleInitialize(ctx context.Context, in mi return next.HandleInitialize(ctx, in) } +type validateOpStartWebRTCContact struct { +} + +func (*validateOpStartWebRTCContact) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartWebRTCContact) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartWebRTCContactInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartWebRTCContactInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpStopContact struct { } @@ -4234,6 +4494,10 @@ func addOpActivateEvaluationFormValidationMiddleware(stack *middleware.Stack) er return stack.Initialize.Add(&validateOpActivateEvaluationForm{}, middleware.After) } +func addOpAssociateAnalyticsDataSetValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAssociateAnalyticsDataSet{}, middleware.After) +} + func addOpAssociateApprovedOriginValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpAssociateApprovedOrigin{}, middleware.After) } @@ -4246,6 +4510,10 @@ func addOpAssociateDefaultVocabularyValidationMiddleware(stack *middleware.Stack return stack.Initialize.Add(&validateOpAssociateDefaultVocabulary{}, middleware.After) } +func addOpAssociateFlowValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAssociateFlow{}, middleware.After) +} + func addOpAssociateInstanceStorageConfigValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpAssociateInstanceStorageConfig{}, middleware.After) } @@ -4278,6 +4546,14 @@ func addOpAssociateTrafficDistributionGroupUserValidationMiddleware(stack *middl return stack.Initialize.Add(&validateOpAssociateTrafficDistributionGroupUser{}, middleware.After) } +func addOpBatchAssociateAnalyticsDataSetValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpBatchAssociateAnalyticsDataSet{}, middleware.After) +} + +func addOpBatchDisassociateAnalyticsDataSetValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpBatchDisassociateAnalyticsDataSet{}, middleware.After) +} + func addOpBatchGetFlowAssociationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpBatchGetFlowAssociation{}, middleware.After) } @@ -4562,6 +4838,10 @@ func addOpDescribeVocabularyValidationMiddleware(stack *middleware.Stack) error return stack.Initialize.Add(&validateOpDescribeVocabulary{}, middleware.After) } +func addOpDisassociateAnalyticsDataSetValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateAnalyticsDataSet{}, middleware.After) +} + func addOpDisassociateApprovedOriginValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisassociateApprovedOrigin{}, middleware.After) } @@ -4570,6 +4850,10 @@ func addOpDisassociateBotValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisassociateBot{}, middleware.After) } +func addOpDisassociateFlowValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateFlow{}, middleware.After) +} + func addOpDisassociateInstanceStorageConfigValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisassociateInstanceStorageConfig{}, middleware.After) } @@ -4622,6 +4906,10 @@ func addOpGetFederationTokenValidationMiddleware(stack *middleware.Stack) error return stack.Initialize.Add(&validateOpGetFederationToken{}, middleware.After) } +func addOpGetFlowAssociationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetFlowAssociation{}, middleware.After) +} + func addOpGetMetricDataValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetMetricData{}, middleware.After) } @@ -4642,10 +4930,18 @@ func addOpGetTrafficDistributionValidationMiddleware(stack *middleware.Stack) er return stack.Initialize.Add(&validateOpGetTrafficDistribution{}, middleware.After) } +func addOpImportPhoneNumberValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpImportPhoneNumber{}, middleware.After) +} + func addOpListAgentStatusesValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListAgentStatuses{}, middleware.After) } +func addOpListAnalyticsDataAssociationsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAnalyticsDataAssociations{}, middleware.After) +} + func addOpListApprovedOriginsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListApprovedOrigins{}, middleware.After) } @@ -4682,6 +4978,10 @@ func addOpListEvaluationFormVersionsValidationMiddleware(stack *middleware.Stack return stack.Initialize.Add(&validateOpListEvaluationFormVersions{}, middleware.After) } +func addOpListFlowAssociationsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListFlowAssociations{}, middleware.After) +} + func addOpListHoursOfOperationsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListHoursOfOperations{}, middleware.After) } @@ -4726,6 +5026,10 @@ func addOpListQuickConnectsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListQuickConnects{}, middleware.After) } +func addOpListRealtimeContactAnalysisSegmentsV2ValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListRealtimeContactAnalysisSegmentsV2{}, middleware.After) +} + func addOpListRoutingProfileQueuesValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListRoutingProfileQueues{}, middleware.After) } @@ -4846,6 +5150,10 @@ func addOpSearchVocabulariesValidationMiddleware(stack *middleware.Stack) error return stack.Initialize.Add(&validateOpSearchVocabularies{}, middleware.After) } +func addOpSendChatIntegrationEventValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSendChatIntegrationEvent{}, middleware.After) +} + func addOpStartChatContactValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpStartChatContact{}, middleware.After) } @@ -4870,6 +5178,10 @@ func addOpStartTaskContactValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpStartTaskContact{}, middleware.After) } +func addOpStartWebRTCContactValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartWebRTCContact{}, middleware.After) +} + func addOpStopContactValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpStopContact{}, middleware.After) } @@ -5093,6 +5405,21 @@ func validateAgentConfig(v *types.AgentConfig) error { } } +func validateChatEvent(v *types.ChatEvent) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ChatEvent"} + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateChatMessage(v *types.ChatMessage) error { if v == nil { return nil @@ -5822,6 +6149,28 @@ func validateMediaConcurrency(v *types.MediaConcurrency) error { } } +func validateNewSessionDetails(v *types.NewSessionDetails) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "NewSessionDetails"} + if v.ParticipantDetails != nil { + if err := validateParticipantDetails(v.ParticipantDetails); err != nil { + invalidParams.AddNested("ParticipantDetails", err.(smithy.InvalidParamsError)) + } + } + if v.StreamingConfiguration != nil { + if err := validateChatStreamingConfiguration(v.StreamingConfiguration); err != nil { + invalidParams.AddNested("StreamingConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateNumericQuestionPropertyValueAutomation(v *types.NumericQuestionPropertyValueAutomation) error { if v == nil { return nil @@ -6373,6 +6722,24 @@ func validateOpActivateEvaluationFormInput(v *ActivateEvaluationFormInput) error } } +func validateOpAssociateAnalyticsDataSetInput(v *AssociateAnalyticsDataSetInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AssociateAnalyticsDataSetInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.DataSetId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSetId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpAssociateApprovedOriginInput(v *AssociateApprovedOriginInput) error { if v == nil { return nil @@ -6429,6 +6796,30 @@ func validateOpAssociateDefaultVocabularyInput(v *AssociateDefaultVocabularyInpu } } +func validateOpAssociateFlowInput(v *AssociateFlowInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AssociateFlowInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.ResourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceId")) + } + if v.FlowId == nil { + invalidParams.Add(smithy.NewErrParamRequired("FlowId")) + } + if len(v.ResourceType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ResourceType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpAssociateInstanceStorageConfigInput(v *AssociateInstanceStorageConfigInput) error { if v == nil { return nil @@ -6600,6 +6991,42 @@ func validateOpAssociateTrafficDistributionGroupUserInput(v *AssociateTrafficDis } } +func validateOpBatchAssociateAnalyticsDataSetInput(v *BatchAssociateAnalyticsDataSetInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BatchAssociateAnalyticsDataSetInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.DataSetIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSetIds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpBatchDisassociateAnalyticsDataSetInput(v *BatchDisassociateAnalyticsDataSetInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BatchDisassociateAnalyticsDataSetInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.DataSetIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSetIds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpBatchGetFlowAssociationInput(v *BatchGetFlowAssociationInput) error { if v == nil { return nil @@ -8001,6 +8428,24 @@ func validateOpDescribeVocabularyInput(v *DescribeVocabularyInput) error { } } +func validateOpDisassociateAnalyticsDataSetInput(v *DisassociateAnalyticsDataSetInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateAnalyticsDataSetInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.DataSetId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSetId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDisassociateApprovedOriginInput(v *DisassociateApprovedOriginInput) error { if v == nil { return nil @@ -8039,6 +8484,27 @@ func validateOpDisassociateBotInput(v *DisassociateBotInput) error { } } +func validateOpDisassociateFlowInput(v *DisassociateFlowInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateFlowInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.ResourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceId")) + } + if len(v.ResourceType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ResourceType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDisassociateInstanceStorageConfigInput(v *DisassociateInstanceStorageConfigInput) error { if v == nil { return nil @@ -8295,6 +8761,27 @@ func validateOpGetFederationTokenInput(v *GetFederationTokenInput) error { } } +func validateOpGetFlowAssociationInput(v *GetFlowAssociationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetFlowAssociationInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.ResourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceId")) + } + if len(v.ResourceType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ResourceType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetMetricDataInput(v *GetMetricDataInput) error { if v == nil { return nil @@ -8400,6 +8887,24 @@ func validateOpGetTrafficDistributionInput(v *GetTrafficDistributionInput) error } } +func validateOpImportPhoneNumberInput(v *ImportPhoneNumberInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ImportPhoneNumberInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.SourcePhoneNumberArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("SourcePhoneNumberArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListAgentStatusesInput(v *ListAgentStatusesInput) error { if v == nil { return nil @@ -8415,6 +8920,21 @@ func validateOpListAgentStatusesInput(v *ListAgentStatusesInput) error { } } +func validateOpListAnalyticsDataAssociationsInput(v *ListAnalyticsDataAssociationsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAnalyticsDataAssociationsInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListApprovedOriginsInput(v *ListApprovedOriginsInput) error { if v == nil { return nil @@ -8565,6 +9085,21 @@ func validateOpListEvaluationFormVersionsInput(v *ListEvaluationFormVersionsInpu } } +func validateOpListFlowAssociationsInput(v *ListFlowAssociationsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListFlowAssociationsInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListHoursOfOperationsInput(v *ListHoursOfOperationsInput) error { if v == nil { return nil @@ -8736,6 +9271,30 @@ func validateOpListQuickConnectsInput(v *ListQuickConnectsInput) error { } } +func validateOpListRealtimeContactAnalysisSegmentsV2Input(v *ListRealtimeContactAnalysisSegmentsV2Input) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListRealtimeContactAnalysisSegmentsV2Input"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.ContactId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContactId")) + } + if len(v.OutputType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("OutputType")) + } + if v.SegmentTypes == nil { + invalidParams.Add(smithy.NewErrParamRequired("SegmentTypes")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListRoutingProfileQueuesInput(v *ListRoutingProfileQueuesInput) error { if v == nil { return nil @@ -9228,6 +9787,36 @@ func validateOpSearchVocabulariesInput(v *SearchVocabulariesInput) error { } } +func validateOpSendChatIntegrationEventInput(v *SendChatIntegrationEventInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SendChatIntegrationEventInput"} + if v.SourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SourceId")) + } + if v.DestinationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DestinationId")) + } + if v.Event == nil { + invalidParams.Add(smithy.NewErrParamRequired("Event")) + } else if v.Event != nil { + if err := validateChatEvent(v.Event); err != nil { + invalidParams.AddNested("Event", err.(smithy.InvalidParamsError)) + } + } + if v.NewSessionDetails != nil { + if err := validateNewSessionDetails(v.NewSessionDetails); err != nil { + invalidParams.AddNested("NewSessionDetails", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpStartChatContactInput(v *StartChatContactInput) error { if v == nil { return nil @@ -9375,6 +9964,36 @@ func validateOpStartTaskContactInput(v *StartTaskContactInput) error { } } +func validateOpStartWebRTCContactInput(v *StartWebRTCContactInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartWebRTCContactInput"} + if v.ContactFlowId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContactFlowId")) + } + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.ParticipantDetails == nil { + invalidParams.Add(smithy.NewErrParamRequired("ParticipantDetails")) + } else if v.ParticipantDetails != nil { + if err := validateParticipantDetails(v.ParticipantDetails); err != nil { + invalidParams.AddNested("ParticipantDetails", err.(smithy.InvalidParamsError)) + } + } + if v.References != nil { + if err := validateContactReferences(v.References); err != nil { + invalidParams.AddNested("References", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpStopContactInput(v *StopContactInput) error { if v == nil { return nil diff --git a/service/customerprofiles/api_op_DetectProfileObjectType.go b/service/customerprofiles/api_op_DetectProfileObjectType.go new file mode 100644 index 00000000000..61511ec460c --- /dev/null +++ b/service/customerprofiles/api_op_DetectProfileObjectType.go @@ -0,0 +1,143 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package customerprofiles + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/customerprofiles/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// The process of detecting profile object type mapping by using given objects. +func (c *Client) DetectProfileObjectType(ctx context.Context, params *DetectProfileObjectTypeInput, optFns ...func(*Options)) (*DetectProfileObjectTypeOutput, error) { + if params == nil { + params = &DetectProfileObjectTypeInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DetectProfileObjectType", params, optFns, c.addOperationDetectProfileObjectTypeMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DetectProfileObjectTypeOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DetectProfileObjectTypeInput struct { + + // The unique name of the domain. + // + // This member is required. + DomainName *string + + // A string that is serialized from a JSON object. + // + // This member is required. + Objects []string + + noSmithyDocumentSerde +} + +type DetectProfileObjectTypeOutput struct { + + // Detected ProfileObjectType mappings from given objects. A maximum of one + // mapping is supported. + DetectedProfileObjectTypes []types.DetectedProfileObjectType + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDetectProfileObjectTypeMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDetectProfileObjectType{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDetectProfileObjectType{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DetectProfileObjectType"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDetectProfileObjectTypeValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectProfileObjectType(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDetectProfileObjectType(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DetectProfileObjectType", + } +} diff --git a/service/customerprofiles/deserializers.go b/service/customerprofiles/deserializers.go index 766eb8cf1ba..d7ce2a8e8ca 100644 --- a/service/customerprofiles/deserializers.go +++ b/service/customerprofiles/deserializers.go @@ -2432,6 +2432,165 @@ func awsRestjson1_deserializeOpErrorDeleteWorkflow(response *smithyhttp.Response } } +type awsRestjson1_deserializeOpDetectProfileObjectType struct { +} + +func (*awsRestjson1_deserializeOpDetectProfileObjectType) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDetectProfileObjectType) 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_deserializeOpErrorDetectProfileObjectType(response, &metadata) + } + output := &DetectProfileObjectTypeOutput{} + 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_deserializeOpDocumentDetectProfileObjectTypeOutput(&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_deserializeOpErrorDetectProfileObjectType(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("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) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDetectProfileObjectTypeOutput(v **DetectProfileObjectTypeOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DetectProfileObjectTypeOutput + if *v == nil { + sv = &DetectProfileObjectTypeOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DetectedProfileObjectTypes": + if err := awsRestjson1_deserializeDocumentDetectedProfileObjectTypes(&sv.DetectedProfileObjectTypes, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpGetAutoMergingPreview struct { } @@ -10585,6 +10744,90 @@ func awsRestjson1_deserializeDocumentDestinationSummary(v **types.DestinationSum return nil } +func awsRestjson1_deserializeDocumentDetectedProfileObjectType(v **types.DetectedProfileObjectType, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DetectedProfileObjectType + if *v == nil { + sv = &types.DetectedProfileObjectType{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Fields": + if err := awsRestjson1_deserializeDocumentFieldMap(&sv.Fields, value); err != nil { + return err + } + + case "Keys": + if err := awsRestjson1_deserializeDocumentKeyMap(&sv.Keys, value); err != nil { + return err + } + + case "SourceLastUpdatedTimestampFormat": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected string1To255 to be of type string, got %T instead", value) + } + sv.SourceLastUpdatedTimestampFormat = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDetectedProfileObjectTypes(v *[]types.DetectedProfileObjectType, 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.DetectedProfileObjectType + if *v == nil { + cv = []types.DetectedProfileObjectType{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DetectedProfileObjectType + destAddr := &col + if err := awsRestjson1_deserializeDocumentDetectedProfileObjectType(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentDomainList(v *[]types.ListDomainItem, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/customerprofiles/generated.json b/service/customerprofiles/generated.json index c1dffd79f84..a6bc35df2ff 100644 --- a/service/customerprofiles/generated.json +++ b/service/customerprofiles/generated.json @@ -24,6 +24,7 @@ "api_op_DeleteProfileObject.go", "api_op_DeleteProfileObjectType.go", "api_op_DeleteWorkflow.go", + "api_op_DetectProfileObjectType.go", "api_op_GetAutoMergingPreview.go", "api_op_GetCalculatedAttributeDefinition.go", "api_op_GetCalculatedAttributeForProfile.go", diff --git a/service/customerprofiles/serializers.go b/service/customerprofiles/serializers.go index 2d21edf15d1..c95b79f5fca 100644 --- a/service/customerprofiles/serializers.go +++ b/service/customerprofiles/serializers.go @@ -1522,6 +1522,96 @@ func awsRestjson1_serializeOpHttpBindingsDeleteWorkflowInput(v *DeleteWorkflowIn return nil } +type awsRestjson1_serializeOpDetectProfileObjectType struct { +} + +func (*awsRestjson1_serializeOpDetectProfileObjectType) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDetectProfileObjectType) 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.(*DetectProfileObjectTypeInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/domains/{DomainName}/detect/object-types") + 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_serializeOpHttpBindingsDetectProfileObjectTypeInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDetectProfileObjectTypeInput(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_serializeOpHttpBindingsDetectProfileObjectTypeInput(v *DetectProfileObjectTypeInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DomainName == nil || len(*v.DomainName) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DomainName must not be empty")} + } + if v.DomainName != nil { + if err := encoder.SetURI("DomainName").String(*v.DomainName); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDetectProfileObjectTypeInput(v *DetectProfileObjectTypeInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Objects != nil { + ok := object.Key("Objects") + if err := awsRestjson1_serializeDocumentObjects(v.Objects, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpGetAutoMergingPreview struct { } @@ -5543,6 +5633,17 @@ func awsRestjson1_serializeDocumentObjectFilter(v *types.ObjectFilter, value smi return nil } +func awsRestjson1_serializeDocumentObjects(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_serializeDocumentObjectTypeField(v *types.ObjectTypeField, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/customerprofiles/types/types.go b/service/customerprofiles/types/types.go index 26d669ac9bf..7a3118eeb8d 100644 --- a/service/customerprofiles/types/types.go +++ b/service/customerprofiles/types/types.go @@ -391,6 +391,21 @@ type DestinationSummary struct { noSmithyDocumentSerde } +// Contains ProfileObjectType mapping information from the model. +type DetectedProfileObjectType struct { + + // A map of the name and the ObjectType field. + Fields map[string]ObjectTypeField + + // A list of unique keys that can be used to map data to a profile. + Keys map[string][]ObjectTypeKey + + // The format of sourceLastUpdatedTimestamp that was detected in fields. + SourceLastUpdatedTimestampFormat *string + + noSmithyDocumentSerde +} + // Usage-specific statistics about the domain. type DomainStats struct { diff --git a/service/customerprofiles/validators.go b/service/customerprofiles/validators.go index 0b37cb922a3..d8ee4a74640 100644 --- a/service/customerprofiles/validators.go +++ b/service/customerprofiles/validators.go @@ -310,6 +310,26 @@ func (m *validateOpDeleteWorkflow) HandleInitialize(ctx context.Context, in midd return next.HandleInitialize(ctx, in) } +type validateOpDetectProfileObjectType struct { +} + +func (*validateOpDetectProfileObjectType) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDetectProfileObjectType) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DetectProfileObjectTypeInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDetectProfileObjectTypeInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetAutoMergingPreview struct { } @@ -1050,6 +1070,10 @@ func addOpDeleteWorkflowValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteWorkflow{}, middleware.After) } +func addOpDetectProfileObjectTypeValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDetectProfileObjectType{}, middleware.After) +} + func addOpGetAutoMergingPreviewValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetAutoMergingPreview{}, middleware.After) } @@ -2227,6 +2251,24 @@ func validateOpDeleteWorkflowInput(v *DeleteWorkflowInput) error { } } +func validateOpDetectProfileObjectTypeInput(v *DetectProfileObjectTypeInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DetectProfileObjectTypeInput"} + if v.Objects == nil { + invalidParams.Add(smithy.NewErrParamRequired("Objects")) + } + if v.DomainName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DomainName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetAutoMergingPreviewInput(v *GetAutoMergingPreviewInput) error { if v == nil { return nil diff --git a/service/datasync/internal/endpoints/endpoints.go b/service/datasync/internal/endpoints/endpoints.go index 2d7bb168216..e436e88cdf7 100644 --- a/service/datasync/internal/endpoints/endpoints.go +++ b/service/datasync/internal/endpoints/endpoints.go @@ -363,6 +363,26 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-iso-west-1", + }: endpoints.Endpoint{ + Hostname: "datasync-fips.us-iso-west-1.c2s.ic.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-iso-west-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "us-iso-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-iso-west-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "datasync-fips.us-iso-west-1.c2s.ic.gov", + }, + }, }, { ID: "aws-iso-b", diff --git a/service/docdb/api_client.go b/service/docdb/api_client.go index b200b41c9f1..e32c3d2ef45 100644 --- a/service/docdb/api_client.go +++ b/service/docdb/api_client.go @@ -506,7 +506,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) } diff --git a/service/drs/internal/endpoints/endpoints.go b/service/drs/internal/endpoints/endpoints.go index 614e2fd4594..952ed633dbd 100644 --- a/service/drs/internal/endpoints/endpoints.go +++ b/service/drs/internal/endpoints/endpoints.go @@ -378,5 +378,43 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-gov-east-1", + }: endpoints.Endpoint{ + Hostname: "drs-fips.us-gov-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-east-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-gov-west-1", + }: endpoints.Endpoint{ + Hostname: "drs-fips.us-gov-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-gov-west-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "us-gov-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-gov-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "drs-fips.us-gov-east-1.amazonaws.com", + }, + endpoints.EndpointKey{ + Region: "us-gov-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-gov-west-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "drs-fips.us-gov-west-1.amazonaws.com", + }, + }, }, } diff --git a/service/ec2/api_client.go b/service/ec2/api_client.go index 41317476d1f..11bee8e35ee 100644 --- a/service/ec2/api_client.go +++ b/service/ec2/api_client.go @@ -522,7 +522,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) } diff --git a/service/neptune/api_client.go b/service/neptune/api_client.go index 42ff4f6d909..1a81839a370 100644 --- a/service/neptune/api_client.go +++ b/service/neptune/api_client.go @@ -505,7 +505,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) } diff --git a/service/polly/api_client.go b/service/polly/api_client.go index 95ad53405fb..7a6ac646239 100644 --- a/service/polly/api_client.go +++ b/service/polly/api_client.go @@ -505,7 +505,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) } diff --git a/service/qbusiness/LICENSE.txt b/service/qbusiness/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/qbusiness/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/qbusiness/api_client.go b/service/qbusiness/api_client.go new file mode 100644 index 00000000000..0ade2d558d2 --- /dev/null +++ b/service/qbusiness/api_client.go @@ -0,0 +1,470 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +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" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + 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 = "QBusiness" +const ServiceAPIVersion = "2023-11-27" + +// Client provides the API client to make operations call for QBusiness. +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) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveIdempotencyTokenProvider(&options) + + resolveEndpointResolverV2(&options) + + resolveAuthSchemeResolver(&options) + + for _, fn := range optFns { + fn(&options) + } + + resolveRetryer(&options) + + ignoreAnonymousAuth(&options) + + resolveAuthSchemes(&options) + + client := &Client{ + options: options, + } + + return client +} + +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttemptOptions(&options, *c) + + finalizeClientEndpointResolverOptions(&options) + + for _, fn := range stackFns { + if err := fn(stack, options); err != nil { + return nil, metadata, err + } + } + + for _, fn := range options.APIOptions { + if err := fn(stack); err != nil { + return nil, metadata, err + } + } + + handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) + result, metadata, err = handler.Handle(ctx, params) + if err != nil { + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + return result, metadata, err +} + +type operationInputKey struct{} + +func setOperationInput(ctx context.Context, input interface{}) context.Context { + return middleware.WithStackValue(ctx, operationInputKey{}, input) +} + +func getOperationInput(ctx context.Context) interface{} { + return middleware.GetStackValue(ctx, operationInputKey{}) +} + +type setOperationInputMiddleware struct { +} + +func (*setOperationInputMiddleware) ID() string { + return "setOperationInput" +} + +func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + ctx = setOperationInput(ctx, in.Parameters) + return next.HandleSerialize(ctx, in) +} + +func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { + if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { + return fmt.Errorf("add ResolveAuthScheme: %v", err) + } + if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { + return fmt.Errorf("add GetIdentity: %v", err) + } + if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { + return fmt.Errorf("add ResolveEndpointV2: %v", err) + } + if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil { + return fmt.Errorf("add Signing: %v", err) + } + return nil +} +func resolveAuthSchemeResolver(options *Options) { + if options.AuthSchemeResolver == nil { + options.AuthSchemeResolver = &defaultAuthSchemeResolver{} + } +} + +func resolveAuthSchemes(options *Options) { + if options.AuthSchemes == nil { + options.AuthSchemes = []smithyhttp.AuthScheme{ + internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ + Signer: options.HTTPSignerV4, + Logger: options.Logger, + LogSigning: options.ClientLogMode.IsSigning(), + }), + } + } +} + +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) + resolveBaseEndpoint(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, "qbusiness", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +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 disableHTTPSMiddleware struct { + DisableHTTPS bool +} + +func (*disableHTTPSMiddleware) ID() string { + return "disableHTTPS" +} + +func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, 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.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleFinalize(ctx, in) +} + +func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Finalize.Insert(&disableHTTPSMiddleware{ + DisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "ResolveEndpointV2", middleware.After) +} diff --git a/service/qbusiness/api_client_test.go b/service/qbusiness/api_client_test.go new file mode 100644 index 00000000000..4426adf6ff5 --- /dev/null +++ b/service/qbusiness/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +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/qbusiness/api_op_BatchDeleteDocument.go b/service/qbusiness/api_op_BatchDeleteDocument.go new file mode 100644 index 00000000000..155a2f9b0e2 --- /dev/null +++ b/service/qbusiness/api_op_BatchDeleteDocument.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Asynchronously deletes one or more documents added using the BatchPutDocument +// API from an Amazon Q index. You can see the progress of the deletion, and any +// error messages related to the process, by using CloudWatch. +func (c *Client) BatchDeleteDocument(ctx context.Context, params *BatchDeleteDocumentInput, optFns ...func(*Options)) (*BatchDeleteDocumentOutput, error) { + if params == nil { + params = &BatchDeleteDocumentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "BatchDeleteDocument", params, optFns, c.addOperationBatchDeleteDocumentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*BatchDeleteDocumentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type BatchDeleteDocumentInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // Documents deleted from the Amazon Q index. + // + // This member is required. + Documents []types.DeleteDocument + + // The identifier of the Amazon Q index that contains the documents to delete. + // + // This member is required. + IndexId *string + + // The identifier of the data source sync during which the documents were deleted. + DataSourceSyncId *string + + noSmithyDocumentSerde +} + +type BatchDeleteDocumentOutput struct { + + // A list of documents that couldn't be removed from the Amazon Q index. Each + // entry contains an error message that indicates why the document couldn't be + // removed from the index. + FailedDocuments []types.FailedDocument + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationBatchDeleteDocumentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchDeleteDocument{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchDeleteDocument{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "BatchDeleteDocument"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpBatchDeleteDocumentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchDeleteDocument(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opBatchDeleteDocument(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "BatchDeleteDocument", + } +} diff --git a/service/qbusiness/api_op_BatchPutDocument.go b/service/qbusiness/api_op_BatchPutDocument.go new file mode 100644 index 00000000000..135a25ff2b9 --- /dev/null +++ b/service/qbusiness/api_op_BatchPutDocument.go @@ -0,0 +1,163 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds one or more documents to an Amazon Q index. You use this API to: +// - ingest your structured and unstructured documents and documents stored in +// an Amazon S3 bucket into an Amazon Q index. +// - add custom attributes to documents in an Amazon Q index. +// - attach an access control list to the documents added to an Amazon Q index. +// +// You can see the progress of the deletion, and any error messages related to the +// process, by using CloudWatch. +func (c *Client) BatchPutDocument(ctx context.Context, params *BatchPutDocumentInput, optFns ...func(*Options)) (*BatchPutDocumentOutput, error) { + if params == nil { + params = &BatchPutDocumentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "BatchPutDocument", params, optFns, c.addOperationBatchPutDocumentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*BatchPutDocumentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type BatchPutDocumentInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // One or more documents to add to the index. + // + // This member is required. + Documents []types.Document + + // The identifier of the Amazon Q index to add the documents to. + // + // This member is required. + IndexId *string + + // The identifier of the data source sync during which the documents were added. + DataSourceSyncId *string + + // The Amazon Resource Name (ARN) of an IAM role with permission to access your S3 + // bucket. + RoleArn *string + + noSmithyDocumentSerde +} + +type BatchPutDocumentOutput struct { + + // A list of documents that were not added to the Amazon Q index because the + // document failed a validation check. Each document contains an error message that + // indicates why the document couldn't be added to the index. + FailedDocuments []types.FailedDocument + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationBatchPutDocumentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchPutDocument{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchPutDocument{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "BatchPutDocument"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpBatchPutDocumentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchPutDocument(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opBatchPutDocument(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "BatchPutDocument", + } +} diff --git a/service/qbusiness/api_op_ChatSync.go b/service/qbusiness/api_op_ChatSync.go new file mode 100644 index 00000000000..f323d0ae0db --- /dev/null +++ b/service/qbusiness/api_op_ChatSync.go @@ -0,0 +1,224 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Starts or continues a non-streaming Amazon Q conversation. +func (c *Client) ChatSync(ctx context.Context, params *ChatSyncInput, optFns ...func(*Options)) (*ChatSyncOutput, error) { + if params == nil { + params = &ChatSyncInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ChatSync", params, optFns, c.addOperationChatSyncMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ChatSyncOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ChatSyncInput struct { + + // The identifier of the Amazon Q application linked to the Amazon Q conversation. + // + // This member is required. + ApplicationId *string + + // The identifier of the user attached to the chat input. + // + // This member is required. + UserId *string + + // A request from an end user to perform an Amazon Q plugin action. + ActionExecution *types.ActionExecution + + // A list of files uploaded directly during chat. You can upload a maximum of 5 + // files of upto 10 MB each. + Attachments []types.AttachmentInput + + // Enables filtering of Amazon Q web experience responses based on document + // attributes or metadata fields. + AttributeFilter *types.AttributeFilter + + // A token that you provide to identify a chat request. + ClientToken *string + + // The identifier of the Amazon Q conversation. + ConversationId *string + + // The identifier of the previous end user text input message in a conversation. + ParentMessageId *string + + // The groups that a user associated with the chat input belongs to. + UserGroups []string + + // A end user message in a conversation. + UserMessage *string + + noSmithyDocumentSerde +} + +type ChatSyncOutput struct { + + // A request from Amazon Q to the end user for information Amazon Q needs to + // successfully complete a requested plugin action. + ActionReview *types.ActionReview + + // The identifier of the Amazon Q conversation. + ConversationId *string + + // A list of files which failed to upload during chat. + FailedAttachments []types.AttachmentOutput + + // The source documents used to generate the conversation response. + SourceAttributions []*types.SourceAttribution + + // An AI-generated message in a conversation. + SystemMessage *string + + // The identifier of an Amazon Q AI generated message within the conversation. + SystemMessageId *string + + // The identifier of an Amazon Q end user text input message within the + // conversation. + UserMessageId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationChatSyncMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpChatSync{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpChatSync{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ChatSync"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opChatSyncMiddleware(stack, options); err != nil { + return err + } + if err = addOpChatSyncValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opChatSync(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpChatSync struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpChatSync) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpChatSync) 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.(*ChatSyncInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *ChatSyncInput ") + } + + 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_opChatSyncMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpChatSync{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opChatSync(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ChatSync", + } +} diff --git a/service/qbusiness/api_op_CreateApplication.go b/service/qbusiness/api_op_CreateApplication.go new file mode 100644 index 00000000000..fdf3d05854d --- /dev/null +++ b/service/qbusiness/api_op_CreateApplication.go @@ -0,0 +1,202 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Q application. +func (c *Client) CreateApplication(ctx context.Context, params *CreateApplicationInput, optFns ...func(*Options)) (*CreateApplicationOutput, error) { + if params == nil { + params = &CreateApplicationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateApplication", params, optFns, c.addOperationCreateApplicationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateApplicationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateApplicationInput struct { + + // A name for the Amazon Q application. + // + // This member is required. + DisplayName *string + + // The Amazon Resource Name (ARN) of an IAM role with permissions to access your + // Amazon CloudWatch logs and metrics. + // + // This member is required. + RoleArn *string + + // An option to allow end users to upload files directly during chat. + AttachmentsConfiguration *types.AttachmentsConfiguration + + // A token that you provide to identify the request to create your Amazon Q + // application. + ClientToken *string + + // A description for the Amazon Q application. + Description *string + + // The identifier of the KMS key that is used to encrypt your data. Amazon Q + // doesn't support asymmetric keys. + EncryptionConfiguration *types.EncryptionConfiguration + + // A list of key-value pairs that identify or categorize your Amazon Q + // application. You can also use tags to help control access to the application. + // Tag keys and values can consist of Unicode letters, digits, white space, and any + // of the following symbols: _ . : / = + - @. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreateApplicationOutput struct { + + // The Amazon Resource Name (ARN) of the Amazon Q application. + ApplicationArn *string + + // The identifier of the Amazon Q application. + ApplicationId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateApplication{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateApplication{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateApplication"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateApplicationMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateApplicationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateApplication(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateApplication struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateApplication) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateApplication) 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.(*CreateApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateApplicationInput ") + } + + 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_opCreateApplicationMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateApplication{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateApplication(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateApplication", + } +} diff --git a/service/qbusiness/api_op_CreateDataSource.go b/service/qbusiness/api_op_CreateDataSource.go new file mode 100644 index 00000000000..ff10799d689 --- /dev/null +++ b/service/qbusiness/api_op_CreateDataSource.go @@ -0,0 +1,234 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a data source connector for an Amazon Q application. CreateDataSource +// is a synchronous operation. The operation returns 200 if the data source was +// successfully created. Otherwise, an exception is raised. +func (c *Client) CreateDataSource(ctx context.Context, params *CreateDataSourceInput, optFns ...func(*Options)) (*CreateDataSourceOutput, error) { + if params == nil { + params = &CreateDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateDataSource", params, optFns, c.addOperationCreateDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateDataSourceInput struct { + + // The identifier of the Amazon Q application the data source will be attached to. + // + // This member is required. + ApplicationId *string + + // Configuration information to connect to your data source repository. For + // configuration templates for your specific data source, see Supported connectors (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/connectors-list.html.html) + // . + // + // This member is required. + Configuration document.Interface + + // A name for the data source connector. + // + // This member is required. + DisplayName *string + + // The identifier of the index that you want to use with the data source connector. + // + // This member is required. + IndexId *string + + // A token you provide to identify a request to create a data source connector. + // Multiple calls to the CreateDataSource API with the same client token will + // create only one data source connector. + ClientToken *string + + // A description for the data source connector. + Description *string + + // Provides the configuration information for altering document metadata and + // content during the document ingestion process. For more information, see Custom + // document enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) + // . + DocumentEnrichmentConfiguration *types.DocumentEnrichmentConfiguration + + // The Amazon Resource Name (ARN) of an IAM role with permission to access the + // data source and required resources. + RoleArn *string + + // Sets the frequency for Amazon Q to check the documents in your data source + // repository and update your index. If you don't set a schedule, Amazon Q won't + // periodically update the index. Specify a cron- format schedule string or an + // empty string to indicate that the index is updated on demand. You can't specify + // the Schedule parameter when the Type parameter is set to CUSTOM . If you do, you + // receive a ValidationException exception. + SyncSchedule *string + + // A list of key-value pairs that identify or categorize the data source + // connector. You can also use tags to help control access to the data source + // connector. Tag keys and values can consist of Unicode letters, digits, white + // space, and any of the following symbols: _ . : / = + - @. + Tags []types.Tag + + // Configuration information for an Amazon VPC (Virtual Private Cloud) to connect + // to your data source. For more information, see Using Amazon VPC with Amazon Q + // connectors (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/connector-vpc.html) + // . + VpcConfiguration *types.DataSourceVpcConfiguration + + noSmithyDocumentSerde +} + +type CreateDataSourceOutput struct { + + // The Amazon Resource Name (ARN) of a data source in an Amazon Q application. + DataSourceArn *string + + // The identifier of the data source connector. + DataSourceId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateDataSourceMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateDataSource struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateDataSource) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateDataSource) 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.(*CreateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateDataSourceInput ") + } + + 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_opCreateDataSourceMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateDataSource{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateDataSource", + } +} diff --git a/service/qbusiness/api_op_CreateIndex.go b/service/qbusiness/api_op_CreateIndex.go new file mode 100644 index 00000000000..f348825f450 --- /dev/null +++ b/service/qbusiness/api_op_CreateIndex.go @@ -0,0 +1,204 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Q index. To determine if index creation has completed, check +// the Status field returned from a call to DescribeIndex . The Status field is +// set to ACTIVE when the index is ready to use. Once the index is active, you can +// index your documents using the BatchPutDocument (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_BatchPutDocument.html) +// API or the CreateDataSource (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CreateDataSource.html) +// API. +func (c *Client) CreateIndex(ctx context.Context, params *CreateIndexInput, optFns ...func(*Options)) (*CreateIndexOutput, error) { + if params == nil { + params = &CreateIndexInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateIndex", params, optFns, c.addOperationCreateIndexMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateIndexOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateIndexInput struct { + + // The identifier of the Amazon Q application using the index. + // + // This member is required. + ApplicationId *string + + // A name for the Amazon Q index. + // + // This member is required. + DisplayName *string + + // The capacity units you want to provision for your index. You can add and remove + // capacity to fit your usage needs. + CapacityConfiguration *types.IndexCapacityConfiguration + + // A token that you provide to identify the request to create an index. Multiple + // calls to the CreateIndex API with the same client token will create only one + // index. + ClientToken *string + + // A description for the Amazon Q index. + Description *string + + // A list of key-value pairs that identify or categorize the index. You can also + // use tags to help control access to the index. Tag keys and values can consist of + // Unicode letters, digits, white space, and any of the following symbols: _ . : / + // = + - @. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreateIndexOutput struct { + + // The Amazon Resource Name (ARN) of an Amazon Q index. + IndexArn *string + + // The identifier for the Amazon Q index. + IndexId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateIndexMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateIndex{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateIndex{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateIndex"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateIndexMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateIndexValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateIndex(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateIndex struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateIndex) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateIndex) 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.(*CreateIndexInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateIndexInput ") + } + + 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_opCreateIndexMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateIndex{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateIndex(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateIndex", + } +} diff --git a/service/qbusiness/api_op_CreatePlugin.go b/service/qbusiness/api_op_CreatePlugin.go new file mode 100644 index 00000000000..5eea5996639 --- /dev/null +++ b/service/qbusiness/api_op_CreatePlugin.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Q plugin. +func (c *Client) CreatePlugin(ctx context.Context, params *CreatePluginInput, optFns ...func(*Options)) (*CreatePluginOutput, error) { + if params == nil { + params = &CreatePluginInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreatePlugin", params, optFns, c.addOperationCreatePluginMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreatePluginOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreatePluginInput struct { + + // The identifier of the application that will contain the plugin. + // + // This member is required. + ApplicationId *string + + // Authentication configuration information for an Amazon Q plugin. + // + // This member is required. + AuthConfiguration types.PluginAuthConfiguration + + // A the name for your plugin. + // + // This member is required. + DisplayName *string + + // The source URL used for plugin configuration. + // + // This member is required. + ServerUrl *string + + // The type of plugin you want to create. + // + // This member is required. + Type types.PluginType + + // A token that you provide to identify the request to create your Amazon Q plugin. + ClientToken *string + + // A list of key-value pairs that identify or categorize the data source + // connector. You can also use tags to help control access to the data source + // connector. Tag keys and values can consist of Unicode letters, digits, white + // space, and any of the following symbols: _ . : / = + - @. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreatePluginOutput struct { + + // The Amazon Resource Name (ARN) of a plugin. + PluginArn *string + + // The identifier of the plugin created. + PluginId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreatePluginMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreatePlugin{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreatePlugin{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreatePlugin"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreatePluginMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreatePluginValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreatePlugin(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreatePlugin struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreatePlugin) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreatePlugin) 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.(*CreatePluginInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreatePluginInput ") + } + + 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_opCreatePluginMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreatePlugin{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreatePlugin(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreatePlugin", + } +} diff --git a/service/qbusiness/api_op_CreateRetriever.go b/service/qbusiness/api_op_CreateRetriever.go new file mode 100644 index 00000000000..6369fab205f --- /dev/null +++ b/service/qbusiness/api_op_CreateRetriever.go @@ -0,0 +1,206 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds a retriever to your Amazon Q application. +func (c *Client) CreateRetriever(ctx context.Context, params *CreateRetrieverInput, optFns ...func(*Options)) (*CreateRetrieverOutput, error) { + if params == nil { + params = &CreateRetrieverInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateRetriever", params, optFns, c.addOperationCreateRetrieverMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateRetrieverOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateRetrieverInput struct { + + // The identifier of your Amazon Q application. + // + // This member is required. + ApplicationId *string + + // Provides information on how the retriever used for your Amazon Q application is + // configured. + // + // This member is required. + Configuration types.RetrieverConfiguration + + // The name of your retriever. + // + // This member is required. + DisplayName *string + + // The type of retriever you are using. + // + // This member is required. + Type types.RetrieverType + + // A token that you provide to identify the request to create your Amazon Q + // application retriever. + ClientToken *string + + // The ARN of an IAM role used by Amazon Q to access the basic authentication + // credentials stored in a Secrets Manager secret. + RoleArn *string + + // A list of key-value pairs that identify or categorize the retriever. You can + // also use tags to help control access to the retriever. Tag keys and values can + // consist of Unicode letters, digits, white space, and any of the following + // symbols: _ . : / = + - @. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreateRetrieverOutput struct { + + // The Amazon Resource Name (ARN) of an IAM role associated with a retriever. + RetrieverArn *string + + // The identifier of the retriever you are using. + RetrieverId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateRetrieverMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateRetriever{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateRetriever{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateRetriever"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateRetrieverMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateRetrieverValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRetriever(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateRetriever struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateRetriever) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateRetriever) 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.(*CreateRetrieverInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateRetrieverInput ") + } + + 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_opCreateRetrieverMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateRetriever{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateRetriever(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateRetriever", + } +} diff --git a/service/qbusiness/api_op_CreateUser.go b/service/qbusiness/api_op_CreateUser.go new file mode 100644 index 00000000000..da1e0bf4eed --- /dev/null +++ b/service/qbusiness/api_op_CreateUser.go @@ -0,0 +1,182 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a universally unique identifier (UUID) mapped to a list of local user +// ids within an application. +func (c *Client) CreateUser(ctx context.Context, params *CreateUserInput, optFns ...func(*Options)) (*CreateUserOutput, error) { + if params == nil { + params = &CreateUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateUser", params, optFns, c.addOperationCreateUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateUserInput struct { + + // The identifier of the application for which the user mapping will be created. + // + // This member is required. + ApplicationId *string + + // The user emails attached to a user mapping. + // + // This member is required. + UserId *string + + // A token that you provide to identify the request to create your Amazon Q user + // mapping. + ClientToken *string + + // The list of user aliases in the mapping. + UserAliases []types.UserAlias + + noSmithyDocumentSerde +} + +type CreateUserOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateUser{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateUser"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateUserMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUser(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateUser struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateUser) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateUser) 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.(*CreateUserInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateUserInput ") + } + + 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_opCreateUserMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateUser{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateUser", + } +} diff --git a/service/qbusiness/api_op_CreateWebExperience.go b/service/qbusiness/api_op_CreateWebExperience.go new file mode 100644 index 00000000000..a2deb7090b4 --- /dev/null +++ b/service/qbusiness/api_op_CreateWebExperience.go @@ -0,0 +1,198 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Q web experience. +func (c *Client) CreateWebExperience(ctx context.Context, params *CreateWebExperienceInput, optFns ...func(*Options)) (*CreateWebExperienceOutput, error) { + if params == nil { + params = &CreateWebExperienceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateWebExperience", params, optFns, c.addOperationCreateWebExperienceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateWebExperienceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateWebExperienceInput struct { + + // The identifier of the Amazon Q web experience. + // + // This member is required. + ApplicationId *string + + // A token you provide to identify a request to create an Amazon Q web experience. + ClientToken *string + + // Determines whether sample prompts are enabled in the web experience for an end + // user. + SamplePromptsControlMode types.WebExperienceSamplePromptsControlMode + + // A subtitle to personalize your Amazon Q web experience. + Subtitle *string + + // A list of key-value pairs that identify or categorize your Amazon Q web + // experience. You can also use tags to help control access to the web experience. + // Tag keys and values can consist of Unicode letters, digits, white space, and any + // of the following symbols: _ . : / = + - @. + Tags []types.Tag + + // The title for your Amazon Q web experience. + Title *string + + // The customized welcome message for end users of an Amazon Q web experience. + WelcomeMessage *string + + noSmithyDocumentSerde +} + +type CreateWebExperienceOutput struct { + + // The Amazon Resource Name (ARN) of an Amazon Q web experience. + WebExperienceArn *string + + // The identifier of the Amazon Q web experience. + WebExperienceId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateWebExperienceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateWebExperience{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateWebExperience{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateWebExperience"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateWebExperienceMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateWebExperienceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateWebExperience(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateWebExperience struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateWebExperience) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateWebExperience) 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.(*CreateWebExperienceInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateWebExperienceInput ") + } + + 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_opCreateWebExperienceMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateWebExperience{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateWebExperience(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateWebExperience", + } +} diff --git a/service/qbusiness/api_op_DeleteApplication.go b/service/qbusiness/api_op_DeleteApplication.go new file mode 100644 index 00000000000..8088a3eb696 --- /dev/null +++ b/service/qbusiness/api_op_DeleteApplication.go @@ -0,0 +1,132 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q application. +func (c *Client) DeleteApplication(ctx context.Context, params *DeleteApplicationInput, optFns ...func(*Options)) (*DeleteApplicationOutput, error) { + if params == nil { + params = &DeleteApplicationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteApplication", params, optFns, c.addOperationDeleteApplicationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteApplicationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteApplicationInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + noSmithyDocumentSerde +} + +type DeleteApplicationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteApplication{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteApplication{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteApplication"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteApplicationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteApplication(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteApplication(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteApplication", + } +} diff --git a/service/qbusiness/api_op_DeleteChatControlsConfiguration.go b/service/qbusiness/api_op_DeleteChatControlsConfiguration.go new file mode 100644 index 00000000000..af07a014bc1 --- /dev/null +++ b/service/qbusiness/api_op_DeleteChatControlsConfiguration.go @@ -0,0 +1,132 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes chat controls configured for an existing Amazon Q application. +func (c *Client) DeleteChatControlsConfiguration(ctx context.Context, params *DeleteChatControlsConfigurationInput, optFns ...func(*Options)) (*DeleteChatControlsConfigurationOutput, error) { + if params == nil { + params = &DeleteChatControlsConfigurationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteChatControlsConfiguration", params, optFns, c.addOperationDeleteChatControlsConfigurationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteChatControlsConfigurationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteChatControlsConfigurationInput struct { + + // The identifier of the application the chat controls have been configured for. + // + // This member is required. + ApplicationId *string + + noSmithyDocumentSerde +} + +type DeleteChatControlsConfigurationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteChatControlsConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteChatControlsConfiguration"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteChatControlsConfigurationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteChatControlsConfiguration(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteChatControlsConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteChatControlsConfiguration", + } +} diff --git a/service/qbusiness/api_op_DeleteConversation.go b/service/qbusiness/api_op_DeleteConversation.go new file mode 100644 index 00000000000..2fa292271a2 --- /dev/null +++ b/service/qbusiness/api_op_DeleteConversation.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q web experience conversation. +func (c *Client) DeleteConversation(ctx context.Context, params *DeleteConversationInput, optFns ...func(*Options)) (*DeleteConversationOutput, error) { + if params == nil { + params = &DeleteConversationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteConversation", params, optFns, c.addOperationDeleteConversationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteConversationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteConversationInput struct { + + // The identifier of the Amazon Q application associated with the conversation. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q web experience conversation being deleted. + // + // This member is required. + ConversationId *string + + // The identifier of the user who is deleting the conversation. + // + // This member is required. + UserId *string + + noSmithyDocumentSerde +} + +type DeleteConversationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteConversationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteConversation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteConversation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteConversation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteConversationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteConversation(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteConversation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteConversation", + } +} diff --git a/service/qbusiness/api_op_DeleteDataSource.go b/service/qbusiness/api_op_DeleteDataSource.go new file mode 100644 index 00000000000..3e39319447c --- /dev/null +++ b/service/qbusiness/api_op_DeleteDataSource.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q data source connector. While the data source is being +// deleted, the Status field returned by a call to the DescribeDataSource API is +// set to DELETING . +func (c *Client) DeleteDataSource(ctx context.Context, params *DeleteDataSourceInput, optFns ...func(*Options)) (*DeleteDataSourceOutput, error) { + if params == nil { + params = &DeleteDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteDataSource", params, optFns, c.addOperationDeleteDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteDataSourceInput struct { + + // The identifier of the Amazon Q application used with the data source connector. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector that you want to delete. + // + // This member is required. + DataSourceId *string + + // The identifier of the index used with the data source connector. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type DeleteDataSourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteDataSource", + } +} diff --git a/service/qbusiness/api_op_DeleteGroup.go b/service/qbusiness/api_op_DeleteGroup.go new file mode 100644 index 00000000000..cf2c2d4a810 --- /dev/null +++ b/service/qbusiness/api_op_DeleteGroup.go @@ -0,0 +1,160 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a group so that all users and sub groups that belong to the group can +// no longer access documents only available to that group. For example, after +// deleting the group "Summer Interns", all interns who belonged to that group no +// longer see intern-only documents in their chat results. If you want to delete, +// update, or replace users or sub groups of a group, you need to use the PutGroup +// operation. For example, if a user in the group "Engineering" leaves the +// engineering team and another user takes their place, you provide an updated list +// of users or sub groups that belong to the "Engineering" group when calling +// PutGroup . +func (c *Client) DeleteGroup(ctx context.Context, params *DeleteGroupInput, optFns ...func(*Options)) (*DeleteGroupOutput, error) { + if params == nil { + params = &DeleteGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteGroup", params, optFns, c.addOperationDeleteGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteGroupInput struct { + + // The identifier of the application in which the group mapping belongs. + // + // This member is required. + ApplicationId *string + + // The name of the group you want to delete. + // + // This member is required. + GroupName *string + + // The identifier of the index you want to delete the group from. + // + // This member is required. + IndexId *string + + // The identifier of the data source linked to the group A group can be tied to + // multiple data sources. You can delete a group from accessing documents in a + // certain data source. For example, the groups "Research", "Engineering", and + // "Sales and Marketing" are all tied to the company's documents stored in the data + // sources Confluence and Salesforce. You want to delete "Research" and + // "Engineering" groups from Salesforce, so that these groups cannot access + // customer-related documents stored in Salesforce. Only "Sales and Marketing" + // should access documents in the Salesforce data source. + DataSourceId *string + + noSmithyDocumentSerde +} + +type DeleteGroupOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteGroup", + } +} diff --git a/service/qbusiness/api_op_DeleteIndex.go b/service/qbusiness/api_op_DeleteIndex.go new file mode 100644 index 00000000000..03dc5c4ff9b --- /dev/null +++ b/service/qbusiness/api_op_DeleteIndex.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q index. +func (c *Client) DeleteIndex(ctx context.Context, params *DeleteIndexInput, optFns ...func(*Options)) (*DeleteIndexOutput, error) { + if params == nil { + params = &DeleteIndexInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteIndex", params, optFns, c.addOperationDeleteIndexMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteIndexOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteIndexInput struct { + + // The identifier of the Amazon Q application the Amazon Q index is linked to. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q index. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type DeleteIndexOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteIndexMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteIndex{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteIndex{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteIndex"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteIndexValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteIndex(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteIndex(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteIndex", + } +} diff --git a/service/qbusiness/api_op_DeletePlugin.go b/service/qbusiness/api_op_DeletePlugin.go new file mode 100644 index 00000000000..ffa24d8200a --- /dev/null +++ b/service/qbusiness/api_op_DeletePlugin.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q plugin. +func (c *Client) DeletePlugin(ctx context.Context, params *DeletePluginInput, optFns ...func(*Options)) (*DeletePluginOutput, error) { + if params == nil { + params = &DeletePluginInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeletePlugin", params, optFns, c.addOperationDeletePluginMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeletePluginOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeletePluginInput struct { + + // The identifier the application attached to the Amazon Q plugin. + // + // This member is required. + ApplicationId *string + + // The identifier of the plugin being deleted. + // + // This member is required. + PluginId *string + + noSmithyDocumentSerde +} + +type DeletePluginOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeletePluginMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeletePlugin{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeletePlugin{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeletePlugin"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeletePluginValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeletePlugin(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeletePlugin(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeletePlugin", + } +} diff --git a/service/qbusiness/api_op_DeleteRetriever.go b/service/qbusiness/api_op_DeleteRetriever.go new file mode 100644 index 00000000000..13543b79d7d --- /dev/null +++ b/service/qbusiness/api_op_DeleteRetriever.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the retriever used by an Amazon Q application. +func (c *Client) DeleteRetriever(ctx context.Context, params *DeleteRetrieverInput, optFns ...func(*Options)) (*DeleteRetrieverOutput, error) { + if params == nil { + params = &DeleteRetrieverInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteRetriever", params, optFns, c.addOperationDeleteRetrieverMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteRetrieverOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteRetrieverInput struct { + + // The identifier of the Amazon Q application using the retriever. + // + // This member is required. + ApplicationId *string + + // The identifier of the retriever being deleted. + // + // This member is required. + RetrieverId *string + + noSmithyDocumentSerde +} + +type DeleteRetrieverOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteRetrieverMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteRetriever{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteRetriever{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteRetriever"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteRetrieverValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRetriever(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteRetriever(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteRetriever", + } +} diff --git a/service/qbusiness/api_op_DeleteUser.go b/service/qbusiness/api_op_DeleteUser.go new file mode 100644 index 00000000000..a2b71e7ca7e --- /dev/null +++ b/service/qbusiness/api_op_DeleteUser.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a user by email id. +func (c *Client) DeleteUser(ctx context.Context, params *DeleteUserInput, optFns ...func(*Options)) (*DeleteUserOutput, error) { + if params == nil { + params = &DeleteUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteUser", params, optFns, c.addOperationDeleteUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteUserInput struct { + + // The identifier of the application from which the user is being deleted. + // + // This member is required. + ApplicationId *string + + // The user email being deleted. + // + // This member is required. + UserId *string + + noSmithyDocumentSerde +} + +type DeleteUserOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteUser{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteUser"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteUser(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteUser", + } +} diff --git a/service/qbusiness/api_op_DeleteWebExperience.go b/service/qbusiness/api_op_DeleteWebExperience.go new file mode 100644 index 00000000000..1c396fae205 --- /dev/null +++ b/service/qbusiness/api_op_DeleteWebExperience.go @@ -0,0 +1,138 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an Amazon Q web experience. +func (c *Client) DeleteWebExperience(ctx context.Context, params *DeleteWebExperienceInput, optFns ...func(*Options)) (*DeleteWebExperienceOutput, error) { + if params == nil { + params = &DeleteWebExperienceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteWebExperience", params, optFns, c.addOperationDeleteWebExperienceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteWebExperienceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteWebExperienceInput struct { + + // The identifier of the Amazon Q application linked to the Amazon Q web + // experience. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q web experience being deleted. + // + // This member is required. + WebExperienceId *string + + noSmithyDocumentSerde +} + +type DeleteWebExperienceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteWebExperienceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteWebExperience{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteWebExperience{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteWebExperience"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteWebExperienceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteWebExperience(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteWebExperience(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteWebExperience", + } +} diff --git a/service/qbusiness/api_op_GetApplication.go b/service/qbusiness/api_op_GetApplication.go new file mode 100644 index 00000000000..8cc0c3f17b2 --- /dev/null +++ b/service/qbusiness/api_op_GetApplication.go @@ -0,0 +1,171 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing Amazon Q application. +func (c *Client) GetApplication(ctx context.Context, params *GetApplicationInput, optFns ...func(*Options)) (*GetApplicationOutput, error) { + if params == nil { + params = &GetApplicationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetApplication", params, optFns, c.addOperationGetApplicationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetApplicationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetApplicationInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + noSmithyDocumentSerde +} + +type GetApplicationOutput struct { + + // The Amazon Resource Name (ARN) of the Amazon Q application. + ApplicationArn *string + + // The identifier of the Amazon Q application. + ApplicationId *string + + // Settings for whether end users can upload files directly during chat. + AttachmentsConfiguration *types.AppliedAttachmentsConfiguration + + // The Unix timestamp when the Amazon Q application was last updated. + CreatedAt *time.Time + + // A description for the Amazon Q application. + Description *string + + // The name of the Amazon Q application. + DisplayName *string + + // The identifier of the Amazon Web Services KMS key that is used to encrypt your + // data. Amazon Q doesn't support asymmetric keys. + EncryptionConfiguration *types.EncryptionConfiguration + + // If the Status field is set to ERROR , the ErrorMessage field contains a + // description of the error that caused the synchronization to fail. + Error *types.ErrorDetail + + // The Amazon Resource Name (ARN) of the IAM with permissions to access your + // CloudWatch logs and metrics. + RoleArn *string + + // The status of the Amazon Q application. + Status types.ApplicationStatus + + // The Unix timestamp when the Amazon Q application was last updated. + UpdatedAt *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetApplication{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetApplication{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetApplication"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetApplicationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetApplication(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetApplication(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetApplication", + } +} diff --git a/service/qbusiness/api_op_GetChatControlsConfiguration.go b/service/qbusiness/api_op_GetChatControlsConfiguration.go new file mode 100644 index 00000000000..4bc63374521 --- /dev/null +++ b/service/qbusiness/api_op_GetChatControlsConfiguration.go @@ -0,0 +1,253 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets information about an chat controls configured for an existing Amazon Q +// application. +func (c *Client) GetChatControlsConfiguration(ctx context.Context, params *GetChatControlsConfigurationInput, optFns ...func(*Options)) (*GetChatControlsConfigurationOutput, error) { + if params == nil { + params = &GetChatControlsConfigurationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetChatControlsConfiguration", params, optFns, c.addOperationGetChatControlsConfigurationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetChatControlsConfigurationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetChatControlsConfigurationInput struct { + + // The identifier of the application for which the chat controls are configured. + // + // This member is required. + ApplicationId *string + + // The maximum number of configured chat controls to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q chat controls configured. + NextToken *string + + noSmithyDocumentSerde +} + +type GetChatControlsConfigurationOutput struct { + + // The phrases blocked from chat by your chat control configuration. + BlockedPhrases *types.BlockedPhrasesConfiguration + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q chat controls configured. + NextToken *string + + // The response scope configured for a Amazon Q application. This determines + // whether your application uses its retrieval augmented generation (RAG) system to + // generate answers only from your enterprise data, or also uses the large language + // models (LLM) knowledge to respons to end user questions in chat. + ResponseScope types.ResponseScope + + // The topic specific controls configured for a Amazon Q application. + TopicConfigurations []types.TopicConfiguration + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetChatControlsConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetChatControlsConfiguration"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetChatControlsConfigurationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetChatControlsConfiguration(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// GetChatControlsConfigurationAPIClient is a client that implements the +// GetChatControlsConfiguration operation. +type GetChatControlsConfigurationAPIClient interface { + GetChatControlsConfiguration(context.Context, *GetChatControlsConfigurationInput, ...func(*Options)) (*GetChatControlsConfigurationOutput, error) +} + +var _ GetChatControlsConfigurationAPIClient = (*Client)(nil) + +// GetChatControlsConfigurationPaginatorOptions is the paginator options for +// GetChatControlsConfiguration +type GetChatControlsConfigurationPaginatorOptions struct { + // The maximum number of configured chat controls to return. + 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 +} + +// GetChatControlsConfigurationPaginator is a paginator for +// GetChatControlsConfiguration +type GetChatControlsConfigurationPaginator struct { + options GetChatControlsConfigurationPaginatorOptions + client GetChatControlsConfigurationAPIClient + params *GetChatControlsConfigurationInput + nextToken *string + firstPage bool +} + +// NewGetChatControlsConfigurationPaginator returns a new +// GetChatControlsConfigurationPaginator +func NewGetChatControlsConfigurationPaginator(client GetChatControlsConfigurationAPIClient, params *GetChatControlsConfigurationInput, optFns ...func(*GetChatControlsConfigurationPaginatorOptions)) *GetChatControlsConfigurationPaginator { + if params == nil { + params = &GetChatControlsConfigurationInput{} + } + + options := GetChatControlsConfigurationPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &GetChatControlsConfigurationPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *GetChatControlsConfigurationPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next GetChatControlsConfiguration page. +func (p *GetChatControlsConfigurationPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetChatControlsConfigurationOutput, 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.GetChatControlsConfiguration(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_opGetChatControlsConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetChatControlsConfiguration", + } +} diff --git a/service/qbusiness/api_op_GetDataSource.go b/service/qbusiness/api_op_GetDataSource.go new file mode 100644 index 00000000000..ebf5c77bae9 --- /dev/null +++ b/service/qbusiness/api_op_GetDataSource.go @@ -0,0 +1,202 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing Amazon Q data source connector. +func (c *Client) GetDataSource(ctx context.Context, params *GetDataSourceInput, optFns ...func(*Options)) (*GetDataSourceOutput, error) { + if params == nil { + params = &GetDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetDataSource", params, optFns, c.addOperationGetDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetDataSourceInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector. + // + // This member is required. + DataSourceId *string + + // The identfier of the index used with the data source connector. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type GetDataSourceOutput struct { + + // The identifier of the Amazon Q application. + ApplicationId *string + + // The details of how the data source connector is configured. + Configuration document.Interface + + // The Unix timestamp when the data source connector was created. + CreatedAt *time.Time + + // The Amazon Resource Name (ARN) of the data source. + DataSourceArn *string + + // The identifier of the data source connector. + DataSourceId *string + + // The description for the data source connector. + Description *string + + // The name for the data source connector. + DisplayName *string + + // Provides the configuration information for altering document metadata and + // content during the document ingestion process. For more information, see Custom + // document enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) + // . + DocumentEnrichmentConfiguration *types.DocumentEnrichmentConfiguration + + // When the Status field value is FAILED , the ErrorMessage field contains a + // description of the error that caused the data source connector to fail. + Error *types.ErrorDetail + + // The identifier of the index linked to the data source connector. + IndexId *string + + // The Amazon Resource Name (ARN) of the role with permission to access the data + // source and required resources. + RoleArn *string + + // The current status of the data source connector. When the Status field value is + // FAILED , the ErrorMessage field contains a description of the error that caused + // the data source connector to fail. + Status types.DataSourceStatus + + // The schedule for Amazon Q to update the index. + SyncSchedule *string + + // The type of the data source connector. For example, S3 . + Type *string + + // The Unix timestamp when the data source connector was last updated. + UpdatedAt *time.Time + + // Configuration information for an Amazon VPC (Virtual Private Cloud) to connect + // to your data source. + VpcConfiguration *types.DataSourceVpcConfiguration + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetDataSource", + } +} diff --git a/service/qbusiness/api_op_GetGroup.go b/service/qbusiness/api_op_GetGroup.go new file mode 100644 index 00000000000..1c31b62a816 --- /dev/null +++ b/service/qbusiness/api_op_GetGroup.go @@ -0,0 +1,153 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Describes a group by group name. +func (c *Client) GetGroup(ctx context.Context, params *GetGroupInput, optFns ...func(*Options)) (*GetGroupOutput, error) { + if params == nil { + params = &GetGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetGroup", params, optFns, c.addOperationGetGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetGroupInput struct { + + // The identifier of the application id the group is attached to. + // + // This member is required. + ApplicationId *string + + // The name of the group. + // + // This member is required. + GroupName *string + + // The identifier of the index the group is attached to. + // + // This member is required. + IndexId *string + + // The identifier of the data source the group is attached to. + DataSourceId *string + + noSmithyDocumentSerde +} + +type GetGroupOutput struct { + + // The current status of the group. + Status *types.GroupStatusDetail + + // The status history of the group. + StatusHistory []types.GroupStatusDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetGroup", + } +} diff --git a/service/qbusiness/api_op_GetIndex.go b/service/qbusiness/api_op_GetIndex.go new file mode 100644 index 00000000000..8e0ce42d05d --- /dev/null +++ b/service/qbusiness/api_op_GetIndex.go @@ -0,0 +1,183 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing Amazon Q index. +func (c *Client) GetIndex(ctx context.Context, params *GetIndexInput, optFns ...func(*Options)) (*GetIndexOutput, error) { + if params == nil { + params = &GetIndexInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetIndex", params, optFns, c.addOperationGetIndexMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetIndexOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetIndexInput struct { + + // The identifier of the Amazon Q application connected to the index. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q index you want information on. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type GetIndexOutput struct { + + // The identifier of the Amazon Q application associated with the index. + ApplicationId *string + + // The storage capacity units chosen for your Amazon Q index. + CapacityConfiguration *types.IndexCapacityConfiguration + + // The Unix timestamp when the Amazon Q index was created. + CreatedAt *time.Time + + // The description for the Amazon Q index. + Description *string + + // The name of the Amazon Q index. + DisplayName *string + + // Configuration information for document attributes or metadata. Document + // metadata are fields associated with your documents. For example, the company + // department name associated with each document. For more information, see + // Understanding document attributes (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/doc-attributes-types.html#doc-attributes) + // . + DocumentAttributeConfigurations []types.DocumentAttributeConfiguration + + // When the Status field value is FAILED , the ErrorMessage field contains a + // message that explains why. + Error *types.ErrorDetail + + // The Amazon Resource Name (ARN) of the Amazon Q index. + IndexArn *string + + // The identifier of the Amazon Q index. + IndexId *string + + // Provides information about the number of documents indexed. + IndexStatistics *types.IndexStatistics + + // The current status of the index. When the value is ACTIVE , the index is ready + // for use. If the Status field value is FAILED , the ErrorMessage field contains + // a message that explains why. + Status types.IndexStatus + + // The Unix timestamp when the Amazon Q index was last updated. + UpdatedAt *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetIndexMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetIndex{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetIndex{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetIndex"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetIndexValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetIndex(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetIndex(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetIndex", + } +} diff --git a/service/qbusiness/api_op_GetPlugin.go b/service/qbusiness/api_op_GetPlugin.go new file mode 100644 index 00000000000..37771f42758 --- /dev/null +++ b/service/qbusiness/api_op_GetPlugin.go @@ -0,0 +1,171 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing Amazon Q plugin. +func (c *Client) GetPlugin(ctx context.Context, params *GetPluginInput, optFns ...func(*Options)) (*GetPluginOutput, error) { + if params == nil { + params = &GetPluginInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetPlugin", params, optFns, c.addOperationGetPluginMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetPluginOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetPluginInput struct { + + // The identifier of the application which contains the plugin. + // + // This member is required. + ApplicationId *string + + // The identifier of the plugin. + // + // This member is required. + PluginId *string + + noSmithyDocumentSerde +} + +type GetPluginOutput struct { + + // The identifier of the application which contains the plugin. + ApplicationId *string + + // Authentication configuration information for an Amazon Q plugin. + AuthConfiguration types.PluginAuthConfiguration + + // The timestamp for when the plugin was created. + CreatedAt *time.Time + + // The name of the plugin. + DisplayName *string + + // The Amazon Resource Name (ARN) of the role with permission to access resources + // needed to create the plugin. + PluginArn *string + + // The identifier of the plugin. + PluginId *string + + // The source URL used for plugin configuration. + ServerUrl *string + + // The current state of the plugin. + State types.PluginState + + // The type of the plugin. + Type types.PluginType + + // The timestamp for when the plugin was last updated. + UpdatedAt *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetPluginMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPlugin{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPlugin{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetPlugin"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetPluginValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPlugin(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetPlugin(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetPlugin", + } +} diff --git a/service/qbusiness/api_op_GetRetriever.go b/service/qbusiness/api_op_GetRetriever.go new file mode 100644 index 00000000000..e2436f72a3f --- /dev/null +++ b/service/qbusiness/api_op_GetRetriever.go @@ -0,0 +1,172 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing retriever used by an Amazon Q application. +func (c *Client) GetRetriever(ctx context.Context, params *GetRetrieverInput, optFns ...func(*Options)) (*GetRetrieverOutput, error) { + if params == nil { + params = &GetRetrieverInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRetriever", params, optFns, c.addOperationGetRetrieverMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRetrieverOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRetrieverInput struct { + + // The identifier of the Amazon Q application using the retriever. + // + // This member is required. + ApplicationId *string + + // The identifier of the retriever. + // + // This member is required. + RetrieverId *string + + noSmithyDocumentSerde +} + +type GetRetrieverOutput struct { + + // The identifier of the Amazon Q application using the retriever. + ApplicationId *string + + // Provides information on how the retriever used for your Amazon Q application is + // configured. + Configuration types.RetrieverConfiguration + + // The Unix timestamp when the retriever was created. + CreatedAt *time.Time + + // The name of the retriever. + DisplayName *string + + // The Amazon Resource Name (ARN) of the IAM role associated with the retriever. + RetrieverArn *string + + // The identifier of the retriever. + RetrieverId *string + + // The Amazon Resource Name (ARN) of the role with the permission to access the + // retriever and required resources. + RoleArn *string + + // The status of the retriever. + Status types.RetrieverStatus + + // The type of the retriever. + Type types.RetrieverType + + // The Unix timestamp when the retriever was last updated. + UpdatedAt *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRetrieverMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRetriever{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRetriever{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetRetriever"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetRetrieverValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRetriever(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetRetriever(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetRetriever", + } +} diff --git a/service/qbusiness/api_op_GetUser.go b/service/qbusiness/api_op_GetUser.go new file mode 100644 index 00000000000..a93ce33b016 --- /dev/null +++ b/service/qbusiness/api_op_GetUser.go @@ -0,0 +1,143 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Describes the universally unique identifier (UUID) associated with a local user +// in a data source. +func (c *Client) GetUser(ctx context.Context, params *GetUserInput, optFns ...func(*Options)) (*GetUserOutput, error) { + if params == nil { + params = &GetUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetUser", params, optFns, c.addOperationGetUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetUserInput struct { + + // The identifier of the application connected to the user. + // + // This member is required. + ApplicationId *string + + // The user email address attached to the user. + // + // This member is required. + UserId *string + + noSmithyDocumentSerde +} + +type GetUserOutput struct { + + // A list of user aliases attached to a user. + UserAliases []types.UserAlias + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetUser{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetUser"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetUser(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetUser", + } +} diff --git a/service/qbusiness/api_op_GetWebExperience.go b/service/qbusiness/api_op_GetWebExperience.go new file mode 100644 index 00000000000..3b3c84a3e37 --- /dev/null +++ b/service/qbusiness/api_op_GetWebExperience.go @@ -0,0 +1,184 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets information about an existing Amazon Q web experience. +func (c *Client) GetWebExperience(ctx context.Context, params *GetWebExperienceInput, optFns ...func(*Options)) (*GetWebExperienceOutput, error) { + if params == nil { + params = &GetWebExperienceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetWebExperience", params, optFns, c.addOperationGetWebExperienceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetWebExperienceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetWebExperienceInput struct { + + // The identifier of the Amazon Q application linked to the web experience. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q web experience. + // + // This member is required. + WebExperienceId *string + + noSmithyDocumentSerde +} + +type GetWebExperienceOutput struct { + + // The identifier of the Amazon Q application linked to the web experience. + ApplicationId *string + + // The authentication configuration information for your Amazon Q web experience. + AuthenticationConfiguration types.WebExperienceAuthConfiguration + + // The Unix timestamp when the retriever was created. + CreatedAt *time.Time + + // The endpoint of your Amazon Q web experience. + DefaultEndpoint *string + + // When the Status field value is FAILED , the ErrorMessage field contains a + // description of the error that caused the data source connector to fail. + Error *types.ErrorDetail + + // Determines whether sample prompts are enabled in the web experience for an end + // user. + SamplePromptsControlMode types.WebExperienceSamplePromptsControlMode + + // The current status of the Amazon Q web experience. When the Status field value + // is FAILED , the ErrorMessage field contains a description of the error that + // caused the data source connector to fail. + Status types.WebExperienceStatus + + // The subtitle for your Amazon Q web experience. + Subtitle *string + + // The title for your Amazon Q web experience. + Title *string + + // The Unix timestamp when the data source connector was last updated. + UpdatedAt *time.Time + + // The Amazon Resource Name (ARN) of the role with the permission to access the + // Amazon Q web experience and required resources. + WebExperienceArn *string + + // The identifier of the Amazon Q web experience. + WebExperienceId *string + + // The customized welcome message for end users of an Amazon Q web experience. + WelcomeMessage *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetWebExperienceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetWebExperience{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetWebExperience{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetWebExperience"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetWebExperienceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetWebExperience(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetWebExperience(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetWebExperience", + } +} diff --git a/service/qbusiness/api_op_ListApplications.go b/service/qbusiness/api_op_ListApplications.go new file mode 100644 index 00000000000..44c88df2e3a --- /dev/null +++ b/service/qbusiness/api_op_ListApplications.go @@ -0,0 +1,232 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists Amazon Q applications. +func (c *Client) ListApplications(ctx context.Context, params *ListApplicationsInput, optFns ...func(*Options)) (*ListApplicationsOutput, error) { + if params == nil { + params = &ListApplicationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListApplications", params, optFns, c.addOperationListApplicationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListApplicationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListApplicationsInput struct { + + // The maximum number of Amazon Q applications to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q applications. + NextToken *string + + noSmithyDocumentSerde +} + +type ListApplicationsOutput struct { + + // An array of summary information on the configuration of one or more Amazon Q + // applications. + Applications []types.Application + + // If the response is truncated, Amazon Q returns this token. You can use this + // token in a subsequent request to retrieve the next set of applications. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListApplicationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListApplications{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListApplications{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListApplications"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListApplications(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListApplicationsAPIClient is a client that implements the ListApplications +// operation. +type ListApplicationsAPIClient interface { + ListApplications(context.Context, *ListApplicationsInput, ...func(*Options)) (*ListApplicationsOutput, error) +} + +var _ ListApplicationsAPIClient = (*Client)(nil) + +// ListApplicationsPaginatorOptions is the paginator options for ListApplications +type ListApplicationsPaginatorOptions struct { + // The maximum number of Amazon Q applications to return. + 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 +} + +// ListApplicationsPaginator is a paginator for ListApplications +type ListApplicationsPaginator struct { + options ListApplicationsPaginatorOptions + client ListApplicationsAPIClient + params *ListApplicationsInput + nextToken *string + firstPage bool +} + +// NewListApplicationsPaginator returns a new ListApplicationsPaginator +func NewListApplicationsPaginator(client ListApplicationsAPIClient, params *ListApplicationsInput, optFns ...func(*ListApplicationsPaginatorOptions)) *ListApplicationsPaginator { + if params == nil { + params = &ListApplicationsInput{} + } + + options := ListApplicationsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListApplicationsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListApplicationsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListApplications page. +func (p *ListApplicationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListApplicationsOutput, 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.ListApplications(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_opListApplications(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListApplications", + } +} diff --git a/service/qbusiness/api_op_ListConversations.go b/service/qbusiness/api_op_ListConversations.go new file mode 100644 index 00000000000..ecf3d0e7028 --- /dev/null +++ b/service/qbusiness/api_op_ListConversations.go @@ -0,0 +1,245 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists one or more Amazon Q conversations. +func (c *Client) ListConversations(ctx context.Context, params *ListConversationsInput, optFns ...func(*Options)) (*ListConversationsOutput, error) { + if params == nil { + params = &ListConversationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListConversations", params, optFns, c.addOperationListConversationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListConversationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListConversationsInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // The identifier of the user involved in the Amazon Q web experience conversation. + // + // This member is required. + UserId *string + + // The maximum number of Amazon Q conversations to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q conversations. + NextToken *string + + noSmithyDocumentSerde +} + +type ListConversationsOutput struct { + + // An array of summary information on the configuration of one or more Amazon Q + // web experiences. + Conversations []types.Conversation + + // If the response is truncated, Amazon Q returns this token, which you can use in + // a later request to list the next set of messages. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListConversationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListConversations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListConversations{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListConversations"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListConversationsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListConversations(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListConversationsAPIClient is a client that implements the ListConversations +// operation. +type ListConversationsAPIClient interface { + ListConversations(context.Context, *ListConversationsInput, ...func(*Options)) (*ListConversationsOutput, error) +} + +var _ ListConversationsAPIClient = (*Client)(nil) + +// ListConversationsPaginatorOptions is the paginator options for ListConversations +type ListConversationsPaginatorOptions struct { + // The maximum number of Amazon Q conversations to return. + 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 +} + +// ListConversationsPaginator is a paginator for ListConversations +type ListConversationsPaginator struct { + options ListConversationsPaginatorOptions + client ListConversationsAPIClient + params *ListConversationsInput + nextToken *string + firstPage bool +} + +// NewListConversationsPaginator returns a new ListConversationsPaginator +func NewListConversationsPaginator(client ListConversationsAPIClient, params *ListConversationsInput, optFns ...func(*ListConversationsPaginatorOptions)) *ListConversationsPaginator { + if params == nil { + params = &ListConversationsInput{} + } + + options := ListConversationsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListConversationsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListConversationsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListConversations page. +func (p *ListConversationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListConversationsOutput, 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.ListConversations(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_opListConversations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListConversations", + } +} diff --git a/service/qbusiness/api_op_ListDataSourceSyncJobs.go b/service/qbusiness/api_op_ListDataSourceSyncJobs.go new file mode 100644 index 00000000000..d7ddac39e27 --- /dev/null +++ b/service/qbusiness/api_op_ListDataSourceSyncJobs.go @@ -0,0 +1,261 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Get information about an Amazon Q data source connector synchronization. +func (c *Client) ListDataSourceSyncJobs(ctx context.Context, params *ListDataSourceSyncJobsInput, optFns ...func(*Options)) (*ListDataSourceSyncJobsOutput, error) { + if params == nil { + params = &ListDataSourceSyncJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListDataSourceSyncJobs", params, optFns, c.addOperationListDataSourceSyncJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListDataSourceSyncJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListDataSourceSyncJobsInput struct { + + // The identifier of the Amazon Q application connected to the data source. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector. + // + // This member is required. + DataSourceId *string + + // The identifier of the index used with the Amazon Q data source connector. + // + // This member is required. + IndexId *string + + // The end time of the data source connector sync. + EndTime *time.Time + + // The maximum number of synchronization jobs to return in the response. + MaxResults *int32 + + // If the maxResults response was incpmplete because there is more data to + // retriever, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of responses. + NextToken *string + + // The start time of the data source connector sync. + StartTime *time.Time + + // Only returns synchronization jobs with the Status field equal to the specified + // status. + StatusFilter types.DataSourceSyncJobStatus + + noSmithyDocumentSerde +} + +type ListDataSourceSyncJobsOutput struct { + + // A history of synchronization jobs for the data source connector. + History []types.DataSourceSyncJob + + // If the response is truncated, Amazon Q returns this token. You can use this + // token in any subsequent request to retrieve the next set of jobs. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListDataSourceSyncJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListDataSourceSyncJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListDataSourceSyncJobs{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListDataSourceSyncJobs"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListDataSourceSyncJobsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDataSourceSyncJobs(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListDataSourceSyncJobsAPIClient is a client that implements the +// ListDataSourceSyncJobs operation. +type ListDataSourceSyncJobsAPIClient interface { + ListDataSourceSyncJobs(context.Context, *ListDataSourceSyncJobsInput, ...func(*Options)) (*ListDataSourceSyncJobsOutput, error) +} + +var _ ListDataSourceSyncJobsAPIClient = (*Client)(nil) + +// ListDataSourceSyncJobsPaginatorOptions is the paginator options for +// ListDataSourceSyncJobs +type ListDataSourceSyncJobsPaginatorOptions struct { + // The maximum number of synchronization jobs to return in the response. + 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 +} + +// ListDataSourceSyncJobsPaginator is a paginator for ListDataSourceSyncJobs +type ListDataSourceSyncJobsPaginator struct { + options ListDataSourceSyncJobsPaginatorOptions + client ListDataSourceSyncJobsAPIClient + params *ListDataSourceSyncJobsInput + nextToken *string + firstPage bool +} + +// NewListDataSourceSyncJobsPaginator returns a new ListDataSourceSyncJobsPaginator +func NewListDataSourceSyncJobsPaginator(client ListDataSourceSyncJobsAPIClient, params *ListDataSourceSyncJobsInput, optFns ...func(*ListDataSourceSyncJobsPaginatorOptions)) *ListDataSourceSyncJobsPaginator { + if params == nil { + params = &ListDataSourceSyncJobsInput{} + } + + options := ListDataSourceSyncJobsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListDataSourceSyncJobsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListDataSourceSyncJobsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListDataSourceSyncJobs page. +func (p *ListDataSourceSyncJobsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDataSourceSyncJobsOutput, 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.ListDataSourceSyncJobs(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_opListDataSourceSyncJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListDataSourceSyncJobs", + } +} diff --git a/service/qbusiness/api_op_ListDataSources.go b/service/qbusiness/api_op_ListDataSources.go new file mode 100644 index 00000000000..aae1e6a039b --- /dev/null +++ b/service/qbusiness/api_op_ListDataSources.go @@ -0,0 +1,245 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the Amazon Q data source connectors that you have created. +func (c *Client) ListDataSources(ctx context.Context, params *ListDataSourcesInput, optFns ...func(*Options)) (*ListDataSourcesOutput, error) { + if params == nil { + params = &ListDataSourcesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListDataSources", params, optFns, c.addOperationListDataSourcesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListDataSourcesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListDataSourcesInput struct { + + // The identifier of the Amazon Q application linked to the data source connectors. + // + // This member is required. + ApplicationId *string + + // The identifier of the index used with one or more data source connectors. + // + // This member is required. + IndexId *string + + // The maximum number of data source connectors to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q data source connectors. + NextToken *string + + noSmithyDocumentSerde +} + +type ListDataSourcesOutput struct { + + // An array of summary information for one or more data source connector. + DataSources []types.DataSource + + // If the response is truncated, Amazon Q returns this token. You can use this + // token in a subsequent request to retrieve the next set of data source + // connectors. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListDataSourcesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListDataSources{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListDataSources{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListDataSources"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListDataSourcesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDataSources(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListDataSourcesAPIClient is a client that implements the ListDataSources +// operation. +type ListDataSourcesAPIClient interface { + ListDataSources(context.Context, *ListDataSourcesInput, ...func(*Options)) (*ListDataSourcesOutput, error) +} + +var _ ListDataSourcesAPIClient = (*Client)(nil) + +// ListDataSourcesPaginatorOptions is the paginator options for ListDataSources +type ListDataSourcesPaginatorOptions struct { + // The maximum number of data source connectors to return. + 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 +} + +// ListDataSourcesPaginator is a paginator for ListDataSources +type ListDataSourcesPaginator struct { + options ListDataSourcesPaginatorOptions + client ListDataSourcesAPIClient + params *ListDataSourcesInput + nextToken *string + firstPage bool +} + +// NewListDataSourcesPaginator returns a new ListDataSourcesPaginator +func NewListDataSourcesPaginator(client ListDataSourcesAPIClient, params *ListDataSourcesInput, optFns ...func(*ListDataSourcesPaginatorOptions)) *ListDataSourcesPaginator { + if params == nil { + params = &ListDataSourcesInput{} + } + + options := ListDataSourcesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListDataSourcesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListDataSourcesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListDataSources page. +func (p *ListDataSourcesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDataSourcesOutput, 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.ListDataSources(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_opListDataSources(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListDataSources", + } +} diff --git a/service/qbusiness/api_op_ListDocuments.go b/service/qbusiness/api_op_ListDocuments.go new file mode 100644 index 00000000000..d80ec6662d6 --- /dev/null +++ b/service/qbusiness/api_op_ListDocuments.go @@ -0,0 +1,247 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// A list of documents attached to an index. +func (c *Client) ListDocuments(ctx context.Context, params *ListDocumentsInput, optFns ...func(*Options)) (*ListDocumentsOutput, error) { + if params == nil { + params = &ListDocumentsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListDocuments", params, optFns, c.addOperationListDocumentsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListDocumentsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListDocumentsInput struct { + + // The identifier of the application id the documents are attached to. + // + // This member is required. + ApplicationId *string + + // The identifier of the index the documents are attached to. + // + // This member is required. + IndexId *string + + // The identifier of the data sources the documents are attached to. + DataSourceIds []string + + // The maximum number of documents to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of documents. + NextToken *string + + noSmithyDocumentSerde +} + +type ListDocumentsOutput struct { + + // A list of document details. + DocumentDetailList []types.DocumentDetails + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of documents. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListDocumentsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListDocuments{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListDocuments{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListDocuments"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListDocumentsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDocuments(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListDocumentsAPIClient is a client that implements the ListDocuments operation. +type ListDocumentsAPIClient interface { + ListDocuments(context.Context, *ListDocumentsInput, ...func(*Options)) (*ListDocumentsOutput, error) +} + +var _ ListDocumentsAPIClient = (*Client)(nil) + +// ListDocumentsPaginatorOptions is the paginator options for ListDocuments +type ListDocumentsPaginatorOptions struct { + // The maximum number of documents to return. + 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 +} + +// ListDocumentsPaginator is a paginator for ListDocuments +type ListDocumentsPaginator struct { + options ListDocumentsPaginatorOptions + client ListDocumentsAPIClient + params *ListDocumentsInput + nextToken *string + firstPage bool +} + +// NewListDocumentsPaginator returns a new ListDocumentsPaginator +func NewListDocumentsPaginator(client ListDocumentsAPIClient, params *ListDocumentsInput, optFns ...func(*ListDocumentsPaginatorOptions)) *ListDocumentsPaginator { + if params == nil { + params = &ListDocumentsInput{} + } + + options := ListDocumentsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListDocumentsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListDocumentsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListDocuments page. +func (p *ListDocumentsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDocumentsOutput, 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.ListDocuments(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_opListDocuments(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListDocuments", + } +} diff --git a/service/qbusiness/api_op_ListGroups.go b/service/qbusiness/api_op_ListGroups.go new file mode 100644 index 00000000000..080a9136df5 --- /dev/null +++ b/service/qbusiness/api_op_ListGroups.go @@ -0,0 +1,254 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Provides a list of groups that are mapped to users. +func (c *Client) ListGroups(ctx context.Context, params *ListGroupsInput, optFns ...func(*Options)) (*ListGroupsOutput, error) { + if params == nil { + params = &ListGroupsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListGroups", params, optFns, c.addOperationListGroupsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListGroupsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListGroupsInput struct { + + // The identifier of the application for getting a list of groups mapped to users. + // + // This member is required. + ApplicationId *string + + // The identifier of the index for getting a list of groups mapped to users. + // + // This member is required. + IndexId *string + + // The timestamp identifier used for the latest PUT or DELETE action for mapping + // users to their groups. + // + // This member is required. + UpdatedEarlierThan *time.Time + + // The identifier of the data source for getting a list of groups mapped to users. + DataSourceId *string + + // The maximum number of returned groups that are mapped to users. + MaxResults *int32 + + // If the previous response was incomplete (because there is more data to + // retrieve), Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of groups that are mapped to users. + NextToken *string + + noSmithyDocumentSerde +} + +type ListGroupsOutput struct { + + // Summary information for list of groups that are mapped to users. + Items []types.GroupSummary + + // If the response is truncated, Amazon Q returns this token that you can use in + // the subsequent request to retrieve the next set of groups that are mapped to + // users. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListGroups{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListGroups{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListGroups"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListGroupsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGroups(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListGroupsAPIClient is a client that implements the ListGroups operation. +type ListGroupsAPIClient interface { + ListGroups(context.Context, *ListGroupsInput, ...func(*Options)) (*ListGroupsOutput, error) +} + +var _ ListGroupsAPIClient = (*Client)(nil) + +// ListGroupsPaginatorOptions is the paginator options for ListGroups +type ListGroupsPaginatorOptions struct { + // The maximum number of returned groups that are mapped to users. + 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 +} + +// ListGroupsPaginator is a paginator for ListGroups +type ListGroupsPaginator struct { + options ListGroupsPaginatorOptions + client ListGroupsAPIClient + params *ListGroupsInput + nextToken *string + firstPage bool +} + +// NewListGroupsPaginator returns a new ListGroupsPaginator +func NewListGroupsPaginator(client ListGroupsAPIClient, params *ListGroupsInput, optFns ...func(*ListGroupsPaginatorOptions)) *ListGroupsPaginator { + if params == nil { + params = &ListGroupsInput{} + } + + options := ListGroupsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListGroupsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListGroupsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListGroups page. +func (p *ListGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGroupsOutput, 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.ListGroups(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_opListGroups(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListGroups", + } +} diff --git a/service/qbusiness/api_op_ListIndices.go b/service/qbusiness/api_op_ListIndices.go new file mode 100644 index 00000000000..031b642cad7 --- /dev/null +++ b/service/qbusiness/api_op_ListIndices.go @@ -0,0 +1,238 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the Amazon Q indices you have created. +func (c *Client) ListIndices(ctx context.Context, params *ListIndicesInput, optFns ...func(*Options)) (*ListIndicesOutput, error) { + if params == nil { + params = &ListIndicesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListIndices", params, optFns, c.addOperationListIndicesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListIndicesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListIndicesInput struct { + + // The identifier of the Amazon Q application connected to the index. + // + // This member is required. + ApplicationId *string + + // The maximum number of indices to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q indices. + NextToken *string + + noSmithyDocumentSerde +} + +type ListIndicesOutput struct { + + // An array of information on the items in one or more indexes. + Indices []types.Index + + // If the response is truncated, Amazon Q returns this token that you can use in + // the subsequent request to retrieve the next set of indexes. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListIndicesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListIndices{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListIndices{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListIndices"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListIndicesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListIndices(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListIndicesAPIClient is a client that implements the ListIndices operation. +type ListIndicesAPIClient interface { + ListIndices(context.Context, *ListIndicesInput, ...func(*Options)) (*ListIndicesOutput, error) +} + +var _ ListIndicesAPIClient = (*Client)(nil) + +// ListIndicesPaginatorOptions is the paginator options for ListIndices +type ListIndicesPaginatorOptions struct { + // The maximum number of indices to return. + 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 +} + +// ListIndicesPaginator is a paginator for ListIndices +type ListIndicesPaginator struct { + options ListIndicesPaginatorOptions + client ListIndicesAPIClient + params *ListIndicesInput + nextToken *string + firstPage bool +} + +// NewListIndicesPaginator returns a new ListIndicesPaginator +func NewListIndicesPaginator(client ListIndicesAPIClient, params *ListIndicesInput, optFns ...func(*ListIndicesPaginatorOptions)) *ListIndicesPaginator { + if params == nil { + params = &ListIndicesInput{} + } + + options := ListIndicesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListIndicesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListIndicesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListIndices page. +func (p *ListIndicesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListIndicesOutput, 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.ListIndices(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_opListIndices(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListIndices", + } +} diff --git a/service/qbusiness/api_op_ListMessages.go b/service/qbusiness/api_op_ListMessages.go new file mode 100644 index 00000000000..01000ce0a6c --- /dev/null +++ b/service/qbusiness/api_op_ListMessages.go @@ -0,0 +1,247 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a list of messages associated with an Amazon Q web experience. +func (c *Client) ListMessages(ctx context.Context, params *ListMessagesInput, optFns ...func(*Options)) (*ListMessagesOutput, error) { + if params == nil { + params = &ListMessagesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListMessages", params, optFns, c.addOperationListMessagesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListMessagesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListMessagesInput struct { + + // The identifier for the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q web experience conversation. + // + // This member is required. + ConversationId *string + + // The identifier of the user involved in the Amazon Q web experience conversation. + // + // This member is required. + UserId *string + + // The maximum number of messages to return. + MaxResults *int32 + + // If the number of retrievers returned exceeds maxResults , Amazon Q returns a + // next token as a pagination token to retrieve the next set of messages. + NextToken *string + + noSmithyDocumentSerde +} + +type ListMessagesOutput struct { + + // An array of information on one or more messages. + Messages []types.Message + + // If the response is truncated, Amazon Q returns this token, which you can use in + // a later request to list the next set of messages. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListMessagesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListMessages{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMessages{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListMessages"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListMessagesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMessages(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListMessagesAPIClient is a client that implements the ListMessages operation. +type ListMessagesAPIClient interface { + ListMessages(context.Context, *ListMessagesInput, ...func(*Options)) (*ListMessagesOutput, error) +} + +var _ ListMessagesAPIClient = (*Client)(nil) + +// ListMessagesPaginatorOptions is the paginator options for ListMessages +type ListMessagesPaginatorOptions struct { + // The maximum number of messages to return. + 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 +} + +// ListMessagesPaginator is a paginator for ListMessages +type ListMessagesPaginator struct { + options ListMessagesPaginatorOptions + client ListMessagesAPIClient + params *ListMessagesInput + nextToken *string + firstPage bool +} + +// NewListMessagesPaginator returns a new ListMessagesPaginator +func NewListMessagesPaginator(client ListMessagesAPIClient, params *ListMessagesInput, optFns ...func(*ListMessagesPaginatorOptions)) *ListMessagesPaginator { + if params == nil { + params = &ListMessagesInput{} + } + + options := ListMessagesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListMessagesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListMessagesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListMessages page. +func (p *ListMessagesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListMessagesOutput, 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.ListMessages(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_opListMessages(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListMessages", + } +} diff --git a/service/qbusiness/api_op_ListPlugins.go b/service/qbusiness/api_op_ListPlugins.go new file mode 100644 index 00000000000..878923d6dc0 --- /dev/null +++ b/service/qbusiness/api_op_ListPlugins.go @@ -0,0 +1,239 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists configured Amazon Q plugins. +func (c *Client) ListPlugins(ctx context.Context, params *ListPluginsInput, optFns ...func(*Options)) (*ListPluginsOutput, error) { + if params == nil { + params = &ListPluginsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListPlugins", params, optFns, c.addOperationListPluginsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListPluginsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListPluginsInput struct { + + // The identifier of the application the plugin is attached to. + // + // This member is required. + ApplicationId *string + + // The maximum number of documents to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of plugins. + NextToken *string + + noSmithyDocumentSerde +} + +type ListPluginsOutput struct { + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of plugins. + NextToken *string + + // Information about a configured plugin. + Plugins []types.Plugin + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListPluginsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListPlugins{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListPlugins{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListPlugins"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListPluginsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPlugins(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListPluginsAPIClient is a client that implements the ListPlugins operation. +type ListPluginsAPIClient interface { + ListPlugins(context.Context, *ListPluginsInput, ...func(*Options)) (*ListPluginsOutput, error) +} + +var _ ListPluginsAPIClient = (*Client)(nil) + +// ListPluginsPaginatorOptions is the paginator options for ListPlugins +type ListPluginsPaginatorOptions struct { + // The maximum number of documents to return. + 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 +} + +// ListPluginsPaginator is a paginator for ListPlugins +type ListPluginsPaginator struct { + options ListPluginsPaginatorOptions + client ListPluginsAPIClient + params *ListPluginsInput + nextToken *string + firstPage bool +} + +// NewListPluginsPaginator returns a new ListPluginsPaginator +func NewListPluginsPaginator(client ListPluginsAPIClient, params *ListPluginsInput, optFns ...func(*ListPluginsPaginatorOptions)) *ListPluginsPaginator { + if params == nil { + params = &ListPluginsInput{} + } + + options := ListPluginsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListPluginsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListPluginsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListPlugins page. +func (p *ListPluginsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListPluginsOutput, 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.ListPlugins(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_opListPlugins(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListPlugins", + } +} diff --git a/service/qbusiness/api_op_ListRetrievers.go b/service/qbusiness/api_op_ListRetrievers.go new file mode 100644 index 00000000000..1ee10889e90 --- /dev/null +++ b/service/qbusiness/api_op_ListRetrievers.go @@ -0,0 +1,238 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the retriever used by an Amazon Q application. +func (c *Client) ListRetrievers(ctx context.Context, params *ListRetrieversInput, optFns ...func(*Options)) (*ListRetrieversOutput, error) { + if params == nil { + params = &ListRetrieversInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListRetrievers", params, optFns, c.addOperationListRetrieversMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListRetrieversOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListRetrieversInput struct { + + // The identifier of the Amazon Q application using the retriever. + // + // This member is required. + ApplicationId *string + + // The maximum number of retrievers returned. + MaxResults *int32 + + // If the number of retrievers returned exceeds maxResults , Amazon Q returns a + // next token as a pagination token to retrieve the next set of retrievers. + NextToken *string + + noSmithyDocumentSerde +} + +type ListRetrieversOutput struct { + + // If the response is truncated, Amazon Q returns this token, which you can use in + // a later request to list the next set of retrievers. + NextToken *string + + // An array of summary information for one or more retrievers. + Retrievers []types.Retriever + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListRetrieversMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListRetrievers{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListRetrievers{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListRetrievers"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListRetrieversValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRetrievers(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListRetrieversAPIClient is a client that implements the ListRetrievers +// operation. +type ListRetrieversAPIClient interface { + ListRetrievers(context.Context, *ListRetrieversInput, ...func(*Options)) (*ListRetrieversOutput, error) +} + +var _ ListRetrieversAPIClient = (*Client)(nil) + +// ListRetrieversPaginatorOptions is the paginator options for ListRetrievers +type ListRetrieversPaginatorOptions struct { + // The maximum number of retrievers returned. + 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 +} + +// ListRetrieversPaginator is a paginator for ListRetrievers +type ListRetrieversPaginator struct { + options ListRetrieversPaginatorOptions + client ListRetrieversAPIClient + params *ListRetrieversInput + nextToken *string + firstPage bool +} + +// NewListRetrieversPaginator returns a new ListRetrieversPaginator +func NewListRetrieversPaginator(client ListRetrieversAPIClient, params *ListRetrieversInput, optFns ...func(*ListRetrieversPaginatorOptions)) *ListRetrieversPaginator { + if params == nil { + params = &ListRetrieversInput{} + } + + options := ListRetrieversPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListRetrieversPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListRetrieversPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListRetrievers page. +func (p *ListRetrieversPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRetrieversOutput, 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.ListRetrievers(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_opListRetrievers(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListRetrievers", + } +} diff --git a/service/qbusiness/api_op_ListTagsForResource.go b/service/qbusiness/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..c009dcd38b0 --- /dev/null +++ b/service/qbusiness/api_op_ListTagsForResource.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a list of tags associated with a specified resource. Amazon Q applications +// and data sources can have tags associated with them. +func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { + if params == nil { + params = &ListTagsForResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTagsForResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTagsForResourceInput struct { + + // The Amazon Resource Name (ARN) of the Amazon Q application or data source to + // get a list of tags for. + // + // This member is required. + ResourceARN *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // A list of tags associated with the Amazon Q application or data source. + Tags []types.Tag + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListTagsForResource", + } +} diff --git a/service/qbusiness/api_op_ListWebExperiences.go b/service/qbusiness/api_op_ListWebExperiences.go new file mode 100644 index 00000000000..3a6fc47e4ee --- /dev/null +++ b/service/qbusiness/api_op_ListWebExperiences.go @@ -0,0 +1,240 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists one or more Amazon Q Web Experiences. +func (c *Client) ListWebExperiences(ctx context.Context, params *ListWebExperiencesInput, optFns ...func(*Options)) (*ListWebExperiencesOutput, error) { + if params == nil { + params = &ListWebExperiencesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListWebExperiences", params, optFns, c.addOperationListWebExperiencesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListWebExperiencesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListWebExperiencesInput struct { + + // The identifier of the Amazon Q application linked to the listed web experiences. + // + // This member is required. + ApplicationId *string + + // The maximum number of Amazon Q Web Experiences to return. + MaxResults *int32 + + // If the maxResults response was incomplete because there is more data to + // retrieve, Amazon Q returns a pagination token in the response. You can use this + // pagination token to retrieve the next set of Amazon Q conversations. + NextToken *string + + noSmithyDocumentSerde +} + +type ListWebExperiencesOutput struct { + + // If the response is truncated, Amazon Q returns this token, which you can use in + // a later request to list the next set of messages. + NextToken *string + + // An array of summary information for one or more Amazon Q experiences. + WebExperiences []types.WebExperience + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListWebExperiencesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListWebExperiences{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListWebExperiences{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListWebExperiences"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListWebExperiencesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListWebExperiences(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListWebExperiencesAPIClient is a client that implements the ListWebExperiences +// operation. +type ListWebExperiencesAPIClient interface { + ListWebExperiences(context.Context, *ListWebExperiencesInput, ...func(*Options)) (*ListWebExperiencesOutput, error) +} + +var _ ListWebExperiencesAPIClient = (*Client)(nil) + +// ListWebExperiencesPaginatorOptions is the paginator options for +// ListWebExperiences +type ListWebExperiencesPaginatorOptions struct { + // The maximum number of Amazon Q Web Experiences to return. + 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 +} + +// ListWebExperiencesPaginator is a paginator for ListWebExperiences +type ListWebExperiencesPaginator struct { + options ListWebExperiencesPaginatorOptions + client ListWebExperiencesAPIClient + params *ListWebExperiencesInput + nextToken *string + firstPage bool +} + +// NewListWebExperiencesPaginator returns a new ListWebExperiencesPaginator +func NewListWebExperiencesPaginator(client ListWebExperiencesAPIClient, params *ListWebExperiencesInput, optFns ...func(*ListWebExperiencesPaginatorOptions)) *ListWebExperiencesPaginator { + if params == nil { + params = &ListWebExperiencesInput{} + } + + options := ListWebExperiencesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListWebExperiencesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListWebExperiencesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListWebExperiences page. +func (p *ListWebExperiencesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListWebExperiencesOutput, 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.ListWebExperiences(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_opListWebExperiences(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListWebExperiences", + } +} diff --git a/service/qbusiness/api_op_PutFeedback.go b/service/qbusiness/api_op_PutFeedback.go new file mode 100644 index 00000000000..3fcc4e0710a --- /dev/null +++ b/service/qbusiness/api_op_PutFeedback.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Enables your end user to to provide feedback on their Amazon Q generated chat +// responses. +func (c *Client) PutFeedback(ctx context.Context, params *PutFeedbackInput, optFns ...func(*Options)) (*PutFeedbackOutput, error) { + if params == nil { + params = &PutFeedbackInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutFeedback", params, optFns, c.addOperationPutFeedbackMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutFeedbackOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutFeedbackInput struct { + + // The identifier of the application associated with the feedback. + // + // This member is required. + ApplicationId *string + + // The identifier of the conversation the feedback is attached to. + // + // This member is required. + ConversationId *string + + // The identifier of the chat message that the feedback was given for. + // + // This member is required. + MessageId *string + + // The identifier of the user giving the feedback. + // + // This member is required. + UserId *string + + // The timestamp for when the feedback was recorded. + MessageCopiedAt *time.Time + + // The feedback usefulness value given by the user to the chat message. + MessageUsefulness *types.MessageUsefulnessFeedback + + noSmithyDocumentSerde +} + +type PutFeedbackOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutFeedbackMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpPutFeedback{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPutFeedback{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PutFeedback"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpPutFeedbackValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutFeedback(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opPutFeedback(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PutFeedback", + } +} diff --git a/service/qbusiness/api_op_PutGroup.go b/service/qbusiness/api_op_PutGroup.go new file mode 100644 index 00000000000..25b905864e2 --- /dev/null +++ b/service/qbusiness/api_op_PutGroup.go @@ -0,0 +1,175 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Create, or updates, a mapping of users—who have access to a document—to groups. +// You can also map sub groups to groups. For example, the group "Company +// Intellectual Property Teams" includes sub groups "Research" and "Engineering". +// These sub groups include their own list of users or people who work in these +// teams. Only users who work in research and engineering, and therefore belong in +// the intellectual property group, can see top-secret company documents in their +// Amazon Q chat results. +func (c *Client) PutGroup(ctx context.Context, params *PutGroupInput, optFns ...func(*Options)) (*PutGroupOutput, error) { + if params == nil { + params = &PutGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutGroup", params, optFns, c.addOperationPutGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutGroupInput struct { + + // The identifier of the application in which the user and group mapping belongs. + // + // This member is required. + ApplicationId *string + + // A list of users or sub groups that belong to a group. This is for generating + // Amazon Q chat results only from document a user has access to. + // + // This member is required. + GroupMembers *types.GroupMembers + + // The list that contains your users or sub groups that belong the same group. For + // example, the group "Company" includes the user "CEO" and the sub groups + // "Research", "Engineering", and "Sales and Marketing". If you have more than 1000 + // users and/or sub groups for a single group, you need to provide the path to the + // S3 file that lists your users and sub groups for a group. Your sub groups can + // contain more than 1000 users, but the list of sub groups that belong to a group + // (and/or users) must be no more than 1000. + // + // This member is required. + GroupName *string + + // The identifier of the index in which you want to map users to their groups. + // + // This member is required. + IndexId *string + + // The type of the group. + // + // This member is required. + Type types.MembershipType + + // The identifier of the data source for which you want to map users to their + // groups. This is useful if a group is tied to multiple data sources, but you only + // want the group to access documents of a certain data source. For example, the + // groups "Research", "Engineering", and "Sales and Marketing" are all tied to the + // company's documents stored in the data sources Confluence and Salesforce. + // However, "Sales and Marketing" team only needs access to customer-related + // documents stored in Salesforce. + DataSourceId *string + + noSmithyDocumentSerde +} + +type PutGroupOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpPutGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPutGroup{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PutGroup"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpPutGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutGroup(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opPutGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PutGroup", + } +} diff --git a/service/qbusiness/api_op_StartDataSourceSyncJob.go b/service/qbusiness/api_op_StartDataSourceSyncJob.go new file mode 100644 index 00000000000..5653bff0c1d --- /dev/null +++ b/service/qbusiness/api_op_StartDataSourceSyncJob.go @@ -0,0 +1,147 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Starts a data source connector synchronization job. If a synchronization job is +// already in progress, Amazon Q returns a ConflictException . +func (c *Client) StartDataSourceSyncJob(ctx context.Context, params *StartDataSourceSyncJobInput, optFns ...func(*Options)) (*StartDataSourceSyncJobOutput, error) { + if params == nil { + params = &StartDataSourceSyncJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartDataSourceSyncJob", params, optFns, c.addOperationStartDataSourceSyncJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartDataSourceSyncJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartDataSourceSyncJobInput struct { + + // The identifier of Amazon Q application the data source is connected to. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector. + // + // This member is required. + DataSourceId *string + + // The identifier of the index used with the data source connector. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type StartDataSourceSyncJobOutput struct { + + // The identifier for a particular synchronization job. + ExecutionId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartDataSourceSyncJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartDataSourceSyncJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartDataSourceSyncJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartDataSourceSyncJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpStartDataSourceSyncJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDataSourceSyncJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartDataSourceSyncJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartDataSourceSyncJob", + } +} diff --git a/service/qbusiness/api_op_StopDataSourceSyncJob.go b/service/qbusiness/api_op_StopDataSourceSyncJob.go new file mode 100644 index 00000000000..f565715d3e9 --- /dev/null +++ b/service/qbusiness/api_op_StopDataSourceSyncJob.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Stops an Amazon Q data source connector synchronization job already in progress. +func (c *Client) StopDataSourceSyncJob(ctx context.Context, params *StopDataSourceSyncJobInput, optFns ...func(*Options)) (*StopDataSourceSyncJobOutput, error) { + if params == nil { + params = &StopDataSourceSyncJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StopDataSourceSyncJob", params, optFns, c.addOperationStopDataSourceSyncJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StopDataSourceSyncJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StopDataSourceSyncJobInput struct { + + // The identifier of the Amazon Q application that the data source is connected to. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector. + // + // This member is required. + DataSourceId *string + + // The identifier of the index used with the Amazon Q data source connector. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +type StopDataSourceSyncJobOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStopDataSourceSyncJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStopDataSourceSyncJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStopDataSourceSyncJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StopDataSourceSyncJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpStopDataSourceSyncJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopDataSourceSyncJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStopDataSourceSyncJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StopDataSourceSyncJob", + } +} diff --git a/service/qbusiness/api_op_TagResource.go b/service/qbusiness/api_op_TagResource.go new file mode 100644 index 00000000000..2b2a615b720 --- /dev/null +++ b/service/qbusiness/api_op_TagResource.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds the specified tag to the specified Amazon Q application or data source +// resource. If the tag already exists, the existing value is replaced with the new +// value. +func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { + if params == nil { + params = &TagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*TagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type TagResourceInput struct { + + // The Amazon Resource Name (ARN) of the Amazon Q application or data source to + // tag. + // + // This member is required. + ResourceARN *string + + // A list of tag keys to add to the Amazon Q application or data source. If a tag + // already exists, the existing value is replaced with the new value. + // + // This member is required. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type TagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "TagResource", + } +} diff --git a/service/qbusiness/api_op_UntagResource.go b/service/qbusiness/api_op_UntagResource.go new file mode 100644 index 00000000000..95fdc0f3a29 --- /dev/null +++ b/service/qbusiness/api_op_UntagResource.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes a tag from an Amazon Q application or a data source. +func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { + if params == nil { + params = &UntagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UntagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UntagResourceInput struct { + + // The Amazon Resource Name (ARN) of the Amazon Q application, or data source to + // remove the tag from. + // + // This member is required. + ResourceARN *string + + // A list of tag keys to remove from the Amazon Q application or data source. If a + // tag key does not exist on the resource, it is ignored. + // + // 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UntagResource", + } +} diff --git a/service/qbusiness/api_op_UpdateApplication.go b/service/qbusiness/api_op_UpdateApplication.go new file mode 100644 index 00000000000..114ec3721ca --- /dev/null +++ b/service/qbusiness/api_op_UpdateApplication.go @@ -0,0 +1,146 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Amazon Q application. +func (c *Client) UpdateApplication(ctx context.Context, params *UpdateApplicationInput, optFns ...func(*Options)) (*UpdateApplicationOutput, error) { + if params == nil { + params = &UpdateApplicationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateApplication", params, optFns, c.addOperationUpdateApplicationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateApplicationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateApplicationInput struct { + + // The identifier of the Amazon Q application. + // + // This member is required. + ApplicationId *string + + // An option to allow end users to upload files directly during chat. + AttachmentsConfiguration *types.AttachmentsConfiguration + + // A description for the Amazon Q application. + Description *string + + // A name for the Amazon Q application. + DisplayName *string + + // An Amazon Web Services Identity and Access Management (IAM) role that gives + // Amazon Q permission to access Amazon CloudWatch logs and metrics. + RoleArn *string + + noSmithyDocumentSerde +} + +type UpdateApplicationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateApplication{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateApplication{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateApplication"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateApplicationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateApplication(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateApplication(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateApplication", + } +} diff --git a/service/qbusiness/api_op_UpdateChatControlsConfiguration.go b/service/qbusiness/api_op_UpdateChatControlsConfiguration.go new file mode 100644 index 00000000000..bb41804afa4 --- /dev/null +++ b/service/qbusiness/api_op_UpdateChatControlsConfiguration.go @@ -0,0 +1,188 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an set of chat controls configured for an existing Amazon Q application. +func (c *Client) UpdateChatControlsConfiguration(ctx context.Context, params *UpdateChatControlsConfigurationInput, optFns ...func(*Options)) (*UpdateChatControlsConfigurationOutput, error) { + if params == nil { + params = &UpdateChatControlsConfigurationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateChatControlsConfiguration", params, optFns, c.addOperationUpdateChatControlsConfigurationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateChatControlsConfigurationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateChatControlsConfigurationInput struct { + + // The identifier of the application for which the chat controls are configured. + // + // This member is required. + ApplicationId *string + + // The phrases blocked from chat by your chat control configuration. + BlockedPhrasesConfigurationUpdate *types.BlockedPhrasesConfigurationUpdate + + // A token that you provide to identify the request to update a Amazon Q + // application chat configuration. + ClientToken *string + + // The response scope configured for your application. This determines whether + // your application uses its retrieval augmented generation (RAG) system to + // generate answers only from your enterprise data, or also uses the large language + // models (LLM) knowledge to respons to end user questions in chat. + ResponseScope types.ResponseScope + + // The configured topic specific chat controls you want to update. + TopicConfigurationsToCreateOrUpdate []types.TopicConfiguration + + // The configured topic specific chat controls you want to delete. + TopicConfigurationsToDelete []types.TopicConfiguration + + noSmithyDocumentSerde +} + +type UpdateChatControlsConfigurationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateChatControlsConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateChatControlsConfiguration{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateChatControlsConfiguration"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opUpdateChatControlsConfigurationMiddleware(stack, options); err != nil { + return err + } + if err = addOpUpdateChatControlsConfigurationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateChatControlsConfiguration(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpUpdateChatControlsConfiguration struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpUpdateChatControlsConfiguration) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpUpdateChatControlsConfiguration) 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.(*UpdateChatControlsConfigurationInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *UpdateChatControlsConfigurationInput ") + } + + 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_opUpdateChatControlsConfigurationMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpUpdateChatControlsConfiguration{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opUpdateChatControlsConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateChatControlsConfiguration", + } +} diff --git a/service/qbusiness/api_op_UpdateDataSource.go b/service/qbusiness/api_op_UpdateDataSource.go new file mode 100644 index 00000000000..25b5d874c63 --- /dev/null +++ b/service/qbusiness/api_op_UpdateDataSource.go @@ -0,0 +1,170 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Amazon Q data source connector. +func (c *Client) UpdateDataSource(ctx context.Context, params *UpdateDataSourceInput, optFns ...func(*Options)) (*UpdateDataSourceOutput, error) { + if params == nil { + params = &UpdateDataSourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateDataSource", params, optFns, c.addOperationUpdateDataSourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateDataSourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateDataSourceInput struct { + + // The identifier of the Amazon Q application the data source is attached to. + // + // This member is required. + ApplicationId *string + + // The identifier of the data source connector. + // + // This member is required. + DataSourceId *string + + // The identifier of the index attached to the data source connector. + // + // This member is required. + IndexId *string + + // Provides the configuration information for an Amazon Q data source. + Configuration document.Interface + + // The description of the data source connector. + Description *string + + // A name of the data source connector. + DisplayName *string + + // Provides the configuration information for altering document metadata and + // content during the document ingestion process. For more information, see Custom + // document enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) + // . + DocumentEnrichmentConfiguration *types.DocumentEnrichmentConfiguration + + // The Amazon Resource Name (ARN) of an IAM role with permission to access the + // data source and required resources. + RoleArn *string + + // The chosen update frequency for your data source. + SyncSchedule *string + + // Provides configuration information needed to connect to an Amazon VPC (Virtual + // Private Cloud). + VpcConfiguration *types.DataSourceVpcConfiguration + + noSmithyDocumentSerde +} + +type UpdateDataSourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateDataSource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateDataSource{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateDataSource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateDataSourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateDataSource(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateDataSource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateDataSource", + } +} diff --git a/service/qbusiness/api_op_UpdateIndex.go b/service/qbusiness/api_op_UpdateIndex.go new file mode 100644 index 00000000000..87ffa0eeb70 --- /dev/null +++ b/service/qbusiness/api_op_UpdateIndex.go @@ -0,0 +1,155 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an Amazon Q index. +func (c *Client) UpdateIndex(ctx context.Context, params *UpdateIndexInput, optFns ...func(*Options)) (*UpdateIndexOutput, error) { + if params == nil { + params = &UpdateIndexInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateIndex", params, optFns, c.addOperationUpdateIndexMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateIndexOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateIndexInput struct { + + // The identifier of the Amazon Q application connected to the index. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q index. + // + // This member is required. + IndexId *string + + // The storage capacity units you want to provision for your Amazon Q index. You + // can add and remove capacity to fit your usage needs. + CapacityConfiguration *types.IndexCapacityConfiguration + + // The description of the Amazon Q index. + Description *string + + // The name of the Amazon Q index. + DisplayName *string + + // Configuration information for document metadata or fields. Document metadata + // are fields or attributes associated with your documents. For example, the + // company department name associated with each document. For more information, see + // Understanding document attributes (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/doc-attributes-types.html#doc-attributes) + // . + DocumentAttributeConfigurations []types.DocumentAttributeConfiguration + + noSmithyDocumentSerde +} + +type UpdateIndexOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateIndexMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateIndex{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateIndex{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateIndex"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateIndexValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIndex(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateIndex(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateIndex", + } +} diff --git a/service/qbusiness/api_op_UpdatePlugin.go b/service/qbusiness/api_op_UpdatePlugin.go new file mode 100644 index 00000000000..c0a8e48dcd4 --- /dev/null +++ b/service/qbusiness/api_op_UpdatePlugin.go @@ -0,0 +1,150 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an Amazon Q plugin. +func (c *Client) UpdatePlugin(ctx context.Context, params *UpdatePluginInput, optFns ...func(*Options)) (*UpdatePluginOutput, error) { + if params == nil { + params = &UpdatePluginInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdatePlugin", params, optFns, c.addOperationUpdatePluginMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdatePluginOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdatePluginInput struct { + + // The identifier of the application the plugin is attached to. + // + // This member is required. + ApplicationId *string + + // The identifier of the plugin. + // + // This member is required. + PluginId *string + + // The authentication configuration the plugin is using. + AuthConfiguration types.PluginAuthConfiguration + + // The name of the plugin. + DisplayName *string + + // The source URL used for plugin configuration. + ServerUrl *string + + // The status of the plugin. + State types.PluginState + + noSmithyDocumentSerde +} + +type UpdatePluginOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdatePluginMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdatePlugin{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdatePlugin{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdatePlugin"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdatePluginValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdatePlugin(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdatePlugin(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdatePlugin", + } +} diff --git a/service/qbusiness/api_op_UpdateRetriever.go b/service/qbusiness/api_op_UpdateRetriever.go new file mode 100644 index 00000000000..0980233a946 --- /dev/null +++ b/service/qbusiness/api_op_UpdateRetriever.go @@ -0,0 +1,149 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates the retriever used for your Amazon Q application. +func (c *Client) UpdateRetriever(ctx context.Context, params *UpdateRetrieverInput, optFns ...func(*Options)) (*UpdateRetrieverOutput, error) { + if params == nil { + params = &UpdateRetrieverInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateRetriever", params, optFns, c.addOperationUpdateRetrieverMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateRetrieverOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateRetrieverInput struct { + + // The identifier of your Amazon Q application. + // + // This member is required. + ApplicationId *string + + // The identifier of your retriever. + // + // This member is required. + RetrieverId *string + + // Provides information on how the retriever used for your Amazon Q application is + // configured. + Configuration types.RetrieverConfiguration + + // The name of your retriever. + DisplayName *string + + // The Amazon Resource Name (ARN) of an IAM role with permission to access the + // retriever and required resources. + RoleArn *string + + noSmithyDocumentSerde +} + +type UpdateRetrieverOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateRetrieverMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateRetriever{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateRetriever{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateRetriever"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateRetrieverValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRetriever(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateRetriever(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateRetriever", + } +} diff --git a/service/qbusiness/api_op_UpdateUser.go b/service/qbusiness/api_op_UpdateUser.go new file mode 100644 index 00000000000..e8d78453266 --- /dev/null +++ b/service/qbusiness/api_op_UpdateUser.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates a information associated with a user id. +func (c *Client) UpdateUser(ctx context.Context, params *UpdateUserInput, optFns ...func(*Options)) (*UpdateUserOutput, error) { + if params == nil { + params = &UpdateUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateUser", params, optFns, c.addOperationUpdateUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateUserInput struct { + + // The identifier of the application the user is attached to. + // + // This member is required. + ApplicationId *string + + // The email id attached to the user. + // + // This member is required. + UserId *string + + // The user aliases attached to the user id that are to be deleted. + UserAliasesToDelete []types.UserAlias + + // The user aliases attached to the user id that are to be updated. + UserAliasesToUpdate []types.UserAlias + + noSmithyDocumentSerde +} + +type UpdateUserOutput struct { + + // The user aliases that have been to be added to a user id. + UserAliasesAdded []types.UserAlias + + // The user aliases that have been deleted from a user id. + UserAliasesDeleted []types.UserAlias + + // The user aliases attached to a user id that have been updated. + UserAliasesUpdated []types.UserAlias + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateUser{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateUser"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateUser(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateUser", + } +} diff --git a/service/qbusiness/api_op_UpdateWebExperience.go b/service/qbusiness/api_op_UpdateWebExperience.go new file mode 100644 index 00000000000..20f2d08ef8f --- /dev/null +++ b/service/qbusiness/api_op_UpdateWebExperience.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an Amazon Q web experience. +func (c *Client) UpdateWebExperience(ctx context.Context, params *UpdateWebExperienceInput, optFns ...func(*Options)) (*UpdateWebExperienceOutput, error) { + if params == nil { + params = &UpdateWebExperienceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateWebExperience", params, optFns, c.addOperationUpdateWebExperienceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateWebExperienceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateWebExperienceInput struct { + + // The identifier of the Amazon Q application attached to the web experience. + // + // This member is required. + ApplicationId *string + + // The identifier of the Amazon Q web experience. + // + // This member is required. + WebExperienceId *string + + // The authentication configuration of the Amazon Q web experience. + AuthenticationConfiguration types.WebExperienceAuthConfiguration + + // Determines whether sample prompts are enabled in the web experience for an end + // user. + SamplePromptsControlMode types.WebExperienceSamplePromptsControlMode + + // The subtitle of the Amazon Q web experience. + Subtitle *string + + // The title of the Amazon Q web experience. + Title *string + + // A customized welcome message for an end user in an Amazon Q web experience. + WelcomeMessage *string + + noSmithyDocumentSerde +} + +type UpdateWebExperienceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateWebExperienceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateWebExperience{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateWebExperience{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateWebExperience"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateWebExperienceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateWebExperience(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateWebExperience(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateWebExperience", + } +} diff --git a/service/qbusiness/auth.go b/service/qbusiness/auth.go new file mode 100644 index 00000000000..a85c8d729c9 --- /dev/null +++ b/service/qbusiness/auth.go @@ -0,0 +1,256 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +func bindAuthParamsRegion(params *AuthResolverParameters, _ interface{}, options Options) { + params.Region = options.Region +} + +type setLegacyContextSigningOptionsMiddleware struct { +} + +func (*setLegacyContextSigningOptionsMiddleware) ID() string { + return "setLegacyContextSigningOptions" +} + +func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + schemeID := rscheme.Scheme.SchemeID() + + if sn := awsmiddleware.GetSigningName(ctx); sn != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) + } + } + + if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) + } + } + + return next.HandleFinalize(ctx, in) +} + +func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { + return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) +} + +// AuthResolverParameters contains the set of inputs necessary for auth scheme +// resolution. +type AuthResolverParameters struct { + // The name of the operation being invoked. + Operation string + + // The region in which the operation is being invoked. + Region string +} + +func bindAuthResolverParams(operation string, input interface{}, options Options) *AuthResolverParameters { + params := &AuthResolverParameters{ + Operation: operation, + } + + bindAuthParamsRegion(params, input, options) + + return params +} + +// AuthSchemeResolver returns a set of possible authentication options for an +// operation. +type AuthSchemeResolver interface { + ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) +} + +type defaultAuthSchemeResolver struct{} + +var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) + +func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + if overrides, ok := operationAuthOptions[params.Operation]; ok { + return overrides(params), nil + } + return serviceAuthOptions(params), nil +} + +var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} + +func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { + return []*smithyauth.Option{ + { + SchemeID: smithyauth.SchemeIDSigV4, + SignerProperties: func() smithy.Properties { + var props smithy.Properties + smithyhttp.SetSigV4SigningName(&props, "qbusiness") + smithyhttp.SetSigV4SigningRegion(&props, params.Region) + return props + }(), + }, + } +} + +type resolveAuthSchemeMiddleware struct { + operation string + options Options +} + +func (*resolveAuthSchemeMiddleware) ID() string { + return "ResolveAuthScheme" +} + +func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + params := bindAuthResolverParams(m.operation, getOperationInput(ctx), m.options) + options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("resolve auth scheme: %v", err) + } + + scheme, ok := m.selectScheme(options) + if !ok { + return out, metadata, fmt.Errorf("could not select an auth scheme") + } + + ctx = setResolvedAuthScheme(ctx, scheme) + return next.HandleFinalize(ctx, in) +} + +func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { + for _, option := range options { + if option.SchemeID == smithyauth.SchemeIDAnonymous { + return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true + } + + for _, scheme := range m.options.AuthSchemes { + if scheme.SchemeID() != option.SchemeID { + continue + } + + if scheme.IdentityResolver(m.options) != nil { + return newResolvedAuthScheme(scheme, option), true + } + } + } + + return nil, false +} + +type resolvedAuthSchemeKey struct{} + +type resolvedAuthScheme struct { + Scheme smithyhttp.AuthScheme + IdentityProperties smithy.Properties + SignerProperties smithy.Properties +} + +func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { + return &resolvedAuthScheme{ + Scheme: scheme, + IdentityProperties: option.IdentityProperties, + SignerProperties: option.SignerProperties, + } +} + +func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { + return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) +} + +func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { + v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) + return v +} + +type getIdentityMiddleware struct { + options Options +} + +func (*getIdentityMiddleware) ID() string { + return "GetIdentity" +} + +func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + resolver := rscheme.Scheme.IdentityResolver(m.options) + if resolver == nil { + return out, metadata, fmt.Errorf("no identity resolver") + } + + identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties) + if err != nil { + return out, metadata, fmt.Errorf("get identity: %v", err) + } + + ctx = setIdentity(ctx, identity) + return next.HandleFinalize(ctx, in) +} + +type identityKey struct{} + +func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { + return middleware.WithStackValue(ctx, identityKey{}, identity) +} + +func getIdentity(ctx context.Context) smithyauth.Identity { + v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) + return v +} + +type signRequestMiddleware struct { +} + +func (*signRequestMiddleware) ID() string { + return "Signing" +} + +func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + identity := getIdentity(ctx) + if identity == nil { + return out, metadata, fmt.Errorf("no identity") + } + + signer := rscheme.Scheme.Signer() + if signer == nil { + return out, metadata, fmt.Errorf("no signer") + } + + if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil { + return out, metadata, fmt.Errorf("sign request: %v", err) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/qbusiness/deserializers.go b/service/qbusiness/deserializers.go new file mode 100644 index 00000000000..83d8eaa4c46 --- /dev/null +++ b/service/qbusiness/deserializers.go @@ -0,0 +1,13459 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + internaldocument "github.com/aws/aws-sdk-go-v2/service/qbusiness/internal/document" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/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" + "time" +) + +type awsRestjson1_deserializeOpBatchDeleteDocument struct { +} + +func (*awsRestjson1_deserializeOpBatchDeleteDocument) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpBatchDeleteDocument) 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_deserializeOpErrorBatchDeleteDocument(response, &metadata) + } + output := &BatchDeleteDocumentOutput{} + 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_deserializeOpDocumentBatchDeleteDocumentOutput(&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_deserializeOpErrorBatchDeleteDocument(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_deserializeOpDocumentBatchDeleteDocumentOutput(v **BatchDeleteDocumentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *BatchDeleteDocumentOutput + if *v == nil { + sv = &BatchDeleteDocumentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "failedDocuments": + if err := awsRestjson1_deserializeDocumentFailedDocuments(&sv.FailedDocuments, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpBatchPutDocument struct { +} + +func (*awsRestjson1_deserializeOpBatchPutDocument) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpBatchPutDocument) 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_deserializeOpErrorBatchPutDocument(response, &metadata) + } + output := &BatchPutDocumentOutput{} + 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_deserializeOpDocumentBatchPutDocumentOutput(&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_deserializeOpErrorBatchPutDocument(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_deserializeOpDocumentBatchPutDocumentOutput(v **BatchPutDocumentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *BatchPutDocumentOutput + if *v == nil { + sv = &BatchPutDocumentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "failedDocuments": + if err := awsRestjson1_deserializeDocumentFailedDocuments(&sv.FailedDocuments, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpChatSync struct { +} + +func (*awsRestjson1_deserializeOpChatSync) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpChatSync) 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_deserializeOpErrorChatSync(response, &metadata) + } + output := &ChatSyncOutput{} + 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_deserializeOpDocumentChatSyncOutput(&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_deserializeOpErrorChatSync(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("LicenseNotFoundException", errorCode): + return awsRestjson1_deserializeErrorLicenseNotFoundException(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_deserializeOpDocumentChatSyncOutput(v **ChatSyncOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ChatSyncOutput + if *v == nil { + sv = &ChatSyncOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionReview": + if err := awsRestjson1_deserializeDocumentActionReview(&sv.ActionReview, value); err != nil { + return err + } + + case "conversationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConversationId to be of type string, got %T instead", value) + } + sv.ConversationId = ptr.String(jtv) + } + + case "failedAttachments": + if err := awsRestjson1_deserializeDocumentAttachmentsOutput(&sv.FailedAttachments, value); err != nil { + return err + } + + case "sourceAttributions": + if err := awsRestjson1_deserializeDocumentSourceAttributions(&sv.SourceAttributions, value); err != nil { + return err + } + + case "systemMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.SystemMessage = ptr.String(jtv) + } + + case "systemMessageId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MessageId to be of type string, got %T instead", value) + } + sv.SystemMessageId = ptr.String(jtv) + } + + case "userMessageId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MessageId to be of type string, got %T instead", value) + } + sv.UserMessageId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateApplication struct { +} + +func (*awsRestjson1_deserializeOpCreateApplication) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateApplication) 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_deserializeOpErrorCreateApplication(response, &metadata) + } + output := &CreateApplicationOutput{} + 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_deserializeOpDocumentCreateApplicationOutput(&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_deserializeOpErrorCreateApplication(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_deserializeOpDocumentCreateApplicationOutput(v **CreateApplicationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateApplicationOutput + if *v == nil { + sv = &CreateApplicationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationArn to be of type string, got %T instead", value) + } + sv.ApplicationArn = ptr.String(jtv) + } + + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateDataSource struct { +} + +func (*awsRestjson1_deserializeOpCreateDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateDataSource) 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_deserializeOpErrorCreateDataSource(response, &metadata) + } + output := &CreateDataSourceOutput{} + 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_deserializeOpDocumentCreateDataSourceOutput(&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_deserializeOpErrorCreateDataSource(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_deserializeOpDocumentCreateDataSourceOutput(v **CreateDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateDataSourceOutput + if *v == nil { + sv = &CreateDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceArn to be of type string, got %T instead", value) + } + sv.DataSourceArn = ptr.String(jtv) + } + + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateIndex struct { +} + +func (*awsRestjson1_deserializeOpCreateIndex) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateIndex) 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_deserializeOpErrorCreateIndex(response, &metadata) + } + output := &CreateIndexOutput{} + 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_deserializeOpDocumentCreateIndexOutput(&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_deserializeOpErrorCreateIndex(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_deserializeOpDocumentCreateIndexOutput(v **CreateIndexOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateIndexOutput + if *v == nil { + sv = &CreateIndexOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "indexArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexArn to be of type string, got %T instead", value) + } + sv.IndexArn = ptr.String(jtv) + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreatePlugin struct { +} + +func (*awsRestjson1_deserializeOpCreatePlugin) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreatePlugin) 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_deserializeOpErrorCreatePlugin(response, &metadata) + } + output := &CreatePluginOutput{} + 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_deserializeOpDocumentCreatePluginOutput(&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_deserializeOpErrorCreatePlugin(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_deserializeOpDocumentCreatePluginOutput(v **CreatePluginOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreatePluginOutput + if *v == nil { + sv = &CreatePluginOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "pluginArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginArn to be of type string, got %T instead", value) + } + sv.PluginArn = ptr.String(jtv) + } + + case "pluginId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginId to be of type string, got %T instead", value) + } + sv.PluginId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateRetriever struct { +} + +func (*awsRestjson1_deserializeOpCreateRetriever) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateRetriever) 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_deserializeOpErrorCreateRetriever(response, &metadata) + } + output := &CreateRetrieverOutput{} + 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_deserializeOpDocumentCreateRetrieverOutput(&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_deserializeOpErrorCreateRetriever(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_deserializeOpDocumentCreateRetrieverOutput(v **CreateRetrieverOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateRetrieverOutput + if *v == nil { + sv = &CreateRetrieverOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "retrieverArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverArn to be of type string, got %T instead", value) + } + sv.RetrieverArn = ptr.String(jtv) + } + + case "retrieverId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverId to be of type string, got %T instead", value) + } + sv.RetrieverId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateUser struct { +} + +func (*awsRestjson1_deserializeOpCreateUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateUser) 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_deserializeOpErrorCreateUser(response, &metadata) + } + output := &CreateUserOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorCreateUser(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_deserializeOpCreateWebExperience struct { +} + +func (*awsRestjson1_deserializeOpCreateWebExperience) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateWebExperience) 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_deserializeOpErrorCreateWebExperience(response, &metadata) + } + output := &CreateWebExperienceOutput{} + 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_deserializeOpDocumentCreateWebExperienceOutput(&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_deserializeOpErrorCreateWebExperience(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_deserializeOpDocumentCreateWebExperienceOutput(v **CreateWebExperienceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateWebExperienceOutput + if *v == nil { + sv = &CreateWebExperienceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "webExperienceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceArn to be of type string, got %T instead", value) + } + sv.WebExperienceArn = ptr.String(jtv) + } + + case "webExperienceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceId to be of type string, got %T instead", value) + } + sv.WebExperienceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteApplication struct { +} + +func (*awsRestjson1_deserializeOpDeleteApplication) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteApplication) 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_deserializeOpErrorDeleteApplication(response, &metadata) + } + output := &DeleteApplicationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteApplication(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_deserializeOpDeleteChatControlsConfiguration struct { +} + +func (*awsRestjson1_deserializeOpDeleteChatControlsConfiguration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteChatControlsConfiguration) 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_deserializeOpErrorDeleteChatControlsConfiguration(response, &metadata) + } + output := &DeleteChatControlsConfigurationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteChatControlsConfiguration(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_deserializeOpDeleteConversation struct { +} + +func (*awsRestjson1_deserializeOpDeleteConversation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteConversation) 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_deserializeOpErrorDeleteConversation(response, &metadata) + } + output := &DeleteConversationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteConversation(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("LicenseNotFoundException", errorCode): + return awsRestjson1_deserializeErrorLicenseNotFoundException(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_deserializeOpDeleteDataSource struct { +} + +func (*awsRestjson1_deserializeOpDeleteDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteDataSource) 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_deserializeOpErrorDeleteDataSource(response, &metadata) + } + output := &DeleteDataSourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteDataSource(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_deserializeOpDeleteGroup struct { +} + +func (*awsRestjson1_deserializeOpDeleteGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteGroup) 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_deserializeOpErrorDeleteGroup(response, &metadata) + } + output := &DeleteGroupOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteGroup(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_deserializeOpDeleteIndex struct { +} + +func (*awsRestjson1_deserializeOpDeleteIndex) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteIndex) 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_deserializeOpErrorDeleteIndex(response, &metadata) + } + output := &DeleteIndexOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteIndex(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_deserializeOpDeletePlugin struct { +} + +func (*awsRestjson1_deserializeOpDeletePlugin) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeletePlugin) 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_deserializeOpErrorDeletePlugin(response, &metadata) + } + output := &DeletePluginOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeletePlugin(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_deserializeOpDeleteRetriever struct { +} + +func (*awsRestjson1_deserializeOpDeleteRetriever) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteRetriever) 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_deserializeOpErrorDeleteRetriever(response, &metadata) + } + output := &DeleteRetrieverOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteRetriever(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_deserializeOpDeleteUser struct { +} + +func (*awsRestjson1_deserializeOpDeleteUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteUser) 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_deserializeOpErrorDeleteUser(response, &metadata) + } + output := &DeleteUserOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteUser(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_deserializeOpDeleteWebExperience struct { +} + +func (*awsRestjson1_deserializeOpDeleteWebExperience) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteWebExperience) 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_deserializeOpErrorDeleteWebExperience(response, &metadata) + } + output := &DeleteWebExperienceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteWebExperience(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_deserializeOpGetApplication struct { +} + +func (*awsRestjson1_deserializeOpGetApplication) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetApplication) 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_deserializeOpErrorGetApplication(response, &metadata) + } + output := &GetApplicationOutput{} + 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_deserializeOpDocumentGetApplicationOutput(&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_deserializeOpErrorGetApplication(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_deserializeOpDocumentGetApplicationOutput(v **GetApplicationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetApplicationOutput + if *v == nil { + sv = &GetApplicationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationArn to be of type string, got %T instead", value) + } + sv.ApplicationArn = ptr.String(jtv) + } + + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "attachmentsConfiguration": + if err := awsRestjson1_deserializeDocumentAppliedAttachmentsConfiguration(&sv.AttachmentsConfiguration, 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 "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "encryptionConfiguration": + if err := awsRestjson1_deserializeDocumentEncryptionConfiguration(&sv.EncryptionConfiguration, value); err != nil { + return err + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, 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) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value) + } + sv.Status = types.ApplicationStatus(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 +} + +type awsRestjson1_deserializeOpGetChatControlsConfiguration struct { +} + +func (*awsRestjson1_deserializeOpGetChatControlsConfiguration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetChatControlsConfiguration) 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_deserializeOpErrorGetChatControlsConfiguration(response, &metadata) + } + output := &GetChatControlsConfigurationOutput{} + 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_deserializeOpDocumentGetChatControlsConfigurationOutput(&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_deserializeOpErrorGetChatControlsConfiguration(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_deserializeOpDocumentGetChatControlsConfigurationOutput(v **GetChatControlsConfigurationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetChatControlsConfigurationOutput + if *v == nil { + sv = &GetChatControlsConfigurationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "blockedPhrases": + if err := awsRestjson1_deserializeDocumentBlockedPhrasesConfiguration(&sv.BlockedPhrases, 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) + } + + case "responseScope": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResponseScope to be of type string, got %T instead", value) + } + sv.ResponseScope = types.ResponseScope(jtv) + } + + case "topicConfigurations": + if err := awsRestjson1_deserializeDocumentTopicConfigurations(&sv.TopicConfigurations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetDataSource struct { +} + +func (*awsRestjson1_deserializeOpGetDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetDataSource) 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_deserializeOpErrorGetDataSource(response, &metadata) + } + output := &GetDataSourceOutput{} + 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_deserializeOpDocumentGetDataSourceOutput(&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_deserializeOpErrorGetDataSource(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_deserializeOpDocumentGetDataSourceOutput(v **GetDataSourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetDataSourceOutput + if *v == nil { + sv = &GetDataSourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "configuration": + if err := awsRestjson1_deserializeDocumentDataSourceConfiguration(&sv.Configuration, 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 "dataSourceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceArn to be of type string, got %T instead", value) + } + sv.DataSourceArn = ptr.String(jtv) + } + + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "documentEnrichmentConfiguration": + if err := awsRestjson1_deserializeDocumentDocumentEnrichmentConfiguration(&sv.DocumentEnrichmentConfiguration, value); err != nil { + return err + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + 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) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceStatus(jtv) + } + + case "syncSchedule": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SyncSchedule to be of type string, got %T instead", value) + } + sv.SyncSchedule = 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 "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 "vpcConfiguration": + if err := awsRestjson1_deserializeDocumentDataSourceVpcConfiguration(&sv.VpcConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetGroup struct { +} + +func (*awsRestjson1_deserializeOpGetGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetGroup) 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_deserializeOpErrorGetGroup(response, &metadata) + } + output := &GetGroupOutput{} + 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_deserializeOpDocumentGetGroupOutput(&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_deserializeOpErrorGetGroup(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_deserializeOpDocumentGetGroupOutput(v **GetGroupOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetGroupOutput + if *v == nil { + sv = &GetGroupOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if err := awsRestjson1_deserializeDocumentGroupStatusDetail(&sv.Status, value); err != nil { + return err + } + + case "statusHistory": + if err := awsRestjson1_deserializeDocumentGroupStatusDetails(&sv.StatusHistory, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetIndex struct { +} + +func (*awsRestjson1_deserializeOpGetIndex) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetIndex) 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_deserializeOpErrorGetIndex(response, &metadata) + } + output := &GetIndexOutput{} + 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_deserializeOpDocumentGetIndexOutput(&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_deserializeOpErrorGetIndex(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_deserializeOpDocumentGetIndexOutput(v **GetIndexOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetIndexOutput + if *v == nil { + sv = &GetIndexOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "capacityConfiguration": + if err := awsRestjson1_deserializeDocumentIndexCapacityConfiguration(&sv.CapacityConfiguration, 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 "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "documentAttributeConfigurations": + if err := awsRestjson1_deserializeDocumentDocumentAttributeConfigurations(&sv.DocumentAttributeConfigurations, value); err != nil { + return err + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "indexArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexArn to be of type string, got %T instead", value) + } + sv.IndexArn = ptr.String(jtv) + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + case "indexStatistics": + if err := awsRestjson1_deserializeDocumentIndexStatistics(&sv.IndexStatistics, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexStatus to be of type string, got %T instead", value) + } + sv.Status = types.IndexStatus(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 +} + +type awsRestjson1_deserializeOpGetPlugin struct { +} + +func (*awsRestjson1_deserializeOpGetPlugin) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetPlugin) 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_deserializeOpErrorGetPlugin(response, &metadata) + } + output := &GetPluginOutput{} + 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_deserializeOpDocumentGetPluginOutput(&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_deserializeOpErrorGetPlugin(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_deserializeOpDocumentGetPluginOutput(v **GetPluginOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetPluginOutput + if *v == nil { + sv = &GetPluginOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "authConfiguration": + if err := awsRestjson1_deserializeDocumentPluginAuthConfiguration(&sv.AuthConfiguration, 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 "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "pluginArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginArn to be of type string, got %T instead", value) + } + sv.PluginArn = ptr.String(jtv) + } + + case "pluginId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginId to be of type string, got %T instead", value) + } + sv.PluginId = ptr.String(jtv) + } + + case "serverUrl": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.ServerUrl = ptr.String(jtv) + } + + case "state": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginState to be of type string, got %T instead", value) + } + sv.State = types.PluginState(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginType to be of type string, got %T instead", value) + } + sv.Type = types.PluginType(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 +} + +type awsRestjson1_deserializeOpGetRetriever struct { +} + +func (*awsRestjson1_deserializeOpGetRetriever) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetRetriever) 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_deserializeOpErrorGetRetriever(response, &metadata) + } + output := &GetRetrieverOutput{} + 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_deserializeOpDocumentGetRetrieverOutput(&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_deserializeOpErrorGetRetriever(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_deserializeOpDocumentGetRetrieverOutput(v **GetRetrieverOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetRetrieverOutput + if *v == nil { + sv = &GetRetrieverOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "configuration": + if err := awsRestjson1_deserializeDocumentRetrieverConfiguration(&sv.Configuration, 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 "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "retrieverArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverArn to be of type string, got %T instead", value) + } + sv.RetrieverArn = ptr.String(jtv) + } + + case "retrieverId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverId to be of type string, got %T instead", value) + } + sv.RetrieverId = ptr.String(jtv) + } + + 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) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverStatus to be of type string, got %T instead", value) + } + sv.Status = types.RetrieverStatus(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverType to be of type string, got %T instead", value) + } + sv.Type = types.RetrieverType(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 +} + +type awsRestjson1_deserializeOpGetUser struct { +} + +func (*awsRestjson1_deserializeOpGetUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorGetUser(response, &metadata) + } + output := &GetUserOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentGetUserOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorGetUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + 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_deserializeOpDocumentGetUserOutput(v **GetUserOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetUserOutput + if *v == nil { + sv = &GetUserOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "userAliases": + if err := awsRestjson1_deserializeDocumentUserAliases(&sv.UserAliases, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetWebExperience struct { +} + +func (*awsRestjson1_deserializeOpGetWebExperience) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetWebExperience) 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_deserializeOpErrorGetWebExperience(response, &metadata) + } + output := &GetWebExperienceOutput{} + 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_deserializeOpDocumentGetWebExperienceOutput(&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_deserializeOpErrorGetWebExperience(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_deserializeOpDocumentGetWebExperienceOutput(v **GetWebExperienceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetWebExperienceOutput + if *v == nil { + sv = &GetWebExperienceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "authenticationConfiguration": + if err := awsRestjson1_deserializeDocumentWebExperienceAuthConfiguration(&sv.AuthenticationConfiguration, 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 "defaultEndpoint": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.DefaultEndpoint = ptr.String(jtv) + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "samplePromptsControlMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceSamplePromptsControlMode to be of type string, got %T instead", value) + } + sv.SamplePromptsControlMode = types.WebExperienceSamplePromptsControlMode(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceStatus to be of type string, got %T instead", value) + } + sv.Status = types.WebExperienceStatus(jtv) + } + + case "subtitle": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceSubtitle to be of type string, got %T instead", value) + } + sv.Subtitle = ptr.String(jtv) + } + + case "title": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceTitle to be of type string, got %T instead", value) + } + sv.Title = 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) + + } + } + + case "webExperienceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceArn to be of type string, got %T instead", value) + } + sv.WebExperienceArn = ptr.String(jtv) + } + + case "webExperienceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceId to be of type string, got %T instead", value) + } + sv.WebExperienceId = ptr.String(jtv) + } + + case "welcomeMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceWelcomeMessage to be of type string, got %T instead", value) + } + sv.WelcomeMessage = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListApplications struct { +} + +func (*awsRestjson1_deserializeOpListApplications) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListApplications) 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_deserializeOpErrorListApplications(response, &metadata) + } + output := &ListApplicationsOutput{} + 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_deserializeOpDocumentListApplicationsOutput(&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_deserializeOpErrorListApplications(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_deserializeOpDocumentListApplicationsOutput(v **ListApplicationsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListApplicationsOutput + if *v == nil { + sv = &ListApplicationsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applications": + if err := awsRestjson1_deserializeDocumentApplications(&sv.Applications, 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_deserializeOpListConversations struct { +} + +func (*awsRestjson1_deserializeOpListConversations) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListConversations) 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_deserializeOpErrorListConversations(response, &metadata) + } + output := &ListConversationsOutput{} + 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_deserializeOpDocumentListConversationsOutput(&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_deserializeOpErrorListConversations(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("LicenseNotFoundException", errorCode): + return awsRestjson1_deserializeErrorLicenseNotFoundException(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_deserializeOpDocumentListConversationsOutput(v **ListConversationsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListConversationsOutput + if *v == nil { + sv = &ListConversationsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "conversations": + if err := awsRestjson1_deserializeDocumentConversations(&sv.Conversations, 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_deserializeOpListDataSources struct { +} + +func (*awsRestjson1_deserializeOpListDataSources) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListDataSources) 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_deserializeOpErrorListDataSources(response, &metadata) + } + output := &ListDataSourcesOutput{} + 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_deserializeOpDocumentListDataSourcesOutput(&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_deserializeOpErrorListDataSources(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_deserializeOpDocumentListDataSourcesOutput(v **ListDataSourcesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListDataSourcesOutput + if *v == nil { + sv = &ListDataSourcesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSources": + if err := awsRestjson1_deserializeDocumentDataSources(&sv.DataSources, 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_deserializeOpListDataSourceSyncJobs struct { +} + +func (*awsRestjson1_deserializeOpListDataSourceSyncJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListDataSourceSyncJobs) 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_deserializeOpErrorListDataSourceSyncJobs(response, &metadata) + } + output := &ListDataSourceSyncJobsOutput{} + 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_deserializeOpDocumentListDataSourceSyncJobsOutput(&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_deserializeOpErrorListDataSourceSyncJobs(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_deserializeOpDocumentListDataSourceSyncJobsOutput(v **ListDataSourceSyncJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListDataSourceSyncJobsOutput + if *v == nil { + sv = &ListDataSourceSyncJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "history": + if err := awsRestjson1_deserializeDocumentDataSourceSyncJobs(&sv.History, 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_deserializeOpListDocuments struct { +} + +func (*awsRestjson1_deserializeOpListDocuments) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListDocuments) 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_deserializeOpErrorListDocuments(response, &metadata) + } + output := &ListDocumentsOutput{} + 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_deserializeOpDocumentListDocumentsOutput(&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_deserializeOpErrorListDocuments(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_deserializeOpDocumentListDocumentsOutput(v **ListDocumentsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListDocumentsOutput + if *v == nil { + sv = &ListDocumentsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "documentDetailList": + if err := awsRestjson1_deserializeDocumentDocumentDetailList(&sv.DocumentDetailList, 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_deserializeOpListGroups struct { +} + +func (*awsRestjson1_deserializeOpListGroups) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListGroups) 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_deserializeOpErrorListGroups(response, &metadata) + } + output := &ListGroupsOutput{} + 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_deserializeOpDocumentListGroupsOutput(&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_deserializeOpErrorListGroups(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_deserializeOpDocumentListGroupsOutput(v **ListGroupsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListGroupsOutput + if *v == nil { + sv = &ListGroupsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "items": + if err := awsRestjson1_deserializeDocumentGroupSummaryList(&sv.Items, 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_deserializeOpListIndices struct { +} + +func (*awsRestjson1_deserializeOpListIndices) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListIndices) 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_deserializeOpErrorListIndices(response, &metadata) + } + output := &ListIndicesOutput{} + 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_deserializeOpDocumentListIndicesOutput(&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_deserializeOpErrorListIndices(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_deserializeOpDocumentListIndicesOutput(v **ListIndicesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListIndicesOutput + if *v == nil { + sv = &ListIndicesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "indices": + if err := awsRestjson1_deserializeDocumentIndices(&sv.Indices, 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_deserializeOpListMessages struct { +} + +func (*awsRestjson1_deserializeOpListMessages) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListMessages) 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_deserializeOpErrorListMessages(response, &metadata) + } + output := &ListMessagesOutput{} + 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_deserializeOpDocumentListMessagesOutput(&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_deserializeOpErrorListMessages(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("LicenseNotFoundException", errorCode): + return awsRestjson1_deserializeErrorLicenseNotFoundException(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_deserializeOpDocumentListMessagesOutput(v **ListMessagesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListMessagesOutput + if *v == nil { + sv = &ListMessagesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "messages": + if err := awsRestjson1_deserializeDocumentMessages(&sv.Messages, 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_deserializeOpListPlugins struct { +} + +func (*awsRestjson1_deserializeOpListPlugins) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListPlugins) 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_deserializeOpErrorListPlugins(response, &metadata) + } + output := &ListPluginsOutput{} + 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_deserializeOpDocumentListPluginsOutput(&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_deserializeOpErrorListPlugins(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_deserializeOpDocumentListPluginsOutput(v **ListPluginsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListPluginsOutput + if *v == nil { + sv = &ListPluginsOutput{} + } 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 "plugins": + if err := awsRestjson1_deserializeDocumentPlugins(&sv.Plugins, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListRetrievers struct { +} + +func (*awsRestjson1_deserializeOpListRetrievers) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListRetrievers) 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_deserializeOpErrorListRetrievers(response, &metadata) + } + output := &ListRetrieversOutput{} + 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_deserializeOpDocumentListRetrieversOutput(&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_deserializeOpErrorListRetrievers(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_deserializeOpDocumentListRetrieversOutput(v **ListRetrieversOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListRetrieversOutput + if *v == nil { + sv = &ListRetrieversOutput{} + } 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 "retrievers": + if err := awsRestjson1_deserializeDocumentRetrievers(&sv.Retrievers, 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_deserializeOpListWebExperiences struct { +} + +func (*awsRestjson1_deserializeOpListWebExperiences) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListWebExperiences) 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_deserializeOpErrorListWebExperiences(response, &metadata) + } + output := &ListWebExperiencesOutput{} + 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_deserializeOpDocumentListWebExperiencesOutput(&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_deserializeOpErrorListWebExperiences(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_deserializeOpDocumentListWebExperiencesOutput(v **ListWebExperiencesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListWebExperiencesOutput + if *v == nil { + sv = &ListWebExperiencesOutput{} + } 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 "webExperiences": + if err := awsRestjson1_deserializeDocumentWebExperiences(&sv.WebExperiences, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpPutFeedback struct { +} + +func (*awsRestjson1_deserializeOpPutFeedback) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpPutFeedback) 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_deserializeOpErrorPutFeedback(response, &metadata) + } + output := &PutFeedbackOutput{} + 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_deserializeOpErrorPutFeedback(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_deserializeOpPutGroup struct { +} + +func (*awsRestjson1_deserializeOpPutGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpPutGroup) 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_deserializeOpErrorPutGroup(response, &metadata) + } + output := &PutGroupOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorPutGroup(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_deserializeOpStartDataSourceSyncJob struct { +} + +func (*awsRestjson1_deserializeOpStartDataSourceSyncJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartDataSourceSyncJob) 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_deserializeOpErrorStartDataSourceSyncJob(response, &metadata) + } + output := &StartDataSourceSyncJobOutput{} + 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_deserializeOpDocumentStartDataSourceSyncJobOutput(&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_deserializeOpErrorStartDataSourceSyncJob(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_deserializeOpDocumentStartDataSourceSyncJobOutput(v **StartDataSourceSyncJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartDataSourceSyncJobOutput + if *v == nil { + sv = &StartDataSourceSyncJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "executionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ExecutionId to be of type string, got %T instead", value) + } + sv.ExecutionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStopDataSourceSyncJob struct { +} + +func (*awsRestjson1_deserializeOpStopDataSourceSyncJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStopDataSourceSyncJob) 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_deserializeOpErrorStopDataSourceSyncJob(response, &metadata) + } + output := &StopDataSourceSyncJobOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorStopDataSourceSyncJob(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_deserializeOpTagResource struct { +} + +func (*awsRestjson1_deserializeOpTagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + } + output := &TagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("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_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + } + output := &UntagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("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_deserializeOpUpdateApplication struct { +} + +func (*awsRestjson1_deserializeOpUpdateApplication) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateApplication) 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_deserializeOpErrorUpdateApplication(response, &metadata) + } + output := &UpdateApplicationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateApplication(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_deserializeOpUpdateChatControlsConfiguration struct { +} + +func (*awsRestjson1_deserializeOpUpdateChatControlsConfiguration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateChatControlsConfiguration) 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_deserializeOpErrorUpdateChatControlsConfiguration(response, &metadata) + } + output := &UpdateChatControlsConfigurationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateChatControlsConfiguration(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_deserializeOpUpdateDataSource struct { +} + +func (*awsRestjson1_deserializeOpUpdateDataSource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateDataSource) 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_deserializeOpErrorUpdateDataSource(response, &metadata) + } + output := &UpdateDataSourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateDataSource(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_deserializeOpUpdateIndex struct { +} + +func (*awsRestjson1_deserializeOpUpdateIndex) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateIndex) 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_deserializeOpErrorUpdateIndex(response, &metadata) + } + output := &UpdateIndexOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateIndex(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_deserializeOpUpdatePlugin struct { +} + +func (*awsRestjson1_deserializeOpUpdatePlugin) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdatePlugin) 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_deserializeOpErrorUpdatePlugin(response, &metadata) + } + output := &UpdatePluginOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdatePlugin(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_deserializeOpUpdateRetriever struct { +} + +func (*awsRestjson1_deserializeOpUpdateRetriever) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateRetriever) 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_deserializeOpErrorUpdateRetriever(response, &metadata) + } + output := &UpdateRetrieverOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateRetriever(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_deserializeOpUpdateUser struct { +} + +func (*awsRestjson1_deserializeOpUpdateUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateUser) 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_deserializeOpErrorUpdateUser(response, &metadata) + } + output := &UpdateUserOutput{} + 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_deserializeOpDocumentUpdateUserOutput(&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_deserializeOpErrorUpdateUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateUserOutput(v **UpdateUserOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateUserOutput + if *v == nil { + sv = &UpdateUserOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "userAliasesAdded": + if err := awsRestjson1_deserializeDocumentUserAliases(&sv.UserAliasesAdded, value); err != nil { + return err + } + + case "userAliasesDeleted": + if err := awsRestjson1_deserializeDocumentUserAliases(&sv.UserAliasesDeleted, value); err != nil { + return err + } + + case "userAliasesUpdated": + if err := awsRestjson1_deserializeDocumentUserAliases(&sv.UserAliasesUpdated, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateWebExperience struct { +} + +func (*awsRestjson1_deserializeOpUpdateWebExperience) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateWebExperience) 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_deserializeOpErrorUpdateWebExperience(response, &metadata) + } + output := &UpdateWebExperienceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateWebExperience(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_deserializeErrorLicenseNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.LicenseNotFoundException{} + 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_deserializeDocumentLicenseNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotFoundException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ServiceQuotaExceededException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ThrottlingException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AccessDeniedException + if *v == nil { + sv = &types.AccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionExecution(v **types.ActionExecution, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionExecution + if *v == nil { + sv = &types.ActionExecution{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentActionExecutionPayload(&sv.Payload, value); err != nil { + return err + } + + case "payloadFieldNameSeparator": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionPayloadFieldNameSeparator to be of type string, got %T instead", value) + } + sv.PayloadFieldNameSeparator = ptr.String(jtv) + } + + case "pluginId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginId to be of type string, got %T instead", value) + } + sv.PluginId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionExecutionPayload(v *map[string]types.ActionExecutionPayloadField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.ActionExecutionPayloadField + if *v == nil { + mv = map[string]types.ActionExecutionPayloadField{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.ActionExecutionPayloadField + mapVar := parsedVal + destAddr := &mapVar + if err := awsRestjson1_deserializeDocumentActionExecutionPayloadField(&destAddr, value); err != nil { + return err + } + parsedVal = *destAddr + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentActionExecutionPayloadField(v **types.ActionExecutionPayloadField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionExecutionPayloadField + if *v == nil { + sv = &types.ActionExecutionPayloadField{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "value": + if err := awsRestjson1_deserializeDocumentActionPayloadFieldValue(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionPayloadFieldValue(v *document.Interface, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + *v = internaldocument.NewDocumentUnmarshaler(value) + return nil +} + +func awsRestjson1_deserializeDocumentActionReview(v **types.ActionReview, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionReview + if *v == nil { + sv = &types.ActionReview{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentActionReviewPayload(&sv.Payload, value); err != nil { + return err + } + + case "payloadFieldNameSeparator": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionPayloadFieldNameSeparator to be of type string, got %T instead", value) + } + sv.PayloadFieldNameSeparator = ptr.String(jtv) + } + + case "pluginId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginId to be of type string, got %T instead", value) + } + sv.PluginId = ptr.String(jtv) + } + + case "pluginType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginType to be of type string, got %T instead", value) + } + sv.PluginType = types.PluginType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionReviewPayload(v *map[string]types.ActionReviewPayloadField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.ActionReviewPayloadField + if *v == nil { + mv = map[string]types.ActionReviewPayloadField{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.ActionReviewPayloadField + mapVar := parsedVal + destAddr := &mapVar + if err := awsRestjson1_deserializeDocumentActionReviewPayloadField(&destAddr, value); err != nil { + return err + } + parsedVal = *destAddr + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentActionReviewPayloadField(v **types.ActionReviewPayloadField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionReviewPayloadField + if *v == nil { + sv = &types.ActionReviewPayloadField{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "allowedValues": + if err := awsRestjson1_deserializeDocumentActionReviewPayloadFieldAllowedValues(&sv.AllowedValues, value); err != nil { + return err + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "displayOrder": + 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.DisplayOrder = ptr.Int32(int32(i64)) + } + + case "required": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Required = ptr.Bool(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ActionPayloadFieldType to be of type string, got %T instead", value) + } + sv.Type = types.ActionPayloadFieldType(jtv) + } + + case "value": + if err := awsRestjson1_deserializeDocumentActionPayloadFieldValue(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionReviewPayloadFieldAllowedValue(v **types.ActionReviewPayloadFieldAllowedValue, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ActionReviewPayloadFieldAllowedValue + if *v == nil { + sv = &types.ActionReviewPayloadFieldAllowedValue{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "displayValue": + if err := awsRestjson1_deserializeDocumentActionPayloadFieldValue(&sv.DisplayValue, value); err != nil { + return err + } + + case "value": + if err := awsRestjson1_deserializeDocumentActionPayloadFieldValue(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentActionReviewPayloadFieldAllowedValues(v *[]types.ActionReviewPayloadFieldAllowedValue, 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.ActionReviewPayloadFieldAllowedValue + if *v == nil { + cv = []types.ActionReviewPayloadFieldAllowedValue{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ActionReviewPayloadFieldAllowedValue + destAddr := &col + if err := awsRestjson1_deserializeDocumentActionReviewPayloadFieldAllowedValue(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentApplication(v **types.Application, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Application + if *v == nil { + sv = &types.Application{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = 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 "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value) + } + sv.Status = types.ApplicationStatus(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_deserializeDocumentApplications(v *[]types.Application, 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.Application + if *v == nil { + cv = []types.Application{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Application + destAddr := &col + if err := awsRestjson1_deserializeDocumentApplication(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAppliedAttachmentsConfiguration(v **types.AppliedAttachmentsConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AppliedAttachmentsConfiguration + if *v == nil { + sv = &types.AppliedAttachmentsConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attachmentsControlMode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttachmentsControlMode to be of type string, got %T instead", value) + } + sv.AttachmentsControlMode = types.AttachmentsControlMode(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAttachmentOutput(v **types.AttachmentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AttachmentOutput + if *v == nil { + sv = &types.AttachmentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttachmentName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttachmentStatus to be of type string, got %T instead", value) + } + sv.Status = types.AttachmentStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAttachmentsOutput(v *[]types.AttachmentOutput, 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.AttachmentOutput + if *v == nil { + cv = []types.AttachmentOutput{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AttachmentOutput + destAddr := &col + if err := awsRestjson1_deserializeDocumentAttachmentOutput(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentBasicAuthConfiguration(v **types.BasicAuthConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.BasicAuthConfiguration + if *v == nil { + sv = &types.BasicAuthConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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) + } + + 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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentBlockedPhrases(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 BlockedPhrase to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentBlockedPhrasesConfiguration(v **types.BlockedPhrasesConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.BlockedPhrasesConfiguration + if *v == nil { + sv = &types.BlockedPhrasesConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "blockedPhrases": + if err := awsRestjson1_deserializeDocumentBlockedPhrases(&sv.BlockedPhrases, value); err != nil { + return err + } + + case "systemMessageOverride": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SystemMessageOverride to be of type string, got %T instead", value) + } + sv.SystemMessageOverride = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ConflictException + if *v == nil { + sv = &types.ConflictException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage 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_deserializeDocumentContentBlockerRule(v **types.ContentBlockerRule, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentBlockerRule + if *v == nil { + sv = &types.ContentBlockerRule{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "systemMessageOverride": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SystemMessageOverride to be of type string, got %T instead", value) + } + sv.SystemMessageOverride = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContentRetrievalRule(v **types.ContentRetrievalRule, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentRetrievalRule + if *v == nil { + sv = &types.ContentRetrievalRule{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "eligibleDataSources": + if err := awsRestjson1_deserializeDocumentEligibleDataSources(&sv.EligibleDataSources, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConversation(v **types.Conversation, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Conversation + if *v == nil { + sv = &types.Conversation{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "conversationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConversationId to be of type string, got %T instead", value) + } + sv.ConversationId = ptr.String(jtv) + } + + case "startTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "title": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConversationTitle to be of type string, got %T instead", value) + } + sv.Title = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConversations(v *[]types.Conversation, 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.Conversation + if *v == nil { + cv = []types.Conversation{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Conversation + destAddr := &col + if err := awsRestjson1_deserializeDocumentConversation(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDataSource(v **types.DataSource, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSource + if *v == nil { + sv = &types.DataSource{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceStatus(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 "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_deserializeDocumentDataSourceConfiguration(v *document.Interface, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + *v = internaldocument.NewDocumentUnmarshaler(value) + return nil +} + +func awsRestjson1_deserializeDocumentDataSources(v *[]types.DataSource, 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.DataSource + if *v == nil { + cv = []types.DataSource{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DataSource + destAddr := &col + if err := awsRestjson1_deserializeDocumentDataSource(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceSyncJob(v **types.DataSourceSyncJob, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSourceSyncJob + if *v == nil { + sv = &types.DataSourceSyncJob{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceErrorCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DataSourceErrorCode = ptr.String(jtv) + } + + case "endTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "executionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ExecutionId to be of type string, got %T instead", value) + } + sv.ExecutionId = ptr.String(jtv) + } + + case "metrics": + if err := awsRestjson1_deserializeDocumentDataSourceSyncJobMetrics(&sv.Metrics, value); err != nil { + return err + } + + case "startTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceSyncJobStatus to be of type string, got %T instead", value) + } + sv.Status = types.DataSourceSyncJobStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceSyncJobMetrics(v **types.DataSourceSyncJobMetrics, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSourceSyncJobMetrics + if *v == nil { + sv = &types.DataSourceSyncJobMetrics{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "documentsAdded": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MetricValue to be of type string, got %T instead", value) + } + sv.DocumentsAdded = ptr.String(jtv) + } + + case "documentsDeleted": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MetricValue to be of type string, got %T instead", value) + } + sv.DocumentsDeleted = ptr.String(jtv) + } + + case "documentsFailed": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MetricValue to be of type string, got %T instead", value) + } + sv.DocumentsFailed = ptr.String(jtv) + } + + case "documentsModified": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MetricValue to be of type string, got %T instead", value) + } + sv.DocumentsModified = ptr.String(jtv) + } + + case "documentsScanned": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MetricValue to be of type string, got %T instead", value) + } + sv.DocumentsScanned = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceSyncJobs(v *[]types.DataSourceSyncJob, 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.DataSourceSyncJob + if *v == nil { + cv = []types.DataSourceSyncJob{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DataSourceSyncJob + destAddr := &col + if err := awsRestjson1_deserializeDocumentDataSourceSyncJob(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourceVpcConfiguration(v **types.DataSourceVpcConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSourceVpcConfiguration + if *v == nil { + sv = &types.DataSourceVpcConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "securityGroupIds": + if err := awsRestjson1_deserializeDocumentSecurityGroupIds(&sv.SecurityGroupIds, value); err != nil { + return err + } + + case "subnetIds": + if err := awsRestjson1_deserializeDocumentSubnetIds(&sv.SubnetIds, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentAttributeCondition(v **types.DocumentAttributeCondition, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentAttributeCondition + if *v == nil { + sv = &types.DocumentAttributeCondition{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "key": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentAttributeKey to be of type string, got %T instead", value) + } + sv.Key = ptr.String(jtv) + } + + case "operator": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentEnrichmentConditionOperator to be of type string, got %T instead", value) + } + sv.Operator = types.DocumentEnrichmentConditionOperator(jtv) + } + + case "value": + if err := awsRestjson1_deserializeDocumentDocumentAttributeValue(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentAttributeConfiguration(v **types.DocumentAttributeConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentAttributeConfiguration + if *v == nil { + sv = &types.DocumentAttributeConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "search": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Status to be of type string, got %T instead", value) + } + sv.Search = types.Status(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttributeType to be of type string, got %T instead", value) + } + sv.Type = types.AttributeType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentAttributeConfigurations(v *[]types.DocumentAttributeConfiguration, 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.DocumentAttributeConfiguration + if *v == nil { + cv = []types.DocumentAttributeConfiguration{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DocumentAttributeConfiguration + destAddr := &col + if err := awsRestjson1_deserializeDocumentDocumentAttributeConfiguration(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentAttributeStringListValue(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_deserializeDocumentDocumentAttributeTarget(v **types.DocumentAttributeTarget, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentAttributeTarget + if *v == nil { + sv = &types.DocumentAttributeTarget{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attributeValueOperator": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttributeValueOperator to be of type string, got %T instead", value) + } + sv.AttributeValueOperator = types.AttributeValueOperator(jtv) + } + + case "key": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentAttributeKey to be of type string, got %T instead", value) + } + sv.Key = ptr.String(jtv) + } + + case "value": + if err := awsRestjson1_deserializeDocumentDocumentAttributeValue(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentAttributeValue(v *types.DocumentAttributeValue, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.DocumentAttributeValue +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "dateValue": + var mv time.Time + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + mv = smithytime.ParseEpochSeconds(f64) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + uv = &types.DocumentAttributeValueMemberDateValue{Value: mv} + break loop + + case "longValue": + var mv 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 + } + mv = i64 + } + uv = &types.DocumentAttributeValueMemberLongValue{Value: mv} + break loop + + case "stringListValue": + var mv []string + if err := awsRestjson1_deserializeDocumentDocumentAttributeStringListValue(&mv, value); err != nil { + return err + } + uv = &types.DocumentAttributeValueMemberStringListValue{Value: mv} + break loop + + case "stringValue": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentAttributeStringValue to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.DocumentAttributeValueMemberStringValue{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentDetailList(v *[]types.DocumentDetails, 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.DocumentDetails + if *v == nil { + cv = []types.DocumentDetails{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DocumentDetails + destAddr := &col + if err := awsRestjson1_deserializeDocumentDocumentDetails(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentDetails(v **types.DocumentDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentDetails + if *v == nil { + sv = &types.DocumentDetails{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "documentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentId to be of type string, got %T instead", value) + } + sv.DocumentId = ptr.String(jtv) + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentStatus to be of type string, got %T instead", value) + } + sv.Status = types.DocumentStatus(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_deserializeDocumentDocumentEnrichmentConfiguration(v **types.DocumentEnrichmentConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentEnrichmentConfiguration + if *v == nil { + sv = &types.DocumentEnrichmentConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "inlineConfigurations": + if err := awsRestjson1_deserializeDocumentInlineDocumentEnrichmentConfigurations(&sv.InlineConfigurations, value); err != nil { + return err + } + + case "postExtractionHookConfiguration": + if err := awsRestjson1_deserializeDocumentHookConfiguration(&sv.PostExtractionHookConfiguration, value); err != nil { + return err + } + + case "preExtractionHookConfiguration": + if err := awsRestjson1_deserializeDocumentHookConfiguration(&sv.PreExtractionHookConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEligibleDataSource(v **types.EligibleDataSource, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EligibleDataSource + if *v == nil { + sv = &types.EligibleDataSource{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEligibleDataSources(v *[]types.EligibleDataSource, 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.EligibleDataSource + if *v == nil { + cv = []types.EligibleDataSource{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.EligibleDataSource + destAddr := &col + if err := awsRestjson1_deserializeDocumentEligibleDataSource(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentEncryptionConfiguration(v **types.EncryptionConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EncryptionConfiguration + if *v == nil { + sv = &types.EncryptionConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "kmsKeyId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) + } + sv.KmsKeyId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentErrorDetail(v **types.ErrorDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ErrorDetail + if *v == nil { + sv = &types.ErrorDetail{} + } 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 ErrorCode to be of type string, got %T instead", value) + } + sv.ErrorCode = types.ErrorCode(jtv) + } + + case "errorMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.ErrorMessage = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentExampleChatMessages(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 ExampleChatMessage to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentFailedDocument(v **types.FailedDocument, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FailedDocument + if *v == nil { + sv = &types.FailedDocument{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "error": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.Error, value); err != nil { + return err + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFailedDocuments(v *[]types.FailedDocument, 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.FailedDocument + if *v == nil { + cv = []types.FailedDocument{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.FailedDocument + destAddr := &col + if err := awsRestjson1_deserializeDocumentFailedDocument(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentGroupStatusDetail(v **types.GroupStatusDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GroupStatusDetail + if *v == nil { + sv = &types.GroupStatusDetail{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "errorDetail": + if err := awsRestjson1_deserializeDocumentErrorDetail(&sv.ErrorDetail, value); err != nil { + return err + } + + case "lastUpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GroupStatus to be of type string, got %T instead", value) + } + sv.Status = types.GroupStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGroupStatusDetails(v *[]types.GroupStatusDetail, 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.GroupStatusDetail + if *v == nil { + cv = []types.GroupStatusDetail{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.GroupStatusDetail + destAddr := &col + if err := awsRestjson1_deserializeDocumentGroupStatusDetail(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentGroupSummary(v **types.GroupSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GroupSummary + if *v == nil { + sv = &types.GroupSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "groupName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) + } + sv.GroupName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGroupSummaryList(v *[]types.GroupSummary, 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.GroupSummary + if *v == nil { + cv = []types.GroupSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.GroupSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentGroupSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentHookConfiguration(v **types.HookConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.HookConfiguration + if *v == nil { + sv = &types.HookConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "invocationCondition": + if err := awsRestjson1_deserializeDocumentDocumentAttributeCondition(&sv.InvocationCondition, value); err != nil { + return err + } + + case "lambdaArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LambdaArn to be of type string, got %T instead", value) + } + sv.LambdaArn = ptr.String(jtv) + } + + 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) + } + + case "s3BucketName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3BucketName to be of type string, got %T instead", value) + } + sv.S3BucketName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIndex(v **types.Index, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Index + if *v == nil { + sv = &types.Index{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexStatus to be of type string, got %T instead", value) + } + sv.Status = types.IndexStatus(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_deserializeDocumentIndexCapacityConfiguration(v **types.IndexCapacityConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IndexCapacityConfiguration + if *v == nil { + sv = &types.IndexCapacityConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "units": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IndexCapacityInteger to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Units = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIndexStatistics(v **types.IndexStatistics, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IndexStatistics + if *v == nil { + sv = &types.IndexStatistics{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "textDocumentStatistics": + if err := awsRestjson1_deserializeDocumentTextDocumentStatistics(&sv.TextDocumentStatistics, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentIndices(v *[]types.Index, 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.Index + if *v == nil { + cv = []types.Index{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Index + destAddr := &col + if err := awsRestjson1_deserializeDocumentIndex(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentInlineDocumentEnrichmentConfiguration(v **types.InlineDocumentEnrichmentConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InlineDocumentEnrichmentConfiguration + if *v == nil { + sv = &types.InlineDocumentEnrichmentConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "condition": + if err := awsRestjson1_deserializeDocumentDocumentAttributeCondition(&sv.Condition, value); err != nil { + return err + } + + case "documentContentOperator": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DocumentContentOperator to be of type string, got %T instead", value) + } + sv.DocumentContentOperator = types.DocumentContentOperator(jtv) + } + + case "target": + if err := awsRestjson1_deserializeDocumentDocumentAttributeTarget(&sv.Target, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInlineDocumentEnrichmentConfigurations(v *[]types.InlineDocumentEnrichmentConfiguration, 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.InlineDocumentEnrichmentConfiguration + if *v == nil { + cv = []types.InlineDocumentEnrichmentConfiguration{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.InlineDocumentEnrichmentConfiguration + destAddr := &col + if err := awsRestjson1_deserializeDocumentInlineDocumentEnrichmentConfiguration(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.InternalServerException + if *v == nil { + sv = &types.InternalServerException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKendraIndexConfiguration(v **types.KendraIndexConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KendraIndexConfiguration + if *v == nil { + sv = &types.KendraIndexConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KendraIndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentLicenseNotFoundException(v **types.LicenseNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.LicenseNotFoundException + if *v == nil { + sv = &types.LicenseNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMessage(v **types.Message, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Message + if *v == nil { + sv = &types.Message{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "actionExecution": + if err := awsRestjson1_deserializeDocumentActionExecution(&sv.ActionExecution, value); err != nil { + return err + } + + case "actionReview": + if err := awsRestjson1_deserializeDocumentActionReview(&sv.ActionReview, value); err != nil { + return err + } + + case "attachments": + if err := awsRestjson1_deserializeDocumentAttachmentsOutput(&sv.Attachments, value); err != nil { + return err + } + + case "body": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MessageBody to be of type string, got %T instead", value) + } + sv.Body = ptr.String(jtv) + } + + case "messageId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.MessageId = ptr.String(jtv) + } + + case "sourceAttribution": + if err := awsRestjson1_deserializeDocumentSourceAttributions(&sv.SourceAttribution, value); err != nil { + return err + } + + case "time": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Time = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MessageType to be of type string, got %T instead", value) + } + sv.Type = types.MessageType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMessages(v *[]types.Message, 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.Message + if *v == nil { + cv = []types.Message{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Message + destAddr := &col + if err := awsRestjson1_deserializeDocumentMessage(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentNativeIndexConfiguration(v **types.NativeIndexConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.NativeIndexConfiguration + if *v == nil { + sv = &types.NativeIndexConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentOAuth2ClientCredentialConfiguration(v **types.OAuth2ClientCredentialConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.OAuth2ClientCredentialConfiguration + if *v == nil { + sv = &types.OAuth2ClientCredentialConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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) + } + + 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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPlugin(v **types.Plugin, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Plugin + if *v == nil { + sv = &types.Plugin{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "pluginId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginId to be of type string, got %T instead", value) + } + sv.PluginId = ptr.String(jtv) + } + + case "serverUrl": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.ServerUrl = ptr.String(jtv) + } + + case "state": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginState to be of type string, got %T instead", value) + } + sv.State = types.PluginState(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PluginType to be of type string, got %T instead", value) + } + sv.Type = types.PluginType(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_deserializeDocumentPluginAuthConfiguration(v *types.PluginAuthConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.PluginAuthConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "basicAuthConfiguration": + var mv types.BasicAuthConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentBasicAuthConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PluginAuthConfigurationMemberBasicAuthConfiguration{Value: mv} + break loop + + case "oAuth2ClientCredentialConfiguration": + var mv types.OAuth2ClientCredentialConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentOAuth2ClientCredentialConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentPlugins(v *[]types.Plugin, 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.Plugin + if *v == nil { + cv = []types.Plugin{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Plugin + destAddr := &col + if err := awsRestjson1_deserializeDocumentPlugin(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage 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_deserializeDocumentRetriever(v **types.Retriever, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Retriever + if *v == nil { + sv = &types.Retriever{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "applicationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationId to be of type string, got %T instead", value) + } + sv.ApplicationId = ptr.String(jtv) + } + + case "displayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverName to be of type string, got %T instead", value) + } + sv.DisplayName = ptr.String(jtv) + } + + case "retrieverId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverId to be of type string, got %T instead", value) + } + sv.RetrieverId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverStatus to be of type string, got %T instead", value) + } + sv.Status = types.RetrieverStatus(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RetrieverType to be of type string, got %T instead", value) + } + sv.Type = types.RetrieverType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRetrieverConfiguration(v *types.RetrieverConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.RetrieverConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "kendraIndexConfiguration": + var mv types.KendraIndexConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentKendraIndexConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RetrieverConfigurationMemberKendraIndexConfiguration{Value: mv} + break loop + + case "nativeIndexConfiguration": + var mv types.NativeIndexConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentNativeIndexConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RetrieverConfigurationMemberNativeIndexConfiguration{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRetrievers(v *[]types.Retriever, 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.Retriever + if *v == nil { + cv = []types.Retriever{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Retriever + destAddr := &col + if err := awsRestjson1_deserializeDocumentRetriever(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRule(v **types.Rule, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Rule + if *v == nil { + sv = &types.Rule{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "excludedUsersAndGroups": + if err := awsRestjson1_deserializeDocumentUsersAndGroups(&sv.ExcludedUsersAndGroups, value); err != nil { + return err + } + + case "includedUsersAndGroups": + if err := awsRestjson1_deserializeDocumentUsersAndGroups(&sv.IncludedUsersAndGroups, value); err != nil { + return err + } + + case "ruleConfiguration": + if err := awsRestjson1_deserializeDocumentRuleConfiguration(&sv.RuleConfiguration, value); err != nil { + return err + } + + case "ruleType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RuleType to be of type string, got %T instead", value) + } + sv.RuleType = types.RuleType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRuleConfiguration(v *types.RuleConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.RuleConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "contentBlockerRule": + var mv types.ContentBlockerRule + destAddr := &mv + if err := awsRestjson1_deserializeDocumentContentBlockerRule(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RuleConfigurationMemberContentBlockerRule{Value: mv} + break loop + + case "contentRetrievalRule": + var mv types.ContentRetrievalRule + destAddr := &mv + if err := awsRestjson1_deserializeDocumentContentRetrievalRule(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RuleConfigurationMemberContentRetrievalRule{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRules(v *[]types.Rule, 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.Rule + if *v == nil { + cv = []types.Rule{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Rule + destAddr := &col + if err := awsRestjson1_deserializeDocumentRule(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentSamlConfiguration(v **types.SamlConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SamlConfiguration + if *v == nil { + sv = &types.SamlConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "metadataXML": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SamlMetadataXML to be of type string, got %T instead", value) + } + sv.MetadataXML = ptr.String(jtv) + } + + 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) + } + + case "userGroupAttribute": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SamlAttribute to be of type string, got %T instead", value) + } + sv.UserGroupAttribute = ptr.String(jtv) + } + + case "userIdAttribute": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SamlAttribute to be of type string, got %T instead", value) + } + sv.UserIdAttribute = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSecurityGroupIds(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_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ServiceQuotaExceededException + if *v == nil { + sv = &types.ServiceQuotaExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "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_deserializeDocumentSourceAttribution(v **types.SourceAttribution, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SourceAttribution + if *v == nil { + sv = &types.SourceAttribution{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "citationNumber": + 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.CitationNumber = ptr.Int32(int32(i64)) + } + + case "snippet": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Snippet = ptr.String(jtv) + } + + case "textMessageSegments": + if err := awsRestjson1_deserializeDocumentTextSegmentList(&sv.TextMessageSegments, value); err != nil { + return err + } + + case "title": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Title = 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) + + } + } + + case "url": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Url = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSourceAttributions(v *[]*types.SourceAttribution, 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.SourceAttribution + if *v == nil { + cv = []*types.SourceAttribution{} + } else { + cv = *v + } + + for _, value := range shape { + var col *types.SourceAttribution + if err := awsRestjson1_deserializeDocumentSourceAttribution(&col, value); err != nil { + return err + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentSubnetIds(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 SubnetId to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTag(v **types.Tag, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.Tag + if *v == nil { + sv = &types.Tag{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "key": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) + } + sv.Key = ptr.String(jtv) + } + + case "value": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) + } + sv.Value = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTags(v *[]types.Tag, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.Tag + if *v == nil { + cv = []types.Tag{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Tag + destAddr := &col + if err := awsRestjson1_deserializeDocumentTag(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTextDocumentStatistics(v **types.TextDocumentStatistics, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TextDocumentStatistics + if *v == nil { + sv = &types.TextDocumentStatistics{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "indexedTextBytes": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IndexedTextBytes to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IndexedTextBytes = ptr.Int64(i64) + } + + case "indexedTextDocumentCount": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IndexedTextDocument to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IndexedTextDocumentCount = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTextSegment(v **types.TextSegment, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TextSegment + if *v == nil { + sv = &types.TextSegment{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "beginOffset": + 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.BeginOffset = ptr.Int32(int32(i64)) + } + + case "endOffset": + 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.EndOffset = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTextSegmentList(v *[]types.TextSegment, 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.TextSegment + if *v == nil { + cv = []types.TextSegment{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.TextSegment + destAddr := &col + if err := awsRestjson1_deserializeDocumentTextSegment(&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 "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTopicConfiguration(v **types.TopicConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TopicConfiguration + if *v == nil { + sv = &types.TopicConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TopicDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "exampleChatMessages": + if err := awsRestjson1_deserializeDocumentExampleChatMessages(&sv.ExampleChatMessages, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TopicConfigurationName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "rules": + if err := awsRestjson1_deserializeDocumentRules(&sv.Rules, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTopicConfigurations(v *[]types.TopicConfiguration, 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.TopicConfiguration + if *v == nil { + cv = []types.TopicConfiguration{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.TopicConfiguration + destAddr := &col + if err := awsRestjson1_deserializeDocumentTopicConfiguration(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentUserAlias(v **types.UserAlias, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.UserAlias + if *v == nil { + sv = &types.UserAlias{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dataSourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceId to be of type string, got %T instead", value) + } + sv.DataSourceId = ptr.String(jtv) + } + + case "indexId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IndexId to be of type string, got %T instead", value) + } + sv.IndexId = ptr.String(jtv) + } + + case "userId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.UserId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentUserAliases(v *[]types.UserAlias, 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.UserAlias + if *v == nil { + cv = []types.UserAlias{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.UserAlias + destAddr := &col + if err := awsRestjson1_deserializeDocumentUserAlias(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentUserGroups(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_deserializeDocumentUserIds(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_deserializeDocumentUsersAndGroups(v **types.UsersAndGroups, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.UsersAndGroups + if *v == nil { + sv = &types.UsersAndGroups{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "userGroups": + if err := awsRestjson1_deserializeDocumentUserGroups(&sv.UserGroups, value); err != nil { + return err + } + + case "userIds": + if err := awsRestjson1_deserializeDocumentUserIds(&sv.UserIds, value); err != nil { + return err + } + + 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 "fields": + if err := awsRestjson1_deserializeDocumentValidationExceptionFields(&sv.Fields, value); err != nil { + return err + } + + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "reason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value) + } + sv.Reason = types.ValidationExceptionReason(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ValidationExceptionField + if *v == nil { + sv = &types.ValidationExceptionField{} + } 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 "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_deserializeDocumentValidationExceptionFields(v *[]types.ValidationExceptionField, 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.ValidationExceptionField + if *v == nil { + cv = []types.ValidationExceptionField{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ValidationExceptionField + destAddr := &col + if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentWebExperience(v **types.WebExperience, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.WebExperience + if *v == nil { + sv = &types.WebExperience{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "defaultEndpoint": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.DefaultEndpoint = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceStatus to be of type string, got %T instead", value) + } + sv.Status = types.WebExperienceStatus(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 "webExperienceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected WebExperienceId to be of type string, got %T instead", value) + } + sv.WebExperienceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentWebExperienceAuthConfiguration(v *types.WebExperienceAuthConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.WebExperienceAuthConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "samlConfiguration": + var mv types.SamlConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentSamlConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.WebExperienceAuthConfigurationMemberSamlConfiguration{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentWebExperiences(v *[]types.WebExperience, 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.WebExperience + if *v == nil { + cv = []types.WebExperience{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.WebExperience + destAddr := &col + if err := awsRestjson1_deserializeDocumentWebExperience(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} diff --git a/service/qbusiness/doc.go b/service/qbusiness/doc.go new file mode 100644 index 00000000000..a5d86d810a9 --- /dev/null +++ b/service/qbusiness/doc.go @@ -0,0 +1,5 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package qbusiness provides the API client, operations, and parameter types for +// QBusiness. +package qbusiness diff --git a/service/qbusiness/document/doc.go b/service/qbusiness/document/doc.go new file mode 100644 index 00000000000..2b06b14f3cd --- /dev/null +++ b/service/qbusiness/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/qbusiness/document/document.go b/service/qbusiness/document/document.go new file mode 100644 index 00000000000..8d9add18bbe --- /dev/null +++ b/service/qbusiness/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/qbusiness/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/qbusiness/endpoints.go b/service/qbusiness/endpoints.go new file mode 100644 index 00000000000..eb3d36d677b --- /dev/null +++ b/service/qbusiness/endpoints.go @@ -0,0 +1,480 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + "github.com/aws/aws-sdk-go-v2/internal/endpoints" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/qbusiness/internal/endpoints" + smithyauth "github.com/aws/smithy-go/auth" + 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" + "os" + "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 = "qbusiness" + } + 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() + } +} + +func resolveBaseEndpoint(cfg aws.Config, o *Options) { + if cfg.BaseEndpoint != nil { + o.BaseEndpoint = cfg.BaseEndpoint + } + + _, g := os.LookupEnv("AWS_ENDPOINT_URL") + _, s := os.LookupEnv("AWS_ENDPOINT_URL_QBUSINESS") + + if g && !s { + return + } + + value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "QBusiness", cfg.ConfigSources) + if found && err == nil { + o.BaseEndpoint = &value + } +} + +// 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, 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.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.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) + } + _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") + } + 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 true == _PartitionResult.SupportsDualStack { + if _UseFIPS == true { + if _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://qbusiness-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 is enabled but this partition does not support FIPS") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://qbusiness.") + 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 + } + if _UseFIPS == true { + if _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://qbusiness-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") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://qbusiness.") + 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") +} + +type endpointParamsBinder interface { + bindEndpointParams(*EndpointParameters) +} + +func bindEndpointParams(input interface{}, options Options) *EndpointParameters { + params := &EndpointParameters{} + + params.Region = aws.String(endpoints.MapFIPSRegion(options.Region)) + params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) + params.Endpoint = options.BaseEndpoint + + if b, ok := input.(endpointParamsBinder); ok { + b.bindEndpointParams(params) + } + + return params +} + +type resolveEndpointV2Middleware struct { + options Options +} + +func (*resolveEndpointV2Middleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleFinalize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.options.EndpointResolverV2 == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := bindEndpointParams(getOperationInput(ctx), m.options) + endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + if endpt.URI.RawPath == "" && req.URL.RawPath != "" { + endpt.URI.RawPath = endpt.URI.Path + } + req.URL.Scheme = endpt.URI.Scheme + req.URL.Host = endpt.URI.Host + req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) + req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) + for k := range endpt.Headers { + req.Header.Set(k, endpt.Headers.Get(k)) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) + for _, o := range opts { + rscheme.SignerProperties.SetAll(&o.SignerProperties) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/qbusiness/endpoints_config_test.go b/service/qbusiness/endpoints_config_test.go new file mode 100644 index 00000000000..2de8f9a8141 --- /dev/null +++ b/service/qbusiness/endpoints_config_test.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "os" + "reflect" + "testing" +) + +type mockConfigSource struct { + global string + service string + ignore bool +} + +// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured +// endpoints feature. +func (m mockConfigSource) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) { + return m.ignore, m.ignore, nil +} + +// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use +// with configured endpoints. +func (m mockConfigSource) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) { + if m.service != "" { + return m.service, true, nil + } + return "", false, nil +} + +func TestResolveBaseEndpoint(t *testing.T) { + cases := map[string]struct { + envGlobal string + envService string + envIgnore bool + configGlobal string + configService string + configIgnore bool + clientEndpoint *string + expectURL *string + }{ + "env ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-qbusiness.dev", + envIgnore: true, + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + expectURL: nil, + }, + "env global": { + envGlobal: "https://env-global.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + expectURL: aws.String("https://env-global.dev"), + }, + "env service": { + envGlobal: "https://env-global.dev", + envService: "https://env-qbusiness.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + expectURL: aws.String("https://env-qbusiness.dev"), + }, + "config ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-qbusiness.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + configIgnore: true, + expectURL: nil, + }, + "config global": { + configGlobal: "http://config-global.dev", + expectURL: aws.String("http://config-global.dev"), + }, + "config service": { + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + expectURL: aws.String("http://config-qbusiness.dev"), + }, + "client": { + envGlobal: "https://env-global.dev", + envService: "https://env-qbusiness.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qbusiness.dev", + clientEndpoint: aws.String("https://client-qbusiness.dev"), + expectURL: aws.String("https://client-qbusiness.dev"), + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + os.Clearenv() + + awsConfig := aws.Config{} + ignore := c.envIgnore || c.configIgnore + + if c.configGlobal != "" && !ignore { + awsConfig.BaseEndpoint = aws.String(c.configGlobal) + } + + if c.envGlobal != "" { + t.Setenv("AWS_ENDPOINT_URL", c.envGlobal) + if !ignore { + awsConfig.BaseEndpoint = aws.String(c.envGlobal) + } + } + + if c.envService != "" { + t.Setenv("AWS_ENDPOINT_URL_QBUSINESS", c.envService) + } + + awsConfig.ConfigSources = []interface{}{ + mockConfigSource{ + global: c.envGlobal, + service: c.envService, + ignore: c.envIgnore, + }, + mockConfigSource{ + global: c.configGlobal, + service: c.configService, + ignore: c.configIgnore, + }, + } + + client := NewFromConfig(awsConfig, func(o *Options) { + if c.clientEndpoint != nil { + o.BaseEndpoint = c.clientEndpoint + } + }) + + if e, a := c.expectURL, client.options.BaseEndpoint; !reflect.DeepEqual(e, a) { + t.Errorf("expect endpoint %v , got %v", e, a) + } + }) + } +} diff --git a/service/qbusiness/endpoints_test.go b/service/qbusiness/endpoints_test.go new file mode 100644 index 00000000000..26ba222bbbd --- /dev/null +++ b/service/qbusiness/endpoints_test.go @@ -0,0 +1,356 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +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), + } + + 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://qbusiness-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 disabled and DualStack enabled +func TestEndpointCase1(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: 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://qbusiness.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 cn-north-1 with FIPS enabled and DualStack enabled +func TestEndpointCase2(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: 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://qbusiness-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 disabled and DualStack enabled +func TestEndpointCase3(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: 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://qbusiness.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 us-gov-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase4(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: 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://qbusiness-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 disabled and DualStack enabled +func TestEndpointCase5(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: 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://qbusiness.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 custom endpoint with region set and fips disabled and dualstack disabled +func TestEndpointCase6(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: 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 TestEndpointCase7(t *testing.T) { + var params = EndpointParameters{ + UseFIPS: 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 TestEndpointCase8(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: 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: FIPS and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// Missing region +func TestEndpointCase9(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/qbusiness/generated.json b/service/qbusiness/generated.json new file mode 100644 index 00000000000..84acabfe8c6 --- /dev/null +++ b/service/qbusiness/generated.json @@ -0,0 +1,92 @@ +{ + "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_BatchDeleteDocument.go", + "api_op_BatchPutDocument.go", + "api_op_ChatSync.go", + "api_op_CreateApplication.go", + "api_op_CreateDataSource.go", + "api_op_CreateIndex.go", + "api_op_CreatePlugin.go", + "api_op_CreateRetriever.go", + "api_op_CreateUser.go", + "api_op_CreateWebExperience.go", + "api_op_DeleteApplication.go", + "api_op_DeleteChatControlsConfiguration.go", + "api_op_DeleteConversation.go", + "api_op_DeleteDataSource.go", + "api_op_DeleteGroup.go", + "api_op_DeleteIndex.go", + "api_op_DeletePlugin.go", + "api_op_DeleteRetriever.go", + "api_op_DeleteUser.go", + "api_op_DeleteWebExperience.go", + "api_op_GetApplication.go", + "api_op_GetChatControlsConfiguration.go", + "api_op_GetDataSource.go", + "api_op_GetGroup.go", + "api_op_GetIndex.go", + "api_op_GetPlugin.go", + "api_op_GetRetriever.go", + "api_op_GetUser.go", + "api_op_GetWebExperience.go", + "api_op_ListApplications.go", + "api_op_ListConversations.go", + "api_op_ListDataSourceSyncJobs.go", + "api_op_ListDataSources.go", + "api_op_ListDocuments.go", + "api_op_ListGroups.go", + "api_op_ListIndices.go", + "api_op_ListMessages.go", + "api_op_ListPlugins.go", + "api_op_ListRetrievers.go", + "api_op_ListTagsForResource.go", + "api_op_ListWebExperiences.go", + "api_op_PutFeedback.go", + "api_op_PutGroup.go", + "api_op_StartDataSourceSyncJob.go", + "api_op_StopDataSourceSyncJob.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateApplication.go", + "api_op_UpdateChatControlsConfiguration.go", + "api_op_UpdateDataSource.go", + "api_op_UpdateIndex.go", + "api_op_UpdatePlugin.go", + "api_op_UpdateRetriever.go", + "api_op_UpdateUser.go", + "api_op_UpdateWebExperience.go", + "auth.go", + "deserializers.go", + "doc.go", + "document/doc.go", + "document/document.go", + "endpoints.go", + "endpoints_config_test.go", + "endpoints_test.go", + "generated.json", + "internal/document/document.go", + "internal/document/document_test.go", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "options.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/qbusiness", + "unstable": false +} diff --git a/service/qbusiness/go.mod b/service/qbusiness/go.mod new file mode 100644 index 00000000000..1c0dff9acfc --- /dev/null +++ b/service/qbusiness/go.mod @@ -0,0 +1,17 @@ +module github.com/aws/aws-sdk-go-v2/service/qbusiness + +go 1.19 + +require ( + github.com/aws/aws-sdk-go-v2 v1.23.1 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 + github.com/aws/smithy-go v1.17.0 + 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/qbusiness/go.sum b/service/qbusiness/go.sum new file mode 100644 index 00000000000..42e4fc806b4 --- /dev/null +++ b/service/qbusiness/go.sum @@ -0,0 +1,4 @@ +github.com/aws/smithy-go v1.17.0 h1:wWJD7LX6PBV6etBUwO0zElG0nWN9rUhp0WdYeHSHAaI= +github.com/aws/smithy-go v1.17.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/qbusiness/go_module_metadata.go b/service/qbusiness/go_module_metadata.go new file mode 100644 index 00000000000..c2d57207e5c --- /dev/null +++ b/service/qbusiness/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package qbusiness + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/qbusiness/internal/document/document.go b/service/qbusiness/internal/document/document.go new file mode 100644 index 00000000000..d8522962627 --- /dev/null +++ b/service/qbusiness/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/qbusiness/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/qbusiness/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/qbusiness/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/qbusiness/internal/document/document_test.go b/service/qbusiness/internal/document/document_test.go new file mode 100644 index 00000000000..775645dcd6e --- /dev/null +++ b/service/qbusiness/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/qbusiness/internal/endpoints/endpoints.go b/service/qbusiness/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..4854bfaa3a8 --- /dev/null +++ b/service/qbusiness/internal/endpoints/endpoints.go @@ -0,0 +1,462 @@ +// 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 QBusiness 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: "qbusiness.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "af-south-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.af-south-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-east-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-east-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-northeast-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-northeast-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-northeast-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-northeast-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-northeast-3", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-northeast-3.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-south-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-south-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-south-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-south-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-southeast-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-southeast-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-southeast-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-southeast-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-southeast-3", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-southeast-3.api.aws", + }, + endpoints.EndpointKey{ + Region: "ap-southeast-4", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ap-southeast-4.api.aws", + }, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.ca-central-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-central-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-central-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-central-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-central-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-north-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-north-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-south-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-south-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-south-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-south-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-west-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-west-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-west-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-west-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "eu-west-3", + }: endpoints.Endpoint{ + Hostname: "qbusiness.eu-west-3.api.aws", + }, + endpoints.EndpointKey{ + Region: "il-central-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.il-central-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "me-central-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.me-central-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "me-south-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.me-south-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "sa-east-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.sa-east-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "us-east-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-east-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "us-east-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-east-2.api.aws", + }, + endpoints.EndpointKey{ + Region: "us-west-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-west-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "us-west-2", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-west-2.api.aws", + }, + }, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "qbusiness.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsCn, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "cn-north-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.cn-north-1.api.amazonwebservices.com.cn", + }, + endpoints.EndpointKey{ + Region: "cn-northwest-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.cn-northwest-1.api.amazonwebservices.com.cn", + }, + }, + }, + { + ID: "aws-iso", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "qbusiness-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{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: "qbusiness-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{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: "qbusiness-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{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: "qbusiness-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{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: "qbusiness.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "qbusiness-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "qbusiness.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "us-gov-east-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-gov-east-1.api.aws", + }, + endpoints.EndpointKey{ + Region: "us-gov-west-1", + }: endpoints.Endpoint{ + Hostname: "qbusiness.us-gov-west-1.api.aws", + }, + }, + }, +} diff --git a/service/qbusiness/internal/endpoints/endpoints_test.go b/service/qbusiness/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/qbusiness/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/qbusiness/options.go b/service/qbusiness/options.go new file mode 100644 index 00000000000..1af710d376c --- /dev/null +++ b/service/qbusiness/options.go @@ -0,0 +1,223 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" +) + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +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 operation. 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 + + // The auth scheme resolver which determines how to authenticate for each + // operation. + AuthSchemeResolver AuthSchemeResolver + + // The list of auth schemes supported by the client. + AuthSchemes []smithyhttp.AuthScheme +} + +// 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 (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { + if schemeID == "aws.auth#sigv4" { + return getSigV4IdentityResolver(o) + } + if schemeID == "smithy.api#noAuth" { + return &smithyauth.AnonymousIdentityResolver{} + } + return nil +} + +// 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 + } +} + +func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { + if o.Credentials != nil { + return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} + } + return nil +} + +// WithSigV4SigningName applies an override to the authentication workflow to +// use the given signing name for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing name from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningName(name string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), + middleware.Before, + ) + }) + } +} + +// WithSigV4SigningRegion applies an override to the authentication workflow to +// use the given signing region for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing region from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningRegion(region string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), + middleware.Before, + ) + }) + } +} + +func ignoreAnonymousAuth(options *Options) { + if _, ok := options.Credentials.(aws.AnonymousCredentials); ok { + options.Credentials = nil + } +} diff --git a/service/qbusiness/protocol_test.go b/service/qbusiness/protocol_test.go new file mode 100644 index 00000000000..63f923d31ed --- /dev/null +++ b/service/qbusiness/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness diff --git a/service/qbusiness/serializers.go b/service/qbusiness/serializers.go new file mode 100644 index 00000000000..86925226a6e --- /dev/null +++ b/service/qbusiness/serializers.go @@ -0,0 +1,6418 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + internaldocument "github.com/aws/aws-sdk-go-v2/service/qbusiness/internal/document" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/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" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +type awsRestjson1_serializeOpBatchDeleteDocument struct { +} + +func (*awsRestjson1_serializeOpBatchDeleteDocument) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpBatchDeleteDocument) 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.(*BatchDeleteDocumentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/documents/delete") + 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_serializeOpHttpBindingsBatchDeleteDocumentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentBatchDeleteDocumentInput(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_serializeOpHttpBindingsBatchDeleteDocumentInput(v *BatchDeleteDocumentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentBatchDeleteDocumentInput(v *BatchDeleteDocumentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceSyncId != nil { + ok := object.Key("dataSourceSyncId") + ok.String(*v.DataSourceSyncId) + } + + if v.Documents != nil { + ok := object.Key("documents") + if err := awsRestjson1_serializeDocumentDeleteDocuments(v.Documents, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpBatchPutDocument struct { +} + +func (*awsRestjson1_serializeOpBatchPutDocument) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpBatchPutDocument) 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.(*BatchPutDocumentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/documents") + 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_serializeOpHttpBindingsBatchPutDocumentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentBatchPutDocumentInput(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_serializeOpHttpBindingsBatchPutDocumentInput(v *BatchPutDocumentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentBatchPutDocumentInput(v *BatchPutDocumentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceSyncId != nil { + ok := object.Key("dataSourceSyncId") + ok.String(*v.DataSourceSyncId) + } + + if v.Documents != nil { + ok := object.Key("documents") + if err := awsRestjson1_serializeDocumentDocuments(v.Documents, ok); err != nil { + return err + } + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpChatSync struct { +} + +func (*awsRestjson1_serializeOpChatSync) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpChatSync) 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.(*ChatSyncInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/conversations?sync") + 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_serializeOpHttpBindingsChatSyncInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentChatSyncInput(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_serializeOpHttpBindingsChatSyncInput(v *ChatSyncInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.UserGroups != nil { + for i := range v.UserGroups { + encoder.AddQuery("userGroups").String(v.UserGroups[i]) + } + } + + if v.UserId != nil { + encoder.SetQuery("userId").String(*v.UserId) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentChatSyncInput(v *ChatSyncInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ActionExecution != nil { + ok := object.Key("actionExecution") + if err := awsRestjson1_serializeDocumentActionExecution(v.ActionExecution, ok); err != nil { + return err + } + } + + if v.Attachments != nil { + ok := object.Key("attachments") + if err := awsRestjson1_serializeDocumentAttachmentsInput(v.Attachments, ok); err != nil { + return err + } + } + + if v.AttributeFilter != nil { + ok := object.Key("attributeFilter") + if err := awsRestjson1_serializeDocumentAttributeFilter(v.AttributeFilter, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.ConversationId != nil { + ok := object.Key("conversationId") + ok.String(*v.ConversationId) + } + + if v.ParentMessageId != nil { + ok := object.Key("parentMessageId") + ok.String(*v.ParentMessageId) + } + + if v.UserMessage != nil { + ok := object.Key("userMessage") + ok.String(*v.UserMessage) + } + + return nil +} + +type awsRestjson1_serializeOpCreateApplication struct { +} + +func (*awsRestjson1_serializeOpCreateApplication) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateApplication) 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.(*CreateApplicationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications") + 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_serializeOpDocumentCreateApplicationInput(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_serializeOpHttpBindingsCreateApplicationInput(v *CreateApplicationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateApplicationInput(v *CreateApplicationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AttachmentsConfiguration != nil { + ok := object.Key("attachmentsConfiguration") + if err := awsRestjson1_serializeDocumentAttachmentsConfiguration(v.AttachmentsConfiguration, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.EncryptionConfiguration != nil { + ok := object.Key("encryptionConfiguration") + if err := awsRestjson1_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateDataSource struct { +} + +func (*awsRestjson1_serializeOpCreateDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateDataSource) 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.(*CreateDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources") + 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_serializeOpHttpBindingsCreateDataSourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateDataSourceInput(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_serializeOpHttpBindingsCreateDataSourceInput(v *CreateDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateDataSourceInput(v *CreateDataSourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Configuration != nil { + ok := object.Key("configuration") + if err := awsRestjson1_serializeDocumentDataSourceConfiguration(v.Configuration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.DocumentEnrichmentConfiguration != nil { + ok := object.Key("documentEnrichmentConfiguration") + if err := awsRestjson1_serializeDocumentDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration, ok); err != nil { + return err + } + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.SyncSchedule != nil { + ok := object.Key("syncSchedule") + ok.String(*v.SyncSchedule) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if v.VpcConfiguration != nil { + ok := object.Key("vpcConfiguration") + if err := awsRestjson1_serializeDocumentDataSourceVpcConfiguration(v.VpcConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateIndex struct { +} + +func (*awsRestjson1_serializeOpCreateIndex) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateIndex) 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.(*CreateIndexInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices") + 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_serializeOpHttpBindingsCreateIndexInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateIndexInput(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_serializeOpHttpBindingsCreateIndexInput(v *CreateIndexInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateIndexInput(v *CreateIndexInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CapacityConfiguration != nil { + ok := object.Key("capacityConfiguration") + if err := awsRestjson1_serializeDocumentIndexCapacityConfiguration(v.CapacityConfiguration, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreatePlugin struct { +} + +func (*awsRestjson1_serializeOpCreatePlugin) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreatePlugin) 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.(*CreatePluginInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/plugins") + 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_serializeOpHttpBindingsCreatePluginInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreatePluginInput(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_serializeOpHttpBindingsCreatePluginInput(v *CreatePluginInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreatePluginInput(v *CreatePluginInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AuthConfiguration != nil { + ok := object.Key("authConfiguration") + if err := awsRestjson1_serializeDocumentPluginAuthConfiguration(v.AuthConfiguration, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.ServerUrl != nil { + ok := object.Key("serverUrl") + ok.String(*v.ServerUrl) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +type awsRestjson1_serializeOpCreateRetriever struct { +} + +func (*awsRestjson1_serializeOpCreateRetriever) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateRetriever) 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.(*CreateRetrieverInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/retrievers") + 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_serializeOpHttpBindingsCreateRetrieverInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateRetrieverInput(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_serializeOpHttpBindingsCreateRetrieverInput(v *CreateRetrieverInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateRetrieverInput(v *CreateRetrieverInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Configuration != nil { + ok := object.Key("configuration") + if err := awsRestjson1_serializeDocumentRetrieverConfiguration(v.Configuration, ok); err != nil { + return err + } + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +type awsRestjson1_serializeOpCreateUser struct { +} + +func (*awsRestjson1_serializeOpCreateUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateUser) 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.(*CreateUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/users") + 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_serializeOpHttpBindingsCreateUserInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateUserInput(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_serializeOpHttpBindingsCreateUserInput(v *CreateUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateUserInput(v *CreateUserInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.UserAliases != nil { + ok := object.Key("userAliases") + if err := awsRestjson1_serializeDocumentUserAliases(v.UserAliases, ok); err != nil { + return err + } + } + + if v.UserId != nil { + ok := object.Key("userId") + ok.String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpCreateWebExperience struct { +} + +func (*awsRestjson1_serializeOpCreateWebExperience) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateWebExperience) 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.(*CreateWebExperienceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/experiences") + 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_serializeOpHttpBindingsCreateWebExperienceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateWebExperienceInput(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_serializeOpHttpBindingsCreateWebExperienceInput(v *CreateWebExperienceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateWebExperienceInput(v *CreateWebExperienceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if len(v.SamplePromptsControlMode) > 0 { + ok := object.Key("samplePromptsControlMode") + ok.String(string(v.SamplePromptsControlMode)) + } + + if v.Subtitle != nil { + ok := object.Key("subtitle") + ok.String(*v.Subtitle) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if v.Title != nil { + ok := object.Key("title") + ok.String(*v.Title) + } + + if v.WelcomeMessage != nil { + ok := object.Key("welcomeMessage") + ok.String(*v.WelcomeMessage) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteApplication struct { +} + +func (*awsRestjson1_serializeOpDeleteApplication) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteApplication) 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.(*DeleteApplicationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}") + 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_serializeOpHttpBindingsDeleteApplicationInput(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_serializeOpHttpBindingsDeleteApplicationInput(v *DeleteApplicationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteChatControlsConfiguration struct { +} + +func (*awsRestjson1_serializeOpDeleteChatControlsConfiguration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteChatControlsConfiguration) 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.(*DeleteChatControlsConfigurationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/chatcontrols") + 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_serializeOpHttpBindingsDeleteChatControlsConfigurationInput(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_serializeOpHttpBindingsDeleteChatControlsConfigurationInput(v *DeleteChatControlsConfigurationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteConversation struct { +} + +func (*awsRestjson1_serializeOpDeleteConversation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteConversation) 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.(*DeleteConversationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/conversations/{conversationId}") + 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_serializeOpHttpBindingsDeleteConversationInput(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_serializeOpHttpBindingsDeleteConversationInput(v *DeleteConversationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.ConversationId == nil || len(*v.ConversationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member conversationId must not be empty")} + } + if v.ConversationId != nil { + if err := encoder.SetURI("conversationId").String(*v.ConversationId); err != nil { + return err + } + } + + if v.UserId != nil { + encoder.SetQuery("userId").String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteDataSource struct { +} + +func (*awsRestjson1_serializeOpDeleteDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteDataSource) 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.(*DeleteDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}") + 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_serializeOpHttpBindingsDeleteDataSourceInput(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_serializeOpHttpBindingsDeleteDataSourceInput(v *DeleteDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteGroup struct { +} + +func (*awsRestjson1_serializeOpDeleteGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteGroup) 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.(*DeleteGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/groups/{groupName}") + 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_serializeOpHttpBindingsDeleteGroupInput(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_serializeOpHttpBindingsDeleteGroupInput(v *DeleteGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId != nil { + encoder.SetQuery("dataSourceId").String(*v.DataSourceId) + } + + if v.GroupName == nil || len(*v.GroupName) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member groupName must not be empty")} + } + if v.GroupName != nil { + if err := encoder.SetURI("groupName").String(*v.GroupName); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteIndex struct { +} + +func (*awsRestjson1_serializeOpDeleteIndex) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteIndex) 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.(*DeleteIndexInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}") + 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_serializeOpHttpBindingsDeleteIndexInput(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_serializeOpHttpBindingsDeleteIndexInput(v *DeleteIndexInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeletePlugin struct { +} + +func (*awsRestjson1_serializeOpDeletePlugin) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeletePlugin) 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.(*DeletePluginInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/plugins/{pluginId}") + 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_serializeOpHttpBindingsDeletePluginInput(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_serializeOpHttpBindingsDeletePluginInput(v *DeletePluginInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.PluginId == nil || len(*v.PluginId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member pluginId must not be empty")} + } + if v.PluginId != nil { + if err := encoder.SetURI("pluginId").String(*v.PluginId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteRetriever struct { +} + +func (*awsRestjson1_serializeOpDeleteRetriever) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteRetriever) 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.(*DeleteRetrieverInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/retrievers/{retrieverId}") + 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_serializeOpHttpBindingsDeleteRetrieverInput(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_serializeOpHttpBindingsDeleteRetrieverInput(v *DeleteRetrieverInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.RetrieverId == nil || len(*v.RetrieverId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member retrieverId must not be empty")} + } + if v.RetrieverId != nil { + if err := encoder.SetURI("retrieverId").String(*v.RetrieverId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteUser struct { +} + +func (*awsRestjson1_serializeOpDeleteUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteUser) 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.(*DeleteUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/users/{userId}") + 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_serializeOpHttpBindingsDeleteUserInput(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_serializeOpHttpBindingsDeleteUserInput(v *DeleteUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteWebExperience struct { +} + +func (*awsRestjson1_serializeOpDeleteWebExperience) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteWebExperience) 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.(*DeleteWebExperienceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/experiences/{webExperienceId}") + 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_serializeOpHttpBindingsDeleteWebExperienceInput(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_serializeOpHttpBindingsDeleteWebExperienceInput(v *DeleteWebExperienceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.WebExperienceId == nil || len(*v.WebExperienceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member webExperienceId must not be empty")} + } + if v.WebExperienceId != nil { + if err := encoder.SetURI("webExperienceId").String(*v.WebExperienceId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetApplication struct { +} + +func (*awsRestjson1_serializeOpGetApplication) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetApplication) 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.(*GetApplicationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}") + 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_serializeOpHttpBindingsGetApplicationInput(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_serializeOpHttpBindingsGetApplicationInput(v *GetApplicationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetChatControlsConfiguration struct { +} + +func (*awsRestjson1_serializeOpGetChatControlsConfiguration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetChatControlsConfiguration) 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.(*GetChatControlsConfigurationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/chatcontrols") + 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_serializeOpHttpBindingsGetChatControlsConfigurationInput(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_serializeOpHttpBindingsGetChatControlsConfigurationInput(v *GetChatControlsConfigurationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); 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_serializeOpGetDataSource struct { +} + +func (*awsRestjson1_serializeOpGetDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetDataSource) 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.(*GetDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}") + 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_serializeOpHttpBindingsGetDataSourceInput(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_serializeOpHttpBindingsGetDataSourceInput(v *GetDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetGroup struct { +} + +func (*awsRestjson1_serializeOpGetGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetGroup) 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.(*GetGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/groups/{groupName}") + 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_serializeOpHttpBindingsGetGroupInput(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_serializeOpHttpBindingsGetGroupInput(v *GetGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId != nil { + encoder.SetQuery("dataSourceId").String(*v.DataSourceId) + } + + if v.GroupName == nil || len(*v.GroupName) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member groupName must not be empty")} + } + if v.GroupName != nil { + if err := encoder.SetURI("groupName").String(*v.GroupName); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetIndex struct { +} + +func (*awsRestjson1_serializeOpGetIndex) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetIndex) 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.(*GetIndexInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}") + 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_serializeOpHttpBindingsGetIndexInput(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_serializeOpHttpBindingsGetIndexInput(v *GetIndexInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetPlugin struct { +} + +func (*awsRestjson1_serializeOpGetPlugin) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetPlugin) 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.(*GetPluginInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/plugins/{pluginId}") + 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_serializeOpHttpBindingsGetPluginInput(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_serializeOpHttpBindingsGetPluginInput(v *GetPluginInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.PluginId == nil || len(*v.PluginId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member pluginId must not be empty")} + } + if v.PluginId != nil { + if err := encoder.SetURI("pluginId").String(*v.PluginId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetRetriever struct { +} + +func (*awsRestjson1_serializeOpGetRetriever) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRetriever) 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.(*GetRetrieverInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/retrievers/{retrieverId}") + 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_serializeOpHttpBindingsGetRetrieverInput(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_serializeOpHttpBindingsGetRetrieverInput(v *GetRetrieverInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.RetrieverId == nil || len(*v.RetrieverId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member retrieverId must not be empty")} + } + if v.RetrieverId != nil { + if err := encoder.SetURI("retrieverId").String(*v.RetrieverId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetUser struct { +} + +func (*awsRestjson1_serializeOpGetUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetUser) 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.(*GetUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/users/{userId}") + 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_serializeOpHttpBindingsGetUserInput(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_serializeOpHttpBindingsGetUserInput(v *GetUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetWebExperience struct { +} + +func (*awsRestjson1_serializeOpGetWebExperience) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetWebExperience) 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.(*GetWebExperienceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/experiences/{webExperienceId}") + 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_serializeOpHttpBindingsGetWebExperienceInput(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_serializeOpHttpBindingsGetWebExperienceInput(v *GetWebExperienceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.WebExperienceId == nil || len(*v.WebExperienceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member webExperienceId must not be empty")} + } + if v.WebExperienceId != nil { + if err := encoder.SetURI("webExperienceId").String(*v.WebExperienceId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListApplications struct { +} + +func (*awsRestjson1_serializeOpListApplications) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListApplications) 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.(*ListApplicationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications") + 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_serializeOpHttpBindingsListApplicationsInput(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_serializeOpHttpBindingsListApplicationsInput(v *ListApplicationsInput, 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_serializeOpListConversations struct { +} + +func (*awsRestjson1_serializeOpListConversations) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListConversations) 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.(*ListConversationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/conversations") + 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_serializeOpHttpBindingsListConversationsInput(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_serializeOpHttpBindingsListConversationsInput(v *ListConversationsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.UserId != nil { + encoder.SetQuery("userId").String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpListDataSources struct { +} + +func (*awsRestjson1_serializeOpListDataSources) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListDataSources) 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.(*ListDataSourcesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources") + 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_serializeOpHttpBindingsListDataSourcesInput(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_serializeOpHttpBindingsListDataSourcesInput(v *ListDataSourcesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); 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_serializeOpListDataSourceSyncJobs struct { +} + +func (*awsRestjson1_serializeOpListDataSourceSyncJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListDataSourceSyncJobs) 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.(*ListDataSourceSyncJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}/syncjobs") + 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_serializeOpHttpBindingsListDataSourceSyncJobsInput(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_serializeOpHttpBindingsListDataSourceSyncJobsInput(v *ListDataSourceSyncJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.EndTime != nil { + encoder.SetQuery("endTime").String(smithytime.FormatDateTime(*v.EndTime)) + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.StartTime != nil { + encoder.SetQuery("startTime").String(smithytime.FormatDateTime(*v.StartTime)) + } + + if len(v.StatusFilter) > 0 { + encoder.SetQuery("syncStatus").String(string(v.StatusFilter)) + } + + return nil +} + +type awsRestjson1_serializeOpListDocuments struct { +} + +func (*awsRestjson1_serializeOpListDocuments) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListDocuments) 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.(*ListDocumentsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/index/{indexId}/documents") + 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_serializeOpHttpBindingsListDocumentsInput(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_serializeOpHttpBindingsListDocumentsInput(v *ListDocumentsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceIds != nil { + for i := range v.DataSourceIds { + encoder.AddQuery("dataSourceIds").String(v.DataSourceIds[i]) + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); 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_serializeOpListGroups struct { +} + +func (*awsRestjson1_serializeOpListGroups) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListGroups) 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.(*ListGroupsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/groups") + 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_serializeOpHttpBindingsListGroupsInput(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_serializeOpHttpBindingsListGroupsInput(v *ListGroupsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId != nil { + encoder.SetQuery("dataSourceId").String(*v.DataSourceId) + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.UpdatedEarlierThan != nil { + encoder.SetQuery("updatedEarlierThan").String(smithytime.FormatDateTime(*v.UpdatedEarlierThan)) + } + + return nil +} + +type awsRestjson1_serializeOpListIndices struct { +} + +func (*awsRestjson1_serializeOpListIndices) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListIndices) 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.(*ListIndicesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices") + 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_serializeOpHttpBindingsListIndicesInput(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_serializeOpHttpBindingsListIndicesInput(v *ListIndicesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); 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_serializeOpListMessages struct { +} + +func (*awsRestjson1_serializeOpListMessages) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListMessages) 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.(*ListMessagesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/conversations/{conversationId}") + 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_serializeOpHttpBindingsListMessagesInput(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_serializeOpHttpBindingsListMessagesInput(v *ListMessagesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.ConversationId == nil || len(*v.ConversationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member conversationId must not be empty")} + } + if v.ConversationId != nil { + if err := encoder.SetURI("conversationId").String(*v.ConversationId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.UserId != nil { + encoder.SetQuery("userId").String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpListPlugins struct { +} + +func (*awsRestjson1_serializeOpListPlugins) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListPlugins) 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.(*ListPluginsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/plugins") + 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_serializeOpHttpBindingsListPluginsInput(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_serializeOpHttpBindingsListPluginsInput(v *ListPluginsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); 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_serializeOpListRetrievers struct { +} + +func (*awsRestjson1_serializeOpListRetrievers) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListRetrievers) 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.(*ListRetrieversInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/retrievers") + 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_serializeOpHttpBindingsListRetrieversInput(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_serializeOpHttpBindingsListRetrieversInput(v *ListRetrieversInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); 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("/v1/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_serializeOpListWebExperiences struct { +} + +func (*awsRestjson1_serializeOpListWebExperiences) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListWebExperiences) 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.(*ListWebExperiencesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/experiences") + 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_serializeOpHttpBindingsListWebExperiencesInput(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_serializeOpHttpBindingsListWebExperiencesInput(v *ListWebExperiencesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); 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_serializeOpPutFeedback struct { +} + +func (*awsRestjson1_serializeOpPutFeedback) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpPutFeedback) 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.(*PutFeedbackInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/conversations/{conversationId}/messages/{messageId}/feedback") + 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_serializeOpHttpBindingsPutFeedbackInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentPutFeedbackInput(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_serializeOpHttpBindingsPutFeedbackInput(v *PutFeedbackInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.ConversationId == nil || len(*v.ConversationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member conversationId must not be empty")} + } + if v.ConversationId != nil { + if err := encoder.SetURI("conversationId").String(*v.ConversationId); err != nil { + return err + } + } + + if v.MessageId == nil || len(*v.MessageId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member messageId must not be empty")} + } + if v.MessageId != nil { + if err := encoder.SetURI("messageId").String(*v.MessageId); err != nil { + return err + } + } + + if v.UserId != nil { + encoder.SetQuery("userId").String(*v.UserId) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentPutFeedbackInput(v *PutFeedbackInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MessageCopiedAt != nil { + ok := object.Key("messageCopiedAt") + ok.Double(smithytime.FormatEpochSeconds(*v.MessageCopiedAt)) + } + + if v.MessageUsefulness != nil { + ok := object.Key("messageUsefulness") + if err := awsRestjson1_serializeDocumentMessageUsefulnessFeedback(v.MessageUsefulness, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpPutGroup struct { +} + +func (*awsRestjson1_serializeOpPutGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpPutGroup) 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.(*PutGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/groups") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsPutGroupInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentPutGroupInput(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_serializeOpHttpBindingsPutGroupInput(v *PutGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentPutGroupInput(v *PutGroupInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceId != nil { + ok := object.Key("dataSourceId") + ok.String(*v.DataSourceId) + } + + if v.GroupMembers != nil { + ok := object.Key("groupMembers") + if err := awsRestjson1_serializeDocumentGroupMembers(v.GroupMembers, ok); err != nil { + return err + } + } + + if v.GroupName != nil { + ok := object.Key("groupName") + ok.String(*v.GroupName) + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +type awsRestjson1_serializeOpStartDataSourceSyncJob struct { +} + +func (*awsRestjson1_serializeOpStartDataSourceSyncJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartDataSourceSyncJob) 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.(*StartDataSourceSyncJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}/startsync") + 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_serializeOpHttpBindingsStartDataSourceSyncJobInput(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_serializeOpHttpBindingsStartDataSourceSyncJobInput(v *StartDataSourceSyncJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpStopDataSourceSyncJob struct { +} + +func (*awsRestjson1_serializeOpStopDataSourceSyncJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStopDataSourceSyncJob) 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.(*StopDataSourceSyncJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}/stopsync") + 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_serializeOpHttpBindingsStopDataSourceSyncJobInput(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_serializeOpHttpBindingsStopDataSourceSyncJobInput(v *StopDataSourceSyncJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpTagResource struct { +} + +func (*awsRestjson1_serializeOpTagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpTagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*TagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/v1/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("/v1/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_serializeOpUpdateApplication struct { +} + +func (*awsRestjson1_serializeOpUpdateApplication) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateApplication) 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.(*UpdateApplicationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateApplicationInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateApplicationInput(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_serializeOpHttpBindingsUpdateApplicationInput(v *UpdateApplicationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateApplicationInput(v *UpdateApplicationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AttachmentsConfiguration != nil { + ok := object.Key("attachmentsConfiguration") + if err := awsRestjson1_serializeDocumentAttachmentsConfiguration(v.AttachmentsConfiguration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateChatControlsConfiguration struct { +} + +func (*awsRestjson1_serializeOpUpdateChatControlsConfiguration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateChatControlsConfiguration) 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.(*UpdateChatControlsConfigurationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/chatcontrols") + 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_serializeOpHttpBindingsUpdateChatControlsConfigurationInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateChatControlsConfigurationInput(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_serializeOpHttpBindingsUpdateChatControlsConfigurationInput(v *UpdateChatControlsConfigurationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateChatControlsConfigurationInput(v *UpdateChatControlsConfigurationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BlockedPhrasesConfigurationUpdate != nil { + ok := object.Key("blockedPhrasesConfigurationUpdate") + if err := awsRestjson1_serializeDocumentBlockedPhrasesConfigurationUpdate(v.BlockedPhrasesConfigurationUpdate, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if len(v.ResponseScope) > 0 { + ok := object.Key("responseScope") + ok.String(string(v.ResponseScope)) + } + + if v.TopicConfigurationsToCreateOrUpdate != nil { + ok := object.Key("topicConfigurationsToCreateOrUpdate") + if err := awsRestjson1_serializeDocumentTopicConfigurations(v.TopicConfigurationsToCreateOrUpdate, ok); err != nil { + return err + } + } + + if v.TopicConfigurationsToDelete != nil { + ok := object.Key("topicConfigurationsToDelete") + if err := awsRestjson1_serializeDocumentTopicConfigurations(v.TopicConfigurationsToDelete, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateDataSource struct { +} + +func (*awsRestjson1_serializeOpUpdateDataSource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateDataSource) 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.(*UpdateDataSourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}/datasources/{dataSourceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateDataSourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateDataSourceInput(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_serializeOpHttpBindingsUpdateDataSourceInput(v *UpdateDataSourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.DataSourceId == nil || len(*v.DataSourceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member dataSourceId must not be empty")} + } + if v.DataSourceId != nil { + if err := encoder.SetURI("dataSourceId").String(*v.DataSourceId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateDataSourceInput(v *UpdateDataSourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Configuration != nil { + ok := object.Key("configuration") + if err := awsRestjson1_serializeDocumentDataSourceConfiguration(v.Configuration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.DocumentEnrichmentConfiguration != nil { + ok := object.Key("documentEnrichmentConfiguration") + if err := awsRestjson1_serializeDocumentDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration, ok); err != nil { + return err + } + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.SyncSchedule != nil { + ok := object.Key("syncSchedule") + ok.String(*v.SyncSchedule) + } + + if v.VpcConfiguration != nil { + ok := object.Key("vpcConfiguration") + if err := awsRestjson1_serializeDocumentDataSourceVpcConfiguration(v.VpcConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateIndex struct { +} + +func (*awsRestjson1_serializeOpUpdateIndex) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateIndex) 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.(*UpdateIndexInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/indices/{indexId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateIndexInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateIndexInput(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_serializeOpHttpBindingsUpdateIndexInput(v *UpdateIndexInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.IndexId == nil || len(*v.IndexId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member indexId must not be empty")} + } + if v.IndexId != nil { + if err := encoder.SetURI("indexId").String(*v.IndexId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateIndexInput(v *UpdateIndexInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CapacityConfiguration != nil { + ok := object.Key("capacityConfiguration") + if err := awsRestjson1_serializeDocumentIndexCapacityConfiguration(v.CapacityConfiguration, ok); err != nil { + return err + } + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.DocumentAttributeConfigurations != nil { + ok := object.Key("documentAttributeConfigurations") + if err := awsRestjson1_serializeDocumentDocumentAttributeConfigurations(v.DocumentAttributeConfigurations, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdatePlugin struct { +} + +func (*awsRestjson1_serializeOpUpdatePlugin) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdatePlugin) 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.(*UpdatePluginInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/plugins/{pluginId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdatePluginInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdatePluginInput(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_serializeOpHttpBindingsUpdatePluginInput(v *UpdatePluginInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.PluginId == nil || len(*v.PluginId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member pluginId must not be empty")} + } + if v.PluginId != nil { + if err := encoder.SetURI("pluginId").String(*v.PluginId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdatePluginInput(v *UpdatePluginInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AuthConfiguration != nil { + ok := object.Key("authConfiguration") + if err := awsRestjson1_serializeDocumentPluginAuthConfiguration(v.AuthConfiguration, ok); err != nil { + return err + } + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.ServerUrl != nil { + ok := object.Key("serverUrl") + ok.String(*v.ServerUrl) + } + + if len(v.State) > 0 { + ok := object.Key("state") + ok.String(string(v.State)) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateRetriever struct { +} + +func (*awsRestjson1_serializeOpUpdateRetriever) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateRetriever) 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.(*UpdateRetrieverInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/retrievers/{retrieverId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateRetrieverInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateRetrieverInput(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_serializeOpHttpBindingsUpdateRetrieverInput(v *UpdateRetrieverInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.RetrieverId == nil || len(*v.RetrieverId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member retrieverId must not be empty")} + } + if v.RetrieverId != nil { + if err := encoder.SetURI("retrieverId").String(*v.RetrieverId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateRetrieverInput(v *UpdateRetrieverInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Configuration != nil { + ok := object.Key("configuration") + if err := awsRestjson1_serializeDocumentRetrieverConfiguration(v.Configuration, ok); err != nil { + return err + } + } + + if v.DisplayName != nil { + ok := object.Key("displayName") + ok.String(*v.DisplayName) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateUser struct { +} + +func (*awsRestjson1_serializeOpUpdateUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateUser) 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.(*UpdateUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/users/{userId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateUserInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateUserInput(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_serializeOpHttpBindingsUpdateUserInput(v *UpdateUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateUserInput(v *UpdateUserInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.UserAliasesToDelete != nil { + ok := object.Key("userAliasesToDelete") + if err := awsRestjson1_serializeDocumentUserAliases(v.UserAliasesToDelete, ok); err != nil { + return err + } + } + + if v.UserAliasesToUpdate != nil { + ok := object.Key("userAliasesToUpdate") + if err := awsRestjson1_serializeDocumentUserAliases(v.UserAliasesToUpdate, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateWebExperience struct { +} + +func (*awsRestjson1_serializeOpUpdateWebExperience) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateWebExperience) 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.(*UpdateWebExperienceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{applicationId}/experiences/{webExperienceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpHttpBindingsUpdateWebExperienceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateWebExperienceInput(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_serializeOpHttpBindingsUpdateWebExperienceInput(v *UpdateWebExperienceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ApplicationId == nil || len(*v.ApplicationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member applicationId must not be empty")} + } + if v.ApplicationId != nil { + if err := encoder.SetURI("applicationId").String(*v.ApplicationId); err != nil { + return err + } + } + + if v.WebExperienceId == nil || len(*v.WebExperienceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member webExperienceId must not be empty")} + } + if v.WebExperienceId != nil { + if err := encoder.SetURI("webExperienceId").String(*v.WebExperienceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateWebExperienceInput(v *UpdateWebExperienceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AuthenticationConfiguration != nil { + ok := object.Key("authenticationConfiguration") + if err := awsRestjson1_serializeDocumentWebExperienceAuthConfiguration(v.AuthenticationConfiguration, ok); err != nil { + return err + } + } + + if len(v.SamplePromptsControlMode) > 0 { + ok := object.Key("samplePromptsControlMode") + ok.String(string(v.SamplePromptsControlMode)) + } + + if v.Subtitle != nil { + ok := object.Key("subtitle") + ok.String(*v.Subtitle) + } + + if v.Title != nil { + ok := object.Key("title") + ok.String(*v.Title) + } + + if v.WelcomeMessage != nil { + ok := object.Key("welcomeMessage") + ok.String(*v.WelcomeMessage) + } + + return nil +} + +func awsRestjson1_serializeDocumentAccessConfiguration(v *types.AccessConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccessControls != nil { + ok := object.Key("accessControls") + if err := awsRestjson1_serializeDocumentAccessControls(v.AccessControls, ok); err != nil { + return err + } + } + + if len(v.MemberRelation) > 0 { + ok := object.Key("memberRelation") + ok.String(string(v.MemberRelation)) + } + + return nil +} + +func awsRestjson1_serializeDocumentAccessControl(v *types.AccessControl, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.MemberRelation) > 0 { + ok := object.Key("memberRelation") + ok.String(string(v.MemberRelation)) + } + + if v.Principals != nil { + ok := object.Key("principals") + if err := awsRestjson1_serializeDocumentPrincipals(v.Principals, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentAccessControls(v []types.AccessControl, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentAccessControl(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentActionExecution(v *types.ActionExecution, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Payload != nil { + ok := object.Key("payload") + if err := awsRestjson1_serializeDocumentActionExecutionPayload(v.Payload, ok); err != nil { + return err + } + } + + if v.PayloadFieldNameSeparator != nil { + ok := object.Key("payloadFieldNameSeparator") + ok.String(*v.PayloadFieldNameSeparator) + } + + if v.PluginId != nil { + ok := object.Key("pluginId") + ok.String(*v.PluginId) + } + + return nil +} + +func awsRestjson1_serializeDocumentActionExecutionPayload(v map[string]types.ActionExecutionPayloadField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + for key := range v { + om := object.Key(key) + mapVar := v[key] + if err := awsRestjson1_serializeDocumentActionExecutionPayloadField(&mapVar, om); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentActionExecutionPayloadField(v *types.ActionExecutionPayloadField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Value != nil { + ok := object.Key("value") + if err := awsRestjson1_serializeDocumentActionPayloadFieldValue(v.Value, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentActionPayloadFieldValue(v document.Interface, value smithyjson.Value) error { + if v == nil { + return nil + } + if !internaldocument.IsInterface(v) { + return fmt.Errorf("%T is not a compatible document type", v) + } + db, err := v.MarshalSmithyDocument() + if err != nil { + return err + } + value.Write(db) + return nil +} + +func awsRestjson1_serializeDocumentAttachmentInput(v *types.AttachmentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Data != nil { + ok := object.Key("data") + ok.Base64EncodeBytes(v.Data) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + return nil +} + +func awsRestjson1_serializeDocumentAttachmentsConfiguration(v *types.AttachmentsConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.AttachmentsControlMode) > 0 { + ok := object.Key("attachmentsControlMode") + ok.String(string(v.AttachmentsControlMode)) + } + + return nil +} + +func awsRestjson1_serializeDocumentAttachmentsInput(v []types.AttachmentInput, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentAttachmentInput(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentAttributeFilter(v *types.AttributeFilter, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AndAllFilters != nil { + ok := object.Key("andAllFilters") + if err := awsRestjson1_serializeDocumentAttributeFilters(v.AndAllFilters, ok); err != nil { + return err + } + } + + if v.ContainsAll != nil { + ok := object.Key("containsAll") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.ContainsAll, ok); err != nil { + return err + } + } + + if v.ContainsAny != nil { + ok := object.Key("containsAny") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.ContainsAny, ok); err != nil { + return err + } + } + + if v.EqualsTo != nil { + ok := object.Key("equalsTo") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.EqualsTo, ok); err != nil { + return err + } + } + + if v.GreaterThan != nil { + ok := object.Key("greaterThan") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.GreaterThan, ok); err != nil { + return err + } + } + + if v.GreaterThanOrEquals != nil { + ok := object.Key("greaterThanOrEquals") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.GreaterThanOrEquals, ok); err != nil { + return err + } + } + + if v.LessThan != nil { + ok := object.Key("lessThan") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.LessThan, ok); err != nil { + return err + } + } + + if v.LessThanOrEquals != nil { + ok := object.Key("lessThanOrEquals") + if err := awsRestjson1_serializeDocumentDocumentAttribute(v.LessThanOrEquals, ok); err != nil { + return err + } + } + + if v.NotFilter != nil { + ok := object.Key("notFilter") + if err := awsRestjson1_serializeDocumentAttributeFilter(v.NotFilter, ok); err != nil { + return err + } + } + + if v.OrAllFilters != nil { + ok := object.Key("orAllFilters") + if err := awsRestjson1_serializeDocumentAttributeFilters(v.OrAllFilters, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentAttributeFilters(v []types.AttributeFilter, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentAttributeFilter(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentBasicAuthConfiguration(v *types.BasicAuthConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.SecretArn != nil { + ok := object.Key("secretArn") + ok.String(*v.SecretArn) + } + + return nil +} + +func awsRestjson1_serializeDocumentBlockedPhrases(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_serializeDocumentBlockedPhrasesConfigurationUpdate(v *types.BlockedPhrasesConfigurationUpdate, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BlockedPhrasesToCreateOrUpdate != nil { + ok := object.Key("blockedPhrasesToCreateOrUpdate") + if err := awsRestjson1_serializeDocumentBlockedPhrases(v.BlockedPhrasesToCreateOrUpdate, ok); err != nil { + return err + } + } + + if v.BlockedPhrasesToDelete != nil { + ok := object.Key("blockedPhrasesToDelete") + if err := awsRestjson1_serializeDocumentBlockedPhrases(v.BlockedPhrasesToDelete, ok); err != nil { + return err + } + } + + if v.SystemMessageOverride != nil { + ok := object.Key("systemMessageOverride") + ok.String(*v.SystemMessageOverride) + } + + return nil +} + +func awsRestjson1_serializeDocumentContentBlockerRule(v *types.ContentBlockerRule, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SystemMessageOverride != nil { + ok := object.Key("systemMessageOverride") + ok.String(*v.SystemMessageOverride) + } + + return nil +} + +func awsRestjson1_serializeDocumentContentRetrievalRule(v *types.ContentRetrievalRule, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EligibleDataSources != nil { + ok := object.Key("eligibleDataSources") + if err := awsRestjson1_serializeDocumentEligibleDataSources(v.EligibleDataSources, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDataSourceConfiguration(v document.Interface, value smithyjson.Value) error { + if v == nil { + return nil + } + if !internaldocument.IsInterface(v) { + return fmt.Errorf("%T is not a compatible document type", v) + } + db, err := v.MarshalSmithyDocument() + if err != nil { + return err + } + value.Write(db) + return nil +} + +func awsRestjson1_serializeDocumentDataSourceVpcConfiguration(v *types.DataSourceVpcConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SecurityGroupIds != nil { + ok := object.Key("securityGroupIds") + if err := awsRestjson1_serializeDocumentSecurityGroupIds(v.SecurityGroupIds, ok); err != nil { + return err + } + } + + if v.SubnetIds != nil { + ok := object.Key("subnetIds") + if err := awsRestjson1_serializeDocumentSubnetIds(v.SubnetIds, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDeleteDocument(v *types.DeleteDocument, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DocumentId != nil { + ok := object.Key("documentId") + ok.String(*v.DocumentId) + } + + return nil +} + +func awsRestjson1_serializeDocumentDeleteDocuments(v []types.DeleteDocument, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentDeleteDocument(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentDocument(v *types.Document, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccessConfiguration != nil { + ok := object.Key("accessConfiguration") + if err := awsRestjson1_serializeDocumentAccessConfiguration(v.AccessConfiguration, ok); err != nil { + return err + } + } + + if v.Attributes != nil { + ok := object.Key("attributes") + if err := awsRestjson1_serializeDocumentDocumentAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.Content != nil { + ok := object.Key("content") + if err := awsRestjson1_serializeDocumentDocumentContent(v.Content, ok); err != nil { + return err + } + } + + if len(v.ContentType) > 0 { + ok := object.Key("contentType") + ok.String(string(v.ContentType)) + } + + if v.DocumentEnrichmentConfiguration != nil { + ok := object.Key("documentEnrichmentConfiguration") + if err := awsRestjson1_serializeDocumentDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration, ok); err != nil { + return err + } + } + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.Title != nil { + ok := object.Key("title") + ok.String(*v.Title) + } + + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttribute(v *types.DocumentAttribute, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Value != nil { + ok := object.Key("value") + if err := awsRestjson1_serializeDocumentDocumentAttributeValue(v.Value, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributeCondition(v *types.DocumentAttributeCondition, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Key != nil { + ok := object.Key("key") + ok.String(*v.Key) + } + + if len(v.Operator) > 0 { + ok := object.Key("operator") + ok.String(string(v.Operator)) + } + + if v.Value != nil { + ok := object.Key("value") + if err := awsRestjson1_serializeDocumentDocumentAttributeValue(v.Value, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributeConfiguration(v *types.DocumentAttributeConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if len(v.Search) > 0 { + ok := object.Key("search") + ok.String(string(v.Search)) + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributeConfigurations(v []types.DocumentAttributeConfiguration, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentDocumentAttributeConfiguration(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributes(v []types.DocumentAttribute, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentDocumentAttribute(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributeStringListValue(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_serializeDocumentDocumentAttributeTarget(v *types.DocumentAttributeTarget, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.AttributeValueOperator) > 0 { + ok := object.Key("attributeValueOperator") + ok.String(string(v.AttributeValueOperator)) + } + + if v.Key != nil { + ok := object.Key("key") + ok.String(*v.Key) + } + + if v.Value != nil { + ok := object.Key("value") + if err := awsRestjson1_serializeDocumentDocumentAttributeValue(v.Value, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDocumentAttributeValue(v types.DocumentAttributeValue, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.DocumentAttributeValueMemberDateValue: + av := object.Key("dateValue") + av.Double(smithytime.FormatEpochSeconds(uv.Value)) + + case *types.DocumentAttributeValueMemberLongValue: + av := object.Key("longValue") + av.Long(uv.Value) + + case *types.DocumentAttributeValueMemberStringListValue: + av := object.Key("stringListValue") + if err := awsRestjson1_serializeDocumentDocumentAttributeStringListValue(uv.Value, av); err != nil { + return err + } + + case *types.DocumentAttributeValueMemberStringValue: + av := object.Key("stringValue") + av.String(uv.Value) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentDocumentContent(v types.DocumentContent, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.DocumentContentMemberBlob: + av := object.Key("blob") + av.Base64EncodeBytes(uv.Value) + + case *types.DocumentContentMemberS3: + av := object.Key("s3") + if err := awsRestjson1_serializeDocumentS3(&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_serializeDocumentDocumentEnrichmentConfiguration(v *types.DocumentEnrichmentConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.InlineConfigurations != nil { + ok := object.Key("inlineConfigurations") + if err := awsRestjson1_serializeDocumentInlineDocumentEnrichmentConfigurations(v.InlineConfigurations, ok); err != nil { + return err + } + } + + if v.PostExtractionHookConfiguration != nil { + ok := object.Key("postExtractionHookConfiguration") + if err := awsRestjson1_serializeDocumentHookConfiguration(v.PostExtractionHookConfiguration, ok); err != nil { + return err + } + } + + if v.PreExtractionHookConfiguration != nil { + ok := object.Key("preExtractionHookConfiguration") + if err := awsRestjson1_serializeDocumentHookConfiguration(v.PreExtractionHookConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentDocuments(v []types.Document, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentDocument(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentEligibleDataSource(v *types.EligibleDataSource, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceId != nil { + ok := object.Key("dataSourceId") + ok.String(*v.DataSourceId) + } + + if v.IndexId != nil { + ok := object.Key("indexId") + ok.String(*v.IndexId) + } + + return nil +} + +func awsRestjson1_serializeDocumentEligibleDataSources(v []types.EligibleDataSource, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentEligibleDataSource(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentEncryptionConfiguration(v *types.EncryptionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KmsKeyId != nil { + ok := object.Key("kmsKeyId") + ok.String(*v.KmsKeyId) + } + + return nil +} + +func awsRestjson1_serializeDocumentExampleChatMessages(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_serializeDocumentGroupMembers(v *types.GroupMembers, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MemberGroups != nil { + ok := object.Key("memberGroups") + if err := awsRestjson1_serializeDocumentMemberGroups(v.MemberGroups, ok); err != nil { + return err + } + } + + if v.MemberUsers != nil { + ok := object.Key("memberUsers") + if err := awsRestjson1_serializeDocumentMemberUsers(v.MemberUsers, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentHookConfiguration(v *types.HookConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.InvocationCondition != nil { + ok := object.Key("invocationCondition") + if err := awsRestjson1_serializeDocumentDocumentAttributeCondition(v.InvocationCondition, ok); err != nil { + return err + } + } + + if v.LambdaArn != nil { + ok := object.Key("lambdaArn") + ok.String(*v.LambdaArn) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.S3BucketName != nil { + ok := object.Key("s3BucketName") + ok.String(*v.S3BucketName) + } + + return nil +} + +func awsRestjson1_serializeDocumentIndexCapacityConfiguration(v *types.IndexCapacityConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Units != nil { + ok := object.Key("units") + ok.Integer(*v.Units) + } + + return nil +} + +func awsRestjson1_serializeDocumentInlineDocumentEnrichmentConfiguration(v *types.InlineDocumentEnrichmentConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Condition != nil { + ok := object.Key("condition") + if err := awsRestjson1_serializeDocumentDocumentAttributeCondition(v.Condition, ok); err != nil { + return err + } + } + + if len(v.DocumentContentOperator) > 0 { + ok := object.Key("documentContentOperator") + ok.String(string(v.DocumentContentOperator)) + } + + if v.Target != nil { + ok := object.Key("target") + if err := awsRestjson1_serializeDocumentDocumentAttributeTarget(v.Target, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentInlineDocumentEnrichmentConfigurations(v []types.InlineDocumentEnrichmentConfiguration, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentInlineDocumentEnrichmentConfiguration(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentKendraIndexConfiguration(v *types.KendraIndexConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.IndexId != nil { + ok := object.Key("indexId") + ok.String(*v.IndexId) + } + + return nil +} + +func awsRestjson1_serializeDocumentMemberGroup(v *types.MemberGroup, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.GroupName != nil { + ok := object.Key("groupName") + ok.String(*v.GroupName) + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +func awsRestjson1_serializeDocumentMemberGroups(v []types.MemberGroup, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentMemberGroup(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentMemberUser(v *types.MemberUser, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + if v.UserId != nil { + ok := object.Key("userId") + ok.String(*v.UserId) + } + + return nil +} + +func awsRestjson1_serializeDocumentMemberUsers(v []types.MemberUser, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentMemberUser(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentMessageUsefulnessFeedback(v *types.MessageUsefulnessFeedback, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Comment != nil { + ok := object.Key("comment") + ok.String(*v.Comment) + } + + if len(v.Reason) > 0 { + ok := object.Key("reason") + ok.String(string(v.Reason)) + } + + if v.SubmittedAt != nil { + ok := object.Key("submittedAt") + ok.Double(smithytime.FormatEpochSeconds(*v.SubmittedAt)) + } + + if len(v.Usefulness) > 0 { + ok := object.Key("usefulness") + ok.String(string(v.Usefulness)) + } + + return nil +} + +func awsRestjson1_serializeDocumentNativeIndexConfiguration(v *types.NativeIndexConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.IndexId != nil { + ok := object.Key("indexId") + ok.String(*v.IndexId) + } + + return nil +} + +func awsRestjson1_serializeDocumentOAuth2ClientCredentialConfiguration(v *types.OAuth2ClientCredentialConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.SecretArn != nil { + ok := object.Key("secretArn") + ok.String(*v.SecretArn) + } + + return nil +} + +func awsRestjson1_serializeDocumentPluginAuthConfiguration(v types.PluginAuthConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.PluginAuthConfigurationMemberBasicAuthConfiguration: + av := object.Key("basicAuthConfiguration") + if err := awsRestjson1_serializeDocumentBasicAuthConfiguration(&uv.Value, av); err != nil { + return err + } + + case *types.PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration: + av := object.Key("oAuth2ClientCredentialConfiguration") + if err := awsRestjson1_serializeDocumentOAuth2ClientCredentialConfiguration(&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_serializeDocumentPrincipal(v types.Principal, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.PrincipalMemberGroup: + av := object.Key("group") + if err := awsRestjson1_serializeDocumentPrincipalGroup(&uv.Value, av); err != nil { + return err + } + + case *types.PrincipalMemberUser: + av := object.Key("user") + if err := awsRestjson1_serializeDocumentPrincipalUser(&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_serializeDocumentPrincipalGroup(v *types.PrincipalGroup, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Access) > 0 { + ok := object.Key("access") + ok.String(string(v.Access)) + } + + if len(v.MembershipType) > 0 { + ok := object.Key("membershipType") + ok.String(string(v.MembershipType)) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrincipals(v []types.Principal, 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_serializeDocumentPrincipal(v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentPrincipalUser(v *types.PrincipalUser, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Access) > 0 { + ok := object.Key("access") + ok.String(string(v.Access)) + } + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if len(v.MembershipType) > 0 { + ok := object.Key("membershipType") + ok.String(string(v.MembershipType)) + } + + return nil +} + +func awsRestjson1_serializeDocumentRetrieverConfiguration(v types.RetrieverConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.RetrieverConfigurationMemberKendraIndexConfiguration: + av := object.Key("kendraIndexConfiguration") + if err := awsRestjson1_serializeDocumentKendraIndexConfiguration(&uv.Value, av); err != nil { + return err + } + + case *types.RetrieverConfigurationMemberNativeIndexConfiguration: + av := object.Key("nativeIndexConfiguration") + if err := awsRestjson1_serializeDocumentNativeIndexConfiguration(&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_serializeDocumentRule(v *types.Rule, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ExcludedUsersAndGroups != nil { + ok := object.Key("excludedUsersAndGroups") + if err := awsRestjson1_serializeDocumentUsersAndGroups(v.ExcludedUsersAndGroups, ok); err != nil { + return err + } + } + + if v.IncludedUsersAndGroups != nil { + ok := object.Key("includedUsersAndGroups") + if err := awsRestjson1_serializeDocumentUsersAndGroups(v.IncludedUsersAndGroups, ok); err != nil { + return err + } + } + + if v.RuleConfiguration != nil { + ok := object.Key("ruleConfiguration") + if err := awsRestjson1_serializeDocumentRuleConfiguration(v.RuleConfiguration, ok); err != nil { + return err + } + } + + if len(v.RuleType) > 0 { + ok := object.Key("ruleType") + ok.String(string(v.RuleType)) + } + + return nil +} + +func awsRestjson1_serializeDocumentRuleConfiguration(v types.RuleConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.RuleConfigurationMemberContentBlockerRule: + av := object.Key("contentBlockerRule") + if err := awsRestjson1_serializeDocumentContentBlockerRule(&uv.Value, av); err != nil { + return err + } + + case *types.RuleConfigurationMemberContentRetrievalRule: + av := object.Key("contentRetrievalRule") + if err := awsRestjson1_serializeDocumentContentRetrievalRule(&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_serializeDocumentRules(v []types.Rule, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentRule(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentS3(v *types.S3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Bucket != nil { + ok := object.Key("bucket") + ok.String(*v.Bucket) + } + + if v.Key != nil { + ok := object.Key("key") + ok.String(*v.Key) + } + + return nil +} + +func awsRestjson1_serializeDocumentSamlConfiguration(v *types.SamlConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetadataXML != nil { + ok := object.Key("metadataXML") + ok.String(*v.MetadataXML) + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + if v.UserGroupAttribute != nil { + ok := object.Key("userGroupAttribute") + ok.String(*v.UserGroupAttribute) + } + + if v.UserIdAttribute != nil { + ok := object.Key("userIdAttribute") + ok.String(*v.UserIdAttribute) + } + + return nil +} + +func awsRestjson1_serializeDocumentSecurityGroupIds(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_serializeDocumentSubnetIds(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Key != nil { + ok := object.Key("key") + ok.String(*v.Key) + } + + if v.Value != nil { + ok := object.Key("value") + ok.String(*v.Value) + } + + return nil +} + +func awsRestjson1_serializeDocumentTags(v []types.Tag, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentTag(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentTopicConfiguration(v *types.TopicConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.ExampleChatMessages != nil { + ok := object.Key("exampleChatMessages") + if err := awsRestjson1_serializeDocumentExampleChatMessages(v.ExampleChatMessages, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Rules != nil { + ok := object.Key("rules") + if err := awsRestjson1_serializeDocumentRules(v.Rules, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentTopicConfigurations(v []types.TopicConfiguration, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentTopicConfiguration(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentUserAlias(v *types.UserAlias, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataSourceId != nil { + ok := object.Key("dataSourceId") + ok.String(*v.DataSourceId) + } + + if v.IndexId != nil { + ok := object.Key("indexId") + ok.String(*v.IndexId) + } + + if v.UserId != nil { + ok := object.Key("userId") + ok.String(*v.UserId) + } + + return nil +} + +func awsRestjson1_serializeDocumentUserAliases(v []types.UserAlias, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentUserAlias(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentUserGroups(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_serializeDocumentUserIds(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_serializeDocumentUsersAndGroups(v *types.UsersAndGroups, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.UserGroups != nil { + ok := object.Key("userGroups") + if err := awsRestjson1_serializeDocumentUserGroups(v.UserGroups, ok); err != nil { + return err + } + } + + if v.UserIds != nil { + ok := object.Key("userIds") + if err := awsRestjson1_serializeDocumentUserIds(v.UserIds, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentWebExperienceAuthConfiguration(v types.WebExperienceAuthConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.WebExperienceAuthConfigurationMemberSamlConfiguration: + av := object.Key("samlConfiguration") + if err := awsRestjson1_serializeDocumentSamlConfiguration(&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 +} diff --git a/service/qbusiness/types/enums.go b/service/qbusiness/types/enums.go new file mode 100644 index 00000000000..fab3f713603 --- /dev/null +++ b/service/qbusiness/types/enums.go @@ -0,0 +1,683 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type ActionPayloadFieldType string + +// Enum values for ActionPayloadFieldType +const ( + ActionPayloadFieldTypeString ActionPayloadFieldType = "STRING" + ActionPayloadFieldTypeNumber ActionPayloadFieldType = "NUMBER" + ActionPayloadFieldTypeArray ActionPayloadFieldType = "ARRAY" + ActionPayloadFieldTypeBoolean ActionPayloadFieldType = "BOOLEAN" +) + +// Values returns all known values for ActionPayloadFieldType. 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 (ActionPayloadFieldType) Values() []ActionPayloadFieldType { + return []ActionPayloadFieldType{ + "STRING", + "NUMBER", + "ARRAY", + "BOOLEAN", + } +} + +type ApplicationStatus string + +// Enum values for ApplicationStatus +const ( + ApplicationStatusCreating ApplicationStatus = "CREATING" + ApplicationStatusActive ApplicationStatus = "ACTIVE" + ApplicationStatusDeleting ApplicationStatus = "DELETING" + ApplicationStatusFailed ApplicationStatus = "FAILED" + ApplicationStatusUpdating ApplicationStatus = "UPDATING" +) + +// Values returns all known values for ApplicationStatus. 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 (ApplicationStatus) Values() []ApplicationStatus { + return []ApplicationStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + "UPDATING", + } +} + +type AttachmentsControlMode string + +// Enum values for AttachmentsControlMode +const ( + AttachmentsControlModeEnabled AttachmentsControlMode = "ENABLED" + AttachmentsControlModeDisabled AttachmentsControlMode = "DISABLED" +) + +// Values returns all known values for AttachmentsControlMode. 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 (AttachmentsControlMode) Values() []AttachmentsControlMode { + return []AttachmentsControlMode{ + "ENABLED", + "DISABLED", + } +} + +type AttachmentStatus string + +// Enum values for AttachmentStatus +const ( + AttachmentStatusFailed AttachmentStatus = "FAILED" + AttachmentStatusSucceeded AttachmentStatus = "SUCCEEDED" +) + +// Values returns all known values for AttachmentStatus. 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 (AttachmentStatus) Values() []AttachmentStatus { + return []AttachmentStatus{ + "FAILED", + "SUCCEEDED", + } +} + +type AttributeType string + +// Enum values for AttributeType +const ( + AttributeTypeString AttributeType = "STRING" + AttributeTypeStringList AttributeType = "STRING_LIST" + AttributeTypeNumber AttributeType = "NUMBER" + AttributeTypeDate AttributeType = "DATE" +) + +// Values returns all known values for AttributeType. 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 (AttributeType) Values() []AttributeType { + return []AttributeType{ + "STRING", + "STRING_LIST", + "NUMBER", + "DATE", + } +} + +type AttributeValueOperator string + +// Enum values for AttributeValueOperator +const ( + AttributeValueOperatorDelete AttributeValueOperator = "DELETE" +) + +// Values returns all known values for AttributeValueOperator. 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 (AttributeValueOperator) Values() []AttributeValueOperator { + return []AttributeValueOperator{ + "DELETE", + } +} + +type ContentType string + +// Enum values for ContentType +const ( + ContentTypePdf ContentType = "PDF" + ContentTypeHtml ContentType = "HTML" + ContentTypeMsWord ContentType = "MS_WORD" + ContentTypePlainText ContentType = "PLAIN_TEXT" + ContentTypePpt ContentType = "PPT" + ContentTypeRtf ContentType = "RTF" + ContentTypeXml ContentType = "XML" + ContentTypeXslt ContentType = "XSLT" + ContentTypeMsExcel ContentType = "MS_EXCEL" + ContentTypeCsv ContentType = "CSV" + ContentTypeJson ContentType = "JSON" + ContentTypeMd ContentType = "MD" +) + +// Values returns all known values for ContentType. 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 (ContentType) Values() []ContentType { + return []ContentType{ + "PDF", + "HTML", + "MS_WORD", + "PLAIN_TEXT", + "PPT", + "RTF", + "XML", + "XSLT", + "MS_EXCEL", + "CSV", + "JSON", + "MD", + } +} + +type DataSourceStatus string + +// Enum values for DataSourceStatus +const ( + DataSourceStatusPendingCreation DataSourceStatus = "PENDING_CREATION" + DataSourceStatusCreating DataSourceStatus = "CREATING" + DataSourceStatusActive DataSourceStatus = "ACTIVE" + DataSourceStatusDeleting DataSourceStatus = "DELETING" + DataSourceStatusFailed DataSourceStatus = "FAILED" + DataSourceStatusUpdating DataSourceStatus = "UPDATING" +) + +// Values returns all known values for DataSourceStatus. 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 (DataSourceStatus) Values() []DataSourceStatus { + return []DataSourceStatus{ + "PENDING_CREATION", + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + "UPDATING", + } +} + +type DataSourceSyncJobStatus string + +// Enum values for DataSourceSyncJobStatus +const ( + DataSourceSyncJobStatusFailed DataSourceSyncJobStatus = "FAILED" + DataSourceSyncJobStatusSucceeded DataSourceSyncJobStatus = "SUCCEEDED" + DataSourceSyncJobStatusSyncing DataSourceSyncJobStatus = "SYNCING" + DataSourceSyncJobStatusIncomplete DataSourceSyncJobStatus = "INCOMPLETE" + DataSourceSyncJobStatusStopping DataSourceSyncJobStatus = "STOPPING" + DataSourceSyncJobStatusAborted DataSourceSyncJobStatus = "ABORTED" + DataSourceSyncJobStatusSyncingIndexing DataSourceSyncJobStatus = "SYNCING_INDEXING" +) + +// Values returns all known values for DataSourceSyncJobStatus. 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 (DataSourceSyncJobStatus) Values() []DataSourceSyncJobStatus { + return []DataSourceSyncJobStatus{ + "FAILED", + "SUCCEEDED", + "SYNCING", + "INCOMPLETE", + "STOPPING", + "ABORTED", + "SYNCING_INDEXING", + } +} + +type DocumentContentOperator string + +// Enum values for DocumentContentOperator +const ( + DocumentContentOperatorDelete DocumentContentOperator = "DELETE" +) + +// Values returns all known values for DocumentContentOperator. 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 (DocumentContentOperator) Values() []DocumentContentOperator { + return []DocumentContentOperator{ + "DELETE", + } +} + +type DocumentEnrichmentConditionOperator string + +// Enum values for DocumentEnrichmentConditionOperator +const ( + DocumentEnrichmentConditionOperatorGreaterThan DocumentEnrichmentConditionOperator = "GREATER_THAN" + DocumentEnrichmentConditionOperatorGreaterThanOrEquals DocumentEnrichmentConditionOperator = "GREATER_THAN_OR_EQUALS" + DocumentEnrichmentConditionOperatorLessThan DocumentEnrichmentConditionOperator = "LESS_THAN" + DocumentEnrichmentConditionOperatorLessThanOrEquals DocumentEnrichmentConditionOperator = "LESS_THAN_OR_EQUALS" + DocumentEnrichmentConditionOperatorEquals DocumentEnrichmentConditionOperator = "EQUALS" + DocumentEnrichmentConditionOperatorNotEquals DocumentEnrichmentConditionOperator = "NOT_EQUALS" + DocumentEnrichmentConditionOperatorContains DocumentEnrichmentConditionOperator = "CONTAINS" + DocumentEnrichmentConditionOperatorNotContains DocumentEnrichmentConditionOperator = "NOT_CONTAINS" + DocumentEnrichmentConditionOperatorExists DocumentEnrichmentConditionOperator = "EXISTS" + DocumentEnrichmentConditionOperatorNotExists DocumentEnrichmentConditionOperator = "NOT_EXISTS" + DocumentEnrichmentConditionOperatorBeginsWith DocumentEnrichmentConditionOperator = "BEGINS_WITH" +) + +// Values returns all known values for DocumentEnrichmentConditionOperator. 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 (DocumentEnrichmentConditionOperator) Values() []DocumentEnrichmentConditionOperator { + return []DocumentEnrichmentConditionOperator{ + "GREATER_THAN", + "GREATER_THAN_OR_EQUALS", + "LESS_THAN", + "LESS_THAN_OR_EQUALS", + "EQUALS", + "NOT_EQUALS", + "CONTAINS", + "NOT_CONTAINS", + "EXISTS", + "NOT_EXISTS", + "BEGINS_WITH", + } +} + +type DocumentStatus string + +// Enum values for DocumentStatus +const ( + DocumentStatusReceived DocumentStatus = "RECEIVED" + DocumentStatusProcessing DocumentStatus = "PROCESSING" + DocumentStatusIndexed DocumentStatus = "INDEXED" + DocumentStatusUpdated DocumentStatus = "UPDATED" + DocumentStatusFailed DocumentStatus = "FAILED" + DocumentStatusDeleting DocumentStatus = "DELETING" + DocumentStatusDeleted DocumentStatus = "DELETED" + DocumentStatusDocumentFailedToIndex DocumentStatus = "DOCUMENT_FAILED_TO_INDEX" +) + +// Values returns all known values for DocumentStatus. 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 (DocumentStatus) Values() []DocumentStatus { + return []DocumentStatus{ + "RECEIVED", + "PROCESSING", + "INDEXED", + "UPDATED", + "FAILED", + "DELETING", + "DELETED", + "DOCUMENT_FAILED_TO_INDEX", + } +} + +type ErrorCode string + +// Enum values for ErrorCode +const ( + ErrorCodeInternalError ErrorCode = "InternalError" + ErrorCodeInvalidRequest ErrorCode = "InvalidRequest" + ErrorCodeResourceInactive ErrorCode = "ResourceInactive" + ErrorCodeResourceNotFound ErrorCode = "ResourceNotFound" +) + +// Values returns all known values for ErrorCode. 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 (ErrorCode) Values() []ErrorCode { + return []ErrorCode{ + "InternalError", + "InvalidRequest", + "ResourceInactive", + "ResourceNotFound", + } +} + +type GroupStatus string + +// Enum values for GroupStatus +const ( + GroupStatusFailed GroupStatus = "FAILED" + GroupStatusSucceeded GroupStatus = "SUCCEEDED" + GroupStatusProcessing GroupStatus = "PROCESSING" + GroupStatusDeleting GroupStatus = "DELETING" + GroupStatusDeleted GroupStatus = "DELETED" +) + +// Values returns all known values for GroupStatus. 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 (GroupStatus) Values() []GroupStatus { + return []GroupStatus{ + "FAILED", + "SUCCEEDED", + "PROCESSING", + "DELETING", + "DELETED", + } +} + +type IndexStatus string + +// Enum values for IndexStatus +const ( + IndexStatusCreating IndexStatus = "CREATING" + IndexStatusActive IndexStatus = "ACTIVE" + IndexStatusDeleting IndexStatus = "DELETING" + IndexStatusFailed IndexStatus = "FAILED" + IndexStatusUpdating IndexStatus = "UPDATING" +) + +// Values returns all known values for IndexStatus. 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 (IndexStatus) Values() []IndexStatus { + return []IndexStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + "UPDATING", + } +} + +type MemberRelation string + +// Enum values for MemberRelation +const ( + MemberRelationAnd MemberRelation = "AND" + MemberRelationOr MemberRelation = "OR" +) + +// Values returns all known values for MemberRelation. 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 (MemberRelation) Values() []MemberRelation { + return []MemberRelation{ + "AND", + "OR", + } +} + +type MembershipType string + +// Enum values for MembershipType +const ( + MembershipTypeIndex MembershipType = "INDEX" + MembershipTypeDatasource MembershipType = "DATASOURCE" +) + +// Values returns all known values for MembershipType. 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 (MembershipType) Values() []MembershipType { + return []MembershipType{ + "INDEX", + "DATASOURCE", + } +} + +type MessageType string + +// Enum values for MessageType +const ( + MessageTypeUser MessageType = "USER" + MessageTypeSystem MessageType = "SYSTEM" +) + +// Values returns all known values for MessageType. 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 (MessageType) Values() []MessageType { + return []MessageType{ + "USER", + "SYSTEM", + } +} + +type MessageUsefulness string + +// Enum values for MessageUsefulness +const ( + MessageUsefulnessUseful MessageUsefulness = "USEFUL" + MessageUsefulnessNotUseful MessageUsefulness = "NOT_USEFUL" +) + +// Values returns all known values for MessageUsefulness. 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 (MessageUsefulness) Values() []MessageUsefulness { + return []MessageUsefulness{ + "USEFUL", + "NOT_USEFUL", + } +} + +type MessageUsefulnessReason string + +// Enum values for MessageUsefulnessReason +const ( + MessageUsefulnessReasonNotFactuallyCorrect MessageUsefulnessReason = "NOT_FACTUALLY_CORRECT" + MessageUsefulnessReasonHarmfulOrUnsafe MessageUsefulnessReason = "HARMFUL_OR_UNSAFE" + MessageUsefulnessReasonIncorrectOrMissingSources MessageUsefulnessReason = "INCORRECT_OR_MISSING_SOURCES" + MessageUsefulnessReasonNotHelpful MessageUsefulnessReason = "NOT_HELPFUL" + MessageUsefulnessReasonFactuallyCorrect MessageUsefulnessReason = "FACTUALLY_CORRECT" + MessageUsefulnessReasonComplete MessageUsefulnessReason = "COMPLETE" + MessageUsefulnessReasonRelevantSources MessageUsefulnessReason = "RELEVANT_SOURCES" + MessageUsefulnessReasonHelpful MessageUsefulnessReason = "HELPFUL" +) + +// Values returns all known values for MessageUsefulnessReason. 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 (MessageUsefulnessReason) Values() []MessageUsefulnessReason { + return []MessageUsefulnessReason{ + "NOT_FACTUALLY_CORRECT", + "HARMFUL_OR_UNSAFE", + "INCORRECT_OR_MISSING_SOURCES", + "NOT_HELPFUL", + "FACTUALLY_CORRECT", + "COMPLETE", + "RELEVANT_SOURCES", + "HELPFUL", + } +} + +type PluginState string + +// Enum values for PluginState +const ( + PluginStateEnabled PluginState = "ENABLED" + PluginStateDisabled PluginState = "DISABLED" +) + +// Values returns all known values for PluginState. 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 (PluginState) Values() []PluginState { + return []PluginState{ + "ENABLED", + "DISABLED", + } +} + +type PluginType string + +// Enum values for PluginType +const ( + PluginTypeServiceNow PluginType = "SERVICE_NOW" + PluginTypeSalesforce PluginType = "SALESFORCE" + PluginTypeJira PluginType = "JIRA" + PluginTypeZendesk PluginType = "ZENDESK" +) + +// Values returns all known values for PluginType. 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 (PluginType) Values() []PluginType { + return []PluginType{ + "SERVICE_NOW", + "SALESFORCE", + "JIRA", + "ZENDESK", + } +} + +type ReadAccessType string + +// Enum values for ReadAccessType +const ( + ReadAccessTypeAllow ReadAccessType = "ALLOW" + ReadAccessTypeDeny ReadAccessType = "DENY" +) + +// Values returns all known values for ReadAccessType. 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 (ReadAccessType) Values() []ReadAccessType { + return []ReadAccessType{ + "ALLOW", + "DENY", + } +} + +type ResponseScope string + +// Enum values for ResponseScope +const ( + ResponseScopeEnterpriseContentOnly ResponseScope = "ENTERPRISE_CONTENT_ONLY" + ResponseScopeExtendedKnowledgeEnabled ResponseScope = "EXTENDED_KNOWLEDGE_ENABLED" +) + +// Values returns all known values for ResponseScope. 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 (ResponseScope) Values() []ResponseScope { + return []ResponseScope{ + "ENTERPRISE_CONTENT_ONLY", + "EXTENDED_KNOWLEDGE_ENABLED", + } +} + +type RetrieverStatus string + +// Enum values for RetrieverStatus +const ( + RetrieverStatusCreating RetrieverStatus = "CREATING" + RetrieverStatusActive RetrieverStatus = "ACTIVE" + RetrieverStatusFailed RetrieverStatus = "FAILED" +) + +// Values returns all known values for RetrieverStatus. 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 (RetrieverStatus) Values() []RetrieverStatus { + return []RetrieverStatus{ + "CREATING", + "ACTIVE", + "FAILED", + } +} + +type RetrieverType string + +// Enum values for RetrieverType +const ( + RetrieverTypeNativeIndex RetrieverType = "NATIVE_INDEX" + RetrieverTypeKendraIndex RetrieverType = "KENDRA_INDEX" +) + +// Values returns all known values for RetrieverType. 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 (RetrieverType) Values() []RetrieverType { + return []RetrieverType{ + "NATIVE_INDEX", + "KENDRA_INDEX", + } +} + +type RuleType string + +// Enum values for RuleType +const ( + RuleTypeContentBlockerRule RuleType = "CONTENT_BLOCKER_RULE" + RuleTypeContentRetrievalRule RuleType = "CONTENT_RETRIEVAL_RULE" +) + +// Values returns all known values for RuleType. 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 (RuleType) Values() []RuleType { + return []RuleType{ + "CONTENT_BLOCKER_RULE", + "CONTENT_RETRIEVAL_RULE", + } +} + +type Status string + +// Enum values for Status +const ( + StatusEnabled Status = "ENABLED" + StatusDisabled Status = "DISABLED" +) + +// Values returns all known values for Status. 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 (Status) Values() []Status { + return []Status{ + "ENABLED", + "DISABLED", + } +} + +type ValidationExceptionReason string + +// Enum values for ValidationExceptionReason +const ( + ValidationExceptionReasonCannotParse ValidationExceptionReason = "CANNOT_PARSE" + ValidationExceptionReasonFieldValidationFailed ValidationExceptionReason = "FIELD_VALIDATION_FAILED" + ValidationExceptionReasonUnknownOperation ValidationExceptionReason = "UNKNOWN_OPERATION" +) + +// 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{ + "CANNOT_PARSE", + "FIELD_VALIDATION_FAILED", + "UNKNOWN_OPERATION", + } +} + +type WebExperienceSamplePromptsControlMode string + +// Enum values for WebExperienceSamplePromptsControlMode +const ( + WebExperienceSamplePromptsControlModeEnabled WebExperienceSamplePromptsControlMode = "ENABLED" + WebExperienceSamplePromptsControlModeDisabled WebExperienceSamplePromptsControlMode = "DISABLED" +) + +// Values returns all known values for WebExperienceSamplePromptsControlMode. 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 (WebExperienceSamplePromptsControlMode) Values() []WebExperienceSamplePromptsControlMode { + return []WebExperienceSamplePromptsControlMode{ + "ENABLED", + "DISABLED", + } +} + +type WebExperienceStatus string + +// Enum values for WebExperienceStatus +const ( + WebExperienceStatusCreating WebExperienceStatus = "CREATING" + WebExperienceStatusActive WebExperienceStatus = "ACTIVE" + WebExperienceStatusDeleting WebExperienceStatus = "DELETING" + WebExperienceStatusFailed WebExperienceStatus = "FAILED" + WebExperienceStatusPendingAuthConfig WebExperienceStatus = "PENDING_AUTH_CONFIG" +) + +// Values returns all known values for WebExperienceStatus. 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 (WebExperienceStatus) Values() []WebExperienceStatus { + return []WebExperienceStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + "PENDING_AUTH_CONFIG", + } +} diff --git a/service/qbusiness/types/errors.go b/service/qbusiness/types/errors.go new file mode 100644 index 00000000000..c5443b2d8ce --- /dev/null +++ b/service/qbusiness/types/errors.go @@ -0,0 +1,237 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// You don't have access to perform this action. Make sure you have the required +// permission policies and user accounts and try again. +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 } + +// You are trying to perform an action that conflicts with the current status of +// your resource. Fix any inconsistences with your resources and try again. +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 } + +// An issue occurred with the internal server used for your Amazon Q service. Wait +// some minutes and try again, or contact Support (http://aws.amazon.com/contact-us/) +// for help. +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 } + +// You don't have permissions to perform the action because your license is +// inactive. Ask your admin to activate your license and try again after your +// licence is active. +type LicenseNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *LicenseNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *LicenseNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *LicenseNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "LicenseNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *LicenseNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The resource you want to use doesn’t exist. Make sure you have provided the +// correct resource and try again. +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 } + +// You have exceeded the set limits for your Amazon Q service. +type ServiceQuotaExceededException struct { + Message *string + + ErrorCodeOverride *string + + ResourceId *string + ResourceType *string + + noSmithyDocumentSerde +} + +func (e *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceQuotaExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceQuotaExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServiceQuotaExceededException" + } + return *e.ErrorCodeOverride +} +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The request was denied due to throttling. Reduce the number of requests and try +// again. +type ThrottlingException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ThrottlingException" + } + return *e.ErrorCodeOverride +} +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The input doesn't meet the constraints set by the Amazon Q service. Provide the +// correct input and try again. +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + Reason ValidationExceptionReason + Fields []ValidationExceptionField + + 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/qbusiness/types/types.go b/service/qbusiness/types/types.go new file mode 100644 index 00000000000..c4b5e898e7d --- /dev/null +++ b/service/qbusiness/types/types.go @@ -0,0 +1,1541 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "github.com/aws/aws-sdk-go-v2/service/qbusiness/document" + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// Used to configure access permissions for a document. +type AccessConfiguration struct { + + // A list of AccessControlList objects. + // + // This member is required. + AccessControls []AccessControl + + // Describes the member relation within the AccessControlList object. + MemberRelation MemberRelation + + noSmithyDocumentSerde +} + +// A list of principals. Each principal can be either a USER or a GROUP and can be +// designated document access permissions of either ALLOW or DENY . +type AccessControl struct { + + // Contains a list of principals, where a principal can be either a USER or a GROUP + // . Each principal can be have the following type of document access: ALLOW or + // DENY . + // + // This member is required. + Principals []Principal + + // Describes the member relation within a principal list. + MemberRelation MemberRelation + + noSmithyDocumentSerde +} + +// Performs an Amazon Q plugin action during a non-streaming chat conversation. +type ActionExecution struct { + + // A mapping of field names to the field values in input that an end user provides + // to Amazon Q requests to perform their plugin action. + // + // This member is required. + Payload map[string]ActionExecutionPayloadField + + // A string used to retain information about the hierarchical contexts within an + // action execution event payload. + // + // This member is required. + PayloadFieldNameSeparator *string + + // The identifier of the plugin the action is attached to. + // + // This member is required. + PluginId *string + + noSmithyDocumentSerde +} + +// A user input field in an plugin action execution payload. +type ActionExecutionPayloadField struct { + + // The content of a user input field in an plugin action execution payload. + // + // This member is required. + Value document.Interface + + noSmithyDocumentSerde +} + +// An output event that Amazon Q returns to an user who wants to perform a plugin +// action during a non-streaming chat conversation. It contains information about +// the selected action with a list of possible user input fields, some +// pre-populated by Amazon Q. +type ActionReview struct { + + // Field values that an end user needs to provide to Amazon Q for Amazon Q to + // perform the requested plugin action. + Payload map[string]ActionReviewPayloadField + + // A string used to retain information about the hierarchical contexts within an + // action review payload. + PayloadFieldNameSeparator *string + + // The identifier of the plugin associated with the action review. + PluginId *string + + // The type of plugin. + PluginType PluginType + + noSmithyDocumentSerde +} + +// A user input field in an plugin action review payload. +type ActionReviewPayloadField struct { + + // Information about the field values that an end user can use to provide to + // Amazon Q for Amazon Q to perform the requested plugin action. + AllowedValues []ActionReviewPayloadFieldAllowedValue + + // The name of the field. + DisplayName *string + + // The display order of fields in a payload. + DisplayOrder *int32 + + // Information about whether the field is required. + Required *bool + + // The type of field. + Type ActionPayloadFieldType + + // The field value. + Value document.Interface + + noSmithyDocumentSerde +} + +// Information about the field values that an end user can use to provide to +// Amazon Q for Amazon Q to perform the requested plugin action. +type ActionReviewPayloadFieldAllowedValue struct { + + // The name of the field. + DisplayValue document.Interface + + // The field value. + Value document.Interface + + noSmithyDocumentSerde +} + +// Summary information for an Amazon Q application. +type Application struct { + + // The identifier for the Amazon Q application. + ApplicationId *string + + // The Unix timestamp when the Amazon Q application was created. + CreatedAt *time.Time + + // The name of the Amazon Q application. + DisplayName *string + + // The status of the Amazon Q application. The application is ready to use when + // the status is ACTIVE . + Status ApplicationStatus + + // The Unix timestamp when the Amazon Q application was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Configuration information about the file upload during chat feature for your +// application. +type AppliedAttachmentsConfiguration struct { + + // Information about whether file upload during chat functionality is activated + // for your application. + AttachmentsControlMode AttachmentsControlMode + + noSmithyDocumentSerde +} + +// A file directly uploaded into a web experience chat. +type AttachmentInput struct { + + // The data contained within the uploaded file. + // + // This member is required. + Data []byte + + // The name of the file. + // + // This member is required. + Name *string + + noSmithyDocumentSerde +} + +// The details of a file uploaded during chat. +type AttachmentOutput struct { + + // An error associated with a file uploaded during chat. + Error *ErrorDetail + + // The name of a file uploaded during chat. + Name *string + + // The status of a file uploaded during chat. + Status AttachmentStatus + + noSmithyDocumentSerde +} + +// Configuration information for the file upload during chat feature. +type AttachmentsConfiguration struct { + + // Status information about whether file upload functionality is activated or + // deactivated for your end user. + // + // This member is required. + AttachmentsControlMode AttachmentsControlMode + + noSmithyDocumentSerde +} + +// Enables filtering of Amazon Q web experience responses based on document +// attributes or metadata fields. +type AttributeFilter struct { + + // Performs a logical AND operation on all supplied filters. + AndAllFilters []AttributeFilter + + // Returns true when a document contains all the specified document attributes or + // metadata fields. + ContainsAll *DocumentAttribute + + // Returns true when a document contains any of the specified document attributes + // or metadata fields. + ContainsAny *DocumentAttribute + + // Performs an equals operation on two document attributes or metadata fields. + EqualsTo *DocumentAttribute + + // Performs a greater than operation on two document attributes or metadata + // fields. Use with a document attribute of type Date or Long . + GreaterThan *DocumentAttribute + + // Performs a greater or equals than operation on two document attributes or + // metadata fields. Use with a document attribute of type Date or Long . + GreaterThanOrEquals *DocumentAttribute + + // Performs a less than operation on two document attributes or metadata fields. + // Use with a document attribute of type Date or Long . + LessThan *DocumentAttribute + + // Performs a less than or equals operation on two document attributes or metadata + // fields. Use with a document attribute of type Date or Long . + LessThanOrEquals *DocumentAttribute + + // Performs a logical NOT operation on all supplied filters. + NotFilter *AttributeFilter + + // Performs a logical OR operation on all supplied filters. + OrAllFilters []AttributeFilter + + noSmithyDocumentSerde +} + +// Information about the basic authentication credentials used to configure a +// plugin. +type BasicAuthConfiguration struct { + + // The ARN of an IAM role used by Amazon Q to access the basic authentication + // credentials stored in a Secrets Manager secret. + // + // This member is required. + RoleArn *string + + // The ARN of the Secrets Manager secret that stores the basic authentication + // credentials used for plugin configuration.. + // + // This member is required. + SecretArn *string + + noSmithyDocumentSerde +} + +// Provides information about the phrases blocked from chat by your chat control +// configuration. +type BlockedPhrasesConfiguration struct { + + // A list of phrases blocked from a Amazon Q web experience chat. + BlockedPhrases []string + + // The configured custom message displayed to an end user informing them that + // they've used a blocked phrase during chat. + SystemMessageOverride *string + + noSmithyDocumentSerde +} + +// Updates a blocked phrases configuration in your Amazon Q application. +type BlockedPhrasesConfigurationUpdate struct { + + // Creates or updates a blocked phrases configuration in your Amazon Q application. + BlockedPhrasesToCreateOrUpdate []string + + // Deletes a blocked phrases configuration in your Amazon Q application. + BlockedPhrasesToDelete []string + + // The configured custom message displayed to your end user when they use blocked + // phrase during chat. + SystemMessageOverride *string + + noSmithyDocumentSerde +} + +// A rule for configuring how Amazon Q responds when it encounters a a blocked +// topic. You can configure a custom message to inform your end users that they +// have asked about a restricted topic and suggest any next steps they should take. +type ContentBlockerRule struct { + + // The configured custom message displayed to an end user informing them that + // they've used a blocked phrase during chat. + SystemMessageOverride *string + + noSmithyDocumentSerde +} + +// Rules for retrieving content from data sources connected to a Amazon Q +// application for a specific topic control configuration. +type ContentRetrievalRule struct { + + // Specifies data sources in a Amazon Q application to use for content generation. + EligibleDataSources []EligibleDataSource + + noSmithyDocumentSerde +} + +// A conversation in an Amazon Q application. +type Conversation struct { + + // The identifier of the Amazon Q conversation. + ConversationId *string + + // The start time of the conversation. + StartTime *time.Time + + // The title of the conversation. + Title *string + + noSmithyDocumentSerde +} + +// A data source in an Amazon Q application. +type DataSource struct { + + // The Unix timestamp when the Amazon Q data source was created. + CreatedAt *time.Time + + // The identifier of the Amazon Q data source. + DataSourceId *string + + // The name of the Amazon Q data source. + DisplayName *string + + // The status of the Amazon Q data source. + Status DataSourceStatus + + // The type of the Amazon Q data source. + Type *string + + // The Unix timestamp when the Amazon Q data source was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Provides information about an Amazon Q data source connector synchronization +// job. +type DataSourceSyncJob struct { + + // If the reason that the synchronization failed is due to an error with the + // underlying data source, this field contains a code that identifies the error. + DataSourceErrorCode *string + + // The Unix timestamp when the synchronization job completed. + EndTime *time.Time + + // If the Status field is set to FAILED , the ErrorCode field indicates the reason + // the synchronization failed. + Error *ErrorDetail + + // The identifier of a data source synchronization job. + ExecutionId *string + + // Maps a batch delete document request to a specific data source sync job. This + // is optional and should only be supplied when documents are deleted by a data + // source connector. + Metrics *DataSourceSyncJobMetrics + + // The Unix time stamp when the data source synchronization job started. + StartTime *time.Time + + // The status of the synchronization job. When the Status field is set to SUCCEEDED + // , the synchronization job is done. If the status code is FAILED , the ErrorCode + // and ErrorMessage fields give you the reason for the failure. + Status DataSourceSyncJobStatus + + noSmithyDocumentSerde +} + +// Maps a batch delete document request to a specific Amazon Q data source +// connector sync job. +type DataSourceSyncJobMetrics struct { + + // The current count of documents added from the data source during the data + // source sync. + DocumentsAdded *string + + // The current count of documents deleted from the data source during the data + // source sync. + DocumentsDeleted *string + + // The current count of documents that failed to sync from the data source during + // the data source sync. + DocumentsFailed *string + + // The current count of documents modified in the data source during the data + // source sync. + DocumentsModified *string + + // The current count of documents crawled by the ongoing sync job in the data + // source. + DocumentsScanned *string + + noSmithyDocumentSerde +} + +// Provides configuration information needed to connect to an Amazon VPC (Virtual +// Private Cloud). +type DataSourceVpcConfiguration struct { + + // A list of identifiers of security groups within your Amazon VPC. The security + // groups should enable Amazon Q to connect to the data source. + // + // This member is required. + SecurityGroupIds []string + + // A list of identifiers for subnets within your Amazon VPC. The subnets should be + // able to connect to each other in the VPC, and they should have outgoing access + // to the Internet through a NAT device. + // + // This member is required. + SubnetIds []string + + noSmithyDocumentSerde +} + +// A document deleted from an Amazon Q data source connector. +type DeleteDocument struct { + + // The identifier of the deleted document. + // + // This member is required. + DocumentId *string + + noSmithyDocumentSerde +} + +// A document in an Amazon Q application. +type Document struct { + + // The identifier of the document. + // + // This member is required. + Id *string + + // Configuration information for access permission to a document. + AccessConfiguration *AccessConfiguration + + // Custom attributes to apply to the document for refining Amazon Q web experience + // responses. + Attributes []DocumentAttribute + + // The contents of the document. + Content DocumentContent + + // The file type of the document in the Blob field. If you want to index snippets + // or subsets of HTML documents instead of the entirety of the HTML documents, you + // add the HTML start and closing tags ( content ) around the content. + ContentType ContentType + + // The configuration information for altering document metadata and content during + // the document ingestion process. + DocumentEnrichmentConfiguration *DocumentEnrichmentConfiguration + + // The title of the document. + Title *string + + noSmithyDocumentSerde +} + +// A document attribute or metadata field. +type DocumentAttribute struct { + + // The identifier for the attribute. + // + // This member is required. + Name *string + + // The value of the attribute. + // + // This member is required. + Value DocumentAttributeValue + + noSmithyDocumentSerde +} + +// The condition used for the target document attribute or metadata field when +// ingesting documents into Amazon Q. You use this with DocumentAttributeTarget (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeTarget.html) +// to apply the condition. For example, you can create the 'Department' target +// field and have it prefill department names associated with the documents based +// on information in the 'Source_URI' field. Set the condition that if the +// 'Source_URI' field contains 'financial' in its URI value, then prefill the +// target field 'Department' with the target value 'Finance' for the document. +// Amazon Q can't create a target field if it has not already been created as an +// index field. After you create your index field, you can create a document +// metadata field using DocumentAttributeTarget . Amazon Q then will map your newly +// created metadata field to your index field. +type DocumentAttributeCondition struct { + + // The identifier of the document attribute used for the condition. For example, + // 'Source_URI' could be an identifier for the attribute or metadata field that + // contains source URIs associated with the documents. Amazon Q currently doesn't + // support _document_body as an attribute key used for the condition. + // + // This member is required. + Key *string + + // The identifier of the document attribute used for the condition. For example, + // 'Source_URI' could be an identifier for the attribute or metadata field that + // contains source URIs associated with the documents. Amazon Kendra currently does + // not support _document_body as an attribute key used for the condition. + // + // This member is required. + Operator DocumentEnrichmentConditionOperator + + // The value of a document attribute. You can only provide one value for a + // document attribute. + Value DocumentAttributeValue + + noSmithyDocumentSerde +} + +// Configuration information for document attributes. Document attributes are +// metadata or fields associated with your documents. For example, the company +// department name associated with each document. For more information, see +// Understanding document attributes (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/doc-attributes.html) +// . +type DocumentAttributeConfiguration struct { + + // The name of the document attribute. + Name *string + + // Information about whether the document attribute can be used by an end user to + // search for information on their web experience. + Search Status + + // The type of document attribute. + Type AttributeType + + noSmithyDocumentSerde +} + +// The target document attribute or metadata field you want to alter when +// ingesting documents into Amazon Q. For example, you can delete all customer +// identification numbers associated with the documents, stored in the document +// metadata field called 'Customer_ID' by setting the target key as 'Customer_ID' +// and the deletion flag to TRUE . This removes all customer ID values in the field +// 'Customer_ID'. This would scrub personally identifiable information from each +// document's metadata. Amazon Q can't create a target field if it has not already +// been created as an index field. After you create your index field, you can +// create a document metadata field using DocumentAttributeTarget (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeTarget.html) +// . Amazon Q will then map your newly created document attribute to your index +// field. You can also use this with DocumentAttributeCondition (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeCondition.html) +// . +type DocumentAttributeTarget struct { + + // The identifier of the target document attribute or metadata field. For example, + // 'Department' could be an identifier for the target attribute or metadata field + // that includes the department names associated with the documents. + // + // This member is required. + Key *string + + // TRUE to delete the existing target value for your specified target attribute + // key. You cannot create a target value and set this to TRUE . + AttributeValueOperator AttributeValueOperator + + // The value of a document attribute. You can only provide one value for a + // document attribute. + Value DocumentAttributeValue + + noSmithyDocumentSerde +} + +// The value of a document attribute. You can only provide one value for a +// document attribute. +// +// The following types satisfy this interface: +// +// DocumentAttributeValueMemberDateValue +// DocumentAttributeValueMemberLongValue +// DocumentAttributeValueMemberStringListValue +// DocumentAttributeValueMemberStringValue +type DocumentAttributeValue interface { + isDocumentAttributeValue() +} + +// A date expressed as an ISO 8601 string. It's important for the time zone to be +// included in the ISO 8601 date-time format. For example, +// 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 +// at 12:30PM (plus 10 seconds) in Central European Time. +type DocumentAttributeValueMemberDateValue struct { + Value time.Time + + noSmithyDocumentSerde +} + +func (*DocumentAttributeValueMemberDateValue) isDocumentAttributeValue() {} + +// A long integer value. +type DocumentAttributeValueMemberLongValue struct { + Value int64 + + noSmithyDocumentSerde +} + +func (*DocumentAttributeValueMemberLongValue) isDocumentAttributeValue() {} + +// A list of strings. +type DocumentAttributeValueMemberStringListValue struct { + Value []string + + noSmithyDocumentSerde +} + +func (*DocumentAttributeValueMemberStringListValue) isDocumentAttributeValue() {} + +// A string. +type DocumentAttributeValueMemberStringValue struct { + Value string + + noSmithyDocumentSerde +} + +func (*DocumentAttributeValueMemberStringValue) isDocumentAttributeValue() {} + +// The contents of a document. +// +// The following types satisfy this interface: +// +// DocumentContentMemberBlob +// DocumentContentMemberS3 +type DocumentContent interface { + isDocumentContent() +} + +// The contents of the document. Documents passed to the blob parameter must be +// base64 encoded. Your code might not need to encode the document file bytes if +// you're using an Amazon Web Services SDK to call Amazon Q APIs. If you are +// calling the Amazon Q endpoint directly using REST, you must base64 encode the +// contents before sending. +type DocumentContentMemberBlob struct { + Value []byte + + noSmithyDocumentSerde +} + +func (*DocumentContentMemberBlob) isDocumentContent() {} + +// The path to the document in an Amazon S3 bucket. +type DocumentContentMemberS3 struct { + Value S3 + + noSmithyDocumentSerde +} + +func (*DocumentContentMemberS3) isDocumentContent() {} + +// The details of a document within an Amazon Q index. +type DocumentDetails struct { + + // The timestamp for when the document was created. + CreatedAt *time.Time + + // The identifier of the document. + DocumentId *string + + // An error message associated with the document. + Error *ErrorDetail + + // The current status of the document. + Status DocumentStatus + + // The timestamp for when the document was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Provides the configuration information for altering document metadata and +// content during the document ingestion process. For more information, see Custom +// document enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) +// . +type DocumentEnrichmentConfiguration struct { + + // Configuration information to alter document attributes or metadata fields and + // content when ingesting documents into Amazon Q. + InlineConfigurations []InlineDocumentEnrichmentConfiguration + + // Provides the configuration information for invoking a Lambda function in Lambda + // to alter document metadata and content when ingesting documents into Amazon Q. + // You can configure your Lambda function using PreExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) + // if you want to apply advanced alterations on the original or raw documents. If + // you want to apply advanced alterations on the Amazon Q structured documents, you + // must configure your Lambda function using PostExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) + // . You can only invoke one Lambda function. However, this function can invoke + // other functions it requires. For more information, see Custom document + // enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) + // . + PostExtractionHookConfiguration *HookConfiguration + + // Provides the configuration information for invoking a Lambda function in Lambda + // to alter document metadata and content when ingesting documents into Amazon Q. + // You can configure your Lambda function using PreExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) + // if you want to apply advanced alterations on the original or raw documents. If + // you want to apply advanced alterations on the Amazon Q structured documents, you + // must configure your Lambda function using PostExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) + // . You can only invoke one Lambda function. However, this function can invoke + // other functions it requires. For more information, see Custom document + // enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) + // . + PreExtractionHookConfiguration *HookConfiguration + + noSmithyDocumentSerde +} + +// The identifier of the data source Amazon Q will generate responses from. +type EligibleDataSource struct { + + // The identifier of the data source. + DataSourceId *string + + // The identifier of the index the data source is attached to. + IndexId *string + + noSmithyDocumentSerde +} + +// Provides the identifier of the KMS key used to encrypt data indexed by Amazon +// Q. Amazon Q doesn't support asymmetric keys. +type EncryptionConfiguration struct { + + // The identifier of the KMS key. Amazon Q doesn't support asymmetric keys. + KmsKeyId *string + + noSmithyDocumentSerde +} + +// Provides information about a data source sync error. +type ErrorDetail struct { + + // The code associated with the data source sync error. + ErrorCode ErrorCode + + // The message explaining the data source sync error. + ErrorMessage *string + + noSmithyDocumentSerde +} + +// A list of documents that could not be removed from an Amazon Q index. Each +// entry contains an error message that indicates why the document couldn't be +// removed from the index. +type FailedDocument struct { + + // The identifier of the Amazon Q data source connector that contains the failed + // document. + DataSourceId *string + + // An explanation for why the document couldn't be removed from the index. + Error *ErrorDetail + + // The identifier of the document that couldn't be removed from the Amazon Q index. + Id *string + + noSmithyDocumentSerde +} + +// A list of users or sub groups that belong to a group. This is for generating +// Amazon Q chat results only from document a user has access to. +type GroupMembers struct { + + // A list of sub groups that belong to a group. For example, the sub groups + // "Research", "Engineering", and "Sales and Marketing" all belong to the group + // "Company". + MemberGroups []MemberGroup + + // A list of users that belong to a group. For example, a list of interns all + // belong to the "Interns" group. + MemberUsers []MemberUser + + noSmithyDocumentSerde +} + +// Provides the details of a group's status. +type GroupStatusDetail struct { + + // The details of an error associated a group status. + ErrorDetail *ErrorDetail + + // The Unix timestamp when the Amazon Q application was last updated. + LastUpdatedAt *time.Time + + // The status of a group. + Status GroupStatus + + noSmithyDocumentSerde +} + +// Summary information for groups. +type GroupSummary struct { + + // The name of the group the summary information is for. + GroupName *string + + noSmithyDocumentSerde +} + +// Provides the configuration information for invoking a Lambda function in Lambda +// to alter document metadata and content when ingesting documents into Amazon Q. +// You can configure your Lambda function using PreExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) +// if you want to apply advanced alterations on the original or raw documents. If +// you want to apply advanced alterations on the Amazon Q structured documents, you +// must configure your Lambda function using PostExtractionHookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_CustomDocumentEnrichmentConfiguration.html) +// . You can only invoke one Lambda function. However, this function can invoke +// other functions it requires. For more information, see Custom document +// enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) +// . +type HookConfiguration struct { + + // The condition used for when a Lambda function should be invoked. For example, + // you can specify a condition that if there are empty date-time values, then + // Amazon Q should invoke a function that inserts the current date-time. + InvocationCondition *DocumentAttributeCondition + + // The Amazon Resource Name (ARN) of a role with permission to run a Lambda + // function during ingestion. For more information, see IAM roles for Custom + // Document Enrichment (CDE) (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/iam-roles.html#cde-iam-role) + // . + LambdaArn *string + + // The Amazon Resource Name (ARN) of a role with permission to run + // PreExtractionHookConfiguration and PostExtractionHookConfiguration for altering + // document metadata and content during the document ingestion process. + RoleArn *string + + // Stores the original, raw documents or the structured, parsed documents before + // and after altering them. For more information, see Data contracts for Lambda + // functions (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/cde-lambda-operations.html#cde-lambda-operations-data-contracts) + // . + S3BucketName *string + + noSmithyDocumentSerde +} + +// Summary information for your Amazon Q index. +type Index struct { + + // The Unix timestamp when the index was created. + CreatedAt *time.Time + + // The name of the index. + DisplayName *string + + // The identifier for the index. + IndexId *string + + // The current status of the index. When the status is ACTIVE , the index is ready. + Status IndexStatus + + // The Unix timestamp when the index was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Provides information about index capacity configuration. +type IndexCapacityConfiguration struct { + + // The number of storage units configured for an Amazon Q index. + Units *int32 + + noSmithyDocumentSerde +} + +// Provides information about the number of documents in an index. +type IndexStatistics struct { + + // The number of documents indexed. + TextDocumentStatistics *TextDocumentStatistics + + noSmithyDocumentSerde +} + +// Provides the configuration information for applying basic logic to alter +// document metadata and content when ingesting documents into Amazon Q. To apply +// advanced logic, to go beyond what you can do with basic logic, see +// HookConfiguration (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_HookConfiguration.html) +// . For more information, see Custom document enrichment (https://docs.aws.amazon.com/amazonq/latest/business-use-dg/custom-document-enrichment.html) +// . +type InlineDocumentEnrichmentConfiguration struct { + + // The condition used for the target document attribute or metadata field when + // ingesting documents into Amazon Q. You use this with DocumentAttributeTarget (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeTarget.html) + // to apply the condition. For example, you can create the 'Department' target + // field and have it prefill department names associated with the documents based + // on information in the 'Source_URI' field. Set the condition that if the + // 'Source_URI' field contains 'financial' in its URI value, then prefill the + // target field 'Department' with the target value 'Finance' for the document. + // Amazon Q can't create a target field if it has not already been created as an + // index field. After you create your index field, you can create a document + // metadata field using DocumentAttributeTarget . Amazon Q then will map your newly + // created metadata field to your index field. + Condition *DocumentAttributeCondition + + // TRUE to delete content if the condition used for the target attribute is met. + DocumentContentOperator DocumentContentOperator + + // The target document attribute or metadata field you want to alter when + // ingesting documents into Amazon Q. For example, you can delete all customer + // identification numbers associated with the documents, stored in the document + // metadata field called 'Customer_ID' by setting the target key as 'Customer_ID' + // and the deletion flag to TRUE . This removes all customer ID values in the field + // 'Customer_ID'. This would scrub personally identifiable information from each + // document's metadata. Amazon Q can't create a target field if it has not already + // been created as an index field. After you create your index field, you can + // create a document metadata field using DocumentAttributeTarget (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeTarget.html) + // . Amazon Q will then map your newly created document attribute to your index + // field. You can also use this with DocumentAttributeCondition (https://docs.aws.amazon.com/enterpriseq/latest/APIReference/API_DocumentAttributeCondition.html) + // . + Target *DocumentAttributeTarget + + noSmithyDocumentSerde +} + +// Stores an Amazon Kendra index as a retriever. +type KendraIndexConfiguration struct { + + // The identifier of the Amazon Kendra index. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +// The sub groups that belong to a group. +type MemberGroup struct { + + // The name of the sub group. + // + // This member is required. + GroupName *string + + // The type of the sub group. + Type MembershipType + + noSmithyDocumentSerde +} + +// The users that belong to a group. +type MemberUser struct { + + // The identifier of the user you want to map to a group. + // + // This member is required. + UserId *string + + // The type of the user. + Type MembershipType + + noSmithyDocumentSerde +} + +// A message in an Amazon Q web experience. +type Message struct { + + // Performs an Amazon Q plugin action during a non-streaming chat conversation. + ActionExecution *ActionExecution + + // An output event that Amazon Q returns to an user who wants to perform a plugin + // action during a non-streaming chat conversation. It contains information about + // the selected action with a list of possible user input fields, some + // pre-populated by Amazon Q. + ActionReview *ActionReview + + // A file directly uploaded into an Amazon Q web experience chat. + Attachments []AttachmentOutput + + // The content of the Amazon Q web experience message. + Body *string + + // The identifier of the Amazon Q web experience message. + MessageId *string + + // The source documents used to generate Amazon Q web experience message. + SourceAttribution []*SourceAttribution + + // The timestamp of the first Amazon Q web experience message. + Time *time.Time + + // The type of Amazon Q message, whether HUMAN or AI generated. + Type MessageType + + noSmithyDocumentSerde +} + +// End user feedback on an AI-generated web experience chat message usefulness. +type MessageUsefulnessFeedback struct { + + // The timestamp for when the feedback was submitted. + // + // This member is required. + SubmittedAt *time.Time + + // The usefulness value assigned by an end user to a message. + // + // This member is required. + Usefulness MessageUsefulness + + // A comment given by an end user on the usefulness of an AI-generated chat + // message. + Comment *string + + // The reason for a usefulness rating. + Reason MessageUsefulnessReason + + noSmithyDocumentSerde +} + +// Configuration information for an Amazon Q index. +type NativeIndexConfiguration struct { + + // The identifier for the Amazon Q index. + // + // This member is required. + IndexId *string + + noSmithyDocumentSerde +} + +// Information about the OAuth 2.0 authentication credential/token used to +// configure a plugin. +type OAuth2ClientCredentialConfiguration struct { + + // The ARN of an IAM role used by Amazon Q to access the OAuth 2.0 authentication + // credentials stored in a Secrets Manager secret. + // + // This member is required. + RoleArn *string + + // The ARN of the Secrets Manager secret that stores the OAuth 2.0 + // credentials/token used for plugin configuration. + // + // This member is required. + SecretArn *string + + noSmithyDocumentSerde +} + +// Information about an Amazon Q plugin and its configuration. +type Plugin struct { + + // The timestamp for when the plugin was created. + CreatedAt *time.Time + + // The name of the plugin. + DisplayName *string + + // The identifier of the plugin. + PluginId *string + + // The plugin server URL used for configuration. + ServerUrl *string + + // The current status of the plugin. + State PluginState + + // The type of the plugin. + Type PluginType + + // The timestamp for when the plugin was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Authentication configuration information for an Amazon Q plugin. +// +// The following types satisfy this interface: +// +// PluginAuthConfigurationMemberBasicAuthConfiguration +// PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration +type PluginAuthConfiguration interface { + isPluginAuthConfiguration() +} + +// Information about the basic authentication credentials used to configure a +// plugin. +type PluginAuthConfigurationMemberBasicAuthConfiguration struct { + Value BasicAuthConfiguration + + noSmithyDocumentSerde +} + +func (*PluginAuthConfigurationMemberBasicAuthConfiguration) isPluginAuthConfiguration() {} + +// Information about the OAuth 2.0 authentication credential/token used to +// configure a plugin. +type PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration struct { + Value OAuth2ClientCredentialConfiguration + + noSmithyDocumentSerde +} + +func (*PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration) isPluginAuthConfiguration() { +} + +// Provides user and group information used for filtering documents to use for +// generating Amazon Q conversation responses. +// +// The following types satisfy this interface: +// +// PrincipalMemberGroup +// PrincipalMemberUser +type Principal interface { + isPrincipal() +} + +// The group associated with the principal. +type PrincipalMemberGroup struct { + Value PrincipalGroup + + noSmithyDocumentSerde +} + +func (*PrincipalMemberGroup) isPrincipal() {} + +// The user associated with the principal. +type PrincipalMemberUser struct { + Value PrincipalUser + + noSmithyDocumentSerde +} + +func (*PrincipalMemberUser) isPrincipal() {} + +// Provides information about a group associated with the principal. +type PrincipalGroup struct { + + // Provides information about whether to allow or deny access to the principal. + // + // This member is required. + Access ReadAccessType + + // The type of group. + MembershipType MembershipType + + // The name of the group. + Name *string + + noSmithyDocumentSerde +} + +// Provides information about a user associated with a principal. +type PrincipalUser struct { + + // Provides information about whether to allow or deny access to the principal. + // + // This member is required. + Access ReadAccessType + + // The identifier of the user. + Id *string + + // The type of group. + MembershipType MembershipType + + noSmithyDocumentSerde +} + +// Summary information for the retriever used for your Amazon Q application. +type Retriever struct { + + // The identifier of the Amazon Q application using the retriever. + ApplicationId *string + + // The name of your retriever. + DisplayName *string + + // The identifier of the retriever used by your Amazon Q application. + RetrieverId *string + + // The status of your retriever. + Status RetrieverStatus + + // The type of your retriever. + Type RetrieverType + + noSmithyDocumentSerde +} + +// Provides information on how the retriever used for your Amazon Q application is +// configured. +// +// The following types satisfy this interface: +// +// RetrieverConfigurationMemberKendraIndexConfiguration +// RetrieverConfigurationMemberNativeIndexConfiguration +type RetrieverConfiguration interface { + isRetrieverConfiguration() +} + +// Provides information on how the Amazon Kendra index used as a retriever for +// your Amazon Q application is configured. +type RetrieverConfigurationMemberKendraIndexConfiguration struct { + Value KendraIndexConfiguration + + noSmithyDocumentSerde +} + +func (*RetrieverConfigurationMemberKendraIndexConfiguration) isRetrieverConfiguration() {} + +// Provides information on how a Amazon Q index used as a retriever for your +// Amazon Q application is configured. +type RetrieverConfigurationMemberNativeIndexConfiguration struct { + Value NativeIndexConfiguration + + noSmithyDocumentSerde +} + +func (*RetrieverConfigurationMemberNativeIndexConfiguration) isRetrieverConfiguration() {} + +// Guardrail rules for an Amazon Q application. Amazon Q supports only one rule at +// a time. +type Rule struct { + + // The type fo rule. + // + // This member is required. + RuleType RuleType + + // Users and groups to be excluded from a rule. + ExcludedUsersAndGroups *UsersAndGroups + + // Users and groups to be included in a rule. + IncludedUsersAndGroups *UsersAndGroups + + // The configuration information for a rule. + RuleConfiguration RuleConfiguration + + noSmithyDocumentSerde +} + +// Provides configuration information about a rule. +// +// The following types satisfy this interface: +// +// RuleConfigurationMemberContentBlockerRule +// RuleConfigurationMemberContentRetrievalRule +type RuleConfiguration interface { + isRuleConfiguration() +} + +// A rule for configuring how Amazon Q responds when it encounters a a blocked +// topic. +type RuleConfigurationMemberContentBlockerRule struct { + Value ContentBlockerRule + + noSmithyDocumentSerde +} + +func (*RuleConfigurationMemberContentBlockerRule) isRuleConfiguration() {} + +// Rules for retrieving content from data sources connected to a Amazon Q +// application for a specific topic control configuration. +type RuleConfigurationMemberContentRetrievalRule struct { + Value ContentRetrievalRule + + noSmithyDocumentSerde +} + +func (*RuleConfigurationMemberContentRetrievalRule) isRuleConfiguration() {} + +// Information required for Amazon Q to find a specific file in an Amazon S3 +// bucket. +type S3 struct { + + // The name of the S3 bucket that contains the file. + // + // This member is required. + Bucket *string + + // The name of the file. + // + // This member is required. + Key *string + + noSmithyDocumentSerde +} + +// Provides the SAML 2.0 compliant identity provider (IdP) configuration +// information Amazon Q needs to deploy a Amazon Q web experience. +type SamlConfiguration struct { + + // The metadata XML that your IdP generated. + // + // This member is required. + MetadataXML *string + + // The Amazon Resource Name (ARN) of an IAM role assumed by users when they + // authenticate into their Amazon Q web experience, containing the relevant Amazon + // Q permissions for conversing with Amazon Q. + // + // This member is required. + RoleArn *string + + // The user attribute name in your IdP that maps to the user email. + // + // This member is required. + UserIdAttribute *string + + // The group attribute name in your IdP that maps to user groups. + UserGroupAttribute *string + + noSmithyDocumentSerde +} + +// The documents used to generate an Amazon Q web experience response. +type SourceAttribution struct { + + // The number attached to a citation in an Amazon Q generated response. + CitationNumber *int32 + + // The content extract from the document on which the generated response is based. + Snippet *string + + // A text extract from a source document that is used for source attribution. + TextMessageSegments []TextSegment + + // The title of the document which is the source for the Amazon Q generated + // response. + Title *string + + // The Unix timestamp when the Amazon Q application was last updated. + UpdatedAt *time.Time + + // The URL of the document which is the source for the Amazon Q generated response. + Url *string + + noSmithyDocumentSerde +} + +// A list of key/value pairs that identify an index, FAQ, or data source. Tag keys +// and values can consist of Unicode letters, digits, white space, and any of the +// following symbols: _ . : / = + - @. +type Tag struct { + + // The key for the tag. Keys are not case sensitive and must be unique for the + // Amazon Q application or data source. + // + // This member is required. + Key *string + + // The value associated with the tag. The value may be an empty string but it + // can't be null. + // + // This member is required. + Value *string + + noSmithyDocumentSerde +} + +// Provides information about text documents in an index. +type TextDocumentStatistics struct { + + // The total size, in bytes, of the indexed documents. + IndexedTextBytes *int64 + + // The number of text documents indexed. + IndexedTextDocumentCount *int32 + + noSmithyDocumentSerde +} + +// Provides information about a text extract in a chat response that can be +// attributed to a source document. +type TextSegment struct { + + // The zero-based location in the response string where the source attribution + // starts. + BeginOffset *int32 + + // The zero-based location in the response string where the source attribution + // ends. + EndOffset *int32 + + noSmithyDocumentSerde +} + +// The topic specific controls configured for an Amazon Q application. +type TopicConfiguration struct { + + // A name for your topic control configuration. + // + // This member is required. + Name *string + + // Rules defined for a topic configuration. + // + // This member is required. + Rules []Rule + + // A description for your topic control configuration. Use this outline how the + // large language model (LLM) should use this topic control configuration. + Description *string + + // A list of example phrases that you expect the end user to use in relation to + // the topic. + ExampleChatMessages []string + + noSmithyDocumentSerde +} + +// Aliases attached to a user id within an Amazon Q application. +type UserAlias struct { + + // The identifier of the user id associated with the user aliases. + // + // This member is required. + UserId *string + + // The identifier of the data source that the user aliases are associated with. + DataSourceId *string + + // The identifier of the index that the user aliases are associated with. + IndexId *string + + noSmithyDocumentSerde +} + +// Provides information about users and groups associated with a topic control +// rule. +type UsersAndGroups struct { + + // The user groups associated with a topic control rule. + UserGroups []string + + // The user ids associated with a topic control rule. + UserIds []string + + noSmithyDocumentSerde +} + +// The input failed to meet the constraints specified by Amazon Q in a specified +// field. +type ValidationExceptionField struct { + + // A message about the validation exception. + // + // This member is required. + Message *string + + // The field name where the invalid entry was detected. + // + // This member is required. + Name *string + + noSmithyDocumentSerde +} + +// Provides information for an Amazon Q web experience. +type WebExperience struct { + + // The Unix timestamp when the Amazon Q application was last updated. + CreatedAt *time.Time + + // The endpoint URLs for your Amazon Q web experience. The URLs are unique and + // fully hosted by Amazon Web Services. + DefaultEndpoint *string + + // The status of your Amazon Q web experience. + Status WebExperienceStatus + + // The Unix timestamp when your Amazon Q web experience was updated. + UpdatedAt *time.Time + + // The identifier of your Amazon Q web experience. + WebExperienceId *string + + noSmithyDocumentSerde +} + +// Provides the authorization configuration information needed to deploy a Amazon +// Q web experience to end users. +// +// The following types satisfy this interface: +// +// WebExperienceAuthConfigurationMemberSamlConfiguration +type WebExperienceAuthConfiguration interface { + isWebExperienceAuthConfiguration() +} + +// Provides the SAML 2.0 compliant identity provider (IdP) configuration +// information Amazon Q needs to deploy a Amazon Q web experience. +type WebExperienceAuthConfigurationMemberSamlConfiguration struct { + Value SamlConfiguration + + noSmithyDocumentSerde +} + +func (*WebExperienceAuthConfigurationMemberSamlConfiguration) isWebExperienceAuthConfiguration() {} + +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) isDocumentAttributeValue() {} +func (*UnknownUnionMember) isDocumentContent() {} +func (*UnknownUnionMember) isPluginAuthConfiguration() {} +func (*UnknownUnionMember) isPrincipal() {} +func (*UnknownUnionMember) isRetrieverConfiguration() {} +func (*UnknownUnionMember) isRuleConfiguration() {} +func (*UnknownUnionMember) isWebExperienceAuthConfiguration() {} diff --git a/service/qbusiness/types/types_exported_test.go b/service/qbusiness/types/types_exported_test.go new file mode 100644 index 00000000000..aada8278b4b --- /dev/null +++ b/service/qbusiness/types/types_exported_test.go @@ -0,0 +1,167 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + "time" +) + +func ExampleDocumentAttributeValue_outputUsage() { + var union types.DocumentAttributeValue + // type switches can be used to check the union value + switch v := union.(type) { + case *types.DocumentAttributeValueMemberDateValue: + _ = v.Value // Value is time.Time + + case *types.DocumentAttributeValueMemberLongValue: + _ = v.Value // Value is int64 + + case *types.DocumentAttributeValueMemberStringListValue: + _ = v.Value // Value is []string + + case *types.DocumentAttributeValueMemberStringValue: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string +var _ *int64 +var _ []string +var _ *time.Time + +func ExampleDocumentContent_outputUsage() { + var union types.DocumentContent + // type switches can be used to check the union value + switch v := union.(type) { + case *types.DocumentContentMemberBlob: + _ = v.Value // Value is []byte + + case *types.DocumentContentMemberS3: + _ = v.Value // Value is types.S3 + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.S3 +var _ []byte + +func ExamplePluginAuthConfiguration_outputUsage() { + var union types.PluginAuthConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.PluginAuthConfigurationMemberBasicAuthConfiguration: + _ = v.Value // Value is types.BasicAuthConfiguration + + case *types.PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration: + _ = v.Value // Value is types.OAuth2ClientCredentialConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.BasicAuthConfiguration +var _ *types.OAuth2ClientCredentialConfiguration + +func ExamplePrincipal_outputUsage() { + var union types.Principal + // type switches can be used to check the union value + switch v := union.(type) { + case *types.PrincipalMemberGroup: + _ = v.Value // Value is types.PrincipalGroup + + case *types.PrincipalMemberUser: + _ = v.Value // Value is types.PrincipalUser + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.PrincipalUser +var _ *types.PrincipalGroup + +func ExampleRetrieverConfiguration_outputUsage() { + var union types.RetrieverConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.RetrieverConfigurationMemberKendraIndexConfiguration: + _ = v.Value // Value is types.KendraIndexConfiguration + + case *types.RetrieverConfigurationMemberNativeIndexConfiguration: + _ = v.Value // Value is types.NativeIndexConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.NativeIndexConfiguration +var _ *types.KendraIndexConfiguration + +func ExampleRuleConfiguration_outputUsage() { + var union types.RuleConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.RuleConfigurationMemberContentBlockerRule: + _ = v.Value // Value is types.ContentBlockerRule + + case *types.RuleConfigurationMemberContentRetrievalRule: + _ = v.Value // Value is types.ContentRetrievalRule + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ContentRetrievalRule +var _ *types.ContentBlockerRule + +func ExampleWebExperienceAuthConfiguration_outputUsage() { + var union types.WebExperienceAuthConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.WebExperienceAuthConfigurationMemberSamlConfiguration: + _ = v.Value // Value is types.SamlConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.SamlConfiguration diff --git a/service/qbusiness/validators.go b/service/qbusiness/validators.go new file mode 100644 index 00000000000..3ec13ff33b6 --- /dev/null +++ b/service/qbusiness/validators.go @@ -0,0 +1,3461 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qbusiness + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qbusiness/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpBatchDeleteDocument struct { +} + +func (*validateOpBatchDeleteDocument) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpBatchDeleteDocument) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*BatchDeleteDocumentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpBatchDeleteDocumentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpBatchPutDocument struct { +} + +func (*validateOpBatchPutDocument) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpBatchPutDocument) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*BatchPutDocumentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpBatchPutDocumentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpChatSync struct { +} + +func (*validateOpChatSync) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpChatSync) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ChatSyncInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpChatSyncInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateApplication struct { +} + +func (*validateOpCreateApplication) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateApplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateApplicationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateDataSource struct { +} + +func (*validateOpCreateDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateIndex struct { +} + +func (*validateOpCreateIndex) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateIndex) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateIndexInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateIndexInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreatePlugin struct { +} + +func (*validateOpCreatePlugin) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreatePlugin) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreatePluginInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreatePluginInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateRetriever struct { +} + +func (*validateOpCreateRetriever) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateRetriever) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateRetrieverInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateRetrieverInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateUser struct { +} + +func (*validateOpCreateUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateWebExperience struct { +} + +func (*validateOpCreateWebExperience) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateWebExperience) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateWebExperienceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateWebExperienceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteApplication struct { +} + +func (*validateOpDeleteApplication) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteApplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteApplicationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteChatControlsConfiguration struct { +} + +func (*validateOpDeleteChatControlsConfiguration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteChatControlsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteChatControlsConfigurationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteChatControlsConfigurationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteConversation struct { +} + +func (*validateOpDeleteConversation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteConversation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteConversationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteConversationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteDataSource struct { +} + +func (*validateOpDeleteDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteGroup struct { +} + +func (*validateOpDeleteGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteIndex struct { +} + +func (*validateOpDeleteIndex) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteIndex) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteIndexInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteIndexInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeletePlugin struct { +} + +func (*validateOpDeletePlugin) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeletePlugin) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeletePluginInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeletePluginInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteRetriever struct { +} + +func (*validateOpDeleteRetriever) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteRetriever) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteRetrieverInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteRetrieverInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteUser struct { +} + +func (*validateOpDeleteUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteWebExperience struct { +} + +func (*validateOpDeleteWebExperience) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteWebExperience) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteWebExperienceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteWebExperienceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetApplication struct { +} + +func (*validateOpGetApplication) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetApplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetApplicationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetChatControlsConfiguration struct { +} + +func (*validateOpGetChatControlsConfiguration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetChatControlsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetChatControlsConfigurationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetChatControlsConfigurationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetDataSource struct { +} + +func (*validateOpGetDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetGroup struct { +} + +func (*validateOpGetGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetIndex struct { +} + +func (*validateOpGetIndex) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetIndex) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetIndexInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetIndexInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetPlugin struct { +} + +func (*validateOpGetPlugin) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetPlugin) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetPluginInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetPluginInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetRetriever struct { +} + +func (*validateOpGetRetriever) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetRetriever) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetRetrieverInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetRetrieverInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetUser struct { +} + +func (*validateOpGetUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetWebExperience struct { +} + +func (*validateOpGetWebExperience) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetWebExperience) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetWebExperienceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetWebExperienceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListConversations struct { +} + +func (*validateOpListConversations) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListConversations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListConversationsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListConversationsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListDataSources struct { +} + +func (*validateOpListDataSources) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListDataSources) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListDataSourcesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListDataSourcesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListDataSourceSyncJobs struct { +} + +func (*validateOpListDataSourceSyncJobs) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListDataSourceSyncJobs) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListDataSourceSyncJobsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListDataSourceSyncJobsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListDocuments struct { +} + +func (*validateOpListDocuments) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListDocuments) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListDocumentsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListDocumentsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListGroups struct { +} + +func (*validateOpListGroups) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListGroups) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListGroupsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListGroupsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListIndices struct { +} + +func (*validateOpListIndices) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListIndices) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListIndicesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListIndicesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListMessages struct { +} + +func (*validateOpListMessages) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListMessages) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListMessagesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListMessagesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListPlugins struct { +} + +func (*validateOpListPlugins) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListPlugins) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListPluginsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListPluginsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListRetrievers struct { +} + +func (*validateOpListRetrievers) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListRetrievers) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListRetrieversInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListRetrieversInput(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 validateOpListWebExperiences struct { +} + +func (*validateOpListWebExperiences) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListWebExperiences) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListWebExperiencesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListWebExperiencesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpPutFeedback struct { +} + +func (*validateOpPutFeedback) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutFeedback) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutFeedbackInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutFeedbackInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpPutGroup struct { +} + +func (*validateOpPutGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartDataSourceSyncJob struct { +} + +func (*validateOpStartDataSourceSyncJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartDataSourceSyncJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartDataSourceSyncJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartDataSourceSyncJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStopDataSourceSyncJob struct { +} + +func (*validateOpStopDataSourceSyncJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStopDataSourceSyncJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StopDataSourceSyncJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStopDataSourceSyncJobInput(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 validateOpUpdateApplication struct { +} + +func (*validateOpUpdateApplication) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateApplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateApplicationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateChatControlsConfiguration struct { +} + +func (*validateOpUpdateChatControlsConfiguration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateChatControlsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateChatControlsConfigurationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateChatControlsConfigurationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateDataSource struct { +} + +func (*validateOpUpdateDataSource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateDataSource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateDataSourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateDataSourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateIndex struct { +} + +func (*validateOpUpdateIndex) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateIndex) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateIndexInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateIndexInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdatePlugin struct { +} + +func (*validateOpUpdatePlugin) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdatePlugin) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdatePluginInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdatePluginInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateRetriever struct { +} + +func (*validateOpUpdateRetriever) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateRetriever) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateRetrieverInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateRetrieverInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateUser struct { +} + +func (*validateOpUpdateUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateWebExperience struct { +} + +func (*validateOpUpdateWebExperience) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateWebExperience) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateWebExperienceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateWebExperienceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpBatchDeleteDocumentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpBatchDeleteDocument{}, middleware.After) +} + +func addOpBatchPutDocumentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpBatchPutDocument{}, middleware.After) +} + +func addOpChatSyncValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpChatSync{}, middleware.After) +} + +func addOpCreateApplicationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateApplication{}, middleware.After) +} + +func addOpCreateDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateDataSource{}, middleware.After) +} + +func addOpCreateIndexValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateIndex{}, middleware.After) +} + +func addOpCreatePluginValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreatePlugin{}, middleware.After) +} + +func addOpCreateRetrieverValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateRetriever{}, middleware.After) +} + +func addOpCreateUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateUser{}, middleware.After) +} + +func addOpCreateWebExperienceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateWebExperience{}, middleware.After) +} + +func addOpDeleteApplicationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteApplication{}, middleware.After) +} + +func addOpDeleteChatControlsConfigurationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteChatControlsConfiguration{}, middleware.After) +} + +func addOpDeleteConversationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteConversation{}, middleware.After) +} + +func addOpDeleteDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteDataSource{}, middleware.After) +} + +func addOpDeleteGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteGroup{}, middleware.After) +} + +func addOpDeleteIndexValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteIndex{}, middleware.After) +} + +func addOpDeletePluginValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeletePlugin{}, middleware.After) +} + +func addOpDeleteRetrieverValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteRetriever{}, middleware.After) +} + +func addOpDeleteUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteUser{}, middleware.After) +} + +func addOpDeleteWebExperienceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteWebExperience{}, middleware.After) +} + +func addOpGetApplicationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetApplication{}, middleware.After) +} + +func addOpGetChatControlsConfigurationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetChatControlsConfiguration{}, middleware.After) +} + +func addOpGetDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetDataSource{}, middleware.After) +} + +func addOpGetGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetGroup{}, middleware.After) +} + +func addOpGetIndexValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetIndex{}, middleware.After) +} + +func addOpGetPluginValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetPlugin{}, middleware.After) +} + +func addOpGetRetrieverValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetRetriever{}, middleware.After) +} + +func addOpGetUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetUser{}, middleware.After) +} + +func addOpGetWebExperienceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetWebExperience{}, middleware.After) +} + +func addOpListConversationsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListConversations{}, middleware.After) +} + +func addOpListDataSourcesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListDataSources{}, middleware.After) +} + +func addOpListDataSourceSyncJobsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListDataSourceSyncJobs{}, middleware.After) +} + +func addOpListDocumentsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListDocuments{}, middleware.After) +} + +func addOpListGroupsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListGroups{}, middleware.After) +} + +func addOpListIndicesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListIndices{}, middleware.After) +} + +func addOpListMessagesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListMessages{}, middleware.After) +} + +func addOpListPluginsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListPlugins{}, middleware.After) +} + +func addOpListRetrieversValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListRetrievers{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpListWebExperiencesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListWebExperiences{}, middleware.After) +} + +func addOpPutFeedbackValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutFeedback{}, middleware.After) +} + +func addOpPutGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutGroup{}, middleware.After) +} + +func addOpStartDataSourceSyncJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartDataSourceSyncJob{}, middleware.After) +} + +func addOpStopDataSourceSyncJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStopDataSourceSyncJob{}, 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 addOpUpdateApplicationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateApplication{}, middleware.After) +} + +func addOpUpdateChatControlsConfigurationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateChatControlsConfiguration{}, middleware.After) +} + +func addOpUpdateDataSourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateDataSource{}, middleware.After) +} + +func addOpUpdateIndexValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateIndex{}, middleware.After) +} + +func addOpUpdatePluginValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdatePlugin{}, middleware.After) +} + +func addOpUpdateRetrieverValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateRetriever{}, middleware.After) +} + +func addOpUpdateUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateUser{}, middleware.After) +} + +func addOpUpdateWebExperienceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateWebExperience{}, middleware.After) +} + +func validateAccessConfiguration(v *types.AccessConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AccessConfiguration"} + if v.AccessControls == nil { + invalidParams.Add(smithy.NewErrParamRequired("AccessControls")) + } else if v.AccessControls != nil { + if err := validateAccessControls(v.AccessControls); err != nil { + invalidParams.AddNested("AccessControls", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAccessControl(v *types.AccessControl) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AccessControl"} + if v.Principals == nil { + invalidParams.Add(smithy.NewErrParamRequired("Principals")) + } else if v.Principals != nil { + if err := validatePrincipals(v.Principals); err != nil { + invalidParams.AddNested("Principals", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAccessControls(v []types.AccessControl) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AccessControls"} + for i := range v { + if err := validateAccessControl(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateActionExecution(v *types.ActionExecution) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ActionExecution"} + if v.PluginId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PluginId")) + } + if v.Payload == nil { + invalidParams.Add(smithy.NewErrParamRequired("Payload")) + } else if v.Payload != nil { + if err := validateActionExecutionPayload(v.Payload); err != nil { + invalidParams.AddNested("Payload", err.(smithy.InvalidParamsError)) + } + } + if v.PayloadFieldNameSeparator == nil { + invalidParams.Add(smithy.NewErrParamRequired("PayloadFieldNameSeparator")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateActionExecutionPayload(v map[string]types.ActionExecutionPayloadField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ActionExecutionPayload"} + for key := range v { + value := v[key] + if err := validateActionExecutionPayloadField(&value); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%q]", key), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateActionExecutionPayloadField(v *types.ActionExecutionPayloadField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ActionExecutionPayloadField"} + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAttachmentInput(v *types.AttachmentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AttachmentInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Data == nil { + invalidParams.Add(smithy.NewErrParamRequired("Data")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAttachmentsConfiguration(v *types.AttachmentsConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AttachmentsConfiguration"} + if len(v.AttachmentsControlMode) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("AttachmentsControlMode")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAttachmentsInput(v []types.AttachmentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AttachmentsInput"} + for i := range v { + if err := validateAttachmentInput(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAttributeFilter(v *types.AttributeFilter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AttributeFilter"} + if v.AndAllFilters != nil { + if err := validateAttributeFilters(v.AndAllFilters); err != nil { + invalidParams.AddNested("AndAllFilters", err.(smithy.InvalidParamsError)) + } + } + if v.OrAllFilters != nil { + if err := validateAttributeFilters(v.OrAllFilters); err != nil { + invalidParams.AddNested("OrAllFilters", err.(smithy.InvalidParamsError)) + } + } + if v.NotFilter != nil { + if err := validateAttributeFilter(v.NotFilter); err != nil { + invalidParams.AddNested("NotFilter", err.(smithy.InvalidParamsError)) + } + } + if v.EqualsTo != nil { + if err := validateDocumentAttribute(v.EqualsTo); err != nil { + invalidParams.AddNested("EqualsTo", err.(smithy.InvalidParamsError)) + } + } + if v.ContainsAll != nil { + if err := validateDocumentAttribute(v.ContainsAll); err != nil { + invalidParams.AddNested("ContainsAll", err.(smithy.InvalidParamsError)) + } + } + if v.ContainsAny != nil { + if err := validateDocumentAttribute(v.ContainsAny); err != nil { + invalidParams.AddNested("ContainsAny", err.(smithy.InvalidParamsError)) + } + } + if v.GreaterThan != nil { + if err := validateDocumentAttribute(v.GreaterThan); err != nil { + invalidParams.AddNested("GreaterThan", err.(smithy.InvalidParamsError)) + } + } + if v.GreaterThanOrEquals != nil { + if err := validateDocumentAttribute(v.GreaterThanOrEquals); err != nil { + invalidParams.AddNested("GreaterThanOrEquals", err.(smithy.InvalidParamsError)) + } + } + if v.LessThan != nil { + if err := validateDocumentAttribute(v.LessThan); err != nil { + invalidParams.AddNested("LessThan", err.(smithy.InvalidParamsError)) + } + } + if v.LessThanOrEquals != nil { + if err := validateDocumentAttribute(v.LessThanOrEquals); err != nil { + invalidParams.AddNested("LessThanOrEquals", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAttributeFilters(v []types.AttributeFilter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AttributeFilters"} + for i := range v { + if err := validateAttributeFilter(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateBasicAuthConfiguration(v *types.BasicAuthConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BasicAuthConfiguration"} + if v.SecretArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("SecretArn")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDataSourceVpcConfiguration(v *types.DataSourceVpcConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DataSourceVpcConfiguration"} + if v.SubnetIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubnetIds")) + } + if v.SecurityGroupIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("SecurityGroupIds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDeleteDocument(v *types.DeleteDocument) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteDocument"} + if v.DocumentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DocumentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDeleteDocuments(v []types.DeleteDocument) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteDocuments"} + for i := range v { + if err := validateDeleteDocument(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocument(v *types.Document) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Document"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if v.Attributes != nil { + if err := validateDocumentAttributes(v.Attributes); err != nil { + invalidParams.AddNested("Attributes", err.(smithy.InvalidParamsError)) + } + } + if v.Content != nil { + if err := validateDocumentContent(v.Content); err != nil { + invalidParams.AddNested("Content", err.(smithy.InvalidParamsError)) + } + } + if v.AccessConfiguration != nil { + if err := validateAccessConfiguration(v.AccessConfiguration); err != nil { + invalidParams.AddNested("AccessConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.DocumentEnrichmentConfiguration != nil { + if err := validateDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration); err != nil { + invalidParams.AddNested("DocumentEnrichmentConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentAttribute(v *types.DocumentAttribute) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentAttribute"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentAttributeCondition(v *types.DocumentAttributeCondition) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentAttributeCondition"} + if v.Key == nil { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentAttributes(v []types.DocumentAttribute) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentAttributes"} + for i := range v { + if err := validateDocumentAttribute(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentAttributeTarget(v *types.DocumentAttributeTarget) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentAttributeTarget"} + if v.Key == nil { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentContent(v types.DocumentContent) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentContent"} + switch uv := v.(type) { + case *types.DocumentContentMemberS3: + if err := validateS3(&uv.Value); err != nil { + invalidParams.AddNested("[s3]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocumentEnrichmentConfiguration(v *types.DocumentEnrichmentConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DocumentEnrichmentConfiguration"} + if v.InlineConfigurations != nil { + if err := validateInlineDocumentEnrichmentConfigurations(v.InlineConfigurations); err != nil { + invalidParams.AddNested("InlineConfigurations", err.(smithy.InvalidParamsError)) + } + } + if v.PreExtractionHookConfiguration != nil { + if err := validateHookConfiguration(v.PreExtractionHookConfiguration); err != nil { + invalidParams.AddNested("PreExtractionHookConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.PostExtractionHookConfiguration != nil { + if err := validateHookConfiguration(v.PostExtractionHookConfiguration); err != nil { + invalidParams.AddNested("PostExtractionHookConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateDocuments(v []types.Document) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Documents"} + for i := range v { + if err := validateDocument(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateGroupMembers(v *types.GroupMembers) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GroupMembers"} + if v.MemberGroups != nil { + if err := validateMemberGroups(v.MemberGroups); err != nil { + invalidParams.AddNested("MemberGroups", err.(smithy.InvalidParamsError)) + } + } + if v.MemberUsers != nil { + if err := validateMemberUsers(v.MemberUsers); err != nil { + invalidParams.AddNested("MemberUsers", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateHookConfiguration(v *types.HookConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "HookConfiguration"} + if v.InvocationCondition != nil { + if err := validateDocumentAttributeCondition(v.InvocationCondition); err != nil { + invalidParams.AddNested("InvocationCondition", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateInlineDocumentEnrichmentConfiguration(v *types.InlineDocumentEnrichmentConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "InlineDocumentEnrichmentConfiguration"} + if v.Condition != nil { + if err := validateDocumentAttributeCondition(v.Condition); err != nil { + invalidParams.AddNested("Condition", err.(smithy.InvalidParamsError)) + } + } + if v.Target != nil { + if err := validateDocumentAttributeTarget(v.Target); err != nil { + invalidParams.AddNested("Target", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateInlineDocumentEnrichmentConfigurations(v []types.InlineDocumentEnrichmentConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "InlineDocumentEnrichmentConfigurations"} + for i := range v { + if err := validateInlineDocumentEnrichmentConfiguration(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKendraIndexConfiguration(v *types.KendraIndexConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KendraIndexConfiguration"} + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMemberGroup(v *types.MemberGroup) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MemberGroup"} + if v.GroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMemberGroups(v []types.MemberGroup) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MemberGroups"} + for i := range v { + if err := validateMemberGroup(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMemberUser(v *types.MemberUser) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MemberUser"} + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMemberUsers(v []types.MemberUser) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MemberUsers"} + for i := range v { + if err := validateMemberUser(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMessageUsefulnessFeedback(v *types.MessageUsefulnessFeedback) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MessageUsefulnessFeedback"} + if len(v.Usefulness) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Usefulness")) + } + if v.SubmittedAt == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubmittedAt")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateNativeIndexConfiguration(v *types.NativeIndexConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "NativeIndexConfiguration"} + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOAuth2ClientCredentialConfiguration(v *types.OAuth2ClientCredentialConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "OAuth2ClientCredentialConfiguration"} + if v.SecretArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("SecretArn")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePluginAuthConfiguration(v types.PluginAuthConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PluginAuthConfiguration"} + switch uv := v.(type) { + case *types.PluginAuthConfigurationMemberBasicAuthConfiguration: + if err := validateBasicAuthConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[basicAuthConfiguration]", err.(smithy.InvalidParamsError)) + } + + case *types.PluginAuthConfigurationMemberOAuth2ClientCredentialConfiguration: + if err := validateOAuth2ClientCredentialConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[oAuth2ClientCredentialConfiguration]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrincipal(v types.Principal) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Principal"} + switch uv := v.(type) { + case *types.PrincipalMemberGroup: + if err := validatePrincipalGroup(&uv.Value); err != nil { + invalidParams.AddNested("[group]", err.(smithy.InvalidParamsError)) + } + + case *types.PrincipalMemberUser: + if err := validatePrincipalUser(&uv.Value); err != nil { + invalidParams.AddNested("[user]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrincipalGroup(v *types.PrincipalGroup) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrincipalGroup"} + if len(v.Access) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Access")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrincipals(v []types.Principal) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Principals"} + for i := range v { + if err := validatePrincipal(v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrincipalUser(v *types.PrincipalUser) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrincipalUser"} + if len(v.Access) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Access")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRetrieverConfiguration(v types.RetrieverConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RetrieverConfiguration"} + switch uv := v.(type) { + case *types.RetrieverConfigurationMemberKendraIndexConfiguration: + if err := validateKendraIndexConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[kendraIndexConfiguration]", err.(smithy.InvalidParamsError)) + } + + case *types.RetrieverConfigurationMemberNativeIndexConfiguration: + if err := validateNativeIndexConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[nativeIndexConfiguration]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRule(v *types.Rule) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Rule"} + if len(v.RuleType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("RuleType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRules(v []types.Rule) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Rules"} + for i := range v { + if err := validateRule(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateS3(v *types.S3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "S3"} + if v.Bucket == nil { + invalidParams.Add(smithy.NewErrParamRequired("Bucket")) + } + if v.Key == nil { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSamlConfiguration(v *types.SamlConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SamlConfiguration"} + if v.MetadataXML == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetadataXML")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if v.UserIdAttribute == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserIdAttribute")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTag(v *types.Tag) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Tag"} + if v.Key == nil { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTags(v []types.Tag) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Tags"} + for i := range v { + if err := validateTag(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTopicConfiguration(v *types.TopicConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TopicConfiguration"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Rules == nil { + invalidParams.Add(smithy.NewErrParamRequired("Rules")) + } else if v.Rules != nil { + if err := validateRules(v.Rules); err != nil { + invalidParams.AddNested("Rules", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTopicConfigurations(v []types.TopicConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TopicConfigurations"} + for i := range v { + if err := validateTopicConfiguration(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateUserAlias(v *types.UserAlias) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UserAlias"} + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateUserAliases(v []types.UserAlias) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UserAliases"} + for i := range v { + if err := validateUserAlias(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateWebExperienceAuthConfiguration(v types.WebExperienceAuthConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "WebExperienceAuthConfiguration"} + switch uv := v.(type) { + case *types.WebExperienceAuthConfigurationMemberSamlConfiguration: + if err := validateSamlConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[samlConfiguration]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpBatchDeleteDocumentInput(v *BatchDeleteDocumentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BatchDeleteDocumentInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.Documents == nil { + invalidParams.Add(smithy.NewErrParamRequired("Documents")) + } else if v.Documents != nil { + if err := validateDeleteDocuments(v.Documents); err != nil { + invalidParams.AddNested("Documents", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpBatchPutDocumentInput(v *BatchPutDocumentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BatchPutDocumentInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.Documents == nil { + invalidParams.Add(smithy.NewErrParamRequired("Documents")) + } else if v.Documents != nil { + if err := validateDocuments(v.Documents); err != nil { + invalidParams.AddNested("Documents", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpChatSyncInput(v *ChatSyncInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ChatSyncInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if v.Attachments != nil { + if err := validateAttachmentsInput(v.Attachments); err != nil { + invalidParams.AddNested("Attachments", err.(smithy.InvalidParamsError)) + } + } + if v.ActionExecution != nil { + if err := validateActionExecution(v.ActionExecution); err != nil { + invalidParams.AddNested("ActionExecution", err.(smithy.InvalidParamsError)) + } + } + if v.AttributeFilter != nil { + if err := validateAttributeFilter(v.AttributeFilter); err != nil { + invalidParams.AddNested("AttributeFilter", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateApplicationInput(v *CreateApplicationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateApplicationInput"} + if v.DisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DisplayName")) + } + if v.RoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if v.AttachmentsConfiguration != nil { + if err := validateAttachmentsConfiguration(v.AttachmentsConfiguration); err != nil { + invalidParams.AddNested("AttachmentsConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateDataSourceInput(v *CreateDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateDataSourceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.DisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DisplayName")) + } + if v.Configuration == nil { + invalidParams.Add(smithy.NewErrParamRequired("Configuration")) + } + if v.VpcConfiguration != nil { + if err := validateDataSourceVpcConfiguration(v.VpcConfiguration); err != nil { + invalidParams.AddNested("VpcConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if v.DocumentEnrichmentConfiguration != nil { + if err := validateDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration); err != nil { + invalidParams.AddNested("DocumentEnrichmentConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateIndexInput(v *CreateIndexInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateIndexInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.DisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DisplayName")) + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreatePluginInput(v *CreatePluginInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreatePluginInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.DisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DisplayName")) + } + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.ServerUrl == nil { + invalidParams.Add(smithy.NewErrParamRequired("ServerUrl")) + } + if v.AuthConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("AuthConfiguration")) + } else if v.AuthConfiguration != nil { + if err := validatePluginAuthConfiguration(v.AuthConfiguration); err != nil { + invalidParams.AddNested("AuthConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateRetrieverInput(v *CreateRetrieverInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateRetrieverInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.DisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("DisplayName")) + } + if v.Configuration == nil { + invalidParams.Add(smithy.NewErrParamRequired("Configuration")) + } else if v.Configuration != nil { + if err := validateRetrieverConfiguration(v.Configuration); err != nil { + invalidParams.AddNested("Configuration", err.(smithy.InvalidParamsError)) + } + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateUserInput(v *CreateUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateUserInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if v.UserAliases != nil { + if err := validateUserAliases(v.UserAliases); err != nil { + invalidParams.AddNested("UserAliases", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateWebExperienceInput(v *CreateWebExperienceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateWebExperienceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteApplicationInput(v *DeleteApplicationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteApplicationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteChatControlsConfigurationInput(v *DeleteChatControlsConfigurationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteChatControlsConfigurationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteConversationInput(v *DeleteConversationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteConversationInput"} + if v.ConversationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConversationId")) + } + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteDataSourceInput(v *DeleteDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteDataSourceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteGroupInput(v *DeleteGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteGroupInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.GroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteIndexInput(v *DeleteIndexInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteIndexInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeletePluginInput(v *DeletePluginInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeletePluginInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.PluginId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PluginId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteRetrieverInput(v *DeleteRetrieverInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteRetrieverInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.RetrieverId == nil { + invalidParams.Add(smithy.NewErrParamRequired("RetrieverId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteUserInput(v *DeleteUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteUserInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteWebExperienceInput(v *DeleteWebExperienceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteWebExperienceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.WebExperienceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("WebExperienceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetApplicationInput(v *GetApplicationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetApplicationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetChatControlsConfigurationInput(v *GetChatControlsConfigurationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetChatControlsConfigurationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetDataSourceInput(v *GetDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetDataSourceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetGroupInput(v *GetGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetGroupInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.GroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetIndexInput(v *GetIndexInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetIndexInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetPluginInput(v *GetPluginInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetPluginInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.PluginId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PluginId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetRetrieverInput(v *GetRetrieverInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetRetrieverInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.RetrieverId == nil { + invalidParams.Add(smithy.NewErrParamRequired("RetrieverId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetUserInput(v *GetUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetUserInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetWebExperienceInput(v *GetWebExperienceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetWebExperienceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.WebExperienceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("WebExperienceId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListConversationsInput(v *ListConversationsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListConversationsInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListDataSourcesInput(v *ListDataSourcesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListDataSourcesInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListDataSourceSyncJobsInput(v *ListDataSourceSyncJobsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListDataSourceSyncJobsInput"} + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListDocumentsInput(v *ListDocumentsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListDocumentsInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListGroupsInput(v *ListGroupsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListGroupsInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.UpdatedEarlierThan == nil { + invalidParams.Add(smithy.NewErrParamRequired("UpdatedEarlierThan")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListIndicesInput(v *ListIndicesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListIndicesInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListMessagesInput(v *ListMessagesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListMessagesInput"} + if v.ConversationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConversationId")) + } + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListPluginsInput(v *ListPluginsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListPluginsInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListRetrieversInput(v *ListRetrieversInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListRetrieversInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + 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 validateOpListWebExperiencesInput(v *ListWebExperiencesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListWebExperiencesInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpPutFeedbackInput(v *PutFeedbackInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutFeedbackInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if v.ConversationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConversationId")) + } + if v.MessageId == nil { + invalidParams.Add(smithy.NewErrParamRequired("MessageId")) + } + if v.MessageUsefulness != nil { + if err := validateMessageUsefulnessFeedback(v.MessageUsefulness); err != nil { + invalidParams.AddNested("MessageUsefulness", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpPutGroupInput(v *PutGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutGroupInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.GroupName == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupName")) + } + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if v.GroupMembers == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupMembers")) + } else if v.GroupMembers != nil { + if err := validateGroupMembers(v.GroupMembers); err != nil { + invalidParams.AddNested("GroupMembers", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartDataSourceSyncJobInput(v *StartDataSourceSyncJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartDataSourceSyncJobInput"} + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStopDataSourceSyncJobInput(v *StopDataSourceSyncJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StopDataSourceSyncJobInput"} + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpTagResourceInput(v *TagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} + if v.ResourceARN == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) + } + if v.Tags == nil { + invalidParams.Add(smithy.NewErrParamRequired("Tags")) + } else if v.Tags != nil { + if err := validateTags(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUntagResourceInput(v *UntagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"} + if v.ResourceARN == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) + } + if v.TagKeys == nil { + invalidParams.Add(smithy.NewErrParamRequired("TagKeys")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateApplicationInput(v *UpdateApplicationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateApplicationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.AttachmentsConfiguration != nil { + if err := validateAttachmentsConfiguration(v.AttachmentsConfiguration); err != nil { + invalidParams.AddNested("AttachmentsConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateChatControlsConfigurationInput(v *UpdateChatControlsConfigurationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateChatControlsConfigurationInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.TopicConfigurationsToCreateOrUpdate != nil { + if err := validateTopicConfigurations(v.TopicConfigurationsToCreateOrUpdate); err != nil { + invalidParams.AddNested("TopicConfigurationsToCreateOrUpdate", err.(smithy.InvalidParamsError)) + } + } + if v.TopicConfigurationsToDelete != nil { + if err := validateTopicConfigurations(v.TopicConfigurationsToDelete); err != nil { + invalidParams.AddNested("TopicConfigurationsToDelete", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateDataSourceInput(v *UpdateDataSourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateDataSourceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if v.DataSourceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataSourceId")) + } + if v.VpcConfiguration != nil { + if err := validateDataSourceVpcConfiguration(v.VpcConfiguration); err != nil { + invalidParams.AddNested("VpcConfiguration", err.(smithy.InvalidParamsError)) + } + } + if v.DocumentEnrichmentConfiguration != nil { + if err := validateDocumentEnrichmentConfiguration(v.DocumentEnrichmentConfiguration); err != nil { + invalidParams.AddNested("DocumentEnrichmentConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateIndexInput(v *UpdateIndexInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateIndexInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.IndexId == nil { + invalidParams.Add(smithy.NewErrParamRequired("IndexId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdatePluginInput(v *UpdatePluginInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdatePluginInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.PluginId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PluginId")) + } + if v.AuthConfiguration != nil { + if err := validatePluginAuthConfiguration(v.AuthConfiguration); err != nil { + invalidParams.AddNested("AuthConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateRetrieverInput(v *UpdateRetrieverInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateRetrieverInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.RetrieverId == nil { + invalidParams.Add(smithy.NewErrParamRequired("RetrieverId")) + } + if v.Configuration != nil { + if err := validateRetrieverConfiguration(v.Configuration); err != nil { + invalidParams.AddNested("Configuration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateUserInput(v *UpdateUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateUserInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if v.UserAliasesToUpdate != nil { + if err := validateUserAliases(v.UserAliasesToUpdate); err != nil { + invalidParams.AddNested("UserAliasesToUpdate", err.(smithy.InvalidParamsError)) + } + } + if v.UserAliasesToDelete != nil { + if err := validateUserAliases(v.UserAliasesToDelete); err != nil { + invalidParams.AddNested("UserAliasesToDelete", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateWebExperienceInput(v *UpdateWebExperienceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateWebExperienceInput"} + if v.ApplicationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ApplicationId")) + } + if v.WebExperienceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("WebExperienceId")) + } + if v.AuthenticationConfiguration != nil { + if err := validateWebExperienceAuthConfiguration(v.AuthenticationConfiguration); err != nil { + invalidParams.AddNested("AuthenticationConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/qconnect/LICENSE.txt b/service/qconnect/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/qconnect/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/qconnect/api_client.go b/service/qconnect/api_client.go new file mode 100644 index 00000000000..d5a358cfaf1 --- /dev/null +++ b/service/qconnect/api_client.go @@ -0,0 +1,470 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +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" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + 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 = "QConnect" +const ServiceAPIVersion = "2020-10-19" + +// Client provides the API client to make operations call for Amazon Q Connect. +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) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveIdempotencyTokenProvider(&options) + + resolveEndpointResolverV2(&options) + + resolveAuthSchemeResolver(&options) + + for _, fn := range optFns { + fn(&options) + } + + resolveRetryer(&options) + + ignoreAnonymousAuth(&options) + + resolveAuthSchemes(&options) + + client := &Client{ + options: options, + } + + return client +} + +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttemptOptions(&options, *c) + + finalizeClientEndpointResolverOptions(&options) + + for _, fn := range stackFns { + if err := fn(stack, options); err != nil { + return nil, metadata, err + } + } + + for _, fn := range options.APIOptions { + if err := fn(stack); err != nil { + return nil, metadata, err + } + } + + handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) + result, metadata, err = handler.Handle(ctx, params) + if err != nil { + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + return result, metadata, err +} + +type operationInputKey struct{} + +func setOperationInput(ctx context.Context, input interface{}) context.Context { + return middleware.WithStackValue(ctx, operationInputKey{}, input) +} + +func getOperationInput(ctx context.Context) interface{} { + return middleware.GetStackValue(ctx, operationInputKey{}) +} + +type setOperationInputMiddleware struct { +} + +func (*setOperationInputMiddleware) ID() string { + return "setOperationInput" +} + +func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + ctx = setOperationInput(ctx, in.Parameters) + return next.HandleSerialize(ctx, in) +} + +func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { + if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { + return fmt.Errorf("add ResolveAuthScheme: %v", err) + } + if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { + return fmt.Errorf("add GetIdentity: %v", err) + } + if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { + return fmt.Errorf("add ResolveEndpointV2: %v", err) + } + if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil { + return fmt.Errorf("add Signing: %v", err) + } + return nil +} +func resolveAuthSchemeResolver(options *Options) { + if options.AuthSchemeResolver == nil { + options.AuthSchemeResolver = &defaultAuthSchemeResolver{} + } +} + +func resolveAuthSchemes(options *Options) { + if options.AuthSchemes == nil { + options.AuthSchemes = []smithyhttp.AuthScheme{ + internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ + Signer: options.HTTPSignerV4, + Logger: options.Logger, + LogSigning: options.ClientLogMode.IsSigning(), + }), + } + } +} + +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) + resolveBaseEndpoint(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, "qconnect", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +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 disableHTTPSMiddleware struct { + DisableHTTPS bool +} + +func (*disableHTTPSMiddleware) ID() string { + return "disableHTTPS" +} + +func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, 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.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleFinalize(ctx, in) +} + +func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Finalize.Insert(&disableHTTPSMiddleware{ + DisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "ResolveEndpointV2", middleware.After) +} diff --git a/service/qconnect/api_client_test.go b/service/qconnect/api_client_test.go new file mode 100644 index 00000000000..71c4f93576d --- /dev/null +++ b/service/qconnect/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +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/qconnect/api_op_CreateAssistant.go b/service/qconnect/api_op_CreateAssistant.go new file mode 100644 index 00000000000..ffaf8618337 --- /dev/null +++ b/service/qconnect/api_op_CreateAssistant.go @@ -0,0 +1,202 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon Q in Connect assistant. +func (c *Client) CreateAssistant(ctx context.Context, params *CreateAssistantInput, optFns ...func(*Options)) (*CreateAssistantOutput, error) { + if params == nil { + params = &CreateAssistantInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAssistant", params, optFns, c.addOperationCreateAssistantMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAssistantOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateAssistantInput struct { + + // The name of the assistant. + // + // This member is required. + Name *string + + // The type of assistant. + // + // This member is required. + Type types.AssistantType + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The description of the assistant. + Description *string + + // The configuration information for the customer managed key used for encryption. + // The customer managed key must have a policy that allows kms:CreateGrant , + // kms:DescribeKey , kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM + // identity using the key to invoke Amazon Q. To use Amazon Q with chat, the key + // policy must also allow kms:Decrypt , kms:GenerateDataKey* , and kms:DescribeKey + // permissions to the connect.amazonaws.com service principal. For more + // information about setting up a customer managed key for Amazon Q, see Enable + // Amazon Q in Connect for your instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) + // . + ServerSideEncryptionConfiguration *types.ServerSideEncryptionConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateAssistantOutput struct { + + // Information about the assistant. + Assistant *types.AssistantData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAssistantMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAssistant{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAssistant{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAssistant"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateAssistantMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateAssistantValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAssistant(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateAssistant struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateAssistant) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateAssistant) 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.(*CreateAssistantInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAssistantInput ") + } + + 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_opCreateAssistantMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAssistant{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateAssistant(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateAssistant", + } +} diff --git a/service/qconnect/api_op_CreateAssistantAssociation.go b/service/qconnect/api_op_CreateAssistantAssociation.go new file mode 100644 index 00000000000..7bd7bdf297e --- /dev/null +++ b/service/qconnect/api_op_CreateAssistantAssociation.go @@ -0,0 +1,196 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an association between an Amazon Q in Connect assistant and another +// resource. Currently, the only supported association is with a knowledge base. An +// assistant can have only a single association. +func (c *Client) CreateAssistantAssociation(ctx context.Context, params *CreateAssistantAssociationInput, optFns ...func(*Options)) (*CreateAssistantAssociationOutput, error) { + if params == nil { + params = &CreateAssistantAssociationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAssistantAssociation", params, optFns, c.addOperationCreateAssistantAssociationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAssistantAssociationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateAssistantAssociationInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The identifier of the associated resource. + // + // This member is required. + Association types.AssistantAssociationInputData + + // The type of association. + // + // This member is required. + AssociationType types.AssociationType + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateAssistantAssociationOutput struct { + + // The assistant association. + AssistantAssociation *types.AssistantAssociationData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAssistantAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAssistantAssociation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateAssistantAssociationMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateAssistantAssociationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAssistantAssociation(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateAssistantAssociation struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateAssistantAssociation) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateAssistantAssociation) 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.(*CreateAssistantAssociationInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAssistantAssociationInput ") + } + + 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_opCreateAssistantAssociationMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAssistantAssociation{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateAssistantAssociation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateAssistantAssociation", + } +} diff --git a/service/qconnect/api_op_CreateContent.go b/service/qconnect/api_op_CreateContent.go new file mode 100644 index 00000000000..2fd6944091f --- /dev/null +++ b/service/qconnect/api_op_CreateContent.go @@ -0,0 +1,213 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates Amazon Q content. Before to calling this API, use StartContentUpload (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_StartContentUpload.html) +// to upload an asset. +func (c *Client) CreateContent(ctx context.Context, params *CreateContentInput, optFns ...func(*Options)) (*CreateContentOutput, error) { + if params == nil { + params = &CreateContentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateContent", params, optFns, c.addOperationCreateContentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateContentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateContentInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The name of the content. Each piece of content in a knowledge base must have a + // unique name. You can retrieve a piece of content using only its knowledge base + // and its name with the SearchContent (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_SearchContent.html) + // API. + // + // This member is required. + Name *string + + // A pointer to the uploaded asset. This value is returned by StartContentUpload (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_StartContentUpload.html) + // . + // + // This member is required. + UploadId *string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // A key/value map to store attributes without affecting tagging or + // recommendations. For example, when synchronizing data between an external system + // and Amazon Q, you can store an external version identifier as metadata to + // utilize for determining drift. + Metadata map[string]string + + // The URI you want to use for the article. If the knowledge base has a + // templateUri, setting this argument overrides it for this piece of content. + OverrideLinkOutUri *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + // The title of the content. If not set, the title is equal to the name. + Title *string + + noSmithyDocumentSerde +} + +type CreateContentOutput struct { + + // The content. + Content *types.ContentData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateContentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateContent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateContent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateContent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateContentMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateContentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateContent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateContent struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateContent) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateContent) 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.(*CreateContentInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateContentInput ") + } + + 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_opCreateContentMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateContent{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateContent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateContent", + } +} diff --git a/service/qconnect/api_op_CreateKnowledgeBase.go b/service/qconnect/api_op_CreateKnowledgeBase.go new file mode 100644 index 00000000000..ca9afe2f5bf --- /dev/null +++ b/service/qconnect/api_op_CreateKnowledgeBase.go @@ -0,0 +1,221 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a knowledge base. When using this API, you cannot reuse Amazon +// AppIntegrations (https://docs.aws.amazon.com/appintegrations/latest/APIReference/Welcome.html) +// DataIntegrations with external knowledge bases such as Salesforce and +// ServiceNow. If you do, you'll get an InvalidRequestException error. For +// example, you're programmatically managing your external knowledge base, and you +// want to add or remove one of the fields that is being ingested from Salesforce. +// Do the following: +// - Call DeleteKnowledgeBase (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_DeleteKnowledgeBase.html) +// . +// - Call DeleteDataIntegration (https://docs.aws.amazon.com/appintegrations/latest/APIReference/API_DeleteDataIntegration.html) +// . +// - Call CreateDataIntegration (https://docs.aws.amazon.com/appintegrations/latest/APIReference/API_CreateDataIntegration.html) +// to recreate the DataIntegration or a create different one. +// - Call CreateKnowledgeBase. +func (c *Client) CreateKnowledgeBase(ctx context.Context, params *CreateKnowledgeBaseInput, optFns ...func(*Options)) (*CreateKnowledgeBaseOutput, error) { + if params == nil { + params = &CreateKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateKnowledgeBase", params, optFns, c.addOperationCreateKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateKnowledgeBaseInput struct { + + // The type of knowledge base. Only CUSTOM knowledge bases allow you to upload + // your own content. EXTERNAL knowledge bases support integrations with third-party + // systems whose content is synchronized automatically. + // + // This member is required. + KnowledgeBaseType types.KnowledgeBaseType + + // The name of the knowledge base. + // + // This member is required. + Name *string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The description. + Description *string + + // Information about how to render the content. + RenderingConfiguration *types.RenderingConfiguration + + // The configuration information for the customer managed key used for encryption. + // This KMS key must have a policy that allows kms:CreateGrant , kms:DescribeKey , + // kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM identity using + // the key to invoke Amazon Q. For more information about setting up a customer + // managed key for Amazon Q, see Enable Amazon Q in Connect for your instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) + // . + ServerSideEncryptionConfiguration *types.ServerSideEncryptionConfiguration + + // The source of the knowledge base content. Only set this argument for EXTERNAL + // knowledge bases. + SourceConfiguration types.SourceConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateKnowledgeBaseOutput struct { + + // The knowledge base. + KnowledgeBase *types.KnowledgeBaseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateKnowledgeBaseMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateKnowledgeBase struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateKnowledgeBase) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateKnowledgeBase) 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.(*CreateKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateKnowledgeBaseInput ") + } + + 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_opCreateKnowledgeBaseMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateKnowledgeBase{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateKnowledgeBase", + } +} diff --git a/service/qconnect/api_op_CreateQuickResponse.go b/service/qconnect/api_op_CreateQuickResponse.go new file mode 100644 index 00000000000..3b73e7b0e35 --- /dev/null +++ b/service/qconnect/api_op_CreateQuickResponse.go @@ -0,0 +1,224 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a Amazon Q quick response. +func (c *Client) CreateQuickResponse(ctx context.Context, params *CreateQuickResponseInput, optFns ...func(*Options)) (*CreateQuickResponseOutput, error) { + if params == nil { + params = &CreateQuickResponseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateQuickResponse", params, optFns, c.addOperationCreateQuickResponseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateQuickResponseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateQuickResponseInput struct { + + // The content of the quick response. + // + // This member is required. + Content types.QuickResponseDataProvider + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The name of the quick response. + // + // This member is required. + Name *string + + // The Amazon Connect channels this quick response applies to. + Channels []string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The media type of the quick response content. + // - Use application/x.quickresponse;format=plain for a quick response written in + // plain text. + // - Use application/x.quickresponse;format=markdown for a quick response written + // in richtext. + ContentType *string + + // The description of the quick response. + Description *string + + // The configuration information of the user groups that the quick response is + // accessible to. + GroupingConfiguration *types.GroupingConfiguration + + // Whether the quick response is active. + IsActive *bool + + // The language code value for the language in which the quick response is + // written. The supported language codes include de_DE , en_US , es_ES , fr_FR , + // id_ID , it_IT , ja_JP , ko_KR , pt_BR , zh_CN , zh_TW + Language *string + + // The shortcut key of the quick response. The value should be unique across the + // knowledge base. + ShortcutKey *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateQuickResponseOutput struct { + + // The quick response. + QuickResponse *types.QuickResponseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateQuickResponseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateQuickResponse{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateQuickResponse{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateQuickResponse"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateQuickResponseMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateQuickResponseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateQuickResponse(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateQuickResponse struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateQuickResponse) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateQuickResponse) 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.(*CreateQuickResponseInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateQuickResponseInput ") + } + + 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_opCreateQuickResponseMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateQuickResponse{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateQuickResponse(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateQuickResponse", + } +} diff --git a/service/qconnect/api_op_CreateSession.go b/service/qconnect/api_op_CreateSession.go new file mode 100644 index 00000000000..5122b3547cc --- /dev/null +++ b/service/qconnect/api_op_CreateSession.go @@ -0,0 +1,194 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a session. A session is a contextual container used for generating +// recommendations. Amazon Connect creates a new Amazon Q session for each contact +// on which Amazon Q is enabled. +func (c *Client) CreateSession(ctx context.Context, params *CreateSessionInput, optFns ...func(*Options)) (*CreateSessionOutput, error) { + if params == nil { + params = &CreateSessionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateSession", params, optFns, c.addOperationCreateSessionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateSessionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateSessionInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The name of the session. + // + // This member is required. + Name *string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. If not provided, the Amazon Web Services SDK populates this + // field. For more information about idempotency, see Making retries safe with + // idempotent APIs (https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/) + // . + ClientToken *string + + // The description. + Description *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateSessionOutput struct { + + // The session. + Session *types.SessionData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateSessionMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateSession{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateSession{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "CreateSession"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opCreateSessionMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateSessionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateSession(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateSession struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateSession) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateSession) 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.(*CreateSessionInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateSessionInput ") + } + + 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_opCreateSessionMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateSession{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateSession(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "CreateSession", + } +} diff --git a/service/qconnect/api_op_DeleteAssistant.go b/service/qconnect/api_op_DeleteAssistant.go new file mode 100644 index 00000000000..507cd218e42 --- /dev/null +++ b/service/qconnect/api_op_DeleteAssistant.go @@ -0,0 +1,133 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an assistant. +func (c *Client) DeleteAssistant(ctx context.Context, params *DeleteAssistantInput, optFns ...func(*Options)) (*DeleteAssistantOutput, error) { + if params == nil { + params = &DeleteAssistantInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAssistant", params, optFns, c.addOperationDeleteAssistantMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAssistantOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteAssistantInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + noSmithyDocumentSerde +} + +type DeleteAssistantOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAssistantMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAssistant{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAssistant{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAssistant"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAssistantValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAssistant(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAssistant(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAssistant", + } +} diff --git a/service/qconnect/api_op_DeleteAssistantAssociation.go b/service/qconnect/api_op_DeleteAssistantAssociation.go new file mode 100644 index 00000000000..66538abeb76 --- /dev/null +++ b/service/qconnect/api_op_DeleteAssistantAssociation.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an assistant association. +func (c *Client) DeleteAssistantAssociation(ctx context.Context, params *DeleteAssistantAssociationInput, optFns ...func(*Options)) (*DeleteAssistantAssociationOutput, error) { + if params == nil { + params = &DeleteAssistantAssociationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteAssistantAssociation", params, optFns, c.addOperationDeleteAssistantAssociationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteAssistantAssociationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteAssistantAssociationInput struct { + + // The identifier of the assistant association. Can be either the ID or the ARN. + // URLs cannot contain the ARN. + // + // This member is required. + AssistantAssociationId *string + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + noSmithyDocumentSerde +} + +type DeleteAssistantAssociationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteAssistantAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAssistantAssociation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteAssistantAssociationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAssistantAssociation(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteAssistantAssociation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteAssistantAssociation", + } +} diff --git a/service/qconnect/api_op_DeleteContent.go b/service/qconnect/api_op_DeleteContent.go new file mode 100644 index 00000000000..88e1eabae62 --- /dev/null +++ b/service/qconnect/api_op_DeleteContent.go @@ -0,0 +1,140 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the content. +func (c *Client) DeleteContent(ctx context.Context, params *DeleteContentInput, optFns ...func(*Options)) (*DeleteContentOutput, error) { + if params == nil { + params = &DeleteContentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteContent", params, optFns, c.addOperationDeleteContentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteContentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteContentInput struct { + + // The identifier of the content. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + ContentId *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type DeleteContentOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteContentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteContent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteContent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteContent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteContentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteContent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteContent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteContent", + } +} diff --git a/service/qconnect/api_op_DeleteImportJob.go b/service/qconnect/api_op_DeleteImportJob.go new file mode 100644 index 00000000000..99a17a97d7f --- /dev/null +++ b/service/qconnect/api_op_DeleteImportJob.go @@ -0,0 +1,138 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the quick response import job. +func (c *Client) DeleteImportJob(ctx context.Context, params *DeleteImportJobInput, optFns ...func(*Options)) (*DeleteImportJobOutput, error) { + if params == nil { + params = &DeleteImportJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteImportJob", params, optFns, c.addOperationDeleteImportJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteImportJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteImportJobInput struct { + + // The identifier of the import job to be deleted. + // + // This member is required. + ImportJobId *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type DeleteImportJobOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteImportJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteImportJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteImportJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteImportJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteImportJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteImportJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteImportJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteImportJob", + } +} diff --git a/service/qconnect/api_op_DeleteKnowledgeBase.go b/service/qconnect/api_op_DeleteKnowledgeBase.go new file mode 100644 index 00000000000..ee65db3e6a3 --- /dev/null +++ b/service/qconnect/api_op_DeleteKnowledgeBase.go @@ -0,0 +1,140 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the knowledge base. When you use this API to delete an external +// knowledge base such as Salesforce or ServiceNow, you must also delete the +// Amazon AppIntegrations (https://docs.aws.amazon.com/appintegrations/latest/APIReference/Welcome.html) +// DataIntegration. This is because you can't reuse the DataIntegration after it's +// been associated with an external knowledge base. However, you can delete and +// recreate it. See DeleteDataIntegration (https://docs.aws.amazon.com/appintegrations/latest/APIReference/API_DeleteDataIntegration.html) +// and CreateDataIntegration (https://docs.aws.amazon.com/appintegrations/latest/APIReference/API_CreateDataIntegration.html) +// in the Amazon AppIntegrations API Reference. +func (c *Client) DeleteKnowledgeBase(ctx context.Context, params *DeleteKnowledgeBaseInput, optFns ...func(*Options)) (*DeleteKnowledgeBaseOutput, error) { + if params == nil { + params = &DeleteKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteKnowledgeBase", params, optFns, c.addOperationDeleteKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteKnowledgeBaseInput struct { + + // The knowledge base to delete content from. Can be either the ID or the ARN. + // URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type DeleteKnowledgeBaseOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteKnowledgeBase", + } +} diff --git a/service/qconnect/api_op_DeleteQuickResponse.go b/service/qconnect/api_op_DeleteQuickResponse.go new file mode 100644 index 00000000000..2e2f7a44397 --- /dev/null +++ b/service/qconnect/api_op_DeleteQuickResponse.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a quick response. +func (c *Client) DeleteQuickResponse(ctx context.Context, params *DeleteQuickResponseInput, optFns ...func(*Options)) (*DeleteQuickResponseOutput, error) { + if params == nil { + params = &DeleteQuickResponseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteQuickResponse", params, optFns, c.addOperationDeleteQuickResponseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteQuickResponseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteQuickResponseInput struct { + + // The knowledge base from which the quick response is deleted. The identifier of + // the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if + // you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The identifier of the quick response to delete. + // + // This member is required. + QuickResponseId *string + + noSmithyDocumentSerde +} + +type DeleteQuickResponseOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteQuickResponseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteQuickResponse{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteQuickResponse{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteQuickResponse"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteQuickResponseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteQuickResponse(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteQuickResponse(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteQuickResponse", + } +} diff --git a/service/qconnect/api_op_GetAssistant.go b/service/qconnect/api_op_GetAssistant.go new file mode 100644 index 00000000000..7524688df42 --- /dev/null +++ b/service/qconnect/api_op_GetAssistant.go @@ -0,0 +1,138 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information about an assistant. +func (c *Client) GetAssistant(ctx context.Context, params *GetAssistantInput, optFns ...func(*Options)) (*GetAssistantOutput, error) { + if params == nil { + params = &GetAssistantInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAssistant", params, optFns, c.addOperationGetAssistantMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAssistantOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetAssistantInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + noSmithyDocumentSerde +} + +type GetAssistantOutput struct { + + // Information about the assistant. + Assistant *types.AssistantData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAssistantMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAssistant{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAssistant{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAssistant"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAssistantValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAssistant(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAssistant(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAssistant", + } +} diff --git a/service/qconnect/api_op_GetAssistantAssociation.go b/service/qconnect/api_op_GetAssistantAssociation.go new file mode 100644 index 00000000000..c43f9a97ec2 --- /dev/null +++ b/service/qconnect/api_op_GetAssistantAssociation.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information about an assistant association. +func (c *Client) GetAssistantAssociation(ctx context.Context, params *GetAssistantAssociationInput, optFns ...func(*Options)) (*GetAssistantAssociationOutput, error) { + if params == nil { + params = &GetAssistantAssociationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAssistantAssociation", params, optFns, c.addOperationGetAssistantAssociationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAssistantAssociationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetAssistantAssociationInput struct { + + // The identifier of the assistant association. Can be either the ID or the ARN. + // URLs cannot contain the ARN. + // + // This member is required. + AssistantAssociationId *string + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + noSmithyDocumentSerde +} + +type GetAssistantAssociationOutput struct { + + // The assistant association. + AssistantAssociation *types.AssistantAssociationData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAssistantAssociationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAssistantAssociation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetAssistantAssociation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetAssistantAssociationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAssistantAssociation(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetAssistantAssociation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetAssistantAssociation", + } +} diff --git a/service/qconnect/api_op_GetContent.go b/service/qconnect/api_op_GetContent.go new file mode 100644 index 00000000000..64455fef6f2 --- /dev/null +++ b/service/qconnect/api_op_GetContent.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves content, including a pre-signed URL to download the content. +func (c *Client) GetContent(ctx context.Context, params *GetContentInput, optFns ...func(*Options)) (*GetContentOutput, error) { + if params == nil { + params = &GetContentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetContent", params, optFns, c.addOperationGetContentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetContentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetContentInput struct { + + // The identifier of the content. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + ContentId *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetContentOutput struct { + + // The content. + Content *types.ContentData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetContentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetContent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetContent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetContent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetContentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetContent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetContent", + } +} diff --git a/service/qconnect/api_op_GetContentSummary.go b/service/qconnect/api_op_GetContentSummary.go new file mode 100644 index 00000000000..e9e35782ff6 --- /dev/null +++ b/service/qconnect/api_op_GetContentSummary.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves summary information about the content. +func (c *Client) GetContentSummary(ctx context.Context, params *GetContentSummaryInput, optFns ...func(*Options)) (*GetContentSummaryOutput, error) { + if params == nil { + params = &GetContentSummaryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetContentSummary", params, optFns, c.addOperationGetContentSummaryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetContentSummaryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetContentSummaryInput struct { + + // The identifier of the content. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + ContentId *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetContentSummaryOutput struct { + + // The content summary. + ContentSummary *types.ContentSummary + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetContentSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetContentSummary{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetContentSummary{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetContentSummary"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetContentSummaryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContentSummary(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetContentSummary(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetContentSummary", + } +} diff --git a/service/qconnect/api_op_GetImportJob.go b/service/qconnect/api_op_GetImportJob.go new file mode 100644 index 00000000000..24123d06012 --- /dev/null +++ b/service/qconnect/api_op_GetImportJob.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the started import job. +func (c *Client) GetImportJob(ctx context.Context, params *GetImportJobInput, optFns ...func(*Options)) (*GetImportJobOutput, error) { + if params == nil { + params = &GetImportJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetImportJob", params, optFns, c.addOperationGetImportJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetImportJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetImportJobInput struct { + + // The identifier of the import job to retrieve. + // + // This member is required. + ImportJobId *string + + // The identifier of the knowledge base that the import job belongs to. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetImportJobOutput struct { + + // The import job. + ImportJob *types.ImportJobData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetImportJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetImportJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetImportJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetImportJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetImportJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetImportJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetImportJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetImportJob", + } +} diff --git a/service/qconnect/api_op_GetKnowledgeBase.go b/service/qconnect/api_op_GetKnowledgeBase.go new file mode 100644 index 00000000000..3485eba11a8 --- /dev/null +++ b/service/qconnect/api_op_GetKnowledgeBase.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information about the knowledge base. +func (c *Client) GetKnowledgeBase(ctx context.Context, params *GetKnowledgeBaseInput, optFns ...func(*Options)) (*GetKnowledgeBaseOutput, error) { + if params == nil { + params = &GetKnowledgeBaseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetKnowledgeBase", params, optFns, c.addOperationGetKnowledgeBaseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetKnowledgeBaseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetKnowledgeBaseInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type GetKnowledgeBaseOutput struct { + + // The knowledge base. + KnowledgeBase *types.KnowledgeBaseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetKnowledgeBaseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetKnowledgeBase{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetKnowledgeBase"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetKnowledgeBaseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetKnowledgeBase(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetKnowledgeBase(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetKnowledgeBase", + } +} diff --git a/service/qconnect/api_op_GetQuickResponse.go b/service/qconnect/api_op_GetQuickResponse.go new file mode 100644 index 00000000000..13c29de13d8 --- /dev/null +++ b/service/qconnect/api_op_GetQuickResponse.go @@ -0,0 +1,143 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the quick response. +func (c *Client) GetQuickResponse(ctx context.Context, params *GetQuickResponseInput, optFns ...func(*Options)) (*GetQuickResponseOutput, error) { + if params == nil { + params = &GetQuickResponseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetQuickResponse", params, optFns, c.addOperationGetQuickResponseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetQuickResponseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetQuickResponseInput struct { + + // The identifier of the knowledge base. This should be a QUICK_RESPONSES type + // knowledge base. + // + // This member is required. + KnowledgeBaseId *string + + // The identifier of the quick response. + // + // This member is required. + QuickResponseId *string + + noSmithyDocumentSerde +} + +type GetQuickResponseOutput struct { + + // The quick response. + QuickResponse *types.QuickResponseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetQuickResponseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetQuickResponse{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetQuickResponse{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetQuickResponse"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetQuickResponseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetQuickResponse(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetQuickResponse(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetQuickResponse", + } +} diff --git a/service/qconnect/api_op_GetRecommendations.go b/service/qconnect/api_op_GetRecommendations.go new file mode 100644 index 00000000000..848611c979d --- /dev/null +++ b/service/qconnect/api_op_GetRecommendations.go @@ -0,0 +1,163 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves recommendations for the specified session. To avoid retrieving the +// same recommendations in subsequent calls, use NotifyRecommendationsReceived (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_NotifyRecommendationsReceived.html) +// . This API supports long-polling behavior with the waitTimeSeconds parameter. +// Short poll is the default behavior and only returns recommendations already +// available. To perform a manual query against an assistant, use QueryAssistant (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_QueryAssistant.html) +// . +func (c *Client) GetRecommendations(ctx context.Context, params *GetRecommendationsInput, optFns ...func(*Options)) (*GetRecommendationsOutput, error) { + if params == nil { + params = &GetRecommendationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRecommendations", params, optFns, c.addOperationGetRecommendationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRecommendationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRecommendationsInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The identifier of the session. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + SessionId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The duration (in seconds) for which the call waits for a recommendation to be + // made available before returning. If a recommendation is available, the call + // returns sooner than WaitTimeSeconds . If no messages are available and the wait + // time expires, the call returns successfully with an empty list. + WaitTimeSeconds int32 + + noSmithyDocumentSerde +} + +type GetRecommendationsOutput struct { + + // The recommendations. + // + // This member is required. + Recommendations []types.RecommendationData + + // The triggers corresponding to recommendations. + Triggers []types.RecommendationTrigger + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRecommendationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRecommendations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRecommendations{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetRecommendations"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetRecommendationsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRecommendations(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetRecommendations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetRecommendations", + } +} diff --git a/service/qconnect/api_op_GetSession.go b/service/qconnect/api_op_GetSession.go new file mode 100644 index 00000000000..281db364272 --- /dev/null +++ b/service/qconnect/api_op_GetSession.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information for a specified session. +func (c *Client) GetSession(ctx context.Context, params *GetSessionInput, optFns ...func(*Options)) (*GetSessionOutput, error) { + if params == nil { + params = &GetSessionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetSession", params, optFns, c.addOperationGetSessionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetSessionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetSessionInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The identifier of the session. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + SessionId *string + + noSmithyDocumentSerde +} + +type GetSessionOutput struct { + + // The session. + Session *types.SessionData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetSessionMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSession{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSession{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetSession"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetSessionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSession(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetSession(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetSession", + } +} diff --git a/service/qconnect/api_op_ListAssistantAssociations.go b/service/qconnect/api_op_ListAssistantAssociations.go new file mode 100644 index 00000000000..a0862389290 --- /dev/null +++ b/service/qconnect/api_op_ListAssistantAssociations.go @@ -0,0 +1,242 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists information about assistant associations. +func (c *Client) ListAssistantAssociations(ctx context.Context, params *ListAssistantAssociationsInput, optFns ...func(*Options)) (*ListAssistantAssociationsOutput, error) { + if params == nil { + params = &ListAssistantAssociationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAssistantAssociations", params, optFns, c.addOperationListAssistantAssociationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAssistantAssociationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListAssistantAssociationsInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListAssistantAssociationsOutput struct { + + // Summary information about assistant associations. + // + // This member is required. + AssistantAssociationSummaries []types.AssistantAssociationSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAssistantAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAssistantAssociations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAssistantAssociations{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAssistantAssociations"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListAssistantAssociationsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAssistantAssociations(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAssistantAssociationsAPIClient is a client that implements the +// ListAssistantAssociations operation. +type ListAssistantAssociationsAPIClient interface { + ListAssistantAssociations(context.Context, *ListAssistantAssociationsInput, ...func(*Options)) (*ListAssistantAssociationsOutput, error) +} + +var _ ListAssistantAssociationsAPIClient = (*Client)(nil) + +// ListAssistantAssociationsPaginatorOptions is the paginator options for +// ListAssistantAssociations +type ListAssistantAssociationsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListAssistantAssociationsPaginator is a paginator for ListAssistantAssociations +type ListAssistantAssociationsPaginator struct { + options ListAssistantAssociationsPaginatorOptions + client ListAssistantAssociationsAPIClient + params *ListAssistantAssociationsInput + nextToken *string + firstPage bool +} + +// NewListAssistantAssociationsPaginator returns a new +// ListAssistantAssociationsPaginator +func NewListAssistantAssociationsPaginator(client ListAssistantAssociationsAPIClient, params *ListAssistantAssociationsInput, optFns ...func(*ListAssistantAssociationsPaginatorOptions)) *ListAssistantAssociationsPaginator { + if params == nil { + params = &ListAssistantAssociationsInput{} + } + + options := ListAssistantAssociationsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAssistantAssociationsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAssistantAssociationsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAssistantAssociations page. +func (p *ListAssistantAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAssistantAssociationsOutput, 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.ListAssistantAssociations(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_opListAssistantAssociations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAssistantAssociations", + } +} diff --git a/service/qconnect/api_op_ListAssistants.go b/service/qconnect/api_op_ListAssistants.go new file mode 100644 index 00000000000..4b1aace92d9 --- /dev/null +++ b/service/qconnect/api_op_ListAssistants.go @@ -0,0 +1,231 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists information about assistants. +func (c *Client) ListAssistants(ctx context.Context, params *ListAssistantsInput, optFns ...func(*Options)) (*ListAssistantsOutput, error) { + if params == nil { + params = &ListAssistantsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAssistants", params, optFns, c.addOperationListAssistantsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAssistantsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListAssistantsInput struct { + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListAssistantsOutput struct { + + // Information about the assistants. + // + // This member is required. + AssistantSummaries []types.AssistantSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAssistantsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAssistants{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAssistants{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListAssistants"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAssistants(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListAssistantsAPIClient is a client that implements the ListAssistants +// operation. +type ListAssistantsAPIClient interface { + ListAssistants(context.Context, *ListAssistantsInput, ...func(*Options)) (*ListAssistantsOutput, error) +} + +var _ ListAssistantsAPIClient = (*Client)(nil) + +// ListAssistantsPaginatorOptions is the paginator options for ListAssistants +type ListAssistantsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListAssistantsPaginator is a paginator for ListAssistants +type ListAssistantsPaginator struct { + options ListAssistantsPaginatorOptions + client ListAssistantsAPIClient + params *ListAssistantsInput + nextToken *string + firstPage bool +} + +// NewListAssistantsPaginator returns a new ListAssistantsPaginator +func NewListAssistantsPaginator(client ListAssistantsAPIClient, params *ListAssistantsInput, optFns ...func(*ListAssistantsPaginatorOptions)) *ListAssistantsPaginator { + if params == nil { + params = &ListAssistantsInput{} + } + + options := ListAssistantsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAssistantsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAssistantsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAssistants page. +func (p *ListAssistantsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAssistantsOutput, 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.ListAssistants(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_opListAssistants(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListAssistants", + } +} diff --git a/service/qconnect/api_op_ListContents.go b/service/qconnect/api_op_ListContents.go new file mode 100644 index 00000000000..87c90841902 --- /dev/null +++ b/service/qconnect/api_op_ListContents.go @@ -0,0 +1,240 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the content. +func (c *Client) ListContents(ctx context.Context, params *ListContentsInput, optFns ...func(*Options)) (*ListContentsOutput, error) { + if params == nil { + params = &ListContentsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListContents", params, optFns, c.addOperationListContentsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListContentsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListContentsInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListContentsOutput struct { + + // Information about the content. + // + // This member is required. + ContentSummaries []types.ContentSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListContentsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListContents{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListContents{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListContents"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListContentsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListContents(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListContentsAPIClient is a client that implements the ListContents operation. +type ListContentsAPIClient interface { + ListContents(context.Context, *ListContentsInput, ...func(*Options)) (*ListContentsOutput, error) +} + +var _ ListContentsAPIClient = (*Client)(nil) + +// ListContentsPaginatorOptions is the paginator options for ListContents +type ListContentsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListContentsPaginator is a paginator for ListContents +type ListContentsPaginator struct { + options ListContentsPaginatorOptions + client ListContentsAPIClient + params *ListContentsInput + nextToken *string + firstPage bool +} + +// NewListContentsPaginator returns a new ListContentsPaginator +func NewListContentsPaginator(client ListContentsAPIClient, params *ListContentsInput, optFns ...func(*ListContentsPaginatorOptions)) *ListContentsPaginator { + if params == nil { + params = &ListContentsInput{} + } + + options := ListContentsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListContentsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListContentsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListContents page. +func (p *ListContentsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListContentsOutput, 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.ListContents(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_opListContents(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListContents", + } +} diff --git a/service/qconnect/api_op_ListImportJobs.go b/service/qconnect/api_op_ListImportJobs.go new file mode 100644 index 00000000000..523438e3dd8 --- /dev/null +++ b/service/qconnect/api_op_ListImportJobs.go @@ -0,0 +1,242 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists information about import jobs. +func (c *Client) ListImportJobs(ctx context.Context, params *ListImportJobsInput, optFns ...func(*Options)) (*ListImportJobsOutput, error) { + if params == nil { + params = &ListImportJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListImportJobs", params, optFns, c.addOperationListImportJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListImportJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListImportJobsInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListImportJobsOutput struct { + + // Summary information about the import jobs. + // + // This member is required. + ImportJobSummaries []types.ImportJobSummary + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListImportJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListImportJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListImportJobs{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListImportJobs"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListImportJobsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListImportJobs(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListImportJobsAPIClient is a client that implements the ListImportJobs +// operation. +type ListImportJobsAPIClient interface { + ListImportJobs(context.Context, *ListImportJobsInput, ...func(*Options)) (*ListImportJobsOutput, error) +} + +var _ ListImportJobsAPIClient = (*Client)(nil) + +// ListImportJobsPaginatorOptions is the paginator options for ListImportJobs +type ListImportJobsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListImportJobsPaginator is a paginator for ListImportJobs +type ListImportJobsPaginator struct { + options ListImportJobsPaginatorOptions + client ListImportJobsAPIClient + params *ListImportJobsInput + nextToken *string + firstPage bool +} + +// NewListImportJobsPaginator returns a new ListImportJobsPaginator +func NewListImportJobsPaginator(client ListImportJobsAPIClient, params *ListImportJobsInput, optFns ...func(*ListImportJobsPaginatorOptions)) *ListImportJobsPaginator { + if params == nil { + params = &ListImportJobsInput{} + } + + options := ListImportJobsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListImportJobsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListImportJobsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListImportJobs page. +func (p *ListImportJobsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListImportJobsOutput, 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.ListImportJobs(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_opListImportJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListImportJobs", + } +} diff --git a/service/qconnect/api_op_ListKnowledgeBases.go b/service/qconnect/api_op_ListKnowledgeBases.go new file mode 100644 index 00000000000..2d440279888 --- /dev/null +++ b/service/qconnect/api_op_ListKnowledgeBases.go @@ -0,0 +1,232 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the knowledge bases. +func (c *Client) ListKnowledgeBases(ctx context.Context, params *ListKnowledgeBasesInput, optFns ...func(*Options)) (*ListKnowledgeBasesOutput, error) { + if params == nil { + params = &ListKnowledgeBasesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListKnowledgeBases", params, optFns, c.addOperationListKnowledgeBasesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListKnowledgeBasesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListKnowledgeBasesInput struct { + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListKnowledgeBasesOutput struct { + + // Information about the knowledge bases. + // + // This member is required. + KnowledgeBaseSummaries []types.KnowledgeBaseSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListKnowledgeBasesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListKnowledgeBases{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListKnowledgeBases"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListKnowledgeBases(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListKnowledgeBasesAPIClient is a client that implements the ListKnowledgeBases +// operation. +type ListKnowledgeBasesAPIClient interface { + ListKnowledgeBases(context.Context, *ListKnowledgeBasesInput, ...func(*Options)) (*ListKnowledgeBasesOutput, error) +} + +var _ ListKnowledgeBasesAPIClient = (*Client)(nil) + +// ListKnowledgeBasesPaginatorOptions is the paginator options for +// ListKnowledgeBases +type ListKnowledgeBasesPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListKnowledgeBasesPaginator is a paginator for ListKnowledgeBases +type ListKnowledgeBasesPaginator struct { + options ListKnowledgeBasesPaginatorOptions + client ListKnowledgeBasesAPIClient + params *ListKnowledgeBasesInput + nextToken *string + firstPage bool +} + +// NewListKnowledgeBasesPaginator returns a new ListKnowledgeBasesPaginator +func NewListKnowledgeBasesPaginator(client ListKnowledgeBasesAPIClient, params *ListKnowledgeBasesInput, optFns ...func(*ListKnowledgeBasesPaginatorOptions)) *ListKnowledgeBasesPaginator { + if params == nil { + params = &ListKnowledgeBasesInput{} + } + + options := ListKnowledgeBasesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListKnowledgeBasesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListKnowledgeBasesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListKnowledgeBases page. +func (p *ListKnowledgeBasesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListKnowledgeBasesOutput, 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.ListKnowledgeBases(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_opListKnowledgeBases(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListKnowledgeBases", + } +} diff --git a/service/qconnect/api_op_ListQuickResponses.go b/service/qconnect/api_op_ListQuickResponses.go new file mode 100644 index 00000000000..a0575b54957 --- /dev/null +++ b/service/qconnect/api_op_ListQuickResponses.go @@ -0,0 +1,243 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists information about quick response. +func (c *Client) ListQuickResponses(ctx context.Context, params *ListQuickResponsesInput, optFns ...func(*Options)) (*ListQuickResponsesOutput, error) { + if params == nil { + params = &ListQuickResponsesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListQuickResponses", params, optFns, c.addOperationListQuickResponsesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListQuickResponsesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListQuickResponsesInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type ListQuickResponsesOutput struct { + + // Summary information about the quick responses. + // + // This member is required. + QuickResponseSummaries []types.QuickResponseSummary + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListQuickResponsesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListQuickResponses{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListQuickResponses{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListQuickResponses"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListQuickResponsesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListQuickResponses(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListQuickResponsesAPIClient is a client that implements the ListQuickResponses +// operation. +type ListQuickResponsesAPIClient interface { + ListQuickResponses(context.Context, *ListQuickResponsesInput, ...func(*Options)) (*ListQuickResponsesOutput, error) +} + +var _ ListQuickResponsesAPIClient = (*Client)(nil) + +// ListQuickResponsesPaginatorOptions is the paginator options for +// ListQuickResponses +type ListQuickResponsesPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// ListQuickResponsesPaginator is a paginator for ListQuickResponses +type ListQuickResponsesPaginator struct { + options ListQuickResponsesPaginatorOptions + client ListQuickResponsesAPIClient + params *ListQuickResponsesInput + nextToken *string + firstPage bool +} + +// NewListQuickResponsesPaginator returns a new ListQuickResponsesPaginator +func NewListQuickResponsesPaginator(client ListQuickResponsesAPIClient, params *ListQuickResponsesInput, optFns ...func(*ListQuickResponsesPaginatorOptions)) *ListQuickResponsesPaginator { + if params == nil { + params = &ListQuickResponsesInput{} + } + + options := ListQuickResponsesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListQuickResponsesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListQuickResponsesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListQuickResponses page. +func (p *ListQuickResponsesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListQuickResponsesOutput, 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.ListQuickResponses(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_opListQuickResponses(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListQuickResponses", + } +} diff --git a/service/qconnect/api_op_ListTagsForResource.go b/service/qconnect/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..565259e4c3e --- /dev/null +++ b/service/qconnect/api_op_ListTagsForResource.go @@ -0,0 +1,136 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the tags for the specified resource. +func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { + if params == nil { + params = &ListTagsForResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTagsForResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTagsForResourceInput struct { + + // The Amazon Resource Name (ARN) of the resource. + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // The tags used to organize, track, or control access for this 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListTagsForResource", + } +} diff --git a/service/qconnect/api_op_NotifyRecommendationsReceived.go b/service/qconnect/api_op_NotifyRecommendationsReceived.go new file mode 100644 index 00000000000..f8a18178eb8 --- /dev/null +++ b/service/qconnect/api_op_NotifyRecommendationsReceived.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes the specified recommendations from the specified assistant's queue of +// newly available recommendations. You can use this API in conjunction with +// GetRecommendations (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_GetRecommendations.html) +// and a waitTimeSeconds input for long-polling behavior and avoiding duplicate +// recommendations. +func (c *Client) NotifyRecommendationsReceived(ctx context.Context, params *NotifyRecommendationsReceivedInput, optFns ...func(*Options)) (*NotifyRecommendationsReceivedOutput, error) { + if params == nil { + params = &NotifyRecommendationsReceivedInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "NotifyRecommendationsReceived", params, optFns, c.addOperationNotifyRecommendationsReceivedMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*NotifyRecommendationsReceivedOutput) + out.ResultMetadata = metadata + return out, nil +} + +type NotifyRecommendationsReceivedInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The identifiers of the recommendations. + // + // This member is required. + RecommendationIds []string + + // The identifier of the session. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + SessionId *string + + noSmithyDocumentSerde +} + +type NotifyRecommendationsReceivedOutput struct { + + // The identifiers of recommendations that are causing errors. + Errors []types.NotifyRecommendationsReceivedError + + // The identifiers of the recommendations. + RecommendationIds []string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationNotifyRecommendationsReceivedMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpNotifyRecommendationsReceived{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpNotifyRecommendationsReceived{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "NotifyRecommendationsReceived"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpNotifyRecommendationsReceivedValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opNotifyRecommendationsReceived(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opNotifyRecommendationsReceived(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "NotifyRecommendationsReceived", + } +} diff --git a/service/qconnect/api_op_QueryAssistant.go b/service/qconnect/api_op_QueryAssistant.go new file mode 100644 index 00000000000..858b273286c --- /dev/null +++ b/service/qconnect/api_op_QueryAssistant.go @@ -0,0 +1,254 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Performs a manual search against the specified assistant. To retrieve +// recommendations for an assistant, use GetRecommendations (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_GetRecommendations.html) +// . +func (c *Client) QueryAssistant(ctx context.Context, params *QueryAssistantInput, optFns ...func(*Options)) (*QueryAssistantOutput, error) { + if params == nil { + params = &QueryAssistantInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "QueryAssistant", params, optFns, c.addOperationQueryAssistantMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*QueryAssistantOutput) + out.ResultMetadata = metadata + return out, nil +} + +type QueryAssistantInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The text to search for. + // + // This member is required. + QueryText *string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + // Information about how to query content. + QueryCondition []types.QueryCondition + + // The identifier of the Amazon Q session. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + SessionId *string + + noSmithyDocumentSerde +} + +type QueryAssistantOutput struct { + + // The results of the query. + // + // This member is required. + Results []types.ResultData + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationQueryAssistantMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpQueryAssistant{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpQueryAssistant{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "QueryAssistant"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpQueryAssistantValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opQueryAssistant(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// QueryAssistantAPIClient is a client that implements the QueryAssistant +// operation. +type QueryAssistantAPIClient interface { + QueryAssistant(context.Context, *QueryAssistantInput, ...func(*Options)) (*QueryAssistantOutput, error) +} + +var _ QueryAssistantAPIClient = (*Client)(nil) + +// QueryAssistantPaginatorOptions is the paginator options for QueryAssistant +type QueryAssistantPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// QueryAssistantPaginator is a paginator for QueryAssistant +type QueryAssistantPaginator struct { + options QueryAssistantPaginatorOptions + client QueryAssistantAPIClient + params *QueryAssistantInput + nextToken *string + firstPage bool +} + +// NewQueryAssistantPaginator returns a new QueryAssistantPaginator +func NewQueryAssistantPaginator(client QueryAssistantAPIClient, params *QueryAssistantInput, optFns ...func(*QueryAssistantPaginatorOptions)) *QueryAssistantPaginator { + if params == nil { + params = &QueryAssistantInput{} + } + + options := QueryAssistantPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &QueryAssistantPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *QueryAssistantPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next QueryAssistant page. +func (p *QueryAssistantPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*QueryAssistantOutput, 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.QueryAssistant(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_opQueryAssistant(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "QueryAssistant", + } +} diff --git a/service/qconnect/api_op_RemoveKnowledgeBaseTemplateUri.go b/service/qconnect/api_op_RemoveKnowledgeBaseTemplateUri.go new file mode 100644 index 00000000000..799b5b771f7 --- /dev/null +++ b/service/qconnect/api_op_RemoveKnowledgeBaseTemplateUri.go @@ -0,0 +1,134 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes a URI template from a knowledge base. +func (c *Client) RemoveKnowledgeBaseTemplateUri(ctx context.Context, params *RemoveKnowledgeBaseTemplateUriInput, optFns ...func(*Options)) (*RemoveKnowledgeBaseTemplateUriOutput, error) { + if params == nil { + params = &RemoveKnowledgeBaseTemplateUriInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "RemoveKnowledgeBaseTemplateUri", params, optFns, c.addOperationRemoveKnowledgeBaseTemplateUriMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*RemoveKnowledgeBaseTemplateUriOutput) + out.ResultMetadata = metadata + return out, nil +} + +type RemoveKnowledgeBaseTemplateUriInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +type RemoveKnowledgeBaseTemplateUriOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationRemoveKnowledgeBaseTemplateUriMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpRemoveKnowledgeBaseTemplateUri{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRemoveKnowledgeBaseTemplateUri{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "RemoveKnowledgeBaseTemplateUri"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpRemoveKnowledgeBaseTemplateUriValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRemoveKnowledgeBaseTemplateUri(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opRemoveKnowledgeBaseTemplateUri(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "RemoveKnowledgeBaseTemplateUri", + } +} diff --git a/service/qconnect/api_op_SearchContent.go b/service/qconnect/api_op_SearchContent.go new file mode 100644 index 00000000000..336cc40545e --- /dev/null +++ b/service/qconnect/api_op_SearchContent.go @@ -0,0 +1,246 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Searches for content in a specified knowledge base. Can be used to get a +// specific content resource by its name. +func (c *Client) SearchContent(ctx context.Context, params *SearchContentInput, optFns ...func(*Options)) (*SearchContentOutput, error) { + if params == nil { + params = &SearchContentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SearchContent", params, optFns, c.addOperationSearchContentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SearchContentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SearchContentInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The search expression to filter results. + // + // This member is required. + SearchExpression *types.SearchExpression + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type SearchContentOutput struct { + + // Summary information about the content. + // + // This member is required. + ContentSummaries []types.ContentSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSearchContentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpSearchContent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSearchContent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "SearchContent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpSearchContentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchContent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// SearchContentAPIClient is a client that implements the SearchContent operation. +type SearchContentAPIClient interface { + SearchContent(context.Context, *SearchContentInput, ...func(*Options)) (*SearchContentOutput, error) +} + +var _ SearchContentAPIClient = (*Client)(nil) + +// SearchContentPaginatorOptions is the paginator options for SearchContent +type SearchContentPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// SearchContentPaginator is a paginator for SearchContent +type SearchContentPaginator struct { + options SearchContentPaginatorOptions + client SearchContentAPIClient + params *SearchContentInput + nextToken *string + firstPage bool +} + +// NewSearchContentPaginator returns a new SearchContentPaginator +func NewSearchContentPaginator(client SearchContentAPIClient, params *SearchContentInput, optFns ...func(*SearchContentPaginatorOptions)) *SearchContentPaginator { + if params == nil { + params = &SearchContentInput{} + } + + options := SearchContentPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &SearchContentPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *SearchContentPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next SearchContent page. +func (p *SearchContentPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchContentOutput, 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.SearchContent(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_opSearchContent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "SearchContent", + } +} diff --git a/service/qconnect/api_op_SearchQuickResponses.go b/service/qconnect/api_op_SearchQuickResponses.go new file mode 100644 index 00000000000..8d7f1a7cbf3 --- /dev/null +++ b/service/qconnect/api_op_SearchQuickResponses.go @@ -0,0 +1,251 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Searches existing Amazon Q quick responses in a Amazon Q knowledge base. +func (c *Client) SearchQuickResponses(ctx context.Context, params *SearchQuickResponsesInput, optFns ...func(*Options)) (*SearchQuickResponsesOutput, error) { + if params == nil { + params = &SearchQuickResponsesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SearchQuickResponses", params, optFns, c.addOperationSearchQuickResponsesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SearchQuickResponsesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SearchQuickResponsesInput struct { + + // The identifier of the knowledge base. This should be a QUICK_RESPONSES type + // knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The search expression for querying the quick response. + // + // This member is required. + SearchExpression *types.QuickResponseSearchExpression + + // The user-defined Amazon Connect contact attributes (https://docs.aws.amazon.com/connect/latest/adminguide/connect-attrib-list.html#user-defined-attributes) + // to be resolved when search results are returned. + Attributes map[string]string + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type SearchQuickResponsesOutput struct { + + // The results of the quick response search. + // + // This member is required. + Results []types.QuickResponseSearchResultData + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSearchQuickResponsesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpSearchQuickResponses{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSearchQuickResponses{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "SearchQuickResponses"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpSearchQuickResponsesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchQuickResponses(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// SearchQuickResponsesAPIClient is a client that implements the +// SearchQuickResponses operation. +type SearchQuickResponsesAPIClient interface { + SearchQuickResponses(context.Context, *SearchQuickResponsesInput, ...func(*Options)) (*SearchQuickResponsesOutput, error) +} + +var _ SearchQuickResponsesAPIClient = (*Client)(nil) + +// SearchQuickResponsesPaginatorOptions is the paginator options for +// SearchQuickResponses +type SearchQuickResponsesPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// SearchQuickResponsesPaginator is a paginator for SearchQuickResponses +type SearchQuickResponsesPaginator struct { + options SearchQuickResponsesPaginatorOptions + client SearchQuickResponsesAPIClient + params *SearchQuickResponsesInput + nextToken *string + firstPage bool +} + +// NewSearchQuickResponsesPaginator returns a new SearchQuickResponsesPaginator +func NewSearchQuickResponsesPaginator(client SearchQuickResponsesAPIClient, params *SearchQuickResponsesInput, optFns ...func(*SearchQuickResponsesPaginatorOptions)) *SearchQuickResponsesPaginator { + if params == nil { + params = &SearchQuickResponsesInput{} + } + + options := SearchQuickResponsesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &SearchQuickResponsesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *SearchQuickResponsesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next SearchQuickResponses page. +func (p *SearchQuickResponsesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchQuickResponsesOutput, 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.SearchQuickResponses(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_opSearchQuickResponses(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "SearchQuickResponses", + } +} diff --git a/service/qconnect/api_op_SearchSessions.go b/service/qconnect/api_op_SearchSessions.go new file mode 100644 index 00000000000..f648ef7009b --- /dev/null +++ b/service/qconnect/api_op_SearchSessions.go @@ -0,0 +1,245 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Searches for sessions. +func (c *Client) SearchSessions(ctx context.Context, params *SearchSessionsInput, optFns ...func(*Options)) (*SearchSessionsOutput, error) { + if params == nil { + params = &SearchSessionsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SearchSessions", params, optFns, c.addOperationSearchSessionsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SearchSessionsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SearchSessionsInput struct { + + // The identifier of the Amazon Q assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The search expression to filter results. + // + // This member is required. + SearchExpression *types.SearchExpression + + // The maximum number of results to return per page. + MaxResults *int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type SearchSessionsOutput struct { + + // Summary information about the sessions. + // + // This member is required. + SessionSummaries []types.SessionSummary + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSearchSessionsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpSearchSessions{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSearchSessions{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "SearchSessions"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpSearchSessionsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchSessions(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// SearchSessionsAPIClient is a client that implements the SearchSessions +// operation. +type SearchSessionsAPIClient interface { + SearchSessions(context.Context, *SearchSessionsInput, ...func(*Options)) (*SearchSessionsOutput, error) +} + +var _ SearchSessionsAPIClient = (*Client)(nil) + +// SearchSessionsPaginatorOptions is the paginator options for SearchSessions +type SearchSessionsPaginatorOptions struct { + // The maximum number of results to return per page. + 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 +} + +// SearchSessionsPaginator is a paginator for SearchSessions +type SearchSessionsPaginator struct { + options SearchSessionsPaginatorOptions + client SearchSessionsAPIClient + params *SearchSessionsInput + nextToken *string + firstPage bool +} + +// NewSearchSessionsPaginator returns a new SearchSessionsPaginator +func NewSearchSessionsPaginator(client SearchSessionsAPIClient, params *SearchSessionsInput, optFns ...func(*SearchSessionsPaginatorOptions)) *SearchSessionsPaginator { + if params == nil { + params = &SearchSessionsInput{} + } + + options := SearchSessionsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &SearchSessionsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *SearchSessionsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next SearchSessions page. +func (p *SearchSessionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchSessionsOutput, 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.SearchSessions(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_opSearchSessions(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "SearchSessions", + } +} diff --git a/service/qconnect/api_op_StartContentUpload.go b/service/qconnect/api_op_StartContentUpload.go new file mode 100644 index 00000000000..3694ebadb7b --- /dev/null +++ b/service/qconnect/api_op_StartContentUpload.go @@ -0,0 +1,170 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Get a URL to upload content to a knowledge base. To upload content, first make +// a PUT request to the returned URL with your file, making sure to include the +// required headers. Then use CreateContent (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_CreateContent.html) +// to finalize the content creation process or UpdateContent (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_UpdateContent.html) +// to modify an existing resource. You can only upload content to a knowledge base +// of type CUSTOM. +func (c *Client) StartContentUpload(ctx context.Context, params *StartContentUploadInput, optFns ...func(*Options)) (*StartContentUploadOutput, error) { + if params == nil { + params = &StartContentUploadInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartContentUpload", params, optFns, c.addOperationStartContentUploadMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartContentUploadOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartContentUploadInput struct { + + // The type of content to upload. + // + // This member is required. + ContentType *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The expected expiration time of the generated presigned URL, specified in + // minutes. + PresignedUrlTimeToLive *int32 + + noSmithyDocumentSerde +} + +type StartContentUploadOutput struct { + + // The headers to include in the upload. + // + // This member is required. + HeadersToInclude map[string]string + + // The identifier of the upload. + // + // This member is required. + UploadId *string + + // The URL of the upload. + // + // This member is required. + Url *string + + // The expiration time of the URL as an epoch timestamp. + // + // This member is required. + UrlExpiry *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartContentUploadMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartContentUpload{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartContentUpload{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartContentUpload"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpStartContentUploadValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartContentUpload(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartContentUpload(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartContentUpload", + } +} diff --git a/service/qconnect/api_op_StartImportJob.go b/service/qconnect/api_op_StartImportJob.go new file mode 100644 index 00000000000..7151f95d031 --- /dev/null +++ b/service/qconnect/api_op_StartImportJob.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Start an asynchronous job to import Amazon Q resources from an uploaded source +// file. Before calling this API, use StartContentUpload (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html) +// to upload an asset that contains the resource data. +// - For importing Amazon Q quick responses, you need to upload a csv file +// including the quick responses. For information about how to format the csv file +// for importing quick responses, see Import quick responses (https://docs.aws.amazon.com/console/connect/quick-responses/add-data) +// . +func (c *Client) StartImportJob(ctx context.Context, params *StartImportJobInput, optFns ...func(*Options)) (*StartImportJobOutput, error) { + if params == nil { + params = &StartImportJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartImportJob", params, optFns, c.addOperationStartImportJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartImportJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartImportJobInput struct { + + // The type of the import job. + // - For importing quick response resource, set the value to QUICK_RESPONSES . + // + // This member is required. + ImportJobType types.ImportJobType + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // - For importing Amazon Q quick responses, this should be a QUICK_RESPONSES + // type knowledge base. + // + // This member is required. + KnowledgeBaseId *string + + // A pointer to the uploaded asset. This value is returned by StartContentUpload (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html) + // . + // + // This member is required. + UploadId *string + + // The tags used to organize, track, or control access for this resource. + ClientToken *string + + // The configuration information of the external source that the resource data are + // imported from. + ExternalSourceConfiguration *types.ExternalSourceConfiguration + + // The metadata fields of the imported Amazon Q resources. + Metadata map[string]string + + noSmithyDocumentSerde +} + +type StartImportJobOutput struct { + + // The import job. + ImportJob *types.ImportJobData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartImportJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartImportJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartImportJob{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartImportJob"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opStartImportJobMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartImportJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartImportJob(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpStartImportJob struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpStartImportJob) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpStartImportJob) 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.(*StartImportJobInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *StartImportJobInput ") + } + + 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_opStartImportJobMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpStartImportJob{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opStartImportJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartImportJob", + } +} diff --git a/service/qconnect/api_op_TagResource.go b/service/qconnect/api_op_TagResource.go new file mode 100644 index 00000000000..5fa1e2413af --- /dev/null +++ b/service/qconnect/api_op_TagResource.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds the specified tags to the specified resource. +func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { + if params == nil { + params = &TagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*TagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type TagResourceInput struct { + + // The Amazon Resource Name (ARN) of the resource. + // + // This member is required. + ResourceArn *string + + // The tags used to organize, track, or control access for this resource. + // + // This member is required. + Tags map[string]string + + noSmithyDocumentSerde +} + +type TagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "TagResource", + } +} diff --git a/service/qconnect/api_op_UntagResource.go b/service/qconnect/api_op_UntagResource.go new file mode 100644 index 00000000000..64d27e285b3 --- /dev/null +++ b/service/qconnect/api_op_UntagResource.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes the specified tags from the specified resource. +func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { + if params == nil { + params = &UntagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UntagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UntagResourceInput struct { + + // The Amazon Resource Name (ARN) of the resource. + // + // This member is required. + ResourceArn *string + + // The tag keys. + // + // 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) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + 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 := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UntagResource", + } +} diff --git a/service/qconnect/api_op_UpdateContent.go b/service/qconnect/api_op_UpdateContent.go new file mode 100644 index 00000000000..858f9e44cde --- /dev/null +++ b/service/qconnect/api_op_UpdateContent.go @@ -0,0 +1,174 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates information about the content. +func (c *Client) UpdateContent(ctx context.Context, params *UpdateContentInput, optFns ...func(*Options)) (*UpdateContentOutput, error) { + if params == nil { + params = &UpdateContentInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateContent", params, optFns, c.addOperationUpdateContentMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateContentOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateContentInput struct { + + // The identifier of the content. Can be either the ID or the ARN. URLs cannot + // contain the ARN. + // + // This member is required. + ContentId *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN + // + // This member is required. + KnowledgeBaseId *string + + // A key/value map to store attributes without affecting tagging or + // recommendations. For example, when synchronizing data between an external system + // and Amazon Q, you can store an external version identifier as metadata to + // utilize for determining drift. + Metadata map[string]string + + // The URI for the article. If the knowledge base has a templateUri, setting this + // argument overrides it for this piece of content. To remove an existing + // overrideLinkOurUri , exclude this argument and set removeOverrideLinkOutUri to + // true. + OverrideLinkOutUri *string + + // Unset the existing overrideLinkOutUri if it exists. + RemoveOverrideLinkOutUri *bool + + // The revisionId of the content resource to update, taken from an earlier call to + // GetContent , GetContentSummary , SearchContent , or ListContents . If included, + // this argument acts as an optimistic lock to ensure content was not modified + // since it was last read. If it has been modified, this API throws a + // PreconditionFailedException . + RevisionId *string + + // The title of the content. + Title *string + + // A pointer to the uploaded asset. This value is returned by StartContentUpload (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_StartContentUpload.html) + // . + UploadId *string + + noSmithyDocumentSerde +} + +type UpdateContentOutput struct { + + // The content. + Content *types.ContentData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateContentMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateContent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateContent{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateContent"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateContentValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateContent(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateContent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateContent", + } +} diff --git a/service/qconnect/api_op_UpdateKnowledgeBaseTemplateUri.go b/service/qconnect/api_op_UpdateKnowledgeBaseTemplateUri.go new file mode 100644 index 00000000000..5f1e81ab3b2 --- /dev/null +++ b/service/qconnect/api_op_UpdateKnowledgeBaseTemplateUri.go @@ -0,0 +1,150 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates the template URI of a knowledge base. This is only supported for +// knowledge bases of type EXTERNAL. Include a single variable in ${variable} +// format; this interpolated by Amazon Q using ingested content. For example, if +// you ingest a Salesforce article, it has an Id value, and you can set the +// template URI to +// https://myInstanceName.lightning.force.com/lightning/r/Knowledge__kav/*${Id}*/view +// . +func (c *Client) UpdateKnowledgeBaseTemplateUri(ctx context.Context, params *UpdateKnowledgeBaseTemplateUriInput, optFns ...func(*Options)) (*UpdateKnowledgeBaseTemplateUriOutput, error) { + if params == nil { + params = &UpdateKnowledgeBaseTemplateUriInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateKnowledgeBaseTemplateUri", params, optFns, c.addOperationUpdateKnowledgeBaseTemplateUriMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateKnowledgeBaseTemplateUriOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateKnowledgeBaseTemplateUriInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The template URI to update. + // + // This member is required. + TemplateUri *string + + noSmithyDocumentSerde +} + +type UpdateKnowledgeBaseTemplateUriOutput struct { + + // The knowledge base to update. + KnowledgeBase *types.KnowledgeBaseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateKnowledgeBaseTemplateUriMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateKnowledgeBaseTemplateUri{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateKnowledgeBaseTemplateUri{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateKnowledgeBaseTemplateUri"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateKnowledgeBaseTemplateUriValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateKnowledgeBaseTemplateUri(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateKnowledgeBaseTemplateUri(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateKnowledgeBaseTemplateUri", + } +} diff --git a/service/qconnect/api_op_UpdateQuickResponse.go b/service/qconnect/api_op_UpdateQuickResponse.go new file mode 100644 index 00000000000..d2eed1d0a43 --- /dev/null +++ b/service/qconnect/api_op_UpdateQuickResponse.go @@ -0,0 +1,188 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates an existing Amazon Q quick response. +func (c *Client) UpdateQuickResponse(ctx context.Context, params *UpdateQuickResponseInput, optFns ...func(*Options)) (*UpdateQuickResponseOutput, error) { + if params == nil { + params = &UpdateQuickResponseInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateQuickResponse", params, optFns, c.addOperationUpdateQuickResponseMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateQuickResponseOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateQuickResponseInput struct { + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The identifier of the quick response. + // + // This member is required. + QuickResponseId *string + + // The Amazon Connect contact channels this quick response applies to. The + // supported contact channel types include Chat . + Channels []string + + // The updated content of the quick response. + Content types.QuickResponseDataProvider + + // The media type of the quick response content. + // - Use application/x.quickresponse;format=plain for quick response written in + // plain text. + // - Use application/x.quickresponse;format=markdown for quick response written + // in richtext. + ContentType *string + + // The updated description of the quick response. + Description *string + + // The updated grouping configuration of the quick response. + GroupingConfiguration *types.GroupingConfiguration + + // Whether the quick response is active. + IsActive *bool + + // The language code value for the language in which the quick response is + // written. The supported language codes include de_DE , en_US , es_ES , fr_FR , + // id_ID , it_IT , ja_JP , ko_KR , pt_BR , zh_CN , zh_TW + Language *string + + // The name of the quick response. + Name *string + + // Whether to remove the description from the quick response. + RemoveDescription *bool + + // Whether to remove the grouping configuration of the quick response. + RemoveGroupingConfiguration *bool + + // Whether to remove the shortcut key of the quick response. + RemoveShortcutKey *bool + + // The shortcut key of the quick response. The value should be unique across the + // knowledge base. + ShortcutKey *string + + noSmithyDocumentSerde +} + +type UpdateQuickResponseOutput struct { + + // The quick response. + QuickResponse *types.QuickResponseData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateQuickResponseMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateQuickResponse{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateQuickResponse{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateQuickResponse"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", 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 = 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateQuickResponseValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateQuickResponse(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 = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateQuickResponse(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "UpdateQuickResponse", + } +} diff --git a/service/qconnect/auth.go b/service/qconnect/auth.go new file mode 100644 index 00000000000..fe5481cf3b1 --- /dev/null +++ b/service/qconnect/auth.go @@ -0,0 +1,256 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +func bindAuthParamsRegion(params *AuthResolverParameters, _ interface{}, options Options) { + params.Region = options.Region +} + +type setLegacyContextSigningOptionsMiddleware struct { +} + +func (*setLegacyContextSigningOptionsMiddleware) ID() string { + return "setLegacyContextSigningOptions" +} + +func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + schemeID := rscheme.Scheme.SchemeID() + + if sn := awsmiddleware.GetSigningName(ctx); sn != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) + } + } + + if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) + } + } + + return next.HandleFinalize(ctx, in) +} + +func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { + return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) +} + +// AuthResolverParameters contains the set of inputs necessary for auth scheme +// resolution. +type AuthResolverParameters struct { + // The name of the operation being invoked. + Operation string + + // The region in which the operation is being invoked. + Region string +} + +func bindAuthResolverParams(operation string, input interface{}, options Options) *AuthResolverParameters { + params := &AuthResolverParameters{ + Operation: operation, + } + + bindAuthParamsRegion(params, input, options) + + return params +} + +// AuthSchemeResolver returns a set of possible authentication options for an +// operation. +type AuthSchemeResolver interface { + ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) +} + +type defaultAuthSchemeResolver struct{} + +var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) + +func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + if overrides, ok := operationAuthOptions[params.Operation]; ok { + return overrides(params), nil + } + return serviceAuthOptions(params), nil +} + +var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} + +func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { + return []*smithyauth.Option{ + { + SchemeID: smithyauth.SchemeIDSigV4, + SignerProperties: func() smithy.Properties { + var props smithy.Properties + smithyhttp.SetSigV4SigningName(&props, "wisdom") + smithyhttp.SetSigV4SigningRegion(&props, params.Region) + return props + }(), + }, + } +} + +type resolveAuthSchemeMiddleware struct { + operation string + options Options +} + +func (*resolveAuthSchemeMiddleware) ID() string { + return "ResolveAuthScheme" +} + +func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + params := bindAuthResolverParams(m.operation, getOperationInput(ctx), m.options) + options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("resolve auth scheme: %v", err) + } + + scheme, ok := m.selectScheme(options) + if !ok { + return out, metadata, fmt.Errorf("could not select an auth scheme") + } + + ctx = setResolvedAuthScheme(ctx, scheme) + return next.HandleFinalize(ctx, in) +} + +func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { + for _, option := range options { + if option.SchemeID == smithyauth.SchemeIDAnonymous { + return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true + } + + for _, scheme := range m.options.AuthSchemes { + if scheme.SchemeID() != option.SchemeID { + continue + } + + if scheme.IdentityResolver(m.options) != nil { + return newResolvedAuthScheme(scheme, option), true + } + } + } + + return nil, false +} + +type resolvedAuthSchemeKey struct{} + +type resolvedAuthScheme struct { + Scheme smithyhttp.AuthScheme + IdentityProperties smithy.Properties + SignerProperties smithy.Properties +} + +func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { + return &resolvedAuthScheme{ + Scheme: scheme, + IdentityProperties: option.IdentityProperties, + SignerProperties: option.SignerProperties, + } +} + +func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { + return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) +} + +func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { + v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) + return v +} + +type getIdentityMiddleware struct { + options Options +} + +func (*getIdentityMiddleware) ID() string { + return "GetIdentity" +} + +func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + resolver := rscheme.Scheme.IdentityResolver(m.options) + if resolver == nil { + return out, metadata, fmt.Errorf("no identity resolver") + } + + identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties) + if err != nil { + return out, metadata, fmt.Errorf("get identity: %v", err) + } + + ctx = setIdentity(ctx, identity) + return next.HandleFinalize(ctx, in) +} + +type identityKey struct{} + +func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { + return middleware.WithStackValue(ctx, identityKey{}, identity) +} + +func getIdentity(ctx context.Context) smithyauth.Identity { + v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) + return v +} + +type signRequestMiddleware struct { +} + +func (*signRequestMiddleware) ID() string { + return "Signing" +} + +func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + identity := getIdentity(ctx) + if identity == nil { + return out, metadata, fmt.Errorf("no identity") + } + + signer := rscheme.Scheme.Signer() + if signer == nil { + return out, metadata, fmt.Errorf("no signer") + } + + if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil { + return out, metadata, fmt.Errorf("sign request: %v", err) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/qconnect/deserializers.go b/service/qconnect/deserializers.go new file mode 100644 index 00000000000..20eb6b941b1 --- /dev/null +++ b/service/qconnect/deserializers.go @@ -0,0 +1,10841 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/qconnect/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" + "math" + "strings" +) + +type awsRestjson1_deserializeOpCreateAssistant struct { +} + +func (*awsRestjson1_deserializeOpCreateAssistant) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAssistant) 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_deserializeOpErrorCreateAssistant(response, &metadata) + } + output := &CreateAssistantOutput{} + 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_deserializeOpDocumentCreateAssistantOutput(&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_deserializeOpErrorCreateAssistant(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("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateAssistantOutput(v **CreateAssistantOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAssistantOutput + if *v == nil { + sv = &CreateAssistantOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistant": + if err := awsRestjson1_deserializeDocumentAssistantData(&sv.Assistant, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateAssistantAssociation struct { +} + +func (*awsRestjson1_deserializeOpCreateAssistantAssociation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAssistantAssociation) 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_deserializeOpErrorCreateAssistantAssociation(response, &metadata) + } + output := &CreateAssistantAssociationOutput{} + 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_deserializeOpDocumentCreateAssistantAssociationOutput(&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_deserializeOpErrorCreateAssistantAssociation(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateAssistantAssociationOutput(v **CreateAssistantAssociationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAssistantAssociationOutput + if *v == nil { + sv = &CreateAssistantAssociationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantAssociation": + if err := awsRestjson1_deserializeDocumentAssistantAssociationData(&sv.AssistantAssociation, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateContent struct { +} + +func (*awsRestjson1_deserializeOpCreateContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateContent) 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_deserializeOpErrorCreateContent(response, &metadata) + } + output := &CreateContentOutput{} + 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_deserializeOpDocumentCreateContentOutput(&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_deserializeOpErrorCreateContent(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateContentOutput(v **CreateContentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateContentOutput + if *v == nil { + sv = &CreateContentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentContentData(&sv.Content, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpCreateKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateKnowledgeBase) 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_deserializeOpErrorCreateKnowledgeBase(response, &metadata) + } + output := &CreateKnowledgeBaseOutput{} + 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_deserializeOpDocumentCreateKnowledgeBaseOutput(&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_deserializeOpErrorCreateKnowledgeBase(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("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateKnowledgeBaseOutput(v **CreateKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateKnowledgeBaseOutput + if *v == nil { + sv = &CreateKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseData(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateQuickResponse struct { +} + +func (*awsRestjson1_deserializeOpCreateQuickResponse) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateQuickResponse) 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_deserializeOpErrorCreateQuickResponse(response, &metadata) + } + output := &CreateQuickResponseOutput{} + 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_deserializeOpDocumentCreateQuickResponseOutput(&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_deserializeOpErrorCreateQuickResponse(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateQuickResponseOutput(v **CreateQuickResponseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateQuickResponseOutput + if *v == nil { + sv = &CreateQuickResponseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "quickResponse": + if err := awsRestjson1_deserializeDocumentQuickResponseData(&sv.QuickResponse, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateSession struct { +} + +func (*awsRestjson1_deserializeOpCreateSession) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateSession) 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_deserializeOpErrorCreateSession(response, &metadata) + } + output := &CreateSessionOutput{} + 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_deserializeOpDocumentCreateSessionOutput(&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_deserializeOpErrorCreateSession(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateSessionOutput(v **CreateSessionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateSessionOutput + if *v == nil { + sv = &CreateSessionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "session": + if err := awsRestjson1_deserializeDocumentSessionData(&sv.Session, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteAssistant struct { +} + +func (*awsRestjson1_deserializeOpDeleteAssistant) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAssistant) 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_deserializeOpErrorDeleteAssistant(response, &metadata) + } + output := &DeleteAssistantOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteAssistant(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteAssistantAssociation struct { +} + +func (*awsRestjson1_deserializeOpDeleteAssistantAssociation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteAssistantAssociation) 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_deserializeOpErrorDeleteAssistantAssociation(response, &metadata) + } + output := &DeleteAssistantAssociationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteAssistantAssociation(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteContent struct { +} + +func (*awsRestjson1_deserializeOpDeleteContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteContent) 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_deserializeOpErrorDeleteContent(response, &metadata) + } + output := &DeleteContentOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteContent(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteImportJob struct { +} + +func (*awsRestjson1_deserializeOpDeleteImportJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteImportJob) 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_deserializeOpErrorDeleteImportJob(response, &metadata) + } + output := &DeleteImportJobOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteImportJob(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpDeleteKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteKnowledgeBase) 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_deserializeOpErrorDeleteKnowledgeBase(response, &metadata) + } + output := &DeleteKnowledgeBaseOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteKnowledgeBase(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteQuickResponse struct { +} + +func (*awsRestjson1_deserializeOpDeleteQuickResponse) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteQuickResponse) 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_deserializeOpErrorDeleteQuickResponse(response, &metadata) + } + output := &DeleteQuickResponseOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteQuickResponse(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpGetAssistant struct { +} + +func (*awsRestjson1_deserializeOpGetAssistant) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAssistant) 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_deserializeOpErrorGetAssistant(response, &metadata) + } + output := &GetAssistantOutput{} + 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_deserializeOpDocumentGetAssistantOutput(&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_deserializeOpErrorGetAssistant(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetAssistantOutput(v **GetAssistantOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAssistantOutput + if *v == nil { + sv = &GetAssistantOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistant": + if err := awsRestjson1_deserializeDocumentAssistantData(&sv.Assistant, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetAssistantAssociation struct { +} + +func (*awsRestjson1_deserializeOpGetAssistantAssociation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAssistantAssociation) 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_deserializeOpErrorGetAssistantAssociation(response, &metadata) + } + output := &GetAssistantAssociationOutput{} + 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_deserializeOpDocumentGetAssistantAssociationOutput(&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_deserializeOpErrorGetAssistantAssociation(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetAssistantAssociationOutput(v **GetAssistantAssociationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetAssistantAssociationOutput + if *v == nil { + sv = &GetAssistantAssociationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantAssociation": + if err := awsRestjson1_deserializeDocumentAssistantAssociationData(&sv.AssistantAssociation, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetContent struct { +} + +func (*awsRestjson1_deserializeOpGetContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetContent) 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_deserializeOpErrorGetContent(response, &metadata) + } + output := &GetContentOutput{} + 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_deserializeOpDocumentGetContentOutput(&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_deserializeOpErrorGetContent(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetContentOutput(v **GetContentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetContentOutput + if *v == nil { + sv = &GetContentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentContentData(&sv.Content, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetContentSummary struct { +} + +func (*awsRestjson1_deserializeOpGetContentSummary) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetContentSummary) 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_deserializeOpErrorGetContentSummary(response, &metadata) + } + output := &GetContentSummaryOutput{} + 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_deserializeOpDocumentGetContentSummaryOutput(&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_deserializeOpErrorGetContentSummary(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetContentSummaryOutput(v **GetContentSummaryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetContentSummaryOutput + if *v == nil { + sv = &GetContentSummaryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentSummary": + if err := awsRestjson1_deserializeDocumentContentSummary(&sv.ContentSummary, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetImportJob struct { +} + +func (*awsRestjson1_deserializeOpGetImportJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetImportJob) 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_deserializeOpErrorGetImportJob(response, &metadata) + } + output := &GetImportJobOutput{} + 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_deserializeOpDocumentGetImportJobOutput(&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_deserializeOpErrorGetImportJob(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetImportJobOutput(v **GetImportJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetImportJobOutput + if *v == nil { + sv = &GetImportJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "importJob": + if err := awsRestjson1_deserializeDocumentImportJobData(&sv.ImportJob, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetKnowledgeBase struct { +} + +func (*awsRestjson1_deserializeOpGetKnowledgeBase) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetKnowledgeBase) 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_deserializeOpErrorGetKnowledgeBase(response, &metadata) + } + output := &GetKnowledgeBaseOutput{} + 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_deserializeOpDocumentGetKnowledgeBaseOutput(&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_deserializeOpErrorGetKnowledgeBase(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetKnowledgeBaseOutput(v **GetKnowledgeBaseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetKnowledgeBaseOutput + if *v == nil { + sv = &GetKnowledgeBaseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseData(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetQuickResponse struct { +} + +func (*awsRestjson1_deserializeOpGetQuickResponse) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetQuickResponse) 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_deserializeOpErrorGetQuickResponse(response, &metadata) + } + output := &GetQuickResponseOutput{} + 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_deserializeOpDocumentGetQuickResponseOutput(&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_deserializeOpErrorGetQuickResponse(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetQuickResponseOutput(v **GetQuickResponseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetQuickResponseOutput + if *v == nil { + sv = &GetQuickResponseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "quickResponse": + if err := awsRestjson1_deserializeDocumentQuickResponseData(&sv.QuickResponse, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetRecommendations struct { +} + +func (*awsRestjson1_deserializeOpGetRecommendations) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetRecommendations) 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_deserializeOpErrorGetRecommendations(response, &metadata) + } + output := &GetRecommendationsOutput{} + 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_deserializeOpDocumentGetRecommendationsOutput(&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_deserializeOpErrorGetRecommendations(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetRecommendationsOutput(v **GetRecommendationsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetRecommendationsOutput + if *v == nil { + sv = &GetRecommendationsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "recommendations": + if err := awsRestjson1_deserializeDocumentRecommendationList(&sv.Recommendations, value); err != nil { + return err + } + + case "triggers": + if err := awsRestjson1_deserializeDocumentRecommendationTriggerList(&sv.Triggers, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetSession struct { +} + +func (*awsRestjson1_deserializeOpGetSession) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetSession) 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_deserializeOpErrorGetSession(response, &metadata) + } + output := &GetSessionOutput{} + 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_deserializeOpDocumentGetSessionOutput(&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_deserializeOpErrorGetSession(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetSessionOutput(v **GetSessionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetSessionOutput + if *v == nil { + sv = &GetSessionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "session": + if err := awsRestjson1_deserializeDocumentSessionData(&sv.Session, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListAssistantAssociations struct { +} + +func (*awsRestjson1_deserializeOpListAssistantAssociations) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAssistantAssociations) 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_deserializeOpErrorListAssistantAssociations(response, &metadata) + } + output := &ListAssistantAssociationsOutput{} + 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_deserializeOpDocumentListAssistantAssociationsOutput(&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_deserializeOpErrorListAssistantAssociations(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListAssistantAssociationsOutput(v **ListAssistantAssociationsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAssistantAssociationsOutput + if *v == nil { + sv = &ListAssistantAssociationsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantAssociationSummaries": + if err := awsRestjson1_deserializeDocumentAssistantAssociationSummaryList(&sv.AssistantAssociationSummaries, 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_deserializeOpListAssistants struct { +} + +func (*awsRestjson1_deserializeOpListAssistants) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAssistants) 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_deserializeOpErrorListAssistants(response, &metadata) + } + output := &ListAssistantsOutput{} + 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_deserializeOpDocumentListAssistantsOutput(&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_deserializeOpErrorListAssistants(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListAssistantsOutput(v **ListAssistantsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListAssistantsOutput + if *v == nil { + sv = &ListAssistantsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantSummaries": + if err := awsRestjson1_deserializeDocumentAssistantList(&sv.AssistantSummaries, 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_deserializeOpListContents struct { +} + +func (*awsRestjson1_deserializeOpListContents) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListContents) 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_deserializeOpErrorListContents(response, &metadata) + } + output := &ListContentsOutput{} + 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_deserializeOpDocumentListContentsOutput(&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_deserializeOpErrorListContents(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListContentsOutput(v **ListContentsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListContentsOutput + if *v == nil { + sv = &ListContentsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentSummaries": + if err := awsRestjson1_deserializeDocumentContentSummaryList(&sv.ContentSummaries, 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_deserializeOpListImportJobs struct { +} + +func (*awsRestjson1_deserializeOpListImportJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListImportJobs) 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_deserializeOpErrorListImportJobs(response, &metadata) + } + output := &ListImportJobsOutput{} + 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_deserializeOpDocumentListImportJobsOutput(&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_deserializeOpErrorListImportJobs(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListImportJobsOutput(v **ListImportJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListImportJobsOutput + if *v == nil { + sv = &ListImportJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "importJobSummaries": + if err := awsRestjson1_deserializeDocumentImportJobList(&sv.ImportJobSummaries, value); err != nil { + return err + } + + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListKnowledgeBases struct { +} + +func (*awsRestjson1_deserializeOpListKnowledgeBases) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListKnowledgeBases) 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_deserializeOpErrorListKnowledgeBases(response, &metadata) + } + output := &ListKnowledgeBasesOutput{} + 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_deserializeOpDocumentListKnowledgeBasesOutput(&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_deserializeOpErrorListKnowledgeBases(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListKnowledgeBasesOutput(v **ListKnowledgeBasesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListKnowledgeBasesOutput + if *v == nil { + sv = &ListKnowledgeBasesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBaseSummaries": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseList(&sv.KnowledgeBaseSummaries, value); err != nil { + return err + } + + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListQuickResponses struct { +} + +func (*awsRestjson1_deserializeOpListQuickResponses) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListQuickResponses) 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_deserializeOpErrorListQuickResponses(response, &metadata) + } + output := &ListQuickResponsesOutput{} + 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_deserializeOpDocumentListQuickResponsesOutput(&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_deserializeOpErrorListQuickResponses(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListQuickResponsesOutput(v **ListQuickResponsesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListQuickResponsesOutput + if *v == nil { + sv = &ListQuickResponsesOutput{} + } 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 NonEmptyString to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "quickResponseSummaries": + if err := awsRestjson1_deserializeDocumentQuickResponseSummaryList(&sv.QuickResponseSummaries, 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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(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_deserializeOpNotifyRecommendationsReceived struct { +} + +func (*awsRestjson1_deserializeOpNotifyRecommendationsReceived) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpNotifyRecommendationsReceived) 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_deserializeOpErrorNotifyRecommendationsReceived(response, &metadata) + } + output := &NotifyRecommendationsReceivedOutput{} + 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_deserializeOpDocumentNotifyRecommendationsReceivedOutput(&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_deserializeOpErrorNotifyRecommendationsReceived(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentNotifyRecommendationsReceivedOutput(v **NotifyRecommendationsReceivedOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *NotifyRecommendationsReceivedOutput + if *v == nil { + sv = &NotifyRecommendationsReceivedOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "errors": + if err := awsRestjson1_deserializeDocumentNotifyRecommendationsReceivedErrorList(&sv.Errors, value); err != nil { + return err + } + + case "recommendationIds": + if err := awsRestjson1_deserializeDocumentRecommendationIdList(&sv.RecommendationIds, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpQueryAssistant struct { +} + +func (*awsRestjson1_deserializeOpQueryAssistant) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpQueryAssistant) 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_deserializeOpErrorQueryAssistant(response, &metadata) + } + output := &QueryAssistantOutput{} + 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_deserializeOpDocumentQueryAssistantOutput(&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_deserializeOpErrorQueryAssistant(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("RequestTimeoutException", errorCode): + return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentQueryAssistantOutput(v **QueryAssistantOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *QueryAssistantOutput + if *v == nil { + sv = &QueryAssistantOutput{} + } 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 "results": + if err := awsRestjson1_deserializeDocumentQueryResultsList(&sv.Results, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpRemoveKnowledgeBaseTemplateUri struct { +} + +func (*awsRestjson1_deserializeOpRemoveKnowledgeBaseTemplateUri) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpRemoveKnowledgeBaseTemplateUri) 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_deserializeOpErrorRemoveKnowledgeBaseTemplateUri(response, &metadata) + } + output := &RemoveKnowledgeBaseTemplateUriOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorRemoveKnowledgeBaseTemplateUri(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpSearchContent struct { +} + +func (*awsRestjson1_deserializeOpSearchContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSearchContent) 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_deserializeOpErrorSearchContent(response, &metadata) + } + output := &SearchContentOutput{} + 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_deserializeOpDocumentSearchContentOutput(&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_deserializeOpErrorSearchContent(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentSearchContentOutput(v **SearchContentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SearchContentOutput + if *v == nil { + sv = &SearchContentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentSummaries": + if err := awsRestjson1_deserializeDocumentContentSummaryList(&sv.ContentSummaries, 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_deserializeOpSearchQuickResponses struct { +} + +func (*awsRestjson1_deserializeOpSearchQuickResponses) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSearchQuickResponses) 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_deserializeOpErrorSearchQuickResponses(response, &metadata) + } + output := &SearchQuickResponsesOutput{} + 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_deserializeOpDocumentSearchQuickResponsesOutput(&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_deserializeOpErrorSearchQuickResponses(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("RequestTimeoutException", errorCode): + return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentSearchQuickResponsesOutput(v **SearchQuickResponsesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SearchQuickResponsesOutput + if *v == nil { + sv = &SearchQuickResponsesOutput{} + } 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 NonEmptyString to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "results": + if err := awsRestjson1_deserializeDocumentQuickResponseSearchResultsList(&sv.Results, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpSearchSessions struct { +} + +func (*awsRestjson1_deserializeOpSearchSessions) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSearchSessions) 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_deserializeOpErrorSearchSessions(response, &metadata) + } + output := &SearchSessionsOutput{} + 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_deserializeOpDocumentSearchSessionsOutput(&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_deserializeOpErrorSearchSessions(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentSearchSessionsOutput(v **SearchSessionsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SearchSessionsOutput + if *v == nil { + sv = &SearchSessionsOutput{} + } 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 "sessionSummaries": + if err := awsRestjson1_deserializeDocumentSessionSummaries(&sv.SessionSummaries, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartContentUpload struct { +} + +func (*awsRestjson1_deserializeOpStartContentUpload) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartContentUpload) 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_deserializeOpErrorStartContentUpload(response, &metadata) + } + output := &StartContentUploadOutput{} + 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_deserializeOpDocumentStartContentUploadOutput(&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_deserializeOpErrorStartContentUpload(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartContentUploadOutput(v **StartContentUploadOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartContentUploadOutput + if *v == nil { + sv = &StartContentUploadOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "headersToInclude": + if err := awsRestjson1_deserializeDocumentHeaders(&sv.HeadersToInclude, value); err != nil { + return err + } + + case "uploadId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UploadId to be of type string, got %T instead", value) + } + sv.UploadId = ptr.String(jtv) + } + + case "url": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.Url = ptr.String(jtv) + } + + case "urlExpiry": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UrlExpiry = 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 +} + +type awsRestjson1_deserializeOpStartImportJob struct { +} + +func (*awsRestjson1_deserializeOpStartImportJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartImportJob) 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_deserializeOpErrorStartImportJob(response, &metadata) + } + output := &StartImportJobOutput{} + 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_deserializeOpDocumentStartImportJobOutput(&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_deserializeOpErrorStartImportJob(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartImportJobOutput(v **StartImportJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartImportJobOutput + if *v == nil { + sv = &StartImportJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "importJob": + if err := awsRestjson1_deserializeDocumentImportJobData(&sv.ImportJob, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpTagResource struct { +} + +func (*awsRestjson1_deserializeOpTagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + } + output := &TagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyTagsException", errorCode): + return awsRestjson1_deserializeErrorTooManyTagsException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + } + output := &UntagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateContent struct { +} + +func (*awsRestjson1_deserializeOpUpdateContent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateContent) 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_deserializeOpErrorUpdateContent(response, &metadata) + } + output := &UpdateContentOutput{} + 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_deserializeOpDocumentUpdateContentOutput(&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_deserializeOpErrorUpdateContent(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("PreconditionFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateContentOutput(v **UpdateContentOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateContentOutput + if *v == nil { + sv = &UpdateContentOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "content": + if err := awsRestjson1_deserializeDocumentContentData(&sv.Content, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateKnowledgeBaseTemplateUri struct { +} + +func (*awsRestjson1_deserializeOpUpdateKnowledgeBaseTemplateUri) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateKnowledgeBaseTemplateUri) 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_deserializeOpErrorUpdateKnowledgeBaseTemplateUri(response, &metadata) + } + output := &UpdateKnowledgeBaseTemplateUriOutput{} + 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_deserializeOpDocumentUpdateKnowledgeBaseTemplateUriOutput(&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_deserializeOpErrorUpdateKnowledgeBaseTemplateUri(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateKnowledgeBaseTemplateUriOutput(v **UpdateKnowledgeBaseTemplateUriOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateKnowledgeBaseTemplateUriOutput + if *v == nil { + sv = &UpdateKnowledgeBaseTemplateUriOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBase": + if err := awsRestjson1_deserializeDocumentKnowledgeBaseData(&sv.KnowledgeBase, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateQuickResponse struct { +} + +func (*awsRestjson1_deserializeOpUpdateQuickResponse) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateQuickResponse) 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_deserializeOpErrorUpdateQuickResponse(response, &metadata) + } + output := &UpdateQuickResponseOutput{} + 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_deserializeOpDocumentUpdateQuickResponseOutput(&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_deserializeOpErrorUpdateQuickResponse(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("PreconditionFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateQuickResponseOutput(v **UpdateQuickResponseOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateQuickResponseOutput + if *v == nil { + sv = &UpdateQuickResponseOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "quickResponse": + if err := awsRestjson1_deserializeDocumentQuickResponseData(&sv.QuickResponse, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConflictException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentConflictException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorPreconditionFailedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.PreconditionFailedException{} + 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_deserializeDocumentPreconditionFailedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorRequestTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.RequestTimeoutException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentRequestTimeoutException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotFoundException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_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_deserializeErrorTooManyTagsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.TooManyTagsException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentTooManyTagsException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AccessDeniedException + if *v == nil { + sv = &types.AccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAppIntegrationsConfiguration(v **types.AppIntegrationsConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AppIntegrationsConfiguration + if *v == nil { + sv = &types.AppIntegrationsConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "appIntegrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.AppIntegrationArn = ptr.String(jtv) + } + + case "objectFields": + if err := awsRestjson1_deserializeDocumentObjectFieldsList(&sv.ObjectFields, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantAssociationData(v **types.AssistantAssociationData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantAssociationData + if *v == nil { + sv = &types.AssistantAssociationData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantAssociationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantAssociationArn = ptr.String(jtv) + } + + case "assistantAssociationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantAssociationId = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "associationData": + if err := awsRestjson1_deserializeDocumentAssistantAssociationOutputData(&sv.AssociationData, value); err != nil { + return err + } + + case "associationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssociationType to be of type string, got %T instead", value) + } + sv.AssociationType = types.AssociationType(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantAssociationOutputData(v *types.AssistantAssociationOutputData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.AssistantAssociationOutputData +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "knowledgeBaseAssociation": + var mv types.KnowledgeBaseAssociationData + destAddr := &mv + if err := awsRestjson1_deserializeDocumentKnowledgeBaseAssociationData(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.AssistantAssociationOutputDataMemberKnowledgeBaseAssociation{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantAssociationSummary(v **types.AssistantAssociationSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantAssociationSummary + if *v == nil { + sv = &types.AssistantAssociationSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantAssociationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantAssociationArn = ptr.String(jtv) + } + + case "assistantAssociationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantAssociationId = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "associationData": + if err := awsRestjson1_deserializeDocumentAssistantAssociationOutputData(&sv.AssociationData, value); err != nil { + return err + } + + case "associationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssociationType to be of type string, got %T instead", value) + } + sv.AssociationType = types.AssociationType(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantAssociationSummaryList(v *[]types.AssistantAssociationSummary, 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.AssistantAssociationSummary + if *v == nil { + cv = []types.AssistantAssociationSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AssistantAssociationSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAssistantAssociationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantCapabilityConfiguration(v **types.AssistantCapabilityConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantCapabilityConfiguration + if *v == nil { + sv = &types.AssistantCapabilityConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssistantCapabilityType to be of type string, got %T instead", value) + } + sv.Type = types.AssistantCapabilityType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantData(v **types.AssistantData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantData + if *v == nil { + sv = &types.AssistantData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "capabilityConfiguration": + if err := awsRestjson1_deserializeDocumentAssistantCapabilityConfiguration(&sv.CapabilityConfiguration, value); err != nil { + return err + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "integrationConfiguration": + if err := awsRestjson1_deserializeDocumentAssistantIntegrationConfiguration(&sv.IntegrationConfiguration, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "serverSideEncryptionConfiguration": + if err := awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(&sv.ServerSideEncryptionConfiguration, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssistantStatus to be of type string, got %T instead", value) + } + sv.Status = types.AssistantStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssistantType to be of type string, got %T instead", value) + } + sv.Type = types.AssistantType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantIntegrationConfiguration(v **types.AssistantIntegrationConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantIntegrationConfiguration + if *v == nil { + sv = &types.AssistantIntegrationConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "topicIntegrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.TopicIntegrationArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantList(v *[]types.AssistantSummary, 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.AssistantSummary + if *v == nil { + cv = []types.AssistantSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AssistantSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAssistantSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAssistantSummary(v **types.AssistantSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AssistantSummary + if *v == nil { + sv = &types.AssistantSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "capabilityConfiguration": + if err := awsRestjson1_deserializeDocumentAssistantCapabilityConfiguration(&sv.CapabilityConfiguration, value); err != nil { + return err + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "integrationConfiguration": + if err := awsRestjson1_deserializeDocumentAssistantIntegrationConfiguration(&sv.IntegrationConfiguration, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "serverSideEncryptionConfiguration": + if err := awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(&sv.ServerSideEncryptionConfiguration, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssistantStatus to be of type string, got %T instead", value) + } + sv.Status = types.AssistantStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AssistantType to be of type string, got %T instead", value) + } + sv.Type = types.AssistantType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentChannels(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 Channel to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentConfiguration(v *types.Configuration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.Configuration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "connectConfiguration": + var mv types.ConnectConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentConnectConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.ConfigurationMemberConnectConfiguration{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + 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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConnectConfiguration(v **types.ConnectConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ConnectConfiguration + if *v == nil { + sv = &types.ConnectConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "instanceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.InstanceId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContactAttributeKeys(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 ContactAttributeKey to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentContentData(v **types.ContentData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentData + if *v == nil { + sv = &types.ContentData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.ContentArn = ptr.String(jtv) + } + + case "contentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ContentId = ptr.String(jtv) + } + + case "contentType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentType to be of type string, got %T instead", value) + } + sv.ContentType = ptr.String(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "linkOutUri": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uri to be of type string, got %T instead", value) + } + sv.LinkOutUri = ptr.String(jtv) + } + + case "metadata": + if err := awsRestjson1_deserializeDocumentContentMetadata(&sv.Metadata, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "revisionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.RevisionId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentStatus to be of type string, got %T instead", value) + } + sv.Status = types.ContentStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "title": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentTitle to be of type string, got %T instead", value) + } + sv.Title = ptr.String(jtv) + } + + case "url": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.Url = ptr.String(jtv) + } + + case "urlExpiry": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UrlExpiry = 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_deserializeDocumentContentDataDetails(v **types.ContentDataDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentDataDetails + if *v == nil { + sv = &types.ContentDataDetails{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "rankingData": + if err := awsRestjson1_deserializeDocumentRankingData(&sv.RankingData, value); err != nil { + return err + } + + case "textData": + if err := awsRestjson1_deserializeDocumentTextData(&sv.TextData, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContentMetadata(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 NonEmptyString to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentContentReference(v **types.ContentReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentReference + if *v == nil { + sv = &types.ContentReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.ContentArn = ptr.String(jtv) + } + + case "contentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ContentId = ptr.String(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContentSummary(v **types.ContentSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ContentSummary + if *v == nil { + sv = &types.ContentSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.ContentArn = ptr.String(jtv) + } + + case "contentId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ContentId = ptr.String(jtv) + } + + case "contentType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentType to be of type string, got %T instead", value) + } + sv.ContentType = ptr.String(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "metadata": + if err := awsRestjson1_deserializeDocumentContentMetadata(&sv.Metadata, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "revisionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.RevisionId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentStatus to be of type string, got %T instead", value) + } + sv.Status = types.ContentStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "title": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContentTitle to be of type string, got %T instead", value) + } + sv.Title = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentContentSummaryList(v *[]types.ContentSummary, 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.ContentSummary + if *v == nil { + cv = []types.ContentSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ContentSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentContentSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDataDetails(v *types.DataDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.DataDetails +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "contentData": + var mv types.ContentDataDetails + destAddr := &mv + if err := awsRestjson1_deserializeDocumentContentDataDetails(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.DataDetailsMemberContentData{Value: mv} + break loop + + case "generativeData": + var mv types.GenerativeDataDetails + destAddr := &mv + if err := awsRestjson1_deserializeDocumentGenerativeDataDetails(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.DataDetailsMemberGenerativeData{Value: mv} + break loop + + case "sourceContentData": + var mv types.SourceContentDataDetails + destAddr := &mv + if err := awsRestjson1_deserializeDocumentSourceContentDataDetails(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.DataDetailsMemberSourceContentData{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentDataReference(v *types.DataReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.DataReference +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "contentReference": + var mv types.ContentReference + destAddr := &mv + if err := awsRestjson1_deserializeDocumentContentReference(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.DataReferenceMemberContentReference{Value: mv} + break loop + + case "generativeReference": + var mv types.GenerativeReference + destAddr := &mv + if err := awsRestjson1_deserializeDocumentGenerativeReference(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.DataReferenceMemberGenerativeReference{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentDataSummary(v **types.DataSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DataSummary + if *v == nil { + sv = &types.DataSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "details": + if err := awsRestjson1_deserializeDocumentDataDetails(&sv.Details, value); err != nil { + return err + } + + case "reference": + if err := awsRestjson1_deserializeDocumentDataReference(&sv.Reference, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSummaryList(v *[]types.DataSummary, 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.DataSummary + if *v == nil { + cv = []types.DataSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DataSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentDataSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDocument(v **types.Document, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Document + if *v == nil { + sv = &types.Document{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "contentReference": + if err := awsRestjson1_deserializeDocumentContentReference(&sv.ContentReference, value); err != nil { + return err + } + + case "excerpt": + if err := awsRestjson1_deserializeDocumentDocumentText(&sv.Excerpt, value); err != nil { + return err + } + + case "title": + if err := awsRestjson1_deserializeDocumentDocumentText(&sv.Title, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentText(v **types.DocumentText, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DocumentText + if *v == nil { + sv = &types.DocumentText{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "highlights": + if err := awsRestjson1_deserializeDocumentHighlights(&sv.Highlights, value); err != nil { + return err + } + + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SensitiveString to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentExternalSourceConfiguration(v **types.ExternalSourceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ExternalSourceConfiguration + if *v == nil { + sv = &types.ExternalSourceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "configuration": + if err := awsRestjson1_deserializeDocumentConfiguration(&sv.Configuration, value); err != nil { + return err + } + + case "source": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ExternalSource to be of type string, got %T instead", value) + } + sv.Source = types.ExternalSource(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGenerativeDataDetails(v **types.GenerativeDataDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GenerativeDataDetails + if *v == nil { + sv = &types.GenerativeDataDetails{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "completion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SensitiveString to be of type string, got %T instead", value) + } + sv.Completion = ptr.String(jtv) + } + + case "rankingData": + if err := awsRestjson1_deserializeDocumentRankingData(&sv.RankingData, value); err != nil { + return err + } + + case "references": + if err := awsRestjson1_deserializeDocumentDataSummaryList(&sv.References, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGenerativeReference(v **types.GenerativeReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GenerativeReference + if *v == nil { + sv = &types.GenerativeReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "generationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.GenerationId = ptr.String(jtv) + } + + case "modelId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LlmModelId to be of type string, got %T instead", value) + } + sv.ModelId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGroupingConfiguration(v **types.GroupingConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GroupingConfiguration + if *v == nil { + sv = &types.GroupingConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "criteria": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GroupingCriteria to be of type string, got %T instead", value) + } + sv.Criteria = ptr.String(jtv) + } + + case "values": + if err := awsRestjson1_deserializeDocumentGroupingValues(&sv.Values, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGroupingValues(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 GroupingValue to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentHeaders(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 NonEmptyString to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentHighlight(v **types.Highlight, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Highlight + if *v == nil { + sv = &types.Highlight{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "beginOffsetInclusive": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected HighlightOffset to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.BeginOffsetInclusive = int32(i64) + } + + case "endOffsetExclusive": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected HighlightOffset to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EndOffsetExclusive = int32(i64) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentHighlights(v *[]types.Highlight, 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.Highlight + if *v == nil { + cv = []types.Highlight{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Highlight + destAddr := &col + if err := awsRestjson1_deserializeDocumentHighlight(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentImportJobData(v **types.ImportJobData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ImportJobData + if *v == nil { + sv = &types.ImportJobData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "externalSourceConfiguration": + if err := awsRestjson1_deserializeDocumentExternalSourceConfiguration(&sv.ExternalSourceConfiguration, value); err != nil { + return err + } + + case "failedRecordReport": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.FailedRecordReport = ptr.String(jtv) + } + + case "importJobId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ImportJobId = ptr.String(jtv) + } + + case "importJobType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ImportJobType to be of type string, got %T instead", value) + } + sv.ImportJobType = types.ImportJobType(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "lastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "metadata": + if err := awsRestjson1_deserializeDocumentContentMetadata(&sv.Metadata, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ImportJobStatus to be of type string, got %T instead", value) + } + sv.Status = types.ImportJobStatus(jtv) + } + + case "uploadId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UploadId to be of type string, got %T instead", value) + } + sv.UploadId = ptr.String(jtv) + } + + case "url": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Url to be of type string, got %T instead", value) + } + sv.Url = ptr.String(jtv) + } + + case "urlExpiry": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UrlExpiry = 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_deserializeDocumentImportJobList(v *[]types.ImportJobSummary, 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.ImportJobSummary + if *v == nil { + cv = []types.ImportJobSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ImportJobSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentImportJobSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentImportJobSummary(v **types.ImportJobSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ImportJobSummary + if *v == nil { + sv = &types.ImportJobSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "externalSourceConfiguration": + if err := awsRestjson1_deserializeDocumentExternalSourceConfiguration(&sv.ExternalSourceConfiguration, value); err != nil { + return err + } + + case "importJobId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ImportJobId = ptr.String(jtv) + } + + case "importJobType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ImportJobType to be of type string, got %T instead", value) + } + sv.ImportJobType = types.ImportJobType(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "lastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "metadata": + if err := awsRestjson1_deserializeDocumentContentMetadata(&sv.Metadata, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ImportJobStatus to be of type string, got %T instead", value) + } + sv.Status = types.ImportJobStatus(jtv) + } + + case "uploadId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UploadId to be of type string, got %T instead", value) + } + sv.UploadId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseAssociationData(v **types.KnowledgeBaseAssociationData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseAssociationData + if *v == nil { + sv = &types.KnowledgeBaseAssociationData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseData(v **types.KnowledgeBaseData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseData + if *v == nil { + sv = &types.KnowledgeBaseData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "knowledgeBaseType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseType to be of type string, got %T instead", value) + } + sv.KnowledgeBaseType = types.KnowledgeBaseType(jtv) + } + + case "lastContentModificationTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastContentModificationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "renderingConfiguration": + if err := awsRestjson1_deserializeDocumentRenderingConfiguration(&sv.RenderingConfiguration, value); err != nil { + return err + } + + case "serverSideEncryptionConfiguration": + if err := awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(&sv.ServerSideEncryptionConfiguration, value); err != nil { + return err + } + + case "sourceConfiguration": + if err := awsRestjson1_deserializeDocumentSourceConfiguration(&sv.SourceConfiguration, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.KnowledgeBaseStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseList(v *[]types.KnowledgeBaseSummary, 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.KnowledgeBaseSummary + if *v == nil { + cv = []types.KnowledgeBaseSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.KnowledgeBaseSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentKnowledgeBaseSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentKnowledgeBaseSummary(v **types.KnowledgeBaseSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KnowledgeBaseSummary + if *v == nil { + sv = &types.KnowledgeBaseSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "knowledgeBaseType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseType to be of type string, got %T instead", value) + } + sv.KnowledgeBaseType = types.KnowledgeBaseType(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "renderingConfiguration": + if err := awsRestjson1_deserializeDocumentRenderingConfiguration(&sv.RenderingConfiguration, value); err != nil { + return err + } + + case "serverSideEncryptionConfiguration": + if err := awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(&sv.ServerSideEncryptionConfiguration, value); err != nil { + return err + } + + case "sourceConfiguration": + if err := awsRestjson1_deserializeDocumentSourceConfiguration(&sv.SourceConfiguration, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KnowledgeBaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.KnowledgeBaseStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentNotifyRecommendationsReceivedError(v **types.NotifyRecommendationsReceivedError, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.NotifyRecommendationsReceivedError + if *v == nil { + sv = &types.NotifyRecommendationsReceivedError{} + } 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 NotifyRecommendationsReceivedErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "recommendationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecommendationId to be of type string, got %T instead", value) + } + sv.RecommendationId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentNotifyRecommendationsReceivedErrorList(v *[]types.NotifyRecommendationsReceivedError, 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.NotifyRecommendationsReceivedError + if *v == nil { + cv = []types.NotifyRecommendationsReceivedError{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.NotifyRecommendationsReceivedError + destAddr := &col + if err := awsRestjson1_deserializeDocumentNotifyRecommendationsReceivedError(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentObjectFieldsList(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 NonEmptyString to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentPreconditionFailedException(v **types.PreconditionFailedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PreconditionFailedException + if *v == nil { + sv = &types.PreconditionFailedException{} + } 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_deserializeDocumentQueryRecommendationTriggerData(v **types.QueryRecommendationTriggerData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryRecommendationTriggerData + if *v == nil { + sv = &types.QueryRecommendationTriggerData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "text": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueryText to be of type string, got %T instead", value) + } + sv.Text = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQueryResultsList(v *[]types.ResultData, 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.ResultData + if *v == nil { + cv = []types.ResultData{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ResultData + destAddr := &col + if err := awsRestjson1_deserializeDocumentResultData(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseContentProvider(v *types.QuickResponseContentProvider, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.QuickResponseContentProvider +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "content": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseContent to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.QuickResponseContentProviderMemberContent{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseContents(v **types.QuickResponseContents, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QuickResponseContents + if *v == nil { + sv = &types.QuickResponseContents{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "markdown": + if err := awsRestjson1_deserializeDocumentQuickResponseContentProvider(&sv.Markdown, value); err != nil { + return err + } + + case "plainText": + if err := awsRestjson1_deserializeDocumentQuickResponseContentProvider(&sv.PlainText, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseData(v **types.QuickResponseData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QuickResponseData + if *v == nil { + sv = &types.QuickResponseData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "channels": + if err := awsRestjson1_deserializeDocumentChannels(&sv.Channels, value); err != nil { + return err + } + + case "contents": + if err := awsRestjson1_deserializeDocumentQuickResponseContents(&sv.Contents, value); err != nil { + return err + } + + case "contentType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseType to be of type string, got %T instead", value) + } + sv.ContentType = ptr.String(jtv) + } + + case "createdTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "groupingConfiguration": + if err := awsRestjson1_deserializeDocumentGroupingConfiguration(&sv.GroupingConfiguration, value); err != nil { + return err + } + + case "isActive": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsActive = ptr.Bool(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "language": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) + } + sv.Language = ptr.String(jtv) + } + + case "lastModifiedBy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.LastModifiedBy = ptr.String(jtv) + } + + case "lastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "quickResponseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.QuickResponseArn = ptr.String(jtv) + } + + case "quickResponseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.QuickResponseId = ptr.String(jtv) + } + + case "shortcutKey": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ShortCutKey to be of type string, got %T instead", value) + } + sv.ShortcutKey = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseStatus to be of type string, got %T instead", value) + } + sv.Status = types.QuickResponseStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseSearchResultData(v **types.QuickResponseSearchResultData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QuickResponseSearchResultData + if *v == nil { + sv = &types.QuickResponseSearchResultData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attributesInterpolated": + if err := awsRestjson1_deserializeDocumentContactAttributeKeys(&sv.AttributesInterpolated, value); err != nil { + return err + } + + case "attributesNotInterpolated": + if err := awsRestjson1_deserializeDocumentContactAttributeKeys(&sv.AttributesNotInterpolated, value); err != nil { + return err + } + + case "channels": + if err := awsRestjson1_deserializeDocumentChannels(&sv.Channels, value); err != nil { + return err + } + + case "contents": + if err := awsRestjson1_deserializeDocumentQuickResponseContents(&sv.Contents, value); err != nil { + return err + } + + case "contentType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseType to be of type string, got %T instead", value) + } + sv.ContentType = ptr.String(jtv) + } + + case "createdTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "groupingConfiguration": + if err := awsRestjson1_deserializeDocumentGroupingConfiguration(&sv.GroupingConfiguration, value); err != nil { + return err + } + + case "isActive": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsActive = ptr.Bool(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "language": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) + } + sv.Language = ptr.String(jtv) + } + + case "lastModifiedBy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.LastModifiedBy = ptr.String(jtv) + } + + case "lastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "quickResponseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.QuickResponseArn = ptr.String(jtv) + } + + case "quickResponseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.QuickResponseId = ptr.String(jtv) + } + + case "shortcutKey": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ShortCutKey to be of type string, got %T instead", value) + } + sv.ShortcutKey = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseStatus to be of type string, got %T instead", value) + } + sv.Status = types.QuickResponseStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseSearchResultsList(v *[]types.QuickResponseSearchResultData, 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.QuickResponseSearchResultData + if *v == nil { + cv = []types.QuickResponseSearchResultData{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.QuickResponseSearchResultData + destAddr := &col + if err := awsRestjson1_deserializeDocumentQuickResponseSearchResultData(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseSummary(v **types.QuickResponseSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QuickResponseSummary + if *v == nil { + sv = &types.QuickResponseSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "channels": + if err := awsRestjson1_deserializeDocumentChannels(&sv.Channels, value); err != nil { + return err + } + + case "contentType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseType to be of type string, got %T instead", value) + } + sv.ContentType = ptr.String(jtv) + } + + case "createdTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseDescription to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "isActive": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsActive = ptr.Bool(jtv) + } + + case "knowledgeBaseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.KnowledgeBaseArn = ptr.String(jtv) + } + + case "knowledgeBaseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.KnowledgeBaseId = ptr.String(jtv) + } + + case "lastModifiedBy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.LastModifiedBy = ptr.String(jtv) + } + + case "lastModifiedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "quickResponseArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.QuickResponseArn = ptr.String(jtv) + } + + case "quickResponseId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.QuickResponseId = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QuickResponseStatus to be of type string, got %T instead", value) + } + sv.Status = types.QuickResponseStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQuickResponseSummaryList(v *[]types.QuickResponseSummary, 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.QuickResponseSummary + if *v == nil { + cv = []types.QuickResponseSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.QuickResponseSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentQuickResponseSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRankingData(v **types.RankingData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RankingData + if *v == nil { + sv = &types.RankingData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "relevanceLevel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RelevanceLevel to be of type string, got %T instead", value) + } + sv.RelevanceLevel = types.RelevanceLevel(jtv) + } + + case "relevanceScore": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.RelevanceScore = f64 + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.RelevanceScore = f64 + + default: + return fmt.Errorf("expected RelevanceScore to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationData(v **types.RecommendationData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RecommendationData + if *v == nil { + sv = &types.RecommendationData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "data": + if err := awsRestjson1_deserializeDocumentDataSummary(&sv.Data, value); err != nil { + return err + } + + case "document": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Document, value); err != nil { + return err + } + + case "recommendationId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecommendationId to be of type string, got %T instead", value) + } + sv.RecommendationId = ptr.String(jtv) + } + + case "relevanceLevel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RelevanceLevel to be of type string, got %T instead", value) + } + sv.RelevanceLevel = types.RelevanceLevel(jtv) + } + + case "relevanceScore": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.RelevanceScore = f64 + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.RelevanceScore = f64 + + default: + return fmt.Errorf("expected RelevanceScore to be a JSON Number, got %T instead", value) + + } + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecommendationType to be of type string, got %T instead", value) + } + sv.Type = types.RecommendationType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationIdList(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 RecommendationId to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationList(v *[]types.RecommendationData, 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.RecommendationData + if *v == nil { + cv = []types.RecommendationData{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RecommendationData + destAddr := &col + if err := awsRestjson1_deserializeDocumentRecommendationData(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationTrigger(v **types.RecommendationTrigger, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RecommendationTrigger + if *v == nil { + sv = &types.RecommendationTrigger{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "data": + if err := awsRestjson1_deserializeDocumentRecommendationTriggerData(&sv.Data, value); err != nil { + return err + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "recommendationIds": + if err := awsRestjson1_deserializeDocumentRecommendationIdList(&sv.RecommendationIds, value); err != nil { + return err + } + + case "source": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecommendationSourceType to be of type string, got %T instead", value) + } + sv.Source = types.RecommendationSourceType(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecommendationTriggerType to be of type string, got %T instead", value) + } + sv.Type = types.RecommendationTriggerType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationTriggerData(v *types.RecommendationTriggerData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.RecommendationTriggerData +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "query": + var mv types.QueryRecommendationTriggerData + destAddr := &mv + if err := awsRestjson1_deserializeDocumentQueryRecommendationTriggerData(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.RecommendationTriggerDataMemberQuery{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentRecommendationTriggerList(v *[]types.RecommendationTrigger, 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.RecommendationTrigger + if *v == nil { + cv = []types.RecommendationTrigger{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RecommendationTrigger + destAddr := &col + if err := awsRestjson1_deserializeDocumentRecommendationTrigger(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRenderingConfiguration(v **types.RenderingConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RenderingConfiguration + if *v == nil { + sv = &types.RenderingConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "templateUri": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uri to be of type string, got %T instead", value) + } + sv.TemplateUri = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRequestTimeoutException(v **types.RequestTimeoutException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RequestTimeoutException + if *v == nil { + sv = &types.RequestTimeoutException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "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_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 "resourceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentResultData(v **types.ResultData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ResultData + if *v == nil { + sv = &types.ResultData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "data": + if err := awsRestjson1_deserializeDocumentDataSummary(&sv.Data, value); err != nil { + return err + } + + case "document": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Document, value); err != nil { + return err + } + + case "relevanceScore": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.RelevanceScore = f64 + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.RelevanceScore = f64 + + default: + return fmt.Errorf("expected RelevanceScore to be a JSON Number, got %T instead", value) + + } + } + + case "resultId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ResultId = ptr.String(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueryResultType to be of type string, got %T instead", value) + } + sv.Type = types.QueryResultType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentServerSideEncryptionConfiguration(v **types.ServerSideEncryptionConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ServerSideEncryptionConfiguration + if *v == nil { + sv = &types.ServerSideEncryptionConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "kmsKeyId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) + } + sv.KmsKeyId = ptr.String(jtv) + } + + 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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSessionData(v **types.SessionData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SessionData + if *v == nil { + sv = &types.SessionData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Description to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "integrationConfiguration": + if err := awsRestjson1_deserializeDocumentSessionIntegrationConfiguration(&sv.IntegrationConfiguration, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "sessionArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.SessionArn = ptr.String(jtv) + } + + case "sessionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.SessionId = ptr.String(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSessionIntegrationConfiguration(v **types.SessionIntegrationConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SessionIntegrationConfiguration + if *v == nil { + sv = &types.SessionIntegrationConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "topicIntegrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GenericArn to be of type string, got %T instead", value) + } + sv.TopicIntegrationArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSessionSummaries(v *[]types.SessionSummary, 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.SessionSummary + if *v == nil { + cv = []types.SessionSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.SessionSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentSessionSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentSessionSummary(v **types.SessionSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SessionSummary + if *v == nil { + sv = &types.SessionSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "sessionArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Arn to be of type string, got %T instead", value) + } + sv.SessionArn = ptr.String(jtv) + } + + case "sessionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.SessionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSourceConfiguration(v *types.SourceConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.SourceConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "appIntegrations": + var mv types.AppIntegrationsConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentAppIntegrationsConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.SourceConfigurationMemberAppIntegrations{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentSourceContentDataDetails(v **types.SourceContentDataDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SourceContentDataDetails + if *v == nil { + sv = &types.SourceContentDataDetails{} + } 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 Uuid to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "rankingData": + if err := awsRestjson1_deserializeDocumentRankingData(&sv.RankingData, value); err != nil { + return err + } + + case "textData": + if err := awsRestjson1_deserializeDocumentTextData(&sv.TextData, value); err != nil { + return err + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SourceContentType to be of type string, got %T instead", value) + } + sv.Type = types.SourceContentType(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 TagValue to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentTextData(v **types.TextData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TextData + if *v == nil { + sv = &types.TextData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "excerpt": + if err := awsRestjson1_deserializeDocumentDocumentText(&sv.Excerpt, value); err != nil { + return err + } + + case "title": + if err := awsRestjson1_deserializeDocumentDocumentText(&sv.Title, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTooManyTagsException(v **types.TooManyTagsException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.TooManyTagsException + if *v == nil { + sv = &types.TooManyTagsException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "resourceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceName = 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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/qconnect/doc.go b/service/qconnect/doc.go new file mode 100644 index 00000000000..2a64deadb28 --- /dev/null +++ b/service/qconnect/doc.go @@ -0,0 +1,19 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package qconnect provides the API client, operations, and parameter types for +// Amazon Q Connect. +// +// Amazon Q in Connect is a generative AI customer service assistant. It is an +// LLM-enhanced evolution of Amazon Connect Wisdom that delivers real-time +// recommendations to help contact center agents resolve customer issues quickly +// and accurately. Amazon Q automatically detects customer intent during calls and +// chats using conversational analytics and natural language understanding (NLU). +// It then provides agents with immediate, real-time generative responses and +// suggested actions, and links to relevant documents and articles. Agents can also +// query Amazon Q directly using natural language or keywords to answer customer +// requests. Use the Amazon Q in Connect APIs to create an assistant and a +// knowledge base, for example, or manage content by uploading custom files. For +// more information, see Use Amazon Q in Connect for generative AI powered agent +// assistance in real-time (https://docs.aws.amazon.com/connect/latest/adminguide/amazon-q-connect.html) +// in the Amazon Connect Administrator Guide. +package qconnect diff --git a/service/qconnect/endpoints.go b/service/qconnect/endpoints.go new file mode 100644 index 00000000000..8a6efd31f04 --- /dev/null +++ b/service/qconnect/endpoints.go @@ -0,0 +1,509 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + "github.com/aws/aws-sdk-go-v2/internal/endpoints" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/qconnect/internal/endpoints" + smithyauth "github.com/aws/smithy-go/auth" + 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" + "os" + "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 = "wisdom" + } + 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() + } +} + +func resolveBaseEndpoint(cfg aws.Config, o *Options) { + if cfg.BaseEndpoint != nil { + o.BaseEndpoint = cfg.BaseEndpoint + } + + _, g := os.LookupEnv("AWS_ENDPOINT_URL") + _, s := os.LookupEnv("AWS_ENDPOINT_URL_QCONNECT") + + if g && !s { + return + } + + value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "QConnect", cfg.ConfigSources) + if found && err == nil { + o.BaseEndpoint = &value + } +} + +// 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://wisdom-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 _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://wisdom-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://wisdom.") + 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://wisdom.") + 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") +} + +type endpointParamsBinder interface { + bindEndpointParams(*EndpointParameters) +} + +func bindEndpointParams(input interface{}, options Options) *EndpointParameters { + params := &EndpointParameters{} + + params.Region = aws.String(endpoints.MapFIPSRegion(options.Region)) + params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled) + params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) + params.Endpoint = options.BaseEndpoint + + if b, ok := input.(endpointParamsBinder); ok { + b.bindEndpointParams(params) + } + + return params +} + +type resolveEndpointV2Middleware struct { + options Options +} + +func (*resolveEndpointV2Middleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleFinalize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.options.EndpointResolverV2 == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := bindEndpointParams(getOperationInput(ctx), m.options) + endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + if endpt.URI.RawPath == "" && req.URL.RawPath != "" { + endpt.URI.RawPath = endpt.URI.Path + } + req.URL.Scheme = endpt.URI.Scheme + req.URL.Host = endpt.URI.Host + req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) + req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) + for k := range endpt.Headers { + req.Header.Set(k, endpt.Headers.Get(k)) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) + for _, o := range opts { + rscheme.SignerProperties.SetAll(&o.SignerProperties) + } + + return next.HandleFinalize(ctx, in) +} diff --git a/service/qconnect/endpoints_config_test.go b/service/qconnect/endpoints_config_test.go new file mode 100644 index 00000000000..4d18ce1e091 --- /dev/null +++ b/service/qconnect/endpoints_config_test.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "os" + "reflect" + "testing" +) + +type mockConfigSource struct { + global string + service string + ignore bool +} + +// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured +// endpoints feature. +func (m mockConfigSource) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) { + return m.ignore, m.ignore, nil +} + +// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use +// with configured endpoints. +func (m mockConfigSource) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) { + if m.service != "" { + return m.service, true, nil + } + return "", false, nil +} + +func TestResolveBaseEndpoint(t *testing.T) { + cases := map[string]struct { + envGlobal string + envService string + envIgnore bool + configGlobal string + configService string + configIgnore bool + clientEndpoint *string + expectURL *string + }{ + "env ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-qconnect.dev", + envIgnore: true, + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + expectURL: nil, + }, + "env global": { + envGlobal: "https://env-global.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + expectURL: aws.String("https://env-global.dev"), + }, + "env service": { + envGlobal: "https://env-global.dev", + envService: "https://env-qconnect.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + expectURL: aws.String("https://env-qconnect.dev"), + }, + "config ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-qconnect.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + configIgnore: true, + expectURL: nil, + }, + "config global": { + configGlobal: "http://config-global.dev", + expectURL: aws.String("http://config-global.dev"), + }, + "config service": { + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + expectURL: aws.String("http://config-qconnect.dev"), + }, + "client": { + envGlobal: "https://env-global.dev", + envService: "https://env-qconnect.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-qconnect.dev", + clientEndpoint: aws.String("https://client-qconnect.dev"), + expectURL: aws.String("https://client-qconnect.dev"), + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + os.Clearenv() + + awsConfig := aws.Config{} + ignore := c.envIgnore || c.configIgnore + + if c.configGlobal != "" && !ignore { + awsConfig.BaseEndpoint = aws.String(c.configGlobal) + } + + if c.envGlobal != "" { + t.Setenv("AWS_ENDPOINT_URL", c.envGlobal) + if !ignore { + awsConfig.BaseEndpoint = aws.String(c.envGlobal) + } + } + + if c.envService != "" { + t.Setenv("AWS_ENDPOINT_URL_QCONNECT", c.envService) + } + + awsConfig.ConfigSources = []interface{}{ + mockConfigSource{ + global: c.envGlobal, + service: c.envService, + ignore: c.envIgnore, + }, + mockConfigSource{ + global: c.configGlobal, + service: c.configService, + ignore: c.configIgnore, + }, + } + + client := NewFromConfig(awsConfig, func(o *Options) { + if c.clientEndpoint != nil { + o.BaseEndpoint = c.clientEndpoint + } + }) + + if e, a := c.expectURL, client.options.BaseEndpoint; !reflect.DeepEqual(e, a) { + t.Errorf("expect endpoint %v , got %v", e, a) + } + }) + } +} diff --git a/service/qconnect/endpoints_test.go b/service/qconnect/endpoints_test.go new file mode 100644 index 00000000000..31e6ce87618 --- /dev/null +++ b/service/qconnect/endpoints_test.go @@ -0,0 +1,856 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +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://wisdom-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://wisdom-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://wisdom.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://wisdom.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://wisdom-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://wisdom-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://wisdom.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://wisdom.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://wisdom-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://wisdom-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://wisdom.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://wisdom.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://wisdom-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://wisdom.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://wisdom-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://wisdom.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/qconnect/generated.json b/service/qconnect/generated.json new file mode 100644 index 00000000000..d656aed7777 --- /dev/null +++ b/service/qconnect/generated.json @@ -0,0 +1,74 @@ +{ + "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_CreateAssistant.go", + "api_op_CreateAssistantAssociation.go", + "api_op_CreateContent.go", + "api_op_CreateKnowledgeBase.go", + "api_op_CreateQuickResponse.go", + "api_op_CreateSession.go", + "api_op_DeleteAssistant.go", + "api_op_DeleteAssistantAssociation.go", + "api_op_DeleteContent.go", + "api_op_DeleteImportJob.go", + "api_op_DeleteKnowledgeBase.go", + "api_op_DeleteQuickResponse.go", + "api_op_GetAssistant.go", + "api_op_GetAssistantAssociation.go", + "api_op_GetContent.go", + "api_op_GetContentSummary.go", + "api_op_GetImportJob.go", + "api_op_GetKnowledgeBase.go", + "api_op_GetQuickResponse.go", + "api_op_GetRecommendations.go", + "api_op_GetSession.go", + "api_op_ListAssistantAssociations.go", + "api_op_ListAssistants.go", + "api_op_ListContents.go", + "api_op_ListImportJobs.go", + "api_op_ListKnowledgeBases.go", + "api_op_ListQuickResponses.go", + "api_op_ListTagsForResource.go", + "api_op_NotifyRecommendationsReceived.go", + "api_op_QueryAssistant.go", + "api_op_RemoveKnowledgeBaseTemplateUri.go", + "api_op_SearchContent.go", + "api_op_SearchQuickResponses.go", + "api_op_SearchSessions.go", + "api_op_StartContentUpload.go", + "api_op_StartImportJob.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateContent.go", + "api_op_UpdateKnowledgeBaseTemplateUri.go", + "api_op_UpdateQuickResponse.go", + "auth.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "endpoints_config_test.go", + "endpoints_test.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "options.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/qconnect", + "unstable": false +} diff --git a/service/qconnect/go.mod b/service/qconnect/go.mod new file mode 100644 index 00000000000..71eb96302d2 --- /dev/null +++ b/service/qconnect/go.mod @@ -0,0 +1,17 @@ +module github.com/aws/aws-sdk-go-v2/service/qconnect + +go 1.19 + +require ( + github.com/aws/aws-sdk-go-v2 v1.23.1 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 + github.com/aws/smithy-go v1.17.0 + 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/qconnect/go.sum b/service/qconnect/go.sum new file mode 100644 index 00000000000..42e4fc806b4 --- /dev/null +++ b/service/qconnect/go.sum @@ -0,0 +1,4 @@ +github.com/aws/smithy-go v1.17.0 h1:wWJD7LX6PBV6etBUwO0zElG0nWN9rUhp0WdYeHSHAaI= +github.com/aws/smithy-go v1.17.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/service/qconnect/go_module_metadata.go b/service/qconnect/go_module_metadata.go new file mode 100644 index 00000000000..577b9c97933 --- /dev/null +++ b/service/qconnect/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package qconnect + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/qconnect/internal/endpoints/endpoints.go b/service/qconnect/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..2ab58304c52 --- /dev/null +++ b/service/qconnect/internal/endpoints/endpoints.go @@ -0,0 +1,352 @@ +// 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 QConnect 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: "wisdom.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "wisdom-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "wisdom-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "ap-northeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips-us-east-1", + }: endpoints.Endpoint{ + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-west-2", + }: endpoints.Endpoint{ + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "ui-ap-northeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ui-ap-southeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ui-eu-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ui-eu-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ui-us-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ui-us-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + Variant: endpoints.FIPSVariant, + }: {}, + endpoints.EndpointKey{ + Region: "us-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + Variant: endpoints.FIPSVariant, + }: {}, + }, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "wisdom.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "wisdom-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "wisdom-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{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: "wisdom-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{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: "wisdom-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{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: "wisdom-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{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: "wisdom-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{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: "wisdom.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "wisdom-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "wisdom-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "wisdom.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/qconnect/internal/endpoints/endpoints_test.go b/service/qconnect/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/qconnect/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/qconnect/options.go b/service/qconnect/options.go new file mode 100644 index 00000000000..15e94a27b4d --- /dev/null +++ b/service/qconnect/options.go @@ -0,0 +1,223 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" +) + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +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 operation. 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 + + // The auth scheme resolver which determines how to authenticate for each + // operation. + AuthSchemeResolver AuthSchemeResolver + + // The list of auth schemes supported by the client. + AuthSchemes []smithyhttp.AuthScheme +} + +// 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 (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { + if schemeID == "aws.auth#sigv4" { + return getSigV4IdentityResolver(o) + } + if schemeID == "smithy.api#noAuth" { + return &smithyauth.AnonymousIdentityResolver{} + } + return nil +} + +// 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 + } +} + +func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { + if o.Credentials != nil { + return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} + } + return nil +} + +// WithSigV4SigningName applies an override to the authentication workflow to +// use the given signing name for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing name from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningName(name string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), + middleware.Before, + ) + }) + } +} + +// WithSigV4SigningRegion applies an override to the authentication workflow to +// use the given signing region for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing region from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningRegion(region string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), + middleware.Before, + ) + }) + } +} + +func ignoreAnonymousAuth(options *Options) { + if _, ok := options.Credentials.(aws.AnonymousCredentials); ok { + options.Credentials = nil + } +} diff --git a/service/qconnect/protocol_test.go b/service/qconnect/protocol_test.go new file mode 100644 index 00000000000..8c6628ced48 --- /dev/null +++ b/service/qconnect/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect diff --git a/service/qconnect/serializers.go b/service/qconnect/serializers.go new file mode 100644 index 00000000000..d6b44187ae6 --- /dev/null +++ b/service/qconnect/serializers.go @@ -0,0 +1,4094 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qconnect/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_serializeOpCreateAssistant struct { +} + +func (*awsRestjson1_serializeOpCreateAssistant) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAssistant) 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.(*CreateAssistantInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants") + 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_serializeOpDocumentCreateAssistantInput(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_serializeOpHttpBindingsCreateAssistantInput(v *CreateAssistantInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAssistantInput(v *CreateAssistantInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.ServerSideEncryptionConfiguration != nil { + ok := object.Key("serverSideEncryptionConfiguration") + if err := awsRestjson1_serializeDocumentServerSideEncryptionConfiguration(v.ServerSideEncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if len(v.Type) > 0 { + ok := object.Key("type") + ok.String(string(v.Type)) + } + + return nil +} + +type awsRestjson1_serializeOpCreateAssistantAssociation struct { +} + +func (*awsRestjson1_serializeOpCreateAssistantAssociation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAssistantAssociation) 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.(*CreateAssistantAssociationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/associations") + 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_serializeOpHttpBindingsCreateAssistantAssociationInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateAssistantAssociationInput(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_serializeOpHttpBindingsCreateAssistantAssociationInput(v *CreateAssistantAssociationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAssistantAssociationInput(v *CreateAssistantAssociationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Association != nil { + ok := object.Key("association") + if err := awsRestjson1_serializeDocumentAssistantAssociationInputData(v.Association, ok); err != nil { + return err + } + } + + if len(v.AssociationType) > 0 { + ok := object.Key("associationType") + ok.String(string(v.AssociationType)) + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateContent struct { +} + +func (*awsRestjson1_serializeOpCreateContent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateContent) 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.(*CreateContentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents") + 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_serializeOpHttpBindingsCreateContentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateContentInput(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_serializeOpHttpBindingsCreateContentInput(v *CreateContentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateContentInput(v *CreateContentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Metadata != nil { + ok := object.Key("metadata") + if err := awsRestjson1_serializeDocumentContentMetadata(v.Metadata, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.OverrideLinkOutUri != nil { + ok := object.Key("overrideLinkOutUri") + ok.String(*v.OverrideLinkOutUri) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if v.Title != nil { + ok := object.Key("title") + ok.String(*v.Title) + } + + if v.UploadId != nil { + ok := object.Key("uploadId") + ok.String(*v.UploadId) + } + + return nil +} + +type awsRestjson1_serializeOpCreateKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpCreateKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateKnowledgeBase) 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.(*CreateKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases") + 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_serializeOpDocumentCreateKnowledgeBaseInput(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_serializeOpHttpBindingsCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if len(v.KnowledgeBaseType) > 0 { + ok := object.Key("knowledgeBaseType") + ok.String(string(v.KnowledgeBaseType)) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RenderingConfiguration != nil { + ok := object.Key("renderingConfiguration") + if err := awsRestjson1_serializeDocumentRenderingConfiguration(v.RenderingConfiguration, ok); err != nil { + return err + } + } + + if v.ServerSideEncryptionConfiguration != nil { + ok := object.Key("serverSideEncryptionConfiguration") + if err := awsRestjson1_serializeDocumentServerSideEncryptionConfiguration(v.ServerSideEncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.SourceConfiguration != nil { + ok := object.Key("sourceConfiguration") + if err := awsRestjson1_serializeDocumentSourceConfiguration(v.SourceConfiguration, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateQuickResponse struct { +} + +func (*awsRestjson1_serializeOpCreateQuickResponse) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateQuickResponse) 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.(*CreateQuickResponseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/quickResponses") + 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_serializeOpHttpBindingsCreateQuickResponseInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateQuickResponseInput(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_serializeOpHttpBindingsCreateQuickResponseInput(v *CreateQuickResponseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateQuickResponseInput(v *CreateQuickResponseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Channels != nil { + ok := object.Key("channels") + if err := awsRestjson1_serializeDocumentChannels(v.Channels, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Content != nil { + ok := object.Key("content") + if err := awsRestjson1_serializeDocumentQuickResponseDataProvider(v.Content, ok); err != nil { + return err + } + } + + if v.ContentType != nil { + ok := object.Key("contentType") + ok.String(*v.ContentType) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.GroupingConfiguration != nil { + ok := object.Key("groupingConfiguration") + if err := awsRestjson1_serializeDocumentGroupingConfiguration(v.GroupingConfiguration, ok); err != nil { + return err + } + } + + if v.IsActive != nil { + ok := object.Key("isActive") + ok.Boolean(*v.IsActive) + } + + if v.Language != nil { + ok := object.Key("language") + ok.String(*v.Language) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.ShortcutKey != nil { + ok := object.Key("shortcutKey") + ok.String(*v.ShortcutKey) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateSession struct { +} + +func (*awsRestjson1_serializeOpCreateSession) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateSession) 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.(*CreateSessionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/sessions") + 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_serializeOpHttpBindingsCreateSessionInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateSessionInput(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_serializeOpHttpBindingsCreateSessionInput(v *CreateSessionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateSessionInput(v *CreateSessionInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.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_serializeOpDeleteAssistant struct { +} + +func (*awsRestjson1_serializeOpDeleteAssistant) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAssistant) 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.(*DeleteAssistantInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}") + 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_serializeOpHttpBindingsDeleteAssistantInput(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_serializeOpHttpBindingsDeleteAssistantInput(v *DeleteAssistantInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteAssistantAssociation struct { +} + +func (*awsRestjson1_serializeOpDeleteAssistantAssociation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteAssistantAssociation) 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.(*DeleteAssistantAssociationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/associations/{assistantAssociationId}") + 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_serializeOpHttpBindingsDeleteAssistantAssociationInput(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_serializeOpHttpBindingsDeleteAssistantAssociationInput(v *DeleteAssistantAssociationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantAssociationId == nil || len(*v.AssistantAssociationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantAssociationId must not be empty")} + } + if v.AssistantAssociationId != nil { + if err := encoder.SetURI("assistantAssociationId").String(*v.AssistantAssociationId); err != nil { + return err + } + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteContent struct { +} + +func (*awsRestjson1_serializeOpDeleteContent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteContent) 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.(*DeleteContentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents/{contentId}") + 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_serializeOpHttpBindingsDeleteContentInput(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_serializeOpHttpBindingsDeleteContentInput(v *DeleteContentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ContentId == nil || len(*v.ContentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member contentId must not be empty")} + } + if v.ContentId != nil { + if err := encoder.SetURI("contentId").String(*v.ContentId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteImportJob struct { +} + +func (*awsRestjson1_serializeOpDeleteImportJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteImportJob) 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.(*DeleteImportJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/importJobs/{importJobId}") + 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_serializeOpHttpBindingsDeleteImportJobInput(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_serializeOpHttpBindingsDeleteImportJobInput(v *DeleteImportJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ImportJobId == nil || len(*v.ImportJobId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member importJobId must not be empty")} + } + if v.ImportJobId != nil { + if err := encoder.SetURI("importJobId").String(*v.ImportJobId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpDeleteKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteKnowledgeBase) 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.(*DeleteKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}") + 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_serializeOpHttpBindingsDeleteKnowledgeBaseInput(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_serializeOpHttpBindingsDeleteKnowledgeBaseInput(v *DeleteKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteQuickResponse struct { +} + +func (*awsRestjson1_serializeOpDeleteQuickResponse) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteQuickResponse) 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.(*DeleteQuickResponseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/quickResponses/{quickResponseId}") + 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_serializeOpHttpBindingsDeleteQuickResponseInput(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_serializeOpHttpBindingsDeleteQuickResponseInput(v *DeleteQuickResponseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + if v.QuickResponseId == nil || len(*v.QuickResponseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member quickResponseId must not be empty")} + } + if v.QuickResponseId != nil { + if err := encoder.SetURI("quickResponseId").String(*v.QuickResponseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAssistant struct { +} + +func (*awsRestjson1_serializeOpGetAssistant) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAssistant) 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.(*GetAssistantInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}") + 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_serializeOpHttpBindingsGetAssistantInput(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_serializeOpHttpBindingsGetAssistantInput(v *GetAssistantInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetAssistantAssociation struct { +} + +func (*awsRestjson1_serializeOpGetAssistantAssociation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAssistantAssociation) 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.(*GetAssistantAssociationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/associations/{assistantAssociationId}") + 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_serializeOpHttpBindingsGetAssistantAssociationInput(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_serializeOpHttpBindingsGetAssistantAssociationInput(v *GetAssistantAssociationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantAssociationId == nil || len(*v.AssistantAssociationId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantAssociationId must not be empty")} + } + if v.AssistantAssociationId != nil { + if err := encoder.SetURI("assistantAssociationId").String(*v.AssistantAssociationId); err != nil { + return err + } + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetContent struct { +} + +func (*awsRestjson1_serializeOpGetContent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetContent) 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.(*GetContentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents/{contentId}") + 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_serializeOpHttpBindingsGetContentInput(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_serializeOpHttpBindingsGetContentInput(v *GetContentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ContentId == nil || len(*v.ContentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member contentId must not be empty")} + } + if v.ContentId != nil { + if err := encoder.SetURI("contentId").String(*v.ContentId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetContentSummary struct { +} + +func (*awsRestjson1_serializeOpGetContentSummary) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetContentSummary) 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.(*GetContentSummaryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents/{contentId}/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_serializeOpHttpBindingsGetContentSummaryInput(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_serializeOpHttpBindingsGetContentSummaryInput(v *GetContentSummaryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ContentId == nil || len(*v.ContentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member contentId must not be empty")} + } + if v.ContentId != nil { + if err := encoder.SetURI("contentId").String(*v.ContentId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetImportJob struct { +} + +func (*awsRestjson1_serializeOpGetImportJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetImportJob) 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.(*GetImportJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/importJobs/{importJobId}") + 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_serializeOpHttpBindingsGetImportJobInput(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_serializeOpHttpBindingsGetImportJobInput(v *GetImportJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ImportJobId == nil || len(*v.ImportJobId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member importJobId must not be empty")} + } + if v.ImportJobId != nil { + if err := encoder.SetURI("importJobId").String(*v.ImportJobId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetKnowledgeBase struct { +} + +func (*awsRestjson1_serializeOpGetKnowledgeBase) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetKnowledgeBase) 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.(*GetKnowledgeBaseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}") + 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_serializeOpHttpBindingsGetKnowledgeBaseInput(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_serializeOpHttpBindingsGetKnowledgeBaseInput(v *GetKnowledgeBaseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetQuickResponse struct { +} + +func (*awsRestjson1_serializeOpGetQuickResponse) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetQuickResponse) 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.(*GetQuickResponseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/quickResponses/{quickResponseId}") + 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_serializeOpHttpBindingsGetQuickResponseInput(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_serializeOpHttpBindingsGetQuickResponseInput(v *GetQuickResponseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + if v.QuickResponseId == nil || len(*v.QuickResponseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member quickResponseId must not be empty")} + } + if v.QuickResponseId != nil { + if err := encoder.SetURI("quickResponseId").String(*v.QuickResponseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetRecommendations struct { +} + +func (*awsRestjson1_serializeOpGetRecommendations) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRecommendations) 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.(*GetRecommendationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/sessions/{sessionId}/recommendations") + 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_serializeOpHttpBindingsGetRecommendationsInput(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_serializeOpHttpBindingsGetRecommendationsInput(v *GetRecommendationsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("maxResults").Integer(*v.MaxResults) + } + + if v.SessionId == nil || len(*v.SessionId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member sessionId must not be empty")} + } + if v.SessionId != nil { + if err := encoder.SetURI("sessionId").String(*v.SessionId); err != nil { + return err + } + } + + if v.WaitTimeSeconds != 0 { + encoder.SetQuery("waitTimeSeconds").Integer(v.WaitTimeSeconds) + } + + return nil +} + +type awsRestjson1_serializeOpGetSession struct { +} + +func (*awsRestjson1_serializeOpGetSession) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetSession) 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.(*GetSessionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/sessions/{sessionId}") + 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_serializeOpHttpBindingsGetSessionInput(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_serializeOpHttpBindingsGetSessionInput(v *GetSessionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + if v.SessionId == nil || len(*v.SessionId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member sessionId must not be empty")} + } + if v.SessionId != nil { + if err := encoder.SetURI("sessionId").String(*v.SessionId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListAssistantAssociations struct { +} + +func (*awsRestjson1_serializeOpListAssistantAssociations) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAssistantAssociations) 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.(*ListAssistantAssociationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/associations") + 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_serializeOpHttpBindingsListAssistantAssociationsInput(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_serializeOpHttpBindingsListAssistantAssociationsInput(v *ListAssistantAssociationsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); 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_serializeOpListAssistants struct { +} + +func (*awsRestjson1_serializeOpListAssistants) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAssistants) 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.(*ListAssistantsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants") + 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_serializeOpHttpBindingsListAssistantsInput(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_serializeOpHttpBindingsListAssistantsInput(v *ListAssistantsInput, 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_serializeOpListContents struct { +} + +func (*awsRestjson1_serializeOpListContents) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListContents) 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.(*ListContentsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents") + 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_serializeOpHttpBindingsListContentsInput(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_serializeOpHttpBindingsListContentsInput(v *ListContentsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); 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_serializeOpListImportJobs struct { +} + +func (*awsRestjson1_serializeOpListImportJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListImportJobs) 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.(*ListImportJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/importJobs") + 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_serializeOpHttpBindingsListImportJobsInput(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_serializeOpHttpBindingsListImportJobsInput(v *ListImportJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); 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_serializeOpListKnowledgeBases struct { +} + +func (*awsRestjson1_serializeOpListKnowledgeBases) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListKnowledgeBases) 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.(*ListKnowledgeBasesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases") + 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_serializeOpHttpBindingsListKnowledgeBasesInput(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_serializeOpHttpBindingsListKnowledgeBasesInput(v *ListKnowledgeBasesInput, 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_serializeOpListQuickResponses struct { +} + +func (*awsRestjson1_serializeOpListQuickResponses) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListQuickResponses) 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.(*ListQuickResponsesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/quickResponses") + 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_serializeOpHttpBindingsListQuickResponsesInput(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_serializeOpHttpBindingsListQuickResponsesInput(v *ListQuickResponsesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); 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_serializeOpNotifyRecommendationsReceived struct { +} + +func (*awsRestjson1_serializeOpNotifyRecommendationsReceived) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpNotifyRecommendationsReceived) 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.(*NotifyRecommendationsReceivedInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/sessions/{sessionId}/recommendations/notify") + 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_serializeOpHttpBindingsNotifyRecommendationsReceivedInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentNotifyRecommendationsReceivedInput(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_serializeOpHttpBindingsNotifyRecommendationsReceivedInput(v *NotifyRecommendationsReceivedInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + if v.SessionId == nil || len(*v.SessionId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member sessionId must not be empty")} + } + if v.SessionId != nil { + if err := encoder.SetURI("sessionId").String(*v.SessionId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentNotifyRecommendationsReceivedInput(v *NotifyRecommendationsReceivedInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RecommendationIds != nil { + ok := object.Key("recommendationIds") + if err := awsRestjson1_serializeDocumentRecommendationIdList(v.RecommendationIds, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpQueryAssistant struct { +} + +func (*awsRestjson1_serializeOpQueryAssistant) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpQueryAssistant) 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.(*QueryAssistantInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/query") + 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_serializeOpHttpBindingsQueryAssistantInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentQueryAssistantInput(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_serializeOpHttpBindingsQueryAssistantInput(v *QueryAssistantInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentQueryAssistantInput(v *QueryAssistantInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("maxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("nextToken") + ok.String(*v.NextToken) + } + + if v.QueryCondition != nil { + ok := object.Key("queryCondition") + if err := awsRestjson1_serializeDocumentQueryConditionExpression(v.QueryCondition, ok); err != nil { + return err + } + } + + if v.QueryText != nil { + ok := object.Key("queryText") + ok.String(*v.QueryText) + } + + if v.SessionId != nil { + ok := object.Key("sessionId") + ok.String(*v.SessionId) + } + + return nil +} + +type awsRestjson1_serializeOpRemoveKnowledgeBaseTemplateUri struct { +} + +func (*awsRestjson1_serializeOpRemoveKnowledgeBaseTemplateUri) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpRemoveKnowledgeBaseTemplateUri) 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.(*RemoveKnowledgeBaseTemplateUriInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/templateUri") + 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_serializeOpHttpBindingsRemoveKnowledgeBaseTemplateUriInput(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_serializeOpHttpBindingsRemoveKnowledgeBaseTemplateUriInput(v *RemoveKnowledgeBaseTemplateUriInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpSearchContent struct { +} + +func (*awsRestjson1_serializeOpSearchContent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSearchContent) 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.(*SearchContentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/search") + 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_serializeOpHttpBindingsSearchContentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSearchContentInput(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_serializeOpHttpBindingsSearchContentInput(v *SearchContentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); 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 +} + +func awsRestjson1_serializeOpDocumentSearchContentInput(v *SearchContentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SearchExpression != nil { + ok := object.Key("searchExpression") + if err := awsRestjson1_serializeDocumentSearchExpression(v.SearchExpression, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpSearchQuickResponses struct { +} + +func (*awsRestjson1_serializeOpSearchQuickResponses) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSearchQuickResponses) 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.(*SearchQuickResponsesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/search/quickResponses") + 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_serializeOpHttpBindingsSearchQuickResponsesInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSearchQuickResponsesInput(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_serializeOpHttpBindingsSearchQuickResponsesInput(v *SearchQuickResponsesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); 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 +} + +func awsRestjson1_serializeOpDocumentSearchQuickResponsesInput(v *SearchQuickResponsesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Attributes != nil { + ok := object.Key("attributes") + if err := awsRestjson1_serializeDocumentContactAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.SearchExpression != nil { + ok := object.Key("searchExpression") + if err := awsRestjson1_serializeDocumentQuickResponseSearchExpression(v.SearchExpression, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpSearchSessions struct { +} + +func (*awsRestjson1_serializeOpSearchSessions) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSearchSessions) 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.(*SearchSessionsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/searchSessions") + 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_serializeOpHttpBindingsSearchSessionsInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSearchSessionsInput(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_serializeOpHttpBindingsSearchSessionsInput(v *SearchSessionsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); 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 +} + +func awsRestjson1_serializeOpDocumentSearchSessionsInput(v *SearchSessionsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SearchExpression != nil { + ok := object.Key("searchExpression") + if err := awsRestjson1_serializeDocumentSearchExpression(v.SearchExpression, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpStartContentUpload struct { +} + +func (*awsRestjson1_serializeOpStartContentUpload) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartContentUpload) 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.(*StartContentUploadInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/upload") + 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_serializeOpHttpBindingsStartContentUploadInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentStartContentUploadInput(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_serializeOpHttpBindingsStartContentUploadInput(v *StartContentUploadInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartContentUploadInput(v *StartContentUploadInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ContentType != nil { + ok := object.Key("contentType") + ok.String(*v.ContentType) + } + + if v.PresignedUrlTimeToLive != nil { + ok := object.Key("presignedUrlTimeToLive") + ok.Integer(*v.PresignedUrlTimeToLive) + } + + return nil +} + +type awsRestjson1_serializeOpStartImportJob struct { +} + +func (*awsRestjson1_serializeOpStartImportJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartImportJob) 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.(*StartImportJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/importJobs") + 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_serializeOpHttpBindingsStartImportJobInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentStartImportJobInput(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_serializeOpHttpBindingsStartImportJobInput(v *StartImportJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartImportJobInput(v *StartImportJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.ExternalSourceConfiguration != nil { + ok := object.Key("externalSourceConfiguration") + if err := awsRestjson1_serializeDocumentExternalSourceConfiguration(v.ExternalSourceConfiguration, ok); err != nil { + return err + } + } + + if len(v.ImportJobType) > 0 { + ok := object.Key("importJobType") + ok.String(string(v.ImportJobType)) + } + + if v.Metadata != nil { + ok := object.Key("metadata") + if err := awsRestjson1_serializeDocumentContentMetadata(v.Metadata, ok); err != nil { + return err + } + } + + if v.UploadId != nil { + ok := object.Key("uploadId") + ok.String(*v.UploadId) + } + + 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_serializeOpUpdateContent struct { +} + +func (*awsRestjson1_serializeOpUpdateContent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateContent) 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.(*UpdateContentInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/contents/{contentId}") + 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_serializeOpHttpBindingsUpdateContentInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateContentInput(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_serializeOpHttpBindingsUpdateContentInput(v *UpdateContentInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ContentId == nil || len(*v.ContentId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member contentId must not be empty")} + } + if v.ContentId != nil { + if err := encoder.SetURI("contentId").String(*v.ContentId); err != nil { + return err + } + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateContentInput(v *UpdateContentInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Metadata != nil { + ok := object.Key("metadata") + if err := awsRestjson1_serializeDocumentContentMetadata(v.Metadata, ok); err != nil { + return err + } + } + + if v.OverrideLinkOutUri != nil { + ok := object.Key("overrideLinkOutUri") + ok.String(*v.OverrideLinkOutUri) + } + + if v.RemoveOverrideLinkOutUri != nil { + ok := object.Key("removeOverrideLinkOutUri") + ok.Boolean(*v.RemoveOverrideLinkOutUri) + } + + if v.RevisionId != nil { + ok := object.Key("revisionId") + ok.String(*v.RevisionId) + } + + if v.Title != nil { + ok := object.Key("title") + ok.String(*v.Title) + } + + if v.UploadId != nil { + ok := object.Key("uploadId") + ok.String(*v.UploadId) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateKnowledgeBaseTemplateUri struct { +} + +func (*awsRestjson1_serializeOpUpdateKnowledgeBaseTemplateUri) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateKnowledgeBaseTemplateUri) 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.(*UpdateKnowledgeBaseTemplateUriInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/templateUri") + 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_serializeOpHttpBindingsUpdateKnowledgeBaseTemplateUriInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateKnowledgeBaseTemplateUriInput(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_serializeOpHttpBindingsUpdateKnowledgeBaseTemplateUriInput(v *UpdateKnowledgeBaseTemplateUriInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateKnowledgeBaseTemplateUriInput(v *UpdateKnowledgeBaseTemplateUriInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.TemplateUri != nil { + ok := object.Key("templateUri") + ok.String(*v.TemplateUri) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateQuickResponse struct { +} + +func (*awsRestjson1_serializeOpUpdateQuickResponse) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateQuickResponse) 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.(*UpdateQuickResponseInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/knowledgeBases/{knowledgeBaseId}/quickResponses/{quickResponseId}") + 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_serializeOpHttpBindingsUpdateQuickResponseInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateQuickResponseInput(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_serializeOpHttpBindingsUpdateQuickResponseInput(v *UpdateQuickResponseInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.KnowledgeBaseId == nil || len(*v.KnowledgeBaseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member knowledgeBaseId must not be empty")} + } + if v.KnowledgeBaseId != nil { + if err := encoder.SetURI("knowledgeBaseId").String(*v.KnowledgeBaseId); err != nil { + return err + } + } + + if v.QuickResponseId == nil || len(*v.QuickResponseId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member quickResponseId must not be empty")} + } + if v.QuickResponseId != nil { + if err := encoder.SetURI("quickResponseId").String(*v.QuickResponseId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateQuickResponseInput(v *UpdateQuickResponseInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Channels != nil { + ok := object.Key("channels") + if err := awsRestjson1_serializeDocumentChannels(v.Channels, ok); err != nil { + return err + } + } + + if v.Content != nil { + ok := object.Key("content") + if err := awsRestjson1_serializeDocumentQuickResponseDataProvider(v.Content, ok); err != nil { + return err + } + } + + if v.ContentType != nil { + ok := object.Key("contentType") + ok.String(*v.ContentType) + } + + if v.Description != nil { + ok := object.Key("description") + ok.String(*v.Description) + } + + if v.GroupingConfiguration != nil { + ok := object.Key("groupingConfiguration") + if err := awsRestjson1_serializeDocumentGroupingConfiguration(v.GroupingConfiguration, ok); err != nil { + return err + } + } + + if v.IsActive != nil { + ok := object.Key("isActive") + ok.Boolean(*v.IsActive) + } + + if v.Language != nil { + ok := object.Key("language") + ok.String(*v.Language) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RemoveDescription != nil { + ok := object.Key("removeDescription") + ok.Boolean(*v.RemoveDescription) + } + + if v.RemoveGroupingConfiguration != nil { + ok := object.Key("removeGroupingConfiguration") + ok.Boolean(*v.RemoveGroupingConfiguration) + } + + if v.RemoveShortcutKey != nil { + ok := object.Key("removeShortcutKey") + ok.Boolean(*v.RemoveShortcutKey) + } + + if v.ShortcutKey != nil { + ok := object.Key("shortcutKey") + ok.String(*v.ShortcutKey) + } + + return nil +} + +func awsRestjson1_serializeDocumentAppIntegrationsConfiguration(v *types.AppIntegrationsConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AppIntegrationArn != nil { + ok := object.Key("appIntegrationArn") + ok.String(*v.AppIntegrationArn) + } + + if v.ObjectFields != nil { + ok := object.Key("objectFields") + if err := awsRestjson1_serializeDocumentObjectFieldsList(v.ObjectFields, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentAssistantAssociationInputData(v types.AssistantAssociationInputData, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.AssistantAssociationInputDataMemberKnowledgeBaseId: + av := object.Key("knowledgeBaseId") + av.String(uv.Value) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentChannels(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_serializeDocumentConfiguration(v types.Configuration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.ConfigurationMemberConnectConfiguration: + av := object.Key("connectConfiguration") + if err := awsRestjson1_serializeDocumentConnectConfiguration(&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_serializeDocumentConnectConfiguration(v *types.ConnectConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.InstanceId != nil { + ok := object.Key("instanceId") + ok.String(*v.InstanceId) + } + + return nil +} + +func awsRestjson1_serializeDocumentContactAttributes(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_serializeDocumentContentMetadata(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_serializeDocumentExternalSourceConfiguration(v *types.ExternalSourceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Configuration != nil { + ok := object.Key("configuration") + if err := awsRestjson1_serializeDocumentConfiguration(v.Configuration, ok); err != nil { + return err + } + } + + if len(v.Source) > 0 { + ok := object.Key("source") + ok.String(string(v.Source)) + } + + return nil +} + +func awsRestjson1_serializeDocumentFilter(v *types.Filter, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Field) > 0 { + ok := object.Key("field") + ok.String(string(v.Field)) + } + + if len(v.Operator) > 0 { + ok := object.Key("operator") + ok.String(string(v.Operator)) + } + + if v.Value != nil { + ok := object.Key("value") + ok.String(*v.Value) + } + + return nil +} + +func awsRestjson1_serializeDocumentFilterList(v []types.Filter, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentFilter(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentGroupingConfiguration(v *types.GroupingConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Criteria != nil { + ok := object.Key("criteria") + ok.String(*v.Criteria) + } + + if v.Values != nil { + ok := object.Key("values") + if err := awsRestjson1_serializeDocumentGroupingValues(v.Values, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentGroupingValues(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_serializeDocumentObjectFieldsList(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_serializeDocumentQueryCondition(v types.QueryCondition, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.QueryConditionMemberSingle: + av := object.Key("single") + if err := awsRestjson1_serializeDocumentQueryConditionItem(&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_serializeDocumentQueryConditionExpression(v []types.QueryCondition, 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_serializeDocumentQueryCondition(v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentQueryConditionItem(v *types.QueryConditionItem, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Comparator) > 0 { + ok := object.Key("comparator") + ok.String(string(v.Comparator)) + } + + if len(v.Field) > 0 { + ok := object.Key("field") + ok.String(string(v.Field)) + } + + if v.Value != nil { + ok := object.Key("value") + ok.String(*v.Value) + } + + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseDataProvider(v types.QuickResponseDataProvider, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.QuickResponseDataProviderMemberContent: + av := object.Key("content") + av.String(uv.Value) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseFilterField(v *types.QuickResponseFilterField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.IncludeNoExistence != nil { + ok := object.Key("includeNoExistence") + ok.Boolean(*v.IncludeNoExistence) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if len(v.Operator) > 0 { + ok := object.Key("operator") + ok.String(string(v.Operator)) + } + + if v.Values != nil { + ok := object.Key("values") + if err := awsRestjson1_serializeDocumentQuickResponseFilterValueList(v.Values, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseFilterFieldList(v []types.QuickResponseFilterField, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentQuickResponseFilterField(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseFilterValueList(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_serializeDocumentQuickResponseOrderField(v *types.QuickResponseOrderField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if len(v.Order) > 0 { + ok := object.Key("order") + ok.String(string(v.Order)) + } + + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseQueryField(v *types.QuickResponseQueryField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AllowFuzziness != nil { + ok := object.Key("allowFuzziness") + ok.Boolean(*v.AllowFuzziness) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if len(v.Operator) > 0 { + ok := object.Key("operator") + ok.String(string(v.Operator)) + } + + if len(v.Priority) > 0 { + ok := object.Key("priority") + ok.String(string(v.Priority)) + } + + if v.Values != nil { + ok := object.Key("values") + if err := awsRestjson1_serializeDocumentQuickResponseQueryValueList(v.Values, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseQueryFieldList(v []types.QuickResponseQueryField, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentQuickResponseQueryField(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentQuickResponseQueryValueList(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_serializeDocumentQuickResponseSearchExpression(v *types.QuickResponseSearchExpression, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Filters != nil { + ok := object.Key("filters") + if err := awsRestjson1_serializeDocumentQuickResponseFilterFieldList(v.Filters, ok); err != nil { + return err + } + } + + if v.OrderOnField != nil { + ok := object.Key("orderOnField") + if err := awsRestjson1_serializeDocumentQuickResponseOrderField(v.OrderOnField, ok); err != nil { + return err + } + } + + if v.Queries != nil { + ok := object.Key("queries") + if err := awsRestjson1_serializeDocumentQuickResponseQueryFieldList(v.Queries, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentRecommendationIdList(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_serializeDocumentRenderingConfiguration(v *types.RenderingConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.TemplateUri != nil { + ok := object.Key("templateUri") + ok.String(*v.TemplateUri) + } + + return nil +} + +func awsRestjson1_serializeDocumentSearchExpression(v *types.SearchExpression, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Filters != nil { + ok := object.Key("filters") + if err := awsRestjson1_serializeDocumentFilterList(v.Filters, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentServerSideEncryptionConfiguration(v *types.ServerSideEncryptionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KmsKeyId != nil { + ok := object.Key("kmsKeyId") + ok.String(*v.KmsKeyId) + } + + return nil +} + +func awsRestjson1_serializeDocumentSourceConfiguration(v types.SourceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.SourceConfigurationMemberAppIntegrations: + av := object.Key("appIntegrations") + if err := awsRestjson1_serializeDocumentAppIntegrationsConfiguration(&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_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 +} diff --git a/service/qconnect/types/enums.go b/service/qconnect/types/enums.go new file mode 100644 index 00000000000..d2d7bd290e1 --- /dev/null +++ b/service/qconnect/types/enums.go @@ -0,0 +1,492 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type AssistantCapabilityType string + +// Enum values for AssistantCapabilityType +const ( + AssistantCapabilityTypeV1 AssistantCapabilityType = "V1" + AssistantCapabilityTypeV2 AssistantCapabilityType = "V2" +) + +// Values returns all known values for AssistantCapabilityType. 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 (AssistantCapabilityType) Values() []AssistantCapabilityType { + return []AssistantCapabilityType{ + "V1", + "V2", + } +} + +type AssistantStatus string + +// Enum values for AssistantStatus +const ( + AssistantStatusCreateInProgress AssistantStatus = "CREATE_IN_PROGRESS" + AssistantStatusCreateFailed AssistantStatus = "CREATE_FAILED" + AssistantStatusActive AssistantStatus = "ACTIVE" + AssistantStatusDeleteInProgress AssistantStatus = "DELETE_IN_PROGRESS" + AssistantStatusDeleteFailed AssistantStatus = "DELETE_FAILED" + AssistantStatusDeleted AssistantStatus = "DELETED" +) + +// Values returns all known values for AssistantStatus. 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 (AssistantStatus) Values() []AssistantStatus { + return []AssistantStatus{ + "CREATE_IN_PROGRESS", + "CREATE_FAILED", + "ACTIVE", + "DELETE_IN_PROGRESS", + "DELETE_FAILED", + "DELETED", + } +} + +type AssistantType string + +// Enum values for AssistantType +const ( + AssistantTypeAgent AssistantType = "AGENT" +) + +// Values returns all known values for AssistantType. 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 (AssistantType) Values() []AssistantType { + return []AssistantType{ + "AGENT", + } +} + +type AssociationType string + +// Enum values for AssociationType +const ( + AssociationTypeKnowledgeBase AssociationType = "KNOWLEDGE_BASE" +) + +// Values returns all known values for AssociationType. 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 (AssociationType) Values() []AssociationType { + return []AssociationType{ + "KNOWLEDGE_BASE", + } +} + +type ContentStatus string + +// Enum values for ContentStatus +const ( + ContentStatusCreateInProgress ContentStatus = "CREATE_IN_PROGRESS" + ContentStatusCreateFailed ContentStatus = "CREATE_FAILED" + ContentStatusActive ContentStatus = "ACTIVE" + ContentStatusDeleteInProgress ContentStatus = "DELETE_IN_PROGRESS" + ContentStatusDeleteFailed ContentStatus = "DELETE_FAILED" + ContentStatusDeleted ContentStatus = "DELETED" + ContentStatusUpdateFailed ContentStatus = "UPDATE_FAILED" +) + +// Values returns all known values for ContentStatus. 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 (ContentStatus) Values() []ContentStatus { + return []ContentStatus{ + "CREATE_IN_PROGRESS", + "CREATE_FAILED", + "ACTIVE", + "DELETE_IN_PROGRESS", + "DELETE_FAILED", + "DELETED", + "UPDATE_FAILED", + } +} + +type ExternalSource string + +// Enum values for ExternalSource +const ( + ExternalSourceAmazonConnect ExternalSource = "AMAZON_CONNECT" +) + +// Values returns all known values for ExternalSource. 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 (ExternalSource) Values() []ExternalSource { + return []ExternalSource{ + "AMAZON_CONNECT", + } +} + +type FilterField string + +// Enum values for FilterField +const ( + FilterFieldName FilterField = "NAME" +) + +// Values returns all known values for FilterField. 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 (FilterField) Values() []FilterField { + return []FilterField{ + "NAME", + } +} + +type FilterOperator string + +// Enum values for FilterOperator +const ( + FilterOperatorEquals FilterOperator = "EQUALS" +) + +// Values returns all known values for FilterOperator. 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 (FilterOperator) Values() []FilterOperator { + return []FilterOperator{ + "EQUALS", + } +} + +type ImportJobStatus string + +// Enum values for ImportJobStatus +const ( + ImportJobStatusStartInProgress ImportJobStatus = "START_IN_PROGRESS" + ImportJobStatusFailed ImportJobStatus = "FAILED" + ImportJobStatusComplete ImportJobStatus = "COMPLETE" + ImportJobStatusDeleteInProgress ImportJobStatus = "DELETE_IN_PROGRESS" + ImportJobStatusDeleteFailed ImportJobStatus = "DELETE_FAILED" + ImportJobStatusDeleted ImportJobStatus = "DELETED" +) + +// Values returns all known values for ImportJobStatus. 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 (ImportJobStatus) Values() []ImportJobStatus { + return []ImportJobStatus{ + "START_IN_PROGRESS", + "FAILED", + "COMPLETE", + "DELETE_IN_PROGRESS", + "DELETE_FAILED", + "DELETED", + } +} + +type ImportJobType string + +// Enum values for ImportJobType +const ( + ImportJobTypeQuickResponses ImportJobType = "QUICK_RESPONSES" +) + +// Values returns all known values for ImportJobType. 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 (ImportJobType) Values() []ImportJobType { + return []ImportJobType{ + "QUICK_RESPONSES", + } +} + +type KnowledgeBaseStatus string + +// Enum values for KnowledgeBaseStatus +const ( + KnowledgeBaseStatusCreateInProgress KnowledgeBaseStatus = "CREATE_IN_PROGRESS" + KnowledgeBaseStatusCreateFailed KnowledgeBaseStatus = "CREATE_FAILED" + KnowledgeBaseStatusActive KnowledgeBaseStatus = "ACTIVE" + KnowledgeBaseStatusDeleteInProgress KnowledgeBaseStatus = "DELETE_IN_PROGRESS" + KnowledgeBaseStatusDeleteFailed KnowledgeBaseStatus = "DELETE_FAILED" + KnowledgeBaseStatusDeleted KnowledgeBaseStatus = "DELETED" +) + +// Values returns all known values for KnowledgeBaseStatus. 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 (KnowledgeBaseStatus) Values() []KnowledgeBaseStatus { + return []KnowledgeBaseStatus{ + "CREATE_IN_PROGRESS", + "CREATE_FAILED", + "ACTIVE", + "DELETE_IN_PROGRESS", + "DELETE_FAILED", + "DELETED", + } +} + +type KnowledgeBaseType string + +// Enum values for KnowledgeBaseType +const ( + KnowledgeBaseTypeExternal KnowledgeBaseType = "EXTERNAL" + KnowledgeBaseTypeCustom KnowledgeBaseType = "CUSTOM" + KnowledgeBaseTypeQuickResponses KnowledgeBaseType = "QUICK_RESPONSES" +) + +// Values returns all known values for KnowledgeBaseType. 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 (KnowledgeBaseType) Values() []KnowledgeBaseType { + return []KnowledgeBaseType{ + "EXTERNAL", + "CUSTOM", + "QUICK_RESPONSES", + } +} + +type Order string + +// Enum values for Order +const ( + OrderAsc Order = "ASC" + OrderDesc Order = "DESC" +) + +// Values returns all known values for Order. 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 (Order) Values() []Order { + return []Order{ + "ASC", + "DESC", + } +} + +type Priority string + +// Enum values for Priority +const ( + PriorityHigh Priority = "HIGH" + PriorityMedium Priority = "MEDIUM" + PriorityLow Priority = "LOW" +) + +// Values returns all known values for Priority. 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 (Priority) Values() []Priority { + return []Priority{ + "HIGH", + "MEDIUM", + "LOW", + } +} + +type QueryConditionComparisonOperator string + +// Enum values for QueryConditionComparisonOperator +const ( + QueryConditionComparisonOperatorEquals QueryConditionComparisonOperator = "EQUALS" +) + +// Values returns all known values for QueryConditionComparisonOperator. 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 (QueryConditionComparisonOperator) Values() []QueryConditionComparisonOperator { + return []QueryConditionComparisonOperator{ + "EQUALS", + } +} + +type QueryConditionFieldName string + +// Enum values for QueryConditionFieldName +const ( + QueryConditionFieldNameResultType QueryConditionFieldName = "RESULT_TYPE" +) + +// Values returns all known values for QueryConditionFieldName. 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 (QueryConditionFieldName) Values() []QueryConditionFieldName { + return []QueryConditionFieldName{ + "RESULT_TYPE", + } +} + +type QueryResultType string + +// Enum values for QueryResultType +const ( + QueryResultTypeKnowledgeContent QueryResultType = "KNOWLEDGE_CONTENT" + QueryResultTypeGenerativeAnswer QueryResultType = "GENERATIVE_ANSWER" +) + +// Values returns all known values for QueryResultType. 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 (QueryResultType) Values() []QueryResultType { + return []QueryResultType{ + "KNOWLEDGE_CONTENT", + "GENERATIVE_ANSWER", + } +} + +type QuickResponseFilterOperator string + +// Enum values for QuickResponseFilterOperator +const ( + QuickResponseFilterOperatorEquals QuickResponseFilterOperator = "EQUALS" + QuickResponseFilterOperatorPrefix QuickResponseFilterOperator = "PREFIX" +) + +// Values returns all known values for QuickResponseFilterOperator. 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 (QuickResponseFilterOperator) Values() []QuickResponseFilterOperator { + return []QuickResponseFilterOperator{ + "EQUALS", + "PREFIX", + } +} + +type QuickResponseQueryOperator string + +// Enum values for QuickResponseQueryOperator +const ( + QuickResponseQueryOperatorContains QuickResponseQueryOperator = "CONTAINS" + QuickResponseQueryOperatorContainsAndPrefix QuickResponseQueryOperator = "CONTAINS_AND_PREFIX" +) + +// Values returns all known values for QuickResponseQueryOperator. 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 (QuickResponseQueryOperator) Values() []QuickResponseQueryOperator { + return []QuickResponseQueryOperator{ + "CONTAINS", + "CONTAINS_AND_PREFIX", + } +} + +type QuickResponseStatus string + +// Enum values for QuickResponseStatus +const ( + QuickResponseStatusCreateInProgress QuickResponseStatus = "CREATE_IN_PROGRESS" + QuickResponseStatusCreateFailed QuickResponseStatus = "CREATE_FAILED" + QuickResponseStatusCreated QuickResponseStatus = "CREATED" + QuickResponseStatusDeleteInProgress QuickResponseStatus = "DELETE_IN_PROGRESS" + QuickResponseStatusDeleteFailed QuickResponseStatus = "DELETE_FAILED" + QuickResponseStatusDeleted QuickResponseStatus = "DELETED" + QuickResponseStatusUpdateInProgress QuickResponseStatus = "UPDATE_IN_PROGRESS" + QuickResponseStatusUpdateFailed QuickResponseStatus = "UPDATE_FAILED" +) + +// Values returns all known values for QuickResponseStatus. 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 (QuickResponseStatus) Values() []QuickResponseStatus { + return []QuickResponseStatus{ + "CREATE_IN_PROGRESS", + "CREATE_FAILED", + "CREATED", + "DELETE_IN_PROGRESS", + "DELETE_FAILED", + "DELETED", + "UPDATE_IN_PROGRESS", + "UPDATE_FAILED", + } +} + +type RecommendationSourceType string + +// Enum values for RecommendationSourceType +const ( + RecommendationSourceTypeIssueDetection RecommendationSourceType = "ISSUE_DETECTION" + RecommendationSourceTypeRuleEvaluation RecommendationSourceType = "RULE_EVALUATION" + RecommendationSourceTypeOther RecommendationSourceType = "OTHER" +) + +// Values returns all known values for RecommendationSourceType. 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 (RecommendationSourceType) Values() []RecommendationSourceType { + return []RecommendationSourceType{ + "ISSUE_DETECTION", + "RULE_EVALUATION", + "OTHER", + } +} + +type RecommendationTriggerType string + +// Enum values for RecommendationTriggerType +const ( + RecommendationTriggerTypeQuery RecommendationTriggerType = "QUERY" + RecommendationTriggerTypeGenerative RecommendationTriggerType = "GENERATIVE" +) + +// Values returns all known values for RecommendationTriggerType. 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 (RecommendationTriggerType) Values() []RecommendationTriggerType { + return []RecommendationTriggerType{ + "QUERY", + "GENERATIVE", + } +} + +type RecommendationType string + +// Enum values for RecommendationType +const ( + RecommendationTypeKnowledgeContent RecommendationType = "KNOWLEDGE_CONTENT" + RecommendationTypeGenerativeResponse RecommendationType = "GENERATIVE_RESPONSE" + RecommendationTypeGenerativeAnswer RecommendationType = "GENERATIVE_ANSWER" +) + +// Values returns all known values for RecommendationType. 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 (RecommendationType) Values() []RecommendationType { + return []RecommendationType{ + "KNOWLEDGE_CONTENT", + "GENERATIVE_RESPONSE", + "GENERATIVE_ANSWER", + } +} + +type RelevanceLevel string + +// Enum values for RelevanceLevel +const ( + RelevanceLevelHigh RelevanceLevel = "HIGH" + RelevanceLevelMedium RelevanceLevel = "MEDIUM" + RelevanceLevelLow RelevanceLevel = "LOW" +) + +// Values returns all known values for RelevanceLevel. 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 (RelevanceLevel) Values() []RelevanceLevel { + return []RelevanceLevel{ + "HIGH", + "MEDIUM", + "LOW", + } +} + +type SourceContentType string + +// Enum values for SourceContentType +const ( + SourceContentTypeKnowledgeContent SourceContentType = "KNOWLEDGE_CONTENT" +) + +// Values returns all known values for SourceContentType. 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 (SourceContentType) Values() []SourceContentType { + return []SourceContentType{ + "KNOWLEDGE_CONTENT", + } +} diff --git a/service/qconnect/types/errors.go b/service/qconnect/types/errors.go new file mode 100644 index 00000000000..eaa44a693ba --- /dev/null +++ b/service/qconnect/types/errors.go @@ -0,0 +1,230 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// You do not have sufficient access to perform this action. +type AccessDeniedException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "AccessDeniedException" + } + return *e.ErrorCodeOverride +} +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The request could not be processed because of conflict in the current state of +// the resource. For example, if you're using a Create API (such as CreateAssistant +// ) that accepts name, a conflicting resource (usually with the same name) is +// being created or mutated. +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The provided revisionId does not match, indicating the content has been +// modified since it was last read. +type PreconditionFailedException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *PreconditionFailedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *PreconditionFailedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *PreconditionFailedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "PreconditionFailedException" + } + return *e.ErrorCodeOverride +} +func (e *PreconditionFailedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The request reached the service more than 15 minutes after the date stamp on +// the request or more than 15 minutes after the request expiration date (such as +// for pre-signed URLs), or the date stamp on the request is more than 15 minutes +// in the future. +type RequestTimeoutException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *RequestTimeoutException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *RequestTimeoutException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *RequestTimeoutException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "RequestTimeoutException" + } + return *e.ErrorCodeOverride +} +func (e *RequestTimeoutException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The specified resource does not exist. +type ResourceNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + ResourceName *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 } + +// You've exceeded your service quota. To perform the requested action, remove +// some of the relevant resources, or use service quotas to request a service quota +// increase. +type ServiceQuotaExceededException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceQuotaExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceQuotaExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServiceQuotaExceededException" + } + return *e.ErrorCodeOverride +} +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Amazon Q in Connect throws this exception if you have too many tags in your tag +// set. +type TooManyTagsException struct { + Message *string + + ErrorCodeOverride *string + + ResourceName *string + + noSmithyDocumentSerde +} + +func (e *TooManyTagsException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *TooManyTagsException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *TooManyTagsException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "TooManyTagsException" + } + return *e.ErrorCodeOverride +} +func (e *TooManyTagsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The input fails to satisfy the constraints specified by a service. +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ValidationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ValidationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ValidationException" + } + return *e.ErrorCodeOverride +} +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/qconnect/types/types.go b/service/qconnect/types/types.go new file mode 100644 index 00000000000..1b6ee013778 --- /dev/null +++ b/service/qconnect/types/types.go @@ -0,0 +1,1744 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// Configuration information for Amazon AppIntegrations to automatically ingest +// content. +type AppIntegrationsConfiguration struct { + + // The Amazon Resource Name (ARN) of the AppIntegrations DataIntegration to use + // for ingesting content. + // - For Salesforce (https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledge__kav.htm) + // , your AppIntegrations DataIntegration must have an ObjectConfiguration if + // objectFields is not provided, including at least Id , ArticleNumber , + // VersionNumber , Title , PublishStatus , and IsDeleted as source fields. + // - For ServiceNow (https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/knowledge-management-api) + // , your AppIntegrations DataIntegration must have an ObjectConfiguration if + // objectFields is not provided, including at least number , short_description , + // sys_mod_count , workflow_state , and active as source fields. + // - For Zendesk (https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/) + // , your AppIntegrations DataIntegration must have an ObjectConfiguration if + // objectFields is not provided, including at least id , title , updated_at , and + // draft as source fields. + // - For SharePoint (https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/sharepoint-net-server-csom-jsom-and-rest-api-index) + // , your AppIntegrations DataIntegration must have a FileConfiguration, including + // only file extensions that are among docx , pdf , html , htm , and txt . + // - For Amazon S3 (https://aws.amazon.com/s3/) , the ObjectConfiguration and + // FileConfiguration of your AppIntegrations DataIntegration must be null. The + // SourceURI of your DataIntegration must use the following format: + // s3://your_s3_bucket_name . The bucket policy of the corresponding S3 bucket + // must allow the Amazon Web Services principal app-integrations.amazonaws.com to + // perform s3:ListBucket , s3:GetObject , and s3:GetBucketLocation against the + // bucket. + // + // This member is required. + AppIntegrationArn *string + + // The fields from the source that are made available to your agents in Amazon Q. + // Optional if ObjectConfiguration is included in the provided DataIntegration. + // - For Salesforce (https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/sforce_api_objects_knowledge__kav.htm) + // , you must include at least Id , ArticleNumber , VersionNumber , Title , + // PublishStatus , and IsDeleted . + // - For ServiceNow (https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/knowledge-management-api) + // , you must include at least number , short_description , sys_mod_count , + // workflow_state , and active . + // - For Zendesk (https://developer.zendesk.com/api-reference/help_center/help-center-api/articles/) + // , you must include at least id , title , updated_at , and draft . + // Make sure to include additional fields. These fields are indexed and used to + // source recommendations. + ObjectFields []string + + noSmithyDocumentSerde +} + +// Information about the assistant association. +type AssistantAssociationData struct { + + // The Amazon Resource Name (ARN) of the Amazon Q assistant. + // + // This member is required. + AssistantArn *string + + // The Amazon Resource Name (ARN) of the assistant association. + // + // This member is required. + AssistantAssociationArn *string + + // The identifier of the assistant association. + // + // This member is required. + AssistantAssociationId *string + + // The identifier of the Amazon Q assistant. + // + // This member is required. + AssistantId *string + + // A union type that currently has a single argument, the knowledge base ID. + // + // This member is required. + AssociationData AssistantAssociationOutputData + + // The type of association. + // + // This member is required. + AssociationType AssociationType + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The data that is input into Amazon Q as a result of the assistant association. +// +// The following types satisfy this interface: +// +// AssistantAssociationInputDataMemberKnowledgeBaseId +type AssistantAssociationInputData interface { + isAssistantAssociationInputData() +} + +// The identifier of the knowledge base. This should not be a QUICK_RESPONSES type +// knowledge base if you're storing Amazon Q Content resource to it. +type AssistantAssociationInputDataMemberKnowledgeBaseId struct { + Value string + + noSmithyDocumentSerde +} + +func (*AssistantAssociationInputDataMemberKnowledgeBaseId) isAssistantAssociationInputData() {} + +// The data that is output as a result of the assistant association. +// +// The following types satisfy this interface: +// +// AssistantAssociationOutputDataMemberKnowledgeBaseAssociation +type AssistantAssociationOutputData interface { + isAssistantAssociationOutputData() +} + +// The knowledge base where output data is sent. +type AssistantAssociationOutputDataMemberKnowledgeBaseAssociation struct { + Value KnowledgeBaseAssociationData + + noSmithyDocumentSerde +} + +func (*AssistantAssociationOutputDataMemberKnowledgeBaseAssociation) isAssistantAssociationOutputData() { +} + +// Summary information about the assistant association. +type AssistantAssociationSummary struct { + + // The Amazon Resource Name (ARN) of the Amazon Q assistant. + // + // This member is required. + AssistantArn *string + + // The Amazon Resource Name (ARN) of the assistant association. + // + // This member is required. + AssistantAssociationArn *string + + // The identifier of the assistant association. + // + // This member is required. + AssistantAssociationId *string + + // The identifier of the Amazon Q assistant. + // + // This member is required. + AssistantId *string + + // The association data. + // + // This member is required. + AssociationData AssistantAssociationOutputData + + // The type of association. + // + // This member is required. + AssociationType AssociationType + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The capability configuration for a Amazon Q assistant. +type AssistantCapabilityConfiguration struct { + + // The type of Amazon Q assistant capability. + Type AssistantCapabilityType + + noSmithyDocumentSerde +} + +// The assistant data. +type AssistantData struct { + + // The Amazon Resource Name (ARN) of the Amazon Q assistant. + // + // This member is required. + AssistantArn *string + + // The identifier of the Amazon Q assistant. + // + // This member is required. + AssistantId *string + + // The name. + // + // This member is required. + Name *string + + // The status of the assistant. + // + // This member is required. + Status AssistantStatus + + // The type of assistant. + // + // This member is required. + Type AssistantType + + // The configuration information for the Amazon Q assistant capability. + CapabilityConfiguration *AssistantCapabilityConfiguration + + // The description. + Description *string + + // The configuration information for the Amazon Q assistant integration. + IntegrationConfiguration *AssistantIntegrationConfiguration + + // The configuration information for the customer managed key used for encryption. + // This KMS key must have a policy that allows kms:CreateGrant , kms:DescribeKey , + // kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM identity using + // the key to invoke Amazon Q. To use Amazon Q with chat, the key policy must also + // allow kms:Decrypt , kms:GenerateDataKey* , and kms:DescribeKey permissions to + // the connect.amazonaws.com service principal. For more information about setting + // up a customer managed key for Amazon Q, see Enable Amazon Q in Connect for your + // instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) . + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The configuration information for the Amazon Q assistant integration. +type AssistantIntegrationConfiguration struct { + + // The Amazon Resource Name (ARN) of the integrated Amazon SNS topic used for + // streaming chat messages. + TopicIntegrationArn *string + + noSmithyDocumentSerde +} + +// Summary information about the assistant. +type AssistantSummary struct { + + // The Amazon Resource Name (ARN) of the Amazon Q assistant. + // + // This member is required. + AssistantArn *string + + // The identifier of the Amazon Q assistant. + // + // This member is required. + AssistantId *string + + // The name of the assistant. + // + // This member is required. + Name *string + + // The status of the assistant. + // + // This member is required. + Status AssistantStatus + + // The type of the assistant. + // + // This member is required. + Type AssistantType + + // The configuration information for the Amazon Q assistant capability. + CapabilityConfiguration *AssistantCapabilityConfiguration + + // The description of the assistant. + Description *string + + // The configuration information for the Amazon Q assistant integration. + IntegrationConfiguration *AssistantIntegrationConfiguration + + // The configuration information for the customer managed key used for encryption. + // This KMS key must have a policy that allows kms:CreateGrant , kms:DescribeKey , + // kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM identity using + // the key to invoke Amazon Q. To use Amazon Q with chat, the key policy must also + // allow kms:Decrypt , kms:GenerateDataKey* , and kms:DescribeKey permissions to + // the connect.amazonaws.com service principal. For more information about setting + // up a customer managed key for Amazon Q, see Enable Amazon Q in Connect for your + // instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) . + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The configuration information of the external data source. +// +// The following types satisfy this interface: +// +// ConfigurationMemberConnectConfiguration +type Configuration interface { + isConfiguration() +} + +// The configuration information of the Amazon Connect data source. +type ConfigurationMemberConnectConfiguration struct { + Value ConnectConfiguration + + noSmithyDocumentSerde +} + +func (*ConfigurationMemberConnectConfiguration) isConfiguration() {} + +// The configuration information of the Amazon Connect data source. +type ConnectConfiguration struct { + + // The identifier of the Amazon Connect instance. You can find the instanceId in + // the ARN of the instance. + InstanceId *string + + noSmithyDocumentSerde +} + +// Information about the content. +type ContentData struct { + + // The Amazon Resource Name (ARN) of the content. + // + // This member is required. + ContentArn *string + + // The identifier of the content. + // + // This member is required. + ContentId *string + + // The media type of the content. + // + // This member is required. + ContentType *string + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // A key/value map to store attributes without affecting tagging or + // recommendations. For example, when synchronizing data between an external system + // and Amazon Q, you can store an external version identifier as metadata to + // utilize for determining drift. + // + // This member is required. + Metadata map[string]string + + // The name of the content. + // + // This member is required. + Name *string + + // The identifier of the content revision. + // + // This member is required. + RevisionId *string + + // The status of the content. + // + // This member is required. + Status ContentStatus + + // The title of the content. + // + // This member is required. + Title *string + + // The URL of the content. + // + // This member is required. + Url *string + + // The expiration time of the URL as an epoch timestamp. + // + // This member is required. + UrlExpiry *time.Time + + // The URI of the content. + LinkOutUri *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// Details about the content data. +type ContentDataDetails struct { + + // Details about the content ranking data. + // + // This member is required. + RankingData *RankingData + + // Details about the content text data. + // + // This member is required. + TextData *TextData + + noSmithyDocumentSerde +} + +// Reference information about the content. +type ContentReference struct { + + // The Amazon Resource Name (ARN) of the content. + ContentArn *string + + // The identifier of the content. + ContentId *string + + // The Amazon Resource Name (ARN) of the knowledge base. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +// Summary information about the content. +type ContentSummary struct { + + // The Amazon Resource Name (ARN) of the content. + // + // This member is required. + ContentArn *string + + // The identifier of the content. + // + // This member is required. + ContentId *string + + // The media type of the content. + // + // This member is required. + ContentType *string + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // A key/value map to store attributes without affecting tagging or + // recommendations. For example, when synchronizing data between an external system + // and Amazon Q, you can store an external version identifier as metadata to + // utilize for determining drift. + // + // This member is required. + Metadata map[string]string + + // The name of the content. + // + // This member is required. + Name *string + + // The identifier of the revision of the content. + // + // This member is required. + RevisionId *string + + // The status of the content. + // + // This member is required. + Status ContentStatus + + // The title of the content. + // + // This member is required. + Title *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// Details about the data. +// +// The following types satisfy this interface: +// +// DataDetailsMemberContentData +// DataDetailsMemberGenerativeData +// DataDetailsMemberSourceContentData +type DataDetails interface { + isDataDetails() +} + +// Details about the content data. +type DataDetailsMemberContentData struct { + Value ContentDataDetails + + noSmithyDocumentSerde +} + +func (*DataDetailsMemberContentData) isDataDetails() {} + +// Details about the generative data. +type DataDetailsMemberGenerativeData struct { + Value GenerativeDataDetails + + noSmithyDocumentSerde +} + +func (*DataDetailsMemberGenerativeData) isDataDetails() {} + +// Details about the content data. +type DataDetailsMemberSourceContentData struct { + Value SourceContentDataDetails + + noSmithyDocumentSerde +} + +func (*DataDetailsMemberSourceContentData) isDataDetails() {} + +// Reference data. +// +// The following types satisfy this interface: +// +// DataReferenceMemberContentReference +// DataReferenceMemberGenerativeReference +type DataReference interface { + isDataReference() +} + +// Reference information about the content. +type DataReferenceMemberContentReference struct { + Value ContentReference + + noSmithyDocumentSerde +} + +func (*DataReferenceMemberContentReference) isDataReference() {} + +// Reference information about the generative content. +type DataReferenceMemberGenerativeReference struct { + Value GenerativeReference + + noSmithyDocumentSerde +} + +func (*DataReferenceMemberGenerativeReference) isDataReference() {} + +// Summary of the data. +type DataSummary struct { + + // Details about the data. + // + // This member is required. + Details DataDetails + + // Reference information about the content. + // + // This member is required. + Reference DataReference + + noSmithyDocumentSerde +} + +// The document. +type Document struct { + + // A reference to the content resource. + // + // This member is required. + ContentReference *ContentReference + + // The excerpt from the document. + Excerpt *DocumentText + + // The title of the document. + Title *DocumentText + + noSmithyDocumentSerde +} + +// The text of the document. +type DocumentText struct { + + // Highlights in the document text. + Highlights []Highlight + + // Text in the document. + Text *string + + noSmithyDocumentSerde +} + +// The configuration information of the external data source. +type ExternalSourceConfiguration struct { + + // The configuration information of the external data source. + // + // This member is required. + Configuration Configuration + + // The type of the external data source. + // + // This member is required. + Source ExternalSource + + noSmithyDocumentSerde +} + +// A search filter. +type Filter struct { + + // The field on which to filter. + // + // This member is required. + Field FilterField + + // The operator to use for comparing the field’s value with the provided value. + // + // This member is required. + Operator FilterOperator + + // The desired field value on which to filter. + // + // This member is required. + Value *string + + noSmithyDocumentSerde +} + +// Details about generative data. +type GenerativeDataDetails struct { + + // The LLM response. + // + // This member is required. + Completion *string + + // Details about the generative content ranking data. + // + // This member is required. + RankingData *RankingData + + // The references used to generative the LLM response. + // + // This member is required. + References []DataSummary + + noSmithyDocumentSerde +} + +// Reference information about generative content. +type GenerativeReference struct { + + // The identifier of the LLM model. + GenerationId *string + + // The identifier of the LLM model. + ModelId *string + + noSmithyDocumentSerde +} + +// The configuration information of the grouping of Amazon Q users. +type GroupingConfiguration struct { + + // The criteria used for grouping Amazon Q users. The following is the list of + // supported criteria values. + // - RoutingProfileArn : Grouping the users by their Amazon Connect routing + // profile ARN (https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html) + // . User should have SearchRoutingProfile (https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchRoutingProfiles.html) + // and DescribeRoutingProfile (https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeRoutingProfile.html) + // permissions when setting criteria to this value. + Criteria *string + + // The list of values that define different groups of Amazon Q users. + // - When setting criteria to RoutingProfileArn , you need to provide a list of + // ARNs of Amazon Connect routing profiles (https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html) + // as values of this parameter. + Values []string + + noSmithyDocumentSerde +} + +// Offset specification to describe highlighting of document excerpts for +// rendering search results and recommendations. +type Highlight struct { + + // The offset for the start of the highlight. + BeginOffsetInclusive int32 + + // The offset for the end of the highlight. + EndOffsetExclusive int32 + + noSmithyDocumentSerde +} + +// Summary information about the import job. +type ImportJobData struct { + + // The timestamp when the import job was created. + // + // This member is required. + CreatedTime *time.Time + + // The identifier of the import job. + // + // This member is required. + ImportJobId *string + + // The type of the import job. + // + // This member is required. + ImportJobType ImportJobType + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The timestamp when the import job data was last modified. + // + // This member is required. + LastModifiedTime *time.Time + + // The status of the import job. + // + // This member is required. + Status ImportJobStatus + + // A pointer to the uploaded asset. This value is returned by StartContentUpload (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html) + // . + // + // This member is required. + UploadId *string + + // The download link to the resource file that is uploaded to the import job. + // + // This member is required. + Url *string + + // The expiration time of the URL as an epoch timestamp. + // + // This member is required. + UrlExpiry *time.Time + + // The configuration information of the external data source. + ExternalSourceConfiguration *ExternalSourceConfiguration + + // The link to donwload the information of resource data that failed to be + // imported. + FailedRecordReport *string + + // The metadata fields of the imported Amazon Q resources. + Metadata map[string]string + + noSmithyDocumentSerde +} + +// Summary information about the import job. +type ImportJobSummary struct { + + // The timestamp when the import job was created. + // + // This member is required. + CreatedTime *time.Time + + // The identifier of the import job. + // + // This member is required. + ImportJobId *string + + // The type of import job. + // + // This member is required. + ImportJobType ImportJobType + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The timestamp when the import job was last modified. + // + // This member is required. + LastModifiedTime *time.Time + + // The status of the import job. + // + // This member is required. + Status ImportJobStatus + + // A pointer to the uploaded asset. This value is returned by StartContentUpload (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html) + // . + // + // This member is required. + UploadId *string + + // The configuration information of the external source that the resource data are + // imported from. + ExternalSourceConfiguration *ExternalSourceConfiguration + + // The metadata fields of the imported Amazon Q resources. + Metadata map[string]string + + noSmithyDocumentSerde +} + +// Association information about the knowledge base. +type KnowledgeBaseAssociationData struct { + + // The Amazon Resource Name (ARN) of the knowledge base. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + KnowledgeBaseId *string + + noSmithyDocumentSerde +} + +// Information about the knowledge base. +type KnowledgeBaseData struct { + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The type of knowledge base. + // + // This member is required. + KnowledgeBaseType KnowledgeBaseType + + // The name of the knowledge base. + // + // This member is required. + Name *string + + // The status of the knowledge base. + // + // This member is required. + Status KnowledgeBaseStatus + + // The description. + Description *string + + // An epoch timestamp indicating the most recent content modification inside the + // knowledge base. If no content exists in a knowledge base, this value is unset. + LastContentModificationTime *time.Time + + // Information about how to render the content. + RenderingConfiguration *RenderingConfiguration + + // The configuration information for the customer managed key used for encryption. + // This KMS key must have a policy that allows kms:CreateGrant , kms:DescribeKey , + // kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM identity using + // the key to invoke Amazon Q. For more information about setting up a customer + // managed key for Amazon Q, see Enable Amazon Q in Connect for your instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) + // . + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration + + // Source configuration information about the knowledge base. + SourceConfiguration SourceConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// Summary information about the knowledge base. +type KnowledgeBaseSummary struct { + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The type of knowledge base. + // + // This member is required. + KnowledgeBaseType KnowledgeBaseType + + // The name of the knowledge base. + // + // This member is required. + Name *string + + // The status of the knowledge base summary. + // + // This member is required. + Status KnowledgeBaseStatus + + // The description of the knowledge base. + Description *string + + // Information about how to render the content. + RenderingConfiguration *RenderingConfiguration + + // The configuration information for the customer managed key used for encryption. + // This KMS key must have a policy that allows kms:CreateGrant , kms:DescribeKey , + // kms:Decrypt , and kms:GenerateDataKey* permissions to the IAM identity using + // the key to invoke Amazon Q. For more information about setting up a customer + // managed key for Amazon Q, see Enable Amazon Q in Connect for your instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) + // . + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration + + // Configuration information about the external data source. + SourceConfiguration SourceConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// An error occurred when creating a recommendation. +type NotifyRecommendationsReceivedError struct { + + // A recommendation is causing an error. + Message *string + + // The identifier of the recommendation that is in error. + RecommendationId *string + + noSmithyDocumentSerde +} + +// Information about how to query content. +// +// The following types satisfy this interface: +// +// QueryConditionMemberSingle +type QueryCondition interface { + isQueryCondition() +} + +// The condition for the query. +type QueryConditionMemberSingle struct { + Value QueryConditionItem + + noSmithyDocumentSerde +} + +func (*QueryConditionMemberSingle) isQueryCondition() {} + +// The condition for the query. +type QueryConditionItem struct { + + // The comparison operator for query condition to query on. + // + // This member is required. + Comparator QueryConditionComparisonOperator + + // The name of the field for query condition to query on. + // + // This member is required. + Field QueryConditionFieldName + + // The value for the query condition to query on. + // + // This member is required. + Value *string + + noSmithyDocumentSerde +} + +// Data associated with the QUERY RecommendationTriggerType. +type QueryRecommendationTriggerData struct { + + // The text associated with the recommendation trigger. + Text *string + + noSmithyDocumentSerde +} + +// The container quick response content. +// +// The following types satisfy this interface: +// +// QuickResponseContentProviderMemberContent +type QuickResponseContentProvider interface { + isQuickResponseContentProvider() +} + +// The content of the quick response. +type QuickResponseContentProviderMemberContent struct { + Value string + + noSmithyDocumentSerde +} + +func (*QuickResponseContentProviderMemberContent) isQuickResponseContentProvider() {} + +// The content of the quick response stored in different media types. +type QuickResponseContents struct { + + // The container quick response content. + Markdown QuickResponseContentProvider + + // The container quick response content. + PlainText QuickResponseContentProvider + + noSmithyDocumentSerde +} + +// Information about the quick response. +type QuickResponseData struct { + + // The media type of the quick response content. + // - Use application/x.quickresponse;format=plain for quick response written in + // plain text. + // - Use application/x.quickresponse;format=markdown for quick response written + // in richtext. + // + // This member is required. + ContentType *string + + // The timestamp when the quick response was created. + // + // This member is required. + CreatedTime *time.Time + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The timestamp when the quick response data was last modified. + // + // This member is required. + LastModifiedTime *time.Time + + // The name of the quick response. + // + // This member is required. + Name *string + + // The Amazon Resource Name (ARN) of the quick response. + // + // This member is required. + QuickResponseArn *string + + // The identifier of the quick response. + // + // This member is required. + QuickResponseId *string + + // The status of the quick response data. + // + // This member is required. + Status QuickResponseStatus + + // The Amazon Connect contact channels this quick response applies to. The + // supported contact channel types include Chat . + Channels []string + + // The contents of the quick response. + Contents *QuickResponseContents + + // The description of the quick response. + Description *string + + // The configuration information of the user groups that the quick response is + // accessible to. + GroupingConfiguration *GroupingConfiguration + + // Whether the quick response is active. + IsActive *bool + + // The language code value for the language in which the quick response is written. + Language *string + + // The Amazon Resource Name (ARN) of the user who last updated the quick response + // data. + LastModifiedBy *string + + // The shortcut key of the quick response. The value should be unique across the + // knowledge base. + ShortcutKey *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The container of quick response data. +// +// The following types satisfy this interface: +// +// QuickResponseDataProviderMemberContent +type QuickResponseDataProvider interface { + isQuickResponseDataProvider() +} + +// The content of the quick response. +type QuickResponseDataProviderMemberContent struct { + Value string + + noSmithyDocumentSerde +} + +func (*QuickResponseDataProviderMemberContent) isQuickResponseDataProvider() {} + +// The quick response fields to filter the quick response query results by. The +// following is the list of supported field names. +// - name +// - description +// - shortcutKey +// - isActive +// - channels +// - language +// - contentType +// - createdTime +// - lastModifiedTime +// - lastModifiedBy +// - groupingConfiguration.criteria +// - groupingConfiguration.values +type QuickResponseFilterField struct { + + // The name of the attribute field to filter the quick responses by. + // + // This member is required. + Name *string + + // The operator to use for filtering. + // + // This member is required. + Operator QuickResponseFilterOperator + + // Whether to treat null value as a match for the attribute field. + IncludeNoExistence *bool + + // The values of attribute field to filter the quick response by. + Values []string + + noSmithyDocumentSerde +} + +// The quick response fields to order the quick response query results by. The +// following is the list of supported field names. +// - name +// - description +// - shortcutKey +// - isActive +// - channels +// - language +// - contentType +// - createdTime +// - lastModifiedTime +// - lastModifiedBy +// - groupingConfiguration.criteria +// - groupingConfiguration.values +type QuickResponseOrderField struct { + + // The name of the attribute to order the quick response query results by. + // + // This member is required. + Name *string + + // The order at which the quick responses are sorted by. + Order Order + + noSmithyDocumentSerde +} + +// The quick response fields to query quick responses by. The following is the +// list of supported field names. +// - content +// - name +// - description +// - shortcutKey +type QuickResponseQueryField struct { + + // The name of the attribute to query the quick responses by. + // + // This member is required. + Name *string + + // The operator to use for matching attribute field values in the query. + // + // This member is required. + Operator QuickResponseQueryOperator + + // The values of the attribute to query the quick responses by. + // + // This member is required. + Values []string + + // Whether the query expects only exact matches on the attribute field values. The + // results of the query will only include exact matches if this parameter is set to + // false. + AllowFuzziness *bool + + // The importance of the attribute field when calculating query result relevancy + // scores. The value set for this parameter affects the ordering of search results. + Priority Priority + + noSmithyDocumentSerde +} + +// Information about the import job. +type QuickResponseSearchExpression struct { + + // The configuration of filtering rules applied to quick response query results. + Filters []QuickResponseFilterField + + // The quick response attribute fields on which the query results are ordered. + OrderOnField *QuickResponseOrderField + + // The quick response query expressions. + Queries []QuickResponseQueryField + + noSmithyDocumentSerde +} + +// The result of quick response search. +type QuickResponseSearchResultData struct { + + // The media type of the quick response content. + // - Use application/x.quickresponse;format=plain for quick response written in + // plain text. + // - Use application/x.quickresponse;format=markdown for quick response written + // in richtext. + // + // This member is required. + ContentType *string + + // The contents of the quick response. + // + // This member is required. + Contents *QuickResponseContents + + // The timestamp when the quick response was created. + // + // This member is required. + CreatedTime *time.Time + + // Whether the quick response is active. + // + // This member is required. + IsActive *bool + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. Can be either + // the ID or the ARN. URLs cannot contain the ARN. + // + // This member is required. + KnowledgeBaseId *string + + // The timestamp when the quick response search result data was last modified. + // + // This member is required. + LastModifiedTime *time.Time + + // The name of the quick response. + // + // This member is required. + Name *string + + // The Amazon Resource Name (ARN) of the quick response. + // + // This member is required. + QuickResponseArn *string + + // The identifier of the quick response. + // + // This member is required. + QuickResponseId *string + + // The resource status of the quick response. + // + // This member is required. + Status QuickResponseStatus + + // The user defined contact attributes that are resolved when the search result is + // returned. + AttributesInterpolated []string + + // The user defined contact attributes that are not resolved when the search + // result is returned. + AttributesNotInterpolated []string + + // The Amazon Connect contact channels this quick response applies to. The + // supported contact channel types include Chat . + Channels []string + + // The description of the quick response. + Description *string + + // The configuration information of the user groups that the quick response is + // accessible to. + GroupingConfiguration *GroupingConfiguration + + // The language code value for the language in which the quick response is written. + Language *string + + // The Amazon Resource Name (ARN) of the user who last updated the quick response + // search result data. + LastModifiedBy *string + + // The shortcut key of the quick response. The value should be unique across the + // knowledge base. + ShortcutKey *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The summary information about the quick response. +type QuickResponseSummary struct { + + // The media type of the quick response content. + // - Use application/x.quickresponse;format=plain for quick response written in + // plain text. + // - Use application/x.quickresponse;format=markdown for quick response written + // in richtext. + // + // This member is required. + ContentType *string + + // The timestamp when the quick response was created. + // + // This member is required. + CreatedTime *time.Time + + // The Amazon Resource Name (ARN) of the knowledge base. + // + // This member is required. + KnowledgeBaseArn *string + + // The identifier of the knowledge base. This should not be a QUICK_RESPONSES type + // knowledge base if you're storing Amazon Q Content resource to it. + // + // This member is required. + KnowledgeBaseId *string + + // The timestamp when the quick response summary was last modified. + // + // This member is required. + LastModifiedTime *time.Time + + // The name of the quick response. + // + // This member is required. + Name *string + + // The Amazon Resource Name (ARN) of the quick response. + // + // This member is required. + QuickResponseArn *string + + // The identifier of the quick response. + // + // This member is required. + QuickResponseId *string + + // The resource status of the quick response. + // + // This member is required. + Status QuickResponseStatus + + // The Amazon Connect contact channels this quick response applies to. The + // supported contact channel types include Chat . + Channels []string + + // The description of the quick response. + Description *string + + // Whether the quick response is active. + IsActive *bool + + // The Amazon Resource Name (ARN) of the user who last updated the quick response + // data. + LastModifiedBy *string + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// Details about the source content ranking data. +type RankingData struct { + + // The relevance score of the content. + RelevanceLevel RelevanceLevel + + // The relevance level of the recommendation. + RelevanceScore float64 + + noSmithyDocumentSerde +} + +// Information about the recommendation. +type RecommendationData struct { + + // The identifier of the recommendation. + // + // This member is required. + RecommendationId *string + + // Summary of the recommended content. + Data *DataSummary + + // The recommended document. + Document *Document + + // The relevance level of the recommendation. + RelevanceLevel RelevanceLevel + + // The relevance score of the recommendation. + RelevanceScore float64 + + // The type of recommendation. + Type RecommendationType + + noSmithyDocumentSerde +} + +// A recommendation trigger provides context on the event that produced the +// referenced recommendations. Recommendations are only referenced in +// recommendationIds by a single RecommendationTrigger. +type RecommendationTrigger struct { + + // A union type containing information related to the trigger. + // + // This member is required. + Data RecommendationTriggerData + + // The identifier of the recommendation trigger. + // + // This member is required. + Id *string + + // The identifiers of the recommendations. + // + // This member is required. + RecommendationIds []string + + // The source of the recommendation trigger. + // - ISSUE_DETECTION: The corresponding recommendations were triggered by a + // Contact Lens issue. + // - RULE_EVALUATION: The corresponding recommendations were triggered by a + // Contact Lens rule. + // + // This member is required. + Source RecommendationSourceType + + // The type of recommendation trigger. + // + // This member is required. + Type RecommendationTriggerType + + noSmithyDocumentSerde +} + +// A union type containing information related to the trigger. +// +// The following types satisfy this interface: +// +// RecommendationTriggerDataMemberQuery +type RecommendationTriggerData interface { + isRecommendationTriggerData() +} + +// Data associated with the QUERY RecommendationTriggerType. +type RecommendationTriggerDataMemberQuery struct { + Value QueryRecommendationTriggerData + + noSmithyDocumentSerde +} + +func (*RecommendationTriggerDataMemberQuery) isRecommendationTriggerData() {} + +// Information about how to render the content. +type RenderingConfiguration struct { + + // A URI template containing exactly one variable in ${variableName} format. This + // can only be set for EXTERNAL knowledge bases. For Salesforce, ServiceNow, and + // Zendesk, the variable must be one of the following: + // - Salesforce: Id , ArticleNumber , VersionNumber , Title , PublishStatus , or + // IsDeleted + // - ServiceNow: number , short_description , sys_mod_count , workflow_state , or + // active + // - Zendesk: id , title , updated_at , or draft + // The variable is replaced with the actual value for a piece of content when + // calling GetContent (https://docs.aws.amazon.com/amazon-q-connect/latest/APIReference/API_GetContent.html) + // . + TemplateUri *string + + noSmithyDocumentSerde +} + +// Information about the result. +type ResultData struct { + + // The identifier of the result data. + // + // This member is required. + ResultId *string + + // Summary of the recommended content. + Data *DataSummary + + // The document. + Document *Document + + // The relevance score of the results. + RelevanceScore float64 + + // The type of the query result. + Type QueryResultType + + noSmithyDocumentSerde +} + +// The search expression. +type SearchExpression struct { + + // The search expression filters. + // + // This member is required. + Filters []Filter + + noSmithyDocumentSerde +} + +// The configuration information for the customer managed key used for encryption. +type ServerSideEncryptionConfiguration struct { + + // The customer managed key used for encryption. For more information about + // setting up a customer managed key for Amazon Q, see Enable Amazon Q in Connect + // for your instance (https://docs.aws.amazon.com/connect/latest/adminguide/enable-q.html) + // . For information about valid ID values, see Key identifiers (KeyId) (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id) + // . + KmsKeyId *string + + noSmithyDocumentSerde +} + +// Information about the session. +type SessionData struct { + + // The name of the session. + // + // This member is required. + Name *string + + // The Amazon Resource Name (ARN) of the session. + // + // This member is required. + SessionArn *string + + // The identifier of the session. + // + // This member is required. + SessionId *string + + // The description of the session. + Description *string + + // The configuration information for the session integration. + IntegrationConfiguration *SessionIntegrationConfiguration + + // The tags used to organize, track, or control access for this resource. + Tags map[string]string + + noSmithyDocumentSerde +} + +// The configuration information for the session integration. +type SessionIntegrationConfiguration struct { + + // The Amazon Resource Name (ARN) of the integrated Amazon SNS topic used for + // streaming chat messages. + TopicIntegrationArn *string + + noSmithyDocumentSerde +} + +// Summary information about the session. +type SessionSummary struct { + + // The Amazon Resource Name (ARN) of the Amazon Q assistant. + // + // This member is required. + AssistantArn *string + + // The identifier of the Amazon Q assistant. + // + // This member is required. + AssistantId *string + + // The Amazon Resource Name (ARN) of the session. + // + // This member is required. + SessionArn *string + + // The identifier of the session. + // + // This member is required. + SessionId *string + + noSmithyDocumentSerde +} + +// Configuration information about the external data source. +// +// The following types satisfy this interface: +// +// SourceConfigurationMemberAppIntegrations +type SourceConfiguration interface { + isSourceConfiguration() +} + +// Configuration information for Amazon AppIntegrations to automatically ingest +// content. +type SourceConfigurationMemberAppIntegrations struct { + Value AppIntegrationsConfiguration + + noSmithyDocumentSerde +} + +func (*SourceConfigurationMemberAppIntegrations) isSourceConfiguration() {} + +// Details about the source content data. +type SourceContentDataDetails struct { + + // The identifier of the source content. + // + // This member is required. + Id *string + + // Details about the source content ranking data. + // + // This member is required. + RankingData *RankingData + + // Details about the source content text data. + // + // This member is required. + TextData *TextData + + // The type of the source content. + // + // This member is required. + Type SourceContentType + + noSmithyDocumentSerde +} + +// Details about the source content text data. +type TextData struct { + + // The text of the document. + Excerpt *DocumentText + + // The text of the document. + Title *DocumentText + + 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) isAssistantAssociationInputData() {} +func (*UnknownUnionMember) isAssistantAssociationOutputData() {} +func (*UnknownUnionMember) isConfiguration() {} +func (*UnknownUnionMember) isDataDetails() {} +func (*UnknownUnionMember) isDataReference() {} +func (*UnknownUnionMember) isQueryCondition() {} +func (*UnknownUnionMember) isQuickResponseContentProvider() {} +func (*UnknownUnionMember) isQuickResponseDataProvider() {} +func (*UnknownUnionMember) isRecommendationTriggerData() {} +func (*UnknownUnionMember) isSourceConfiguration() {} diff --git a/service/qconnect/types/types_exported_test.go b/service/qconnect/types/types_exported_test.go new file mode 100644 index 00000000000..bf9008898bc --- /dev/null +++ b/service/qconnect/types/types_exported_test.go @@ -0,0 +1,200 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" +) + +func ExampleAssistantAssociationInputData_outputUsage() { + var union types.AssistantAssociationInputData + // type switches can be used to check the union value + switch v := union.(type) { + case *types.AssistantAssociationInputDataMemberKnowledgeBaseId: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string + +func ExampleAssistantAssociationOutputData_outputUsage() { + var union types.AssistantAssociationOutputData + // type switches can be used to check the union value + switch v := union.(type) { + case *types.AssistantAssociationOutputDataMemberKnowledgeBaseAssociation: + _ = v.Value // Value is types.KnowledgeBaseAssociationData + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.KnowledgeBaseAssociationData + +func ExampleConfiguration_outputUsage() { + var union types.Configuration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.ConfigurationMemberConnectConfiguration: + _ = v.Value // Value is types.ConnectConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ConnectConfiguration + +func ExampleDataDetails_outputUsage() { + var union types.DataDetails + // type switches can be used to check the union value + switch v := union.(type) { + case *types.DataDetailsMemberContentData: + _ = v.Value // Value is types.ContentDataDetails + + case *types.DataDetailsMemberGenerativeData: + _ = v.Value // Value is types.GenerativeDataDetails + + case *types.DataDetailsMemberSourceContentData: + _ = v.Value // Value is types.SourceContentDataDetails + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ContentDataDetails +var _ *types.GenerativeDataDetails +var _ *types.SourceContentDataDetails + +func ExampleDataReference_outputUsage() { + var union types.DataReference + // type switches can be used to check the union value + switch v := union.(type) { + case *types.DataReferenceMemberContentReference: + _ = v.Value // Value is types.ContentReference + + case *types.DataReferenceMemberGenerativeReference: + _ = v.Value // Value is types.GenerativeReference + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.GenerativeReference +var _ *types.ContentReference + +func ExampleQueryCondition_outputUsage() { + var union types.QueryCondition + // type switches can be used to check the union value + switch v := union.(type) { + case *types.QueryConditionMemberSingle: + _ = v.Value // Value is types.QueryConditionItem + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.QueryConditionItem + +func ExampleQuickResponseContentProvider_outputUsage() { + var union types.QuickResponseContentProvider + // type switches can be used to check the union value + switch v := union.(type) { + case *types.QuickResponseContentProviderMemberContent: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string + +func ExampleQuickResponseDataProvider_outputUsage() { + var union types.QuickResponseDataProvider + // type switches can be used to check the union value + switch v := union.(type) { + case *types.QuickResponseDataProviderMemberContent: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string + +func ExampleRecommendationTriggerData_outputUsage() { + var union types.RecommendationTriggerData + // type switches can be used to check the union value + switch v := union.(type) { + case *types.RecommendationTriggerDataMemberQuery: + _ = v.Value // Value is types.QueryRecommendationTriggerData + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.QueryRecommendationTriggerData + +func ExampleSourceConfiguration_outputUsage() { + var union types.SourceConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.SourceConfigurationMemberAppIntegrations: + _ = v.Value // Value is types.AppIntegrationsConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.AppIntegrationsConfiguration diff --git a/service/qconnect/validators.go b/service/qconnect/validators.go new file mode 100644 index 00000000000..5a17a6ca89a --- /dev/null +++ b/service/qconnect/validators.go @@ -0,0 +1,1942 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package qconnect + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/qconnect/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpCreateAssistantAssociation struct { +} + +func (*validateOpCreateAssistantAssociation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAssistantAssociation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAssistantAssociationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAssistantAssociationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateAssistant struct { +} + +func (*validateOpCreateAssistant) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAssistant) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAssistantInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAssistantInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateContent struct { +} + +func (*validateOpCreateContent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateContentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateContentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateKnowledgeBase struct { +} + +func (*validateOpCreateKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateQuickResponse struct { +} + +func (*validateOpCreateQuickResponse) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateQuickResponse) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateQuickResponseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateQuickResponseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateSession struct { +} + +func (*validateOpCreateSession) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateSession) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateSessionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateSessionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAssistantAssociation struct { +} + +func (*validateOpDeleteAssistantAssociation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAssistantAssociation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAssistantAssociationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAssistantAssociationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteAssistant struct { +} + +func (*validateOpDeleteAssistant) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteAssistant) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteAssistantInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteAssistantInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteContent struct { +} + +func (*validateOpDeleteContent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteContentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteContentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteImportJob struct { +} + +func (*validateOpDeleteImportJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteImportJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteImportJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteImportJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteKnowledgeBase struct { +} + +func (*validateOpDeleteKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteQuickResponse struct { +} + +func (*validateOpDeleteQuickResponse) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteQuickResponse) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteQuickResponseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteQuickResponseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAssistantAssociation struct { +} + +func (*validateOpGetAssistantAssociation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAssistantAssociation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAssistantAssociationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAssistantAssociationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetAssistant struct { +} + +func (*validateOpGetAssistant) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAssistant) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAssistantInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAssistantInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetContent struct { +} + +func (*validateOpGetContent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetContentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetContentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetContentSummary struct { +} + +func (*validateOpGetContentSummary) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetContentSummary) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetContentSummaryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetContentSummaryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetImportJob struct { +} + +func (*validateOpGetImportJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetImportJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetImportJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetImportJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetKnowledgeBase struct { +} + +func (*validateOpGetKnowledgeBase) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetKnowledgeBase) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetKnowledgeBaseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetKnowledgeBaseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetQuickResponse struct { +} + +func (*validateOpGetQuickResponse) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetQuickResponse) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetQuickResponseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetQuickResponseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetRecommendations struct { +} + +func (*validateOpGetRecommendations) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetRecommendations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetRecommendationsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetRecommendationsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetSession struct { +} + +func (*validateOpGetSession) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetSession) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetSessionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetSessionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListAssistantAssociations struct { +} + +func (*validateOpListAssistantAssociations) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAssistantAssociations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAssistantAssociationsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAssistantAssociationsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListContents struct { +} + +func (*validateOpListContents) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListContents) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListContentsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListContentsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListImportJobs struct { +} + +func (*validateOpListImportJobs) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListImportJobs) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListImportJobsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListImportJobsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListQuickResponses struct { +} + +func (*validateOpListQuickResponses) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListQuickResponses) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListQuickResponsesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListQuickResponsesInput(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 validateOpNotifyRecommendationsReceived struct { +} + +func (*validateOpNotifyRecommendationsReceived) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpNotifyRecommendationsReceived) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*NotifyRecommendationsReceivedInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpNotifyRecommendationsReceivedInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpQueryAssistant struct { +} + +func (*validateOpQueryAssistant) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpQueryAssistant) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*QueryAssistantInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpQueryAssistantInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpRemoveKnowledgeBaseTemplateUri struct { +} + +func (*validateOpRemoveKnowledgeBaseTemplateUri) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpRemoveKnowledgeBaseTemplateUri) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*RemoveKnowledgeBaseTemplateUriInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpRemoveKnowledgeBaseTemplateUriInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpSearchContent struct { +} + +func (*validateOpSearchContent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSearchContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SearchContentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSearchContentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpSearchQuickResponses struct { +} + +func (*validateOpSearchQuickResponses) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSearchQuickResponses) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SearchQuickResponsesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSearchQuickResponsesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpSearchSessions struct { +} + +func (*validateOpSearchSessions) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSearchSessions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SearchSessionsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSearchSessionsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartContentUpload struct { +} + +func (*validateOpStartContentUpload) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartContentUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartContentUploadInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartContentUploadInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartImportJob struct { +} + +func (*validateOpStartImportJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartImportJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartImportJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartImportJobInput(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 validateOpUpdateContent struct { +} + +func (*validateOpUpdateContent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateContentInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateContentInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateKnowledgeBaseTemplateUri struct { +} + +func (*validateOpUpdateKnowledgeBaseTemplateUri) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateKnowledgeBaseTemplateUri) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateKnowledgeBaseTemplateUriInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateKnowledgeBaseTemplateUriInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateQuickResponse struct { +} + +func (*validateOpUpdateQuickResponse) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateQuickResponse) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateQuickResponseInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateQuickResponseInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpCreateAssistantAssociationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAssistantAssociation{}, middleware.After) +} + +func addOpCreateAssistantValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAssistant{}, middleware.After) +} + +func addOpCreateContentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateContent{}, middleware.After) +} + +func addOpCreateKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateKnowledgeBase{}, middleware.After) +} + +func addOpCreateQuickResponseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateQuickResponse{}, middleware.After) +} + +func addOpCreateSessionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateSession{}, middleware.After) +} + +func addOpDeleteAssistantAssociationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAssistantAssociation{}, middleware.After) +} + +func addOpDeleteAssistantValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteAssistant{}, middleware.After) +} + +func addOpDeleteContentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteContent{}, middleware.After) +} + +func addOpDeleteImportJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteImportJob{}, middleware.After) +} + +func addOpDeleteKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteKnowledgeBase{}, middleware.After) +} + +func addOpDeleteQuickResponseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteQuickResponse{}, middleware.After) +} + +func addOpGetAssistantAssociationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAssistantAssociation{}, middleware.After) +} + +func addOpGetAssistantValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAssistant{}, middleware.After) +} + +func addOpGetContentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetContent{}, middleware.After) +} + +func addOpGetContentSummaryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetContentSummary{}, middleware.After) +} + +func addOpGetImportJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetImportJob{}, middleware.After) +} + +func addOpGetKnowledgeBaseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetKnowledgeBase{}, middleware.After) +} + +func addOpGetQuickResponseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetQuickResponse{}, middleware.After) +} + +func addOpGetRecommendationsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetRecommendations{}, middleware.After) +} + +func addOpGetSessionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetSession{}, middleware.After) +} + +func addOpListAssistantAssociationsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAssistantAssociations{}, middleware.After) +} + +func addOpListContentsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListContents{}, middleware.After) +} + +func addOpListImportJobsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListImportJobs{}, middleware.After) +} + +func addOpListQuickResponsesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListQuickResponses{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpNotifyRecommendationsReceivedValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpNotifyRecommendationsReceived{}, middleware.After) +} + +func addOpQueryAssistantValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpQueryAssistant{}, middleware.After) +} + +func addOpRemoveKnowledgeBaseTemplateUriValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpRemoveKnowledgeBaseTemplateUri{}, middleware.After) +} + +func addOpSearchContentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSearchContent{}, middleware.After) +} + +func addOpSearchQuickResponsesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSearchQuickResponses{}, middleware.After) +} + +func addOpSearchSessionsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSearchSessions{}, middleware.After) +} + +func addOpStartContentUploadValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartContentUpload{}, middleware.After) +} + +func addOpStartImportJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartImportJob{}, 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 addOpUpdateContentValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateContent{}, middleware.After) +} + +func addOpUpdateKnowledgeBaseTemplateUriValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateKnowledgeBaseTemplateUri{}, middleware.After) +} + +func addOpUpdateQuickResponseValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateQuickResponse{}, middleware.After) +} + +func validateAppIntegrationsConfiguration(v *types.AppIntegrationsConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AppIntegrationsConfiguration"} + if v.AppIntegrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("AppIntegrationArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateExternalSourceConfiguration(v *types.ExternalSourceConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExternalSourceConfiguration"} + if len(v.Source) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Source")) + } + if v.Configuration == nil { + invalidParams.Add(smithy.NewErrParamRequired("Configuration")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateFilter(v *types.Filter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Filter"} + if len(v.Field) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Field")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateFilterList(v []types.Filter) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "FilterList"} + for i := range v { + if err := validateFilter(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQueryCondition(v types.QueryCondition) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QueryCondition"} + switch uv := v.(type) { + case *types.QueryConditionMemberSingle: + if err := validateQueryConditionItem(&uv.Value); err != nil { + invalidParams.AddNested("[single]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQueryConditionExpression(v []types.QueryCondition) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QueryConditionExpression"} + for i := range v { + if err := validateQueryCondition(v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQueryConditionItem(v *types.QueryConditionItem) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QueryConditionItem"} + if len(v.Field) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Field")) + } + if len(v.Comparator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Comparator")) + } + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseFilterField(v *types.QuickResponseFilterField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseFilterField"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseFilterFieldList(v []types.QuickResponseFilterField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseFilterFieldList"} + for i := range v { + if err := validateQuickResponseFilterField(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseOrderField(v *types.QuickResponseOrderField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseOrderField"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseQueryField(v *types.QuickResponseQueryField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseQueryField"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Values == nil { + invalidParams.Add(smithy.NewErrParamRequired("Values")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseQueryFieldList(v []types.QuickResponseQueryField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseQueryFieldList"} + for i := range v { + if err := validateQuickResponseQueryField(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateQuickResponseSearchExpression(v *types.QuickResponseSearchExpression) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QuickResponseSearchExpression"} + if v.Queries != nil { + if err := validateQuickResponseQueryFieldList(v.Queries); err != nil { + invalidParams.AddNested("Queries", err.(smithy.InvalidParamsError)) + } + } + if v.Filters != nil { + if err := validateQuickResponseFilterFieldList(v.Filters); err != nil { + invalidParams.AddNested("Filters", err.(smithy.InvalidParamsError)) + } + } + if v.OrderOnField != nil { + if err := validateQuickResponseOrderField(v.OrderOnField); err != nil { + invalidParams.AddNested("OrderOnField", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSearchExpression(v *types.SearchExpression) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchExpression"} + if v.Filters == nil { + invalidParams.Add(smithy.NewErrParamRequired("Filters")) + } else if v.Filters != nil { + if err := validateFilterList(v.Filters); err != nil { + invalidParams.AddNested("Filters", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSourceConfiguration(v types.SourceConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SourceConfiguration"} + switch uv := v.(type) { + case *types.SourceConfigurationMemberAppIntegrations: + if err := validateAppIntegrationsConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[appIntegrations]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateAssistantAssociationInput(v *CreateAssistantAssociationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAssistantAssociationInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if len(v.AssociationType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("AssociationType")) + } + if v.Association == nil { + invalidParams.Add(smithy.NewErrParamRequired("Association")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateAssistantInput(v *CreateAssistantInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAssistantInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if len(v.Type) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Type")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateContentInput(v *CreateContentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateContentInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.UploadId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UploadId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateKnowledgeBaseInput(v *CreateKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateKnowledgeBaseInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if len(v.KnowledgeBaseType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseType")) + } + if v.SourceConfiguration != nil { + if err := validateSourceConfiguration(v.SourceConfiguration); err != nil { + invalidParams.AddNested("SourceConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateQuickResponseInput(v *CreateQuickResponseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateQuickResponseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Content == nil { + invalidParams.Add(smithy.NewErrParamRequired("Content")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateSessionInput(v *CreateSessionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateSessionInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAssistantAssociationInput(v *DeleteAssistantAssociationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAssistantAssociationInput"} + if v.AssistantAssociationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantAssociationId")) + } + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteAssistantInput(v *DeleteAssistantInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteAssistantInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteContentInput(v *DeleteContentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteContentInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.ContentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteImportJobInput(v *DeleteImportJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteImportJobInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.ImportJobId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ImportJobId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteKnowledgeBaseInput(v *DeleteKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteKnowledgeBaseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteQuickResponseInput(v *DeleteQuickResponseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteQuickResponseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.QuickResponseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QuickResponseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAssistantAssociationInput(v *GetAssistantAssociationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAssistantAssociationInput"} + if v.AssistantAssociationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantAssociationId")) + } + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetAssistantInput(v *GetAssistantInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAssistantInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetContentInput(v *GetContentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetContentInput"} + if v.ContentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContentId")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetContentSummaryInput(v *GetContentSummaryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetContentSummaryInput"} + if v.ContentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContentId")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetImportJobInput(v *GetImportJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetImportJobInput"} + if v.ImportJobId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ImportJobId")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetKnowledgeBaseInput(v *GetKnowledgeBaseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetKnowledgeBaseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetQuickResponseInput(v *GetQuickResponseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetQuickResponseInput"} + if v.QuickResponseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QuickResponseId")) + } + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetRecommendationsInput(v *GetRecommendationsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetRecommendationsInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.SessionId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SessionId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetSessionInput(v *GetSessionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetSessionInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.SessionId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SessionId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListAssistantAssociationsInput(v *ListAssistantAssociationsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAssistantAssociationsInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListContentsInput(v *ListContentsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListContentsInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListImportJobsInput(v *ListImportJobsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListImportJobsInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListQuickResponsesInput(v *ListQuickResponsesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListQuickResponsesInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + 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 validateOpNotifyRecommendationsReceivedInput(v *NotifyRecommendationsReceivedInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "NotifyRecommendationsReceivedInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.SessionId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SessionId")) + } + if v.RecommendationIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("RecommendationIds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpQueryAssistantInput(v *QueryAssistantInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "QueryAssistantInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.QueryText == nil { + invalidParams.Add(smithy.NewErrParamRequired("QueryText")) + } + if v.QueryCondition != nil { + if err := validateQueryConditionExpression(v.QueryCondition); err != nil { + invalidParams.AddNested("QueryCondition", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpRemoveKnowledgeBaseTemplateUriInput(v *RemoveKnowledgeBaseTemplateUriInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RemoveKnowledgeBaseTemplateUriInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpSearchContentInput(v *SearchContentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchContentInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.SearchExpression == nil { + invalidParams.Add(smithy.NewErrParamRequired("SearchExpression")) + } else if v.SearchExpression != nil { + if err := validateSearchExpression(v.SearchExpression); err != nil { + invalidParams.AddNested("SearchExpression", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpSearchQuickResponsesInput(v *SearchQuickResponsesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchQuickResponsesInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.SearchExpression == nil { + invalidParams.Add(smithy.NewErrParamRequired("SearchExpression")) + } else if v.SearchExpression != nil { + if err := validateQuickResponseSearchExpression(v.SearchExpression); err != nil { + invalidParams.AddNested("SearchExpression", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpSearchSessionsInput(v *SearchSessionsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchSessionsInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.SearchExpression == nil { + invalidParams.Add(smithy.NewErrParamRequired("SearchExpression")) + } else if v.SearchExpression != nil { + if err := validateSearchExpression(v.SearchExpression); err != nil { + invalidParams.AddNested("SearchExpression", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartContentUploadInput(v *StartContentUploadInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartContentUploadInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.ContentType == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContentType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartImportJobInput(v *StartImportJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartImportJobInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if len(v.ImportJobType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ImportJobType")) + } + if v.UploadId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UploadId")) + } + if v.ExternalSourceConfiguration != nil { + if err := validateExternalSourceConfiguration(v.ExternalSourceConfiguration); err != nil { + invalidParams.AddNested("ExternalSourceConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpTagResourceInput(v *TagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.Tags == nil { + invalidParams.Add(smithy.NewErrParamRequired("Tags")) + } + 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 validateOpUpdateContentInput(v *UpdateContentInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateContentInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.ContentId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ContentId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateKnowledgeBaseTemplateUriInput(v *UpdateKnowledgeBaseTemplateUriInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateKnowledgeBaseTemplateUriInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.TemplateUri == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateUri")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateQuickResponseInput(v *UpdateQuickResponseInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateQuickResponseInput"} + if v.KnowledgeBaseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("KnowledgeBaseId")) + } + if v.QuickResponseId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QuickResponseId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/rds/api_client.go b/service/rds/api_client.go index 36f0a6ef81e..af3a5330089 100644 --- a/service/rds/api_client.go +++ b/service/rds/api_client.go @@ -506,7 +506,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) } diff --git a/service/s3/endpoints.go b/service/s3/endpoints.go index fb70e7b3123..a1f2e36d63a 100644 --- a/service/s3/endpoints.go +++ b/service/s3/endpoints.go @@ -347,7 +347,7 @@ type EndpointParameters struct { // Parameter is required. UseS3ExpressControlEndpoint *bool - // Internal parameter to indicate whether S3Express session auth should be + // Parameter to indicate whether S3Express session auth should be // disabled // // Parameter is required. diff --git a/service/s3control/api_op_CreateAccessPoint.go b/service/s3control/api_op_CreateAccessPoint.go index 783d22b8024..578c3b4d91f 100644 --- a/service/s3control/api_op_CreateAccessPoint.go +++ b/service/s3control/api_op_CreateAccessPoint.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Creates an access point and associates it with the specified bucket. For more -// information, see Managing Data Access with Amazon S3 Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) +// This operation is not supported by directory buckets. Creates an access point +// and associates it with the specified bucket. For more information, see Managing +// Data Access with Amazon S3 Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) // in the Amazon S3 User Guide. S3 on Outposts only supports VPC-style access // points. For more information, see Accessing Amazon S3 on Outposts using virtual // private cloud (VPC) only access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) diff --git a/service/s3control/api_op_CreateAccessPointForObjectLambda.go b/service/s3control/api_op_CreateAccessPointForObjectLambda.go index 0493410d93f..c8124681f45 100644 --- a/service/s3control/api_op_CreateAccessPointForObjectLambda.go +++ b/service/s3control/api_op_CreateAccessPointForObjectLambda.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Creates an Object Lambda Access Point. For more information, see Transforming -// objects with Object Lambda Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/transforming-objects.html) +// This operation is not supported by directory buckets. Creates an Object Lambda +// Access Point. For more information, see Transforming objects with Object Lambda +// Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/transforming-objects.html) // in the Amazon S3 User Guide. The following actions are related to // CreateAccessPointForObjectLambda : // - DeleteAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointForObjectLambda.html) diff --git a/service/s3control/api_op_CreateJob.go b/service/s3control/api_op_CreateJob.go index 81a06e01c42..80ef3c5b4bc 100644 --- a/service/s3control/api_op_CreateJob.go +++ b/service/s3control/api_op_CreateJob.go @@ -16,11 +16,14 @@ import ( "strings" ) -// You can use S3 Batch Operations to perform large-scale batch actions on Amazon -// S3 objects. Batch Operations can run a single action on lists of Amazon S3 -// objects that you specify. For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) -// in the Amazon S3 User Guide. This action creates a S3 Batch Operations job. -// Related actions include: +// This operation creates an S3 Batch Operations job. You can use S3 Batch +// Operations to perform large-scale batch actions on Amazon S3 objects. Batch +// Operations can run a single action on lists of Amazon S3 objects that you +// specify. For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) +// in the Amazon S3 User Guide. Permissions For information about permissions +// required to use the Batch Operations, see Granting permissions for S3 Batch +// Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) +// in the Amazon S3 User Guide. Related actions include: // - DescribeJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - UpdateJobPriority (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobPriority.html) diff --git a/service/s3control/api_op_CreateMultiRegionAccessPoint.go b/service/s3control/api_op_CreateMultiRegionAccessPoint.go index 6bb62499b8e..6ee33386266 100644 --- a/service/s3control/api_op_CreateMultiRegionAccessPoint.go +++ b/service/s3control/api_op_CreateMultiRegionAccessPoint.go @@ -16,9 +16,10 @@ import ( "strings" ) -// Creates a Multi-Region Access Point and associates it with the specified -// buckets. For more information about creating Multi-Region Access Points, see -// Creating Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Creates a Multi-Region +// Access Point and associates it with the specified buckets. For more information +// about creating Multi-Region Access Points, see Creating Multi-Region Access +// Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. This action will always be routed to the US West // (Oregon) Region. For more information about the restrictions around managing // Multi-Region Access Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) diff --git a/service/s3control/api_op_DeleteAccessPoint.go b/service/s3control/api_op_DeleteAccessPoint.go index a567f269575..8562975041b 100644 --- a/service/s3control/api_op_DeleteAccessPoint.go +++ b/service/s3control/api_op_DeleteAccessPoint.go @@ -15,12 +15,13 @@ import ( "strings" ) -// Deletes the specified access point. All Amazon S3 on Outposts REST API requests -// for this action require an additional parameter of x-amz-outpost-id to be -// passed with the request. In addition, you must use an S3 on Outposts endpoint -// hostname prefix instead of s3-control . For an example of the request syntax for -// Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and -// the x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html#API_control_DeleteAccessPoint_Examples) +// This operation is not supported by directory buckets. Deletes the specified +// access point. All Amazon S3 on Outposts REST API requests for this action +// require an additional parameter of x-amz-outpost-id to be passed with the +// request. In addition, you must use an S3 on Outposts endpoint hostname prefix +// instead of s3-control . For an example of the request syntax for Amazon S3 on +// Outposts that uses the S3 on Outposts endpoint hostname prefix and the +// x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html#API_control_DeleteAccessPoint_Examples) // section. The following actions are related to DeleteAccessPoint : // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - GetAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html) diff --git a/service/s3control/api_op_DeleteAccessPointForObjectLambda.go b/service/s3control/api_op_DeleteAccessPointForObjectLambda.go index 5684afaa2d2..33170ecd46f 100644 --- a/service/s3control/api_op_DeleteAccessPointForObjectLambda.go +++ b/service/s3control/api_op_DeleteAccessPointForObjectLambda.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Deletes the specified Object Lambda Access Point. The following actions are -// related to DeleteAccessPointForObjectLambda : +// This operation is not supported by directory buckets. Deletes the specified +// Object Lambda Access Point. The following actions are related to +// DeleteAccessPointForObjectLambda : // - CreateAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPointForObjectLambda.html) // - GetAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointForObjectLambda.html) // - ListAccessPointsForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPointsForObjectLambda.html) diff --git a/service/s3control/api_op_DeleteAccessPointPolicy.go b/service/s3control/api_op_DeleteAccessPointPolicy.go index 15b69380859..b7939bcae36 100644 --- a/service/s3control/api_op_DeleteAccessPointPolicy.go +++ b/service/s3control/api_op_DeleteAccessPointPolicy.go @@ -15,13 +15,13 @@ import ( "strings" ) -// Deletes the access point policy for the specified access point. All Amazon S3 -// on Outposts REST API requests for this action require an additional parameter of -// x-amz-outpost-id to be passed with the request. In addition, you must use an S3 -// on Outposts endpoint hostname prefix instead of s3-control . For an example of -// the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts -// endpoint hostname prefix and the x-amz-outpost-id derived by using the access -// point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html#API_control_DeleteAccessPointPolicy_Examples) +// This operation is not supported by directory buckets. Deletes the access point +// policy for the specified access point. All Amazon S3 on Outposts REST API +// requests for this action require an additional parameter of x-amz-outpost-id to +// be passed with the request. In addition, you must use an S3 on Outposts endpoint +// hostname prefix instead of s3-control . For an example of the request syntax for +// Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and +// the x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html#API_control_DeleteAccessPointPolicy_Examples) // section. The following actions are related to DeleteAccessPointPolicy : // - PutAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html) // - GetAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointPolicy.html) diff --git a/service/s3control/api_op_DeleteAccessPointPolicyForObjectLambda.go b/service/s3control/api_op_DeleteAccessPointPolicyForObjectLambda.go index b09c6705e93..1cc0d20c92d 100644 --- a/service/s3control/api_op_DeleteAccessPointPolicyForObjectLambda.go +++ b/service/s3control/api_op_DeleteAccessPointPolicyForObjectLambda.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Removes the resource policy for an Object Lambda Access Point. The following -// actions are related to DeleteAccessPointPolicyForObjectLambda : +// This operation is not supported by directory buckets. Removes the resource +// policy for an Object Lambda Access Point. The following actions are related to +// DeleteAccessPointPolicyForObjectLambda : // - GetAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointPolicyForObjectLambda.html) // - PutAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicyForObjectLambda.html) func (c *Client) DeleteAccessPointPolicyForObjectLambda(ctx context.Context, params *DeleteAccessPointPolicyForObjectLambdaInput, optFns ...func(*Options)) (*DeleteAccessPointPolicyForObjectLambdaOutput, error) { diff --git a/service/s3control/api_op_DeleteJobTagging.go b/service/s3control/api_op_DeleteJobTagging.go index b2d22ac7111..545f1721700 100644 --- a/service/s3control/api_op_DeleteJobTagging.go +++ b/service/s3control/api_op_DeleteJobTagging.go @@ -15,10 +15,10 @@ import ( "strings" ) -// Removes the entire tag set from the specified S3 Batch Operations job. To use -// the DeleteJobTagging operation, you must have permission to perform the -// s3:DeleteJobTagging action. For more information, see Controlling access and -// labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) +// Removes the entire tag set from the specified S3 Batch Operations job. +// Permissions To use the DeleteJobTagging operation, you must have permission to +// perform the s3:DeleteJobTagging action. For more information, see Controlling +// access and labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) // in the Amazon S3 User Guide. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - GetJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetJobTagging.html) diff --git a/service/s3control/api_op_DeleteMultiRegionAccessPoint.go b/service/s3control/api_op_DeleteMultiRegionAccessPoint.go index c26bb86acc4..f64761694cf 100644 --- a/service/s3control/api_op_DeleteMultiRegionAccessPoint.go +++ b/service/s3control/api_op_DeleteMultiRegionAccessPoint.go @@ -16,11 +16,12 @@ import ( "strings" ) -// Deletes a Multi-Region Access Point. This action does not delete the buckets -// associated with the Multi-Region Access Point, only the Multi-Region Access -// Point itself. This action will always be routed to the US West (Oregon) Region. -// For more information about the restrictions around managing Multi-Region Access -// Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Deletes a Multi-Region +// Access Point. This action does not delete the buckets associated with the +// Multi-Region Access Point, only the Multi-Region Access Point itself. This +// action will always be routed to the US West (Oregon) Region. For more +// information about the restrictions around managing Multi-Region Access Points, +// see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. This request is asynchronous, meaning that you // might receive a response before the command has completed. When this request // provides a response, it provides a token that you can use to monitor the status diff --git a/service/s3control/api_op_DeletePublicAccessBlock.go b/service/s3control/api_op_DeletePublicAccessBlock.go index 5879aabdcfd..440f23c610e 100644 --- a/service/s3control/api_op_DeletePublicAccessBlock.go +++ b/service/s3control/api_op_DeletePublicAccessBlock.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Removes the PublicAccessBlock configuration for an Amazon Web Services account. -// For more information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) +// This operation is not supported by directory buckets. Removes the +// PublicAccessBlock configuration for an Amazon Web Services account. For more +// information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) // . Related actions include: // - GetPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetPublicAccessBlock.html) // - PutPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutPublicAccessBlock.html) diff --git a/service/s3control/api_op_DeleteStorageLensConfiguration.go b/service/s3control/api_op_DeleteStorageLensConfiguration.go index 3fa478e722b..1307794d996 100644 --- a/service/s3control/api_op_DeleteStorageLensConfiguration.go +++ b/service/s3control/api_op_DeleteStorageLensConfiguration.go @@ -15,9 +15,9 @@ import ( "strings" ) -// Deletes the Amazon S3 Storage Lens configuration. For more information about S3 -// Storage Lens, see Assessing your storage activity and usage with Amazon S3 -// Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Deletes the Amazon S3 +// Storage Lens configuration. For more information about S3 Storage Lens, see +// Assessing your storage activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:DeleteStorageLensConfiguration action. For more information, see // Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) diff --git a/service/s3control/api_op_DeleteStorageLensConfigurationTagging.go b/service/s3control/api_op_DeleteStorageLensConfigurationTagging.go index 1c4644be075..a28904f927b 100644 --- a/service/s3control/api_op_DeleteStorageLensConfigurationTagging.go +++ b/service/s3control/api_op_DeleteStorageLensConfigurationTagging.go @@ -15,9 +15,9 @@ import ( "strings" ) -// Deletes the Amazon S3 Storage Lens configuration tags. For more information -// about S3 Storage Lens, see Assessing your storage activity and usage with -// Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Deletes the Amazon S3 +// Storage Lens configuration tags. For more information about S3 Storage Lens, see +// Assessing your storage activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:DeleteStorageLensConfigurationTagging action. For more // information, see Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) diff --git a/service/s3control/api_op_DescribeJob.go b/service/s3control/api_op_DescribeJob.go index 2d7da27d6b5..2c6e17fb657 100644 --- a/service/s3control/api_op_DescribeJob.go +++ b/service/s3control/api_op_DescribeJob.go @@ -18,7 +18,9 @@ import ( // Retrieves the configuration parameters and status for a Batch Operations job. // For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) -// in the Amazon S3 User Guide. Related actions include: +// in the Amazon S3 User Guide. Permissions To use the DescribeJob operation, you +// must have permission to perform the s3:DescribeJob action. Related actions +// include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - UpdateJobPriority (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobPriority.html) diff --git a/service/s3control/api_op_DescribeMultiRegionAccessPointOperation.go b/service/s3control/api_op_DescribeMultiRegionAccessPointOperation.go index 556e89354c1..53a602cb809 100644 --- a/service/s3control/api_op_DescribeMultiRegionAccessPointOperation.go +++ b/service/s3control/api_op_DescribeMultiRegionAccessPointOperation.go @@ -16,9 +16,10 @@ import ( "strings" ) -// Retrieves the status of an asynchronous request to manage a Multi-Region Access -// Point. For more information about managing Multi-Region Access Points and how -// asynchronous requests work, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Retrieves the status of +// an asynchronous request to manage a Multi-Region Access Point. For more +// information about managing Multi-Region Access Points and how asynchronous +// requests work, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) diff --git a/service/s3control/api_op_GetAccessPoint.go b/service/s3control/api_op_GetAccessPoint.go index 86b72bd4d3b..128f0261dd0 100644 --- a/service/s3control/api_op_GetAccessPoint.go +++ b/service/s3control/api_op_GetAccessPoint.go @@ -17,13 +17,13 @@ import ( "time" ) -// Returns configuration information about the specified access point. All Amazon -// S3 on Outposts REST API requests for this action require an additional parameter -// of x-amz-outpost-id to be passed with the request. In addition, you must use an -// S3 on Outposts endpoint hostname prefix instead of s3-control . For an example -// of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts -// endpoint hostname prefix and the x-amz-outpost-id derived by using the access -// point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) +// This operation is not supported by directory buckets. Returns configuration +// information about the specified access point. All Amazon S3 on Outposts REST API +// requests for this action require an additional parameter of x-amz-outpost-id to +// be passed with the request. In addition, you must use an S3 on Outposts endpoint +// hostname prefix instead of s3-control . For an example of the request syntax for +// Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and +// the x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) // section. The following actions are related to GetAccessPoint : // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - DeleteAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html) diff --git a/service/s3control/api_op_GetAccessPointConfigurationForObjectLambda.go b/service/s3control/api_op_GetAccessPointConfigurationForObjectLambda.go index a6b1b5d156a..57212417c60 100644 --- a/service/s3control/api_op_GetAccessPointConfigurationForObjectLambda.go +++ b/service/s3control/api_op_GetAccessPointConfigurationForObjectLambda.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Returns configuration for an Object Lambda Access Point. The following actions -// are related to GetAccessPointConfigurationForObjectLambda : +// This operation is not supported by directory buckets. Returns configuration for +// an Object Lambda Access Point. The following actions are related to +// GetAccessPointConfigurationForObjectLambda : // - PutAccessPointConfigurationForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointConfigurationForObjectLambda.html) func (c *Client) GetAccessPointConfigurationForObjectLambda(ctx context.Context, params *GetAccessPointConfigurationForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointConfigurationForObjectLambdaOutput, error) { if params == nil { diff --git a/service/s3control/api_op_GetAccessPointForObjectLambda.go b/service/s3control/api_op_GetAccessPointForObjectLambda.go index da203bcf694..62153f4b7a1 100644 --- a/service/s3control/api_op_GetAccessPointForObjectLambda.go +++ b/service/s3control/api_op_GetAccessPointForObjectLambda.go @@ -17,8 +17,9 @@ import ( "time" ) -// Returns configuration information about the specified Object Lambda Access -// Point The following actions are related to GetAccessPointForObjectLambda : +// This operation is not supported by directory buckets. Returns configuration +// information about the specified Object Lambda Access Point The following actions +// are related to GetAccessPointForObjectLambda : // - CreateAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPointForObjectLambda.html) // - DeleteAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointForObjectLambda.html) // - ListAccessPointsForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPointsForObjectLambda.html) diff --git a/service/s3control/api_op_GetAccessPointPolicy.go b/service/s3control/api_op_GetAccessPointPolicy.go index 327f228ec3b..3a1032ee3e9 100644 --- a/service/s3control/api_op_GetAccessPointPolicy.go +++ b/service/s3control/api_op_GetAccessPointPolicy.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Returns the access point policy associated with the specified access point. The -// following actions are related to GetAccessPointPolicy : +// This operation is not supported by directory buckets. Returns the access point +// policy associated with the specified access point. The following actions are +// related to GetAccessPointPolicy : // - PutAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html) // - DeleteAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html) func (c *Client) GetAccessPointPolicy(ctx context.Context, params *GetAccessPointPolicyInput, optFns ...func(*Options)) (*GetAccessPointPolicyOutput, error) { diff --git a/service/s3control/api_op_GetAccessPointPolicyForObjectLambda.go b/service/s3control/api_op_GetAccessPointPolicyForObjectLambda.go index 25a411c1ddc..c56d1c802d4 100644 --- a/service/s3control/api_op_GetAccessPointPolicyForObjectLambda.go +++ b/service/s3control/api_op_GetAccessPointPolicyForObjectLambda.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Returns the resource policy for an Object Lambda Access Point. The following -// actions are related to GetAccessPointPolicyForObjectLambda : +// This operation is not supported by directory buckets. Returns the resource +// policy for an Object Lambda Access Point. The following actions are related to +// GetAccessPointPolicyForObjectLambda : // - DeleteAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicyForObjectLambda.html) // - PutAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicyForObjectLambda.html) func (c *Client) GetAccessPointPolicyForObjectLambda(ctx context.Context, params *GetAccessPointPolicyForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointPolicyForObjectLambdaOutput, error) { diff --git a/service/s3control/api_op_GetAccessPointPolicyStatus.go b/service/s3control/api_op_GetAccessPointPolicyStatus.go index f2968b899e4..63efb862640 100644 --- a/service/s3control/api_op_GetAccessPointPolicyStatus.go +++ b/service/s3control/api_op_GetAccessPointPolicyStatus.go @@ -16,9 +16,10 @@ import ( "strings" ) -// Indicates whether the specified access point currently has a policy that allows -// public access. For more information about public access through access points, -// see Managing Data Access with Amazon S3 access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) +// This operation is not supported by directory buckets. Indicates whether the +// specified access point currently has a policy that allows public access. For +// more information about public access through access points, see Managing Data +// Access with Amazon S3 access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) // in the Amazon S3 User Guide. func (c *Client) GetAccessPointPolicyStatus(ctx context.Context, params *GetAccessPointPolicyStatusInput, optFns ...func(*Options)) (*GetAccessPointPolicyStatusOutput, error) { if params == nil { diff --git a/service/s3control/api_op_GetAccessPointPolicyStatusForObjectLambda.go b/service/s3control/api_op_GetAccessPointPolicyStatusForObjectLambda.go index 3e22a34b678..4191d804f2b 100644 --- a/service/s3control/api_op_GetAccessPointPolicyStatusForObjectLambda.go +++ b/service/s3control/api_op_GetAccessPointPolicyStatusForObjectLambda.go @@ -16,8 +16,8 @@ import ( "strings" ) -// Returns the status of the resource policy associated with an Object Lambda -// Access Point. +// This operation is not supported by directory buckets. Returns the status of the +// resource policy associated with an Object Lambda Access Point. func (c *Client) GetAccessPointPolicyStatusForObjectLambda(ctx context.Context, params *GetAccessPointPolicyStatusForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointPolicyStatusForObjectLambdaOutput, error) { if params == nil { params = &GetAccessPointPolicyStatusForObjectLambdaInput{} diff --git a/service/s3control/api_op_GetJobTagging.go b/service/s3control/api_op_GetJobTagging.go index a61265eb354..828d2fe3c9a 100644 --- a/service/s3control/api_op_GetJobTagging.go +++ b/service/s3control/api_op_GetJobTagging.go @@ -16,9 +16,10 @@ import ( "strings" ) -// Returns the tags on an S3 Batch Operations job. To use the GetJobTagging -// operation, you must have permission to perform the s3:GetJobTagging action. For -// more information, see Controlling access and labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) +// Returns the tags on an S3 Batch Operations job. Permissions To use the +// GetJobTagging operation, you must have permission to perform the +// s3:GetJobTagging action. For more information, see Controlling access and +// labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) // in the Amazon S3 User Guide. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - PutJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutJobTagging.html) diff --git a/service/s3control/api_op_GetMultiRegionAccessPoint.go b/service/s3control/api_op_GetMultiRegionAccessPoint.go index dcdb3496517..973652c1d85 100644 --- a/service/s3control/api_op_GetMultiRegionAccessPoint.go +++ b/service/s3control/api_op_GetMultiRegionAccessPoint.go @@ -16,10 +16,11 @@ import ( "strings" ) -// Returns configuration information about the specified Multi-Region Access -// Point. This action will always be routed to the US West (Oregon) Region. For -// more information about the restrictions around managing Multi-Region Access -// Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Returns configuration +// information about the specified Multi-Region Access Point. This action will +// always be routed to the US West (Oregon) Region. For more information about the +// restrictions around managing Multi-Region Access Points, see Managing +// Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) diff --git a/service/s3control/api_op_GetMultiRegionAccessPointPolicy.go b/service/s3control/api_op_GetMultiRegionAccessPointPolicy.go index 2efd9622be4..d4ba61a05cf 100644 --- a/service/s3control/api_op_GetMultiRegionAccessPointPolicy.go +++ b/service/s3control/api_op_GetMultiRegionAccessPointPolicy.go @@ -16,10 +16,11 @@ import ( "strings" ) -// Returns the access control policy of the specified Multi-Region Access Point. -// This action will always be routed to the US West (Oregon) Region. For more -// information about the restrictions around managing Multi-Region Access Points, -// see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Returns the access +// control policy of the specified Multi-Region Access Point. This action will +// always be routed to the US West (Oregon) Region. For more information about the +// restrictions around managing Multi-Region Access Points, see Managing +// Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPointPolicy : // - GetMultiRegionAccessPointPolicyStatus (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPointPolicyStatus.html) diff --git a/service/s3control/api_op_GetMultiRegionAccessPointPolicyStatus.go b/service/s3control/api_op_GetMultiRegionAccessPointPolicyStatus.go index d964ea88700..fe4177350ec 100644 --- a/service/s3control/api_op_GetMultiRegionAccessPointPolicyStatus.go +++ b/service/s3control/api_op_GetMultiRegionAccessPointPolicyStatus.go @@ -16,10 +16,11 @@ import ( "strings" ) -// Indicates whether the specified Multi-Region Access Point has an access control -// policy that allows public access. This action will always be routed to the US -// West (Oregon) Region. For more information about the restrictions around -// managing Multi-Region Access Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Indicates whether the +// specified Multi-Region Access Point has an access control policy that allows +// public access. This action will always be routed to the US West (Oregon) Region. +// For more information about the restrictions around managing Multi-Region Access +// Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPointPolicyStatus : // - GetMultiRegionAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPointPolicy.html) diff --git a/service/s3control/api_op_GetMultiRegionAccessPointRoutes.go b/service/s3control/api_op_GetMultiRegionAccessPointRoutes.go index 79ac4b9d658..c85114448c2 100644 --- a/service/s3control/api_op_GetMultiRegionAccessPointRoutes.go +++ b/service/s3control/api_op_GetMultiRegionAccessPointRoutes.go @@ -16,10 +16,11 @@ import ( "strings" ) -// Returns the routing configuration for a Multi-Region Access Point, indicating -// which Regions are active or passive. To obtain routing control changes and -// failover requests, use the Amazon S3 failover control infrastructure endpoints -// in these five Amazon Web Services Regions: +// This operation is not supported by directory buckets. Returns the routing +// configuration for a Multi-Region Access Point, indicating which Regions are +// active or passive. To obtain routing control changes and failover requests, use +// the Amazon S3 failover control infrastructure endpoints in these five Amazon Web +// Services Regions: // - us-east-1 // - us-west-2 // - ap-southeast-2 diff --git a/service/s3control/api_op_GetPublicAccessBlock.go b/service/s3control/api_op_GetPublicAccessBlock.go index 515d1de1447..582d2caefb8 100644 --- a/service/s3control/api_op_GetPublicAccessBlock.go +++ b/service/s3control/api_op_GetPublicAccessBlock.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Retrieves the PublicAccessBlock configuration for an Amazon Web Services -// account. For more information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) +// This operation is not supported by directory buckets. Retrieves the +// PublicAccessBlock configuration for an Amazon Web Services account. For more +// information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) // . Related actions include: // - DeletePublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeletePublicAccessBlock.html) // - PutPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutPublicAccessBlock.html) diff --git a/service/s3control/api_op_GetStorageLensConfiguration.go b/service/s3control/api_op_GetStorageLensConfiguration.go index fb16db7de1f..40c408c1bcb 100644 --- a/service/s3control/api_op_GetStorageLensConfiguration.go +++ b/service/s3control/api_op_GetStorageLensConfiguration.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Gets the Amazon S3 Storage Lens configuration. For more information, see -// Assessing your storage activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Gets the Amazon S3 +// Storage Lens configuration. For more information, see Assessing your storage +// activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. For a complete list of S3 Storage Lens metrics, see // S3 Storage Lens metrics glossary (https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage_lens_metrics_glossary.html) // in the Amazon S3 User Guide. To use this action, you must have permission to diff --git a/service/s3control/api_op_GetStorageLensConfigurationTagging.go b/service/s3control/api_op_GetStorageLensConfigurationTagging.go index d4cd41b8361..6325e788305 100644 --- a/service/s3control/api_op_GetStorageLensConfigurationTagging.go +++ b/service/s3control/api_op_GetStorageLensConfigurationTagging.go @@ -16,9 +16,9 @@ import ( "strings" ) -// Gets the tags of Amazon S3 Storage Lens configuration. For more information -// about S3 Storage Lens, see Assessing your storage activity and usage with -// Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Gets the tags of Amazon +// S3 Storage Lens configuration. For more information about S3 Storage Lens, see +// Assessing your storage activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:GetStorageLensConfigurationTagging action. For more information, // see Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) diff --git a/service/s3control/api_op_ListAccessPoints.go b/service/s3control/api_op_ListAccessPoints.go index 812be78c3e4..f82c8401939 100644 --- a/service/s3control/api_op_ListAccessPoints.go +++ b/service/s3control/api_op_ListAccessPoints.go @@ -16,17 +16,18 @@ import ( "strings" ) -// Returns a list of the access points that are owned by the current account -// that's associated with the specified bucket. You can retrieve up to 1000 access -// points per call. If the specified bucket has more than 1,000 access points (or -// the number specified in maxResults , whichever is less), the response will -// include a continuation token that you can use to list the additional access -// points. All Amazon S3 on Outposts REST API requests for this action require an -// additional parameter of x-amz-outpost-id to be passed with the request. In -// addition, you must use an S3 on Outposts endpoint hostname prefix instead of -// s3-control . For an example of the request syntax for Amazon S3 on Outposts that -// uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id -// derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) +// This operation is not supported by directory buckets. Returns a list of the +// access points that are owned by the current account that's associated with the +// specified bucket. You can retrieve up to 1000 access points per call. If the +// specified bucket has more than 1,000 access points (or the number specified in +// maxResults , whichever is less), the response will include a continuation token +// that you can use to list the additional access points. All Amazon S3 on Outposts +// REST API requests for this action require an additional parameter of +// x-amz-outpost-id to be passed with the request. In addition, you must use an S3 +// on Outposts endpoint hostname prefix instead of s3-control . For an example of +// the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts +// endpoint hostname prefix and the x-amz-outpost-id derived by using the access +// point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) // section. The following actions are related to ListAccessPoints : // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - DeleteAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html) diff --git a/service/s3control/api_op_ListAccessPointsForObjectLambda.go b/service/s3control/api_op_ListAccessPointsForObjectLambda.go index b822952657b..dffd5f10b1a 100644 --- a/service/s3control/api_op_ListAccessPointsForObjectLambda.go +++ b/service/s3control/api_op_ListAccessPointsForObjectLambda.go @@ -16,11 +16,12 @@ import ( "strings" ) -// Returns some or all (up to 1,000) access points associated with the Object -// Lambda Access Point per call. If there are more access points than what can be -// returned in one call, the response will include a continuation token that you -// can use to list the additional access points. The following actions are related -// to ListAccessPointsForObjectLambda : +// This operation is not supported by directory buckets. Returns some or all (up +// to 1,000) access points associated with the Object Lambda Access Point per call. +// If there are more access points than what can be returned in one call, the +// response will include a continuation token that you can use to list the +// additional access points. The following actions are related to +// ListAccessPointsForObjectLambda : // - CreateAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPointForObjectLambda.html) // - DeleteAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointForObjectLambda.html) // - GetAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointForObjectLambda.html) diff --git a/service/s3control/api_op_ListJobs.go b/service/s3control/api_op_ListJobs.go index a0a7e9352f7..d328a853166 100644 --- a/service/s3control/api_op_ListJobs.go +++ b/service/s3control/api_op_ListJobs.go @@ -16,10 +16,12 @@ import ( "strings" ) -// Lists current S3 Batch Operations jobs and jobs that have ended within the last -// 30 days for the Amazon Web Services account making the request. For more -// information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) -// in the Amazon S3 User Guide. Related actions include: +// Lists current S3 Batch Operations jobs as well as the jobs that have ended +// within the last 30 days for the Amazon Web Services account making the request. +// For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) +// in the Amazon S3 User Guide. Permissions To use the ListJobs operation, you +// must have permission to perform the s3:ListJobs action. Related actions +// include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - DescribeJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeJob.html) // - UpdateJobPriority (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobPriority.html) diff --git a/service/s3control/api_op_ListMultiRegionAccessPoints.go b/service/s3control/api_op_ListMultiRegionAccessPoints.go index a5925806a37..3d9b65f9bc4 100644 --- a/service/s3control/api_op_ListMultiRegionAccessPoints.go +++ b/service/s3control/api_op_ListMultiRegionAccessPoints.go @@ -16,13 +16,13 @@ import ( "strings" ) -// Returns a list of the Multi-Region Access Points currently associated with the -// specified Amazon Web Services account. Each call can return up to 100 -// Multi-Region Access Points, the maximum number of Multi-Region Access Points -// that can be associated with a single account. This action will always be routed -// to the US West (Oregon) Region. For more information about the restrictions -// around managing Multi-Region Access Points, see Managing Multi-Region Access -// Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Returns a list of the +// Multi-Region Access Points currently associated with the specified Amazon Web +// Services account. Each call can return up to 100 Multi-Region Access Points, the +// maximum number of Multi-Region Access Points that can be associated with a +// single account. This action will always be routed to the US West (Oregon) +// Region. For more information about the restrictions around managing Multi-Region +// Access Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // ListMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) diff --git a/service/s3control/api_op_ListRegionalBuckets.go b/service/s3control/api_op_ListRegionalBuckets.go index e393aebfbcf..206c1551f71 100644 --- a/service/s3control/api_op_ListRegionalBuckets.go +++ b/service/s3control/api_op_ListRegionalBuckets.go @@ -16,9 +16,9 @@ import ( "strings" ) -// Returns a list of all Outposts buckets in an Outpost that are owned by the -// authenticated sender of the request. For more information, see Using Amazon S3 -// on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) +// This operation is not supported by directory buckets. Returns a list of all +// Outposts buckets in an Outpost that are owned by the authenticated sender of the +// request. For more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. For an example of the request syntax for Amazon S3 // on Outposts that uses the S3 on Outposts endpoint hostname prefix and // x-amz-outpost-id in your request, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListRegionalBuckets.html#API_control_ListRegionalBuckets_Examples) diff --git a/service/s3control/api_op_ListStorageLensConfigurations.go b/service/s3control/api_op_ListStorageLensConfigurations.go index 6e7d6b9f3ff..f583c82fc1f 100644 --- a/service/s3control/api_op_ListStorageLensConfigurations.go +++ b/service/s3control/api_op_ListStorageLensConfigurations.go @@ -16,9 +16,9 @@ import ( "strings" ) -// Gets a list of Amazon S3 Storage Lens configurations. For more information -// about S3 Storage Lens, see Assessing your storage activity and usage with -// Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Gets a list of Amazon S3 +// Storage Lens configurations. For more information about S3 Storage Lens, see +// Assessing your storage activity and usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:ListStorageLensConfigurations action. For more information, see // Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) diff --git a/service/s3control/api_op_PutAccessPointConfigurationForObjectLambda.go b/service/s3control/api_op_PutAccessPointConfigurationForObjectLambda.go index 4bb61d83c68..a8dc08b9e65 100644 --- a/service/s3control/api_op_PutAccessPointConfigurationForObjectLambda.go +++ b/service/s3control/api_op_PutAccessPointConfigurationForObjectLambda.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Replaces configuration for an Object Lambda Access Point. The following actions -// are related to PutAccessPointConfigurationForObjectLambda : +// This operation is not supported by directory buckets. Replaces configuration +// for an Object Lambda Access Point. The following actions are related to +// PutAccessPointConfigurationForObjectLambda : // - GetAccessPointConfigurationForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointConfigurationForObjectLambda.html) func (c *Client) PutAccessPointConfigurationForObjectLambda(ctx context.Context, params *PutAccessPointConfigurationForObjectLambdaInput, optFns ...func(*Options)) (*PutAccessPointConfigurationForObjectLambdaOutput, error) { if params == nil { diff --git a/service/s3control/api_op_PutAccessPointPolicy.go b/service/s3control/api_op_PutAccessPointPolicy.go index 8e0be89c5b3..3dcddbdded5 100644 --- a/service/s3control/api_op_PutAccessPointPolicy.go +++ b/service/s3control/api_op_PutAccessPointPolicy.go @@ -15,15 +15,15 @@ import ( "strings" ) -// Associates an access policy with the specified access point. Each access point -// can have only one policy, so a request made to this API replaces any existing -// policy associated with the specified access point. All Amazon S3 on Outposts -// REST API requests for this action require an additional parameter of -// x-amz-outpost-id to be passed with the request. In addition, you must use an S3 -// on Outposts endpoint hostname prefix instead of s3-control . For an example of -// the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts -// endpoint hostname prefix and the x-amz-outpost-id derived by using the access -// point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html#API_control_PutAccessPointPolicy_Examples) +// This operation is not supported by directory buckets. Associates an access +// policy with the specified access point. Each access point can have only one +// policy, so a request made to this API replaces any existing policy associated +// with the specified access point. All Amazon S3 on Outposts REST API requests for +// this action require an additional parameter of x-amz-outpost-id to be passed +// with the request. In addition, you must use an S3 on Outposts endpoint hostname +// prefix instead of s3-control . For an example of the request syntax for Amazon +// S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the +// x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html#API_control_PutAccessPointPolicy_Examples) // section. The following actions are related to PutAccessPointPolicy : // - GetAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointPolicy.html) // - DeleteAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html) diff --git a/service/s3control/api_op_PutAccessPointPolicyForObjectLambda.go b/service/s3control/api_op_PutAccessPointPolicyForObjectLambda.go index 74205ad6922..871d2af5061 100644 --- a/service/s3control/api_op_PutAccessPointPolicyForObjectLambda.go +++ b/service/s3control/api_op_PutAccessPointPolicyForObjectLambda.go @@ -15,8 +15,9 @@ import ( "strings" ) -// Creates or replaces resource policy for an Object Lambda Access Point. For an -// example policy, see Creating Object Lambda Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/olap-create.html#olap-create-cli) +// This operation is not supported by directory buckets. Creates or replaces +// resource policy for an Object Lambda Access Point. For an example policy, see +// Creating Object Lambda Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/olap-create.html#olap-create-cli) // in the Amazon S3 User Guide. The following actions are related to // PutAccessPointPolicyForObjectLambda : // - DeleteAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicyForObjectLambda.html) diff --git a/service/s3control/api_op_PutJobTagging.go b/service/s3control/api_op_PutJobTagging.go index c2d1c221923..01fdc2aa593 100644 --- a/service/s3control/api_op_PutJobTagging.go +++ b/service/s3control/api_op_PutJobTagging.go @@ -22,9 +22,9 @@ import ( // modify the existing tag set, you can either replace the existing tag set // entirely, or make changes within the existing tag set by retrieving the existing // tag set using GetJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetJobTagging.html) -// , modify that tag set, and use this action to replace the tag set with the one -// you modified. For more information, see Controlling access and labeling jobs -// using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) +// , modify that tag set, and use this operation to replace the tag set with the +// one you modified. For more information, see Controlling access and labeling +// jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) // in the Amazon S3 User Guide. // - If you send this request with an empty tag set, Amazon S3 deletes the // existing tag set on the Batch Operations job. If you use this method, you are @@ -44,8 +44,8 @@ import ( // User-Defined Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html) // in the Billing and Cost Management User Guide. // -// To use the PutJobTagging operation, you must have permission to perform the -// s3:PutJobTagging action. Related actions include: +// Permissions To use the PutJobTagging operation, you must have permission to +// perform the s3:PutJobTagging action. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - GetJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetJobTagging.html) // - DeleteJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteJobTagging.html) diff --git a/service/s3control/api_op_PutMultiRegionAccessPointPolicy.go b/service/s3control/api_op_PutMultiRegionAccessPointPolicy.go index 1a85143630d..2f95734b912 100644 --- a/service/s3control/api_op_PutMultiRegionAccessPointPolicy.go +++ b/service/s3control/api_op_PutMultiRegionAccessPointPolicy.go @@ -16,12 +16,13 @@ import ( "strings" ) -// Associates an access control policy with the specified Multi-Region Access -// Point. Each Multi-Region Access Point can have only one policy, so a request -// made to this action replaces any existing policy that is associated with the -// specified Multi-Region Access Point. This action will always be routed to the US -// West (Oregon) Region. For more information about the restrictions around -// managing Multi-Region Access Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) +// This operation is not supported by directory buckets. Associates an access +// control policy with the specified Multi-Region Access Point. Each Multi-Region +// Access Point can have only one policy, so a request made to this action replaces +// any existing policy that is associated with the specified Multi-Region Access +// Point. This action will always be routed to the US West (Oregon) Region. For +// more information about the restrictions around managing Multi-Region Access +// Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // PutMultiRegionAccessPointPolicy : // - GetMultiRegionAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPointPolicy.html) diff --git a/service/s3control/api_op_PutPublicAccessBlock.go b/service/s3control/api_op_PutPublicAccessBlock.go index 9d61078e54f..21af52ce2ec 100644 --- a/service/s3control/api_op_PutPublicAccessBlock.go +++ b/service/s3control/api_op_PutPublicAccessBlock.go @@ -16,10 +16,10 @@ import ( "strings" ) -// Creates or modifies the PublicAccessBlock configuration for an Amazon Web -// Services account. For this operation, users must have the -// s3:PutAccountPublicAccessBlock permission. For more information, see Using -// Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) +// This operation is not supported by directory buckets. Creates or modifies the +// PublicAccessBlock configuration for an Amazon Web Services account. For this +// operation, users must have the s3:PutAccountPublicAccessBlock permission. For +// more information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) // . Related actions include: // - GetPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetPublicAccessBlock.html) // - DeletePublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeletePublicAccessBlock.html) diff --git a/service/s3control/api_op_PutStorageLensConfiguration.go b/service/s3control/api_op_PutStorageLensConfiguration.go index 67f03584dca..83de0779be3 100644 --- a/service/s3control/api_op_PutStorageLensConfiguration.go +++ b/service/s3control/api_op_PutStorageLensConfiguration.go @@ -16,8 +16,9 @@ import ( "strings" ) -// Puts an Amazon S3 Storage Lens configuration. For more information about S3 -// Storage Lens, see Working with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Puts an Amazon S3 Storage +// Lens configuration. For more information about S3 Storage Lens, see Working +// with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. For a complete list of S3 Storage Lens metrics, see // S3 Storage Lens metrics glossary (https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage_lens_metrics_glossary.html) // in the Amazon S3 User Guide. To use this action, you must have permission to diff --git a/service/s3control/api_op_PutStorageLensConfigurationTagging.go b/service/s3control/api_op_PutStorageLensConfigurationTagging.go index c2e01243695..a8c23dec821 100644 --- a/service/s3control/api_op_PutStorageLensConfigurationTagging.go +++ b/service/s3control/api_op_PutStorageLensConfigurationTagging.go @@ -16,9 +16,10 @@ import ( "strings" ) -// Put or replace tags on an existing Amazon S3 Storage Lens configuration. For -// more information about S3 Storage Lens, see Assessing your storage activity and -// usage with Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) +// This operation is not supported by directory buckets. Put or replace tags on an +// existing Amazon S3 Storage Lens configuration. For more information about S3 +// Storage Lens, see Assessing your storage activity and usage with Amazon S3 +// Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:PutStorageLensConfigurationTagging action. For more information, // see Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) diff --git a/service/s3control/api_op_SubmitMultiRegionAccessPointRoutes.go b/service/s3control/api_op_SubmitMultiRegionAccessPointRoutes.go index ae14152bd40..91e31270ae2 100644 --- a/service/s3control/api_op_SubmitMultiRegionAccessPointRoutes.go +++ b/service/s3control/api_op_SubmitMultiRegionAccessPointRoutes.go @@ -16,20 +16,21 @@ import ( "strings" ) -// Submits an updated route configuration for a Multi-Region Access Point. This -// API operation updates the routing status for the specified Regions from active -// to passive, or from passive to active. A value of 0 indicates a passive status, -// which means that traffic won't be routed to the specified Region. A value of 100 -// indicates an active status, which means that traffic will be routed to the -// specified Region. At least one Region must be active at all times. When the -// routing configuration is changed, any in-progress operations (uploads, copies, -// deletes, and so on) to formerly active Regions will continue to run to their -// final completion state (success or failure). The routing configurations of any -// Regions that aren’t specified remain unchanged. Updated routing configurations -// might not be immediately applied. It can take up to 2 minutes for your changes -// to take effect. To submit routing control changes and failover requests, use the -// Amazon S3 failover control infrastructure endpoints in these five Amazon Web -// Services Regions: +// This operation is not supported by directory buckets. Submits an updated route +// configuration for a Multi-Region Access Point. This API operation updates the +// routing status for the specified Regions from active to passive, or from passive +// to active. A value of 0 indicates a passive status, which means that traffic +// won't be routed to the specified Region. A value of 100 indicates an active +// status, which means that traffic will be routed to the specified Region. At +// least one Region must be active at all times. When the routing configuration is +// changed, any in-progress operations (uploads, copies, deletes, and so on) to +// formerly active Regions will continue to run to their final completion state +// (success or failure). The routing configurations of any Regions that aren’t +// specified remain unchanged. Updated routing configurations might not be +// immediately applied. It can take up to 2 minutes for your changes to take +// effect. To submit routing control changes and failover requests, use the Amazon +// S3 failover control infrastructure endpoints in these five Amazon Web Services +// Regions: // - us-east-1 // - us-west-2 // - ap-southeast-2 diff --git a/service/s3control/api_op_UpdateJobPriority.go b/service/s3control/api_op_UpdateJobPriority.go index f3ec7340b4b..d81afb456a0 100644 --- a/service/s3control/api_op_UpdateJobPriority.go +++ b/service/s3control/api_op_UpdateJobPriority.go @@ -17,7 +17,9 @@ import ( // Updates an existing S3 Batch Operations job's priority. For more information, // see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) -// in the Amazon S3 User Guide. Related actions include: +// in the Amazon S3 User Guide. Permissions To use the UpdateJobPriority +// operation, you must have permission to perform the s3:UpdateJobPriority action. +// Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - DescribeJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeJob.html) diff --git a/service/s3control/api_op_UpdateJobStatus.go b/service/s3control/api_op_UpdateJobStatus.go index 56e7ae49adc..1059c1fbeb9 100644 --- a/service/s3control/api_op_UpdateJobStatus.go +++ b/service/s3control/api_op_UpdateJobStatus.go @@ -16,10 +16,12 @@ import ( "strings" ) -// Updates the status for the specified job. Use this action to confirm that you -// want to run a job or to cancel an existing job. For more information, see S3 -// Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) -// in the Amazon S3 User Guide. Related actions include: +// Updates the status for the specified job. Use this operation to confirm that +// you want to run a job or to cancel an existing job. For more information, see +// S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) +// in the Amazon S3 User Guide. Permissions To use the UpdateJobStatus operation, +// you must have permission to perform the s3:UpdateJobStatus action. Related +// actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - DescribeJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeJob.html) diff --git a/service/s3control/deserializers.go b/service/s3control/deserializers.go index 8edebf905b0..0dc4b4bcb54 100644 --- a/service/s3control/deserializers.go +++ b/service/s3control/deserializers.go @@ -16066,6 +16066,25 @@ func awsRestxml_deserializeDocumentLambdaInvokeOperation(v **types.LambdaInvokeO sv.FunctionArn = ptr.String(xtv) } + case strings.EqualFold("InvocationSchemaVersion", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + sv.InvocationSchemaVersion = ptr.String(xtv) + } + + case strings.EqualFold("UserArguments", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentUserArguments(&sv.UserArguments, nodeDecoder); err != nil { + return err + } + default: // Do nothing and ignore the unexpected tag element err = decoder.Decoder.Skip() @@ -24144,6 +24163,104 @@ func awsRestxml_deserializeDocumentTransitionListUnwrapped(v *[]types.Transition *v = sv return nil } +func awsRestxml_deserializeDocumentUserArguments(v *map[string]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv map[string]string + if *v == nil { + sv = make(map[string]string, 0) + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + switch { + case strings.EqualFold("entry", t.Name.Local): + entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentUserArgumentsUnwrapped(&sv, entryDecoder); err != nil { + return err + } + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentUserArgumentsUnwrapped(v *map[string]string, decoder smithyxml.NodeDecoder) error { + var sv map[string]string + if *v == nil { + sv = make(map[string]string, 0) + } else { + sv = *v + } + + var ek string + var ev string + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + sv[ek] = ev + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("key", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + ek = xtv + } + + case strings.EqualFold("value", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + ev = xtv + } + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} func awsRestxml_deserializeDocumentVpcConfiguration(v **types.VpcConfiguration, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/s3control/serializers.go b/service/s3control/serializers.go index 7dc5eeb9b38..808607a84ee 100644 --- a/service/s3control/serializers.go +++ b/service/s3control/serializers.go @@ -8791,6 +8791,30 @@ func awsRestxml_serializeDocumentLambdaInvokeOperation(v *types.LambdaInvokeOper el := value.MemberElement(root) el.String(*v.FunctionArn) } + if v.InvocationSchemaVersion != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "InvocationSchemaVersion", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.String(*v.InvocationSchemaVersion) + } + if v.UserArguments != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "UserArguments", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentUserArguments(v.UserArguments, el); err != nil { + return err + } + } return nil } @@ -11881,6 +11905,34 @@ func awsRestxml_serializeDocumentTransitionList(v []types.Transition, value smit return nil } +func awsRestxml_serializeDocumentUserArguments(v map[string]string, value smithyxml.Value) error { + if !value.IsFlattened() { + defer value.Close() + } + m := value.Map() + for key := range v { + entry := m.Entry() + keyElementAttr := []smithyxml.Attr{} + keyElement := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "key", + }, + Attr: keyElementAttr, + } + entry.MemberElement(keyElement).String(key) + valueElementAttr := []smithyxml.Attr{} + valueElement := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "value", + }, + Attr: valueElementAttr, + } + entry.MemberElement(valueElement).String(v[key]) + entry.Close() + } + return nil +} + func awsRestxml_serializeDocumentVersioningConfiguration(v *types.VersioningConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.MFADelete) > 0 { diff --git a/service/s3control/types/types.go b/service/s3control/types/types.go index eb436896388..ad4acb384f4 100644 --- a/service/s3control/types/types.go +++ b/service/s3control/types/types.go @@ -430,7 +430,7 @@ type Destination struct { // The storage class to use when replicating objects. All objects stored on S3 on // Outposts are stored in the OUTPOSTS storage class. S3 on Outposts uses the // OUTPOSTS storage class to create the object replicas. Values other than OUTPOSTS - // are not supported by Amazon S3 on Outposts. + // aren't supported by Amazon S3 on Outposts. StorageClass ReplicationStorageClass noSmithyDocumentSerde @@ -689,6 +689,9 @@ type JobListDescriptor struct { type JobManifest struct { // Contains the information required to locate the specified job's manifest. + // Manifests can't be imported from directory buckets. For more information, see + // Directory buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html) + // . // // This member is required. Location *JobManifestLocation @@ -759,7 +762,9 @@ type JobManifestGeneratorFilter struct { noSmithyDocumentSerde } -// Contains the information required to locate a manifest object. +// Contains the information required to locate a manifest object. Manifests can't +// be imported from directory buckets. For more information, see Directory buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html) +// . type JobManifestLocation struct { // The ETag for the specified manifest object. @@ -808,15 +813,17 @@ type JobOperation struct { LambdaInvoke *LambdaInvokeOperation // Directs the specified job to execute a DELETE Object tagging call on every - // object in the manifest. + // object in the manifest. This functionality is not supported by directory + // buckets. S3DeleteObjectTagging *S3DeleteObjectTaggingOperation // Directs the specified job to initiate restore requests for every archived - // object in the manifest. + // object in the manifest. This functionality is not supported by directory + // buckets. S3InitiateRestoreObject *S3InitiateRestoreObjectOperation // Directs the specified job to run a PutObjectAcl call on every object in the - // manifest. + // manifest. This functionality is not supported by directory buckets. S3PutObjectAcl *S3SetObjectAclOperation // Directs the specified job to run a PUT Copy object call on every object in the @@ -827,22 +834,24 @@ type JobOperation struct { // S3 Batch Operations job passes to every object to the underlying // PutObjectLegalHold API operation. For more information, see Using S3 Object // Lock legal hold with S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-legal-hold.html) - // in the Amazon S3 User Guide. + // in the Amazon S3 User Guide. This functionality is not supported by directory + // buckets. S3PutObjectLegalHold *S3SetObjectLegalHoldOperation // Contains the configuration parameters for the Object Lock retention action for // an S3 Batch Operations job. Batch Operations passes every object to the // underlying PutObjectRetention API operation. For more information, see Using S3 // Object Lock retention with S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-retention-date.html) - // in the Amazon S3 User Guide. + // in the Amazon S3 User Guide. This functionality is not supported by directory + // buckets. S3PutObjectRetention *S3SetObjectRetentionOperation // Directs the specified job to run a PUT Object tagging call on every object in - // the manifest. + // the manifest. This functionality is not supported by directory buckets. S3PutObjectTagging *S3SetObjectTaggingOperation // Directs the specified job to invoke ReplicateObject on every object in the - // job's manifest. + // job's manifest. This functionality is not supported by directory buckets. S3ReplicateObject *S3ReplicateObjectOperation noSmithyDocumentSerde @@ -876,7 +885,8 @@ type JobReport struct { Enabled bool // The Amazon Resource Name (ARN) for the bucket where specified job-completion - // report will be stored. + // report will be stored. Directory buckets - Directory buckets aren't supported as + // a location for Batch Operations to store job completion reports. Bucket *string // The format of the specified job-completion report. @@ -930,6 +940,27 @@ type LambdaInvokeOperation struct { // will invoke on every object in the manifest. FunctionArn *string + // Specifies the schema version for the payload that Batch Operations sends when + // invoking an Lambda function. Version 1.0 is the default. Version 2.0 is + // required when you use Batch Operations to invoke Lambda functions that act on + // directory buckets, or if you need to specify UserArguments . For more + // information, see Using Lambda with Amazon S3 Batch Operations and Amazon S3 + // Express One Zone (https://aws.amazon.com/blogs/storage/using-lambda-with-s3-batch-operations-and-s3-express-one-zone/) + // in the Amazon Web Services Storage Blog. Ensure that your Lambda function code + // expects InvocationSchemaVersion 2.0 and uses bucket name rather than bucket + // ARN. If the InvocationSchemaVersion does not match what your Lambda function + // expects, your function might not work as expected. Directory buckets - To + // initiate Amazon Web Services Lambda function to perform custom actions on + // objects in directory buckets, you must specify 2.0 . + InvocationSchemaVersion *string + + // Key-value pairs that are passed in the payload that Batch Operations sends when + // invoking an Lambda function. You must specify InvocationSchemaVersion 2.0 for + // LambdaInvoke operations that include UserArguments . For more information, see + // Using Lambda with Amazon S3 Batch Operations and Amazon S3 Express One Zone (https://aws.amazon.com/blogs/storage/using-lambda-with-s3-batch-operations-and-s3-express-one-zone/) + // in the Amazon Web Services Storage Blog. + UserArguments map[string]string + noSmithyDocumentSerde } @@ -1921,17 +1952,18 @@ type S3BucketDestination struct { // . type S3CopyObjectOperation struct { - // + // This functionality is not supported by directory buckets. AccessControlGrants []S3Grant // Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption // with server-side encryption using Amazon Web Services KMS (SSE-KMS). Setting // this header to true causes Amazon S3 to use an S3 Bucket Key for object // encryption with SSE-KMS. Specifying this header with an object action doesn’t - // affect bucket-level settings for S3 Bucket Key. + // affect bucket-level settings for S3 Bucket Key. This functionality is not + // supported by directory buckets. BucketKeyEnabled bool - // + // This functionality is not supported by directory buckets. CannedAccessControlList S3CannedAccessControlList // Indicates the algorithm that you want Amazon S3 to use to create the checksum. @@ -1950,31 +1982,42 @@ type S3CopyObjectOperation struct { // tags. Otherwise, Amazon S3 assigns the supplied tags to the new objects. NewObjectMetadata *S3ObjectMetadata - // + // Specifies a list of tags to add to the destination objects after they are + // copied. If NewObjectTagging is not specified, the tags of the source objects + // are copied to destination objects by default. Directory buckets - Tags aren't + // supported by directory buckets. If your source objects have tags and your + // destination bucket is a directory bucket, specify an empty tag set in the + // NewObjectTagging field to prevent copying the source object tags to the + // directory bucket. NewObjectTagging []S3Tag // The legal hold status to be applied to all objects in the Batch Operations job. + // This functionality is not supported by directory buckets. ObjectLockLegalHoldStatus S3ObjectLockLegalHoldStatus // The retention mode to be applied to all objects in the Batch Operations job. + // This functionality is not supported by directory buckets. ObjectLockMode S3ObjectLockMode // The date when the applied object retention configuration expires on all objects - // in the Batch Operations job. + // in the Batch Operations job. This functionality is not supported by directory + // buckets. ObjectLockRetainUntilDate *time.Time - // Specifies an optional metadata property for website redirects, - // x-amz-website-redirect-location . Allows webpage redirects if the object is - // accessed through a website endpoint. + // If the destination bucket is configured as a website, specifies an optional + // metadata property for website redirects, x-amz-website-redirect-location . + // Allows webpage redirects if the object copy is accessed through a website + // endpoint. This functionality is not supported by directory buckets. RedirectLocation *string - // + // This functionality is not supported by directory buckets. RequesterPays bool - // + // This functionality is not supported by directory buckets. SSEAwsKmsKeyId *string - // + // Specify the storage class for the destination objects in a Copy operation. + // Directory buckets - This functionality is not supported by directory buckets. StorageClass S3StorageClass // Specifies the folder prefix that you want the objects to be copied into. For @@ -1983,8 +2026,15 @@ type S3CopyObjectOperation struct { TargetKeyPrefix *string // Specifies the destination bucket Amazon Resource Name (ARN) for the batch copy - // operation. For example, to copy objects to a bucket named destinationBucket , - // set the TargetResource property to arn:aws:s3:::destinationBucket . + // operation. + // - General purpose buckets - For example, to copy objects to a general purpose + // bucket named destinationBucket , set the TargetResource property to + // arn:aws:s3:::destinationBucket . + // - Directory buckets - For example, to copy objects to a directory bucket + // named destinationBucket in the Availability Zone; identified by the AZ ID + // usw2-az2 , set the TargetResource property to + // arn:aws:s3express:region:account_id:/bucket/destination_bucket_base_name--usw2-az2--x-s3 + // . TargetResource *string // @@ -2008,7 +2058,9 @@ type S3GeneratedManifestDescriptor struct { // The format of the generated manifest. Format GeneratedManifestFormat - // Contains the information required to locate a manifest object. + // Contains the information required to locate a manifest object. Manifests can't + // be imported from directory buckets. For more information, see Directory buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html) + // . Location *JobManifestLocation noSmithyDocumentSerde @@ -2074,7 +2126,9 @@ type S3JobManifestGenerator struct { // This member is required. EnableManifestOutput bool - // The source bucket used by the ManifestGenerator. + // The source bucket used by the ManifestGenerator. Directory buckets - Directory + // buckets aren't supported as the source buckets used by S3JobManifestGenerator + // to generate the job manifest. // // This member is required. SourceBucket *string @@ -2084,12 +2138,15 @@ type S3JobManifestGenerator struct { // Services account ID must match this value, else the job fails. ExpectedBucketOwner *string - // Specifies rules the S3JobManifestGenerator should use to use to decide whether - // an object in the source bucket should or should not be included in the generated + // Specifies rules the S3JobManifestGenerator should use to decide whether an + // object in the source bucket should or should not be included in the generated // job manifest. Filter *JobManifestGeneratorFilter - // Specifies the location the generated manifest will be written to. + // Specifies the location the generated manifest will be written to. Manifests + // can't be written to directory buckets. For more information, see Directory + // buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html) + // . ManifestOutputLocation *S3ManifestOutputLocation noSmithyDocumentSerde @@ -2098,7 +2155,9 @@ type S3JobManifestGenerator struct { // Location details for where the generated manifest should be written. type S3ManifestOutputLocation struct { - // The bucket ARN the generated manifest should be written to. + // The bucket ARN the generated manifest should be written to. Directory buckets - + // Directory buckets aren't supported as the buckets to store the generated + // manifest. // // This member is required. Bucket *string @@ -2148,10 +2207,10 @@ type S3ObjectMetadata struct { // ContentLanguage *string - // + // This member has been deprecated. ContentLength *int64 - // + // This member has been deprecated. ContentMD5 *string // @@ -2160,10 +2219,11 @@ type S3ObjectMetadata struct { // HttpExpiresDate *time.Time - // + // This member has been deprecated. RequesterCharged bool - // + // For directory buckets, only the server-side encryption with Amazon S3 managed + // keys (SSE-S3) ( AES256 ) is supported. SSEAlgorithm S3SSEAlgorithm // @@ -2223,7 +2283,8 @@ type S3SetObjectAclOperation struct { // S3 Batch Operations job passes to every object to the underlying // PutObjectLegalHold API operation. For more information, see Using S3 Object // Lock legal hold with S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-legal-hold.html) -// in the Amazon S3 User Guide. +// in the Amazon S3 User Guide. This functionality is not supported by directory +// buckets. type S3SetObjectLegalHoldOperation struct { // Contains the Object Lock legal hold status to be applied to all objects in the @@ -2239,7 +2300,8 @@ type S3SetObjectLegalHoldOperation struct { // an S3 Batch Operations job. Batch Operations passes every object to the // underlying PutObjectRetention API operation. For more information, see Using S3 // Object Lock retention with S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-retention-date.html) -// in the Amazon S3 User Guide. +// in the Amazon S3 User Guide. This functionality is not supported by directory +// buckets. type S3SetObjectRetentionOperation struct { // Contains the Object Lock retention mode to be applied to all objects in the diff --git a/service/sts/api_client.go b/service/sts/api_client.go index 087c2bfcd2d..83e63ac0133 100644 --- a/service/sts/api_client.go +++ b/service/sts/api_client.go @@ -506,7 +506,7 @@ func (m *presignContextPolyfillMiddleware) HandleFinalize(ctx context.Context, i schemeID := rscheme.Scheme.SchemeID() - if schemeID == "aws.auth#sigv4" { + if schemeID == "aws.auth#sigv4" || schemeID == "com.amazonaws.s3#sigv4express" { if sn, ok := smithyhttp.GetSigV4SigningName(&rscheme.SignerProperties); ok { ctx = awsmiddleware.SetSigningName(ctx, sn) }