From a7f463ee903116ef77847dcfb697aab1f546d745 Mon Sep 17 00:00:00 2001 From: AWS SDK for Go v2 automation user Date: Mon, 12 Dec 2022 19:15:08 +0000 Subject: [PATCH] Regenerated Clients --- .../0b0da57152fb483385cd8c27f13c9903.json | 8 + .../41575353444b40ffbf474f4155544f00.json | 8 + .../80733a8a83314ee8b1525d8e797081ba.json | 8 + .../863b489c2ed4428e8e0ba3f7c39c9472.json | 8 + .../8f44e34a8ccc4ac391498806094e85b2.json | 8 + .../b194bfc128d643c9ba494dbb85fb8f10.json | 8 + .../ce1f5fea7aab4b1484fd9bd22bfd6396.json | 8 + .../cfb4661a80b3445e855cb7df773e55b6.json | 8 + .../efd0b063c99846c5b7651b84ccba0dd5.json | 8 + .../fa61e0fe74604964883c523ade6ebaf2.json | 8 + .../appstream/internal/endpoints/endpoints.go | 3 + .../customerprofiles/api_op_CreateProfile.go | 6 + .../customerprofiles/api_op_UpdateProfile.go | 6 + service/customerprofiles/serializers.go | 20 + service/ec2/api_op_CopyImage.go | 28 +- service/ec2/deserializers.go | 86 ++ service/ec2/types/enums.go | 2 + service/ec2/types/types.go | 26 +- .../api_op_DescribeEdgeConfiguration.go | 144 +++ .../api_op_StartEdgeConfigurationUpdate.go | 165 +++ service/kinesisvideo/deserializers.go | 948 +++++++++++++++++- service/kinesisvideo/generated.json | 2 + service/kinesisvideo/serializers.go | 296 ++++++ service/kinesisvideo/types/enums.go | 62 ++ service/kinesisvideo/types/errors.go | 24 + service/kinesisvideo/types/types.go | 156 ++- service/kinesisvideo/validators.go | 149 +++ .../api_op_StartModelPackagingJob.go | 17 +- service/m2/internal/endpoints/endpoints.go | 27 + .../api_op_CreateRoute.go | 16 +- .../api_op_CreateService.go | 5 +- .../migrationhubrefactorspaces/types/types.go | 2 +- service/mq/internal/endpoints/endpoints.go | 3 + service/rds/api_op_CopyDBSnapshot.go | 8 +- service/rds/deserializers.go | 59 ++ service/rds/serializers.go | 5 + service/rds/types/types.go | 15 +- service/rekognition/api_op_DetectLabels.go | 79 +- service/rekognition/api_op_GetFaceSearch.go | 4 +- .../rekognition/api_op_GetLabelDetection.go | 64 +- .../rekognition/api_op_GetPersonTracking.go | 4 +- .../rekognition/api_op_StartLabelDetection.go | 23 +- service/rekognition/deserializers.go | 39 + service/rekognition/serializers.go | 44 + service/rekognition/types/enums.go | 34 + service/rekognition/types/types.go | 26 +- service/sagemakermetrics/LICENSE.txt | 202 ++++ service/sagemakermetrics/api_client.go | 434 ++++++++ service/sagemakermetrics/api_client_test.go | 123 +++ .../api_op_BatchPutMetrics.go | 127 +++ service/sagemakermetrics/deserializers.go | 248 +++++ service/sagemakermetrics/doc.go | 12 + service/sagemakermetrics/endpoints.go | 200 ++++ service/sagemakermetrics/generated.json | 27 + service/sagemakermetrics/go.mod | 16 + service/sagemakermetrics/go.sum | 11 + .../sagemakermetrics/go_module_metadata.go | 6 + .../internal/endpoints/endpoints.go | 341 +++++++ .../internal/endpoints/endpoints_test.go | 11 + service/sagemakermetrics/protocol_test.go | 3 + service/sagemakermetrics/serializers.go | 145 +++ service/sagemakermetrics/types/enums.go | 25 + service/sagemakermetrics/types/types.go | 58 ++ service/sagemakermetrics/validators.go | 92 ++ service/wafv2/api_op_CreateWebACL.go | 3 +- .../wafv2/api_op_PutLoggingConfiguration.go | 8 +- service/wafv2/api_op_UpdateWebACL.go | 3 +- service/wafv2/types/types.go | 8 +- 68 files changed, 4625 insertions(+), 155 deletions(-) create mode 100644 .changelog/0b0da57152fb483385cd8c27f13c9903.json create mode 100644 .changelog/41575353444b40ffbf474f4155544f00.json create mode 100644 .changelog/80733a8a83314ee8b1525d8e797081ba.json create mode 100644 .changelog/863b489c2ed4428e8e0ba3f7c39c9472.json create mode 100644 .changelog/8f44e34a8ccc4ac391498806094e85b2.json create mode 100644 .changelog/b194bfc128d643c9ba494dbb85fb8f10.json create mode 100644 .changelog/ce1f5fea7aab4b1484fd9bd22bfd6396.json create mode 100644 .changelog/cfb4661a80b3445e855cb7df773e55b6.json create mode 100644 .changelog/efd0b063c99846c5b7651b84ccba0dd5.json create mode 100644 .changelog/fa61e0fe74604964883c523ade6ebaf2.json create mode 100644 service/kinesisvideo/api_op_DescribeEdgeConfiguration.go create mode 100644 service/kinesisvideo/api_op_StartEdgeConfigurationUpdate.go create mode 100644 service/sagemakermetrics/LICENSE.txt create mode 100644 service/sagemakermetrics/api_client.go create mode 100644 service/sagemakermetrics/api_client_test.go create mode 100644 service/sagemakermetrics/api_op_BatchPutMetrics.go create mode 100644 service/sagemakermetrics/deserializers.go create mode 100644 service/sagemakermetrics/doc.go create mode 100644 service/sagemakermetrics/endpoints.go create mode 100644 service/sagemakermetrics/generated.json create mode 100644 service/sagemakermetrics/go.mod create mode 100644 service/sagemakermetrics/go.sum create mode 100644 service/sagemakermetrics/go_module_metadata.go create mode 100644 service/sagemakermetrics/internal/endpoints/endpoints.go create mode 100644 service/sagemakermetrics/internal/endpoints/endpoints_test.go create mode 100644 service/sagemakermetrics/protocol_test.go create mode 100644 service/sagemakermetrics/serializers.go create mode 100644 service/sagemakermetrics/types/enums.go create mode 100644 service/sagemakermetrics/types/types.go create mode 100644 service/sagemakermetrics/validators.go diff --git a/.changelog/0b0da57152fb483385cd8c27f13c9903.json b/.changelog/0b0da57152fb483385cd8c27f13c9903.json new file mode 100644 index 00000000000..e92ee9a16eb --- /dev/null +++ b/.changelog/0b0da57152fb483385cd8c27f13c9903.json @@ -0,0 +1,8 @@ +{ + "id": "0b0da571-52fb-4833-85cd-8c27f13c9903", + "type": "feature", + "description": "This release introduces support SageMaker Metrics APIs.", + "modules": [ + "service/sagemakermetrics" + ] +} \ No newline at end of file diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..a15b9e663d5 --- /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/sagemakermetrics" + ] +} \ No newline at end of file diff --git a/.changelog/80733a8a83314ee8b1525d8e797081ba.json b/.changelog/80733a8a83314ee8b1525d8e797081ba.json new file mode 100644 index 00000000000..f9372d1627f --- /dev/null +++ b/.changelog/80733a8a83314ee8b1525d8e797081ba.json @@ -0,0 +1,8 @@ +{ + "id": "80733a8a-8331-4ee8-b152-5d8e797081ba", + "type": "feature", + "description": "This release adds support for public preview of Kinesis Video Stream at Edge enabling customers to provide configuration for the Kinesis Video Stream EdgeAgent running on an on-premise IoT device. Customers can now locally record from cameras and stream videos to the cloud on configured schedule.", + "modules": [ + "service/kinesisvideo" + ] +} \ No newline at end of file diff --git a/.changelog/863b489c2ed4428e8e0ba3f7c39c9472.json b/.changelog/863b489c2ed4428e8e0ba3f7c39c9472.json new file mode 100644 index 00000000000..33558f96eb4 --- /dev/null +++ b/.changelog/863b489c2ed4428e8e0ba3f7c39c9472.json @@ -0,0 +1,8 @@ +{ + "id": "863b489c-2ed4-428e-8e0b-a3f7c39c9472", + "type": "feature", + "description": "Adds support for \"aliases\" and \"categories\", inclusion and exclusion filters for labels and label categories, and aggregating labels by video segment timestamps for Stored Video Label Detection APIs.", + "modules": [ + "service/rekognition" + ] +} \ No newline at end of file diff --git a/.changelog/8f44e34a8ccc4ac391498806094e85b2.json b/.changelog/8f44e34a8ccc4ac391498806094e85b2.json new file mode 100644 index 00000000000..ac1a030167b --- /dev/null +++ b/.changelog/8f44e34a8ccc4ac391498806094e85b2.json @@ -0,0 +1,8 @@ +{ + "id": "8f44e34a-8ccc-4ac3-9149-8806094e85b2", + "type": "feature", + "description": "This release updates DescribeFpgaImages to show supported instance types of AFIs in its response.", + "modules": [ + "service/ec2" + ] +} \ No newline at end of file diff --git a/.changelog/b194bfc128d643c9ba494dbb85fb8f10.json b/.changelog/b194bfc128d643c9ba494dbb85fb8f10.json new file mode 100644 index 00000000000..ae57fa4de8b --- /dev/null +++ b/.changelog/b194bfc128d643c9ba494dbb85fb8f10.json @@ -0,0 +1,8 @@ +{ + "id": "b194bfc1-28d6-43c9-ba49-4dbb85fb8f10", + "type": "feature", + "description": "This release adds support for Lambda alias service endpoints. Lambda alias ARNs can now be passed into CreateService.", + "modules": [ + "service/migrationhubrefactorspaces" + ] +} \ No newline at end of file diff --git a/.changelog/ce1f5fea7aab4b1484fd9bd22bfd6396.json b/.changelog/ce1f5fea7aab4b1484fd9bd22bfd6396.json new file mode 100644 index 00000000000..7e76af8360e --- /dev/null +++ b/.changelog/ce1f5fea7aab4b1484fd9bd22bfd6396.json @@ -0,0 +1,8 @@ +{ + "id": "ce1f5fea-7aab-4b14-84fd-9bd22bfd6396", + "type": "documentation", + "description": "This documentation update adds kms:GenerateDataKey as a required permission to StartModelPackagingJob.", + "modules": [ + "service/lookoutvision" + ] +} \ No newline at end of file diff --git a/.changelog/cfb4661a80b3445e855cb7df773e55b6.json b/.changelog/cfb4661a80b3445e855cb7df773e55b6.json new file mode 100644 index 00000000000..1a043e83746 --- /dev/null +++ b/.changelog/cfb4661a80b3445e855cb7df773e55b6.json @@ -0,0 +1,8 @@ +{ + "id": "cfb4661a-80b3-445e-855c-b7df773e55b6", + "type": "feature", + "description": "Update the RDS API model to support copying option groups during the CopyDBSnapshot operation", + "modules": [ + "service/rds" + ] +} \ No newline at end of file diff --git a/.changelog/efd0b063c99846c5b7651b84ccba0dd5.json b/.changelog/efd0b063c99846c5b7651b84ccba0dd5.json new file mode 100644 index 00000000000..9187c886923 --- /dev/null +++ b/.changelog/efd0b063c99846c5b7651b84ccba0dd5.json @@ -0,0 +1,8 @@ +{ + "id": "efd0b063-c998-46c5-b765-1b84ccba0dd5", + "type": "documentation", + "description": "Documents the naming requirement for logging destinations that you use with web ACLs.", + "modules": [ + "service/wafv2" + ] +} \ No newline at end of file diff --git a/.changelog/fa61e0fe74604964883c523ade6ebaf2.json b/.changelog/fa61e0fe74604964883c523ade6ebaf2.json new file mode 100644 index 00000000000..6e83607af7b --- /dev/null +++ b/.changelog/fa61e0fe74604964883c523ade6ebaf2.json @@ -0,0 +1,8 @@ +{ + "id": "fa61e0fe-7460-4964-883c-523ade6ebaf2", + "type": "feature", + "description": "This release allows custom strings in PartyType and Gender through 2 new attributes in the CreateProfile and UpdateProfile APIs: PartyTypeString and GenderString.", + "modules": [ + "service/customerprofiles" + ] +} \ No newline at end of file diff --git a/service/appstream/internal/endpoints/endpoints.go b/service/appstream/internal/endpoints/endpoints.go index 58d59e2509a..5e6c15c603c 100644 --- a/service/appstream/internal/endpoints/endpoints.go +++ b/service/appstream/internal/endpoints/endpoints.go @@ -183,6 +183,9 @@ var defaultPartitions = endpoints.Partitions{ }, Deprecated: aws.TrueTernary, }, + endpoints.EndpointKey{ + Region: "sa-east-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "us-east-1", }: endpoints.Endpoint{}, diff --git a/service/customerprofiles/api_op_CreateProfile.go b/service/customerprofiles/api_op_CreateProfile.go index 993ead1b6a5..3d4748423e2 100644 --- a/service/customerprofiles/api_op_CreateProfile.go +++ b/service/customerprofiles/api_op_CreateProfile.go @@ -73,6 +73,9 @@ type CreateProfileInput struct { // The gender with which the customer identifies. Gender types.Gender + // An alternative to Gender which accepts any string as input. + GenderString *string + // The customer’s home phone number. HomePhoneNumber *string @@ -91,6 +94,9 @@ type CreateProfileInput struct { // The type of profile used to describe the customer. PartyType types.PartyType + // An alternative to PartyType which accepts any string as input. + PartyTypeString *string + // The customer’s personal email address. PersonalEmailAddress *string diff --git a/service/customerprofiles/api_op_UpdateProfile.go b/service/customerprofiles/api_op_UpdateProfile.go index 5d7b3c338af..505ffcdb0de 100644 --- a/service/customerprofiles/api_op_UpdateProfile.go +++ b/service/customerprofiles/api_op_UpdateProfile.go @@ -80,6 +80,9 @@ type UpdateProfileInput struct { // The gender with which the customer identifies. Gender types.Gender + // An alternative to Gender which accepts any string as input. + GenderString *string + // The customer’s home phone number. HomePhoneNumber *string @@ -98,6 +101,9 @@ type UpdateProfileInput struct { // The type of profile used to describe the customer. PartyType types.PartyType + // An alternative to PartyType which accepts any string as input. + PartyTypeString *string + // The customer’s personal email address. PersonalEmailAddress *string diff --git a/service/customerprofiles/serializers.go b/service/customerprofiles/serializers.go index 094c66c4a85..1e12aadd721 100644 --- a/service/customerprofiles/serializers.go +++ b/service/customerprofiles/serializers.go @@ -458,6 +458,11 @@ func awsRestjson1_serializeOpDocumentCreateProfileInput(v *CreateProfileInput, v ok.String(string(v.Gender)) } + if v.GenderString != nil { + ok := object.Key("GenderString") + ok.String(*v.GenderString) + } + if v.HomePhoneNumber != nil { ok := object.Key("HomePhoneNumber") ok.String(*v.HomePhoneNumber) @@ -490,6 +495,11 @@ func awsRestjson1_serializeOpDocumentCreateProfileInput(v *CreateProfileInput, v ok.String(string(v.PartyType)) } + if v.PartyTypeString != nil { + ok := object.Key("PartyTypeString") + ok.String(*v.PartyTypeString) + } + if v.PersonalEmailAddress != nil { ok := object.Key("PersonalEmailAddress") ok.String(*v.PersonalEmailAddress) @@ -3281,6 +3291,11 @@ func awsRestjson1_serializeOpDocumentUpdateProfileInput(v *UpdateProfileInput, v ok.String(string(v.Gender)) } + if v.GenderString != nil { + ok := object.Key("GenderString") + ok.String(*v.GenderString) + } + if v.HomePhoneNumber != nil { ok := object.Key("HomePhoneNumber") ok.String(*v.HomePhoneNumber) @@ -3313,6 +3328,11 @@ func awsRestjson1_serializeOpDocumentUpdateProfileInput(v *UpdateProfileInput, v ok.String(string(v.PartyType)) } + if v.PartyTypeString != nil { + ok := object.Key("PartyTypeString") + ok.String(*v.PartyTypeString) + } + if v.PersonalEmailAddress != nil { ok := object.Key("PersonalEmailAddress") ok.String(*v.PersonalEmailAddress) diff --git a/service/ec2/api_op_CopyImage.go b/service/ec2/api_op_CopyImage.go index 0c714606aba..57abe11abaa 100644 --- a/service/ec2/api_op_CopyImage.go +++ b/service/ec2/api_op_CopyImage.go @@ -15,22 +15,18 @@ import ( // from one Outpost to another, or within the same Outpost. To copy an AMI to // another partition, see CreateStoreImageTask // (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateStoreImageTask.html). -// To copy an AMI from one Region to another, specify the source Region using -// the -// -// SourceRegion parameter, and specify the destination Region using its -// endpoint. Copies of encrypted backing snapshots for the AMI are encrypted. -// Copies of unencrypted backing snapshots remain unencrypted, unless you set -// Encrypted during the copy operation. You cannot create an unencrypted copy of an -// encrypted backing snapshot. To copy an AMI from a Region to an Outpost, specify -// the source Region using the -// -// SourceRegion parameter, and specify the ARN of the -// destination Outpost using DestinationOutpostArn. Backing snapshots copied to an -// Outpost are encrypted by default using the default encryption key for the -// Region, or a different key that you specify in the request using KmsKeyId. -// Outposts do not support unencrypted snapshots. For more information, Amazon EBS -// local snapshots on Outposts +// To copy an AMI from one Region to another, specify the source Region using the +// SourceRegion parameter, and specify the destination Region using its endpoint. +// Copies of encrypted backing snapshots for the AMI are encrypted. Copies of +// unencrypted backing snapshots remain unencrypted, unless you set Encrypted +// during the copy operation. You cannot create an unencrypted copy of an encrypted +// backing snapshot. To copy an AMI from a Region to an Outpost, specify the source +// Region using the SourceRegion parameter, and specify the ARN of the destination +// Outpost using DestinationOutpostArn. Backing snapshots copied to an Outpost are +// encrypted by default using the default encryption key for the Region, or a +// different key that you specify in the request using KmsKeyId. Outposts do not +// support unencrypted snapshots. For more information, Amazon EBS local snapshots +// on Outposts // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshots-outposts.html#ami) // in the Amazon Elastic Compute Cloud User Guide. For more information about the // prerequisites and limits when copying an AMI, see Copy an AMI diff --git a/service/ec2/deserializers.go b/service/ec2/deserializers.go index 9cae25a629c..c9b47678161 100644 --- a/service/ec2/deserializers.go +++ b/service/ec2/deserializers.go @@ -71131,6 +71131,12 @@ func awsEc2query_deserializeDocumentFpgaImage(v **types.FpgaImage, decoder smith sv.FpgaImageId = ptr.String(xtv) } + case strings.EqualFold("instanceTypes", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentInstanceTypesList(&sv.InstanceTypes, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("name", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -81492,6 +81498,86 @@ func awsEc2query_deserializeDocumentInstanceTypeOfferingsListUnwrapped(v *[]type *v = sv return nil } +func awsEc2query_deserializeDocumentInstanceTypesList(v *[]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("item", t.Name.Local): + var col string + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + col = xtv + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsEc2query_deserializeDocumentInstanceTypesListUnwrapped(v *[]string, decoder smithyxml.NodeDecoder) error { + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + switch { + default: + var mv string + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + mv = xtv + } + sv = append(sv, mv) + } + *v = sv + return nil +} func awsEc2query_deserializeDocumentInstanceUsage(v **types.InstanceUsage, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/ec2/types/enums.go b/service/ec2/types/enums.go index f60d2989496..065c35aa71c 100644 --- a/service/ec2/types/enums.go +++ b/service/ec2/types/enums.go @@ -5576,6 +5576,7 @@ const ( ResourceTypeVerifiedAccessPolicy ResourceType = "verified-access-policy" ResourceTypeVerifiedAccessTrustProvider ResourceType = "verified-access-trust-provider" ResourceTypeVpnConnectionDeviceType ResourceType = "vpn-connection-device-type" + ResourceTypeVpcBlockPublicAccessExclusion ResourceType = "vpc-block-public-access-exclusion" ) // Values returns all known values for ResourceType. Note that this can be expanded @@ -5665,6 +5666,7 @@ func (ResourceType) Values() []ResourceType { "verified-access-policy", "verified-access-trust-provider", "vpn-connection-device-type", + "vpc-block-public-access-exclusion", } } diff --git a/service/ec2/types/types.go b/service/ec2/types/types.go index 990e6790d3e..b57a382a52a 100644 --- a/service/ec2/types/types.go +++ b/service/ec2/types/types.go @@ -4440,6 +4440,8 @@ type FpgaImage struct { // The FPGA image identifier (AFI ID). FpgaImageId *string + InstanceTypes []string + // The name of the AFI. Name *string @@ -13515,15 +13517,11 @@ type SpotFleetRequestConfigData struct { // For more information, see Allocation strategies for Spot Instances // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-allocation-strategy.html) // in the Amazon EC2 User Guide. priceCapacityOptimized (recommended) Spot Fleet - // identifies the pools with - // - // the highest capacity availability for the number of + // identifies the pools with the highest capacity availability for the number of // instances that are launching. This means that we will request Spot Instances // from the pools that we believe have the lowest chance of interruption in the // near term. Spot Fleet then requests Spot Instances from the lowest priced of - // these pools. capacityOptimized Spot Fleet identifies the pools with - // - // the highest + // these pools. capacityOptimized Spot Fleet identifies the pools with the highest // capacity availability for the number of instances that are launching. This means // that we will request Spot Instances from the pools that we believe have the // lowest chance of interruption in the near term. To give certain instance types a @@ -13882,15 +13880,11 @@ type SpotOptions struct { // For more information, see Allocation strategies for Spot Instances // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-allocation-strategy.html) // in the Amazon EC2 User Guide. price-capacity-optimized (recommended) EC2 Fleet - // identifies the pools with - // - // the highest capacity availability for the number of + // identifies the pools with the highest capacity availability for the number of // instances that are launching. This means that we will request Spot Instances // from the pools that we believe have the lowest chance of interruption in the // near term. EC2 Fleet then requests Spot Instances from the lowest priced of - // these pools. capacity-optimized EC2 Fleet identifies the pools with - // - // the highest + // these pools. capacity-optimized EC2 Fleet identifies the pools with the highest // capacity availability for the number of instances that are launching. This means // that we will request Spot Instances from the pools that we believe have the // lowest chance of interruption in the near term. To give certain instance types a @@ -13966,15 +13960,11 @@ type SpotOptionsRequest struct { // For more information, see Allocation strategies for Spot Instances // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-allocation-strategy.html) // in the Amazon EC2 User Guide. price-capacity-optimized (recommended) EC2 Fleet - // identifies the pools with - // - // the highest capacity availability for the number of + // identifies the pools with the highest capacity availability for the number of // instances that are launching. This means that we will request Spot Instances // from the pools that we believe have the lowest chance of interruption in the // near term. EC2 Fleet then requests Spot Instances from the lowest priced of - // these pools. capacity-optimized EC2 Fleet identifies the pools with - // - // the highest + // these pools. capacity-optimized EC2 Fleet identifies the pools with the highest // capacity availability for the number of instances that are launching. This means // that we will request Spot Instances from the pools that we believe have the // lowest chance of interruption in the near term. To give certain instance types a diff --git a/service/kinesisvideo/api_op_DescribeEdgeConfiguration.go b/service/kinesisvideo/api_op_DescribeEdgeConfiguration.go new file mode 100644 index 00000000000..654368f5b2a --- /dev/null +++ b/service/kinesisvideo/api_op_DescribeEdgeConfiguration.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package kinesisvideo + +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/kinesisvideo/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// Describes a stream’s edge configuration that was set using the +// StartEdgeConfigurationUpdate API. Use this API to get the status of the +// configuration if the configuration is in sync with the Edge Agent. +func (c *Client) DescribeEdgeConfiguration(ctx context.Context, params *DescribeEdgeConfigurationInput, optFns ...func(*Options)) (*DescribeEdgeConfigurationOutput, error) { + if params == nil { + params = &DescribeEdgeConfigurationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DescribeEdgeConfiguration", params, optFns, c.addOperationDescribeEdgeConfigurationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DescribeEdgeConfigurationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DescribeEdgeConfigurationInput struct { + + // The Amazon Resource Name (ARN) of the stream. Specify either the StreamNameor + // the StreamARN. + StreamARN *string + + // The name of the stream whose edge configuration you want to update. Specify + // either the StreamName or the StreamARN. + StreamName *string + + noSmithyDocumentSerde +} + +type DescribeEdgeConfigurationOutput struct { + + // The timestamp at which a stream’s edge configuration was first created. + CreationTime *time.Time + + // A description of the stream's edge configuration that will be used to sync with + // the Edge Agent IoT Greengrass component. The Edge Agent component will run on an + // IoT Hub Device setup at your premise. + EdgeConfig *types.EdgeConfig + + // A description of the generated failure status. + FailedStatusDetails *string + + // The timestamp at which a stream’s edge configuration was last updated. + LastUpdatedTime *time.Time + + // The Amazon Resource Name (ARN) of the stream. + StreamARN *string + + // The name of the stream from which the edge configuration was updated. + StreamName *string + + // The latest status of the edge configuration update. + SyncStatus types.SyncStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDescribeEdgeConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeEdgeConfiguration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeEdgeConfiguration{}, 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_opDescribeEdgeConfiguration(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_opDescribeEdgeConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "kinesisvideo", + OperationName: "DescribeEdgeConfiguration", + } +} diff --git a/service/kinesisvideo/api_op_StartEdgeConfigurationUpdate.go b/service/kinesisvideo/api_op_StartEdgeConfigurationUpdate.go new file mode 100644 index 00000000000..2de5dd93889 --- /dev/null +++ b/service/kinesisvideo/api_op_StartEdgeConfigurationUpdate.go @@ -0,0 +1,165 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package kinesisvideo + +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/kinesisvideo/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +// An asynchronous API that updates a stream’s existing edge configuration. If this +// API is invoked for the first time, a new edge configuration will be created for +// the stream, and the sync status will be set to SYNCING. The Kinesis Video Stream +// will sync the stream’s edge configuration with the Edge Agent IoT Greengrass +// component that runs on an IoT Hub Device setup at your premise. The time to sync +// can vary and depends on the connectivity of the Hub Device. The SyncStatus will +// be updated as the edge configuration is acknowledged, and synced with the Edge +// Agent. You will have to wait for the sync status to reach a terminal state such +// as: IN_SYNC and SYNC_FAILED, before using this API again. If you invoke this API +// during the syncing process, a ResourceInUseException will be thrown. The +// connectivity of the stream's edge configuration and the Edge Agent will be +// retried for 15 minutes. After 15 minutes, the status will transition into the +// SYNC_FAILED state. +func (c *Client) StartEdgeConfigurationUpdate(ctx context.Context, params *StartEdgeConfigurationUpdateInput, optFns ...func(*Options)) (*StartEdgeConfigurationUpdateOutput, error) { + if params == nil { + params = &StartEdgeConfigurationUpdateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartEdgeConfigurationUpdate", params, optFns, c.addOperationStartEdgeConfigurationUpdateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartEdgeConfigurationUpdateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartEdgeConfigurationUpdateInput struct { + + // The edge configuration details required to invoke the update process. + // + // This member is required. + EdgeConfig *types.EdgeConfig + + // The Amazon Resource Name (ARN) of the stream. Specify either the StreamName or + // the StreamARN. + StreamARN *string + + // The name of the stream whose edge configuration you want to update. Specify + // either the StreamName or the StreamARN. + StreamName *string + + noSmithyDocumentSerde +} + +type StartEdgeConfigurationUpdateOutput struct { + + // The timestamp at which a stream’s edge configuration was first created. + CreationTime *time.Time + + // A description of the stream's edge configuration that will be used to sync with + // the Edge Agent IoT Greengrass component. The Edge Agent component will run on an + // IoT Hub Device setup at your premise. + EdgeConfig *types.EdgeConfig + + // A description of the generated failure status. + FailedStatusDetails *string + + // The timestamp at which a stream’s edge configuration was last updated. + LastUpdatedTime *time.Time + + // The Amazon Resource Name (ARN) of the stream. + StreamARN *string + + // The name of the stream from which the edge configuration was updated. + StreamName *string + + // The current sync status of the stream's edge configuration. When you invoke this + // API, the sync status will be set to the SYNCING state. Use the + // DescribeEdgeConfiguration API to get the latest status of the edge + // configuration. + SyncStatus types.SyncStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartEdgeConfigurationUpdateMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartEdgeConfigurationUpdate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartEdgeConfigurationUpdate{}, 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 = addOpStartEdgeConfigurationUpdateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartEdgeConfigurationUpdate(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_opStartEdgeConfigurationUpdate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "kinesisvideo", + OperationName: "StartEdgeConfigurationUpdate", + } +} diff --git a/service/kinesisvideo/deserializers.go b/service/kinesisvideo/deserializers.go index 14054de054e..c0a45b76133 100644 --- a/service/kinesisvideo/deserializers.go +++ b/service/kinesisvideo/deserializers.go @@ -550,6 +550,233 @@ func awsRestjson1_deserializeOpErrorDeleteStream(response *smithyhttp.Response, } } +type awsRestjson1_deserializeOpDescribeEdgeConfiguration struct { +} + +func (*awsRestjson1_deserializeOpDescribeEdgeConfiguration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDescribeEdgeConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorDescribeEdgeConfiguration(response, &metadata) + } + output := &DescribeEdgeConfigurationOutput{} + 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_deserializeOpDocumentDescribeEdgeConfigurationOutput(&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_deserializeOpErrorDescribeEdgeConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != 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("ClientLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorClientLimitExceededException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("StreamEdgeConfigurationNotFoundException", errorCode): + return awsRestjson1_deserializeErrorStreamEdgeConfigurationNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDescribeEdgeConfigurationOutput(v **DescribeEdgeConfigurationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DescribeEdgeConfigurationOutput + if *v == nil { + sv = &DescribeEdgeConfigurationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CreationTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "EdgeConfig": + if err := awsRestjson1_deserializeDocumentEdgeConfig(&sv.EdgeConfig, value); err != nil { + return err + } + + case "FailedStatusDetails": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailedStatusDetails to be of type string, got %T instead", value) + } + sv.FailedStatusDetails = ptr.String(jtv) + } + + case "LastUpdatedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "StreamARN": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceARN to be of type string, got %T instead", value) + } + sv.StreamARN = ptr.String(jtv) + } + + case "StreamName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected StreamName to be of type string, got %T instead", value) + } + sv.StreamName = ptr.String(jtv) + } + + case "SyncStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SyncStatus to be of type string, got %T instead", value) + } + sv.SyncStatus = types.SyncStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpDescribeImageGenerationConfiguration struct { } @@ -2147,14 +2374,14 @@ func awsRestjson1_deserializeOpDocumentListTagsForStreamOutput(v **ListTagsForSt return nil } -type awsRestjson1_deserializeOpTagResource struct { +type awsRestjson1_deserializeOpStartEdgeConfigurationUpdate struct { } -func (*awsRestjson1_deserializeOpTagResource) ID() string { +func (*awsRestjson1_deserializeOpStartEdgeConfigurationUpdate) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpStartEdgeConfigurationUpdate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -2168,15 +2395,43 @@ func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorStartEdgeConfigurationUpdate(response, &metadata) } - output := &TagResourceOutput{} + output := &StartEdgeConfigurationUpdateOutput{} 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_deserializeOpDocumentStartEdgeConfigurationUpdateOutput(&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_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorStartEdgeConfigurationUpdate(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -2226,12 +2481,15 @@ func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, m case strings.EqualFold("InvalidArgumentException", errorCode): return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + case strings.EqualFold("NoDataRetentionException", errorCode): + return awsRestjson1_deserializeErrorNoDataRetentionException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TagsPerResourceExceededLimitException", errorCode): - return awsRestjson1_deserializeErrorTagsPerResourceExceededLimitException(response, errorBody) - default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -2242,10 +2500,209 @@ func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, m } } -type awsRestjson1_deserializeOpTagStream struct { -} +func awsRestjson1_deserializeOpDocumentStartEdgeConfigurationUpdateOutput(v **StartEdgeConfigurationUpdateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } -func (*awsRestjson1_deserializeOpTagStream) ID() string { + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartEdgeConfigurationUpdateOutput + if *v == nil { + sv = &StartEdgeConfigurationUpdateOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CreationTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "EdgeConfig": + if err := awsRestjson1_deserializeDocumentEdgeConfig(&sv.EdgeConfig, value); err != nil { + return err + } + + case "FailedStatusDetails": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailedStatusDetails to be of type string, got %T instead", value) + } + sv.FailedStatusDetails = ptr.String(jtv) + } + + case "LastUpdatedTime": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "StreamARN": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceARN to be of type string, got %T instead", value) + } + sv.StreamARN = ptr.String(jtv) + } + + case "StreamName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected StreamName to be of type string, got %T instead", value) + } + sv.StreamName = ptr.String(jtv) + } + + case "SyncStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SyncStatus to be of type string, got %T instead", value) + } + sv.SyncStatus = types.SyncStatus(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("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ClientLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorClientLimitExceededException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TagsPerResourceExceededLimitException", errorCode): + return awsRestjson1_deserializeErrorTagsPerResourceExceededLimitException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpTagStream struct { +} + +func (*awsRestjson1_deserializeOpTagStream) ID() string { return "OperationDeserializer" } @@ -3449,6 +3906,42 @@ func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp return output } +func awsRestjson1_deserializeErrorStreamEdgeConfigurationNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.StreamEdgeConfigurationNotFoundException{} + 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_deserializeDocumentStreamEdgeConfigurationNotFoundException(&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_deserializeErrorTagsPerResourceExceededLimitException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.TagsPerResourceExceededLimitException{} var buff [1024]byte @@ -3812,7 +4305,7 @@ func awsRestjson1_deserializeDocumentClientLimitExceededException(v **types.Clie return nil } -func awsRestjson1_deserializeDocumentDeviceStreamLimitExceededException(v **types.DeviceStreamLimitExceededException, value interface{}) error { +func awsRestjson1_deserializeDocumentDeletionConfig(v **types.DeletionConfig, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -3825,22 +4318,40 @@ func awsRestjson1_deserializeDocumentDeviceStreamLimitExceededException(v **type return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.DeviceStreamLimitExceededException + var sv *types.DeletionConfig if *v == nil { - sv = &types.DeviceStreamLimitExceededException{} + sv = &types.DeletionConfig{} } else { sv = *v } for key, value := range shape { switch key { - case "Message": + case "DeleteAfterUpload": if value != nil { - jtv, ok := value.(string) + jtv, ok := value.(bool) if !ok { - return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + return fmt.Errorf("expected DeleteAfterUpload to be of type *bool, got %T instead", value) } - sv.Message = ptr.String(jtv) + sv.DeleteAfterUpload = ptr.Bool(jtv) + } + + case "EdgeRetentionInHours": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected EdgeRetentionInHours to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EdgeRetentionInHours = ptr.Int32(int32(i64)) + } + + case "LocalSizeConfig": + if err := awsRestjson1_deserializeDocumentLocalSizeConfig(&sv.LocalSizeConfig, value); err != nil { + return err } default: @@ -3852,7 +4363,7 @@ func awsRestjson1_deserializeDocumentDeviceStreamLimitExceededException(v **type return nil } -func awsRestjson1_deserializeDocumentFormatConfig(v *map[string]string, value interface{}) error { +func awsRestjson1_deserializeDocumentDeviceStreamLimitExceededException(v **types.DeviceStreamLimitExceededException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -3865,26 +4376,121 @@ func awsRestjson1_deserializeDocumentFormatConfig(v *map[string]string, value in return fmt.Errorf("unexpected JSON type %v", value) } - var mv map[string]string + var sv *types.DeviceStreamLimitExceededException if *v == nil { - mv = map[string]string{} + sv = &types.DeviceStreamLimitExceededException{} } else { - mv = *v + sv = *v } for key, value := range shape { - var parsedVal string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected FormatConfigValue to be of type string, got %T instead", value) - } - parsedVal = jtv - } - mv[key] = parsedVal - - } - *v = mv + 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_deserializeDocumentEdgeConfig(v **types.EdgeConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.EdgeConfig + if *v == nil { + sv = &types.EdgeConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DeletionConfig": + if err := awsRestjson1_deserializeDocumentDeletionConfig(&sv.DeletionConfig, value); err != nil { + return err + } + + case "HubDeviceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HubDeviceArn to be of type string, got %T instead", value) + } + sv.HubDeviceArn = ptr.String(jtv) + } + + case "RecorderConfig": + if err := awsRestjson1_deserializeDocumentRecorderConfig(&sv.RecorderConfig, value); err != nil { + return err + } + + case "UploaderConfig": + if err := awsRestjson1_deserializeDocumentUploaderConfig(&sv.UploaderConfig, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentFormatConfig(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 FormatConfigValue to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv return nil } @@ -4164,6 +4770,108 @@ func awsRestjson1_deserializeDocumentInvalidResourceFormatException(v **types.In return nil } +func awsRestjson1_deserializeDocumentLocalSizeConfig(v **types.LocalSizeConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.LocalSizeConfig + if *v == nil { + sv = &types.LocalSizeConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "MaxLocalMediaSizeInMB": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected MaxLocalMediaSizeInMB to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaxLocalMediaSizeInMB = ptr.Int32(int32(i64)) + } + + case "StrategyOnFullSize": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected StrategyOnFullSize to be of type string, got %T instead", value) + } + sv.StrategyOnFullSize = types.StrategyOnFullSize(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMediaSourceConfig(v **types.MediaSourceConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.MediaSourceConfig + if *v == nil { + sv = &types.MediaSourceConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "MediaUriSecretArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MediaUriSecretArn to be of type string, got %T instead", value) + } + sv.MediaUriSecretArn = ptr.String(jtv) + } + + case "MediaUriType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MediaUriType to be of type string, got %T instead", value) + } + sv.MediaUriType = types.MediaUriType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentNoDataRetentionException(v **types.NoDataRetentionException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4329,6 +5037,47 @@ func awsRestjson1_deserializeDocumentNotificationDestinationConfig(v **types.Not return nil } +func awsRestjson1_deserializeDocumentRecorderConfig(v **types.RecorderConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RecorderConfig + if *v == nil { + sv = &types.RecorderConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "MediaSourceConfig": + if err := awsRestjson1_deserializeDocumentMediaSourceConfig(&sv.MediaSourceConfig, value); err != nil { + return err + } + + case "ScheduleConfig": + if err := awsRestjson1_deserializeDocumentScheduleConfig(&sv.ScheduleConfig, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentResourceEndpointList(v *[]types.ResourceEndpointListItem, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4528,6 +5277,59 @@ func awsRestjson1_deserializeDocumentResourceTags(v *map[string]string, value in return nil } +func awsRestjson1_deserializeDocumentScheduleConfig(v **types.ScheduleConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ScheduleConfig + if *v == nil { + sv = &types.ScheduleConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DurationInSeconds": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected DurationInSeconds to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.DurationInSeconds = ptr.Int32(int32(i64)) + } + + case "ScheduleExpression": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ScheduleExpression to be of type string, got %T instead", value) + } + sv.ScheduleExpression = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentSingleMasterConfiguration(v **types.SingleMasterConfiguration, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4572,6 +5374,46 @@ func awsRestjson1_deserializeDocumentSingleMasterConfiguration(v **types.SingleM return nil } +func awsRestjson1_deserializeDocumentStreamEdgeConfigurationNotFoundException(v **types.StreamEdgeConfigurationNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.StreamEdgeConfigurationNotFoundException + if *v == nil { + sv = &types.StreamEdgeConfigurationNotFoundException{} + } 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_deserializeDocumentStreamInfo(v **types.StreamInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4769,6 +5611,42 @@ func awsRestjson1_deserializeDocumentTagsPerResourceExceededLimitException(v **t return nil } +func awsRestjson1_deserializeDocumentUploaderConfig(v **types.UploaderConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.UploaderConfig + if *v == nil { + sv = &types.UploaderConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ScheduleConfig": + if err := awsRestjson1_deserializeDocumentScheduleConfig(&sv.ScheduleConfig, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentVersionMismatchException(v **types.VersionMismatchException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/kinesisvideo/generated.json b/service/kinesisvideo/generated.json index 406efb673d6..9a738b75ae2 100644 --- a/service/kinesisvideo/generated.json +++ b/service/kinesisvideo/generated.json @@ -12,6 +12,7 @@ "api_op_CreateStream.go", "api_op_DeleteSignalingChannel.go", "api_op_DeleteStream.go", + "api_op_DescribeEdgeConfiguration.go", "api_op_DescribeImageGenerationConfiguration.go", "api_op_DescribeNotificationConfiguration.go", "api_op_DescribeSignalingChannel.go", @@ -22,6 +23,7 @@ "api_op_ListStreams.go", "api_op_ListTagsForResource.go", "api_op_ListTagsForStream.go", + "api_op_StartEdgeConfigurationUpdate.go", "api_op_TagResource.go", "api_op_TagStream.go", "api_op_UntagResource.go", diff --git a/service/kinesisvideo/serializers.go b/service/kinesisvideo/serializers.go index 005421c22e6..c6091229a83 100644 --- a/service/kinesisvideo/serializers.go +++ b/service/kinesisvideo/serializers.go @@ -342,6 +342,79 @@ func awsRestjson1_serializeOpDocumentDeleteStreamInput(v *DeleteStreamInput, val return nil } +type awsRestjson1_serializeOpDescribeEdgeConfiguration struct { +} + +func (*awsRestjson1_serializeOpDescribeEdgeConfiguration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDescribeEdgeConfiguration) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DescribeEdgeConfigurationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/describeEdgeConfiguration") + 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_serializeOpDocumentDescribeEdgeConfigurationInput(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_serializeOpHttpBindingsDescribeEdgeConfigurationInput(v *DescribeEdgeConfigurationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDescribeEdgeConfigurationInput(v *DescribeEdgeConfigurationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.StreamARN != nil { + ok := object.Key("StreamARN") + ok.String(*v.StreamARN) + } + + if v.StreamName != nil { + ok := object.Key("StreamName") + ok.String(*v.StreamName) + } + + return nil +} + type awsRestjson1_serializeOpDescribeImageGenerationConfiguration struct { } @@ -1098,6 +1171,86 @@ func awsRestjson1_serializeOpDocumentListTagsForStreamInput(v *ListTagsForStream return nil } +type awsRestjson1_serializeOpStartEdgeConfigurationUpdate struct { +} + +func (*awsRestjson1_serializeOpStartEdgeConfigurationUpdate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartEdgeConfigurationUpdate) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*StartEdgeConfigurationUpdateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/startEdgeConfigurationUpdate") + 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_serializeOpDocumentStartEdgeConfigurationUpdateInput(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_serializeOpHttpBindingsStartEdgeConfigurationUpdateInput(v *StartEdgeConfigurationUpdateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartEdgeConfigurationUpdateInput(v *StartEdgeConfigurationUpdateInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EdgeConfig != nil { + ok := object.Key("EdgeConfig") + if err := awsRestjson1_serializeDocumentEdgeConfig(v.EdgeConfig, ok); err != nil { + return err + } + } + + if v.StreamARN != nil { + ok := object.Key("StreamARN") + ok.String(*v.StreamARN) + } + + if v.StreamName != nil { + ok := object.Key("StreamName") + ok.String(*v.StreamName) + } + + return nil +} + type awsRestjson1_serializeOpTagResource struct { } @@ -1841,6 +1994,63 @@ func awsRestjson1_serializeDocumentChannelNameCondition(v *types.ChannelNameCond return nil } +func awsRestjson1_serializeDocumentDeletionConfig(v *types.DeletionConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DeleteAfterUpload != nil { + ok := object.Key("DeleteAfterUpload") + ok.Boolean(*v.DeleteAfterUpload) + } + + if v.EdgeRetentionInHours != nil { + ok := object.Key("EdgeRetentionInHours") + ok.Integer(*v.EdgeRetentionInHours) + } + + if v.LocalSizeConfig != nil { + ok := object.Key("LocalSizeConfig") + if err := awsRestjson1_serializeDocumentLocalSizeConfig(v.LocalSizeConfig, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentEdgeConfig(v *types.EdgeConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DeletionConfig != nil { + ok := object.Key("DeletionConfig") + if err := awsRestjson1_serializeDocumentDeletionConfig(v.DeletionConfig, ok); err != nil { + return err + } + } + + if v.HubDeviceArn != nil { + ok := object.Key("HubDeviceArn") + ok.String(*v.HubDeviceArn) + } + + if v.RecorderConfig != nil { + ok := object.Key("RecorderConfig") + if err := awsRestjson1_serializeDocumentRecorderConfig(v.RecorderConfig, ok); err != nil { + return err + } + } + + if v.UploaderConfig != nil { + ok := object.Key("UploaderConfig") + if err := awsRestjson1_serializeDocumentUploaderConfig(v.UploaderConfig, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentFormatConfig(v map[string]string, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1931,6 +2141,40 @@ func awsRestjson1_serializeDocumentListOfProtocols(v []types.ChannelProtocol, va return nil } +func awsRestjson1_serializeDocumentLocalSizeConfig(v *types.LocalSizeConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxLocalMediaSizeInMB != nil { + ok := object.Key("MaxLocalMediaSizeInMB") + ok.Integer(*v.MaxLocalMediaSizeInMB) + } + + if len(v.StrategyOnFullSize) > 0 { + ok := object.Key("StrategyOnFullSize") + ok.String(string(v.StrategyOnFullSize)) + } + + return nil +} + +func awsRestjson1_serializeDocumentMediaSourceConfig(v *types.MediaSourceConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MediaUriSecretArn != nil { + ok := object.Key("MediaUriSecretArn") + ok.String(*v.MediaUriSecretArn) + } + + if len(v.MediaUriType) > 0 { + ok := object.Key("MediaUriType") + ok.String(string(v.MediaUriType)) + } + + return nil +} + func awsRestjson1_serializeDocumentNotificationConfiguration(v *types.NotificationConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1962,6 +2206,27 @@ func awsRestjson1_serializeDocumentNotificationDestinationConfig(v *types.Notifi return nil } +func awsRestjson1_serializeDocumentRecorderConfig(v *types.RecorderConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MediaSourceConfig != nil { + ok := object.Key("MediaSourceConfig") + if err := awsRestjson1_serializeDocumentMediaSourceConfig(v.MediaSourceConfig, ok); err != nil { + return err + } + } + + if v.ScheduleConfig != nil { + ok := object.Key("ScheduleConfig") + if err := awsRestjson1_serializeDocumentScheduleConfig(v.ScheduleConfig, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentResourceTags(v map[string]string, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1973,6 +2238,23 @@ func awsRestjson1_serializeDocumentResourceTags(v map[string]string, value smith return nil } +func awsRestjson1_serializeDocumentScheduleConfig(v *types.ScheduleConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DurationInSeconds != nil { + ok := object.Key("DurationInSeconds") + ok.Integer(*v.DurationInSeconds) + } + + if v.ScheduleExpression != nil { + ok := object.Key("ScheduleExpression") + ok.String(*v.ScheduleExpression) + } + + return nil +} + func awsRestjson1_serializeDocumentSingleMasterChannelEndpointConfiguration(v *types.SingleMasterChannelEndpointConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -2074,3 +2356,17 @@ func awsRestjson1_serializeDocumentTagOnCreateList(v []types.Tag, value smithyjs } return nil } + +func awsRestjson1_serializeDocumentUploaderConfig(v *types.UploaderConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ScheduleConfig != nil { + ok := object.Key("ScheduleConfig") + if err := awsRestjson1_serializeDocumentScheduleConfig(v.ScheduleConfig, ok); err != nil { + return err + } + } + + return nil +} diff --git a/service/kinesisvideo/types/enums.go b/service/kinesisvideo/types/enums.go index bd80b617cb8..03759522f69 100644 --- a/service/kinesisvideo/types/enums.go +++ b/service/kinesisvideo/types/enums.go @@ -172,6 +172,24 @@ func (ImageSelectorType) Values() []ImageSelectorType { } } +type MediaUriType string + +// Enum values for MediaUriType +const ( + MediaUriTypeRtspUri MediaUriType = "RTSP_URI" + MediaUriTypeFileUri MediaUriType = "FILE_URI" +) + +// Values returns all known values for MediaUriType. 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 (MediaUriType) Values() []MediaUriType { + return []MediaUriType{ + "RTSP_URI", + "FILE_URI", + } +} + type Status string // Enum values for Status @@ -194,6 +212,50 @@ func (Status) Values() []Status { } } +type StrategyOnFullSize string + +// Enum values for StrategyOnFullSize +const ( + StrategyOnFullSizeDeleteOldestMedia StrategyOnFullSize = "DELETE_OLDEST_MEDIA" + StrategyOnFullSizeDenyNewMedia StrategyOnFullSize = "DENY_NEW_MEDIA" +) + +// Values returns all known values for StrategyOnFullSize. 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 (StrategyOnFullSize) Values() []StrategyOnFullSize { + return []StrategyOnFullSize{ + "DELETE_OLDEST_MEDIA", + "DENY_NEW_MEDIA", + } +} + +type SyncStatus string + +// Enum values for SyncStatus +const ( + SyncStatusSyncing SyncStatus = "SYNCING" + SyncStatusAcknowledged SyncStatus = "ACKNOWLEDGED" + SyncStatusInSync SyncStatus = "IN_SYNC" + SyncStatusSyncFailed SyncStatus = "SYNC_FAILED" + SyncStatusDeleting SyncStatus = "DELETING" + SyncStatusDeleteFailed SyncStatus = "DELETE_FAILED" +) + +// Values returns all known values for SyncStatus. 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 (SyncStatus) Values() []SyncStatus { + return []SyncStatus{ + "SYNCING", + "ACKNOWLEDGED", + "IN_SYNC", + "SYNC_FAILED", + "DELETING", + "DELETE_FAILED", + } +} + type UpdateDataRetentionOperation string // Enum values for UpdateDataRetentionOperation diff --git a/service/kinesisvideo/types/errors.go b/service/kinesisvideo/types/errors.go index 89907499179..69d17c139da 100644 --- a/service/kinesisvideo/types/errors.go +++ b/service/kinesisvideo/types/errors.go @@ -254,6 +254,30 @@ func (e *ResourceNotFoundException) ErrorMessage() string { func (e *ResourceNotFoundException) ErrorCode() string { return "ResourceNotFoundException" } func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } +// The Exception rendered when the Amazon Kinesis Video Stream can't find a +// stream's edge configuration that you specified. +type StreamEdgeConfigurationNotFoundException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *StreamEdgeConfigurationNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *StreamEdgeConfigurationNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *StreamEdgeConfigurationNotFoundException) ErrorCode() string { + return "StreamEdgeConfigurationNotFoundException" +} +func (e *StreamEdgeConfigurationNotFoundException) ErrorFault() smithy.ErrorFault { + return smithy.FaultClient +} + // You have exceeded the limit of tags that you can associate with the resource. A // Kinesis video stream can support up to 50 tags. type TagsPerResourceExceededLimitException struct { diff --git a/service/kinesisvideo/types/types.go b/service/kinesisvideo/types/types.go index 89033fa7828..5403085cb51 100644 --- a/service/kinesisvideo/types/types.go +++ b/service/kinesisvideo/types/types.go @@ -49,6 +49,59 @@ type ChannelNameCondition struct { noSmithyDocumentSerde } +// The configuration details required to delete the connection of the stream from +// the Edge Agent. +type DeletionConfig struct { + + // The boolean value used to indicate whether or not you want to mark the media for + // deletion, once it has been uploaded to the Kinesis Video Stream cloud. The media + // files can be deleted if any of the deletion configuration values are set to + // true, such as when the limit for the EdgeRetentionInHours, or the + // MaxLocalMediaSizeInMB, has been reached. Since the default value is set to true, + // configure the uploader schedule such that the media files are not being deleted + // before they are initially uploaded to AWS cloud. + DeleteAfterUpload *bool + + // The number of hours that you want to retain the data in the stream on the Edge + // Agent. The default value of the retention time is 720 hours, which translates to + // 30 days. + EdgeRetentionInHours *int32 + + // The value of the local size required in order to delete the edge configuration. + LocalSizeConfig *LocalSizeConfig + + noSmithyDocumentSerde +} + +// A description of the stream's edge configuration that will be used to sync with +// the Edge Agent IoT Greengrass component. The Edge Agent component will run on an +// IoT Hub Device setup at your premise. +type EdgeConfig struct { + + // The "Internet of Things (IoT) Thing" Arn of the stream. + // + // This member is required. + HubDeviceArn *string + + // The recorder configuration consists of the local MediaSourceConfig details, that + // are used as credentials to access the local media files streamed on the camera. + // + // This member is required. + RecorderConfig *RecorderConfig + + // The deletion configuration is made up of the retention time + // (EdgeRetentionInHours) and local size configuration (LocalSizeConfig) details + // that are used to make the deletion. + DeletionConfig *DeletionConfig + + // The uploader configuration contains the ScheduleExpression details that are + // used, to schedule upload jobs for the recorded media files from the Edge Agent, + // to a Kinesis Video Stream. + UploaderConfig *UploaderConfig + + noSmithyDocumentSerde +} + // The structure that contains the information required for the KVS images // delivery. If null, the configuration will be deleted from the stream. type ImageGenerationConfiguration struct { @@ -122,7 +175,7 @@ type ImageGenerationDestinationConfig struct { // This member is required. DestinationRegion *string - // The Uniform Resource Idenifier (URI) that identifies where the images will be + // The Uniform Resource Identifier (URI) that identifies where the images will be // delivered. // // This member is required. @@ -131,6 +184,42 @@ type ImageGenerationDestinationConfig struct { noSmithyDocumentSerde } +// The configuration details that include the maximum size of the media +// (MaxLocalMediaSizeInMB) that you want to store for a stream on the Edge Agent, +// as well as the strategy that should be used (StrategyOnFullSize) when a stream's +// maximum size has been reached. +type LocalSizeConfig struct { + + // The overall maximum size of the media that you want to store for a stream on the + // Edge Agent. + MaxLocalMediaSizeInMB *int32 + + // The strategy to perform when a stream’s MaxLocalMediaSizeInMB limit is reached. + StrategyOnFullSize StrategyOnFullSize + + noSmithyDocumentSerde +} + +// The configuration details that consist of the credentials required +// (MediaUriSecretArn and MediaUriType) to access the media files that are streamed +// to the camera. +type MediaSourceConfig struct { + + // The AWS Secrets Manager ARN for the username and password of the camera, or a + // local media file location. + // + // This member is required. + MediaUriSecretArn *string + + // The Uniform Resource Identifier (Uri) type. The FILE_URI value can be used to + // stream local media files. + // + // This member is required. + MediaUriType MediaUriType + + noSmithyDocumentSerde +} + // The structure that contains the notification information for the KVS images // delivery. If this parameter is null, the configuration will be deleted from the // stream. @@ -153,7 +242,7 @@ type NotificationConfiguration struct { // to a customer. type NotificationDestinationConfig struct { - // The Uniform Resource Idenifier (URI) that identifies where the images will be + // The Uniform Resource Identifier (URI) that identifies where the images will be // delivered. // // This member is required. @@ -162,6 +251,26 @@ type NotificationDestinationConfig struct { noSmithyDocumentSerde } +// The recorder configuration consists of the local MediaSourceConfig details that +// are used as credentials to accesss the local media files streamed on the camera. +type RecorderConfig struct { + + // The configuration details that consist of the credentials required + // (MediaUriSecretArn and MediaUriType) to access the media files streamed to the + // camera. + // + // This member is required. + MediaSourceConfig *MediaSourceConfig + + // The configuration that consists of the ScheduleExpression and the + // DurationInMinutes details that specify the scheduling to record from a camera, + // or local media file, onto the Edge Agent. If the ScheduleExpression attribute is + // not provided, then the Edge Agent will always be set to recording mode. + ScheduleConfig *ScheduleConfig + + noSmithyDocumentSerde +} + // An object that describes the endpoint of the signaling channel returned by the // GetSignalingChannelEndpoint API. type ResourceEndpointListItem struct { @@ -177,6 +286,33 @@ type ResourceEndpointListItem struct { noSmithyDocumentSerde } +// This API enables you to specify the duration that the camera, or local media +// file, should record onto the Edge Agent. The ScheduleConfig consists of the +// ScheduleExpression and the DurationInMinutes attributes. If the +// ScheduleExpression is not provided, then the Edge Agent will always be set to +// recording mode. +type ScheduleConfig struct { + + // The total duration to record the media. If the ScheduleExpression attribute is + // provided, then the DurationInSeconds attribute should also be specified. + // + // This member is required. + DurationInSeconds *int32 + + // The Quartz cron expression that takes care of scheduling jobs to record from the + // camera, or local media file, onto the Edge Agent. If the ScheduleExpression is + // not provided for the RecorderConfig, then the Edge Agent will always be set to + // recording mode. For more information about Quartz, refer to the Cron Trigger + // Tutorial + // (http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) + // page to understand the valid expressions and its use. + // + // This member is required. + ScheduleExpression *string + + noSmithyDocumentSerde +} + // An object that contains the endpoint configuration for the SINGLE_MASTER channel // type. type SingleMasterChannelEndpointConfiguration struct { @@ -273,4 +409,20 @@ type Tag struct { noSmithyDocumentSerde } +// The configuration that consists of the ScheduleConfig attribute that's required, +// to schedule the jobs to upload the recorded media files onto the Edge Agent in a +// Kinesis Video Stream. +type UploaderConfig struct { + + // The configuration that consists of the ScheduleExpression and the + // DurationInMinutesdetails that specify the scheduling to record from a camera, or + // local media file, onto the Edge Agent. If the ScheduleExpression is not + // provided, then the Edge Agent will always be in recording mode. + // + // This member is required. + ScheduleConfig *ScheduleConfig + + noSmithyDocumentSerde +} + type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/kinesisvideo/validators.go b/service/kinesisvideo/validators.go index c2b0232e8af..500b6e84e1d 100644 --- a/service/kinesisvideo/validators.go +++ b/service/kinesisvideo/validators.go @@ -150,6 +150,26 @@ func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpStartEdgeConfigurationUpdate struct { +} + +func (*validateOpStartEdgeConfigurationUpdate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartEdgeConfigurationUpdate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartEdgeConfigurationUpdateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartEdgeConfigurationUpdateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpTagResource struct { } @@ -358,6 +378,10 @@ func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) } +func addOpStartEdgeConfigurationUpdateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartEdgeConfigurationUpdate{}, middleware.After) +} + func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpTagResource{}, middleware.After) } @@ -394,6 +418,33 @@ func addOpUpdateStreamValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpUpdateStream{}, middleware.After) } +func validateEdgeConfig(v *types.EdgeConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "EdgeConfig"} + if v.HubDeviceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("HubDeviceArn")) + } + if v.RecorderConfig == nil { + invalidParams.Add(smithy.NewErrParamRequired("RecorderConfig")) + } else if v.RecorderConfig != nil { + if err := validateRecorderConfig(v.RecorderConfig); err != nil { + invalidParams.AddNested("RecorderConfig", err.(smithy.InvalidParamsError)) + } + } + if v.UploaderConfig != nil { + if err := validateUploaderConfig(v.UploaderConfig); err != nil { + invalidParams.AddNested("UploaderConfig", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateImageGenerationConfiguration(v *types.ImageGenerationConfiguration) error { if v == nil { return nil @@ -443,6 +494,24 @@ func validateImageGenerationDestinationConfig(v *types.ImageGenerationDestinatio } } +func validateMediaSourceConfig(v *types.MediaSourceConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MediaSourceConfig"} + if v.MediaUriSecretArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("MediaUriSecretArn")) + } + if len(v.MediaUriType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("MediaUriType")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateNotificationConfiguration(v *types.NotificationConfiguration) error { if v == nil { return nil @@ -480,6 +549,48 @@ func validateNotificationDestinationConfig(v *types.NotificationDestinationConfi } } +func validateRecorderConfig(v *types.RecorderConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RecorderConfig"} + if v.MediaSourceConfig == nil { + invalidParams.Add(smithy.NewErrParamRequired("MediaSourceConfig")) + } else if v.MediaSourceConfig != nil { + if err := validateMediaSourceConfig(v.MediaSourceConfig); err != nil { + invalidParams.AddNested("MediaSourceConfig", err.(smithy.InvalidParamsError)) + } + } + if v.ScheduleConfig != nil { + if err := validateScheduleConfig(v.ScheduleConfig); err != nil { + invalidParams.AddNested("ScheduleConfig", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateScheduleConfig(v *types.ScheduleConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ScheduleConfig"} + if v.ScheduleExpression == nil { + invalidParams.Add(smithy.NewErrParamRequired("ScheduleExpression")) + } + if v.DurationInSeconds == nil { + invalidParams.Add(smithy.NewErrParamRequired("DurationInSeconds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateTag(v *types.Tag) error { if v == nil { return nil @@ -532,6 +643,25 @@ func validateTagOnCreateList(v []types.Tag) error { } } +func validateUploaderConfig(v *types.UploaderConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UploaderConfig"} + if v.ScheduleConfig == nil { + invalidParams.Add(smithy.NewErrParamRequired("ScheduleConfig")) + } else if v.ScheduleConfig != nil { + if err := validateScheduleConfig(v.ScheduleConfig); err != nil { + invalidParams.AddNested("ScheduleConfig", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpCreateSignalingChannelInput(v *CreateSignalingChannelInput) error { if v == nil { return nil @@ -642,6 +772,25 @@ func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { } } +func validateOpStartEdgeConfigurationUpdateInput(v *StartEdgeConfigurationUpdateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartEdgeConfigurationUpdateInput"} + if v.EdgeConfig == nil { + invalidParams.Add(smithy.NewErrParamRequired("EdgeConfig")) + } else if v.EdgeConfig != nil { + if err := validateEdgeConfig(v.EdgeConfig); err != nil { + invalidParams.AddNested("EdgeConfig", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpTagResourceInput(v *TagResourceInput) error { if v == nil { return nil diff --git a/service/lookoutvision/api_op_StartModelPackagingJob.go b/service/lookoutvision/api_op_StartModelPackagingJob.go index 5f91a8c3885..c7f9c26a6f8 100644 --- a/service/lookoutvision/api_op_StartModelPackagingJob.go +++ b/service/lookoutvision/api_op_StartModelPackagingJob.go @@ -30,16 +30,19 @@ import ( // * s3:GetBucketLocation // // * -// greengrass:CreateComponentVersion +// kms:GenerateDataKey // -// * greengrass:DescribeComponent +// * greengrass:CreateComponentVersion // -// * (Optional) -// greengrass:TagResource. Only required if you want to tag the component. +// * +// greengrass:DescribeComponent +// +// * (Optional) greengrass:TagResource. Only required +// if you want to tag the component. // -// For -// more information, see Using your Amazon Lookout for Vision model on an edge -// device in the Amazon Lookout for Vision Developer Guide. +// For more information, see Using your Amazon +// Lookout for Vision model on an edge device in the Amazon Lookout for Vision +// Developer Guide. func (c *Client) StartModelPackagingJob(ctx context.Context, params *StartModelPackagingJobInput, optFns ...func(*Options)) (*StartModelPackagingJobOutput, error) { if params == nil { params = &StartModelPackagingJobInput{} diff --git a/service/m2/internal/endpoints/endpoints.go b/service/m2/internal/endpoints/endpoints.go index 87cb739cae6..535cb947c0b 100644 --- a/service/m2/internal/endpoints/endpoints.go +++ b/service/m2/internal/endpoints/endpoints.go @@ -150,6 +150,10 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ca-central-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + Variant: endpoints.FIPSVariant, + }: {}, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, @@ -162,15 +166,38 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "eu-west-3", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips-ca-central-1", + }: endpoints.Endpoint{ + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-east-1", + }: endpoints.Endpoint{ + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-west-2", + }: endpoints.Endpoint{ + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "sa-east-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "us-east-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + Variant: endpoints.FIPSVariant, + }: {}, endpoints.EndpointKey{ Region: "us-west-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + Variant: endpoints.FIPSVariant, + }: {}, }, }, { diff --git a/service/migrationhubrefactorspaces/api_op_CreateRoute.go b/service/migrationhubrefactorspaces/api_op_CreateRoute.go index fc61b08c920..2a2e3a02a9c 100644 --- a/service/migrationhubrefactorspaces/api_op_CreateRoute.go +++ b/service/migrationhubrefactorspaces/api_op_CreateRoute.go @@ -50,12 +50,16 @@ import ( // in the Lambda Developer Guide. For Lambda endpoints, a check is performed to // determine that a Lambda function with the specified ARN exists. If it does not // exist, the health check fails. For public URLs, a connection is opened to the -// public endpoint. If the URL is not reachable, the health check fails. For -// private URLS, a target group is created on the Elastic Load Balancing and the -// target group health check is run. The HealthCheckProtocol, HealthCheckPort, and -// HealthCheckPath are the same protocol, port, and path specified in the URL or -// health URL, if used. All other settings use the default values, as described in -// Health checks for your target groups +// public endpoint. If the URL is not reachable, the health check fails. Refactor +// Spaces automatically resolves the public Domain Name System (DNS) names that are +// set in CreateServiceRequest$UrlEndpoint when you create a service. The DNS names +// resolve when the DNS time-to-live (TTL) expires, or every 60 seconds for TTLs +// less than 60 seconds. This periodic DNS resolution ensures that the route +// configuration remains up-to-date. For private URLS, a target group is created on +// the Elastic Load Balancing and the target group health check is run. The +// HealthCheckProtocol, HealthCheckPort, and HealthCheckPath are the same protocol, +// port, and path specified in the URL or health URL, if used. All other settings +// use the default values, as described in Health checks for your target groups // (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html). // The health check is considered successful if at least one target within the // target group transitions to a healthy state. Services can have HTTP or HTTPS URL diff --git a/service/migrationhubrefactorspaces/api_op_CreateService.go b/service/migrationhubrefactorspaces/api_op_CreateService.go index 167cae623f6..62a9d60467c 100644 --- a/service/migrationhubrefactorspaces/api_op_CreateService.go +++ b/service/migrationhubrefactorspaces/api_op_CreateService.go @@ -73,7 +73,10 @@ type CreateServiceInput struct { // Web Services resource. Each tag consists of a key-value pair.. Tags map[string]string - // The configuration for the URL endpoint type. + // The configuration for the URL endpoint type. When creating a route to a service, + // Refactor Spaces automatically resolves the address in the UrlEndpointInput + // object URL when the Domain Name System (DNS) time-to-live (TTL) expires, or + // every 60 seconds for TTLs less than 60 seconds. UrlEndpoint *types.UrlEndpointInput // The ID of the VPC. diff --git a/service/migrationhubrefactorspaces/types/types.go b/service/migrationhubrefactorspaces/types/types.go index c85ed752f41..34e58e6d43b 100644 --- a/service/migrationhubrefactorspaces/types/types.go +++ b/service/migrationhubrefactorspaces/types/types.go @@ -247,7 +247,7 @@ type LambdaEndpointConfig struct { // The input for the Lambda endpoint type. type LambdaEndpointInput struct { - // The Amazon Resource Name (ARN) of the Lambda endpoint. + // The Amazon Resource Name (ARN) of the Lambda function or alias. // // This member is required. Arn *string diff --git a/service/mq/internal/endpoints/endpoints.go b/service/mq/internal/endpoints/endpoints.go index 270545b6c33..fc9aa7b2864 100644 --- a/service/mq/internal/endpoints/endpoints.go +++ b/service/mq/internal/endpoints/endpoints.go @@ -219,6 +219,9 @@ var defaultPartitions = endpoints.Partitions{ }, Deprecated: aws.TrueTernary, }, + endpoints.EndpointKey{ + Region: "me-central-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "me-south-1", }: endpoints.Endpoint{}, diff --git a/service/rds/api_op_CopyDBSnapshot.go b/service/rds/api_op_CopyDBSnapshot.go index f2c488b60a8..67097e9d44d 100644 --- a/service/rds/api_op_CopyDBSnapshot.go +++ b/service/rds/api_op_CopyDBSnapshot.go @@ -76,8 +76,14 @@ type CopyDBSnapshotInput struct { // This member is required. TargetDBSnapshotIdentifier *string + // A value that indicates whether to copy the DB option group associated with the + // source DB snapshot to the target Amazon Web Services account and associate with + // the target DB snapshot. The associated option group can be copied only with + // cross-account snapshot copy calls. + CopyOptionGroup *bool + // A value that indicates whether to copy all tags from the source DB snapshot to - // the target DB snapshot. By default, tags are not copied. + // the target DB snapshot. By default, tags aren't copied. CopyTags *bool // The Amazon Web Services KMS key identifier for an encrypted DB snapshot. The diff --git a/service/rds/deserializers.go b/service/rds/deserializers.go index 9faa89bd5f7..19217084582 100644 --- a/service/rds/deserializers.go +++ b/service/rds/deserializers.go @@ -38116,6 +38116,23 @@ func awsAwsquery_deserializeDocumentOptionGroup(v **types.OptionGroup, decoder s sv.AllowsVpcAndNonVpcInstanceMemberships = xtv } + case strings.EqualFold("CopyTimestamp", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.CopyTimestamp = ptr.Time(t) + } + case strings.EqualFold("EngineName", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -38187,6 +38204,32 @@ func awsAwsquery_deserializeDocumentOptionGroup(v **types.OptionGroup, decoder s return err } + case strings.EqualFold("SourceAccountId", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + sv.SourceAccountId = ptr.String(xtv) + } + + case strings.EqualFold("SourceOptionGroup", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + sv.SourceOptionGroup = ptr.String(xtv) + } + case strings.EqualFold("VpcId", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -38464,6 +38507,22 @@ func awsAwsquery_deserializeDocumentOptionGroupOption(v **types.OptionGroupOptio originalDecoder := decoder decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) switch { + case strings.EqualFold("CopyableCrossAccount", 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 BooleanOptional to be of type *bool, got %T instead", val) + } + sv.CopyableCrossAccount = ptr.Bool(xtv) + } + case strings.EqualFold("DefaultPort", t.Name.Local): val, err := decoder.Value() if err != nil { diff --git a/service/rds/serializers.go b/service/rds/serializers.go index 46aa65c2742..8a3dff942f6 100644 --- a/service/rds/serializers.go +++ b/service/rds/serializers.go @@ -9968,6 +9968,11 @@ func awsAwsquery_serializeOpDocumentCopyDBSnapshotInput(v *CopyDBSnapshotInput, object := value.Object() _ = object + if v.CopyOptionGroup != nil { + objectKey := object.Key("CopyOptionGroup") + objectKey.Boolean(*v.CopyOptionGroup) + } + if v.CopyTags != nil { objectKey := object.Key("CopyTags") objectKey.Boolean(*v.CopyTags) diff --git a/service/rds/types/types.go b/service/rds/types/types.go index f7820122cf8..e639455c6b2 100644 --- a/service/rds/types/types.go +++ b/service/rds/types/types.go @@ -2836,13 +2836,16 @@ type OptionGroup struct { // and non-VPC instances. AllowsVpcAndNonVpcInstanceMemberships bool + // Indicates when the option group was copied. + CopyTimestamp *time.Time + // Indicates the name of the engine that this option group can be applied to. EngineName *string // Indicates the major engine version associated with this option group. MajorEngineVersion *string - // The Amazon Resource Name (ARN) for the option group. + // Specifies the Amazon Resource Name (ARN) for the option group. OptionGroupArn *string // Provides a description of the option group. @@ -2854,6 +2857,13 @@ type OptionGroup struct { // Indicates what options are available in the option group. Options []Option + // Specifies the Amazon Web Services account ID for the option group from which + // this option group is copied. + SourceAccountId *string + + // Specifies the name of the option group from which this option group is copied. + SourceOptionGroup *string + // If AllowsVpcAndNonVpcInstanceMemberships is false, this field is blank. If // AllowsVpcAndNonVpcInstanceMemberships is true and this field is blank, then this // option group can be applied to both VPC and non-VPC instances. If this field @@ -2881,6 +2891,9 @@ type OptionGroupMembership struct { // Available option. type OptionGroupOption struct { + // Specifies whether the option can be copied across Amazon Web Services accounts. + CopyableCrossAccount *bool + // If the option requires a port, specifies the default port for the option. DefaultPort *int32 diff --git a/service/rekognition/api_op_DetectLabels.go b/service/rekognition/api_op_DetectLabels.go index d03aa2d2699..a9d6a5915e1 100644 --- a/service/rekognition/api_op_DetectLabels.go +++ b/service/rekognition/api_op_DetectLabels.go @@ -54,56 +54,57 @@ import ( // Possible Aliases for the label. // // * Categories - The label categories that the -// detected label belongs to. A given label can belong to more than one -// category. +// detected label belongs to. // -// * BoundingBox — Bounding boxes are described for all instances of -// detected common object labels, returned in an array of Instance objects. An -// Instance object contains a BoundingBox object, describing the location of the -// label on the input image. It also includes the confidence for the accuracy of -// the detected bounding box. +// * BoundingBox — Bounding boxes are described for all +// instances of detected common object labels, returned in an array of Instance +// objects. An Instance object contains a BoundingBox object, describing the +// location of the label on the input image. It also includes the confidence for +// the accuracy of the detected bounding box. // -// The API returns the following information regarding -// the image, as part of the ImageProperties structure: +// The API returns the following +// information regarding the image, as part of the ImageProperties structure: // -// * Quality - Information -// about the Sharpness, Brightness, and Contrast of the input image, scored between -// 0 to 100. Image quality is returned for the entire image, as well as the -// background and the foreground. +// * +// Quality - Information about the Sharpness, Brightness, and Contrast of the input +// image, scored between 0 to 100. Image quality is returned for the entire image, +// as well as the background and the foreground. // -// * Dominant Color - An array of the dominant -// colors in the image. +// * Dominant Color - An array of +// the dominant colors in the image. // -// * Foreground - Information about the Sharpness and -// Brightness of the input image’s foreground. +// * Foreground - Information about the +// sharpness, brightness, and dominant colors of the input image’s foreground. // -// * Background - Information about -// the Sharpness and Brightness of the input image’s background. +// * +// Background - Information about the sharpness, brightness, and dominant colors of +// the input image’s background. // -// The list of -// returned labels will include at least one label for every detected object, along -// with information about that label. In the following example, suppose the input -// image has a lighthouse, the sea, and a rock. The response includes all three -// labels, one for each object, as well as the confidence in the label: {Name: -// lighthouse, Confidence: 98.4629} +// The list of returned labels will include at least +// one label for every detected object, along with information about that label. In +// the following example, suppose the input image has a lighthouse, the sea, and a +// rock. The response includes all three labels, one for each object, as well as +// the confidence in the label: {Name: lighthouse, Confidence: 98.4629} // -// {Name: rock,Confidence: 79.2097} +// {Name: // -// {Name: -// sea,Confidence: 75.061} The list of labels can include multiple labels for the -// same object. For example, if the input image shows a flower (for example, a -// tulip), the operation might return the following three labels. {Name: -// flower,Confidence: 99.0562} +// rock,Confidence: 79.2097} // -// {Name: plant,Confidence: 99.0562} +// {Name: sea,Confidence: 75.061} The list of labels can +// include multiple labels for the same object. For example, if the input image +// shows a flower (for example, a tulip), the operation might return the following +// three labels. {Name: flower,Confidence: 99.0562} // -// {Name: -// tulip,Confidence: 99.0562} In this example, the detection algorithm more -// precisely identifies the flower as a tulip. If the object detected is a person, -// the operation doesn't provide the same facial details that the DetectFaces -// operation provides. This is a stateless API operation. That is, the operation -// does not persist any data. This operation requires permissions to perform the -// rekognition:DetectLabels action. +// {Name: plant,Confidence: +// +// 99.0562} +// +// {Name: tulip,Confidence: 99.0562} In this example, the detection +// algorithm more precisely identifies the flower as a tulip. If the object +// detected is a person, the operation doesn't provide the same facial details that +// the DetectFaces operation provides. This is a stateless API operation. That is, +// the operation does not persist any data. This operation requires permissions to +// perform the rekognition:DetectLabels action. func (c *Client) DetectLabels(ctx context.Context, params *DetectLabelsInput, optFns ...func(*Options)) (*DetectLabelsOutput, error) { if params == nil { params = &DetectLabelsInput{} diff --git a/service/rekognition/api_op_GetFaceSearch.go b/service/rekognition/api_op_GetFaceSearch.go index da6c7da107b..38eaa8ac9e0 100644 --- a/service/rekognition/api_op_GetFaceSearch.go +++ b/service/rekognition/api_op_GetFaceSearch.go @@ -28,9 +28,7 @@ import ( // about the matching faces in the input collection, person information (facial // attributes, bounding boxes, and person identifer) for the matched person, and // the time the person was matched in the video. GetFaceSearch only returns the -// default -// -// facial attributes (BoundingBox, Confidence, Landmarks, Pose, and +// default facial attributes (BoundingBox, Confidence, Landmarks, Pose, and // Quality). The other facial attributes listed in the Face object of the following // response syntax are not returned. For more information, see FaceDetail in the // Amazon Rekognition Developer Guide. By default, the Persons array is sorted by diff --git a/service/rekognition/api_op_GetLabelDetection.go b/service/rekognition/api_op_GetLabelDetection.go index 4cae816eac7..eb3eb689aaf 100644 --- a/service/rekognition/api_op_GetLabelDetection.go +++ b/service/rekognition/api_op_GetLabelDetection.go @@ -23,16 +23,56 @@ import ( // from the initial call to StartLabelDetection. GetLabelDetection returns an array // of detected labels (Labels) sorted by the time the labels were detected. You can // also sort by the label name by specifying NAME for the SortBy input parameter. -// The labels returned include the label name, the percentage confidence in the -// accuracy of the detected label, and the time the label was detected in the -// video. The returned labels also include bounding box information for common -// objects, a hierarchical taxonomy of detected labels, and the version of the -// label model used for detection. Use MaxResults parameter to limit the number of -// labels returned. If there are more results than specified in MaxResults, the -// value of NextToken in the operation response contains a pagination token for -// getting the next set of results. To get the next page of results, call -// GetlabelDetection and populate the NextToken request parameter with the token -// value returned from the previous call to GetLabelDetection. +// If there is no NAME specified, the default sort is by timestamp. You can select +// how results are aggregated by using the AggregateBy input parameter. The default +// aggregation method is TIMESTAMPS. You can also aggregate by SEGMENTS, which +// aggregates all instances of labels detected in a given segment. The returned +// Labels array may include the following attributes: +// +// * Name - The name of the +// detected label. +// +// * Confidence - The level of confidence in the label assigned to +// a detected object. +// +// * Parents - The ancestor labels for a detected label. +// GetLabelDetection returns a hierarchical taxonomy of detected labels. For +// example, a detected car might be assigned the label car. The label car has two +// parent labels: Vehicle (its parent) and Transportation (its grandparent). The +// response includes the all ancestors for a label, where every ancestor is a +// unique label. In the previous example, Car, Vehicle, and Transportation are +// returned as unique labels in the response. +// +// * Aliases - Possible Aliases for the +// label. +// +// * Categories - The label categories that the detected label belongs +// to. +// +// * BoundingBox — Bounding boxes are described for all instances of detected +// common object labels, returned in an array of Instance objects. An Instance +// object contains a BoundingBox object, describing the location of the label on +// the input image. It also includes the confidence for the accuracy of the +// detected bounding box. +// +// * Timestamp - Time, in milliseconds from the start of +// the video, that the label was detected. For aggregation by SEGMENTS, the +// StartTimestampMillis, EndTimestampMillis, and DurationMillis structures are what +// define a segment. Although the “Timestamp” structure is still returned with each +// label, its value is set to be the same as StartTimestampMillis. +// +// Timestamp and +// Bounding box information are returned for detected Instances, only if +// aggregation is done by TIMESTAMPS. If aggregating by SEGMENTS, information about +// detected instances isn’t returned. The version of the label model used for the +// detection is also returned. Note DominantColors isn't returned for Instances, +// although it is shown as part of the response in the sample seen below. Use +// MaxResults parameter to limit the number of labels returned. If there are more +// results than specified in MaxResults, the value of NextToken in the operation +// response contains a pagination token for getting the next set of results. To get +// the next page of results, call GetlabelDetection and populate the NextToken +// request parameter with the token value returned from the previous call to +// GetLabelDetection. func (c *Client) GetLabelDetection(ctx context.Context, params *GetLabelDetectionInput, optFns ...func(*Options)) (*GetLabelDetectionOutput, error) { if params == nil { params = &GetLabelDetectionInput{} @@ -56,6 +96,10 @@ type GetLabelDetectionInput struct { // This member is required. JobId *string + // Defines how to aggregate the returned results. Results can be aggregated by + // timestamps or segments. + AggregateBy types.LabelDetectionAggregateBy + // Maximum number of results to return per paginated call. The largest value you // can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 // results is returned. The default value is 1000. diff --git a/service/rekognition/api_op_GetPersonTracking.go b/service/rekognition/api_op_GetPersonTracking.go index d03501cbd76..6ca33f7dc2a 100644 --- a/service/rekognition/api_op_GetPersonTracking.go +++ b/service/rekognition/api_op_GetPersonTracking.go @@ -22,9 +22,7 @@ import ( // SUCCEEDED. If so, call GetPersonTracking and pass the job identifier (JobId) // from the initial call to StartPersonTracking. GetPersonTracking returns an // array, Persons, of tracked persons and the time(s) their paths were tracked in -// the video. GetPersonTracking only returns the default -// -// facial attributes +// the video. GetPersonTracking only returns the default facial attributes // (BoundingBox, Confidence, Landmarks, Pose, and Quality). The other facial // attributes listed in the Face object of the following response syntax are not // returned. For more information, see FaceDetail in the Amazon Rekognition diff --git a/service/rekognition/api_op_StartLabelDetection.go b/service/rekognition/api_op_StartLabelDetection.go index c2f35390615..b121507b853 100644 --- a/service/rekognition/api_op_StartLabelDetection.go +++ b/service/rekognition/api_op_StartLabelDetection.go @@ -24,7 +24,15 @@ import ( // get the results of the label detection operation, first check that the status // value published to the Amazon SNS topic is SUCCEEDED. If so, call // GetLabelDetection and pass the job identifier (JobId) from the initial call to -// StartLabelDetection. +// StartLabelDetection. Optional Parameters StartLabelDetection has the +// GENERAL_LABELS Feature applied by default. This feature allows you to provide +// filtering criteria to the Settings parameter. You can filter with sets of +// individual labels or with label categories. You can specify inclusive filters, +// exclusive filters, or a combination of inclusive and exclusive filters. For more +// information on filtering, see Detecting labels in a video +// (https://docs.aws.amazon.com/rekognition/latest/dg/labels-detecting-labels-video.html). +// You can specify MinConfidence to control the confidence threshold for the labels +// returned. The default is 50. func (c *Client) StartLabelDetection(ctx context.Context, params *StartLabelDetectionInput, optFns ...func(*Options)) (*StartLabelDetectionOutput, error) { if params == nil { params = &StartLabelDetectionInput{} @@ -54,6 +62,10 @@ type StartLabelDetectionInput struct { // than once. ClientRequestToken *string + // The features to return after video analysis. You can specify that GENERAL_LABELS + // are returned. + Features []types.LabelDetectionFeatureName + // An identifier you specify that's returned in the completion notification that's // published to your Amazon Simple Notification Service topic. For example, you can // use JobTag to group related jobs and identify them in the completion @@ -65,8 +77,8 @@ type StartLabelDetectionInput struct { // Rekognition is that a label is correctly identified.0 is the lowest confidence. // 100 is the highest confidence. Amazon Rekognition Video doesn't return any // labels with a confidence level lower than this specified value. If you don't - // specify MinConfidence, the operation returns labels with confidence values - // greater than or equal to 50 percent. + // specify MinConfidence, the operation returns labels and bounding boxes (if + // detected) with confidence values greater than or equal to 50 percent. MinConfidence *float32 // The Amazon SNS topic ARN you want Amazon Rekognition Video to publish the @@ -75,6 +87,11 @@ type StartLabelDetectionInput struct { // AmazonRekognitionServiceRole permissions policy. NotificationChannel *types.NotificationChannel + // The settings for a StartLabelDetection request.Contains the specified parameters + // for the label detection request of an asynchronous label analysis operation. + // Settings can include filters for GENERAL_LABELS. + Settings *types.LabelDetectionSettings + noSmithyDocumentSerde } diff --git a/service/rekognition/deserializers.go b/service/rekognition/deserializers.go index 76b0796e3d3..b2a51732c4d 100644 --- a/service/rekognition/deserializers.go +++ b/service/rekognition/deserializers.go @@ -14057,11 +14057,50 @@ func awsAwsjson11_deserializeDocumentLabelDetection(v **types.LabelDetection, va for key, value := range shape { switch key { + case "DurationMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ULong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.DurationMillis = ptr.Int64(i64) + } + + case "EndTimestampMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ULong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EndTimestampMillis = ptr.Int64(i64) + } + case "Label": if err := awsAwsjson11_deserializeDocumentLabel(&sv.Label, value); err != nil { return err } + case "StartTimestampMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected ULong to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.StartTimestampMillis = ptr.Int64(i64) + } + case "Timestamp": if value != nil { jtv, ok := value.(json.Number) diff --git a/service/rekognition/serializers.go b/service/rekognition/serializers.go index 795b8ce4f17..59e1644c0bd 100644 --- a/service/rekognition/serializers.go +++ b/service/rekognition/serializers.go @@ -4118,6 +4118,31 @@ func awsAwsjson11_serializeDocumentKinesisVideoStreamStartSelector(v *types.Kine return nil } +func awsAwsjson11_serializeDocumentLabelDetectionFeatureList(v []types.LabelDetectionFeatureName, 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 awsAwsjson11_serializeDocumentLabelDetectionSettings(v *types.LabelDetectionSettings, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.GeneralLabels != nil { + ok := object.Key("GeneralLabels") + if err := awsAwsjson11_serializeDocumentGeneralLabelsSettings(v.GeneralLabels, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeDocumentNotificationChannel(v *types.NotificationChannel, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -5440,6 +5465,11 @@ func awsAwsjson11_serializeOpDocumentGetLabelDetectionInput(v *GetLabelDetection object := value.Object() defer object.Close() + if len(v.AggregateBy) > 0 { + ok := object.Key("AggregateBy") + ok.String(string(v.AggregateBy)) + } + if v.JobId != nil { ok := object.Key("JobId") ok.String(*v.JobId) @@ -6038,6 +6068,13 @@ func awsAwsjson11_serializeOpDocumentStartLabelDetectionInput(v *StartLabelDetec ok.String(*v.ClientRequestToken) } + if v.Features != nil { + ok := object.Key("Features") + if err := awsAwsjson11_serializeDocumentLabelDetectionFeatureList(v.Features, ok); err != nil { + return err + } + } + if v.JobTag != nil { ok := object.Key("JobTag") ok.String(*v.JobTag) @@ -6068,6 +6105,13 @@ func awsAwsjson11_serializeOpDocumentStartLabelDetectionInput(v *StartLabelDetec } } + if v.Settings != nil { + ok := object.Key("Settings") + if err := awsAwsjson11_serializeDocumentLabelDetectionSettings(v.Settings, ok); err != nil { + return err + } + } + if v.Video != nil { ok := object.Key("Video") if err := awsAwsjson11_serializeDocumentVideo(v.Video, ok); err != nil { diff --git a/service/rekognition/types/enums.go b/service/rekognition/types/enums.go index fab9ea087b0..354112e1c30 100644 --- a/service/rekognition/types/enums.go +++ b/service/rekognition/types/enums.go @@ -288,6 +288,40 @@ func (KnownGenderType) Values() []KnownGenderType { } } +type LabelDetectionAggregateBy string + +// Enum values for LabelDetectionAggregateBy +const ( + LabelDetectionAggregateByTimestamps LabelDetectionAggregateBy = "TIMESTAMPS" + LabelDetectionAggregateBySegments LabelDetectionAggregateBy = "SEGMENTS" +) + +// Values returns all known values for LabelDetectionAggregateBy. 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 (LabelDetectionAggregateBy) Values() []LabelDetectionAggregateBy { + return []LabelDetectionAggregateBy{ + "TIMESTAMPS", + "SEGMENTS", + } +} + +type LabelDetectionFeatureName string + +// Enum values for LabelDetectionFeatureName +const ( + LabelDetectionFeatureNameGeneralLabels LabelDetectionFeatureName = "GENERAL_LABELS" +) + +// Values returns all known values for LabelDetectionFeatureName. 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 (LabelDetectionFeatureName) Values() []LabelDetectionFeatureName { + return []LabelDetectionFeatureName{ + "GENERAL_LABELS", + } +} + type LabelDetectionSortBy string // Enum values for LabelDetectionSortBy diff --git a/service/rekognition/types/types.go b/service/rekognition/types/types.go index abc5f6c5062..97798ad2a7c 100644 --- a/service/rekognition/types/types.go +++ b/service/rekognition/types/types.go @@ -775,7 +775,7 @@ type Face struct { // which attributes to return, use the FaceAttributes input parameter for // StartFaceDetection. The following Amazon Rekognition Video operations return // only the default attributes. The corresponding Start operations don't have a -// FaceAttributes input parameter. +// FaceAttributes input parameter: // // * GetCelebrityRecognition // @@ -1195,9 +1195,21 @@ type LabelCategory struct { // label was detected in the video. type LabelDetection struct { + // The time duration of a segment in milliseconds, I.e. time elapsed from + // StartTimestampMillis to EndTimestampMillis. + DurationMillis *int64 + + // The time in milliseconds defining the end of the timeline segment containing a + // continuously detected label. + EndTimestampMillis *int64 + // Details about the detected label. Label *Label + // The time in milliseconds defining the start of the timeline segment containing a + // continuously detected label. + StartTimestampMillis *int64 + // Time, in milliseconds from the start of the video, that the label was detected. // Note that Timestamp is not guaranteed to be accurate to the individual frame // where the label first appears. @@ -1206,6 +1218,18 @@ type LabelDetection struct { noSmithyDocumentSerde } +// Contains the specified filters that should be applied to a list of returned +// GENERAL_LABELS. +type LabelDetectionSettings struct { + + // Contains filters for the object labels returned by DetectLabels. Filters can be + // inclusive, exclusive, or a combination of both and can be applied to individual + // l abels or entire label categories. + GeneralLabels *GeneralLabelsSettings + + noSmithyDocumentSerde +} + // Indicates the location of the landmark on the face. type Landmark struct { diff --git a/service/sagemakermetrics/LICENSE.txt b/service/sagemakermetrics/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/sagemakermetrics/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/sagemakermetrics/api_client.go b/service/sagemakermetrics/api_client.go new file mode 100644 index 00000000000..f55be9969a6 --- /dev/null +++ b/service/sagemakermetrics/api_client.go @@ -0,0 +1,434 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +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 = "SageMaker Metrics" +const ServiceAPIVersion = "2022-09-30" + +// Client provides the API client to make operations call for Amazon SageMaker +// Metrics Service. +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, "sagemakermetrics", 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/sagemakermetrics/api_client_test.go b/service/sagemakermetrics/api_client_test.go new file mode 100644 index 00000000000..a8027483b41 --- /dev/null +++ b/service/sagemakermetrics/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +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/sagemakermetrics/api_op_BatchPutMetrics.go b/service/sagemakermetrics/api_op_BatchPutMetrics.go new file mode 100644 index 00000000000..4e558c56bd6 --- /dev/null +++ b/service/sagemakermetrics/api_op_BatchPutMetrics.go @@ -0,0 +1,127 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +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/sagemakermetrics/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Used to ingest training metrics into SageMaker which can be visualized in +// SageMaker Studio and retrieved with the GetMetrics API. +func (c *Client) BatchPutMetrics(ctx context.Context, params *BatchPutMetricsInput, optFns ...func(*Options)) (*BatchPutMetricsOutput, error) { + if params == nil { + params = &BatchPutMetricsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "BatchPutMetrics", params, optFns, c.addOperationBatchPutMetricsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*BatchPutMetricsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type BatchPutMetricsInput struct { + + // A list of raw metric values to put. + // + // This member is required. + MetricData []types.RawMetricData + + // The name of Trial Component to associate the metrics with. + // + // This member is required. + TrialComponentName *string + + noSmithyDocumentSerde +} + +type BatchPutMetricsOutput struct { + + // Any errors that occur when inserting metric data will appear in this. + Errors []types.BatchPutMetricsError + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationBatchPutMetricsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpBatchPutMetrics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpBatchPutMetrics{}, 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 = addOpBatchPutMetricsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchPutMetrics(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_opBatchPutMetrics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "sagemaker", + OperationName: "BatchPutMetrics", + } +} diff --git a/service/sagemakermetrics/deserializers.go b/service/sagemakermetrics/deserializers.go new file mode 100644 index 00000000000..f9782575d4f --- /dev/null +++ b/service/sagemakermetrics/deserializers.go @@ -0,0 +1,248 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/sagemakermetrics/types" + smithy "github.com/aws/smithy-go" + smithyio "github.com/aws/smithy-go/io" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" +) + +type awsRestjson1_deserializeOpBatchPutMetrics struct { +} + +func (*awsRestjson1_deserializeOpBatchPutMetrics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpBatchPutMetrics) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorBatchPutMetrics(response, &metadata) + } + output := &BatchPutMetricsOutput{} + 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_deserializeOpDocumentBatchPutMetricsOutput(&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_deserializeOpErrorBatchPutMetrics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != 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 { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentBatchPutMetricsOutput(v **BatchPutMetricsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *BatchPutMetricsOutput + if *v == nil { + sv = &BatchPutMetricsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Errors": + if err := awsRestjson1_deserializeDocumentBatchPutMetricsErrorList(&sv.Errors, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentBatchPutMetricsError(v **types.BatchPutMetricsError, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.BatchPutMetricsError + if *v == nil { + sv = &types.BatchPutMetricsError{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PutMetricsErrorCode to be of type string, got %T instead", value) + } + sv.Code = types.PutMetricsErrorCode(jtv) + } + + case "MetricIndex": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MetricIndex = int32(i64) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentBatchPutMetricsErrorList(v *[]types.BatchPutMetricsError, 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.BatchPutMetricsError + if *v == nil { + cv = []types.BatchPutMetricsError{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.BatchPutMetricsError + destAddr := &col + if err := awsRestjson1_deserializeDocumentBatchPutMetricsError(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} diff --git a/service/sagemakermetrics/doc.go b/service/sagemakermetrics/doc.go new file mode 100644 index 00000000000..c4fdbf15d85 --- /dev/null +++ b/service/sagemakermetrics/doc.go @@ -0,0 +1,12 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package sagemakermetrics provides the API client, operations, and parameter +// types for Amazon SageMaker Metrics Service. +// +// Contains all data plane API operations and data types for Amazon SageMaker +// Metrics. Use these APIs to put and retrieve (get) features related to your +// training run. +// +// * BatchPutMetrics +// (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_metrics_BatchPutMetrics.html) +package sagemakermetrics diff --git a/service/sagemakermetrics/endpoints.go b/service/sagemakermetrics/endpoints.go new file mode 100644 index 00000000000..7ea962556d5 --- /dev/null +++ b/service/sagemakermetrics/endpoints.go @@ -0,0 +1,200 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +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/sagemakermetrics/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 = "sagemaker" + } + 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/sagemakermetrics/generated.json b/service/sagemakermetrics/generated.json new file mode 100644 index 00000000000..dfecab270ef --- /dev/null +++ b/service/sagemakermetrics/generated.json @@ -0,0 +1,27 @@ +{ + "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_BatchPutMetrics.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/types.go", + "validators.go" + ], + "go": "1.15", + "module": "github.com/aws/aws-sdk-go-v2/service/sagemakermetrics", + "unstable": false +} diff --git a/service/sagemakermetrics/go.mod b/service/sagemakermetrics/go.mod new file mode 100644 index 00000000000..b4af044cd19 --- /dev/null +++ b/service/sagemakermetrics/go.mod @@ -0,0 +1,16 @@ +module github.com/aws/aws-sdk-go-v2/service/sagemakermetrics + +go 1.15 + +require ( + github.com/aws/aws-sdk-go-v2 v1.17.2 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 + github.com/aws/smithy-go v1.13.5 +) + +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/sagemakermetrics/go.sum b/service/sagemakermetrics/go.sum new file mode 100644 index 00000000000..6f859610e44 --- /dev/null +++ b/service/sagemakermetrics/go.sum @@ -0,0 +1,11 @@ +github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/service/sagemakermetrics/go_module_metadata.go b/service/sagemakermetrics/go_module_metadata.go new file mode 100644 index 00000000000..ccfdbf38b31 --- /dev/null +++ b/service/sagemakermetrics/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package sagemakermetrics + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/sagemakermetrics/internal/endpoints/endpoints.go b/service/sagemakermetrics/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..c8fb3ea8902 --- /dev/null +++ b/service/sagemakermetrics/internal/endpoints/endpoints.go @@ -0,0 +1,341 @@ +// 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 SageMaker Metrics 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: "metrics.sagemaker.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "metrics.sagemaker.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "af-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-3", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-3", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-north-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "me-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "me-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "sa-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + }: endpoints.Endpoint{}, + }, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "metrics.sagemaker.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "metrics.sagemaker.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsCn, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "cn-north-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "cn-northwest-1", + }: endpoints.Endpoint{}, + }, + }, + { + ID: "aws-iso", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "metrics.sagemaker.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIso, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "us-iso-east-1", + }: endpoints.Endpoint{}, + }, + }, + { + ID: "aws-iso-b", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "metrics.sagemaker.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "us-isob-east-1", + }: endpoints.Endpoint{}, + }, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "metrics.sagemaker.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "metrics.sagemaker-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "metrics.sagemaker.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "us-gov-west-1", + }: endpoints.Endpoint{}, + }, + }, +} diff --git a/service/sagemakermetrics/internal/endpoints/endpoints_test.go b/service/sagemakermetrics/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/sagemakermetrics/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/sagemakermetrics/protocol_test.go b/service/sagemakermetrics/protocol_test.go new file mode 100644 index 00000000000..a79a85d7604 --- /dev/null +++ b/service/sagemakermetrics/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics diff --git a/service/sagemakermetrics/serializers.go b/service/sagemakermetrics/serializers.go new file mode 100644 index 00000000000..9a3f53a2bd0 --- /dev/null +++ b/service/sagemakermetrics/serializers.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/sagemakermetrics/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/encoding/httpbinding" + smithyjson "github.com/aws/smithy-go/encoding/json" + "github.com/aws/smithy-go/middleware" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "math" +) + +type awsRestjson1_serializeOpBatchPutMetrics struct { +} + +func (*awsRestjson1_serializeOpBatchPutMetrics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpBatchPutMetrics) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*BatchPutMetricsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/BatchPutMetrics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + 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_serializeOpDocumentBatchPutMetricsInput(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_serializeOpHttpBindingsBatchPutMetricsInput(v *BatchPutMetricsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentBatchPutMetricsInput(v *BatchPutMetricsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetricData != nil { + ok := object.Key("MetricData") + if err := awsRestjson1_serializeDocumentRawMetricDataList(v.MetricData, ok); err != nil { + return err + } + } + + if v.TrialComponentName != nil { + ok := object.Key("TrialComponentName") + ok.String(*v.TrialComponentName) + } + + return nil +} + +func awsRestjson1_serializeDocumentRawMetricData(v *types.RawMetricData, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MetricName != nil { + ok := object.Key("MetricName") + ok.String(*v.MetricName) + } + + if v.Step != nil { + ok := object.Key("Step") + ok.Integer(*v.Step) + } + + if v.Timestamp != nil { + ok := object.Key("Timestamp") + ok.Double(smithytime.FormatEpochSeconds(*v.Timestamp)) + } + + { + ok := object.Key("Value") + switch { + case math.IsNaN(v.Value): + ok.String("NaN") + + case math.IsInf(v.Value, 1): + ok.String("Infinity") + + case math.IsInf(v.Value, -1): + ok.String("-Infinity") + + default: + ok.Double(v.Value) + + } + } + + return nil +} + +func awsRestjson1_serializeDocumentRawMetricDataList(v []types.RawMetricData, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentRawMetricData(&v[i], av); err != nil { + return err + } + } + return nil +} diff --git a/service/sagemakermetrics/types/enums.go b/service/sagemakermetrics/types/enums.go new file mode 100644 index 00000000000..035944b9486 --- /dev/null +++ b/service/sagemakermetrics/types/enums.go @@ -0,0 +1,25 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type PutMetricsErrorCode string + +// Enum values for PutMetricsErrorCode +const ( + PutMetricsErrorCodeMetricLimitExceeded PutMetricsErrorCode = "METRIC_LIMIT_EXCEEDED" + PutMetricsErrorCodeInternalError PutMetricsErrorCode = "INTERNAL_ERROR" + PutMetricsErrorCodeValidationError PutMetricsErrorCode = "VALIDATION_ERROR" + PutMetricsErrorCodeConflictError PutMetricsErrorCode = "CONFLICT_ERROR" +) + +// Values returns all known values for PutMetricsErrorCode. 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 (PutMetricsErrorCode) Values() []PutMetricsErrorCode { + return []PutMetricsErrorCode{ + "METRIC_LIMIT_EXCEEDED", + "INTERNAL_ERROR", + "VALIDATION_ERROR", + "CONFLICT_ERROR", + } +} diff --git a/service/sagemakermetrics/types/types.go b/service/sagemakermetrics/types/types.go new file mode 100644 index 00000000000..1682f237648 --- /dev/null +++ b/service/sagemakermetrics/types/types.go @@ -0,0 +1,58 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// An error that occured when putting the metric data. +type BatchPutMetricsError struct { + + // The error code of an error that occured when attempting to put metrics. + // + // * + // METRIC_LIMIT_EXCEEDED - The max amount of metrics per resource has been + // exceeded. + // + // * INTERNAL_ERROR - An internal error occured. + // + // * VALIDATION_ERROR - + // The metric data failed validation. + // + // * CONFLICT_ERROR - Multiple requests + // attempted to modify the same data simultaneously. + Code PutMetricsErrorCode + + // An index that corresponds to the metric in the request. + MetricIndex int32 + + noSmithyDocumentSerde +} + +// The raw metric data to associate with the resource. +type RawMetricData struct { + + // The name of the metric. + // + // This member is required. + MetricName *string + + // The time when the metric was recorded. + // + // This member is required. + Timestamp *time.Time + + // The metric value. + // + // This member is required. + Value float64 + + // Metric step (aka Epoch). + Step *int32 + + noSmithyDocumentSerde +} + +type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/sagemakermetrics/validators.go b/service/sagemakermetrics/validators.go new file mode 100644 index 00000000000..da08138ed71 --- /dev/null +++ b/service/sagemakermetrics/validators.go @@ -0,0 +1,92 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package sagemakermetrics + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/sagemakermetrics/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpBatchPutMetrics struct { +} + +func (*validateOpBatchPutMetrics) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpBatchPutMetrics) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*BatchPutMetricsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpBatchPutMetricsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpBatchPutMetricsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpBatchPutMetrics{}, middleware.After) +} + +func validateRawMetricData(v *types.RawMetricData) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RawMetricData"} + if v.MetricName == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetricName")) + } + if v.Timestamp == nil { + invalidParams.Add(smithy.NewErrParamRequired("Timestamp")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRawMetricDataList(v []types.RawMetricData) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RawMetricDataList"} + for i := range v { + if err := validateRawMetricData(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpBatchPutMetricsInput(v *BatchPutMetricsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "BatchPutMetricsInput"} + if v.TrialComponentName == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrialComponentName")) + } + if v.MetricData == nil { + invalidParams.Add(smithy.NewErrParamRequired("MetricData")) + } else if v.MetricData != nil { + if err := validateRawMetricDataList(v.MetricData); err != nil { + invalidParams.AddNested("MetricData", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/wafv2/api_op_CreateWebACL.go b/service/wafv2/api_op_CreateWebACL.go index b85216091d2..ef80742c86d 100644 --- a/service/wafv2/api_op_CreateWebACL.go +++ b/service/wafv2/api_op_CreateWebACL.go @@ -112,7 +112,8 @@ type CreateWebACLInput struct { // only for the domain of the protected resource. With a token domain list, WAF // accepts the resource's host domain plus all domains in the token domain list, // including their prefixed subdomains. Example JSON: "TokenDomains": { - // "mywebsite.com", "myotherwebsite.com" } + // "mywebsite.com", "myotherwebsite.com" } Public suffixes aren't allowed. For + // example, you can't use usa.gov or co.uk as token domains. TokenDomains []string noSmithyDocumentSerde diff --git a/service/wafv2/api_op_PutLoggingConfiguration.go b/service/wafv2/api_op_PutLoggingConfiguration.go index bc4230e861f..5db72e869e8 100644 --- a/service/wafv2/api_op_PutLoggingConfiguration.go +++ b/service/wafv2/api_op_PutLoggingConfiguration.go @@ -18,9 +18,11 @@ import ( // // * Create your logging destination. You can use an // Amazon CloudWatch Logs log group, an Amazon Simple Storage Service (Amazon S3) -// bucket, or an Amazon Kinesis Data Firehose. For information about configuring -// logging destinations and the permissions that are required for each, see Logging -// web ACL traffic information +// bucket, or an Amazon Kinesis Data Firehose. The name that you give the +// destination must start with aws-waf-logs-. Depending on the type of destination, +// you might need to configure additional settings or permissions. For +// configuration requirements and pricing information for each destination type, +// see Logging web ACL traffic // (https://docs.aws.amazon.com/waf/latest/developerguide/logging.html) in the WAF // Developer Guide. // diff --git a/service/wafv2/api_op_UpdateWebACL.go b/service/wafv2/api_op_UpdateWebACL.go index 0c7bdf7cc9e..4e89ff00318 100644 --- a/service/wafv2/api_op_UpdateWebACL.go +++ b/service/wafv2/api_op_UpdateWebACL.go @@ -142,7 +142,8 @@ type UpdateWebACLInput struct { // only for the domain of the protected resource. With a token domain list, WAF // accepts the resource's host domain plus all domains in the token domain list, // including their prefixed subdomains. Example JSON: "TokenDomains": { - // "mywebsite.com", "myotherwebsite.com" } + // "mywebsite.com", "myotherwebsite.com" } Public suffixes aren't allowed. For + // example, you can't use usa.gov or co.uk as token domains. TokenDomains []string noSmithyDocumentSerde diff --git a/service/wafv2/types/types.go b/service/wafv2/types/types.go index a44b556ef9e..e38185cddbc 100644 --- a/service/wafv2/types/types.go +++ b/service/wafv2/types/types.go @@ -1336,9 +1336,11 @@ type LabelSummary struct { // // * Create your logging destination. You can // use an Amazon CloudWatch Logs log group, an Amazon Simple Storage Service -// (Amazon S3) bucket, or an Amazon Kinesis Data Firehose. For information about -// configuring logging destinations and the permissions that are required for each, -// see Logging web ACL traffic information +// (Amazon S3) bucket, or an Amazon Kinesis Data Firehose. The name that you give +// the destination must start with aws-waf-logs-. Depending on the type of +// destination, you might need to configure additional settings or permissions. For +// configuration requirements and pricing information for each destination type, +// see Logging web ACL traffic // (https://docs.aws.amazon.com/waf/latest/developerguide/logging.html) in the WAF // Developer Guide. //