diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..9911f464f0c --- /dev/null +++ b/.changelog/41575353444b40ffbf474f4155544f00.json @@ -0,0 +1,8 @@ +{ + "id": "41575353-444b-40ff-bf47-4f4155544f00", + "type": "release", + "description": "New AWS service client module", + "modules": [ + "service/ivschat" + ] +} \ No newline at end of file diff --git a/.changelog/41bbd46a08894591844932da5efbae20.json b/.changelog/41bbd46a08894591844932da5efbae20.json new file mode 100644 index 00000000000..f1b3625b515 --- /dev/null +++ b/.changelog/41bbd46a08894591844932da5efbae20.json @@ -0,0 +1,8 @@ +{ + "id": "41bbd46a-0889-4591-8449-32da5efbae20", + "type": "feature", + "description": "Adds new APIs for IVS Chat, a feature for building interactive chat experiences alongside an IVS broadcast.", + "modules": [ + "service/ivschat" + ] +} \ No newline at end of file diff --git a/.changelog/5647ccf73ce64eaf82a6a9baa9929948.json b/.changelog/5647ccf73ce64eaf82a6a9baa9929948.json new file mode 100644 index 00000000000..3971d12e61b --- /dev/null +++ b/.changelog/5647ccf73ce64eaf82a6a9baa9929948.json @@ -0,0 +1,8 @@ +{ + "id": "5647ccf7-3ce6-4eaf-82a6-a9baa9929948", + "type": "documentation", + "description": "This release adds documentation for the APIs to create, read, delete, list, and batch read of AWS Glue custom patterns, and for Lake Formation configuration settings in the AWS Glue crawler.", + "modules": [ + "service/glue" + ] +} \ No newline at end of file diff --git a/.changelog/587257a00c6d453c9ddd984ff2e6350a.json b/.changelog/587257a00c6d453c9ddd984ff2e6350a.json new file mode 100644 index 00000000000..d18e09751e0 --- /dev/null +++ b/.changelog/587257a00c6d453c9ddd984ff2e6350a.json @@ -0,0 +1,8 @@ +{ + "id": "587257a0-0c6d-453c-9ddd-984ff2e6350a", + "type": "documentation", + "description": "Documentation updates for Price List API", + "modules": [ + "service/pricing" + ] +} \ No newline at end of file diff --git a/.changelog/6c92370b39d04e5eb417c0ac4010597d.json b/.changelog/6c92370b39d04e5eb417c0ac4010597d.json new file mode 100644 index 00000000000..d5ccf7aa9b1 --- /dev/null +++ b/.changelog/6c92370b39d04e5eb417c0ac4010597d.json @@ -0,0 +1,8 @@ +{ + "id": "6c92370b-39d0-4e5e-b417-c0ac4010597d", + "type": "feature", + "description": "CloudFront now supports the Server-Timing header in HTTP responses sent from CloudFront. You can use this header to view metrics that help you gain insights about the behavior and performance of CloudFront. To use this header, enable it in a response headers policy.", + "modules": [ + "service/cloudfront" + ] +} \ No newline at end of file diff --git a/.changelog/9b356f52bd6749b19a63fa1758b7ef5a.json b/.changelog/9b356f52bd6749b19a63fa1758b7ef5a.json new file mode 100644 index 00000000000..2d1cefdf50a --- /dev/null +++ b/.changelog/9b356f52bd6749b19a63fa1758b7ef5a.json @@ -0,0 +1,8 @@ +{ + "id": "9b356f52-bd67-49b1-9a63-fa1758b7ef5a", + "type": "feature", + "description": "AWS Network Firewall now enables customers to use a customer managed AWS KMS key for the encryption of their firewall resources.", + "modules": [ + "service/networkfirewall" + ] +} \ No newline at end of file diff --git a/.changelog/a334815f5a254840b138e03f14e102f1.json b/.changelog/a334815f5a254840b138e03f14e102f1.json new file mode 100644 index 00000000000..52d5a34394d --- /dev/null +++ b/.changelog/a334815f5a254840b138e03f14e102f1.json @@ -0,0 +1,8 @@ +{ + "id": "a334815f-5a25-4840-b138-e03f14e102f1", + "type": "feature", + "description": "SageMaker Inference Recommender now accepts customer KMS key ID for encryption of endpoints and compilation outputs created during inference recommendation.", + "modules": [ + "service/sagemaker" + ] +} \ No newline at end of file diff --git a/.changelog/bb7cfe22fdc3403bba16dbaa1c85a93f.json b/.changelog/bb7cfe22fdc3403bba16dbaa1c85a93f.json new file mode 100644 index 00000000000..ab820de1054 --- /dev/null +++ b/.changelog/bb7cfe22fdc3403bba16dbaa1c85a93f.json @@ -0,0 +1,8 @@ +{ + "id": "bb7cfe22-fdc3-403b-ba16-dbaa1c85a93f", + "type": "feature", + "description": "This release adds support for Lightsail load balancer HTTP to HTTPS redirect and TLS policy configuration.", + "modules": [ + "service/lightsail" + ] +} \ No newline at end of file diff --git a/service/cloudfront/deserializers.go b/service/cloudfront/deserializers.go index b56f34d7542..4a4bd09fc9d 100644 --- a/service/cloudfront/deserializers.go +++ b/service/cloudfront/deserializers.go @@ -34793,6 +34793,12 @@ func awsRestxml_deserializeDocumentResponseHeadersPolicyConfig(v **types.Respons return err } + case strings.EqualFold("ServerTimingHeadersConfig", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentResponseHeadersPolicyServerTimingHeadersConfig(&sv.ServerTimingHeadersConfig, nodeDecoder); err != nil { + return err + } + default: // Do nothing and ignore the unexpected tag element err = decoder.Decoder.Skip() @@ -35578,6 +35584,75 @@ func awsRestxml_deserializeDocumentResponseHeadersPolicySecurityHeadersConfig(v return nil } +func awsRestxml_deserializeDocumentResponseHeadersPolicyServerTimingHeadersConfig(v **types.ResponseHeadersPolicyServerTimingHeadersConfig, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *types.ResponseHeadersPolicyServerTimingHeadersConfig + if *v == nil { + sv = &types.ResponseHeadersPolicyServerTimingHeadersConfig{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("Enabled", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv, err := strconv.ParseBool(string(val)) + if err != nil { + return fmt.Errorf("expected boolean to be of type *bool, got %T instead", val) + } + sv.Enabled = ptr.Bool(xtv) + } + + case strings.EqualFold("SamplingRate", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + f64, err := strconv.ParseFloat(xtv, 64) + if err != nil { + return err + } + sv.SamplingRate = ptr.Float64(f64) + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsRestxml_deserializeDocumentResponseHeadersPolicyStrictTransportSecurity(v **types.ResponseHeadersPolicyStrictTransportSecurity, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/cloudfront/serializers.go b/service/cloudfront/serializers.go index 20ce3148d74..98b37bbca45 100644 --- a/service/cloudfront/serializers.go +++ b/service/cloudfront/serializers.go @@ -12,6 +12,7 @@ import ( smithyxml "github.com/aws/smithy-go/encoding/xml" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" + "math" ) type awsRestxml_serializeOpAssociateAlias struct { @@ -9929,6 +9930,19 @@ func awsRestxml_serializeDocumentResponseHeadersPolicyConfig(v *types.ResponseHe return err } } + if v.ServerTimingHeadersConfig != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "ServerTimingHeadersConfig", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentResponseHeadersPolicyServerTimingHeadersConfig(v.ServerTimingHeadersConfig, el); err != nil { + return err + } + } return nil } @@ -10291,6 +10305,46 @@ func awsRestxml_serializeDocumentResponseHeadersPolicySecurityHeadersConfig(v *t return nil } +func awsRestxml_serializeDocumentResponseHeadersPolicyServerTimingHeadersConfig(v *types.ResponseHeadersPolicyServerTimingHeadersConfig, value smithyxml.Value) error { + defer value.Close() + if v.Enabled != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "Enabled", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Boolean(*v.Enabled) + } + if v.SamplingRate != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "SamplingRate", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + switch { + case math.IsNaN(*v.SamplingRate): + el.String("NaN") + + case math.IsInf(*v.SamplingRate, 1): + el.String("Infinity") + + case math.IsInf(*v.SamplingRate, -1): + el.String("-Infinity") + + default: + el.Double(*v.SamplingRate) + + } + } + return nil +} + func awsRestxml_serializeDocumentResponseHeadersPolicyStrictTransportSecurity(v *types.ResponseHeadersPolicyStrictTransportSecurity, value smithyxml.Value) error { defer value.Close() if v.AccessControlMaxAgeSec != nil { diff --git a/service/cloudfront/types/types.go b/service/cloudfront/types/types.go index 463ca9a8bca..3342afc498b 100644 --- a/service/cloudfront/types/types.go +++ b/service/cloudfront/types/types.go @@ -3833,6 +3833,10 @@ type ResponseHeadersPolicyConfig struct { // A configuration for a set of security-related HTTP response headers. SecurityHeadersConfig *ResponseHeadersPolicySecurityHeadersConfig + // A configuration for enabling the Server-Timing header in HTTP responses sent + // from CloudFront. + ServerTimingHeadersConfig *ResponseHeadersPolicyServerTimingHeadersConfig + noSmithyDocumentSerde } @@ -4135,6 +4139,39 @@ type ResponseHeadersPolicySecurityHeadersConfig struct { noSmithyDocumentSerde } +// A configuration for enabling the Server-Timing header in HTTP responses sent +// from CloudFront. CloudFront adds this header to HTTP responses that it sends in +// response to requests that match a cache behavior that's associated with this +// response headers policy. You can use the Server-Timing header to view metrics +// that can help you gain insights about the behavior and performance of +// CloudFront. For example, you can see which cache layer served a cache hit, or +// the first byte latency from the origin when there was a cache miss. You can use +// the metrics in the Server-Timing header to troubleshoot issues or test the +// efficiency of your CloudFront configuration. For more information, see +// Server-Timing header +// (https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/understanding-response-headers-policies.html#server-timing-header) +// in the Amazon CloudFront Developer Guide. +type ResponseHeadersPolicyServerTimingHeadersConfig struct { + + // A Boolean that determines whether CloudFront adds the Server-Timing header to + // HTTP responses that it sends in response to requests that match a cache behavior + // that's associated with this response headers policy. + // + // This member is required. + Enabled *bool + + // A number 0–100 (inclusive) that specifies the percentage of responses that you + // want CloudFront to add the Server-Timing header to. When you set the sampling + // rate to 100, CloudFront adds the Server-Timing header to the HTTP response for + // every request that matches the cache behavior that this response headers policy + // is attached to. When you set it to 50, CloudFront adds the header to 50% of the + // responses for requests that match the cache behavior. You can set the sampling + // rate to any number 0–100 with up to four decimal places. + SamplingRate *float64 + + noSmithyDocumentSerde +} + // Determines whether CloudFront includes the Strict-Transport-Security HTTP // response header and the header’s value. For more information about the // Strict-Transport-Security HTTP response header, see Strict-Transport-Security diff --git a/service/cloudfront/validators.go b/service/cloudfront/validators.go index 8ce4f91fd96..d90898e41f5 100644 --- a/service/cloudfront/validators.go +++ b/service/cloudfront/validators.go @@ -3570,6 +3570,11 @@ func validateResponseHeadersPolicyConfig(v *types.ResponseHeadersPolicyConfig) e invalidParams.AddNested("CustomHeadersConfig", err.(smithy.InvalidParamsError)) } } + if v.ServerTimingHeadersConfig != nil { + if err := validateResponseHeadersPolicyServerTimingHeadersConfig(v.ServerTimingHeadersConfig); err != nil { + invalidParams.AddNested("ServerTimingHeadersConfig", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -3790,6 +3795,21 @@ func validateResponseHeadersPolicySecurityHeadersConfig(v *types.ResponseHeaders } } +func validateResponseHeadersPolicyServerTimingHeadersConfig(v *types.ResponseHeadersPolicyServerTimingHeadersConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ResponseHeadersPolicyServerTimingHeadersConfig"} + if v.Enabled == nil { + invalidParams.Add(smithy.NewErrParamRequired("Enabled")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateResponseHeadersPolicyStrictTransportSecurity(v *types.ResponseHeadersPolicyStrictTransportSecurity) error { if v == nil { return nil diff --git a/service/glue/api_op_BatchGetCustomEntityTypes.go b/service/glue/api_op_BatchGetCustomEntityTypes.go index 9faf6c74754..7891f7b528a 100644 --- a/service/glue/api_op_BatchGetCustomEntityTypes.go +++ b/service/glue/api_op_BatchGetCustomEntityTypes.go @@ -11,6 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +// Retrieves the details for the custom patterns specified by a list of names. func (c *Client) BatchGetCustomEntityTypes(ctx context.Context, params *BatchGetCustomEntityTypesInput, optFns ...func(*Options)) (*BatchGetCustomEntityTypesOutput, error) { if params == nil { params = &BatchGetCustomEntityTypesInput{} @@ -28,6 +29,8 @@ func (c *Client) BatchGetCustomEntityTypes(ctx context.Context, params *BatchGet type BatchGetCustomEntityTypesInput struct { + // A list of names of the custom patterns that you want to retrieve. + // // This member is required. Names []string @@ -35,8 +38,12 @@ type BatchGetCustomEntityTypesInput struct { } type BatchGetCustomEntityTypesOutput struct { + + // A list of CustomEntityType objects representing the custom patterns that have + // been created. CustomEntityTypes []types.CustomEntityType + // A list of the names of custom patterns that were not found. CustomEntityTypesNotFound []string // Metadata pertaining to the operation's result. diff --git a/service/glue/api_op_CreateCrawler.go b/service/glue/api_op_CreateCrawler.go index 310a6ed7eb0..46efb3078ba 100644 --- a/service/glue/api_op_CreateCrawler.go +++ b/service/glue/api_op_CreateCrawler.go @@ -67,6 +67,7 @@ type CreateCrawlerInput struct { // A description of the new crawler. Description *string + // Specifies AWS Lake Formation configuration settings for the crawler. LakeFormationConfiguration *types.LakeFormationConfiguration // Specifies data lineage configuration settings for the crawler. diff --git a/service/glue/api_op_CreateCustomEntityType.go b/service/glue/api_op_CreateCustomEntityType.go index 30e2b14446a..99a435f5346 100644 --- a/service/glue/api_op_CreateCustomEntityType.go +++ b/service/glue/api_op_CreateCustomEntityType.go @@ -10,6 +10,10 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +// Creates a custom pattern that is used to detect sensitive data across the +// columns and rows of your structured data. Each custom pattern you create +// specifies a regular expression and an optional list of context words. If no +// context words are passed only a regular expression is checked. func (c *Client) CreateCustomEntityType(ctx context.Context, params *CreateCustomEntityTypeInput, optFns ...func(*Options)) (*CreateCustomEntityTypeOutput, error) { if params == nil { params = &CreateCustomEntityTypeInput{} @@ -27,18 +31,29 @@ func (c *Client) CreateCustomEntityType(ctx context.Context, params *CreateCusto type CreateCustomEntityTypeInput struct { + // A name for the custom pattern that allows it to be retrieved or deleted later. + // This name must be unique per Amazon Web Services account. + // // This member is required. Name *string + // A regular expression string that is used for detecting sensitive data in a + // custom pattern. + // // This member is required. RegexString *string + // A list of context words. If none of these context words are found within the + // vicinity of the regular expression the data will not be detected as sensitive + // data. If no context words are passed only a regular expression is checked. ContextWords []string noSmithyDocumentSerde } type CreateCustomEntityTypeOutput struct { + + // The name of the custom pattern you created. Name *string // Metadata pertaining to the operation's result. diff --git a/service/glue/api_op_DeleteCustomEntityType.go b/service/glue/api_op_DeleteCustomEntityType.go index 0b7c5219c9c..048fa7ed38c 100644 --- a/service/glue/api_op_DeleteCustomEntityType.go +++ b/service/glue/api_op_DeleteCustomEntityType.go @@ -10,6 +10,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +// Deletes a custom pattern by specifying its name. func (c *Client) DeleteCustomEntityType(ctx context.Context, params *DeleteCustomEntityTypeInput, optFns ...func(*Options)) (*DeleteCustomEntityTypeOutput, error) { if params == nil { params = &DeleteCustomEntityTypeInput{} @@ -27,6 +28,8 @@ func (c *Client) DeleteCustomEntityType(ctx context.Context, params *DeleteCusto type DeleteCustomEntityTypeInput struct { + // The name of the custom pattern that you want to delete. + // // This member is required. Name *string @@ -34,6 +37,8 @@ type DeleteCustomEntityTypeInput struct { } type DeleteCustomEntityTypeOutput struct { + + // The name of the custom pattern you deleted. Name *string // Metadata pertaining to the operation's result. diff --git a/service/glue/api_op_GetCustomEntityType.go b/service/glue/api_op_GetCustomEntityType.go index a372082e746..f1fc2cddd03 100644 --- a/service/glue/api_op_GetCustomEntityType.go +++ b/service/glue/api_op_GetCustomEntityType.go @@ -10,6 +10,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +// Retrieves the details of a custom pattern by specifying its name. func (c *Client) GetCustomEntityType(ctx context.Context, params *GetCustomEntityTypeInput, optFns ...func(*Options)) (*GetCustomEntityTypeOutput, error) { if params == nil { params = &GetCustomEntityTypeInput{} @@ -27,6 +28,8 @@ func (c *Client) GetCustomEntityType(ctx context.Context, params *GetCustomEntit type GetCustomEntityTypeInput struct { + // The name of the custom pattern that you want to retrieve. + // // This member is required. Name *string @@ -34,10 +37,17 @@ type GetCustomEntityTypeInput struct { } type GetCustomEntityTypeOutput struct { + + // A list of context words if specified when you created the custom pattern. If + // none of these context words are found within the vicinity of the regular + // expression the data will not be detected as sensitive data. ContextWords []string + // The name of the custom pattern that you retrieved. Name *string + // A regular expression string that is used for detecting sensitive data in a + // custom pattern. RegexString *string // Metadata pertaining to the operation's result. diff --git a/service/glue/api_op_ListCustomEntityTypes.go b/service/glue/api_op_ListCustomEntityTypes.go index 6afb7c7caf7..0c208a6362f 100644 --- a/service/glue/api_op_ListCustomEntityTypes.go +++ b/service/glue/api_op_ListCustomEntityTypes.go @@ -12,6 +12,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +// Lists all the custom patterns that have been created. func (c *Client) ListCustomEntityTypes(ctx context.Context, params *ListCustomEntityTypesInput, optFns ...func(*Options)) (*ListCustomEntityTypesOutput, error) { if params == nil { params = &ListCustomEntityTypesInput{} @@ -28,16 +29,22 @@ func (c *Client) ListCustomEntityTypes(ctx context.Context, params *ListCustomEn } type ListCustomEntityTypesInput struct { + + // The maximum number of results to return. MaxResults *int32 + // A paginated token to offset the results. NextToken *string noSmithyDocumentSerde } type ListCustomEntityTypesOutput struct { + + // A list of CustomEntityType objects representing custom patterns. CustomEntityTypes []types.CustomEntityType + // A pagination token, if more results are available. NextToken *string // Metadata pertaining to the operation's result. @@ -117,6 +124,7 @@ var _ ListCustomEntityTypesAPIClient = (*Client)(nil) // ListCustomEntityTypesPaginatorOptions is the paginator options for // ListCustomEntityTypes type ListCustomEntityTypesPaginatorOptions struct { + // The maximum number of results to return. Limit int32 // Set to true if pagination should stop if the service returns a pagination token diff --git a/service/glue/api_op_UpdateCrawler.go b/service/glue/api_op_UpdateCrawler.go index bfbc0a3d924..6819f820805 100644 --- a/service/glue/api_op_UpdateCrawler.go +++ b/service/glue/api_op_UpdateCrawler.go @@ -55,6 +55,7 @@ type UpdateCrawlerInput struct { // A description of the new crawler. Description *string + // Specifies AWS Lake Formation configuration settings for the crawler. LakeFormationConfiguration *types.LakeFormationConfiguration // Specifies data lineage configuration settings for the crawler. diff --git a/service/glue/types/types.go b/service/glue/types/types.go index 6b7dc21e1cd..baaab15cccb 100644 --- a/service/glue/types/types.go +++ b/service/glue/types/types.go @@ -925,6 +925,8 @@ type Crawler struct { // A description of the crawler. Description *string + // Specifies whether the crawler should use AWS Lake Formation credentials for the + // crawler instead of the IAM role credentials. LakeFormationConfiguration *LakeFormationConfiguration // The status of the last crawl, and potentially error information if an error @@ -1170,14 +1172,25 @@ type CsvClassifier struct { noSmithyDocumentSerde } +// An object representing a custom pattern for detecting sensitive data across the +// columns and rows of your structured data. type CustomEntityType struct { + // A name for the custom pattern that allows it to be retrieved or deleted later. + // This name must be unique per Amazon Web Services account. + // // This member is required. Name *string + // A regular expression string that is used for detecting sensitive data in a + // custom pattern. + // // This member is required. RegexString *string + // A list of context words. If none of these context words are found within the + // vicinity of the regular expression the data will not be detected as sensitive + // data. If no context words are passed only a regular expression is checked. ContextWords []string noSmithyDocumentSerde @@ -2400,9 +2413,15 @@ type LabelingSetGenerationTaskRunProperties struct { noSmithyDocumentSerde } +// Specifies AWS Lake Formation configuration settings for the crawler. type LakeFormationConfiguration struct { + + // Required for cross account crawls. For same account crawls as the target data, + // this can be left as null. AccountId *string + // Specifies whether to use AWS Lake Formation credentials for the crawler instead + // of the IAM role credentials. UseLakeFormationCredentials *bool noSmithyDocumentSerde diff --git a/service/ivschat/LICENSE.txt b/service/ivschat/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/ivschat/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/ivschat/api_client.go b/service/ivschat/api_client.go new file mode 100644 index 00000000000..d0dc2b94d9a --- /dev/null +++ b/service/ivschat/api_client.go @@ -0,0 +1,434 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/defaults" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + smithy "github.com/aws/smithy-go" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net" + "net/http" + "time" +) + +const ServiceID = "ivschat" +const ServiceAPIVersion = "2020-07-14" + +// Client provides the API client to make operations call for Amazon Interactive +// Video Service Chat. +type Client struct { + options Options +} + +// New returns an initialized Client based on the functional options. Provide +// additional functional options to further configure the behavior of the client, +// such as changing the client's endpoint or adding custom middleware behavior. +func New(options Options, optFns ...func(*Options)) *Client { + options = options.Copy() + + resolveDefaultLogger(&options) + + setResolvedDefaultsMode(&options) + + resolveRetryer(&options) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveDefaultEndpointConfiguration(&options) + + for _, fn := range optFns { + fn(&options) + } + + client := &Client{ + options: options, + } + + return client +} + +type Options struct { + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // Configures the events that will be sent to the configured logger. + ClientLogMode aws.ClientLogMode + + // The credentials object to use when signing requests. + Credentials aws.CredentialsProvider + + // The configuration DefaultsMode that the SDK should use when constructing the + // clients initial default settings. + DefaultsMode aws.DefaultsMode + + // The endpoint options to be used when attempting to resolve an endpoint. + EndpointOptions EndpointResolverOptions + + // The service endpoint resolver. + EndpointResolver EndpointResolver + + // Signature Version 4 (SigV4) Signer + HTTPSignerV4 HTTPSignerV4 + + // The logger writer interface to write logging messages to. + Logger logging.Logger + + // The region to send requests to. (Required) + Region string + + // RetryMaxAttempts specifies the maximum number attempts an API client will call + // an operation that fails with a retryable error. A value of 0 is ignored, and + // will not be used to configure the API client created default retryer, or modify + // per operation call's retry max attempts. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. If specified in an operation call's functional + // options with a value that is different than the constructed client's Options, + // the Client's Retryer will be wrapped to use the operation's specific + // RetryMaxAttempts value. + RetryMaxAttempts int + + // RetryMode specifies the retry mode the API client will be created with, if + // Retryer option is not also specified. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. Currently does not support per operation call + // overrides, may in the future. + RetryMode aws.RetryMode + + // Retryer guides how HTTP requests should be retried in case of recoverable + // failures. When nil the API client will use a default retryer. The kind of + // default retry created by the API client can be changed with the RetryMode + // option. + Retryer aws.Retryer + + // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set + // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You + // should not populate this structure programmatically, or rely on the values here + // within your applications. + RuntimeEnvironment aws.RuntimeEnvironment + + // The initial DefaultsMode used when the client options were constructed. If the + // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved + // value was at that point in time. Currently does not support per operation call + // overrides, may in the future. + resolvedDefaultsMode aws.DefaultsMode + + // The HTTP client to invoke API calls with. Defaults to client's default HTTP + // implementation if nil. + HTTPClient HTTPClient +} + +// WithAPIOptions returns a functional option for setting the Client's APIOptions +// option. +func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { + return func(o *Options) { + o.APIOptions = append(o.APIOptions, optFns...) + } +} + +// WithEndpointResolver returns a functional option for setting the Client's +// EndpointResolver option. +func WithEndpointResolver(v EndpointResolver) func(*Options) { + return func(o *Options) { + o.EndpointResolver = v + } +} + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// Copy creates a clone where the APIOptions list is deep copied. +func (o Options) Copy() Options { + to := o + to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions)) + copy(to.APIOptions, o.APIOptions) + + return to +} +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttemptOptions(&options, *c) + + finalizeClientEndpointResolverOptions(&options) + + for _, fn := range stackFns { + if err := fn(stack, options); err != nil { + return nil, metadata, err + } + } + + for _, fn := range options.APIOptions { + if err := fn(stack); err != nil { + return nil, metadata, err + } + } + + handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) + result, metadata, err = handler.Handle(ctx, params) + if err != nil { + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + return result, metadata, err +} + +type noSmithyDocumentSerde = smithydocument.NoSerde + +func resolveDefaultLogger(o *Options) { + if o.Logger != nil { + return + } + o.Logger = logging.Nop{} +} + +func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error { + return middleware.AddSetLoggerMiddleware(stack, o.Logger) +} + +func setResolvedDefaultsMode(o *Options) { + if len(o.resolvedDefaultsMode) > 0 { + return + } + + var mode aws.DefaultsMode + mode.SetFromString(string(o.DefaultsMode)) + + if mode == aws.DefaultsModeAuto { + mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment) + } + + o.resolvedDefaultsMode = mode +} + +// NewFromConfig returns a new client from the provided config. +func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { + opts := Options{ + Region: cfg.Region, + DefaultsMode: cfg.DefaultsMode, + RuntimeEnvironment: cfg.RuntimeEnvironment, + HTTPClient: cfg.HTTPClient, + Credentials: cfg.Credentials, + APIOptions: cfg.APIOptions, + Logger: cfg.Logger, + ClientLogMode: cfg.ClientLogMode, + } + resolveAWSRetryerProvider(cfg, &opts) + resolveAWSRetryMaxAttempts(cfg, &opts) + resolveAWSRetryMode(cfg, &opts) + resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStackEndpoint(cfg, &opts) + resolveUseFIPSEndpoint(cfg, &opts) + return New(opts, optFns...) +} + +func resolveHTTPClient(o *Options) { + var buildable *awshttp.BuildableClient + + if o.HTTPClient != nil { + var ok bool + buildable, ok = o.HTTPClient.(*awshttp.BuildableClient) + if !ok { + return + } + } else { + buildable = awshttp.NewBuildableClient() + } + + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) { + if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok { + dialer.Timeout = dialerTimeout + } + }) + + buildable = buildable.WithTransportOptions(func(transport *http.Transport) { + if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok { + transport.TLSHandshakeTimeout = tlsHandshakeTimeout + } + }) + } + + o.HTTPClient = buildable +} + +func resolveRetryer(o *Options) { + if o.Retryer != nil { + return + } + + if len(o.RetryMode) == 0 { + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + o.RetryMode = modeConfig.RetryMode + } + } + if len(o.RetryMode) == 0 { + o.RetryMode = aws.RetryModeStandard + } + + var standardOptions []func(*retry.StandardOptions) + if v := o.RetryMaxAttempts; v != 0 { + standardOptions = append(standardOptions, func(so *retry.StandardOptions) { + so.MaxAttempts = v + }) + } + + switch o.RetryMode { + case aws.RetryModeAdaptive: + var adaptiveOptions []func(*retry.AdaptiveModeOptions) + if len(standardOptions) != 0 { + adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) { + ao.StandardOptions = append(ao.StandardOptions, standardOptions...) + }) + } + o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...) + + default: + o.Retryer = retry.NewStandard(standardOptions...) + } +} + +func resolveAWSRetryerProvider(cfg aws.Config, o *Options) { + if cfg.Retryer == nil { + return + } + o.Retryer = cfg.Retryer() +} + +func resolveAWSRetryMode(cfg aws.Config, o *Options) { + if len(cfg.RetryMode) == 0 { + return + } + o.RetryMode = cfg.RetryMode +} +func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { + if cfg.RetryMaxAttempts == 0 { + return + } + o.RetryMaxAttempts = cfg.RetryMaxAttempts +} + +func finalizeRetryMaxAttemptOptions(o *Options, client Client) { + if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func resolveAWSEndpointResolver(cfg aws.Config, o *Options) { + if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil { + return + } + o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver()) +} + +func addClientUserAgent(stack *middleware.Stack) error { + return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "ivschat", goModuleVersion)(stack) +} + +func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error { + mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{ + CredentialsProvider: o.Credentials, + Signer: o.HTTPSignerV4, + LogSigning: o.ClientLogMode.IsSigning(), + }) + return stack.Finalize.Add(mw, middleware.After) +} + +type HTTPSignerV4 interface { + SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error +} + +func resolveHTTPSignerV4(o *Options) { + if o.HTTPSignerV4 != nil { + return + } + o.HTTPSignerV4 = newDefaultV4Signer(*o) +} + +func newDefaultV4Signer(o Options) *v4.Signer { + return v4.NewSigner(func(so *v4.SignerOptions) { + so.Logger = o.Logger + so.LogSigning = o.ClientLogMode.IsSigning() + }) +} + +func addRetryMiddlewares(stack *middleware.Stack, o Options) error { + mo := retry.AddRetryMiddlewaresOptions{ + Retryer: o.Retryer, + LogRetryAttempts: o.ClientLogMode.IsRetries(), + } + return retry.AddRetryMiddlewares(stack, mo) +} + +// resolves dual-stack endpoint configuration +func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseDualStackEndpoint = value + } + return nil +} + +// resolves FIPS endpoint configuration +func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseFIPSEndpoint = value + } + return nil +} + +func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { + return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) +} + +func addResponseErrorMiddleware(stack *middleware.Stack) error { + return awshttp.AddResponseErrorMiddleware(stack) +} + +func addRequestResponseLogging(stack *middleware.Stack, o Options) error { + return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ + LogRequest: o.ClientLogMode.IsRequest(), + LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), + LogResponse: o.ClientLogMode.IsResponse(), + LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), + }, middleware.After) +} diff --git a/service/ivschat/api_client_test.go b/service/ivschat/api_client_test.go new file mode 100644 index 00000000000..cefadda0cc0 --- /dev/null +++ b/service/ivschat/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +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/ivschat/api_op_CreateChatToken.go b/service/ivschat/api_op_CreateChatToken.go new file mode 100644 index 00000000000..6bbf398fb8c --- /dev/null +++ b/service/ivschat/api_op_CreateChatToken.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/ivschat/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Creates an encrypted token that is used to establish an individual WebSocket +// connection to a room. The token is valid for one minute, and a connection +// (session) established with the token is valid for the specified duration. +// Encryption keys are owned by Amazon IVS Chat and never used directly by your +// application. +func (c *Client) CreateChatToken(ctx context.Context, params *CreateChatTokenInput, optFns ...func(*Options)) (*CreateChatTokenOutput, error) { + if params == nil { + params = &CreateChatTokenInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateChatToken", params, optFns, c.addOperationCreateChatTokenMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateChatTokenOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateChatTokenInput struct { + + // Identifier of the room that the client is trying to access. Currently this must + // be an ARN. + // + // This member is required. + RoomIdentifier *string + + // Application-provided ID that uniquely identifies the user associated with this + // token. This can be any UTF-8 encoded text. + // + // This member is required. + UserId *string + + // Application-provided attributes to encode into the token and attach to a chat + // session. Map keys and values can contain UTF-8 encoded text. The maximum length + // of this field is 1 KB total. + Attributes map[string]string + + // Set of capabilities that the user is allowed to perform in the room. Default: + // None (the capability to view messages is implicitly included in all requests). + Capabilities []types.ChatTokenCapability + + // Session duration (in minutes), after which the session expires. Default: 60 (1 + // hour). + SessionDurationInMinutes int32 + + noSmithyDocumentSerde +} + +type CreateChatTokenOutput struct { + + // Time after which an end user's session is no longer valid. This is an ISO 8601 + // timestamp; note that this is returned as a string. + SessionExpirationTime *time.Time + + // The issued client token, encrypted. + Token *string + + // Time after which the token is no longer valid and cannot be used to connect to a + // room. This is an ISO 8601 timestamp; note that this is returned as a string. + TokenExpirationTime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateChatTokenMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateChatToken{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateChatToken{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpCreateChatTokenValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateChatToken(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCreateChatToken(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "CreateChatToken", + } +} diff --git a/service/ivschat/api_op_CreateRoom.go b/service/ivschat/api_op_CreateRoom.go new file mode 100644 index 00000000000..6a22610fe31 --- /dev/null +++ b/service/ivschat/api_op_CreateRoom.go @@ -0,0 +1,161 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/ivschat/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Creates a room that allows clients to connect and pass messages. +func (c *Client) CreateRoom(ctx context.Context, params *CreateRoomInput, optFns ...func(*Options)) (*CreateRoomOutput, error) { + if params == nil { + params = &CreateRoomInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateRoom", params, optFns, c.addOperationCreateRoomMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateRoomOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateRoomInput struct { + + // Maximum number of characters in a single message. Messages are expected to be + // UTF-8 encoded and this limit applies specifically to rune/code-point count, not + // number of bytes. Default: 500. + MaximumMessageLength int32 + + // Maximum number of messages per second that a client can send to the room. + // Default: 10. + MaximumMessageRatePerSecond int32 + + // Configuration information for optional review of messages. + MessageReviewHandler *types.MessageReviewHandler + + // Room name. The value does not need to be unique. + Name *string + + // Tags to attach to the resource. Array of maps, each of the form string:string + // (key:value). + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateRoomOutput struct { + + // Room ARN, assigned by the system. + Arn *string + + // Time when the room was created. This is an ISO 8601 timestamp; note that this is + // returned as a string. + CreateTime *time.Time + + // Room ID, generated by the system. This is a relative identifier, the part of the + // ARN that uniquely identifies the room. + Id *string + + // Maximum number of characters in a single message, from the request. + MaximumMessageLength int32 + + // Maximum number of messages per second that a client can send to the room, from + // the request. + MaximumMessageRatePerSecond int32 + + // Configuration information for optional review of messages. + MessageReviewHandler *types.MessageReviewHandler + + // Room name, from the request (if specified). + Name *string + + // Tags attached to the resource, from the request. + Tags map[string]string + + // Time of the room’s last update. This is an ISO 8601 timestamp; note that this is + // returned as a string. + UpdateTime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateRoomMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateRoom{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateRoom{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRoom(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCreateRoom(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "CreateRoom", + } +} diff --git a/service/ivschat/api_op_DeleteMessage.go b/service/ivschat/api_op_DeleteMessage.go new file mode 100644 index 00000000000..189f6e62069 --- /dev/null +++ b/service/ivschat/api_op_DeleteMessage.go @@ -0,0 +1,137 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Sends an event to a specific room which directs clients to delete a specific +// message; that is, unrender it from view and delete it from the client’s chat +// history. This event’s EventName is aws:DELETE_MESSAGE. This replicates the +// DeleteMessage +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-deletemessage-publish.html) +// WebSocket operation in the Amazon IVS Chat Messaging API. +func (c *Client) DeleteMessage(ctx context.Context, params *DeleteMessageInput, optFns ...func(*Options)) (*DeleteMessageOutput, error) { + if params == nil { + params = &DeleteMessageInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteMessage", params, optFns, c.addOperationDeleteMessageMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteMessageOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteMessageInput struct { + + // ID of the message to be deleted. This is the Id field in the received message + // (see Message (Subscribe) + // (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-message-subscribe.html) + // in the Chat Messaging API). + // + // This member is required. + Id *string + + // Identifier of the room where the message should be deleted. Currently this must + // be an ARN. + // + // This member is required. + RoomIdentifier *string + + // Reason for deleting the message. + Reason *string + + noSmithyDocumentSerde +} + +type DeleteMessageOutput struct { + + // Operation identifier, generated by Amazon IVS Chat. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteMessageMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteMessage{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteMessage{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteMessageValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteMessage(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteMessage(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "DeleteMessage", + } +} diff --git a/service/ivschat/api_op_DeleteRoom.go b/service/ivschat/api_op_DeleteRoom.go new file mode 100644 index 00000000000..0c5dd9ec7fc --- /dev/null +++ b/service/ivschat/api_op_DeleteRoom.go @@ -0,0 +1,116 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the specified room. +func (c *Client) DeleteRoom(ctx context.Context, params *DeleteRoomInput, optFns ...func(*Options)) (*DeleteRoomOutput, error) { + if params == nil { + params = &DeleteRoomInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteRoom", params, optFns, c.addOperationDeleteRoomMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteRoomOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteRoomInput struct { + + // Identifier of the room to be deleted. Currently this must be an ARN. + // + // This member is required. + Identifier *string + + noSmithyDocumentSerde +} + +type DeleteRoomOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteRoomMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteRoom{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteRoom{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteRoomValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRoom(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteRoom(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "DeleteRoom", + } +} diff --git a/service/ivschat/api_op_DisconnectUser.go b/service/ivschat/api_op_DisconnectUser.go new file mode 100644 index 00000000000..52dfbe4207d --- /dev/null +++ b/service/ivschat/api_op_DisconnectUser.go @@ -0,0 +1,128 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disconnects all connections using a specified user ID from a room. This +// replicates the DisconnectUser +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-disconnectuser-publish.html) +// WebSocket operation in the Amazon IVS Chat Messaging API. +func (c *Client) DisconnectUser(ctx context.Context, params *DisconnectUserInput, optFns ...func(*Options)) (*DisconnectUserOutput, error) { + if params == nil { + params = &DisconnectUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisconnectUser", params, optFns, c.addOperationDisconnectUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisconnectUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisconnectUserInput struct { + + // Identifier of the room from which the user's clients should be disconnected. + // Currently this must be an ARN. + // + // This member is required. + RoomIdentifier *string + + // ID of the user (connection) to disconnect from the room. + // + // This member is required. + UserId *string + + // Reason for disconnecting the user. + Reason *string + + noSmithyDocumentSerde +} + +type DisconnectUserOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisconnectUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisconnectUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisconnectUser{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpDisconnectUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisconnectUser(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDisconnectUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "DisconnectUser", + } +} diff --git a/service/ivschat/api_op_GetRoom.go b/service/ivschat/api_op_GetRoom.go new file mode 100644 index 00000000000..e1f5e5e1ee7 --- /dev/null +++ b/service/ivschat/api_op_GetRoom.go @@ -0,0 +1,154 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/ivschat/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Gets the specified room. +func (c *Client) GetRoom(ctx context.Context, params *GetRoomInput, optFns ...func(*Options)) (*GetRoomOutput, error) { + if params == nil { + params = &GetRoomInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRoom", params, optFns, c.addOperationGetRoomMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRoomOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRoomInput struct { + + // Identifier of the room for which the configuration is to be retrieved. Currently + // this must be an ARN. + // + // This member is required. + Identifier *string + + noSmithyDocumentSerde +} + +type GetRoomOutput struct { + + // Room ARN, from the request (if identifier was an ARN). + Arn *string + + // Time when the room was created. This is an ISO 8601 timestamp; note that this is + // returned as a string. + CreateTime *time.Time + + // Room ID, generated by the system. This is a relative identifier, the part of the + // ARN that uniquely identifies the room. + Id *string + + // Maximum number of characters in a single message. Messages are expected to be + // UTF-8 encoded and this limit applies specifically to rune/code-point count, not + // number of bytes. Default: 500. + MaximumMessageLength int32 + + // Maximum number of messages per second that a client can send to the room. + // Default: 10. + MaximumMessageRatePerSecond int32 + + // Configuration information for optional review of messages. + MessageReviewHandler *types.MessageReviewHandler + + // Room name. The value does not need to be unique. + Name *string + + // Tags attached to the resource. Array of maps, each of the form string:string + // (key:value). + Tags map[string]string + + // Time of the room’s last update. This is an ISO 8601 timestamp; note that this is + // returned as a string. + UpdateTime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRoomMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRoom{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRoom{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpGetRoomValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRoom(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetRoom(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "GetRoom", + } +} diff --git a/service/ivschat/api_op_ListRooms.go b/service/ivschat/api_op_ListRooms.go new file mode 100644 index 00000000000..a557328fc46 --- /dev/null +++ b/service/ivschat/api_op_ListRooms.go @@ -0,0 +1,219 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +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/ivschat/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets summary information about all your rooms in the AWS region where the API +// request is processed. Results are sorted in descending order of updateTime. +func (c *Client) ListRooms(ctx context.Context, params *ListRoomsInput, optFns ...func(*Options)) (*ListRoomsOutput, error) { + if params == nil { + params = &ListRoomsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListRooms", params, optFns, c.addOperationListRoomsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListRoomsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListRoomsInput struct { + + // Maximum number of rooms to return. Default: 50. + MaxResults int32 + + // Filters the list to match the specified message review handler URI. + MessageReviewHandlerUri *string + + // Filters the list to match the specified room name. + Name *string + + // The first room to retrieve. This is used for pagination; see the nextToken + // response field. + NextToken *string + + noSmithyDocumentSerde +} + +type ListRoomsOutput struct { + + // List of the matching rooms (summary information only). + // + // This member is required. + Rooms []types.RoomSummary + + // If there are more rooms than maxResults, use nextToken in the request to get the + // next set. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListRoomsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListRooms{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListRooms{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRooms(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +// ListRoomsAPIClient is a client that implements the ListRooms operation. +type ListRoomsAPIClient interface { + ListRooms(context.Context, *ListRoomsInput, ...func(*Options)) (*ListRoomsOutput, error) +} + +var _ ListRoomsAPIClient = (*Client)(nil) + +// ListRoomsPaginatorOptions is the paginator options for ListRooms +type ListRoomsPaginatorOptions struct { + // Maximum number of rooms to return. Default: 50. + 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 +} + +// ListRoomsPaginator is a paginator for ListRooms +type ListRoomsPaginator struct { + options ListRoomsPaginatorOptions + client ListRoomsAPIClient + params *ListRoomsInput + nextToken *string + firstPage bool +} + +// NewListRoomsPaginator returns a new ListRoomsPaginator +func NewListRoomsPaginator(client ListRoomsAPIClient, params *ListRoomsInput, optFns ...func(*ListRoomsPaginatorOptions)) *ListRoomsPaginator { + if params == nil { + params = &ListRoomsInput{} + } + + options := ListRoomsPaginatorOptions{} + if params.MaxResults != 0 { + options.Limit = params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListRoomsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListRoomsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListRooms page. +func (p *ListRoomsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRoomsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + params.MaxResults = p.options.Limit + + result, err := p.client.ListRooms(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_opListRooms(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "ListRooms", + } +} diff --git a/service/ivschat/api_op_ListTagsForResource.go b/service/ivschat/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..44fa0b4a6bf --- /dev/null +++ b/service/ivschat/api_op_ListTagsForResource.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets information about AWS tags for the specified ARN. +func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { + if params == nil { + params = &ListTagsForResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTagsForResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTagsForResourceInput struct { + + // The ARN of the resource to be retrieved. The ARN must be URL-encoded. + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // Tags to attach to the resource. Array of maps, each of the form string:string + // (key:value). + // + // This member is required. + Tags map[string]string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "ListTagsForResource", + } +} diff --git a/service/ivschat/api_op_SendEvent.go b/service/ivschat/api_op_SendEvent.go new file mode 100644 index 00000000000..0be39698ad4 --- /dev/null +++ b/service/ivschat/api_op_SendEvent.go @@ -0,0 +1,133 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Sends an event to a room. Use this within your application’s business logic to +// send events to clients of a room; e.g., to notify clients to change the way the +// chat UI is rendered. +func (c *Client) SendEvent(ctx context.Context, params *SendEventInput, optFns ...func(*Options)) (*SendEventOutput, error) { + if params == nil { + params = &SendEventInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SendEvent", params, optFns, c.addOperationSendEventMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SendEventOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SendEventInput struct { + + // Application-defined name of the event to send to clients. + // + // This member is required. + EventName *string + + // Identifier of the room to which the event will be sent. Currently this must be + // an ARN. + // + // This member is required. + RoomIdentifier *string + + // Application-defined metadata to attach to the event sent to clients. The maximum + // length of the metadata is 1 KB total. + Attributes map[string]string + + noSmithyDocumentSerde +} + +type SendEventOutput struct { + + // An identifier generated by Amazon IVS Chat. This identifier must be used in + // subsequent operations for this message, such as DeleteMessage. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSendEventMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpSendEvent{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSendEvent{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpSendEventValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSendEvent(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opSendEvent(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "SendEvent", + } +} diff --git a/service/ivschat/api_op_TagResource.go b/service/ivschat/api_op_TagResource.go new file mode 100644 index 00000000000..d7642392738 --- /dev/null +++ b/service/ivschat/api_op_TagResource.go @@ -0,0 +1,121 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds or updates tags for the AWS resource with the specified ARN. +func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { + if params == nil { + params = &TagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*TagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type TagResourceInput struct { + + // The ARN of the resource to be tagged. The ARN must be URL-encoded. + // + // This member is required. + ResourceArn *string + + // Array of tags to be added or updated. + // + // This member is required. + Tags map[string]string + + noSmithyDocumentSerde +} + +type TagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "TagResource", + } +} diff --git a/service/ivschat/api_op_UntagResource.go b/service/ivschat/api_op_UntagResource.go new file mode 100644 index 00000000000..ee0a70b0ced --- /dev/null +++ b/service/ivschat/api_op_UntagResource.go @@ -0,0 +1,121 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes tags from the resource with the specified ARN. +func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { + if params == nil { + params = &UntagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UntagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UntagResourceInput struct { + + // The ARN of the resource to be untagged. The ARN must be URL-encoded. + // + // This member is required. + ResourceArn *string + + // Array of tags to be removed. + // + // This member is required. + TagKeys []string + + noSmithyDocumentSerde +} + +type UntagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUntagResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUntagResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "UntagResource", + } +} diff --git a/service/ivschat/api_op_UpdateRoom.go b/service/ivschat/api_op_UpdateRoom.go new file mode 100644 index 00000000000..bab0ccb47bb --- /dev/null +++ b/service/ivschat/api_op_UpdateRoom.go @@ -0,0 +1,166 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/ivschat/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Updates a room’s configuration. +func (c *Client) UpdateRoom(ctx context.Context, params *UpdateRoomInput, optFns ...func(*Options)) (*UpdateRoomOutput, error) { + if params == nil { + params = &UpdateRoomInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateRoom", params, optFns, c.addOperationUpdateRoomMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateRoomOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateRoomInput struct { + + // Identifier of the room to be updated. Currently this must be an ARN. + // + // This member is required. + Identifier *string + + // The maximum number of characters in a single message. Messages are expected to + // be UTF-8 encoded and this limit applies specifically to rune/code-point count, + // not number of bytes. Default: 500. + MaximumMessageLength int32 + + // The maximum number of messages per second that a client can send to the room. + // Default: 10. + MaximumMessageRatePerSecond int32 + + // Configuration information for optional review of messages. Specify an empty uri + // string to disassociate a message review handler from the specified room. + MessageReviewHandler *types.MessageReviewHandler + + // Room name. The value does not need to be unique. + Name *string + + noSmithyDocumentSerde +} + +type UpdateRoomOutput struct { + + // Room ARN, from the request (if identifier was an ARN). + Arn *string + + // Time when the room was created. This is an ISO 8601 timestamp; note that this is + // returned as a string. + CreateTime *time.Time + + // Room ID, generated by the system. This is a relative identifier, the part of the + // ARN that uniquely identifies the room. + Id *string + + // Maximum number of characters in a single message, from the request. + MaximumMessageLength int32 + + // Maximum number of messages per second that a client can send to the room, from + // the request. + MaximumMessageRatePerSecond int32 + + // Configuration information for optional review of messages. + MessageReviewHandler *types.MessageReviewHandler + + // Room name, from the request. + Name *string + + // Tags attached to the resource. + Tags map[string]string + + // Time of the room’s last update. This is an ISO 8601 timestamp; note that this is + // returned as a string. + UpdateTime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateRoomMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateRoom{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateRoom{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpUpdateRoomValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRoom(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateRoom(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "ivschat", + OperationName: "UpdateRoom", + } +} diff --git a/service/ivschat/deserializers.go b/service/ivschat/deserializers.go new file mode 100644 index 00000000000..f77d6aecc5a --- /dev/null +++ b/service/ivschat/deserializers.go @@ -0,0 +1,2943 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/ivschat/types" + smithy "github.com/aws/smithy-go" + smithyio "github.com/aws/smithy-go/io" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" + "io/ioutil" + "strings" +) + +type awsRestjson1_deserializeOpCreateChatToken struct { +} + +func (*awsRestjson1_deserializeOpCreateChatToken) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateChatToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorCreateChatToken(response, &metadata) + } + output := &CreateChatTokenOutput{} + 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_deserializeOpDocumentCreateChatTokenOutput(&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_deserializeOpErrorCreateChatToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("PendingVerification", errorCode): + return awsRestjson1_deserializeErrorPendingVerification(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_deserializeOpDocumentCreateChatTokenOutput(v **CreateChatTokenOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateChatTokenOutput + if *v == nil { + sv = &CreateChatTokenOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "sessionExpirationTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.SessionExpirationTime = ptr.Time(t) + } + + case "token": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ChatToken to be of type string, got %T instead", value) + } + sv.Token = ptr.String(jtv) + } + + case "tokenExpirationTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.TokenExpirationTime = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateRoom struct { +} + +func (*awsRestjson1_deserializeOpCreateRoom) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateRoom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorCreateRoom(response, &metadata) + } + output := &CreateRoomOutput{} + 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_deserializeOpDocumentCreateRoomOutput(&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_deserializeOpErrorCreateRoom(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("PendingVerification", errorCode): + return awsRestjson1_deserializeErrorPendingVerification(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_deserializeOpDocumentCreateRoomOutput(v **CreateRoomOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateRoomOutput + if *v == nil { + sv = &CreateRoomOutput{} + } 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 RoomArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "createTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreateTime = ptr.Time(t) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "maximumMessageLength": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageLength to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageLength = int32(i64) + } + + case "maximumMessageRatePerSecond": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageRatePerSecond to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageRatePerSecond = int32(i64) + } + + case "messageReviewHandler": + if err := awsRestjson1_deserializeDocumentMessageReviewHandler(&sv.MessageReviewHandler, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "updateTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdateTime = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteMessage struct { +} + +func (*awsRestjson1_deserializeOpDeleteMessage) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteMessage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorDeleteMessage(response, &metadata) + } + output := &DeleteMessageOutput{} + 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_deserializeOpDocumentDeleteMessageOutput(&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_deserializeOpErrorDeleteMessage(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("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_deserializeOpDocumentDeleteMessageOutput(v **DeleteMessageOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteMessageOutput + if *v == nil { + sv = &DeleteMessageOutput{} + } 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 ID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteRoom struct { +} + +func (*awsRestjson1_deserializeOpDeleteRoom) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteRoom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorDeleteRoom(response, &metadata) + } + output := &DeleteRoomOutput{} + 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_deserializeOpErrorDeleteRoom(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDisconnectUser struct { +} + +func (*awsRestjson1_deserializeOpDisconnectUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisconnectUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorDisconnectUser(response, &metadata) + } + output := &DisconnectUserOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDisconnectUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("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_deserializeOpGetRoom struct { +} + +func (*awsRestjson1_deserializeOpGetRoom) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetRoom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorGetRoom(response, &metadata) + } + output := &GetRoomOutput{} + 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_deserializeOpDocumentGetRoomOutput(&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_deserializeOpErrorGetRoom(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetRoomOutput(v **GetRoomOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetRoomOutput + if *v == nil { + sv = &GetRoomOutput{} + } 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 RoomArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "createTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreateTime = ptr.Time(t) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "maximumMessageLength": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageLength to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageLength = int32(i64) + } + + case "maximumMessageRatePerSecond": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageRatePerSecond to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageRatePerSecond = int32(i64) + } + + case "messageReviewHandler": + if err := awsRestjson1_deserializeDocumentMessageReviewHandler(&sv.MessageReviewHandler, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "updateTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdateTime = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListRooms struct { +} + +func (*awsRestjson1_deserializeOpListRooms) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListRooms) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListRooms(response, &metadata) + } + output := &ListRoomsOutput{} + 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_deserializeOpDocumentListRoomsOutput(&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_deserializeOpErrorListRooms(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListRoomsOutput(v **ListRoomsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListRoomsOutput + if *v == nil { + sv = &ListRoomsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "rooms": + if err := awsRestjson1_deserializeDocumentRoomList(&sv.Rooms, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTagsForResource struct { +} + +func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) + } + output := &ListTagsForResourceOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListTagsForResourceOutput + if *v == nil { + sv = &ListTagsForResourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpSendEvent struct { +} + +func (*awsRestjson1_deserializeOpSendEvent) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSendEvent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorSendEvent(response, &metadata) + } + output := &SendEventOutput{} + 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_deserializeOpDocumentSendEventOutput(&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_deserializeOpErrorSendEvent(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("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_deserializeOpDocumentSendEventOutput(v **SendEventOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SendEventOutput + if *v == nil { + sv = &SendEventOutput{} + } 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 ID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpTagResource struct { +} + +func (*awsRestjson1_deserializeOpTagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + } + output := &TagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + } + output := &UntagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateRoom struct { +} + +func (*awsRestjson1_deserializeOpUpdateRoom) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateRoom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoom(response, &metadata) + } + output := &UpdateRoomOutput{} + 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_deserializeOpDocumentUpdateRoomOutput(&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_deserializeOpErrorUpdateRoom(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentUpdateRoomOutput(v **UpdateRoomOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateRoomOutput + if *v == nil { + sv = &UpdateRoomOutput{} + } 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 RoomArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "createTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreateTime = ptr.Time(t) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "maximumMessageLength": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageLength to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageLength = int32(i64) + } + + case "maximumMessageRatePerSecond": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected RoomMaxMessageRatePerSecond to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumMessageRatePerSecond = int32(i64) + } + + case "messageReviewHandler": + if err := awsRestjson1_deserializeDocumentMessageReviewHandler(&sv.MessageReviewHandler, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "updateTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdateTime = ptr.Time(t) + } + + 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_deserializeErrorPendingVerification(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.PendingVerification{} + 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_deserializeDocumentPendingVerification(&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_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 ResourceId 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 ResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ResourceType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.InternalServerException + if *v == nil { + sv = &types.InternalServerException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMessageReviewHandler(v **types.MessageReviewHandler, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.MessageReviewHandler + if *v == nil { + sv = &types.MessageReviewHandler{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "fallbackResult": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FallbackResult to be of type string, got %T instead", value) + } + sv.FallbackResult = types.FallbackResult(jtv) + } + + case "uri": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LambdaArn to be of type string, got %T instead", value) + } + sv.Uri = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPendingVerification(v **types.PendingVerification, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.PendingVerification + if *v == nil { + sv = &types.PendingVerification{} + } 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_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 ResourceId 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 ResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ResourceType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRoomList(v *[]types.RoomSummary, 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.RoomSummary + if *v == nil { + cv = []types.RoomSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RoomSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentRoomSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentRoomSummary(v **types.RoomSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RoomSummary + if *v == nil { + sv = &types.RoomSummary{} + } 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 RoomArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "createTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreateTime = ptr.Time(t) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomID to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "messageReviewHandler": + if err := awsRestjson1_deserializeDocumentMessageReviewHandler(&sv.MessageReviewHandler, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoomName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + case "updateTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Time to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdateTime = ptr.Time(t) + } + + 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 "limit": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Limit to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Limit = int32(i64) + } + + 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 ResourceId 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 ResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ResourceType(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_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 "limit": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Limit to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Limit = int32(i64) + } + + 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 ResourceId 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 ResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ResourceType(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 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 ErrorMessage 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 FieldName 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 +} diff --git a/service/ivschat/doc.go b/service/ivschat/doc.go new file mode 100644 index 00000000000..b361ee4a0fb --- /dev/null +++ b/service/ivschat/doc.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package ivschat provides the API client, operations, and parameter types for +// Amazon Interactive Video Service Chat. +// +// Introduction The Amazon IVS Chat control-plane API enables you to create and +// manage Amazon IVS Chat resources. You also need to integrate with the Amazon +// IVS Chat Messaging API +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/chat-messaging-api.html), +// to enable users to interact with chat rooms in real time. The API is an AWS +// regional service. For a list of supported regions and Amazon IVS Chat HTTPS +// service endpoints, see the Amazon IVS Chat information on the Amazon IVS page +// (https://docs.aws.amazon.com/general/latest/gr/ivs.html) in the AWS General +// Reference. Notes on terminology: +// +// * You create service applications using the +// Amazon IVS Chat API. We refer to these as applications. +// +// * You create front-end +// client applications (browser and Android/iOS apps) using the Amazon IVS Chat +// Messaging API. We refer to these as clients. +// +// Resources The following resource +// is part of Amazon IVS Chat: +// +// * Room — The central Amazon IVS Chat resource +// through which clients connect to and exchange chat messages. See the Room +// endpoints for more information. +// +// API Access Security Your Amazon IVS Chat +// applications (service applications and clients) must be authenticated and +// authorized to access Amazon IVS Chat resources. Note the differences between +// these concepts: +// +// * Authentication is about verifying identity. Requests to the +// Amazon IVS Chat API must be signed to verify your identity. +// +// * Authorization is +// about granting permissions. Your IAM roles need to have permissions for Amazon +// IVS Chat API requests. +// +// Users (viewers) connect to a room using secure access +// tokens that you create using the CreateChatToken endpoint through the AWS SDK. +// You call CreateChatToken for every user’s chat session, passing identity and +// authorization information about the user. Signing API Requests HTTP API requests +// must be signed with an AWS SigV4 signature using your AWS security credentials. +// The AWS Command Line Interface (CLI) and the AWS SDKs take care of signing the +// underlying API calls for you. However, if your application calls the Amazon IVS +// Chat HTTP API directly, it’s your responsibility to sign the requests. You +// generate a signature using valid AWS credentials for an IAM role that has +// permission to perform the requested action. For example, DeleteMessage requests +// must be made using an IAM role that has the ivschat:DeleteMessage permission. +// For more information: +// +// * Authentication and generating signatures — See +// Authenticating Requests (Amazon Web Services Signature Version 4) +// (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) +// in the Amazon Web Services General Reference. +// +// * Managing Amazon IVS permissions +// — See Identity and Access Management +// (https://docs.aws.amazon.com/ivs/latest/userguide/security-iam.html) on the +// Security page of the Amazon IVS User Guide. +// +// Messaging Endpoints +// +// * +// DeleteMessage — Sends an event to a specific room which directs clients to +// delete a specific message; that is, unrender it from view and delete it from the +// client’s chat history. This event’s EventName is aws:DELETE_MESSAGE. This +// replicates the DeleteMessage +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-deletemessage-publish.html) +// WebSocket operation in the Amazon IVS Chat Messaging API. +// +// * DisconnectUser — +// Disconnects all connections using a specified user ID from a room. This +// replicates the DisconnectUser +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-disconnectuser-publish.html) +// WebSocket operation in the Amazon IVS Chat Messaging API. +// +// * SendEvent — Sends +// an event to a room. Use this within your application’s business logic to send +// events to clients of a room; e.g., to notify clients to change the way the chat +// UI is rendered. +// +// Chat Token Endpoint +// +// * CreateChatToken — Creates an encrypted +// token that is used to establish an individual WebSocket connection to a room. +// The token is valid for one minute, and a connection (session) established with +// the token is valid for the specified duration. +// +// Room Endpoints +// +// * CreateRoom — +// Creates a room that allows clients to connect and pass messages. +// +// * DeleteRoom — +// Deletes the specified room. +// +// * GetRoom — Gets the specified room. +// +// * ListRooms — +// Gets summary information about all your rooms in the AWS region where the API +// request is processed. +// +// * UpdateRoom — Updates a room’s configuration. +// +// Tags +// Endpoints +// +// * ListTagsForResource — Gets information about AWS tags for the +// specified ARN. +// +// * TagResource — Adds or updates tags for the AWS resource with +// the specified ARN. +// +// * UntagResource — Removes tags from the resource with the +// specified ARN. +// +// All the above are HTTP operations. There is a separate messaging +// API for managing Chat resources; see the Amazon IVS Chat Messaging API +// Reference +// (https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/chat-messaging-api.html). +package ivschat diff --git a/service/ivschat/endpoints.go b/service/ivschat/endpoints.go new file mode 100644 index 00000000000..7e14b256ec2 --- /dev/null +++ b/service/ivschat/endpoints.go @@ -0,0 +1,200 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/ivschat/internal/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/url" + "strings" +) + +// EndpointResolverOptions is the service endpoint resolver options +type EndpointResolverOptions = internalendpoints.Options + +// EndpointResolver interface for resolving service endpoints. +type EndpointResolver interface { + ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) +} + +var _ EndpointResolver = &internalendpoints.Resolver{} + +// NewDefaultEndpointResolver constructs a new service endpoint resolver +func NewDefaultEndpointResolver() *internalendpoints.Resolver { + return internalendpoints.New() +} + +// EndpointResolverFunc is a helper utility that wraps a function so it satisfies +// the EndpointResolver interface. This is useful when you want to add additional +// endpoint resolving logic, or stub out specific endpoints with custom values. +type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error) + +func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return fn(region, options) +} + +func resolveDefaultEndpointConfiguration(o *Options) { + if o.EndpointResolver != nil { + return + } + o.EndpointResolver = NewDefaultEndpointResolver() +} + +// EndpointResolverFromURL returns an EndpointResolver configured using the +// provided endpoint url. By default, the resolved endpoint resolver uses the +// client region as signing region, and the endpoint source is set to +// EndpointSourceCustom.You can provide functional options to configure endpoint +// values for the resolved endpoint. +func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver { + e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom} + for _, fn := range optFns { + fn(&e) + } + + return EndpointResolverFunc( + func(region string, options EndpointResolverOptions) (aws.Endpoint, error) { + if len(e.SigningRegion) == 0 { + e.SigningRegion = region + } + return e, nil + }, + ) +} + +type ResolveEndpoint struct { + Resolver EndpointResolver + Options EndpointResolverOptions +} + +func (*ResolveEndpoint) ID() string { + return "ResolveEndpoint" +} + +func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.Resolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + eo := m.Options + eo.Logger = middleware.GetLogger(ctx) + + var endpoint aws.Endpoint + endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL, err = url.Parse(endpoint.URL) + if err != nil { + return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) + } + + if len(awsmiddleware.GetSigningName(ctx)) == 0 { + signingName := endpoint.SigningName + if len(signingName) == 0 { + signingName = "ivschat" + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + } + ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source) + ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable) + ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) + ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID) + return next.HandleSerialize(ctx, in) +} +func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + return stack.Serialize.Insert(&ResolveEndpoint{ + Resolver: o.EndpointResolver, + Options: o.EndpointOptions, + }, "OperationSerializer", middleware.Before) +} + +func removeResolveEndpointMiddleware(stack *middleware.Stack) error { + _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID()) + return err +} + +type wrappedEndpointResolver struct { + awsResolver aws.EndpointResolverWithOptions + resolver EndpointResolver +} + +func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + if w.awsResolver == nil { + goto fallback + } + endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options) + if err == nil { + return endpoint, nil + } + + if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) { + return endpoint, err + } + +fallback: + if w.resolver == nil { + return endpoint, fmt.Errorf("default endpoint resolver provided was nil") + } + return w.resolver.ResolveEndpoint(region, options) +} + +type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error) + +func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) { + return a(service, region) +} + +var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil) + +// withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver. +// If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided +// fallbackResolver for resolution. +// +// fallbackResolver must not be nil +func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver { + var resolver aws.EndpointResolverWithOptions + + if awsResolverWithOptions != nil { + resolver = awsResolverWithOptions + } else if awsResolver != nil { + resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) + } + + return &wrappedEndpointResolver{ + awsResolver: resolver, + resolver: fallbackResolver, + } +} + +func finalizeClientEndpointResolverOptions(options *Options) { + options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage() + + if len(options.EndpointOptions.ResolvedRegion) == 0 { + const fipsInfix = "-fips-" + const fipsPrefix = "fips-" + const fipsSuffix = "-fips" + + if strings.Contains(options.Region, fipsInfix) || + strings.Contains(options.Region, fipsPrefix) || + strings.Contains(options.Region, fipsSuffix) { + options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( + options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") + options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled + } + } + +} diff --git a/service/ivschat/generated.json b/service/ivschat/generated.json new file mode 100644 index 00000000000..597e1dd68bc --- /dev/null +++ b/service/ivschat/generated.json @@ -0,0 +1,39 @@ +{ + "dependencies": { + "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", + "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000", + "github.com/aws/smithy-go": "v1.4.0" + }, + "files": [ + "api_client.go", + "api_client_test.go", + "api_op_CreateChatToken.go", + "api_op_CreateRoom.go", + "api_op_DeleteMessage.go", + "api_op_DeleteRoom.go", + "api_op_DisconnectUser.go", + "api_op_GetRoom.go", + "api_op_ListRooms.go", + "api_op_ListTagsForResource.go", + "api_op_SendEvent.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateRoom.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "protocol_test.go", + "serializers.go", + "types/enums.go", + "types/errors.go", + "types/types.go", + "validators.go" + ], + "go": "1.15", + "module": "github.com/aws/aws-sdk-go-v2/service/ivschat", + "unstable": false +} diff --git a/service/ivschat/go.mod b/service/ivschat/go.mod new file mode 100644 index 00000000000..c5aff0215bc --- /dev/null +++ b/service/ivschat/go.mod @@ -0,0 +1,16 @@ +module github.com/aws/aws-sdk-go-v2/service/ivschat + +go 1.15 + +require ( + github.com/aws/aws-sdk-go-v2 v1.16.3 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.10 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.4 + github.com/aws/smithy-go v1.11.2 +) + +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/ivschat/go.sum b/service/ivschat/go.sum new file mode 100644 index 00000000000..d50e4572cb0 --- /dev/null +++ b/service/ivschat/go.sum @@ -0,0 +1,13 @@ +github.com/aws/smithy-go v1.11.2 h1:eG/N+CcUMAvsdffgMvjMKwfyDzIkjM6pfxMJ8Mzc6mE= +github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/service/ivschat/go_module_metadata.go b/service/ivschat/go_module_metadata.go new file mode 100644 index 00000000000..86a19f60305 --- /dev/null +++ b/service/ivschat/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package ivschat + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/ivschat/internal/endpoints/endpoints.go b/service/ivschat/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..3cf7913d574 --- /dev/null +++ b/service/ivschat/internal/endpoints/endpoints.go @@ -0,0 +1,250 @@ +// 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 ivschat endpoint resolver +type Resolver struct { + partitions endpoints.Partitions +} + +// ResolveEndpoint resolves the service endpoint for the given region and options +func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { + if len(region) == 0 { + return endpoint, &aws.MissingRegionError{} + } + + opt := transformToSharedOptions(options) + return r.partitions.ResolveEndpoint(region, opt) +} + +// New returns a new Resolver +func New() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + +var defaultPartitions = endpoints.Partitions{ + { + ID: "aws", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "ivschat.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "ivschat-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "ivschat-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "ivschat.{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: "ivschat.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "ivschat-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "ivschat-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "ivschat.{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: "ivschat-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "ivschat.{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: "ivschat-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "ivschat.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "ivschat.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "ivschat-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "ivschat-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "ivschat.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/ivschat/internal/endpoints/endpoints_test.go b/service/ivschat/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/ivschat/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/ivschat/protocol_test.go b/service/ivschat/protocol_test.go new file mode 100644 index 00000000000..891879162f4 --- /dev/null +++ b/service/ivschat/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat diff --git a/service/ivschat/serializers.go b/service/ivschat/serializers.go new file mode 100644 index 00000000000..997c30c8ff1 --- /dev/null +++ b/service/ivschat/serializers.go @@ -0,0 +1,1010 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/ivschat/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_serializeOpCreateChatToken struct { +} + +func (*awsRestjson1_serializeOpCreateChatToken) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateChatToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*CreateChatTokenInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/CreateChatToken") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateChatTokenInput(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_serializeOpHttpBindingsCreateChatTokenInput(v *CreateChatTokenInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateChatTokenInput(v *CreateChatTokenInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Attributes != nil { + ok := object.Key("attributes") + if err := awsRestjson1_serializeDocumentChatTokenAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.Capabilities != nil { + ok := object.Key("capabilities") + if err := awsRestjson1_serializeDocumentChatTokenCapabilities(v.Capabilities, ok); err != nil { + return err + } + } + + if v.RoomIdentifier != nil { + ok := object.Key("roomIdentifier") + ok.String(*v.RoomIdentifier) + } + + if v.SessionDurationInMinutes != 0 { + ok := object.Key("sessionDurationInMinutes") + ok.Integer(v.SessionDurationInMinutes) + } + + if v.UserId != nil { + ok := object.Key("userId") + ok.String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpCreateRoom struct { +} + +func (*awsRestjson1_serializeOpCreateRoom) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateRoom) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*CreateRoomInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/CreateRoom") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateRoomInput(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_serializeOpHttpBindingsCreateRoomInput(v *CreateRoomInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateRoomInput(v *CreateRoomInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaximumMessageLength != 0 { + ok := object.Key("maximumMessageLength") + ok.Integer(v.MaximumMessageLength) + } + + if v.MaximumMessageRatePerSecond != 0 { + ok := object.Key("maximumMessageRatePerSecond") + ok.Integer(v.MaximumMessageRatePerSecond) + } + + if v.MessageReviewHandler != nil { + ok := object.Key("messageReviewHandler") + if err := awsRestjson1_serializeDocumentMessageReviewHandler(v.MessageReviewHandler, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteMessage struct { +} + +func (*awsRestjson1_serializeOpDeleteMessage) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteMessage) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DeleteMessageInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/DeleteMessage") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDeleteMessageInput(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_serializeOpHttpBindingsDeleteMessageInput(v *DeleteMessageInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDeleteMessageInput(v *DeleteMessageInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.Reason != nil { + ok := object.Key("reason") + ok.String(*v.Reason) + } + + if v.RoomIdentifier != nil { + ok := object.Key("roomIdentifier") + ok.String(*v.RoomIdentifier) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteRoom struct { +} + +func (*awsRestjson1_serializeOpDeleteRoom) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteRoom) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DeleteRoomInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/DeleteRoom") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDeleteRoomInput(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_serializeOpHttpBindingsDeleteRoomInput(v *DeleteRoomInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDeleteRoomInput(v *DeleteRoomInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Identifier != nil { + ok := object.Key("identifier") + ok.String(*v.Identifier) + } + + return nil +} + +type awsRestjson1_serializeOpDisconnectUser struct { +} + +func (*awsRestjson1_serializeOpDisconnectUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisconnectUser) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DisconnectUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/DisconnectUser") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentDisconnectUserInput(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_serializeOpHttpBindingsDisconnectUserInput(v *DisconnectUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDisconnectUserInput(v *DisconnectUserInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Reason != nil { + ok := object.Key("reason") + ok.String(*v.Reason) + } + + if v.RoomIdentifier != nil { + ok := object.Key("roomIdentifier") + ok.String(*v.RoomIdentifier) + } + + if v.UserId != nil { + ok := object.Key("userId") + ok.String(*v.UserId) + } + + return nil +} + +type awsRestjson1_serializeOpGetRoom struct { +} + +func (*awsRestjson1_serializeOpGetRoom) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRoom) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetRoomInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/GetRoom") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentGetRoomInput(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_serializeOpHttpBindingsGetRoomInput(v *GetRoomInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentGetRoomInput(v *GetRoomInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Identifier != nil { + ok := object.Key("identifier") + ok.String(*v.Identifier) + } + + return nil +} + +type awsRestjson1_serializeOpListRooms struct { +} + +func (*awsRestjson1_serializeOpListRooms) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListRooms) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListRoomsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ListRooms") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListRoomsInput(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_serializeOpHttpBindingsListRoomsInput(v *ListRoomsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListRoomsInput(v *ListRoomsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != 0 { + ok := object.Key("maxResults") + ok.Integer(v.MaxResults) + } + + if v.MessageReviewHandlerUri != nil { + ok := object.Key("messageReviewHandlerUri") + ok.String(*v.MessageReviewHandlerUri) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + 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" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(v *ListTagsForResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member resourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("resourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpSendEvent struct { +} + +func (*awsRestjson1_serializeOpSendEvent) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSendEvent) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*SendEventInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/SendEvent") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSendEventInput(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_serializeOpHttpBindingsSendEventInput(v *SendEventInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentSendEventInput(v *SendEventInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Attributes != nil { + ok := object.Key("attributes") + if err := awsRestjson1_serializeDocumentEventAttributes(v.Attributes, ok); err != nil { + return err + } + } + + if v.EventName != nil { + ok := object.Key("eventName") + ok.String(*v.EventName) + } + + if v.RoomIdentifier != nil { + ok := object.Key("roomIdentifier") + ok.String(*v.RoomIdentifier) + } + + return nil +} + +type awsRestjson1_serializeOpTagResource struct { +} + +func (*awsRestjson1_serializeOpTagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpTagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*TagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/tags/{resourceArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsTagResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentTagResourceInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsTagResourceInput(v *TagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member resourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("resourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_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" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUntagResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsUntagResourceInput(v *UntagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member resourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("resourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + if v.TagKeys != nil { + for i := range v.TagKeys { + encoder.AddQuery("tagKeys").String(v.TagKeys[i]) + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateRoom struct { +} + +func (*awsRestjson1_serializeOpUpdateRoom) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateRoom) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*UpdateRoomInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/UpdateRoom") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateRoomInput(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_serializeOpHttpBindingsUpdateRoomInput(v *UpdateRoomInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateRoomInput(v *UpdateRoomInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Identifier != nil { + ok := object.Key("identifier") + ok.String(*v.Identifier) + } + + if v.MaximumMessageLength != 0 { + ok := object.Key("maximumMessageLength") + ok.Integer(v.MaximumMessageLength) + } + + if v.MaximumMessageRatePerSecond != 0 { + ok := object.Key("maximumMessageRatePerSecond") + ok.Integer(v.MaximumMessageRatePerSecond) + } + + if v.MessageReviewHandler != nil { + ok := object.Key("messageReviewHandler") + if err := awsRestjson1_serializeDocumentMessageReviewHandler(v.MessageReviewHandler, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + return nil +} + +func awsRestjson1_serializeDocumentChatTokenAttributes(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_serializeDocumentChatTokenCapabilities(v []types.ChatTokenCapability, 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_serializeDocumentEventAttributes(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_serializeDocumentMessageReviewHandler(v *types.MessageReviewHandler, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.FallbackResult) > 0 { + ok := object.Key("fallbackResult") + ok.String(string(v.FallbackResult)) + } + + if v.Uri != nil { + ok := object.Key("uri") + ok.String(*v.Uri) + } + + 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/ivschat/types/enums.go b/service/ivschat/types/enums.go new file mode 100644 index 00000000000..9a5289d6bfa --- /dev/null +++ b/service/ivschat/types/enums.go @@ -0,0 +1,77 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type ChatTokenCapability string + +// Enum values for ChatTokenCapability +const ( + ChatTokenCapabilitySendMessage ChatTokenCapability = "SEND_MESSAGE" + ChatTokenCapabilityDisconnectUser ChatTokenCapability = "DISCONNECT_USER" + ChatTokenCapabilityDeleteMessage ChatTokenCapability = "DELETE_MESSAGE" +) + +// Values returns all known values for ChatTokenCapability. 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 (ChatTokenCapability) Values() []ChatTokenCapability { + return []ChatTokenCapability{ + "SEND_MESSAGE", + "DISCONNECT_USER", + "DELETE_MESSAGE", + } +} + +type FallbackResult string + +// Enum values for FallbackResult +const ( + FallbackResultAllow FallbackResult = "ALLOW" + FallbackResultDeny FallbackResult = "DENY" +) + +// Values returns all known values for FallbackResult. 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 (FallbackResult) Values() []FallbackResult { + return []FallbackResult{ + "ALLOW", + "DENY", + } +} + +type ResourceType string + +// Enum values for ResourceType +const ( + ResourceTypeRoom ResourceType = "ROOM" +) + +// Values returns all known values for ResourceType. Note that this can be expanded +// in the future, and so it is only as up to date as the client. The ordering of +// this slice is not guaranteed to be stable across updates. +func (ResourceType) Values() []ResourceType { + return []ResourceType{ + "ROOM", + } +} + +type ValidationExceptionReason string + +// Enum values for ValidationExceptionReason +const ( + ValidationExceptionReasonUnknownOperation ValidationExceptionReason = "UNKNOWN_OPERATION" + ValidationExceptionReasonFieldValidationFailed ValidationExceptionReason = "FIELD_VALIDATION_FAILED" + ValidationExceptionReasonOther ValidationExceptionReason = "OTHER" +) + +// Values returns all known values for ValidationExceptionReason. Note that this +// can be expanded in the future, and so it is only as up to date as the client. +// The ordering of this slice is not guaranteed to be stable across updates. +func (ValidationExceptionReason) Values() []ValidationExceptionReason { + return []ValidationExceptionReason{ + "UNKNOWN_OPERATION", + "FIELD_VALIDATION_FAILED", + "OTHER", + } +} diff --git a/service/ivschat/types/errors.go b/service/ivschat/types/errors.go new file mode 100644 index 00000000000..fe9a9196363 --- /dev/null +++ b/service/ivschat/types/errors.go @@ -0,0 +1,177 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// +type AccessDeniedException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { return "AccessDeniedException" } +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type ConflictException struct { + Message *string + + ResourceId *string + ResourceType ResourceType + + 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 { return "ConflictException" } +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type InternalServerException struct { + Message *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 { return "InternalServerException" } +func (e *InternalServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// +type PendingVerification struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *PendingVerification) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *PendingVerification) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *PendingVerification) ErrorCode() string { return "PendingVerification" } +func (e *PendingVerification) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type ResourceNotFoundException struct { + Message *string + + ResourceId *string + ResourceType ResourceType + + noSmithyDocumentSerde +} + +func (e *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ResourceNotFoundException) ErrorCode() string { return "ResourceNotFoundException" } +func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type ServiceQuotaExceededException struct { + Message *string + + ResourceId *string + ResourceType ResourceType + Limit int32 + + 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 { return "ServiceQuotaExceededException" } +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type ThrottlingException struct { + Message *string + + ResourceId *string + ResourceType ResourceType + Limit int32 + + 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 { return "ThrottlingException" } +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// +type ValidationException struct { + Message *string + + Reason ValidationExceptionReason + 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 { return "ValidationException" } +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/ivschat/types/types.go b/service/ivschat/types/types.go new file mode 100644 index 00000000000..b9c6eef349b --- /dev/null +++ b/service/ivschat/types/types.go @@ -0,0 +1,73 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// Configuration information for optional message review. +type MessageReviewHandler struct { + + // Specifies the fallback behavior (whether the message is allowed or denied) if + // the handler does not return a valid response, encounters an error or times out. + // If allowed, the message is delivered with returned content to all users + // connected to the room. If denied, the message is not delivered to any user. + // Default: ALLOW. + FallbackResult FallbackResult + + // Identifier of the message review handler. Currently this must be an ARN of a + // lambda function. + Uri *string + + noSmithyDocumentSerde +} + +// Summary information about a room. +type RoomSummary struct { + + // Room ARN. + Arn *string + + // Time when the room was created. This is an ISO 8601 timestamp; note that this is + // returned as a string. + CreateTime *time.Time + + // Room ID, generated by the system. This is a relative identifier, the part of the + // ARN that uniquely identifies the room. + Id *string + + // Configuration information for optional review of messages. + MessageReviewHandler *MessageReviewHandler + + // Room name. The value does not need to be unique. + Name *string + + // Tags attached to the resource. + Tags map[string]string + + // Time of the room’s last update. This is an ISO 8601 timestamp; note that this is + // returned as a string. + UpdateTime *time.Time + + noSmithyDocumentSerde +} + +// This object is used in the ValidationException error. +type ValidationExceptionField struct { + + // Explanation of the reason for the validation error. + // + // This member is required. + Message *string + + // Name of the field which failed validation. + // + // This member is required. + Name *string + + noSmithyDocumentSerde +} + +type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/ivschat/validators.go b/service/ivschat/validators.go new file mode 100644 index 00000000000..9a52c7312bd --- /dev/null +++ b/service/ivschat/validators.go @@ -0,0 +1,418 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ivschat + +import ( + "context" + "fmt" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpCreateChatToken struct { +} + +func (*validateOpCreateChatToken) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateChatToken) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateChatTokenInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateChatTokenInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteMessage struct { +} + +func (*validateOpDeleteMessage) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteMessage) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteMessageInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteMessageInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteRoom struct { +} + +func (*validateOpDeleteRoom) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteRoom) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteRoomInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteRoomInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDisconnectUser struct { +} + +func (*validateOpDisconnectUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisconnectUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisconnectUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisconnectUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetRoom struct { +} + +func (*validateOpGetRoom) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetRoom) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetRoomInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetRoomInput(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 validateOpSendEvent struct { +} + +func (*validateOpSendEvent) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSendEvent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SendEventInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSendEventInput(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 validateOpUpdateRoom struct { +} + +func (*validateOpUpdateRoom) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateRoom) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateRoomInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateRoomInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpCreateChatTokenValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateChatToken{}, middleware.After) +} + +func addOpDeleteMessageValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteMessage{}, middleware.After) +} + +func addOpDeleteRoomValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteRoom{}, middleware.After) +} + +func addOpDisconnectUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisconnectUser{}, middleware.After) +} + +func addOpGetRoomValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetRoom{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpSendEventValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSendEvent{}, 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 addOpUpdateRoomValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateRoom{}, middleware.After) +} + +func validateOpCreateChatTokenInput(v *CreateChatTokenInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateChatTokenInput"} + if v.RoomIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoomIdentifier")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteMessageInput(v *DeleteMessageInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteMessageInput"} + if v.RoomIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoomIdentifier")) + } + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteRoomInput(v *DeleteRoomInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteRoomInput"} + if v.Identifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("Identifier")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDisconnectUserInput(v *DisconnectUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisconnectUserInput"} + if v.RoomIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoomIdentifier")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetRoomInput(v *GetRoomInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetRoomInput"} + if v.Identifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("Identifier")) + } + 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 validateOpSendEventInput(v *SendEventInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SendEventInput"} + if v.RoomIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoomIdentifier")) + } + if v.EventName == nil { + invalidParams.Add(smithy.NewErrParamRequired("EventName")) + } + 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 validateOpUpdateRoomInput(v *UpdateRoomInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateRoomInput"} + if v.Identifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("Identifier")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/lightsail/api_op_AttachCertificateToDistribution.go b/service/lightsail/api_op_AttachCertificateToDistribution.go index a05b6ec1eb2..71ec424af98 100644 --- a/service/lightsail/api_op_AttachCertificateToDistribution.go +++ b/service/lightsail/api_op_AttachCertificateToDistribution.go @@ -15,11 +15,11 @@ import ( // network (CDN) distribution. After the certificate is attached, your distribution // accepts HTTPS traffic for all of the domains that are associated with the // certificate. Use the CreateCertificate action to create a certificate that you -// can attach to your distribution. Only certificates created in the us-east-1 AWS -// Region can be attached to Lightsail distributions. Lightsail distributions are -// global resources that can reference an origin in any AWS Region, and distribute -// its content globally. However, all distributions are located in the us-east-1 -// Region. +// can attach to your distribution. Only certificates created in the us-east-1 +// Amazon Web Services Region can be attached to Lightsail distributions. Lightsail +// distributions are global resources that can reference an origin in any Amazon +// Web Services Region, and distribute its content globally. However, all +// distributions are located in the us-east-1 Region. func (c *Client) AttachCertificateToDistribution(ctx context.Context, params *AttachCertificateToDistributionInput, optFns ...func(*Options)) (*AttachCertificateToDistributionOutput, error) { if params == nil { params = &AttachCertificateToDistributionInput{} diff --git a/service/lightsail/api_op_CopySnapshot.go b/service/lightsail/api_op_CopySnapshot.go index e9d2cc982c2..426dd3c687b 100644 --- a/service/lightsail/api_op_CopySnapshot.go +++ b/service/lightsail/api_op_CopySnapshot.go @@ -14,11 +14,12 @@ import ( // Copies a manual snapshot of an instance or disk as another manual snapshot, or // copies an automatic snapshot of an instance or disk as a manual snapshot. This // operation can also be used to copy a manual or automatic snapshot of an instance -// or a disk from one AWS Region to another in Amazon Lightsail. When copying a -// manual snapshot, be sure to define the source region, source snapshot name, and -// target snapshot name parameters. When copying an automatic snapshot, be sure to -// define the source region, source resource name, target snapshot name, and either -// the restore date or the use latest restorable auto snapshot parameters. +// or a disk from one Amazon Web Services Region to another in Amazon Lightsail. +// When copying a manual snapshot, be sure to define the source region, source +// snapshot name, and target snapshot name parameters. When copying an automatic +// snapshot, be sure to define the source region, source resource name, target +// snapshot name, and either the restore date or the use latest restorable auto +// snapshot parameters. func (c *Client) CopySnapshot(ctx context.Context, params *CopySnapshotInput, optFns ...func(*Options)) (*CopySnapshotOutput, error) { if params == nil { params = &CopySnapshotInput{} @@ -36,7 +37,8 @@ func (c *Client) CopySnapshot(ctx context.Context, params *CopySnapshotInput, op type CopySnapshotInput struct { - // The AWS Region where the source manual or automatic snapshot is located. + // The Amazon Web Services Region where the source manual or automatic snapshot is + // located. // // This member is required. SourceRegion types.RegionName diff --git a/service/lightsail/api_op_CreateCertificate.go b/service/lightsail/api_op_CreateCertificate.go index b743ebd0a78..32ce42e2ff0 100644 --- a/service/lightsail/api_op_CreateCertificate.go +++ b/service/lightsail/api_op_CreateCertificate.go @@ -16,10 +16,10 @@ import ( // the AttachCertificateToDistribution action to use the certificate and its // domains with your distribution. Or use the UpdateContainerService action to use // the certificate and its domains with your container service. Only certificates -// created in the us-east-1 AWS Region can be attached to Lightsail distributions. -// Lightsail distributions are global resources that can reference an origin in any -// AWS Region, and distribute its content globally. However, all distributions are -// located in the us-east-1 Region. +// created in the us-east-1 Amazon Web Services Region can be attached to Lightsail +// distributions. Lightsail distributions are global resources that can reference +// an origin in any Amazon Web Services Region, and distribute its content +// globally. However, all distributions are located in the us-east-1 Region. func (c *Client) CreateCertificate(ctx context.Context, params *CreateCertificateInput, optFns ...func(*Options)) (*CreateCertificateOutput, error) { if params == nil { params = &CreateCertificateInput{} diff --git a/service/lightsail/api_op_CreateContactMethod.go b/service/lightsail/api_op_CreateContactMethod.go index 1f5ae43c939..d4b5d0eef31 100644 --- a/service/lightsail/api_op_CreateContactMethod.go +++ b/service/lightsail/api_op_CreateContactMethod.go @@ -13,10 +13,10 @@ import ( // Creates an email or SMS text message contact method. A contact method is used to // send you notifications about your Amazon Lightsail resources. You can add one -// email address and one mobile phone number contact method in each AWS Region. -// However, SMS text messaging is not supported in some AWS Regions, and SMS text -// messages cannot be sent to some countries/regions. For more information, see -// Notifications in Amazon Lightsail +// email address and one mobile phone number contact method in each Amazon Web +// Services Region. However, SMS text messaging is not supported in some Amazon Web +// Services Regions, and SMS text messages cannot be sent to some +// countries/regions. For more information, see Notifications in Amazon Lightsail // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-notifications). func (c *Client) CreateContactMethod(ctx context.Context, params *CreateContactMethodInput, optFns ...func(*Options)) (*CreateContactMethodOutput, error) { if params == nil { @@ -48,27 +48,27 @@ type CreateContactMethodInput struct { ContactEndpoint *string // The protocol of the contact method, such as Email or SMS (text messaging). The - // SMS protocol is supported only in the following AWS Regions. + // SMS protocol is supported only in the following Amazon Web Services Regions. // - // * US East (N. - // Virginia) (us-east-1) + // * + // US East (N. Virginia) (us-east-1) // // * US West (Oregon) (us-west-2) // - // * Europe (Ireland) - // (eu-west-1) + // * Europe + // (Ireland) (eu-west-1) // // * Asia Pacific (Tokyo) (ap-northeast-1) // - // * Asia Pacific (Singapore) - // (ap-southeast-1) + // * Asia Pacific + // (Singapore) (ap-southeast-1) // // * Asia Pacific (Sydney) (ap-southeast-2) // - // For a list of - // countries/regions where SMS text messages can be sent, and the latest AWS - // Regions where SMS text messaging is supported, see Supported Regions and - // Countries + // For a + // list of countries/regions where SMS text messages can be sent, and the latest + // Amazon Web Services Regions where SMS text messaging is supported, see Supported + // Regions and Countries // (https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html) // in the Amazon SNS Developer Guide. For more information about notifications in // Amazon Lightsail, see Notifications in Amazon Lightsail diff --git a/service/lightsail/api_op_CreateContainerService.go b/service/lightsail/api_op_CreateContainerService.go index c2386d2040e..037d621b8a4 100644 --- a/service/lightsail/api_op_CreateContainerService.go +++ b/service/lightsail/api_op_CreateContainerService.go @@ -63,15 +63,16 @@ type CreateContainerServiceInput struct { // following are the requirements for container service names: // // * Must be unique - // within each AWS Region in your Lightsail account. + // within each Amazon Web Services Region in your Lightsail account. // - // * Must contain 1 to 63 - // characters. + // * Must + // contain 1 to 63 characters. // - // * Must contain only alphanumeric characters and hyphens. + // * Must contain only alphanumeric characters and + // hyphens. // - // * A - // hyphen (-) can separate words but cannot be at the start or end of the name. + // * A hyphen (-) can separate words but cannot be at the start or end of + // the name. // // This member is required. ServiceName *string diff --git a/service/lightsail/api_op_CreateLoadBalancer.go b/service/lightsail/api_op_CreateLoadBalancer.go index b02f33cd5e7..29b6ecc2609 100644 --- a/service/lightsail/api_op_CreateLoadBalancer.go +++ b/service/lightsail/api_op_CreateLoadBalancer.go @@ -77,6 +77,16 @@ type CreateLoadBalancerInput struct { // TagResource action to tag a resource after it's created. Tags []types.Tag + // The name of the TLS policy to apply to the load balancer. Use the + // GetLoadBalancerTlsPolicies + // (https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetLoadBalancerTlsPolicies.html) + // action to get a list of TLS policy names that you can specify. For more + // information about load balancer TLS policies, see Load balancer TLS security + // policies + // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configure-load-balancer-tls-security-policy) + // in the Amazon Lightsail Developer Guide. + TlsPolicyName *string + noSmithyDocumentSerde } diff --git a/service/lightsail/api_op_DeleteBucket.go b/service/lightsail/api_op_DeleteBucket.go index 9ec30502d99..468f30b4220 100644 --- a/service/lightsail/api_op_DeleteBucket.go +++ b/service/lightsail/api_op_DeleteBucket.go @@ -12,8 +12,8 @@ import ( ) // Deletes a Amazon Lightsail bucket. When you delete your bucket, the bucket name -// is released and can be reused for a new bucket in your account or another AWS -// account. +// is released and can be reused for a new bucket in your account or another Amazon +// Web Services account. func (c *Client) DeleteBucket(ctx context.Context, params *DeleteBucketInput, optFns ...func(*Options)) (*DeleteBucketOutput, error) { if params == nil { params = &DeleteBucketInput{} diff --git a/service/lightsail/api_op_DeleteContactMethod.go b/service/lightsail/api_op_DeleteContactMethod.go index 1a56fa33e3f..5d142cc3781 100644 --- a/service/lightsail/api_op_DeleteContactMethod.go +++ b/service/lightsail/api_op_DeleteContactMethod.go @@ -13,10 +13,10 @@ import ( // Deletes a contact method. A contact method is used to send you notifications // about your Amazon Lightsail resources. You can add one email address and one -// mobile phone number contact method in each AWS Region. However, SMS text -// messaging is not supported in some AWS Regions, and SMS text messages cannot be -// sent to some countries/regions. For more information, see Notifications in -// Amazon Lightsail +// mobile phone number contact method in each Amazon Web Services Region. However, +// SMS text messaging is not supported in some Amazon Web Services Regions, and SMS +// text messages cannot be sent to some countries/regions. For more information, +// see Notifications in Amazon Lightsail // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-notifications). func (c *Client) DeleteContactMethod(ctx context.Context, params *DeleteContactMethodInput, optFns ...func(*Options)) (*DeleteContactMethodOutput, error) { if params == nil { diff --git a/service/lightsail/api_op_GetBuckets.go b/service/lightsail/api_op_GetBuckets.go index 6c9ff935549..e277b31f323 100644 --- a/service/lightsail/api_op_GetBuckets.go +++ b/service/lightsail/api_op_GetBuckets.go @@ -35,8 +35,8 @@ func (c *Client) GetBuckets(ctx context.Context, params *GetBucketsInput, optFns type GetBucketsInput struct { // The name of the bucket for which to return information. When omitted, the - // response includes all of your buckets in the AWS Region where the request is - // made. + // response includes all of your buckets in the Amazon Web Services Region where + // the request is made. BucketName *string // A Boolean value that indicates whether to include Lightsail instances that were diff --git a/service/lightsail/api_op_GetCertificates.go b/service/lightsail/api_op_GetCertificates.go index 803f728678e..f173b626d9f 100644 --- a/service/lightsail/api_op_GetCertificates.go +++ b/service/lightsail/api_op_GetCertificates.go @@ -33,14 +33,14 @@ func (c *Client) GetCertificates(ctx context.Context, params *GetCertificatesInp type GetCertificatesInput struct { // The name for the certificate for which to return information. When omitted, the - // response includes all of your certificates in the AWS Region where the request - // is made. + // response includes all of your certificates in the Amazon Web Services Region + // where the request is made. CertificateName *string // The status of the certificates for which to return information. For example, // specify ISSUED to return only certificates with an ISSUED status. When omitted, - // the response includes all of your certificates in the AWS Region where the - // request is made, regardless of their current status. + // the response includes all of your certificates in the Amazon Web Services Region + // where the request is made, regardless of their current status. CertificateStatuses []types.CertificateStatus // Indicates whether to include detailed information about the certificates in the diff --git a/service/lightsail/api_op_GetContactMethods.go b/service/lightsail/api_op_GetContactMethods.go index 119d67358d6..f86375627b6 100644 --- a/service/lightsail/api_op_GetContactMethods.go +++ b/service/lightsail/api_op_GetContactMethods.go @@ -15,9 +15,9 @@ import ( // your request to return information about a specific contact method. A contact // method is used to send you notifications about your Amazon Lightsail resources. // You can add one email address and one mobile phone number contact method in each -// AWS Region. However, SMS text messaging is not supported in some AWS Regions, -// and SMS text messages cannot be sent to some countries/regions. For more -// information, see Notifications in Amazon Lightsail +// Amazon Web Services Region. However, SMS text messaging is not supported in some +// Amazon Web Services Regions, and SMS text messages cannot be sent to some +// countries/regions. For more information, see Notifications in Amazon Lightsail // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-notifications). func (c *Client) GetContactMethods(ctx context.Context, params *GetContactMethodsInput, optFns ...func(*Options)) (*GetContactMethodsOutput, error) { if params == nil { diff --git a/service/lightsail/api_op_GetContainerServices.go b/service/lightsail/api_op_GetContainerServices.go index d67b9674c0f..839667f8c5f 100644 --- a/service/lightsail/api_op_GetContainerServices.go +++ b/service/lightsail/api_op_GetContainerServices.go @@ -31,8 +31,8 @@ func (c *Client) GetContainerServices(ctx context.Context, params *GetContainerS type GetContainerServicesInput struct { // The name of the container service for which to return information. When omitted, - // the response includes all of your container services in the AWS Region where the - // request is made. + // the response includes all of your container services in the Amazon Web Services + // Region where the request is made. ServiceName *string noSmithyDocumentSerde diff --git a/service/lightsail/api_op_GetDistributions.go b/service/lightsail/api_op_GetDistributions.go index b56ef7c10ec..a865d3451ca 100644 --- a/service/lightsail/api_op_GetDistributions.go +++ b/service/lightsail/api_op_GetDistributions.go @@ -31,8 +31,8 @@ func (c *Client) GetDistributions(ctx context.Context, params *GetDistributionsI type GetDistributionsInput struct { // The name of the distribution for which to return information. When omitted, the - // response includes all of your distributions in the AWS Region where the request - // is made. + // response includes all of your distributions in the Amazon Web Services Region + // where the request is made. DistributionName *string // The token to advance to the next page of results from your request. To get a diff --git a/service/lightsail/api_op_GetLoadBalancerTlsPolicies.go b/service/lightsail/api_op_GetLoadBalancerTlsPolicies.go new file mode 100644 index 00000000000..2238f257fd8 --- /dev/null +++ b/service/lightsail/api_op_GetLoadBalancerTlsPolicies.go @@ -0,0 +1,129 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package lightsail + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/lightsail/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of TLS security policies that you can apply to Lightsail load +// balancers. For more information about load balancer TLS security policies, see +// Load balancer TLS security policies +// (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configure-load-balancer-tls-security-policy) +// in the Amazon Lightsail Developer Guide. +func (c *Client) GetLoadBalancerTlsPolicies(ctx context.Context, params *GetLoadBalancerTlsPoliciesInput, optFns ...func(*Options)) (*GetLoadBalancerTlsPoliciesOutput, error) { + if params == nil { + params = &GetLoadBalancerTlsPoliciesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetLoadBalancerTlsPolicies", params, optFns, c.addOperationGetLoadBalancerTlsPoliciesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetLoadBalancerTlsPoliciesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetLoadBalancerTlsPoliciesInput struct { + + // The token to advance to the next page of results from your request. To get a + // page token, perform an initial GetLoadBalancerTlsPolicies request. If your + // results are paginated, the response will return a next page token that you can + // specify as the page token in a subsequent request. + PageToken *string + + noSmithyDocumentSerde +} + +type GetLoadBalancerTlsPoliciesOutput struct { + + // The token to advance to the next page of results from your request. A next page + // token is not returned if there are no more results to display. To get the next + // page of results, perform another GetLoadBalancerTlsPolicies request and specify + // the next page token using the pageToken parameter. + NextPageToken *string + + // An array of objects that describe the TLS security policies that are available. + TlsPolicies []types.LoadBalancerTlsPolicy + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetLoadBalancerTlsPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLoadBalancerTlsPolicies{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLoadBalancerTlsPolicies{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLoadBalancerTlsPolicies(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetLoadBalancerTlsPolicies(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "lightsail", + OperationName: "GetLoadBalancerTlsPolicies", + } +} diff --git a/service/lightsail/api_op_PutAlarm.go b/service/lightsail/api_op_PutAlarm.go index e5c97ba4b51..6e34b8899be 100644 --- a/service/lightsail/api_op_PutAlarm.go +++ b/service/lightsail/api_op_PutAlarm.go @@ -106,10 +106,10 @@ type PutAlarmInput struct { // or both. A notification is sent via the specified contact protocol if // notifications are enabled for the alarm, and when the alarm is triggered. A // notification is not sent if a contact protocol is not specified, if the - // specified contact protocol is not configured in the AWS Region, or if - // notifications are not enabled for the alarm using the notificationEnabled + // specified contact protocol is not configured in the Amazon Web Services Region, + // or if notifications are not enabled for the alarm using the notificationEnabled // paramater. Use the CreateContactMethod action to configure a contact protocol in - // an AWS Region. + // an Amazon Web Services Region. ContactProtocols []types.ContactProtocol // The number of data points that must be not within the specified threshold to diff --git a/service/lightsail/api_op_RegisterContainerImage.go b/service/lightsail/api_op_RegisterContainerImage.go index 47ac553824c..6efbe8b8c0f 100644 --- a/service/lightsail/api_op_RegisterContainerImage.go +++ b/service/lightsail/api_op_RegisterContainerImage.go @@ -71,8 +71,8 @@ type RegisterContainerImageInput struct { type RegisterContainerImageOutput struct { - // Describes a container image that is registered to an Amazon Lightsail container - // service. + // An object that describes a container image that is registered to a Lightsail + // container service ContainerImage *types.ContainerImage // Metadata pertaining to the operation's result. diff --git a/service/lightsail/api_op_SendContactMethodVerification.go b/service/lightsail/api_op_SendContactMethodVerification.go index bf83071eef0..aea9719dd26 100644 --- a/service/lightsail/api_op_SendContactMethodVerification.go +++ b/service/lightsail/api_op_SendContactMethodVerification.go @@ -14,10 +14,10 @@ import ( // Sends a verification request to an email contact method to ensure it's owned by // the requester. SMS contact methods don't need to be verified. A contact method // is used to send you notifications about your Amazon Lightsail resources. You can -// add one email address and one mobile phone number contact method in each AWS -// Region. However, SMS text messaging is not supported in some AWS Regions, and -// SMS text messages cannot be sent to some countries/regions. For more -// information, see Notifications in Amazon Lightsail +// add one email address and one mobile phone number contact method in each Amazon +// Web Services Region. However, SMS text messaging is not supported in some Amazon +// Web Services Regions, and SMS text messages cannot be sent to some +// countries/regions. For more information, see Notifications in Amazon Lightsail // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-notifications). // A verification request is sent to the contact method when you initially create // it. Use this action to send another verification request if a previous diff --git a/service/lightsail/api_op_SetIpAddressType.go b/service/lightsail/api_op_SetIpAddressType.go index f1de235a3f4..25a9c77a09f 100644 --- a/service/lightsail/api_op_SetIpAddressType.go +++ b/service/lightsail/api_op_SetIpAddressType.go @@ -45,8 +45,8 @@ type SetIpAddressTypeInput struct { // The resource type. The possible values are Distribution, Instance, and // LoadBalancer. Distribution-related APIs are available only in the N. Virginia - // (us-east-1) AWS Region. Set your AWS Region configuration to us-east-1 to - // create, view, or edit distributions. + // (us-east-1) Amazon Web Services Region. Set your Amazon Web Services Region + // configuration to us-east-1 to create, view, or edit distributions. // // This member is required. ResourceType types.ResourceType diff --git a/service/lightsail/api_op_SetResourceAccessForBucket.go b/service/lightsail/api_op_SetResourceAccessForBucket.go index 75b4b766d92..730eb484ae9 100644 --- a/service/lightsail/api_op_SetResourceAccessForBucket.go +++ b/service/lightsail/api_op_SetResourceAccessForBucket.go @@ -13,7 +13,7 @@ import ( // Sets the Amazon Lightsail resources that can access the specified Lightsail // bucket. Lightsail buckets currently support setting access for Lightsail -// instances in the same AWS Region. +// instances in the same Amazon Web Services Region. func (c *Client) SetResourceAccessForBucket(ctx context.Context, params *SetResourceAccessForBucketInput, optFns ...func(*Options)) (*SetResourceAccessForBucketOutput, error) { if params == nil { params = &SetResourceAccessForBucketInput{} diff --git a/service/lightsail/api_op_UpdateBucket.go b/service/lightsail/api_op_UpdateBucket.go index 13995f122c3..5a24b0fb823 100644 --- a/service/lightsail/api_op_UpdateBucket.go +++ b/service/lightsail/api_op_UpdateBucket.go @@ -13,7 +13,7 @@ import ( // Updates an existing Amazon Lightsail bucket. Use this action to update the // configuration of an existing bucket, such as versioning, public accessibility, -// and the AWS accounts that can access the bucket. +// and the Amazon Web Services accounts that can access the bucket. func (c *Client) UpdateBucket(ctx context.Context, params *UpdateBucketInput, optFns ...func(*Options)) (*UpdateBucketOutput, error) { if params == nil { params = &UpdateBucketInput{} @@ -42,8 +42,9 @@ type UpdateBucketInput struct { // An object that sets the public accessibility of objects in the specified bucket. AccessRules *types.AccessRules - // An array of strings to specify the AWS account IDs that can access the bucket. - // You can give a maximum of 10 AWS accounts access to a bucket. + // An array of strings to specify the Amazon Web Services account IDs that can + // access the bucket. You can give a maximum of 10 Amazon Web Services accounts + // access to a bucket. ReadonlyAccessAccounts []string // Specifies whether to enable or suspend versioning of objects in the bucket. The diff --git a/service/lightsail/api_op_UpdateDistributionBundle.go b/service/lightsail/api_op_UpdateDistributionBundle.go index 9fd085f6cb8..572fccd37e1 100644 --- a/service/lightsail/api_op_UpdateDistributionBundle.go +++ b/service/lightsail/api_op_UpdateDistributionBundle.go @@ -52,7 +52,9 @@ type UpdateDistributionBundleInput struct { type UpdateDistributionBundleOutput struct { - // Describes the API operation. + // An object that describes the result of the action, such as the status of the + // request, the timestamp of the request, and the resources affected by the + // request. Operation *types.Operation // Metadata pertaining to the operation's result. diff --git a/service/lightsail/api_op_UpdateLoadBalancerAttribute.go b/service/lightsail/api_op_UpdateLoadBalancerAttribute.go index 3f301ff22b8..008f397b30f 100644 --- a/service/lightsail/api_op_UpdateLoadBalancerAttribute.go +++ b/service/lightsail/api_op_UpdateLoadBalancerAttribute.go @@ -34,12 +34,35 @@ func (c *Client) UpdateLoadBalancerAttribute(ctx context.Context, params *Update type UpdateLoadBalancerAttributeInput struct { - // The name of the attribute you want to update. Valid values are below. + // The name of the attribute you want to update. // // This member is required. AttributeName types.LoadBalancerAttributeName - // The value that you want to specify for the attribute name. + // The value that you want to specify for the attribute name. The following values + // are supported depending on what you specify for the attributeName request + // parameter: + // + // * If you specify HealthCheckPath for the attributeName request + // parameter, then the attributeValue request parameter must be the path to ping on + // the target (for example, /weather/us/wa/seattle). + // + // * If you specify + // SessionStickinessEnabled for the attributeName request parameter, then the + // attributeValue request parameter must be true or false. + // + // * If you specify + // SessionStickiness_LB_CookieDurationSeconds for the attributeName request + // parameter, then the attributeValue request parameter must be an interger that + // represents the cookie duration in seconds. + // + // * If you specify + // HttpsRedirectionEnabled for the attributeName request parameter, then the + // attributeValue request parameter must be true or false. + // + // * If you specify + // TlsPolicyName for the attributeName request parameter, then the attributeValue + // request parameter must be TLS version 1.0, 1.1, and 1.2 or TLS version 1.2. // // This member is required. AttributeValue *string diff --git a/service/lightsail/deserializers.go b/service/lightsail/deserializers.go index 87c80fde1ed..e5b4d66fdf7 100644 --- a/service/lightsail/deserializers.go +++ b/service/lightsail/deserializers.go @@ -13235,6 +13235,129 @@ func awsAwsjson11_deserializeOpErrorGetLoadBalancerTlsCertificates(response *smi } } +type awsAwsjson11_deserializeOpGetLoadBalancerTlsPolicies struct { +} + +func (*awsAwsjson11_deserializeOpGetLoadBalancerTlsPolicies) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpGetLoadBalancerTlsPolicies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorGetLoadBalancerTlsPolicies(response, &metadata) + } + output := &GetLoadBalancerTlsPoliciesOutput{} + 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 = awsAwsjson11_deserializeOpDocumentGetLoadBalancerTlsPoliciesOutput(&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 out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorGetLoadBalancerTlsPolicies(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("AccountSetupInProgressException", errorCode): + return awsAwsjson11_deserializeErrorAccountSetupInProgressException(response, errorBody) + + case strings.EqualFold("InvalidInputException", errorCode): + return awsAwsjson11_deserializeErrorInvalidInputException(response, errorBody) + + case strings.EqualFold("ServiceException", errorCode): + return awsAwsjson11_deserializeErrorServiceException(response, errorBody) + + case strings.EqualFold("UnauthenticatedException", errorCode): + return awsAwsjson11_deserializeErrorUnauthenticatedException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpGetOperation struct { } @@ -27320,6 +27443,15 @@ func awsAwsjson11_deserializeDocumentLoadBalancer(v **types.LoadBalancer, value sv.HealthCheckPath = ptr.String(jtv) } + case "httpsRedirectionEnabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value) + } + sv.HttpsRedirectionEnabled = ptr.Bool(jtv) + } + case "instanceHealthSummary": if err := awsAwsjson11_deserializeDocumentInstanceHealthSummaryList(&sv.InstanceHealthSummary, value); err != nil { return err @@ -27412,6 +27544,15 @@ func awsAwsjson11_deserializeDocumentLoadBalancer(v **types.LoadBalancer, value return err } + case "tlsPolicyName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) + } + sv.TlsPolicyName = ptr.String(jtv) + } + default: _, _ = key, value @@ -28117,6 +28258,108 @@ func awsAwsjson11_deserializeDocumentLoadBalancerTlsCertificateSummaryList(v *[] return nil } +func awsAwsjson11_deserializeDocumentLoadBalancerTlsPolicy(v **types.LoadBalancerTlsPolicy, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.LoadBalancerTlsPolicy + if *v == nil { + sv = &types.LoadBalancerTlsPolicy{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ciphers": + if err := awsAwsjson11_deserializeDocumentStringList(&sv.Ciphers, value); err != nil { + return err + } + + case "description": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected string to be of type string, got %T instead", value) + } + sv.Description = ptr.String(jtv) + } + + case "isDefault": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value) + } + sv.IsDefault = ptr.Bool(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "protocols": + if err := awsAwsjson11_deserializeDocumentStringList(&sv.Protocols, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentLoadBalancerTlsPolicyList(v *[]types.LoadBalancerTlsPolicy, 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.LoadBalancerTlsPolicy + if *v == nil { + cv = []types.LoadBalancerTlsPolicy{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.LoadBalancerTlsPolicy + destAddr := &col + if err := awsAwsjson11_deserializeDocumentLoadBalancerTlsPolicy(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentLogEvent(v **types.LogEvent, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -35369,6 +35612,51 @@ func awsAwsjson11_deserializeOpDocumentGetLoadBalancerTlsCertificatesOutput(v ** return nil } +func awsAwsjson11_deserializeOpDocumentGetLoadBalancerTlsPoliciesOutput(v **GetLoadBalancerTlsPoliciesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetLoadBalancerTlsPoliciesOutput + if *v == nil { + sv = &GetLoadBalancerTlsPoliciesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextPageToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected string to be of type string, got %T instead", value) + } + sv.NextPageToken = ptr.String(jtv) + } + + case "tlsPolicies": + if err := awsAwsjson11_deserializeDocumentLoadBalancerTlsPolicyList(&sv.TlsPolicies, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentGetOperationOutput(v **GetOperationOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/lightsail/doc.go b/service/lightsail/doc.go index 0777f73ea8f..aa653f53048 100644 --- a/service/lightsail/doc.go +++ b/service/lightsail/doc.go @@ -4,20 +4,21 @@ // Amazon Lightsail. // // Amazon Lightsail is the easiest way to get started with Amazon Web Services -// (AWS) for developers who need to build websites or web applications. It includes -// everything you need to launch your project quickly - instances (virtual private -// servers), container services, storage buckets, managed databases, SSD-based -// block storage, static IP addresses, load balancers, content delivery network -// (CDN) distributions, DNS management of registered domains, and resource -// snapshots (backups) - for a low, predictable monthly price. You can manage your -// Lightsail resources using the Lightsail console, Lightsail API, AWS Command Line -// Interface (AWS CLI), or SDKs. For more information about Lightsail concepts and -// tasks, see the Amazon Lightsail Developer Guide +// (Amazon Web Services) for developers who need to build websites or web +// applications. It includes everything you need to launch your project quickly - +// instances (virtual private servers), container services, storage buckets, +// managed databases, SSD-based block storage, static IP addresses, load balancers, +// content delivery network (CDN) distributions, DNS management of registered +// domains, and resource snapshots (backups) - for a low, predictable monthly +// price. You can manage your Lightsail resources using the Lightsail console, +// Lightsail API, AWS Command Line Interface (AWS CLI), or SDKs. For more +// information about Lightsail concepts and tasks, see the Amazon Lightsail +// Developer Guide // (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/lightsail-how-to-set-up-access-keys-to-use-sdk-api-cli). // This API Reference provides detailed information about the actions, data types, // parameters, and errors of the Lightsail service. For more information about the -// supported AWS Regions, endpoints, and service quotas of the Lightsail service, -// see Amazon Lightsail Endpoints and Quotas -// (https://docs.aws.amazon.com/general/latest/gr/lightsail.html) in the AWS -// General Reference. +// supported Amazon Web Services Regions, endpoints, and service quotas of the +// Lightsail service, see Amazon Lightsail Endpoints and Quotas +// (https://docs.aws.amazon.com/general/latest/gr/lightsail.html) in the Amazon Web +// Services General Reference. package lightsail diff --git a/service/lightsail/generated.json b/service/lightsail/generated.json index 38bc2ffd67a..340a964c2fb 100644 --- a/service/lightsail/generated.json +++ b/service/lightsail/generated.json @@ -111,6 +111,7 @@ "api_op_GetLoadBalancer.go", "api_op_GetLoadBalancerMetricData.go", "api_op_GetLoadBalancerTlsCertificates.go", + "api_op_GetLoadBalancerTlsPolicies.go", "api_op_GetLoadBalancers.go", "api_op_GetOperation.go", "api_op_GetOperations.go", diff --git a/service/lightsail/serializers.go b/service/lightsail/serializers.go index b34cad0dd13..03226475fc9 100644 --- a/service/lightsail/serializers.go +++ b/service/lightsail/serializers.go @@ -5737,6 +5737,61 @@ func (m *awsAwsjson11_serializeOpGetLoadBalancerTlsCertificates) HandleSerialize return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpGetLoadBalancerTlsPolicies struct { +} + +func (*awsAwsjson11_serializeOpGetLoadBalancerTlsPolicies) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpGetLoadBalancerTlsPolicies) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetLoadBalancerTlsPoliciesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("Lightsail_20161128.GetLoadBalancerTlsPolicies") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentGetLoadBalancerTlsPoliciesInput(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 = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpGetOperation struct { } @@ -10063,6 +10118,11 @@ func awsAwsjson11_serializeOpDocumentCreateLoadBalancerInput(v *CreateLoadBalanc } } + if v.TlsPolicyName != nil { + ok := object.Key("tlsPolicyName") + ok.String(*v.TlsPolicyName) + } + return nil } @@ -11420,6 +11480,18 @@ func awsAwsjson11_serializeOpDocumentGetLoadBalancerTlsCertificatesInput(v *GetL return nil } +func awsAwsjson11_serializeOpDocumentGetLoadBalancerTlsPoliciesInput(v *GetLoadBalancerTlsPoliciesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.PageToken != nil { + ok := object.Key("pageToken") + ok.String(*v.PageToken) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentGetOperationInput(v *GetOperationInput, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/lightsail/types/enums.go b/service/lightsail/types/enums.go index 1b7ad53c3c9..b0f15446899 100644 --- a/service/lightsail/types/enums.go +++ b/service/lightsail/types/enums.go @@ -794,6 +794,8 @@ const ( LoadBalancerAttributeNameHealthCheckPath LoadBalancerAttributeName = "HealthCheckPath" LoadBalancerAttributeNameSessionStickinessEnabled LoadBalancerAttributeName = "SessionStickinessEnabled" LoadBalancerAttributeNameSessionStickinessLbCookieDurationSeconds LoadBalancerAttributeName = "SessionStickiness_LB_CookieDurationSeconds" + LoadBalancerAttributeNameHttpsRedirectionEnabled LoadBalancerAttributeName = "HttpsRedirectionEnabled" + LoadBalancerAttributeNameTlsPolicyName LoadBalancerAttributeName = "TlsPolicyName" ) // Values returns all known values for LoadBalancerAttributeName. Note that this @@ -804,6 +806,8 @@ func (LoadBalancerAttributeName) Values() []LoadBalancerAttributeName { "HealthCheckPath", "SessionStickinessEnabled", "SessionStickiness_LB_CookieDurationSeconds", + "HttpsRedirectionEnabled", + "TlsPolicyName", } } diff --git a/service/lightsail/types/errors.go b/service/lightsail/types/errors.go index 739dd3d5295..437f3f916f3 100644 --- a/service/lightsail/types/errors.go +++ b/service/lightsail/types/errors.go @@ -59,8 +59,9 @@ func (e *AccountSetupInProgressException) ErrorFault() smithy.ErrorFault { retur // Lightsail throws this exception when user input does not conform to the // validation rules of an input field. Domain and distribution APIs are only -// available in the N. Virginia (us-east-1) AWS Region. Please set your AWS Region -// configuration to us-east-1 to create, view, or edit these resources. +// available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set +// your Amazon Web Services Region configuration to us-east-1 to create, view, or +// edit these resources. type InvalidInputException struct { Message *string diff --git a/service/lightsail/types/types.go b/service/lightsail/types/types.go index 69cefb9821b..6a6982c28d7 100644 --- a/service/lightsail/types/types.go +++ b/service/lightsail/types/types.go @@ -493,7 +493,7 @@ type Bucket struct { // Indicates whether the bundle that is currently applied to a bucket can be // changed to another bundle. You can update a bucket's bundle only one time within - // a monthly AWS billing cycle. Use the UpdateBucketBundle + // a monthly Amazon Web Services billing cycle. Use the UpdateBucketBundle // (https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateBucketBundle.html) // action to change a bucket's bundle. AbleToUpdateBundle *bool @@ -517,7 +517,8 @@ type Bucket struct { // The timestamp when the distribution was created. CreatedAt *time.Time - // Describes the resource location. + // An object that describes the location of the bucket, such as the Amazon Web + // Services Region and Availability Zone. Location *ResourceLocation // The name of the bucket. @@ -536,8 +537,8 @@ type Bucket struct { // never been enabled. ObjectVersioning *string - // An array of strings that specify the AWS account IDs that have read-only access - // to the bucket. + // An array of strings that specify the Amazon Web Services account IDs that have + // read-only access to the bucket. ReadonlyAccessAccounts []string // The Lightsail resource type of the bucket (for example, Bucket). @@ -583,9 +584,9 @@ type BucketAccessLogConfig struct { Enabled *bool // The name of the bucket where the access logs are saved. The destination can be a - // Lightsail bucket in the same account, and in the same AWS Region as the source - // bucket. This parameter is required when enabling the access log for a bucket, - // and should be omitted when disabling the access log. + // Lightsail bucket in the same account, and in the same Amazon Web Services Region + // as the source bucket. This parameter is required when enabling the access log + // for a bucket, and should be omitted when disabling the access log. Destination *string // The optional object prefix for the bucket access log. The prefix is an optional @@ -994,8 +995,8 @@ type CloudFormationStackRecord struct { // stack. DestinationInfo *DestinationInfo - // A list of objects describing the Availability Zone and AWS Region of the - // CloudFormation stack record. + // A list of objects describing the Availability Zone and Amazon Web Services + // Region of the CloudFormation stack record. Location *ResourceLocation // The name of the CloudFormation stack record. It starts with @@ -1045,7 +1046,8 @@ type ContactMethod struct { // The timestamp when the contact method was created. CreatedAt *time.Time - // Describes the resource location. + // An object that describes the location of the contact method, such as the Amazon + // Web Services Region and Availability Zone. Location *ResourceLocation // The name of the contact method. @@ -1142,8 +1144,8 @@ type ContainerService struct { // A Boolean value indicating whether the container service is disabled. IsDisabled *bool - // An object that describes the location of the container service, such as the AWS - // Region and Availability Zone. + // An object that describes the location of the container service, such as the + // Amazon Web Services Region and Availability Zone. Location *ResourceLocation // An object that describes the next deployment of the container service. This @@ -1158,9 +1160,9 @@ type ContainerService struct { PowerId *string // The principal ARN of the container service. The principal ARN can be used to - // create a trust relationship between your standard AWS account and your Lightsail - // container service. This allows you to give your service permission to access - // resources in your standard AWS account. + // create a trust relationship between your standard Amazon Web Services account + // and your Lightsail container service. This allows you to give your service + // permission to access resources in your standard Amazon Web Services account. PrincipalArn *string // The private domain name of the container service. The private domain name is @@ -2612,10 +2614,11 @@ type LightsailDistribution struct { // Indicates whether the distribution is enabled. IsEnabled *bool - // An object that describes the location of the distribution, such as the AWS - // Region and Availability Zone. Lightsail distributions are global resources that - // can reference an origin in any AWS Region, and distribute its content globally. - // However, all distributions are located in the us-east-1 Region. + // An object that describes the location of the distribution, such as the Amazon + // Web Services Region and Availability Zone. Lightsail distributions are global + // resources that can reference an origin in any Amazon Web Services Region, and + // distribute its content globally. However, all distributions are located in the + // us-east-1 Region. Location *ResourceLocation // The name of the distribution. @@ -2668,6 +2671,10 @@ type LoadBalancer struct { // the load balancer tries to make a request to the default (root) page. HealthCheckPath *string + // A Boolean value that indicates whether HTTPS redirection is enabled for the load + // balancer. + HttpsRedirectionEnabled *bool + // An array of InstanceHealthSummary objects describing the health of the load // balancer. InstanceHealthSummary []InstanceHealthSummary @@ -2716,6 +2723,14 @@ type LoadBalancer struct { // certificate is attached to the load balancer. TlsCertificateSummaries []LoadBalancerTlsCertificateSummary + // The name of the TLS security policy for the load balancer. The following TLS + // security policy names are possible: + // + // * TLS-2016-08 + // + // * TLS-FS-Res-1-2-2019-08 + TlsPolicyName *string + noSmithyDocumentSerde } @@ -2979,6 +2994,53 @@ type LoadBalancerTlsCertificateSummary struct { noSmithyDocumentSerde } +// Describes the TLS security policies that are available for Lightsail load +// balancers. For more information about load balancer TLS security policies, see +// Load balancer TLS security policies +// (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configure-load-balancer-tls-security-policy) +// in the Amazon Lightsail Developer Guide. +type LoadBalancerTlsPolicy struct { + + // The ciphers used by the TLS security policy. The ciphers are listed in order of + // preference. + Ciphers []string + + // The description of the TLS security policy. + Description *string + + // A Boolean value that indicates whether the TLS security policy is the default. + IsDefault *bool + + // The name of the TLS security policy. The following TLS security policy names are + // possible: + // + // * TLS-2016-08 + // + // * TLS-FS-Res-1-2-2019-08 + // + // You can specify either of + // these values for the tlsSecurityPolicyName request parameter in the + // CreateLoadBalancer + // (https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_CreateLoadBalancer.html) + // action, and the attributeValue request parameter in the + // UpdateLoadBalancerAttribute + // (https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_UpdateLoadBalancerAttribute.html) + // action. + Name *string + + // The protocols used in a given TLS security policy. The following protocols are + // possible: + // + // * Protocol-TLSv1 + // + // * Protocol-TLSv1.1 + // + // * Protocol-TLSv1.2 + Protocols []string + + noSmithyDocumentSerde +} + // Describes a database log event. type LogEvent struct { @@ -3066,7 +3128,7 @@ type Operation struct { // A Boolean value indicating whether the operation is terminal. IsTerminal *bool - // The AWS Region and Availability Zone. + // The Amazon Web Services Region and Availability Zone. Location *ResourceLocation // Details about the operation (e.g., Debian-1GB-Ohio-1). diff --git a/service/networkfirewall/api_op_AssociateSubnets.go b/service/networkfirewall/api_op_AssociateSubnets.go index 4317c243a3d..835677e6aba 100644 --- a/service/networkfirewall/api_op_AssociateSubnets.go +++ b/service/networkfirewall/api_op_AssociateSubnets.go @@ -13,10 +13,10 @@ import ( // Associates the specified subnets in the Amazon VPC to the firewall. You can // specify one subnet for each of the Availability Zones that the VPC spans. This -// request creates an AWS Network Firewall firewall endpoint in each of the -// subnets. To enable the firewall's protections, you must also modify the VPC's -// route tables for each subnet's Availability Zone, to redirect the traffic that's -// coming into and going out of the zone through the firewall endpoint. +// request creates an Network Firewall firewall endpoint in each of the subnets. To +// enable the firewall's protections, you must also modify the VPC's route tables +// for each subnet's Availability Zone, to redirect the traffic that's coming into +// and going out of the zone through the firewall endpoint. func (c *Client) AssociateSubnets(ctx context.Context, params *AssociateSubnetsInput, optFns ...func(*Options)) (*AssociateSubnetsOutput, error) { if params == nil { params = &AssociateSubnetsInput{} diff --git a/service/networkfirewall/api_op_CreateFirewall.go b/service/networkfirewall/api_op_CreateFirewall.go index 18ca501a2f6..193f31afa02 100644 --- a/service/networkfirewall/api_op_CreateFirewall.go +++ b/service/networkfirewall/api_op_CreateFirewall.go @@ -11,18 +11,18 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates an AWS Network Firewall Firewall and accompanying FirewallStatus for a -// VPC. The firewall defines the configuration settings for an AWS Network Firewall +// Creates an Network Firewall Firewall and accompanying FirewallStatus for a VPC. +// The firewall defines the configuration settings for an Network Firewall // firewall. The settings that you can define at creation include the firewall // policy, the subnets in your VPC to use for the firewall endpoints, and any tags -// that are attached to the firewall AWS resource. After you create a firewall, you -// can provide additional settings, like the logging configuration. To update the -// settings for a firewall, you use the operations that apply to the settings -// themselves, for example UpdateLoggingConfiguration, AssociateSubnets, and -// UpdateFirewallDeleteProtection. To manage a firewall's tags, use the standard -// AWS resource tagging operations, ListTagsForResource, TagResource, and -// UntagResource. To retrieve information about firewalls, use ListFirewalls and -// DescribeFirewall. +// that are attached to the firewall Amazon Web Services resource. After you create +// a firewall, you can provide additional settings, like the logging configuration. +// To update the settings for a firewall, you use the operations that apply to the +// settings themselves, for example UpdateLoggingConfiguration, AssociateSubnets, +// and UpdateFirewallDeleteProtection. To manage a firewall's tags, use the +// standard Amazon Web Services resource tagging operations, ListTagsForResource, +// TagResource, and UntagResource. To retrieve information about firewalls, use +// ListFirewalls and DescribeFirewall. func (c *Client) CreateFirewall(ctx context.Context, params *CreateFirewallInput, optFns ...func(*Options)) (*CreateFirewallOutput, error) { if params == nil { params = &CreateFirewallInput{} @@ -74,6 +74,9 @@ type CreateFirewallInput struct { // A description of the firewall. Description *string + // A complex type that contains settings for encryption of your firewall resources. + EncryptionConfiguration *types.EncryptionConfiguration + // A setting indicating whether the firewall is protected against a change to the // firewall policy association. Use this setting to protect against accidentally // modifying the firewall policy for a firewall that is in use. When you create a diff --git a/service/networkfirewall/api_op_CreateFirewallPolicy.go b/service/networkfirewall/api_op_CreateFirewallPolicy.go index 76092110dba..3d76a8444fd 100644 --- a/service/networkfirewall/api_op_CreateFirewallPolicy.go +++ b/service/networkfirewall/api_op_CreateFirewallPolicy.go @@ -12,7 +12,7 @@ import ( ) // Creates the firewall policy for the firewall according to the specifications. An -// AWS Network Firewall firewall policy defines the behavior of a firewall, in a +// Network Firewall firewall policy defines the behavior of a firewall, in a // collection of stateless and stateful rule groups and other settings. You can use // one firewall policy for multiple firewalls. func (c *Client) CreateFirewallPolicy(ctx context.Context, params *CreateFirewallPolicyInput, optFns ...func(*Options)) (*CreateFirewallPolicyOutput, error) { @@ -56,6 +56,10 @@ type CreateFirewallPolicyInput struct { // set to FALSE, Network Firewall makes the requested changes to your resources. DryRun bool + // A complex type that contains settings for encryption of your firewall policy + // resources. + EncryptionConfiguration *types.EncryptionConfiguration + // The key:value pairs to associate with the resource. Tags []types.Tag diff --git a/service/networkfirewall/api_op_CreateRuleGroup.go b/service/networkfirewall/api_op_CreateRuleGroup.go index ab8a1b60e04..a7a30f557c7 100644 --- a/service/networkfirewall/api_op_CreateRuleGroup.go +++ b/service/networkfirewall/api_op_CreateRuleGroup.go @@ -93,6 +93,10 @@ type CreateRuleGroupInput struct { // set to FALSE, Network Firewall makes the requested changes to your resources. DryRun bool + // A complex type that contains settings for encryption of your rule group + // resources. + EncryptionConfiguration *types.EncryptionConfiguration + // An object that defines the rule group rules. You must provide either this rule // group setting or a Rules setting, but not both. RuleGroup *types.RuleGroup diff --git a/service/networkfirewall/api_op_DeleteFirewall.go b/service/networkfirewall/api_op_DeleteFirewall.go index cdfbbef870a..620f872577a 100644 --- a/service/networkfirewall/api_op_DeleteFirewall.go +++ b/service/networkfirewall/api_op_DeleteFirewall.go @@ -53,12 +53,12 @@ type DeleteFirewallInput struct { type DeleteFirewallOutput struct { - // The firewall defines the configuration settings for an AWS Network Firewall + // The firewall defines the configuration settings for an Network Firewall // firewall. These settings include the firewall policy, the subnets in your VPC to // use for the firewall endpoints, and any tags that are attached to the firewall - // AWS resource. The status of the firewall, for example whether it's ready to - // filter network traffic, is provided in the corresponding FirewallStatus. You can - // retrieve both objects by calling DescribeFirewall. + // Amazon Web Services resource. The status of the firewall, for example whether + // it's ready to filter network traffic, is provided in the corresponding + // FirewallStatus. You can retrieve both objects by calling DescribeFirewall. Firewall *types.Firewall // Detailed information about the current status of a Firewall. You can retrieve diff --git a/service/networkfirewall/api_op_DescribeLoggingConfiguration.go b/service/networkfirewall/api_op_DescribeLoggingConfiguration.go index d90ef4849fd..deefa0b99ff 100644 --- a/service/networkfirewall/api_op_DescribeLoggingConfiguration.go +++ b/service/networkfirewall/api_op_DescribeLoggingConfiguration.go @@ -46,7 +46,7 @@ type DescribeLoggingConfigurationOutput struct { // The Amazon Resource Name (ARN) of the firewall. FirewallArn *string - // Defines how AWS Network Firewall performs logging for a Firewall. + // Defines how Network Firewall performs logging for a Firewall. LoggingConfiguration *types.LoggingConfiguration // Metadata pertaining to the operation's result. diff --git a/service/networkfirewall/api_op_DescribeResourcePolicy.go b/service/networkfirewall/api_op_DescribeResourcePolicy.go index 8b27be25062..da2ae2e52e3 100644 --- a/service/networkfirewall/api_op_DescribeResourcePolicy.go +++ b/service/networkfirewall/api_op_DescribeResourcePolicy.go @@ -39,7 +39,7 @@ type DescribeResourcePolicyInput struct { type DescribeResourcePolicyOutput struct { - // The AWS Identity and Access Management policy for the resource. + // The IAM policy for the resource. Policy *string // Metadata pertaining to the operation's result. diff --git a/service/networkfirewall/api_op_DescribeRuleGroup.go b/service/networkfirewall/api_op_DescribeRuleGroup.go index 1abef0d724b..29d4cd5e3ba 100644 --- a/service/networkfirewall/api_op_DescribeRuleGroup.go +++ b/service/networkfirewall/api_op_DescribeRuleGroup.go @@ -71,13 +71,13 @@ type DescribeRuleGroupOutput struct { // The object that defines the rules in a rule group. This, along with // RuleGroupResponse, define the rule group. You can retrieve all objects for a - // rule group by calling DescribeRuleGroup. AWS Network Firewall uses a rule group - // to inspect and control network traffic. You define stateless rule groups to - // inspect individual packets and you define stateful rule groups to inspect - // packets in the context of their traffic flow. To use a rule group, you include - // it by reference in an Network Firewall firewall policy, then you use the policy - // in a firewall. You can reference a rule group from more than one firewall - // policy, and you can use a firewall policy in more than one firewall. + // rule group by calling DescribeRuleGroup. Network Firewall uses a rule group to + // inspect and control network traffic. You define stateless rule groups to inspect + // individual packets and you define stateful rule groups to inspect packets in the + // context of their traffic flow. To use a rule group, you include it by reference + // in an Network Firewall firewall policy, then you use the policy in a firewall. + // You can reference a rule group from more than one firewall policy, and you can + // use a firewall policy in more than one firewall. RuleGroup *types.RuleGroup // Metadata pertaining to the operation's result. diff --git a/service/networkfirewall/api_op_ListTagsForResource.go b/service/networkfirewall/api_op_ListTagsForResource.go index 9b9b6f27013..0cf66b4d997 100644 --- a/service/networkfirewall/api_op_ListTagsForResource.go +++ b/service/networkfirewall/api_op_ListTagsForResource.go @@ -15,10 +15,10 @@ import ( // Retrieves the tags associated with the specified resource. Tags are key:value // pairs that you can use to categorize and manage your resources, for purposes // like billing. For example, you might set the tag key to "customer" and the value -// to the customer name or ID. You can specify one or more tags to add to each AWS -// resource, up to 50 tags for a resource. You can tag the AWS resources that you -// manage through AWS Network Firewall: firewalls, firewall policies, and rule -// groups. +// to the customer name or ID. You can specify one or more tags to add to each +// Amazon Web Services resource, up to 50 tags for a resource. You can tag the +// Amazon Web Services resources that you manage through Network Firewall: +// firewalls, firewall policies, and rule groups. func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { if params == nil { params = &ListTagsForResourceInput{} diff --git a/service/networkfirewall/api_op_PutResourcePolicy.go b/service/networkfirewall/api_op_PutResourcePolicy.go index 1b9f8dbf196..56e7fd06027 100644 --- a/service/networkfirewall/api_op_PutResourcePolicy.go +++ b/service/networkfirewall/api_op_PutResourcePolicy.go @@ -10,16 +10,16 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates or updates an AWS Identity and Access Management policy for your rule -// group or firewall policy. Use this to share rule groups and firewall policies -// between accounts. This operation works in conjunction with the AWS Resource -// Access Manager (RAM) service to manage resource sharing for Network Firewall. -// Use this operation to create or update a resource policy for your rule group or -// firewall policy. In the policy, you specify the accounts that you want to share -// the resource with and the operations that you want the accounts to be able to -// perform. When you add an account in the resource policy, you then run the -// following Resource Access Manager (RAM) operations to access and accept the -// shared rule group or firewall policy. +// Creates or updates an IAM policy for your rule group or firewall policy. Use +// this to share rule groups and firewall policies between accounts. This operation +// works in conjunction with the Amazon Web Services Resource Access Manager (RAM) +// service to manage resource sharing for Network Firewall. Use this operation to +// create or update a resource policy for your rule group or firewall policy. In +// the policy, you specify the accounts that you want to share the resource with +// and the operations that you want the accounts to be able to perform. When you +// add an account in the resource policy, you then run the following Resource +// Access Manager (RAM) operations to access and accept the shared rule group or +// firewall policy. // // * GetResourceShareInvitations // (https://docs.aws.amazon.com/ram/latest/APIReference/API_GetResourceShareInvitations.html) @@ -31,8 +31,8 @@ import ( // - Accepts the share invitation for a specified resource share. // // For additional -// information about resource sharing using RAM, see AWS Resource Access Manager -// User Guide (https://docs.aws.amazon.com/ram/latest/userguide/what-is.html). +// information about resource sharing using RAM, see Resource Access Manager User +// Guide (https://docs.aws.amazon.com/ram/latest/userguide/what-is.html). func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolicyInput, optFns ...func(*Options)) (*PutResourcePolicyOutput, error) { if params == nil { params = &PutResourcePolicyInput{} @@ -50,13 +50,13 @@ func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolic type PutResourcePolicyInput struct { - // The AWS Identity and Access Management policy statement that lists the accounts - // that you want to share your rule group or firewall policy with and the - // operations that you want the accounts to be able to perform. For a rule group - // resource, you can specify the following operations in the Actions section of the - // statement: + // The IAM policy statement that lists the accounts that you want to share your + // rule group or firewall policy with and the operations that you want the accounts + // to be able to perform. For a rule group resource, you can specify the following + // operations in the Actions section of the statement: // - // * network-firewall:CreateFirewallPolicy + // * + // network-firewall:CreateFirewallPolicy // // * // network-firewall:UpdateFirewallPolicy diff --git a/service/networkfirewall/api_op_TagResource.go b/service/networkfirewall/api_op_TagResource.go index e2abe9338f0..c5155a9dbfb 100644 --- a/service/networkfirewall/api_op_TagResource.go +++ b/service/networkfirewall/api_op_TagResource.go @@ -14,10 +14,10 @@ import ( // Adds the specified tags to the specified resource. Tags are key:value pairs that // you can use to categorize and manage your resources, for purposes like billing. // For example, you might set the tag key to "customer" and the value to the -// customer name or ID. You can specify one or more tags to add to each AWS -// resource, up to 50 tags for a resource. You can tag the AWS resources that you -// manage through AWS Network Firewall: firewalls, firewall policies, and rule -// groups. +// customer name or ID. You can specify one or more tags to add to each Amazon Web +// Services resource, up to 50 tags for a resource. You can tag the Amazon Web +// Services resources that you manage through Network Firewall: firewalls, firewall +// policies, and rule groups. func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { if params == nil { params = &TagResourceInput{} diff --git a/service/networkfirewall/api_op_UntagResource.go b/service/networkfirewall/api_op_UntagResource.go index 6db542df08d..3af78778f81 100644 --- a/service/networkfirewall/api_op_UntagResource.go +++ b/service/networkfirewall/api_op_UntagResource.go @@ -14,9 +14,9 @@ import ( // key:value pairs that you can use to categorize and manage your resources, for // purposes like billing. For example, you might set the tag key to "customer" and // the value to the customer name or ID. You can specify one or more tags to add to -// each AWS resource, up to 50 tags for a resource. You can manage tags for the AWS -// resources that you manage through AWS Network Firewall: firewalls, firewall -// policies, and rule groups. +// each Amazon Web Services resource, up to 50 tags for a resource. You can manage +// tags for the Amazon Web Services resources that you manage through Network +// Firewall: firewalls, firewall policies, and rule groups. func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { if params == nil { params = &UntagResourceInput{} diff --git a/service/networkfirewall/api_op_UpdateFirewallEncryptionConfiguration.go b/service/networkfirewall/api_op_UpdateFirewallEncryptionConfiguration.go new file mode 100644 index 00000000000..579b055d989 --- /dev/null +++ b/service/networkfirewall/api_op_UpdateFirewallEncryptionConfiguration.go @@ -0,0 +1,174 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package networkfirewall + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/networkfirewall/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// A complex type that contains settings for encryption of your firewall resources. +func (c *Client) UpdateFirewallEncryptionConfiguration(ctx context.Context, params *UpdateFirewallEncryptionConfigurationInput, optFns ...func(*Options)) (*UpdateFirewallEncryptionConfigurationOutput, error) { + if params == nil { + params = &UpdateFirewallEncryptionConfigurationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateFirewallEncryptionConfiguration", params, optFns, c.addOperationUpdateFirewallEncryptionConfigurationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateFirewallEncryptionConfigurationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateFirewallEncryptionConfigurationInput struct { + + // A complex type that contains optional Amazon Web Services Key Management Service + // (KMS) encryption settings for your Network Firewall resources. Your data is + // encrypted by default with an Amazon Web Services owned key that Amazon Web + // Services owns and manages for you. You can use either the Amazon Web Services + // owned key, or provide your own customer managed key. To learn more about KMS + // encryption of your Network Firewall resources, see Encryption at rest with + // Amazon Web Services Key Managment Service + // (https://docs.aws.amazon.com/kms/latest/developerguide/kms-encryption-at-rest.html) + // in the Network Firewall Developer Guide. + EncryptionConfiguration *types.EncryptionConfiguration + + // The Amazon Resource Name (ARN) of the firewall. + FirewallArn *string + + // The descriptive name of the firewall. You can't change the name of a firewall + // after you create it. + FirewallName *string + + // An optional token that you can use for optimistic locking. Network Firewall + // returns a token to your requests that access the firewall. The token marks the + // state of the firewall resource at the time of the request. To make an + // unconditional change to the firewall, omit the token in your update request. + // Without the token, Network Firewall performs your updates regardless of whether + // the firewall has changed since you last retrieved it. To make a conditional + // change to the firewall, provide the token in your update request. Network + // Firewall uses the token to ensure that the firewall hasn't changed since you + // last retrieved it. If it has changed, the operation fails with an + // InvalidTokenException. If this happens, retrieve the firewall again to get a + // current copy of it with a new token. Reapply your changes as needed, then try + // the operation again using the new token. + UpdateToken *string + + noSmithyDocumentSerde +} + +type UpdateFirewallEncryptionConfigurationOutput struct { + + // A complex type that contains optional Amazon Web Services Key Management Service + // (KMS) encryption settings for your Network Firewall resources. Your data is + // encrypted by default with an Amazon Web Services owned key that Amazon Web + // Services owns and manages for you. You can use either the Amazon Web Services + // owned key, or provide your own customer managed key. To learn more about KMS + // encryption of your Network Firewall resources, see Encryption at rest with + // Amazon Web Services Key Managment Service + // (https://docs.aws.amazon.com/kms/latest/developerguide/kms-encryption-at-rest.html) + // in the Network Firewall Developer Guide. + EncryptionConfiguration *types.EncryptionConfiguration + + // The Amazon Resource Name (ARN) of the firewall. + FirewallArn *string + + // The descriptive name of the firewall. You can't change the name of a firewall + // after you create it. + FirewallName *string + + // An optional token that you can use for optimistic locking. Network Firewall + // returns a token to your requests that access the firewall. The token marks the + // state of the firewall resource at the time of the request. To make an + // unconditional change to the firewall, omit the token in your update request. + // Without the token, Network Firewall performs your updates regardless of whether + // the firewall has changed since you last retrieved it. To make a conditional + // change to the firewall, provide the token in your update request. Network + // Firewall uses the token to ensure that the firewall hasn't changed since you + // last retrieved it. If it has changed, the operation fails with an + // InvalidTokenException. If this happens, retrieve the firewall again to get a + // current copy of it with a new token. Reapply your changes as needed, then try + // the operation again using the new token. + UpdateToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateFirewallEncryptionConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsjson10_serializeOpUpdateFirewallEncryptionConfiguration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpUpdateFirewallEncryptionConfiguration{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateFirewallEncryptionConfiguration(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateFirewallEncryptionConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "network-firewall", + OperationName: "UpdateFirewallEncryptionConfiguration", + } +} diff --git a/service/networkfirewall/api_op_UpdateFirewallPolicy.go b/service/networkfirewall/api_op_UpdateFirewallPolicy.go index 3550743bf43..e9a5161fbfb 100644 --- a/service/networkfirewall/api_op_UpdateFirewallPolicy.go +++ b/service/networkfirewall/api_op_UpdateFirewallPolicy.go @@ -59,6 +59,10 @@ type UpdateFirewallPolicyInput struct { // set to FALSE, Network Firewall makes the requested changes to your resources. DryRun bool + // A complex type that contains settings for encryption of your firewall policy + // resources. + EncryptionConfiguration *types.EncryptionConfiguration + // The Amazon Resource Name (ARN) of the firewall policy. You must specify the ARN // or the name, and you can specify both. FirewallPolicyArn *string diff --git a/service/networkfirewall/api_op_UpdateLoggingConfiguration.go b/service/networkfirewall/api_op_UpdateLoggingConfiguration.go index 0f84b837405..7f46cffe7a2 100644 --- a/service/networkfirewall/api_op_UpdateLoggingConfiguration.go +++ b/service/networkfirewall/api_op_UpdateLoggingConfiguration.go @@ -75,7 +75,7 @@ type UpdateLoggingConfigurationOutput struct { // after you create it. FirewallName *string - // Defines how AWS Network Firewall performs logging for a Firewall. + // Defines how Network Firewall performs logging for a Firewall. LoggingConfiguration *types.LoggingConfiguration // Metadata pertaining to the operation's result. diff --git a/service/networkfirewall/api_op_UpdateRuleGroup.go b/service/networkfirewall/api_op_UpdateRuleGroup.go index 6e9355ec330..ce65e2985fe 100644 --- a/service/networkfirewall/api_op_UpdateRuleGroup.go +++ b/service/networkfirewall/api_op_UpdateRuleGroup.go @@ -59,6 +59,10 @@ type UpdateRuleGroupInput struct { // set to FALSE, Network Firewall makes the requested changes to your resources. DryRun bool + // A complex type that contains settings for encryption of your rule group + // resources. + EncryptionConfiguration *types.EncryptionConfiguration + // An object that defines the rule group rules. You must provide either this rule // group setting or a Rules setting, but not both. RuleGroup *types.RuleGroup diff --git a/service/networkfirewall/deserializers.go b/service/networkfirewall/deserializers.go index 3c10f212c14..e5b795db30c 100644 --- a/service/networkfirewall/deserializers.go +++ b/service/networkfirewall/deserializers.go @@ -3075,6 +3075,132 @@ func awsAwsjson10_deserializeOpErrorUpdateFirewallDescription(response *smithyht } } +type awsAwsjson10_deserializeOpUpdateFirewallEncryptionConfiguration struct { +} + +func (*awsAwsjson10_deserializeOpUpdateFirewallEncryptionConfiguration) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson10_deserializeOpUpdateFirewallEncryptionConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson10_deserializeOpErrorUpdateFirewallEncryptionConfiguration(response, &metadata) + } + output := &UpdateFirewallEncryptionConfigurationOutput{} + 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 = awsAwsjson10_deserializeOpDocumentUpdateFirewallEncryptionConfigurationOutput(&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 out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson10_deserializeOpErrorUpdateFirewallEncryptionConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServerError", errorCode): + return awsAwsjson10_deserializeErrorInternalServerError(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsAwsjson10_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("InvalidTokenException", errorCode): + return awsAwsjson10_deserializeErrorInvalidTokenException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceOwnerCheckException", errorCode): + return awsAwsjson10_deserializeErrorResourceOwnerCheckException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsAwsjson10_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson10_deserializeOpUpdateFirewallPolicy struct { } @@ -4440,6 +4566,55 @@ func awsAwsjson10_deserializeDocumentDimensions(v *[]types.Dimension, value inte return nil } +func awsAwsjson10_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 "KeyId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeyId to be of type string, got %T instead", value) + } + sv.KeyId = ptr.String(jtv) + } + + case "Type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EncryptionType to be of type string, got %T instead", value) + } + sv.Type = types.EncryptionType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeDocumentFirewall(v **types.Firewall, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4480,6 +4655,11 @@ func awsAwsjson10_deserializeDocumentFirewall(v **types.Firewall, value interfac sv.Description = ptr.String(jtv) } + case "EncryptionConfiguration": + if err := awsAwsjson10_deserializeDocumentEncryptionConfiguration(&sv.EncryptionConfiguration, value); err != nil { + return err + } + case "FirewallArn": if value != nil { jtv, ok := value.(string) @@ -4817,6 +4997,11 @@ func awsAwsjson10_deserializeDocumentFirewallPolicyResponse(v **types.FirewallPo sv.Description = ptr.String(jtv) } + case "EncryptionConfiguration": + if err := awsAwsjson10_deserializeDocumentEncryptionConfiguration(&sv.EncryptionConfiguration, value); err != nil { + return err + } + case "FirewallPolicyArn": if value != nil { jtv, ok := value.(string) @@ -6261,6 +6446,11 @@ func awsAwsjson10_deserializeDocumentRuleGroupResponse(v **types.RuleGroupRespon sv.Description = ptr.String(jtv) } + case "EncryptionConfiguration": + if err := awsAwsjson10_deserializeDocumentEncryptionConfiguration(&sv.EncryptionConfiguration, value); err != nil { + return err + } + case "NumberOfAssociations": if value != nil { jtv, ok := value.(json.Number) @@ -8933,6 +9123,69 @@ func awsAwsjson10_deserializeOpDocumentUpdateFirewallDescriptionOutput(v **Updat return nil } +func awsAwsjson10_deserializeOpDocumentUpdateFirewallEncryptionConfigurationOutput(v **UpdateFirewallEncryptionConfigurationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateFirewallEncryptionConfigurationOutput + if *v == nil { + sv = &UpdateFirewallEncryptionConfigurationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EncryptionConfiguration": + if err := awsAwsjson10_deserializeDocumentEncryptionConfiguration(&sv.EncryptionConfiguration, value); err != nil { + return err + } + + case "FirewallArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) + } + sv.FirewallArn = ptr.String(jtv) + } + + case "FirewallName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) + } + sv.FirewallName = ptr.String(jtv) + } + + case "UpdateToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UpdateToken to be of type string, got %T instead", value) + } + sv.UpdateToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeOpDocumentUpdateFirewallPolicyChangeProtectionOutput(v **UpdateFirewallPolicyChangeProtectionOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/networkfirewall/doc.go b/service/networkfirewall/doc.go index 940893e4ead..344c338efc2 100644 --- a/service/networkfirewall/doc.go +++ b/service/networkfirewall/doc.go @@ -3,24 +3,26 @@ // Package networkfirewall provides the API client, operations, and parameter types // for AWS Network Firewall. // -// This is the API Reference for AWS Network Firewall. This guide is for developers -// who need detailed information about the Network Firewall API actions, data -// types, and errors. -// -// * The REST API requires you to handle connection details, -// such as calculating signatures, handling request retries, and error handling. -// For general information about using the AWS REST APIs, see AWS APIs -// (https://docs.aws.amazon.com/general/latest/gr/aws-apis.html). To access Network -// Firewall using the REST API endpoint: https://network-firewall..amazonaws.com -// -// * -// Alternatively, you can use one of the AWS SDKs to access an API that's tailored -// to the programming language or platform that you're using. For more information, -// see AWS SDKs (http://aws.amazon.com/tools/#SDKs). -// -// * For descriptions of Network -// Firewall features, including and step-by-step instructions on how to use them -// through the Network Firewall console, see the Network Firewall Developer Guide +// This is the API Reference for Network Firewall. This guide is for developers who +// need detailed information about the Network Firewall API actions, data types, +// and errors. +// +// * The REST API requires you to handle connection details, such as +// calculating signatures, handling request retries, and error handling. For +// general information about using the Amazon Web Services REST APIs, see Amazon +// Web Services APIs (https://docs.aws.amazon.com/general/latest/gr/aws-apis.html). +// To access Network Firewall using the REST API endpoint: +// https://network-firewall..amazonaws.com +// +// * Alternatively, you can use one of the +// Amazon Web Services SDKs to access an API that's tailored to the programming +// language or platform that you're using. For more information, see Amazon Web +// Services SDKs (http://aws.amazon.com/tools/#SDKs). +// +// * For descriptions of +// Network Firewall features, including and step-by-step instructions on how to use +// them through the Network Firewall console, see the Network Firewall Developer +// Guide // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/). // // Network @@ -28,15 +30,15 @@ // prevention service for Amazon Virtual Private Cloud (Amazon VPC). With Network // Firewall, you can filter traffic at the perimeter of your VPC. This includes // filtering traffic going to and coming from an internet gateway, NAT gateway, or -// over VPN or AWS Direct Connect. Network Firewall uses rules that are compatible -// with Suricata, a free, open source intrusion detection system (IDS) engine. AWS -// Network Firewall supports Suricata version 5.0.2. For information about -// Suricata, see the Suricata website (https://suricata-ids.org/). You can use -// Network Firewall to monitor and protect your VPC traffic in a number of ways. -// The following are just a few examples: -// -// * Allow domains or IP addresses for -// known AWS service endpoints, such as Amazon S3, and block all other forms of +// over VPN or Direct Connect. Network Firewall uses rules that are compatible with +// Suricata, a free, open source intrusion detection system (IDS) engine. Network +// Firewall supports Suricata version 5.0.2. For information about Suricata, see +// the Suricata website (https://suricata-ids.org/). You can use Network Firewall +// to monitor and protect your VPC traffic in a number of ways. The following are +// just a few examples: +// +// * Allow domains or IP addresses for known Amazon Web +// Services service endpoints, such as Amazon S3, and block all other forms of // traffic. // // * Use custom lists of known bad domains to limit the types of domain diff --git a/service/networkfirewall/generated.json b/service/networkfirewall/generated.json index cfb3aa98ea8..04a60dce3fb 100644 --- a/service/networkfirewall/generated.json +++ b/service/networkfirewall/generated.json @@ -33,6 +33,7 @@ "api_op_UntagResource.go", "api_op_UpdateFirewallDeleteProtection.go", "api_op_UpdateFirewallDescription.go", + "api_op_UpdateFirewallEncryptionConfiguration.go", "api_op_UpdateFirewallPolicy.go", "api_op_UpdateFirewallPolicyChangeProtection.go", "api_op_UpdateLoggingConfiguration.go", diff --git a/service/networkfirewall/serializers.go b/service/networkfirewall/serializers.go index 29e3ae59a60..db86b0fa230 100644 --- a/service/networkfirewall/serializers.go +++ b/service/networkfirewall/serializers.go @@ -1390,6 +1390,61 @@ func (m *awsAwsjson10_serializeOpUpdateFirewallDescription) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } +type awsAwsjson10_serializeOpUpdateFirewallEncryptionConfiguration struct { +} + +func (*awsAwsjson10_serializeOpUpdateFirewallEncryptionConfiguration) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson10_serializeOpUpdateFirewallEncryptionConfiguration) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*UpdateFirewallEncryptionConfigurationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0") + httpBindingEncoder.SetHeader("X-Amz-Target").String("NetworkFirewall_20201112.UpdateFirewallEncryptionConfiguration") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson10_serializeOpDocumentUpdateFirewallEncryptionConfigurationInput(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 = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson10_serializeOpUpdateFirewallPolicy struct { } @@ -1771,6 +1826,23 @@ func awsAwsjson10_serializeDocumentDimensions(v []types.Dimension, value smithyj return nil } +func awsAwsjson10_serializeDocumentEncryptionConfiguration(v *types.EncryptionConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KeyId != nil { + ok := object.Key("KeyId") + ok.String(*v.KeyId) + } + + if len(v.Type) > 0 { + ok := object.Key("Type") + ok.String(string(v.Type)) + } + + return nil +} + func awsAwsjson10_serializeDocumentFirewallPolicy(v *types.FirewallPolicy, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -2700,6 +2772,13 @@ func awsAwsjson10_serializeOpDocumentCreateFirewallInput(v *CreateFirewallInput, ok.String(*v.Description) } + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + if v.FirewallName != nil { ok := object.Key("FirewallName") ok.String(*v.FirewallName) @@ -2756,6 +2835,13 @@ func awsAwsjson10_serializeOpDocumentCreateFirewallPolicyInput(v *CreateFirewall ok.Boolean(v.DryRun) } + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + if v.FirewallPolicy != nil { ok := object.Key("FirewallPolicy") if err := awsAwsjson10_serializeDocumentFirewallPolicy(v.FirewallPolicy, ok); err != nil { @@ -2797,6 +2883,13 @@ func awsAwsjson10_serializeOpDocumentCreateRuleGroupInput(v *CreateRuleGroupInpu ok.Boolean(v.DryRun) } + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + if v.RuleGroup != nil { ok := object.Key("RuleGroup") if err := awsAwsjson10_serializeDocumentRuleGroup(v.RuleGroup, ok); err != nil { @@ -3227,6 +3320,35 @@ func awsAwsjson10_serializeOpDocumentUpdateFirewallDescriptionInput(v *UpdateFir return nil } +func awsAwsjson10_serializeOpDocumentUpdateFirewallEncryptionConfigurationInput(v *UpdateFirewallEncryptionConfigurationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + + if v.FirewallArn != nil { + ok := object.Key("FirewallArn") + ok.String(*v.FirewallArn) + } + + if v.FirewallName != nil { + ok := object.Key("FirewallName") + ok.String(*v.FirewallName) + } + + if v.UpdateToken != nil { + ok := object.Key("UpdateToken") + ok.String(*v.UpdateToken) + } + + return nil +} + func awsAwsjson10_serializeOpDocumentUpdateFirewallPolicyChangeProtectionInput(v *UpdateFirewallPolicyChangeProtectionInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -3268,6 +3390,13 @@ func awsAwsjson10_serializeOpDocumentUpdateFirewallPolicyInput(v *UpdateFirewall ok.Boolean(v.DryRun) } + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + if v.FirewallPolicy != nil { ok := object.Key("FirewallPolicy") if err := awsAwsjson10_serializeDocumentFirewallPolicy(v.FirewallPolicy, ok); err != nil { @@ -3331,6 +3460,13 @@ func awsAwsjson10_serializeOpDocumentUpdateRuleGroupInput(v *UpdateRuleGroupInpu ok.Boolean(v.DryRun) } + if v.EncryptionConfiguration != nil { + ok := object.Key("EncryptionConfiguration") + if err := awsAwsjson10_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, ok); err != nil { + return err + } + } + if v.RuleGroup != nil { ok := object.Key("RuleGroup") if err := awsAwsjson10_serializeDocumentRuleGroup(v.RuleGroup, ok); err != nil { diff --git a/service/networkfirewall/types/enums.go b/service/networkfirewall/types/enums.go index 0699ea6ad85..1438fa34494 100644 --- a/service/networkfirewall/types/enums.go +++ b/service/networkfirewall/types/enums.go @@ -42,6 +42,24 @@ func (ConfigurationSyncState) Values() []ConfigurationSyncState { } } +type EncryptionType string + +// Enum values for EncryptionType +const ( + EncryptionTypeCustomerKms EncryptionType = "CUSTOMER_KMS" + EncryptionTypeAwsOwnedKmsKey EncryptionType = "AWS_OWNED_KMS_KEY" +) + +// Values returns all known values for EncryptionType. 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 (EncryptionType) Values() []EncryptionType { + return []EncryptionType{ + "CUSTOMER_KMS", + "AWS_OWNED_KMS_KEY", + } +} + type FirewallStatusValue string // Enum values for FirewallStatusValue diff --git a/service/networkfirewall/types/errors.go b/service/networkfirewall/types/errors.go index 4156635b443..e60f73b6ad0 100644 --- a/service/networkfirewall/types/errors.go +++ b/service/networkfirewall/types/errors.go @@ -7,8 +7,8 @@ import ( smithy "github.com/aws/smithy-go" ) -// AWS doesn't currently have enough available capacity to fulfill your request. -// Try your request later. +// Amazon Web Services doesn't currently have enough available capacity to fulfill +// your request. Try your request later. type InsufficientCapacityException struct { Message *string diff --git a/service/networkfirewall/types/types.go b/service/networkfirewall/types/types.go index a36903a1397..8e6abeb81dc 100644 --- a/service/networkfirewall/types/types.go +++ b/service/networkfirewall/types/types.go @@ -47,7 +47,7 @@ type Address struct { } // The configuration and status for a single subnet that you've specified for use -// by the AWS Network Firewall firewall. This is part of the FirewallStatus. +// by the Network Firewall firewall. This is part of the FirewallStatus. type Attachment struct { // The identifier of the firewall endpoint that Network Firewall has instantiated @@ -105,10 +105,10 @@ type CustomAction struct { // The value to use in an Amazon CloudWatch custom metric dimension. This is used // in the PublishMetricsCustomAction. A CloudWatch custom metric dimension is a -// name/value pair that's part of the identity of a metric. AWS Network Firewall -// sets the dimension name to CustomAction and you provide the dimension value. For -// more information about CloudWatch custom metric dimensions, see Publishing -// Custom Metrics +// name/value pair that's part of the identity of a metric. Network Firewall sets +// the dimension name to CustomAction and you provide the dimension value. For more +// information about CloudWatch custom metric dimensions, see Publishing Custom +// Metrics // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#usingDimensions) // in the Amazon CloudWatch User Guide // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html). @@ -122,12 +122,38 @@ type Dimension struct { noSmithyDocumentSerde } -// The firewall defines the configuration settings for an AWS Network Firewall +// A complex type that contains optional Amazon Web Services Key Management Service +// (KMS) encryption settings for your Network Firewall resources. Your data is +// encrypted by default with an Amazon Web Services owned key that Amazon Web +// Services owns and manages for you. You can use either the Amazon Web Services +// owned key, or provide your own customer managed key. To learn more about KMS +// encryption of your Network Firewall resources, see Encryption at rest with +// Amazon Web Services Key Managment Service +// (https://docs.aws.amazon.com/kms/latest/developerguide/kms-encryption-at-rest.html) +// in the Network Firewall Developer Guide. +type EncryptionConfiguration struct { + + // The ID of the Amazon Web Services Key Management Service (KMS) customer managed + // key. You can use any of the key identifiers that KMS supports, unless you're + // using a key that's managed by another account. If you're using a key managed by + // another account, then specify the key ARN. For more information, see Key ID + // (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id) in + // the Amazon Web Services KMS Developer Guide. + KeyId *string + + // The type of Amazon Web Services KMS key to use for encryption of your Network + // Firewall resources. + Type EncryptionType + + noSmithyDocumentSerde +} + +// The firewall defines the configuration settings for an Network Firewall // firewall. These settings include the firewall policy, the subnets in your VPC to // use for the firewall endpoints, and any tags that are attached to the firewall -// AWS resource. The status of the firewall, for example whether it's ready to -// filter network traffic, is provided in the corresponding FirewallStatus. You can -// retrieve both objects by calling DescribeFirewall. +// Amazon Web Services resource. The status of the firewall, for example whether +// it's ready to filter network traffic, is provided in the corresponding +// FirewallStatus. You can retrieve both objects by calling DescribeFirewall. type Firewall struct { // The unique identifier for the firewall. @@ -163,6 +189,10 @@ type Firewall struct { // A description of the firewall. Description *string + // A complex type that contains the Amazon Web Services KMS encryption + // configuration settings for your firewall. + EncryptionConfiguration *EncryptionConfiguration + // The Amazon Resource Name (ARN) of the firewall. FirewallArn *string @@ -251,8 +281,8 @@ type FirewallPolicy struct { // // For more // information, see Strict evaluation order - // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-strict-rule-evaluation-order.html) - // in the AWS Network Firewall Developer Guide. + // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html#suricata-strict-rule-evaluation-order.html) + // in the Network Firewall Developer Guide. StatefulDefaultActions []string // Additional options governing how Network Firewall handles stateful rules. The @@ -324,6 +354,10 @@ type FirewallPolicyResponse struct { // A description of the firewall policy. Description *string + // A complex type that contains the Amazon Web Services KMS encryption + // configuration settings for your firewall policy. + EncryptionConfiguration *EncryptionConfiguration + // The current status of the firewall policy. You can retrieve this for a firewall // policy by calling DescribeFirewallPolicy and providing the firewall policy's // name or ARN. @@ -374,9 +408,9 @@ type FirewallStatus struct { noSmithyDocumentSerde } -// The basic rule criteria for AWS Network Firewall to use to inspect packet -// headers in stateful traffic flow inspection. Traffic flows that match the -// criteria are a match for the corresponding StatefulRule. +// The basic rule criteria for Network Firewall to use to inspect packet headers in +// stateful traffic flow inspection. Traffic flows that match the criteria are a +// match for the corresponding StatefulRule. type Header struct { // The destination IP address or address range to inspect for, in CIDR notation. To @@ -414,7 +448,7 @@ type Header struct { Direction StatefulRuleDirection // The protocol to inspect for. To specify all, you can use IP, because all traffic - // on AWS and on the internet is IP. + // on Amazon Web Services and on the internet is IP. // // This member is required. Protocol StatefulRuleProtocol @@ -460,7 +494,7 @@ type IPSet struct { noSmithyDocumentSerde } -// Defines where AWS Network Firewall sends logs for the firewall for one log type. +// Defines where Network Firewall sends logs for the firewall for one log type. // This is used in LoggingConfiguration. You can send each type of log to an Amazon // S3 bucket, a CloudWatch log group, or a Kinesis Data Firehose delivery stream. // Network Firewall generates logs for stateful rule groups. You can save alert and @@ -508,7 +542,7 @@ type LogDestinationConfig struct { noSmithyDocumentSerde } -// Defines how AWS Network Firewall performs logging for a Firewall. +// Defines how Network Firewall performs logging for a Firewall. type LoggingConfiguration struct { // Defines the logging destinations for the logs for a firewall. Network Firewall @@ -617,10 +651,9 @@ type PublishMetricAction struct { noSmithyDocumentSerde } -// The inspection criteria and action for a single stateless rule. AWS Network -// Firewall inspects each packet for the specified matching criteria. When a packet -// matches the criteria, Network Firewall performs the rule's actions on the -// packet. +// The inspection criteria and action for a single stateless rule. Network Firewall +// inspects each packet for the specified matching criteria. When a packet matches +// the criteria, Network Firewall performs the rule's actions on the packet. type RuleDefinition struct { // The actions to take on a packet that matches one of the stateless rule @@ -666,13 +699,13 @@ type RuleDefinition struct { // The object that defines the rules in a rule group. This, along with // RuleGroupResponse, define the rule group. You can retrieve all objects for a -// rule group by calling DescribeRuleGroup. AWS Network Firewall uses a rule group -// to inspect and control network traffic. You define stateless rule groups to -// inspect individual packets and you define stateful rule groups to inspect -// packets in the context of their traffic flow. To use a rule group, you include -// it by reference in an Network Firewall firewall policy, then you use the policy -// in a firewall. You can reference a rule group from more than one firewall -// policy, and you can use a firewall policy in more than one firewall. +// rule group by calling DescribeRuleGroup. Network Firewall uses a rule group to +// inspect and control network traffic. You define stateless rule groups to inspect +// individual packets and you define stateful rule groups to inspect packets in the +// context of their traffic flow. To use a rule group, you include it by reference +// in an Network Firewall firewall policy, then you use the policy in a firewall. +// You can reference a rule group from more than one firewall policy, and you can +// use a firewall policy in more than one firewall. type RuleGroup struct { // The stateful rules or stateless rules for the rule group. @@ -744,6 +777,10 @@ type RuleGroupResponse struct { // A description of the rule group. Description *string + // A complex type that contains the Amazon Web Services KMS encryption + // configuration settings for your rule group. + EncryptionConfiguration *EncryptionConfiguration + // The number of firewall policies that use this rule group. NumberOfAssociations *int32 @@ -812,7 +849,7 @@ type RulesSource struct { // traffic from IP addresses outside of the deployment VPC, you set the HOME_NET // rule variable to include the CIDR range of the deployment VPC plus the other // CIDR ranges. For more information, see RuleVariables in this guide and Stateful -// domain list rule groups in AWS Network Firewall +// domain list rule groups in Network Firewall // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/stateful-rule-groups-domain-names.html) // in the Network Firewall Developer Guide. type RulesSourceList struct { @@ -867,7 +904,7 @@ type StatefulEngineOptions struct { // rule engine as Suricata compatible strings, and Suricata evaluates them based on // certain settings. For more information, see Evaluation order for stateful rules // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html) - // in the AWS Network Firewall Developer Guide. + // in the Network Firewall Developer Guide. RuleOrder RuleOrder noSmithyDocumentSerde @@ -962,7 +999,7 @@ type StatefulRuleOptions struct { // rule engine as Suricata compatible strings, and Suricata evaluates them based on // certain settings. For more information, see Evaluation order for stateful rules // (https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html) - // in the AWS Network Firewall Developer Guide. + // in the Network Firewall Developer Guide. RuleOrder RuleOrder noSmithyDocumentSerde @@ -1034,9 +1071,9 @@ type StatelessRulesAndCustomActions struct { } // The ID for a subnet that you want to associate with the firewall. This is used -// with CreateFirewall and AssociateSubnets. AWS Network Firewall creates an -// instance of the associated firewall in each subnet that you specify, to filter -// traffic in the subnet's Availability Zone. +// with CreateFirewall and AssociateSubnets. Network Firewall creates an instance +// of the associated firewall in each subnet that you specify, to filter traffic in +// the subnet's Availability Zone. type SubnetMapping struct { // The unique identifier for the subnet. @@ -1048,7 +1085,7 @@ type SubnetMapping struct { } // The status of the firewall endpoint and firewall policy configuration for a -// single VPC subnet. For each VPC subnet that you associate with a firewall, AWS +// single VPC subnet. For each VPC subnet that you associate with a firewall, // Network Firewall does the following: // // * Instantiates a firewall endpoint in the @@ -1079,11 +1116,11 @@ type SyncState struct { noSmithyDocumentSerde } -// A key:value pair associated with an AWS resource. The key:value pair can be -// anything you define. Typically, the tag key represents a category (such as -// "environment") and the tag value represents a specific value within that -// category (such as "test," "development," or "production"). You can add up to 50 -// tags to each AWS resource. +// A key:value pair associated with an Amazon Web Services resource. The key:value +// pair can be anything you define. Typically, the tag key represents a category +// (such as "environment") and the tag value represents a specific value within +// that category (such as "test," "development," or "production"). You can add up +// to 50 tags to each Amazon Web Services resource. type Tag struct { // The part of the key:value pair that defines a tag. You can use a tag key to diff --git a/service/pricing/api_op_DescribeServices.go b/service/pricing/api_op_DescribeServices.go index 450bdd4b58c..3a193f68750 100644 --- a/service/pricing/api_op_DescribeServices.go +++ b/service/pricing/api_op_DescribeServices.go @@ -58,7 +58,7 @@ type DescribeServicesOutput struct { // The format version of the response. For example, aws_v1. FormatVersion *string - // The pagination token for the next set of retreivable results. + // The pagination token for the next set of retrievable results. NextToken *string // The service metadata for the service or services in the response. diff --git a/service/pricing/api_op_GetAttributeValues.go b/service/pricing/api_op_GetAttributeValues.go index 236407c0c89..6bf5096d7d0 100644 --- a/service/pricing/api_op_GetAttributeValues.go +++ b/service/pricing/api_op_GetAttributeValues.go @@ -12,7 +12,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Returns a list of attribute values. Attibutes are similar to the details in a +// Returns a list of attribute values. Attributes are similar to the details in a // Price List API offer file. For a list of available attributes, see Offer File // Definitions // (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/reading-an-offer.html#pps-defs) diff --git a/service/pricing/doc.go b/service/pricing/doc.go index 7acbae0c7d9..cc97f6a0cc2 100644 --- a/service/pricing/doc.go +++ b/service/pricing/doc.go @@ -13,7 +13,7 @@ // spend for budgeting purposes, and provide cost benefit analysis that compare // your internal workloads with Amazon Web Services. Use GetServices without a // service code to retrieve the service codes for all AWS services, then -// GetServices with a service code to retreive the attribute names for that +// GetServices with a service code to retrieve the attribute names for that // service. After you have the service code and attribute names, you can use // GetAttributeValues to see what values are available for an attribute. With the // service code and an attribute name and value, you can use GetProducts to find diff --git a/service/sagemaker/api_op_CreateInferenceRecommendationsJob.go b/service/sagemaker/api_op_CreateInferenceRecommendationsJob.go index de54eb2cb8c..588e15c792a 100644 --- a/service/sagemaker/api_op_CreateInferenceRecommendationsJob.go +++ b/service/sagemaker/api_op_CreateInferenceRecommendationsJob.go @@ -59,6 +59,10 @@ type CreateInferenceRecommendationsJobInput struct { // Description of the recommendation job. JobDescription *string + // Provides information about the output artifacts and the KMS key to use for + // Amazon S3 server-side encryption. + OutputConfig *types.RecommendationJobOutputConfig + // A set of conditions for stopping a recommendation job. If any of the conditions // are met, the job is automatically stopped. StoppingConditions *types.RecommendationJobStoppingConditions diff --git a/service/sagemaker/deserializers.go b/service/sagemaker/deserializers.go index 3d9b89283a4..98e71abe414 100644 --- a/service/sagemaker/deserializers.go +++ b/service/sagemaker/deserializers.go @@ -51234,6 +51234,15 @@ func awsAwsjson11_deserializeDocumentRecommendationJobInputConfig(v **types.Reco return err } + case "VolumeKmsKeyId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) + } + sv.VolumeKmsKeyId = ptr.String(jtv) + } + default: _, _ = key, value diff --git a/service/sagemaker/serializers.go b/service/sagemaker/serializers.go index 72aedd0b543..a228204f088 100644 --- a/service/sagemaker/serializers.go +++ b/service/sagemaker/serializers.go @@ -19354,6 +19354,18 @@ func awsAwsjson11_serializeDocumentRealtimeInferenceInstanceTypes(v []types.Prod return nil } +func awsAwsjson11_serializeDocumentRecommendationJobCompiledOutputConfig(v *types.RecommendationJobCompiledOutputConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.S3OutputUri != nil { + ok := object.Key("S3OutputUri") + ok.String(*v.S3OutputUri) + } + + return nil +} + func awsAwsjson11_serializeDocumentRecommendationJobInputConfig(v *types.RecommendationJobInputConfig, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -19389,6 +19401,30 @@ func awsAwsjson11_serializeDocumentRecommendationJobInputConfig(v *types.Recomme } } + if v.VolumeKmsKeyId != nil { + ok := object.Key("VolumeKmsKeyId") + ok.String(*v.VolumeKmsKeyId) + } + + return nil +} + +func awsAwsjson11_serializeDocumentRecommendationJobOutputConfig(v *types.RecommendationJobOutputConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CompiledOutputConfig != nil { + ok := object.Key("CompiledOutputConfig") + if err := awsAwsjson11_serializeDocumentRecommendationJobCompiledOutputConfig(v.CompiledOutputConfig, ok); err != nil { + return err + } + } + + if v.KmsKeyId != nil { + ok := object.Key("KmsKeyId") + ok.String(*v.KmsKeyId) + } + return nil } @@ -21839,6 +21875,13 @@ func awsAwsjson11_serializeOpDocumentCreateInferenceRecommendationsJobInput(v *C ok.String(string(v.JobType)) } + if v.OutputConfig != nil { + ok := object.Key("OutputConfig") + if err := awsAwsjson11_serializeDocumentRecommendationJobOutputConfig(v.OutputConfig, ok); err != nil { + return err + } + } + if v.RoleArn != nil { ok := object.Key("RoleArn") ok.String(*v.RoleArn) diff --git a/service/sagemaker/types/types.go b/service/sagemaker/types/types.go index 1fef70108b5..b358785577d 100644 --- a/service/sagemaker/types/types.go +++ b/service/sagemaker/types/types.go @@ -10468,6 +10468,16 @@ type QueryFilters struct { noSmithyDocumentSerde } +// Provides information about the output configuration for the compiled model. +type RecommendationJobCompiledOutputConfig struct { + + // Identifies the Amazon S3 bucket where you want SageMaker to store the compiled + // model artifacts. + S3OutputUri *string + + noSmithyDocumentSerde +} + // The input configuration of the recommendation job. type RecommendationJobInputConfig struct { @@ -10488,6 +10498,67 @@ type RecommendationJobInputConfig struct { // Specifies the traffic pattern of the job. TrafficPattern *TrafficPattern + // The Amazon Resource Name (ARN) of a Amazon Web Services Key Management Service + // (Amazon Web Services KMS) key that Amazon SageMaker uses to encrypt data on the + // storage volume attached to the ML compute instance that hosts the endpoint. This + // key will be passed to SageMaker Hosting for endpoint creation. The SageMaker + // execution role must have kms:CreateGrant permission in order to encrypt data on + // the storage volume of the endpoints created for inference recommendation. The + // inference recommendation job will fail asynchronously during endpoint + // configuration creation if the role passed does not have kms:CreateGrant + // permission. The KmsKeyId can be any of the following formats: + // + // * // KMS Key ID + // "1234abcd-12ab-34cd-56ef-1234567890ab" + // + // * // Amazon Resource Name (ARN) of a KMS + // Key "arn:aws:kms:::key/" + // + // * // KMS Key Alias "alias/ExampleAlias" + // + // * // Amazon + // Resource Name (ARN) of a KMS Key Alias "arn:aws:kms:::alias/" + // + // For more + // information about key identifiers, see Key identifiers (KeyID) + // (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id) + // in the Amazon Web Services Key Management Service (Amazon Web Services KMS) + // documentation. + VolumeKmsKeyId *string + + noSmithyDocumentSerde +} + +// Provides information about the output configuration for the compiled model. +type RecommendationJobOutputConfig struct { + + // Provides information about the output configuration for the compiled model. + CompiledOutputConfig *RecommendationJobCompiledOutputConfig + + // The Amazon Resource Name (ARN) of a Amazon Web Services Key Management Service + // (Amazon Web Services KMS) key that Amazon SageMaker uses to encrypt your output + // artifacts with Amazon S3 server-side encryption. The SageMaker execution role + // must have kms:GenerateDataKey permission. The KmsKeyId can be any of the + // following formats: + // + // * // KMS Key ID "1234abcd-12ab-34cd-56ef-1234567890ab" + // + // * // + // Amazon Resource Name (ARN) of a KMS Key "arn:aws:kms:::key/" + // + // * // KMS Key Alias + // "alias/ExampleAlias" + // + // * // Amazon Resource Name (ARN) of a KMS Key Alias + // "arn:aws:kms:::alias/" + // + // For more information about key identifiers, see Key + // identifiers (KeyID) + // (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id) + // in the Amazon Web Services Key Management Service (Amazon Web Services KMS) + // documentation. + KmsKeyId *string + noSmithyDocumentSerde }