diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..767f061a1b9 --- /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/observabilityadmin" + ] +} \ No newline at end of file diff --git a/.changelog/95fb3520532748e49a3e51b250afcde5.json b/.changelog/95fb3520532748e49a3e51b250afcde5.json new file mode 100644 index 00000000000..7845cc1e86a --- /dev/null +++ b/.changelog/95fb3520532748e49a3e51b250afcde5.json @@ -0,0 +1,8 @@ +{ + "id": "95fb3520-5327-48e4-9a3e-51b250afcde5", + "type": "feature", + "description": "This release adds EFA support to increase FSx for Lustre file systems' throughput performance to a single client instance. This can be done by specifying EfaEnabled=true at the time of creation of Persistent_2 file systems.", + "modules": [ + "service/fsx" + ] +} \ No newline at end of file diff --git a/.changelog/97a0c976b62d40dd80407dfe1f5c452b.json b/.changelog/97a0c976b62d40dd80407dfe1f5c452b.json new file mode 100644 index 00000000000..c68e3330300 --- /dev/null +++ b/.changelog/97a0c976b62d40dd80407dfe1f5c452b.json @@ -0,0 +1,8 @@ +{ + "id": "97a0c976-b62d-40dd-8040-7dfe1f5c452b", + "type": "feature", + "description": "AWS Config adds support for service-linked recorders, a new type of Config recorder managed by AWS services to record specific subsets of resource configuration data and functioning independently from customer managed AWS Config recorders.", + "modules": [ + "service/configservice" + ] +} \ No newline at end of file diff --git a/.changelog/cfb3185d1da347b4a93d97425da9e354.json b/.changelog/cfb3185d1da347b4a93d97425da9e354.json new file mode 100644 index 00000000000..d43e8090577 --- /dev/null +++ b/.changelog/cfb3185d1da347b4a93d97425da9e354.json @@ -0,0 +1,8 @@ +{ + "id": "cfb3185d-1da3-47b4-a93d-97425da9e354", + "type": "feature", + "description": "Amazon CloudWatch Observability Admin adds the ability to audit telemetry configuration for AWS resources in customers AWS Accounts and Organizations. The release introduces new APIs to turn on/off the new experience, which supports discovering supported AWS resources and their state of telemetry.", + "modules": [ + "service/observabilityadmin" + ] +} \ No newline at end of file diff --git a/.changelog/e776d42d8fbc4dbd9fabadc507affbd4.json b/.changelog/e776d42d8fbc4dbd9fabadc507affbd4.json new file mode 100644 index 00000000000..928694d3f0d --- /dev/null +++ b/.changelog/e776d42d8fbc4dbd9fabadc507affbd4.json @@ -0,0 +1,8 @@ +{ + "id": "e776d42d-8fbc-4dbd-9fab-adc507affbd4", + "type": "feature", + "description": "Add support for specifying embeddingDataType, either FLOAT32 or BINARY", + "modules": [ + "service/bedrockagent" + ] +} \ No newline at end of file diff --git a/service/bedrockagent/deserializers.go b/service/bedrockagent/deserializers.go index 809dfa54463..39edc63487c 100644 --- a/service/bedrockagent/deserializers.go +++ b/service/bedrockagent/deserializers.go @@ -13690,6 +13690,15 @@ func awsRestjson1_deserializeDocumentBedrockEmbeddingModelConfiguration(v **type sv.Dimensions = ptr.Int32(int32(i64)) } + case "embeddingDataType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected EmbeddingDataType to be of type string, got %T instead", value) + } + sv.EmbeddingDataType = types.EmbeddingDataType(jtv) + } + default: _, _ = key, value diff --git a/service/bedrockagent/serializers.go b/service/bedrockagent/serializers.go index 30f01e7a48a..9f01a7ca1d6 100644 --- a/service/bedrockagent/serializers.go +++ b/service/bedrockagent/serializers.go @@ -6208,6 +6208,11 @@ func awsRestjson1_serializeDocumentBedrockEmbeddingModelConfiguration(v *types.B ok.Integer(*v.Dimensions) } + if len(v.EmbeddingDataType) > 0 { + ok := object.Key("embeddingDataType") + ok.String(string(v.EmbeddingDataType)) + } + return nil } diff --git a/service/bedrockagent/types/enums.go b/service/bedrockagent/types/enums.go index 3025966b91b..15e90d3739a 100644 --- a/service/bedrockagent/types/enums.go +++ b/service/bedrockagent/types/enums.go @@ -293,6 +293,25 @@ func (DataSourceType) Values() []DataSourceType { } } +type EmbeddingDataType string + +// Enum values for EmbeddingDataType +const ( + EmbeddingDataTypeFloat32 EmbeddingDataType = "FLOAT32" + EmbeddingDataTypeBinary EmbeddingDataType = "BINARY" +) + +// Values returns all known values for EmbeddingDataType. 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 (EmbeddingDataType) Values() []EmbeddingDataType { + return []EmbeddingDataType{ + "FLOAT32", + "BINARY", + } +} + type FlowConnectionType string // Enum values for FlowConnectionType diff --git a/service/bedrockagent/types/types.go b/service/bedrockagent/types/types.go index 97eb4eeaeaf..8b7dd9d25e8 100644 --- a/service/bedrockagent/types/types.go +++ b/service/bedrockagent/types/types.go @@ -726,6 +726,15 @@ type BedrockEmbeddingModelConfiguration struct { // embeddings model. Dimensions *int32 + // The data type for the vectors when using a model to convert text into vector + // embeddings. The model must support the specified data type for vector + // embeddings. Floating-point (float32) is the default data type, and is supported + // by most models for vector embeddings. See [Supported embeddings models]for information on the available + // models and their vector data types. + // + // [Supported embeddings models]: https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-supported.html + EmbeddingDataType EmbeddingDataType + noSmithyDocumentSerde } diff --git a/service/configservice/api_op_AssociateResourceTypes.go b/service/configservice/api_op_AssociateResourceTypes.go new file mode 100644 index 00000000000..828335a56ec --- /dev/null +++ b/service/configservice/api_op_AssociateResourceTypes.go @@ -0,0 +1,178 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package configservice + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/configservice/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds all resource types specified in the ResourceTypes list to the [RecordingGroup] of +// specified configuration recorder and includes those resource types when +// recording. +// +// For this operation, the specified configuration recorder must use a [RecordingStrategy] that is +// either INCLUSION_BY_RESOURCE_TYPES or EXCLUSION_BY_RESOURCE_TYPES . +// +// [RecordingStrategy]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html +// [RecordingGroup]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html +func (c *Client) AssociateResourceTypes(ctx context.Context, params *AssociateResourceTypesInput, optFns ...func(*Options)) (*AssociateResourceTypesOutput, error) { + if params == nil { + params = &AssociateResourceTypesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AssociateResourceTypes", params, optFns, c.addOperationAssociateResourceTypesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AssociateResourceTypesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type AssociateResourceTypesInput struct { + + // The Amazon Resource Name (ARN) of the specified configuration recorder. + // + // This member is required. + ConfigurationRecorderArn *string + + // The list of resource types you want to add to the recording group of the + // specified configuration recorder. + // + // This member is required. + ResourceTypes []types.ResourceType + + noSmithyDocumentSerde +} + +type AssociateResourceTypesOutput struct { + + // Records configuration changes to the resource types in scope. + // + // For more information about the configuration recorder, see [Working with the Configuration Recorder] in the Config + // Developer Guide. + // + // [Working with the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html + // + // This member is required. + ConfigurationRecorder *types.ConfigurationRecorder + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAssociateResourceTypesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpAssociateResourceTypes{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAssociateResourceTypes{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateResourceTypes"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = addOpAssociateResourceTypesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateResourceTypes(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opAssociateResourceTypes(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "AssociateResourceTypes", + } +} diff --git a/service/configservice/api_op_DeleteConfigRule.go b/service/configservice/api_op_DeleteConfigRule.go index 61b27e53523..12cde18e82d 100644 --- a/service/configservice/api_op_DeleteConfigRule.go +++ b/service/configservice/api_op_DeleteConfigRule.go @@ -18,6 +18,26 @@ import ( // . // // You can check the state of a rule by using the DescribeConfigRules request. +// +// Recommendation: Stop recording resource compliance before deleting rules +// +// It is highly recommended that you stop recording for the +// AWS::Config::ResourceCompliance resource type before you delete rules in your +// account. Deleting rules creates CIs for AWS::Config::ResourceCompliance and can +// affect your Config [configuration recorder]costs. +// +// If you are deleting rules which evaluate a large number of resource types, this +// can lead to a spike in the number of CIs recorded. +// +// Best practice: +// +// - Stop recording AWS::Config::ResourceCompliance +// +// - Delete rule(s) +// +// - Turn on recording for AWS::Config::ResourceCompliance +// +// [configuration recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html func (c *Client) DeleteConfigRule(ctx context.Context, params *DeleteConfigRuleInput, optFns ...func(*Options)) (*DeleteConfigRuleOutput, error) { if params == nil { params = &DeleteConfigRuleInput{} diff --git a/service/configservice/api_op_DeleteConfigurationRecorder.go b/service/configservice/api_op_DeleteConfigurationRecorder.go index 145ea5c388e..1b93e0bbfe3 100644 --- a/service/configservice/api_op_DeleteConfigurationRecorder.go +++ b/service/configservice/api_op_DeleteConfigurationRecorder.go @@ -10,16 +10,15 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Deletes the configuration recorder. +// Deletes the customer managed configuration recorder. // -// After the configuration recorder is deleted, Config will not record resource -// configuration changes until you create a new configuration recorder. +// This operation does not delete the configuration information that was +// previously recorded. You will be able to access the previously recorded +// information by using the [GetResourceConfigHistory]operation, but you will not be able to access this +// information in the Config console until you have created a new customer managed +// configuration recorder. // -// This action does not delete the configuration information that was previously -// recorded. You will be able to access the previously recorded information by -// using the GetResourceConfigHistory action, but you will not be able to access -// this information in the Config console until you create a new configuration -// recorder. +// [GetResourceConfigHistory]: https://docs.aws.amazon.com/config/latest/APIReference/API_GetResourceConfigHistory.html func (c *Client) DeleteConfigurationRecorder(ctx context.Context, params *DeleteConfigurationRecorderInput, optFns ...func(*Options)) (*DeleteConfigurationRecorderOutput, error) { if params == nil { params = &DeleteConfigurationRecorderInput{} @@ -35,12 +34,14 @@ func (c *Client) DeleteConfigurationRecorder(ctx context.Context, params *Delete return out, nil } -// The request object for the DeleteConfigurationRecorder action. +// The request object for the DeleteConfigurationRecorder operation. type DeleteConfigurationRecorderInput struct { - // The name of the configuration recorder to be deleted. You can retrieve the name - // of your configuration recorder by using the DescribeConfigurationRecorders - // action. + // The name of the customer managed configuration recorder that you want to + // delete. You can retrieve the name of your configuration recorders by using the [DescribeConfigurationRecorders] + // operation. + // + // [DescribeConfigurationRecorders]: https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html // // This member is required. ConfigurationRecorderName *string diff --git a/service/configservice/api_op_DeleteDeliveryChannel.go b/service/configservice/api_op_DeleteDeliveryChannel.go index 9e0ee2e9747..934d04c6861 100644 --- a/service/configservice/api_op_DeleteDeliveryChannel.go +++ b/service/configservice/api_op_DeleteDeliveryChannel.go @@ -12,8 +12,9 @@ import ( // Deletes the delivery channel. // -// Before you can delete the delivery channel, you must stop the configuration -// recorder by using the StopConfigurationRecorderaction. +// Before you can delete the delivery channel, you must stop the customer managed +// configuration recorder. You can use the StopConfigurationRecorderoperation to stop the customer managed +// configuration recorder. func (c *Client) DeleteDeliveryChannel(ctx context.Context, params *DeleteDeliveryChannelInput, optFns ...func(*Options)) (*DeleteDeliveryChannelOutput, error) { if params == nil { params = &DeleteDeliveryChannelInput{} @@ -33,7 +34,7 @@ func (c *Client) DeleteDeliveryChannel(ctx context.Context, params *DeleteDelive // format. type DeleteDeliveryChannelInput struct { - // The name of the delivery channel to delete. + // The name of the delivery channel that you want to delete. // // This member is required. DeliveryChannelName *string diff --git a/service/configservice/api_op_DeleteServiceLinkedConfigurationRecorder.go b/service/configservice/api_op_DeleteServiceLinkedConfigurationRecorder.go new file mode 100644 index 00000000000..1697dc80510 --- /dev/null +++ b/service/configservice/api_op_DeleteServiceLinkedConfigurationRecorder.go @@ -0,0 +1,179 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package configservice + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes an existing service-linked configuration recorder. +// +// This operation does not delete the configuration information that was +// previously recorded. You will be able to access the previously recorded +// information by using the [GetResourceConfigHistory]operation, but you will not be able to access this +// information in the Config console until you have created a new service-linked +// configuration recorder for the same service. +// +// # The recording scope determines if you receive configuration items +// +// The recording scope is set by the service that is linked to the configuration +// recorder and determines whether you receive configuration items (CIs) in the +// delivery channel. If the recording scope is internal, you will not receive CIs +// in the delivery channel. +// +// [GetResourceConfigHistory]: https://docs.aws.amazon.com/config/latest/APIReference/API_GetResourceConfigHistory.html +func (c *Client) DeleteServiceLinkedConfigurationRecorder(ctx context.Context, params *DeleteServiceLinkedConfigurationRecorderInput, optFns ...func(*Options)) (*DeleteServiceLinkedConfigurationRecorderOutput, error) { + if params == nil { + params = &DeleteServiceLinkedConfigurationRecorderInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteServiceLinkedConfigurationRecorder", params, optFns, c.addOperationDeleteServiceLinkedConfigurationRecorderMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteServiceLinkedConfigurationRecorderOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteServiceLinkedConfigurationRecorderInput struct { + + // The service principal of the Amazon Web Services service for the service-linked + // configuration recorder that you want to delete. + // + // This member is required. + ServicePrincipal *string + + noSmithyDocumentSerde +} + +type DeleteServiceLinkedConfigurationRecorderOutput struct { + + // The Amazon Resource Name (ARN) of the specified configuration recorder. + // + // This member is required. + Arn *string + + // The name of the specified configuration recorder. + // + // This member is required. + Name *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteServiceLinkedConfigurationRecorderMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteServiceLinkedConfigurationRecorder{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteServiceLinkedConfigurationRecorder{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteServiceLinkedConfigurationRecorder"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = addOpDeleteServiceLinkedConfigurationRecorderValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteServiceLinkedConfigurationRecorder(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteServiceLinkedConfigurationRecorder(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteServiceLinkedConfigurationRecorder", + } +} diff --git a/service/configservice/api_op_DescribeAggregateComplianceByConformancePacks.go b/service/configservice/api_op_DescribeAggregateComplianceByConformancePacks.go index 89a58d5512a..92cee0d0803 100644 --- a/service/configservice/api_op_DescribeAggregateComplianceByConformancePacks.go +++ b/service/configservice/api_op_DescribeAggregateComplianceByConformancePacks.go @@ -11,11 +11,11 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Returns a list of the conformance packs and their associated compliance status -// with the count of compliant and noncompliant Config rules within each -// conformance pack. Also returns the total rule count which includes compliant -// rules, noncompliant rules, and rules that cannot be evaluated due to -// insufficient data. +// Returns a list of the existing and deleted conformance packs and their +// associated compliance status with the count of compliant and noncompliant Config +// rules within each conformance pack. Also returns the total rule count which +// includes compliant rules, noncompliant rules, and rules that cannot be evaluated +// due to insufficient data. // // The results can return an empty result page, but if you have a nextToken , the // results are displayed on the next page. diff --git a/service/configservice/api_op_DescribeComplianceByConfigRule.go b/service/configservice/api_op_DescribeComplianceByConfigRule.go index d96e7ef7096..b702eef08f6 100644 --- a/service/configservice/api_op_DescribeComplianceByConfigRule.go +++ b/service/configservice/api_op_DescribeComplianceByConfigRule.go @@ -12,7 +12,7 @@ import ( ) // Indicates whether the specified Config rules are compliant. If a rule is -// noncompliant, this action returns the number of Amazon Web Services resources +// noncompliant, this operation returns the number of Amazon Web Services resources // that do not comply with the rule. // // A rule is compliant if all of the evaluated resources comply with it. It is diff --git a/service/configservice/api_op_DescribeComplianceByResource.go b/service/configservice/api_op_DescribeComplianceByResource.go index 58ee64d2604..9b074969578 100644 --- a/service/configservice/api_op_DescribeComplianceByResource.go +++ b/service/configservice/api_op_DescribeComplianceByResource.go @@ -12,8 +12,8 @@ import ( ) // Indicates whether the specified Amazon Web Services resources are compliant. If -// a resource is noncompliant, this action returns the number of Config rules that -// the resource does not comply with. +// a resource is noncompliant, this operation returns the number of Config rules +// that the resource does not comply with. // // A resource is compliant if it complies with all the Config rules that evaluate // it. It is noncompliant if it does not comply with one or more of these rules. @@ -69,8 +69,8 @@ type DescribeComplianceByResourceInput struct { ResourceId *string // The types of Amazon Web Services resources for which you want compliance - // information (for example, AWS::EC2::Instance ). For this action, you can specify - // that the resource type is an Amazon Web Services account by specifying + // information (for example, AWS::EC2::Instance ). For this operation, you can + // specify that the resource type is an Amazon Web Services account by specifying // AWS::::Account . ResourceType *string diff --git a/service/configservice/api_op_DescribeConfigurationAggregators.go b/service/configservice/api_op_DescribeConfigurationAggregators.go index 0105c0962bf..a872d3a1a16 100644 --- a/service/configservice/api_op_DescribeConfigurationAggregators.go +++ b/service/configservice/api_op_DescribeConfigurationAggregators.go @@ -12,8 +12,8 @@ import ( ) // Returns the details of one or more configuration aggregators. If the -// configuration aggregator is not specified, this action returns the details for -// all the configuration aggregators associated with the account. +// configuration aggregator is not specified, this operation returns the details +// for all the configuration aggregators associated with the account. func (c *Client) DescribeConfigurationAggregators(ctx context.Context, params *DescribeConfigurationAggregatorsInput, optFns ...func(*Options)) (*DescribeConfigurationAggregatorsOutput, error) { if params == nil { params = &DescribeConfigurationAggregatorsInput{} diff --git a/service/configservice/api_op_DescribeConfigurationRecorderStatus.go b/service/configservice/api_op_DescribeConfigurationRecorderStatus.go index a207330ee4c..9939306efcb 100644 --- a/service/configservice/api_op_DescribeConfigurationRecorderStatus.go +++ b/service/configservice/api_op_DescribeConfigurationRecorderStatus.go @@ -11,14 +11,18 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Returns the current status of the specified configuration recorder as well as -// the status of the last recording event for the recorder. If a configuration -// recorder is not specified, this action returns the status of all configuration -// recorders associated with the account. +// Returns the current status of the configuration recorder you specify as well as +// the status of the last recording event for the configuration recorders. // -// >You can specify only one configuration recorder for each Amazon Web Services -// Region for each account. For a detailed status of recording events over time, -// add your Config events to Amazon CloudWatch metrics and use CloudWatch metrics. +// For a detailed status of recording events over time, add your Config events to +// Amazon CloudWatch metrics and use CloudWatch metrics. +// +// If a configuration recorder is not specified, this operation returns the status +// for the customer managed configuration recorder configured for the account, if +// applicable. +// +// When making a request to this operation, you can only specify one configuration +// recorder. func (c *Client) DescribeConfigurationRecorderStatus(ctx context.Context, params *DescribeConfigurationRecorderStatusInput, optFns ...func(*Options)) (*DescribeConfigurationRecorderStatusOutput, error) { if params == nil { params = &DescribeConfigurationRecorderStatusInput{} @@ -37,11 +41,22 @@ func (c *Client) DescribeConfigurationRecorderStatus(ctx context.Context, params // The input for the DescribeConfigurationRecorderStatus action. type DescribeConfigurationRecorderStatusInput struct { - // The name(s) of the configuration recorder. If the name is not specified, the - // action returns the current status of all the configuration recorders associated - // with the account. + // The Amazon Resource Name (ARN) of the configuration recorder that you want to + // specify. + Arn *string + + // The name of the configuration recorder. If the name is not specified, the + // opertation returns the status for the customer managed configuration recorder + // configured for the account, if applicable. + // + // When making a request to this operation, you can only specify one configuration + // recorder. ConfigurationRecorderNames []string + // For service-linked configuration recorders, you can use the service principal + // of the linked Amazon Web Services service to specify the configuration recorder. + ServicePrincipal *string + noSmithyDocumentSerde } diff --git a/service/configservice/api_op_DescribeConfigurationRecorders.go b/service/configservice/api_op_DescribeConfigurationRecorders.go index 22576834725..e6c98b5e33c 100644 --- a/service/configservice/api_op_DescribeConfigurationRecorders.go +++ b/service/configservice/api_op_DescribeConfigurationRecorders.go @@ -11,12 +11,14 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Returns the details for the specified configuration recorders. If the -// configuration recorder is not specified, this action returns the details for all -// configuration recorders associated with the account. +// Returns details for the configuration recorder you specify. // -// You can specify only one configuration recorder for each Amazon Web Services -// Region for each account. +// If a configuration recorder is not specified, this operation returns details +// for the customer managed configuration recorder configured for the account, if +// applicable. +// +// When making a request to this operation, you can only specify one configuration +// recorder. func (c *Client) DescribeConfigurationRecorders(ctx context.Context, params *DescribeConfigurationRecordersInput, optFns ...func(*Options)) (*DescribeConfigurationRecordersOutput, error) { if params == nil { params = &DescribeConfigurationRecordersInput{} @@ -35,9 +37,17 @@ func (c *Client) DescribeConfigurationRecorders(ctx context.Context, params *Des // The input for the DescribeConfigurationRecorders action. type DescribeConfigurationRecordersInput struct { - // A list of configuration recorder names. + // The Amazon Resource Name (ARN) of the configuration recorder that you want to + // specify. + Arn *string + + // A list of names of the configuration recorders that you want to specify. ConfigurationRecorderNames []string + // For service-linked configuration recorders, you can use the service principal + // of the linked Amazon Web Services service to specify the configuration recorder. + ServicePrincipal *string + noSmithyDocumentSerde } diff --git a/service/configservice/api_op_DescribeDeliveryChannelStatus.go b/service/configservice/api_op_DescribeDeliveryChannelStatus.go index e32b0db4f68..47e3c35172b 100644 --- a/service/configservice/api_op_DescribeDeliveryChannelStatus.go +++ b/service/configservice/api_op_DescribeDeliveryChannelStatus.go @@ -12,8 +12,8 @@ import ( ) // Returns the current status of the specified delivery channel. If a delivery -// channel is not specified, this action returns the current status of all delivery -// channels associated with the account. +// channel is not specified, this operation returns the current status of all +// delivery channels associated with the account. // // Currently, you can specify only one delivery channel per region in your account. func (c *Client) DescribeDeliveryChannelStatus(ctx context.Context, params *DescribeDeliveryChannelStatusInput, optFns ...func(*Options)) (*DescribeDeliveryChannelStatusOutput, error) { diff --git a/service/configservice/api_op_DescribeDeliveryChannels.go b/service/configservice/api_op_DescribeDeliveryChannels.go index 700e453a3ed..d576681e33b 100644 --- a/service/configservice/api_op_DescribeDeliveryChannels.go +++ b/service/configservice/api_op_DescribeDeliveryChannels.go @@ -12,7 +12,7 @@ import ( ) // Returns details about the specified delivery channel. If a delivery channel is -// not specified, this action returns the details of all delivery channels +// not specified, this operation returns the details of all delivery channels // associated with the account. // // Currently, you can specify only one delivery channel per region in your account. diff --git a/service/configservice/api_op_DescribeRemediationExecutionStatus.go b/service/configservice/api_op_DescribeRemediationExecutionStatus.go index 543b0df22b4..f795d455a7e 100644 --- a/service/configservice/api_op_DescribeRemediationExecutionStatus.go +++ b/service/configservice/api_op_DescribeRemediationExecutionStatus.go @@ -32,7 +32,7 @@ func (c *Client) DescribeRemediationExecutionStatus(ctx context.Context, params type DescribeRemediationExecutionStatusInput struct { - // A list of Config rule names. + // The name of the Config rule. // // This member is required. ConfigRuleName *string diff --git a/service/configservice/api_op_DescribeRetentionConfigurations.go b/service/configservice/api_op_DescribeRetentionConfigurations.go index 83ce4ca20eb..04d82eda05c 100644 --- a/service/configservice/api_op_DescribeRetentionConfigurations.go +++ b/service/configservice/api_op_DescribeRetentionConfigurations.go @@ -12,8 +12,8 @@ import ( ) // Returns the details of one or more retention configurations. If the retention -// configuration name is not specified, this action returns the details for all the -// retention configurations for that account. +// configuration name is not specified, this operation returns the details for all +// the retention configurations for that account. // // Currently, Config supports only one retention configuration per region in your // account. diff --git a/service/configservice/api_op_DisassociateResourceTypes.go b/service/configservice/api_op_DisassociateResourceTypes.go new file mode 100644 index 00000000000..66cbc30c0c9 --- /dev/null +++ b/service/configservice/api_op_DisassociateResourceTypes.go @@ -0,0 +1,177 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package configservice + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/configservice/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes all resource types specified in the ResourceTypes list from the [RecordingGroup] of +// configuration recorder and excludes these resource types when recording. +// +// For this operation, the configuration recorder must use a [RecordingStrategy] that is either +// INCLUSION_BY_RESOURCE_TYPES or EXCLUSION_BY_RESOURCE_TYPES . +// +// [RecordingStrategy]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html +// [RecordingGroup]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html +func (c *Client) DisassociateResourceTypes(ctx context.Context, params *DisassociateResourceTypesInput, optFns ...func(*Options)) (*DisassociateResourceTypesOutput, error) { + if params == nil { + params = &DisassociateResourceTypesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateResourceTypes", params, optFns, c.addOperationDisassociateResourceTypesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateResourceTypesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisassociateResourceTypesInput struct { + + // The Amazon Resource Name (ARN) of the specified configuration recorder. + // + // This member is required. + ConfigurationRecorderArn *string + + // The list of resource types you want to remove from the recording group of the + // specified configuration recorder. + // + // This member is required. + ResourceTypes []types.ResourceType + + noSmithyDocumentSerde +} + +type DisassociateResourceTypesOutput struct { + + // Records configuration changes to the resource types in scope. + // + // For more information about the configuration recorder, see [Working with the Configuration Recorder] in the Config + // Developer Guide. + // + // [Working with the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html + // + // This member is required. + ConfigurationRecorder *types.ConfigurationRecorder + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateResourceTypesMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpDisassociateResourceTypes{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDisassociateResourceTypes{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateResourceTypes"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = addOpDisassociateResourceTypesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateResourceTypes(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDisassociateResourceTypes(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DisassociateResourceTypes", + } +} diff --git a/service/configservice/api_op_GetAggregateResourceConfig.go b/service/configservice/api_op_GetAggregateResourceConfig.go index 2e00be3e571..e5e3e1a2438 100644 --- a/service/configservice/api_op_GetAggregateResourceConfig.go +++ b/service/configservice/api_op_GetAggregateResourceConfig.go @@ -13,6 +13,8 @@ import ( // Returns configuration item that is aggregated for your specific resource in a // specific source account and region. +// +// The API does not return results for deleted resources. func (c *Client) GetAggregateResourceConfig(ctx context.Context, params *GetAggregateResourceConfigInput, optFns ...func(*Options)) (*GetAggregateResourceConfigOutput, error) { if params == nil { params = &GetAggregateResourceConfigInput{} diff --git a/service/configservice/api_op_ListConfigurationRecorders.go b/service/configservice/api_op_ListConfigurationRecorders.go new file mode 100644 index 00000000000..52edccc20f3 --- /dev/null +++ b/service/configservice/api_op_ListConfigurationRecorders.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package configservice + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/configservice/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of configuration recorders depending on the filters you specify. +func (c *Client) ListConfigurationRecorders(ctx context.Context, params *ListConfigurationRecordersInput, optFns ...func(*Options)) (*ListConfigurationRecordersOutput, error) { + if params == nil { + params = &ListConfigurationRecordersInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListConfigurationRecorders", params, optFns, c.addOperationListConfigurationRecordersMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListConfigurationRecordersOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListConfigurationRecordersInput struct { + + // Filters the results based on a list of ConfigurationRecorderFilter objects that + // you specify. + Filters []types.ConfigurationRecorderFilter + + // The maximum number of results to include in the response. + MaxResults *int32 + + // The NextToken string returned on a previous page that you use to get the next + // page of results in a paginated response. + NextToken *string + + noSmithyDocumentSerde +} + +type ListConfigurationRecordersOutput struct { + + // A list of ConfigurationRecorderSummary objects that includes. + // + // This member is required. + ConfigurationRecorderSummaries []types.ConfigurationRecorderSummary + + // The NextToken string returned on a previous page that you use to get the next + // page of results in a paginated response. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListConfigurationRecordersMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpListConfigurationRecorders{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListConfigurationRecorders{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListConfigurationRecorders"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListConfigurationRecorders(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +// ListConfigurationRecordersPaginatorOptions is the paginator options for +// ListConfigurationRecorders +type ListConfigurationRecordersPaginatorOptions struct { + // The maximum number of results to include in the response. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListConfigurationRecordersPaginator is a paginator for +// ListConfigurationRecorders +type ListConfigurationRecordersPaginator struct { + options ListConfigurationRecordersPaginatorOptions + client ListConfigurationRecordersAPIClient + params *ListConfigurationRecordersInput + nextToken *string + firstPage bool +} + +// NewListConfigurationRecordersPaginator returns a new +// ListConfigurationRecordersPaginator +func NewListConfigurationRecordersPaginator(client ListConfigurationRecordersAPIClient, params *ListConfigurationRecordersInput, optFns ...func(*ListConfigurationRecordersPaginatorOptions)) *ListConfigurationRecordersPaginator { + if params == nil { + params = &ListConfigurationRecordersInput{} + } + + options := ListConfigurationRecordersPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListConfigurationRecordersPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListConfigurationRecordersPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListConfigurationRecorders page. +func (p *ListConfigurationRecordersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListConfigurationRecordersOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + optFns = append([]func(*Options){ + addIsPaginatorUserAgent, + }, optFns...) + result, err := p.client.ListConfigurationRecorders(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +// ListConfigurationRecordersAPIClient is a client that implements the +// ListConfigurationRecorders operation. +type ListConfigurationRecordersAPIClient interface { + ListConfigurationRecorders(context.Context, *ListConfigurationRecordersInput, ...func(*Options)) (*ListConfigurationRecordersOutput, error) +} + +var _ ListConfigurationRecordersAPIClient = (*Client)(nil) + +func newServiceMetadataMiddleware_opListConfigurationRecorders(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListConfigurationRecorders", + } +} diff --git a/service/configservice/api_op_ListStoredQueries.go b/service/configservice/api_op_ListStoredQueries.go index 52391426d7e..4b78dc3d38a 100644 --- a/service/configservice/api_op_ListStoredQueries.go +++ b/service/configservice/api_op_ListStoredQueries.go @@ -44,7 +44,7 @@ type ListStoredQueriesOutput struct { // If the previous paginated request didn't return all of the remaining results, // the response object's NextToken parameter value is set to a token. To retrieve - // the next set of results, call this action again and assign that token to the + // the next set of results, call this operation again and assign that token to the // request object's NextToken parameter. If there are no remaining results, the // previous response object's NextToken parameter is set to null . NextToken *string diff --git a/service/configservice/api_op_ListTagsForResource.go b/service/configservice/api_op_ListTagsForResource.go index 06c38ed658e..06eb54cceef 100644 --- a/service/configservice/api_op_ListTagsForResource.go +++ b/service/configservice/api_op_ListTagsForResource.go @@ -30,8 +30,23 @@ func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForRes type ListTagsForResourceInput struct { // The Amazon Resource Name (ARN) that identifies the resource for which to list - // the tags. Currently, the supported resources are ConfigRule , - // ConfigurationAggregator and AggregatorAuthorization . + // the tags. The following resources are supported: + // + // - ConfigurationRecorder + // + // - ConfigRule + // + // - OrganizationConfigRule + // + // - ConformancePack + // + // - OrganizationConformancePack + // + // - ConfigurationAggregator + // + // - AggregationAuthorization + // + // - StoredQuery // // This member is required. ResourceArn *string diff --git a/service/configservice/api_op_PutAggregationAuthorization.go b/service/configservice/api_op_PutAggregationAuthorization.go index 8ab0509d4ec..b6c358a8c1e 100644 --- a/service/configservice/api_op_PutAggregationAuthorization.go +++ b/service/configservice/api_op_PutAggregationAuthorization.go @@ -14,11 +14,18 @@ import ( // Authorizes the aggregator account and region to collect data from the source // account and region. // +// # Tags are added at creation and cannot be updated with this operation +// // PutAggregationAuthorization is an idempotent API. Subsequent requests won’t // create a duplicate resource if one was already created. If a following request // has different tags values, Config will ignore these differences and treat it as // an idempotent request of the previous. In this case, tags will not be updated, // even if they are different. +// +// Use [TagResource] and [UntagResource] to update tags after creation. +// +// [TagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html +// [UntagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html func (c *Client) PutAggregationAuthorization(ctx context.Context, params *PutAggregationAuthorizationInput, optFns ...func(*Options)) (*PutAggregationAuthorizationOutput, error) { if params == nil { params = &PutAggregationAuthorizationInput{} diff --git a/service/configservice/api_op_PutConfigRule.go b/service/configservice/api_op_PutConfigRule.go index 708abfd9975..27c76a370b6 100644 --- a/service/configservice/api_op_PutConfigRule.go +++ b/service/configservice/api_op_PutConfigRule.go @@ -49,15 +49,21 @@ import ( // For more information about developing and using Config rules, see [Evaluating Resources with Config Rules] in the // Config Developer Guide. // +// # Tags are added at creation and cannot be updated with this operation +// // PutConfigRule is an idempotent API. Subsequent requests won’t create a // duplicate resource if one was already created. If a following request has // different tags values, Config will ignore these differences and treat it as an // idempotent request of the previous. In this case, tags will not be updated, // even if they are different. // +// Use [TagResource] and [UntagResource] to update tags after creation. +// // [List of Config Managed Rules]: https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html // [Lambda Developer Guide]: https://docs.aws.amazon.com/config/latest/developerguide/gettingstarted-concepts.html#gettingstarted-concepts-function +// [TagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html // [Evaluating Resources with Config Rules]: https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html +// [UntagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html // [Service Limits]: https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html // [Guard GitHub Repository]: https://github.com/aws-cloudformation/cloudformation-guard func (c *Client) PutConfigRule(ctx context.Context, params *PutConfigRuleInput, optFns ...func(*Options)) (*PutConfigRuleOutput, error) { diff --git a/service/configservice/api_op_PutConfigurationAggregator.go b/service/configservice/api_op_PutConfigurationAggregator.go index 87c4b39c784..39f400046b1 100644 --- a/service/configservice/api_op_PutConfigurationAggregator.go +++ b/service/configservice/api_op_PutConfigurationAggregator.go @@ -32,13 +32,19 @@ import ( // // To register a delegated administrator, see [Register a Delegated Administrator] in the Config developer guide. // +// # Tags are added at creation and cannot be updated with this operation +// // PutConfigurationAggregator is an idempotent API. Subsequent requests won’t // create a duplicate resource if one was already created. If a following request // has different tags values, Config will ignore these differences and treat it as // an idempotent request of the previous. In this case, tags will not be updated, // even if they are different. // +// Use [TagResource] and [UntagResource] to update tags after creation. +// // [Register a Delegated Administrator]: https://docs.aws.amazon.com/config/latest/developerguide/set-up-aggregator-cli.html#register-a-delegated-administrator-cli +// [TagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html +// [UntagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html func (c *Client) PutConfigurationAggregator(ctx context.Context, params *PutConfigurationAggregatorInput, optFns ...func(*Options)) (*PutConfigurationAggregatorOutput, error) { if params == nil { params = &PutConfigurationAggregatorInput{} @@ -64,6 +70,10 @@ type PutConfigurationAggregatorInput struct { // A list of AccountAggregationSource object. AccountAggregationSources []types.AccountAggregationSource + // An object to filter configuration recorders in an aggregator. Either + // ResourceType or ServicePrincipal is required. + AggregatorFilters *types.AggregatorFilters + // An OrganizationAggregationSource object. OrganizationAggregationSource *types.OrganizationAggregationSource diff --git a/service/configservice/api_op_PutConfigurationRecorder.go b/service/configservice/api_op_PutConfigurationRecorder.go index 3952c014568..d0c56d2127a 100644 --- a/service/configservice/api_op_PutConfigurationRecorder.go +++ b/service/configservice/api_op_PutConfigurationRecorder.go @@ -11,19 +11,44 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates a new configuration recorder to record configuration changes for -// specified resource types. +// Creates or updates the customer managed configuration recorder. // -// You can also use this action to change the roleARN or the recordingGroup of an -// existing recorder. For more information, see [Managing the Configuration Recorder]in the Config Developer Guide. +// You can use this operation to create a new customer managed configuration +// recorder or to update the roleARN and the recordingGroup for an existing +// customer managed configuration recorder. // -// You can specify only one configuration recorder for each Amazon Web Services -// Region for each account. +// To start the customer managed configuration recorder and begin recording +// configuration changes for the resource types you specify, use the [StartConfigurationRecorder]operation. // -// If the configuration recorder does not have the recordingGroup field specified, -// the default is to record all supported resource types. +// For more information, see [Working with the Configuration Recorder] in the Config Developer Guide. // -// [Managing the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html +// # One customer managed configuration recorder per account per Region +// +// You can create only one customer managed configuration recorder for each +// account for each Amazon Web Services Region. +// +// Default is to record all supported resource types, excluding the global IAM +// resource types +// +// If you have not specified values for the recordingGroup field, the default for +// the customer managed configuration recorder is to record all supported resource +// types, excluding the global IAM resource types: AWS::IAM::Group , +// AWS::IAM::Policy , AWS::IAM::Role , and AWS::IAM::User . +// +// # Tags are added at creation and cannot be updated +// +// PutConfigurationRecorder is an idempotent API. Subsequent requests won’t create +// a duplicate resource if one was already created. If a following request has +// different tags values, Config will ignore these differences and treat it as an +// idempotent request of the previous. In this case, tags will not be updated, even +// if they are different. +// +// Use [TagResource] and [UntagResource] to update tags after creation. +// +// [Working with the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html +// [TagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html +// [UntagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html +// [StartConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_StartConfigurationRecorder.html func (c *Client) PutConfigurationRecorder(ctx context.Context, params *PutConfigurationRecorderInput, optFns ...func(*Options)) (*PutConfigurationRecorderOutput, error) { if params == nil { params = &PutConfigurationRecorderInput{} @@ -42,12 +67,16 @@ func (c *Client) PutConfigurationRecorder(ctx context.Context, params *PutConfig // The input for the PutConfigurationRecorder action. type PutConfigurationRecorderInput struct { - // An object for the configuration recorder to record configuration changes for - // specified resource types. + // An object for the configuration recorder. A configuration recorder records + // configuration changes for the resource types in scope. // // This member is required. ConfigurationRecorder *types.ConfigurationRecorder + // The tags for the customer managed configuration recorder. Each tag consists of + // a key and an optional value, both of which you define. + Tags []types.Tag + noSmithyDocumentSerde } diff --git a/service/configservice/api_op_PutDeliveryChannel.go b/service/configservice/api_op_PutDeliveryChannel.go index 733609fbcb4..5f85213fea3 100644 --- a/service/configservice/api_op_PutDeliveryChannel.go +++ b/service/configservice/api_op_PutDeliveryChannel.go @@ -11,23 +11,20 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates a delivery channel object to deliver configuration information and -// other compliance information to an Amazon S3 bucket and Amazon SNS topic. For -// more information, see [Notifications that Config Sends to an Amazon SNS topic]. +// Creates or updates a delivery channel to deliver configuration information and +// other compliance information. // -// Before you can create a delivery channel, you must create a configuration -// recorder. +// You can use this operation to create a new delivery channel or to update the +// Amazon S3 bucket and the Amazon SNS topic of an existing delivery channel. // -// You can use this action to change the Amazon S3 bucket or an Amazon SNS topic -// of the existing delivery channel. To change the Amazon S3 bucket or an Amazon -// SNS topic, call this action and specify the changed values for the S3 bucket and -// the SNS topic. If you specify a different value for either the S3 bucket or the -// SNS topic, this action will keep the existing value for the parameter that is -// not changed. +// For more information, see [Working with the Delivery Channel] in the Config Developer Guide. // -// You can have only one delivery channel per region in your account. +// # One delivery channel per account per Region // -// [Notifications that Config Sends to an Amazon SNS topic]: https://docs.aws.amazon.com/config/latest/developerguide/notifications-for-AWS-Config.html +// You can have only one delivery channel for each account for each Amazon Web +// Services Region. +// +// [Working with the Delivery Channel]: https://docs.aws.amazon.com/config/latest/developerguide/manage-delivery-channel.html func (c *Client) PutDeliveryChannel(ctx context.Context, params *PutDeliveryChannelInput, optFns ...func(*Options)) (*PutDeliveryChannelOutput, error) { if params == nil { params = &PutDeliveryChannelInput{} @@ -46,8 +43,8 @@ func (c *Client) PutDeliveryChannel(ctx context.Context, params *PutDeliveryChan // The input for the PutDeliveryChannel action. type PutDeliveryChannelInput struct { - // The configuration delivery channel object that delivers the configuration - // information to an Amazon S3 bucket and to an Amazon SNS topic. + // An object for the delivery channel. A delivery channel sends notifications and + // updated configuration states. // // This member is required. DeliveryChannel *types.DeliveryChannel diff --git a/service/configservice/api_op_PutEvaluations.go b/service/configservice/api_op_PutEvaluations.go index 26a92d52ce2..1d3cf3958b2 100644 --- a/service/configservice/api_op_PutEvaluations.go +++ b/service/configservice/api_op_PutEvaluations.go @@ -11,8 +11,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Used by an Lambda function to deliver evaluation results to Config. This action -// is required in every Lambda function that is invoked by an Config rule. +// Used by an Lambda function to deliver evaluation results to Config. This +// operation is required in every Lambda function that is invoked by an Config +// rule. func (c *Client) PutEvaluations(ctx context.Context, params *PutEvaluationsInput, optFns ...func(*Options)) (*PutEvaluationsOutput, error) { if params == nil { params = &PutEvaluationsInput{} diff --git a/service/configservice/api_op_PutRemediationExceptions.go b/service/configservice/api_op_PutRemediationExceptions.go index aa72f0367b2..0099fd35bdd 100644 --- a/service/configservice/api_op_PutRemediationExceptions.go +++ b/service/configservice/api_op_PutRemediationExceptions.go @@ -41,6 +41,11 @@ import ( // conditions that initiate the possible Config evaluation results, see [Concepts | Config Rules]in the // Config Developer Guide. // +// # Exceptions cannot be placed on service-linked remediation actions +// +// You cannot place an exception on service-linked remediation actions, such as +// remediation actions put by an organizational conformance pack. +// // # Auto remediation can be initiated even for compliant resources // // If you enable auto remediation for a specific Config rule using the [PutRemediationConfigurations] API or the diff --git a/service/configservice/api_op_PutServiceLinkedConfigurationRecorder.go b/service/configservice/api_op_PutServiceLinkedConfigurationRecorder.go new file mode 100644 index 00000000000..63ad16def2d --- /dev/null +++ b/service/configservice/api_op_PutServiceLinkedConfigurationRecorder.go @@ -0,0 +1,194 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package configservice + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/configservice/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a service-linked configuration recorder that is linked to a specific +// Amazon Web Services service based on the ServicePrincipal you specify. +// +// The configuration recorder's name , recordingGroup , recordingMode , and +// recordingScope is set by the service that is linked to the configuration +// recorder. +// +// For more information, see [Working with the Configuration Recorder] in the Config Developer Guide. +// +// This API creates a service-linked role AWSServiceRoleForConfig in your account. +// The service-linked role is created only when the role does not exist in your +// account. +// +// # The recording scope determines if you receive configuration items +// +// The recording scope is set by the service that is linked to the configuration +// recorder and determines whether you receive configuration items (CIs) in the +// delivery channel. If the recording scope is internal, you will not receive CIs +// in the delivery channel. +// +// # Tags are added at creation and cannot be updated with this operation +// +// Use [TagResource] and [UntagResource] to update tags after creation. +// +// [Working with the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html +// [TagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html +// [UntagResource]: https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html +func (c *Client) PutServiceLinkedConfigurationRecorder(ctx context.Context, params *PutServiceLinkedConfigurationRecorderInput, optFns ...func(*Options)) (*PutServiceLinkedConfigurationRecorderOutput, error) { + if params == nil { + params = &PutServiceLinkedConfigurationRecorderInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutServiceLinkedConfigurationRecorder", params, optFns, c.addOperationPutServiceLinkedConfigurationRecorderMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutServiceLinkedConfigurationRecorderOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutServiceLinkedConfigurationRecorderInput struct { + + // The service principal of the Amazon Web Services service for the service-linked + // configuration recorder that you want to create. + // + // This member is required. + ServicePrincipal *string + + // The tags for a service-linked configuration recorder. Each tag consists of a + // key and an optional value, both of which you define. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type PutServiceLinkedConfigurationRecorderOutput struct { + + // The Amazon Resource Name (ARN) of the specified configuration recorder. + Arn *string + + // The name of the specified configuration recorder. + // + // For service-linked configuration recorders, Config automatically assigns a name + // that has the prefix " AWS " to the new service-linked configuration recorder. + Name *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutServiceLinkedConfigurationRecorderMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutServiceLinkedConfigurationRecorder{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutServiceLinkedConfigurationRecorder{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PutServiceLinkedConfigurationRecorder"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = addOpPutServiceLinkedConfigurationRecorderValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutServiceLinkedConfigurationRecorder(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opPutServiceLinkedConfigurationRecorder(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PutServiceLinkedConfigurationRecorder", + } +} diff --git a/service/configservice/api_op_PutStoredQuery.go b/service/configservice/api_op_PutStoredQuery.go index 25a916f10d1..24a2c65300b 100644 --- a/service/configservice/api_op_PutStoredQuery.go +++ b/service/configservice/api_op_PutStoredQuery.go @@ -16,6 +16,8 @@ import ( // Region. You can create upto 300 queries in a single Amazon Web Services account // and a single Amazon Web Services Region. // +// # Tags are added at creation and cannot be updated +// // PutStoredQuery is an idempotent API. Subsequent requests won’t create a // duplicate resource if one was already created. If a following request has // different tags values, Config will ignore these differences and treat it as an diff --git a/service/configservice/api_op_StartConfigurationRecorder.go b/service/configservice/api_op_StartConfigurationRecorder.go index 08464a2ecd1..7e3e11b27b1 100644 --- a/service/configservice/api_op_StartConfigurationRecorder.go +++ b/service/configservice/api_op_StartConfigurationRecorder.go @@ -10,11 +10,15 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Starts recording configurations of the Amazon Web Services resources you have -// selected to record in your Amazon Web Services account. +// Starts the customer managed configuration recorder. The customer managed +// configuration recorder will begin recording configuration changes for the +// resource types you specify. // -// You must have created at least one delivery channel to successfully start the -// configuration recorder. +// You must have created a delivery channel to successfully start the customer +// managed configuration recorder. You can use the [PutDeliveryChannel]operation to create a delivery +// channel. +// +// [PutDeliveryChannel]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutDeliveryChannel.html func (c *Client) StartConfigurationRecorder(ctx context.Context, params *StartConfigurationRecorderInput, optFns ...func(*Options)) (*StartConfigurationRecorderOutput, error) { if params == nil { params = &StartConfigurationRecorderInput{} @@ -30,11 +34,10 @@ func (c *Client) StartConfigurationRecorder(ctx context.Context, params *StartCo return out, nil } -// The input for the StartConfigurationRecorder action. +// The input for the StartConfigurationRecorder operation. type StartConfigurationRecorderInput struct { - // The name of the recorder object that records each configuration change made to - // the resources. + // The name of the customer managed configuration recorder that you want to start. // // This member is required. ConfigurationRecorderName *string diff --git a/service/configservice/api_op_StopConfigurationRecorder.go b/service/configservice/api_op_StopConfigurationRecorder.go index c9f8ec29972..ac6b9f38287 100644 --- a/service/configservice/api_op_StopConfigurationRecorder.go +++ b/service/configservice/api_op_StopConfigurationRecorder.go @@ -10,8 +10,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Stops recording configurations of the Amazon Web Services resources you have -// selected to record in your Amazon Web Services account. +// Stops the customer managed configuration recorder. The customer managed +// configuration recorder will stop recording configuration changes for the +// resource types you have specified. func (c *Client) StopConfigurationRecorder(ctx context.Context, params *StopConfigurationRecorderInput, optFns ...func(*Options)) (*StopConfigurationRecorderOutput, error) { if params == nil { params = &StopConfigurationRecorderInput{} @@ -27,11 +28,10 @@ func (c *Client) StopConfigurationRecorder(ctx context.Context, params *StopConf return out, nil } -// The input for the StopConfigurationRecorder action. +// The input for the StopConfigurationRecorder operation. type StopConfigurationRecorderInput struct { - // The name of the recorder object that records each configuration change made to - // the resources. + // The name of the customer managed configuration recorder that you want to stop. // // This member is required. ConfigurationRecorderName *string diff --git a/service/configservice/api_op_TagResource.go b/service/configservice/api_op_TagResource.go index f568ed88053..d34ab0f99d3 100644 --- a/service/configservice/api_op_TagResource.go +++ b/service/configservice/api_op_TagResource.go @@ -11,7 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Associates the specified tags to a resource with the specified resourceArn. If +// Associates the specified tags to a resource with the specified ResourceArn . If // existing tags on a resource are not specified in the request parameters, they // are not changed. If existing tags are specified, however, then their values will // be updated. When a resource is deleted, the tags associated with that resource @@ -34,8 +34,23 @@ func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optF type TagResourceInput struct { // The Amazon Resource Name (ARN) that identifies the resource for which to list - // the tags. Currently, the supported resources are ConfigRule , - // ConfigurationAggregator and AggregatorAuthorization . + // the tags. The following resources are supported: + // + // - ConfigurationRecorder + // + // - ConfigRule + // + // - OrganizationConfigRule + // + // - ConformancePack + // + // - OrganizationConformancePack + // + // - ConfigurationAggregator + // + // - AggregationAuthorization + // + // - StoredQuery // // This member is required. ResourceArn *string diff --git a/service/configservice/api_op_UntagResource.go b/service/configservice/api_op_UntagResource.go index c746c5165fc..8591ee2f41d 100644 --- a/service/configservice/api_op_UntagResource.go +++ b/service/configservice/api_op_UntagResource.go @@ -29,8 +29,23 @@ func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, type UntagResourceInput struct { // The Amazon Resource Name (ARN) that identifies the resource for which to list - // the tags. Currently, the supported resources are ConfigRule , - // ConfigurationAggregator and AggregatorAuthorization . + // the tags. The following resources are supported: + // + // - ConfigurationRecorder + // + // - ConfigRule + // + // - OrganizationConfigRule + // + // - ConformancePack + // + // - OrganizationConformancePack + // + // - ConfigurationAggregator + // + // - AggregationAuthorization + // + // - StoredQuery // // This member is required. ResourceArn *string diff --git a/service/configservice/deserializers.go b/service/configservice/deserializers.go index a808895b3e4..c9c684859d9 100644 --- a/service/configservice/deserializers.go +++ b/service/configservice/deserializers.go @@ -30,6 +30,123 @@ func deserializeS3Expires(v string) (*time.Time, error) { return &t, nil } +type awsAwsjson11_deserializeOpAssociateResourceTypes struct { +} + +func (*awsAwsjson11_deserializeOpAssociateResourceTypes) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpAssociateResourceTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorAssociateResourceTypes(response, &metadata) + } + output := &AssociateResourceTypesOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentAssociateResourceTypesOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorAssociateResourceTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("ConflictException", errorCode): + return awsAwsjson11_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): + return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpBatchGetAggregateResourceConfig struct { } @@ -607,6 +724,9 @@ func awsAwsjson11_deserializeOpErrorDeleteConfigurationRecorder(response *smithy case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + case strings.EqualFold("UnmodifiableEntityException", errorCode): + return awsAwsjson11_deserializeErrorUnmodifiableEntityException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -1609,6 +1729,123 @@ func awsAwsjson11_deserializeOpErrorDeleteRetentionConfiguration(response *smith } } +type awsAwsjson11_deserializeOpDeleteServiceLinkedConfigurationRecorder struct { +} + +func (*awsAwsjson11_deserializeOpDeleteServiceLinkedConfigurationRecorder) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpDeleteServiceLinkedConfigurationRecorder) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorDeleteServiceLinkedConfigurationRecorder(response, &metadata) + } + output := &DeleteServiceLinkedConfigurationRecorderOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentDeleteServiceLinkedConfigurationRecorderOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorDeleteServiceLinkedConfigurationRecorder(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("ConflictException", errorCode): + return awsAwsjson11_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): + return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpDeleteStoredQuery struct { } @@ -3003,6 +3240,9 @@ func awsAwsjson11_deserializeOpErrorDescribeConfigurationRecorders(response *smi case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -3114,6 +3354,9 @@ func awsAwsjson11_deserializeOpErrorDescribeConfigurationRecorderStatus(response case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -4759,14 +5002,14 @@ func awsAwsjson11_deserializeOpErrorDescribeRetentionConfigurations(response *sm } } -type awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule struct { +type awsAwsjson11_deserializeOpDisassociateResourceTypes struct { } -func (*awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) ID() string { +func (*awsAwsjson11_deserializeOpDisassociateResourceTypes) ID() string { return "OperationDeserializer" } -func (m *awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsAwsjson11_deserializeOpDisassociateResourceTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -4784,9 +5027,9 @@ func (m *awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) Ha } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(response, &metadata) + return out, metadata, awsAwsjson11_deserializeOpErrorDisassociateResourceTypes(response, &metadata) } - output := &GetAggregateComplianceDetailsByConfigRuleOutput{} + output := &DisassociateResourceTypesOutput{} out.Result = output var buff [1024]byte @@ -4806,7 +5049,7 @@ func (m *awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) Ha return out, metadata, err } - err = awsAwsjson11_deserializeOpDocumentGetAggregateComplianceDetailsByConfigRuleOutput(&output, shape) + err = awsAwsjson11_deserializeOpDocumentDisassociateResourceTypesOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -4820,7 +5063,7 @@ func (m *awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) Ha return out, metadata, err } -func awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsAwsjson11_deserializeOpErrorDisassociateResourceTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -4857,14 +5100,11 @@ func awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(re errorMessage = bodyInfo.Message } switch { - case strings.EqualFold("InvalidLimitException", errorCode): - return awsAwsjson11_deserializeErrorInvalidLimitException(response, errorBody) + case strings.EqualFold("ConflictException", errorCode): + return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - case strings.EqualFold("InvalidNextTokenException", errorCode): - return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody) - - case strings.EqualFold("NoSuchConfigurationAggregatorException", errorCode): - return awsAwsjson11_deserializeErrorNoSuchConfigurationAggregatorException(response, errorBody) + case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): + return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsAwsjson11_deserializeErrorValidationException(response, errorBody) @@ -4879,14 +5119,14 @@ func awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(re } } -type awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary struct { +type awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule struct { } -func (*awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) ID() string { +func (*awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) ID() string { return "OperationDeserializer" } -func (m *awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsAwsjson11_deserializeOpGetAggregateComplianceDetailsByConfigRule) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -4904,9 +5144,9 @@ func (m *awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) Hand } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetAggregateConfigRuleComplianceSummary(response, &metadata) + return out, metadata, awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(response, &metadata) } - output := &GetAggregateConfigRuleComplianceSummaryOutput{} + output := &GetAggregateComplianceDetailsByConfigRuleOutput{} out.Result = output var buff [1024]byte @@ -4926,7 +5166,7 @@ func (m *awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) Hand return out, metadata, err } - err = awsAwsjson11_deserializeOpDocumentGetAggregateConfigRuleComplianceSummaryOutput(&output, shape) + err = awsAwsjson11_deserializeOpDocumentGetAggregateComplianceDetailsByConfigRuleOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -4940,7 +5180,7 @@ func (m *awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) Hand return out, metadata, err } -func awsAwsjson11_deserializeOpErrorGetAggregateConfigRuleComplianceSummary(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsAwsjson11_deserializeOpErrorGetAggregateComplianceDetailsByConfigRule(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -4999,10 +5239,130 @@ func awsAwsjson11_deserializeOpErrorGetAggregateConfigRuleComplianceSummary(resp } } -type awsAwsjson11_deserializeOpGetAggregateConformancePackComplianceSummary struct { +type awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary struct { } -func (*awsAwsjson11_deserializeOpGetAggregateConformancePackComplianceSummary) ID() string { +func (*awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpGetAggregateConfigRuleComplianceSummary) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorGetAggregateConfigRuleComplianceSummary(response, &metadata) + } + output := &GetAggregateConfigRuleComplianceSummaryOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentGetAggregateConfigRuleComplianceSummaryOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorGetAggregateConfigRuleComplianceSummary(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("InvalidLimitException", errorCode): + return awsAwsjson11_deserializeErrorInvalidLimitException(response, errorBody) + + case strings.EqualFold("InvalidNextTokenException", errorCode): + return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody) + + case strings.EqualFold("NoSuchConfigurationAggregatorException", errorCode): + return awsAwsjson11_deserializeErrorNoSuchConfigurationAggregatorException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsAwsjson11_deserializeOpGetAggregateConformancePackComplianceSummary struct { +} + +func (*awsAwsjson11_deserializeOpGetAggregateConformancePackComplianceSummary) ID() string { return "OperationDeserializer" } @@ -7099,6 +7459,117 @@ func awsAwsjson11_deserializeOpErrorListAggregateDiscoveredResources(response *s } } +type awsAwsjson11_deserializeOpListConfigurationRecorders struct { +} + +func (*awsAwsjson11_deserializeOpListConfigurationRecorders) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpListConfigurationRecorders) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorListConfigurationRecorders(response, &metadata) + } + output := &ListConfigurationRecordersOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentListConfigurationRecordersOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorListConfigurationRecorders(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpListConformancePackComplianceScores struct { } @@ -8113,6 +8584,9 @@ func awsAwsjson11_deserializeOpErrorPutConfigurationRecorder(response *smithyhtt case strings.EqualFold("MaxNumberOfConfigurationRecordersExceededException", errorCode): return awsAwsjson11_deserializeErrorMaxNumberOfConfigurationRecordersExceededException(response, errorBody) + case strings.EqualFold("UnmodifiableEntityException", errorCode): + return awsAwsjson11_deserializeErrorUnmodifiableEntityException(response, errorBody) + case strings.EqualFold("ValidationException", errorCode): return awsAwsjson11_deserializeErrorValidationException(response, errorBody) @@ -9294,14 +9768,14 @@ func awsAwsjson11_deserializeOpErrorPutRetentionConfiguration(response *smithyht } } -type awsAwsjson11_deserializeOpPutStoredQuery struct { +type awsAwsjson11_deserializeOpPutServiceLinkedConfigurationRecorder struct { } -func (*awsAwsjson11_deserializeOpPutStoredQuery) ID() string { +func (*awsAwsjson11_deserializeOpPutServiceLinkedConfigurationRecorder) ID() string { return "OperationDeserializer" } -func (m *awsAwsjson11_deserializeOpPutStoredQuery) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsAwsjson11_deserializeOpPutServiceLinkedConfigurationRecorder) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -9319,9 +9793,9 @@ func (m *awsAwsjson11_deserializeOpPutStoredQuery) HandleDeserialize(ctx context } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorPutStoredQuery(response, &metadata) + return out, metadata, awsAwsjson11_deserializeOpErrorPutServiceLinkedConfigurationRecorder(response, &metadata) } - output := &PutStoredQueryOutput{} + output := &PutServiceLinkedConfigurationRecorderOutput{} out.Result = output var buff [1024]byte @@ -9341,7 +9815,7 @@ func (m *awsAwsjson11_deserializeOpPutStoredQuery) HandleDeserialize(ctx context return out, metadata, err } - err = awsAwsjson11_deserializeOpDocumentPutStoredQueryOutput(&output, shape) + err = awsAwsjson11_deserializeOpDocumentPutServiceLinkedConfigurationRecorderOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -9355,7 +9829,7 @@ func (m *awsAwsjson11_deserializeOpPutStoredQuery) HandleDeserialize(ctx context return out, metadata, err } -func awsAwsjson11_deserializeOpErrorPutStoredQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsAwsjson11_deserializeOpErrorPutServiceLinkedConfigurationRecorder(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -9392,11 +9866,14 @@ func awsAwsjson11_deserializeOpErrorPutStoredQuery(response *smithyhttp.Response errorMessage = bodyInfo.Message } switch { - case strings.EqualFold("ResourceConcurrentModificationException", errorCode): - return awsAwsjson11_deserializeErrorResourceConcurrentModificationException(response, errorBody) + case strings.EqualFold("ConflictException", errorCode): + return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - case strings.EqualFold("TooManyTagsException", errorCode): - return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) + case strings.EqualFold("InsufficientPermissionsException", errorCode): + return awsAwsjson11_deserializeErrorInsufficientPermissionsException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsAwsjson11_deserializeErrorValidationException(response, errorBody) @@ -9411,14 +9888,14 @@ func awsAwsjson11_deserializeOpErrorPutStoredQuery(response *smithyhttp.Response } } -type awsAwsjson11_deserializeOpSelectAggregateResourceConfig struct { +type awsAwsjson11_deserializeOpPutStoredQuery struct { } -func (*awsAwsjson11_deserializeOpSelectAggregateResourceConfig) ID() string { +func (*awsAwsjson11_deserializeOpPutStoredQuery) ID() string { return "OperationDeserializer" } -func (m *awsAwsjson11_deserializeOpSelectAggregateResourceConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsAwsjson11_deserializeOpPutStoredQuery) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -9436,9 +9913,9 @@ func (m *awsAwsjson11_deserializeOpSelectAggregateResourceConfig) HandleDeserial } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorSelectAggregateResourceConfig(response, &metadata) + return out, metadata, awsAwsjson11_deserializeOpErrorPutStoredQuery(response, &metadata) } - output := &SelectAggregateResourceConfigOutput{} + output := &PutStoredQueryOutput{} out.Result = output var buff [1024]byte @@ -9458,7 +9935,7 @@ func (m *awsAwsjson11_deserializeOpSelectAggregateResourceConfig) HandleDeserial return out, metadata, err } - err = awsAwsjson11_deserializeOpDocumentSelectAggregateResourceConfigOutput(&output, shape) + err = awsAwsjson11_deserializeOpDocumentPutStoredQueryOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -9472,7 +9949,124 @@ func (m *awsAwsjson11_deserializeOpSelectAggregateResourceConfig) HandleDeserial return out, metadata, err } -func awsAwsjson11_deserializeOpErrorSelectAggregateResourceConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsAwsjson11_deserializeOpErrorPutStoredQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("ResourceConcurrentModificationException", errorCode): + return awsAwsjson11_deserializeErrorResourceConcurrentModificationException(response, errorBody) + + case strings.EqualFold("TooManyTagsException", errorCode): + return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson11_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsAwsjson11_deserializeOpSelectAggregateResourceConfig struct { +} + +func (*awsAwsjson11_deserializeOpSelectAggregateResourceConfig) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpSelectAggregateResourceConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorSelectAggregateResourceConfig(response, &metadata) + } + output := &SelectAggregateResourceConfigOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentSelectAggregateResourceConfigOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorSelectAggregateResourceConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -9850,6 +10444,9 @@ func awsAwsjson11_deserializeOpErrorStartConfigurationRecorder(response *smithyh case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + case strings.EqualFold("UnmodifiableEntityException", errorCode): + return awsAwsjson11_deserializeErrorUnmodifiableEntityException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -10170,6 +10767,9 @@ func awsAwsjson11_deserializeOpErrorStopConfigurationRecorder(response *smithyht case strings.EqualFold("NoSuchConfigurationRecorderException", errorCode): return awsAwsjson11_deserializeErrorNoSuchConfigurationRecorderException(response, errorBody) + case strings.EqualFold("UnmodifiableEntityException", errorCode): + return awsAwsjson11_deserializeErrorUnmodifiableEntityException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -10367,6 +10967,41 @@ func awsAwsjson11_deserializeOpErrorUntagResource(response *smithyhttp.Response, } } +func awsAwsjson11_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + 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 + } + + output := &types.ConflictException{} + err := awsAwsjson11_deserializeDocumentConflictException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + return output +} + func awsAwsjson11_deserializeErrorConformancePackTemplateValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -12222,6 +12857,41 @@ func awsAwsjson11_deserializeErrorTooManyTagsException(response *smithyhttp.Resp return output } +func awsAwsjson11_deserializeErrorUnmodifiableEntityException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + 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 + } + + output := &types.UnmodifiableEntityException{} + err := awsAwsjson11_deserializeDocumentUnmodifiableEntityException(&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 awsAwsjson11_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -13322,7 +13992,7 @@ func awsAwsjson11_deserializeDocumentAggregationAuthorizationList(v *[]types.Agg return nil } -func awsAwsjson11_deserializeDocumentAggregatorRegionList(v *[]string, value interface{}) error { +func awsAwsjson11_deserializeDocumentAggregatorFilterResourceType(v **types.AggregatorFilterResourceType, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -13330,35 +14000,85 @@ func awsAwsjson11_deserializeDocumentAggregatorRegionList(v *[]string, value int return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []string + var sv *types.AggregatorFilterResourceType if *v == nil { - cv = []string{} + sv = &types.AggregatorFilterResourceType{} } else { - cv = *v + sv = *v } - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) + for key, value := range shape { + switch key { + case "Type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AggregatorFilterType to be of type string, got %T instead", value) + } + sv.Type = types.AggregatorFilterType(jtv) } - col = jtv + + case "Value": + if err := awsAwsjson11_deserializeDocumentResourceTypeValueList(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + } - cv = append(cv, col) + } + *v = sv + return nil +} +func awsAwsjson11_deserializeDocumentAggregatorFilters(v **types.AggregatorFilters, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) } - *v = cv + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AggregatorFilters + if *v == nil { + sv = &types.AggregatorFilters{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ResourceType": + if err := awsAwsjson11_deserializeDocumentAggregatorFilterResourceType(&sv.ResourceType, value); err != nil { + return err + } + + case "ServicePrincipal": + if err := awsAwsjson11_deserializeDocumentAggregatorFilterServicePrincipal(&sv.ServicePrincipal, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv return nil } -func awsAwsjson11_deserializeDocumentBaseConfigurationItem(v **types.BaseConfigurationItem, value interface{}) error { +func awsAwsjson11_deserializeDocumentAggregatorFilterServicePrincipal(v **types.AggregatorFilterServicePrincipal, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -13371,26 +14091,107 @@ func awsAwsjson11_deserializeDocumentBaseConfigurationItem(v **types.BaseConfigu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.BaseConfigurationItem + var sv *types.AggregatorFilterServicePrincipal if *v == nil { - sv = &types.BaseConfigurationItem{} + sv = &types.AggregatorFilterServicePrincipal{} } else { sv = *v } for key, value := range shape { switch key { - case "accountId": + case "Type": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) + return fmt.Errorf("expected AggregatorFilterType to be of type string, got %T instead", value) } - sv.AccountId = ptr.String(jtv) + sv.Type = types.AggregatorFilterType(jtv) } - case "arn": - if value != nil { + case "Value": + if err := awsAwsjson11_deserializeDocumentServicePrincipalValueList(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentAggregatorRegionList(v *[]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []string + if *v == nil { + cv = []string{} + } else { + cv = *v + } + + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsAwsjson11_deserializeDocumentBaseConfigurationItem(v **types.BaseConfigurationItem, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.BaseConfigurationItem + if *v == nil { + sv = &types.BaseConfigurationItem{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "accountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) + } + sv.AccountId = ptr.String(jtv) + } + + case "arn": + if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ARN to be of type string, got %T instead", value) @@ -14669,6 +15470,11 @@ func awsAwsjson11_deserializeDocumentConfigurationAggregator(v **types.Configura return err } + case "AggregatorFilters": + if err := awsAwsjson11_deserializeDocumentAggregatorFilters(&sv.AggregatorFilters, value); err != nil { + return err + } + case "ConfigurationAggregatorArn": if value != nil { jtv, ok := value.(string) @@ -15048,6 +15854,15 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorder(v **types.Configurati for key, value := range shape { switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + case "name": if value != nil { jtv, ok := value.(string) @@ -15067,6 +15882,15 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorder(v **types.Configurati return err } + case "recordingScope": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecordingScope to be of type string, got %T instead", value) + } + sv.RecordingScope = types.RecordingScope(jtv) + } + case "roleARN": if value != nil { jtv, ok := value.(string) @@ -15076,6 +15900,15 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorder(v **types.Configurati sv.RoleARN = ptr.String(jtv) } + case "servicePrincipal": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipal to be of type string, got %T instead", value) + } + sv.ServicePrincipal = ptr.String(jtv) + } + default: _, _ = key, value @@ -15141,6 +15974,15 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorderStatus(v **types.Confi for key, value := range shape { switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + case "lastErrorCode": if value != nil { jtv, ok := value.(string) @@ -15234,6 +16076,15 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorderStatus(v **types.Confi sv.Recording = jtv } + case "servicePrincipal": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipal to be of type string, got %T instead", value) + } + sv.ServicePrincipal = ptr.String(jtv) + } + default: _, _ = key, value @@ -15277,6 +16128,147 @@ func awsAwsjson11_deserializeDocumentConfigurationRecorderStatusList(v *[]types. return nil } +func awsAwsjson11_deserializeDocumentConfigurationRecorderSummaries(v *[]types.ConfigurationRecorderSummary, 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.ConfigurationRecorderSummary + if *v == nil { + cv = []types.ConfigurationRecorderSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ConfigurationRecorderSummary + destAddr := &col + if err := awsAwsjson11_deserializeDocumentConfigurationRecorderSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsAwsjson11_deserializeDocumentConfigurationRecorderSummary(v **types.ConfigurationRecorderSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ConfigurationRecorderSummary + if *v == nil { + sv = &types.ConfigurationRecorderSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecorderName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "recordingScope": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecordingScope to be of type string, got %T instead", value) + } + sv.RecordingScope = types.RecordingScope(jtv) + } + + case "servicePrincipal": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipal to be of type string, got %T instead", value) + } + sv.ServicePrincipal = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ConflictException + if *v == nil { + sv = &types.ConflictException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message", "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 awsAwsjson11_deserializeDocumentConformancePackComplianceScore(v **types.ConformancePackComplianceScore, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -22441,7 +23433,7 @@ func awsAwsjson11_deserializeDocumentResourceTypesScope(v *[]string, value inter return nil } -func awsAwsjson11_deserializeDocumentResourceValue(v **types.ResourceValue, value interface{}) error { +func awsAwsjson11_deserializeDocumentResourceTypeValueList(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -22449,23 +23441,59 @@ func awsAwsjson11_deserializeDocumentResourceValue(v **types.ResourceValue, valu return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.ResourceValue + var cv []string if *v == nil { - sv = &types.ResourceValue{} + cv = []string{} } else { - sv = *v + cv = *v } - for key, value := range shape { - switch key { - case "Value": - if value != nil { - jtv, ok := value.(string) + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceTypeValue to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsAwsjson11_deserializeDocumentResourceValue(v **types.ResourceValue, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceValue + if *v == nil { + sv = &types.ResourceValue{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Value": + if value != nil { + jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ResourceValueType to be of type string, got %T instead", value) } @@ -22667,6 +23695,42 @@ func awsAwsjson11_deserializeDocumentScope(v **types.Scope, value interface{}) e return nil } +func awsAwsjson11_deserializeDocumentServicePrincipalValueList(v *[]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []string + if *v == nil { + cv = []string{} + } else { + cv = *v + } + + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipalValue to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentSource(v **types.Source, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -23368,6 +24432,46 @@ func awsAwsjson11_deserializeDocumentTooManyTagsException(v **types.TooManyTagsE return nil } +func awsAwsjson11_deserializeDocumentUnmodifiableEntityException(v **types.UnmodifiableEntityException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.UnmodifiableEntityException + if *v == nil { + sv = &types.UnmodifiableEntityException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message", "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 awsAwsjson11_deserializeDocumentUnprocessedResourceIdentifierList(v *[]types.AggregateResourceIdentifier, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -23442,6 +24546,42 @@ func awsAwsjson11_deserializeDocumentValidationException(v **types.ValidationExc return nil } +func awsAwsjson11_deserializeOpDocumentAssociateResourceTypesOutput(v **AssociateResourceTypesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *AssociateResourceTypesOutput + if *v == nil { + sv = &AssociateResourceTypesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConfigurationRecorder": + if err := awsAwsjson11_deserializeDocumentConfigurationRecorder(&sv.ConfigurationRecorder, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentBatchGetAggregateResourceConfigOutput(v **BatchGetAggregateResourceConfigOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -23622,6 +24762,55 @@ func awsAwsjson11_deserializeOpDocumentDeleteRemediationExceptionsOutput(v **Del return nil } +func awsAwsjson11_deserializeOpDocumentDeleteServiceLinkedConfigurationRecorderOutput(v **DeleteServiceLinkedConfigurationRecorderOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteServiceLinkedConfigurationRecorderOutput + if *v == nil { + sv = &DeleteServiceLinkedConfigurationRecorderOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecorderName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentDeleteStoredQueryOutput(v **DeleteStoredQueryOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -24782,6 +25971,42 @@ func awsAwsjson11_deserializeOpDocumentDescribeRetentionConfigurationsOutput(v * return nil } +func awsAwsjson11_deserializeOpDocumentDisassociateResourceTypesOutput(v **DisassociateResourceTypesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DisassociateResourceTypesOutput + if *v == nil { + sv = &DisassociateResourceTypesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConfigurationRecorder": + if err := awsAwsjson11_deserializeDocumentConfigurationRecorder(&sv.ConfigurationRecorder, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentGetAggregateComplianceDetailsByConfigRuleOutput(v **GetAggregateComplianceDetailsByConfigRuleOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -25742,6 +26967,51 @@ func awsAwsjson11_deserializeOpDocumentListAggregateDiscoveredResourcesOutput(v return nil } +func awsAwsjson11_deserializeOpDocumentListConfigurationRecordersOutput(v **ListConfigurationRecordersOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListConfigurationRecordersOutput + if *v == nil { + sv = &ListConfigurationRecordersOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConfigurationRecorderSummaries": + if err := awsAwsjson11_deserializeDocumentConfigurationRecorderSummaries(&sv.ConfigurationRecorderSummaries, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentListConformancePackComplianceScoresOutput(v **ListConformancePackComplianceScoresOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -26334,6 +27604,55 @@ func awsAwsjson11_deserializeOpDocumentPutRetentionConfigurationOutput(v **PutRe return nil } +func awsAwsjson11_deserializeOpDocumentPutServiceLinkedConfigurationRecorderOutput(v **PutServiceLinkedConfigurationRecorderOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *PutServiceLinkedConfigurationRecorderOutput + if *v == nil { + sv = &PutServiceLinkedConfigurationRecorderOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RecorderName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentPutStoredQueryOutput(v **PutStoredQueryOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/configservice/generated.json b/service/configservice/generated.json index 94179f4ee91..d7f8c537972 100644 --- a/service/configservice/generated.json +++ b/service/configservice/generated.json @@ -8,6 +8,7 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_AssociateResourceTypes.go", "api_op_BatchGetAggregateResourceConfig.go", "api_op_BatchGetResourceConfig.go", "api_op_DeleteAggregationAuthorization.go", @@ -24,6 +25,7 @@ "api_op_DeleteRemediationExceptions.go", "api_op_DeleteResourceConfig.go", "api_op_DeleteRetentionConfiguration.go", + "api_op_DeleteServiceLinkedConfigurationRecorder.go", "api_op_DeleteStoredQuery.go", "api_op_DeliverConfigSnapshot.go", "api_op_DescribeAggregateComplianceByConfigRules.go", @@ -51,6 +53,7 @@ "api_op_DescribeRemediationExceptions.go", "api_op_DescribeRemediationExecutionStatus.go", "api_op_DescribeRetentionConfigurations.go", + "api_op_DisassociateResourceTypes.go", "api_op_GetAggregateComplianceDetailsByConfigRule.go", "api_op_GetAggregateConfigRuleComplianceSummary.go", "api_op_GetAggregateConformancePackComplianceSummary.go", @@ -71,6 +74,7 @@ "api_op_GetResourceEvaluationSummary.go", "api_op_GetStoredQuery.go", "api_op_ListAggregateDiscoveredResources.go", + "api_op_ListConfigurationRecorders.go", "api_op_ListConformancePackComplianceScores.go", "api_op_ListDiscoveredResources.go", "api_op_ListResourceEvaluations.go", @@ -90,6 +94,7 @@ "api_op_PutRemediationExceptions.go", "api_op_PutResourceConfig.go", "api_op_PutRetentionConfiguration.go", + "api_op_PutServiceLinkedConfigurationRecorder.go", "api_op_PutStoredQuery.go", "api_op_SelectAggregateResourceConfig.go", "api_op_SelectResourceConfig.go", diff --git a/service/configservice/serializers.go b/service/configservice/serializers.go index abb6411f781..118e4d0e0e8 100644 --- a/service/configservice/serializers.go +++ b/service/configservice/serializers.go @@ -18,6 +18,67 @@ import ( "strings" ) +type awsAwsjson11_serializeOpAssociateResourceTypes struct { +} + +func (*awsAwsjson11_serializeOpAssociateResourceTypes) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpAssociateResourceTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*AssociateResourceTypesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("StarlingDoveService.AssociateResourceTypes") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentAssociateResourceTypesInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpBatchGetAggregateResourceConfig struct { } @@ -994,6 +1055,67 @@ func (m *awsAwsjson11_serializeOpDeleteRetentionConfiguration) HandleSerialize(c return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpDeleteServiceLinkedConfigurationRecorder struct { +} + +func (*awsAwsjson11_serializeOpDeleteServiceLinkedConfigurationRecorder) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpDeleteServiceLinkedConfigurationRecorder) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DeleteServiceLinkedConfigurationRecorderInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("StarlingDoveService.DeleteServiceLinkedConfigurationRecorder") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentDeleteServiceLinkedConfigurationRecorderInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpDeleteStoredQuery struct { } @@ -2641,6 +2763,67 @@ func (m *awsAwsjson11_serializeOpDescribeRetentionConfigurations) HandleSerializ return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpDisassociateResourceTypes struct { +} + +func (*awsAwsjson11_serializeOpDisassociateResourceTypes) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpDisassociateResourceTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DisassociateResourceTypesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("StarlingDoveService.DisassociateResourceTypes") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentDisassociateResourceTypesInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpGetAggregateComplianceDetailsByConfigRule struct { } @@ -3856,6 +4039,67 @@ func (m *awsAwsjson11_serializeOpListAggregateDiscoveredResources) HandleSeriali return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpListConfigurationRecorders struct { +} + +func (*awsAwsjson11_serializeOpListConfigurationRecorders) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpListConfigurationRecorders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListConfigurationRecordersInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("StarlingDoveService.ListConfigurationRecorders") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentListConfigurationRecordersInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpListConformancePackComplianceScores struct { } @@ -5015,6 +5259,67 @@ func (m *awsAwsjson11_serializeOpPutRetentionConfiguration) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpPutServiceLinkedConfigurationRecorder struct { +} + +func (*awsAwsjson11_serializeOpPutServiceLinkedConfigurationRecorder) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpPutServiceLinkedConfigurationRecorder) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*PutServiceLinkedConfigurationRecorderInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("StarlingDoveService.PutServiceLinkedConfigurationRecorder") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentPutServiceLinkedConfigurationRecorderInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpPutStoredQuery struct { } @@ -5761,6 +6066,65 @@ func awsAwsjson11_serializeDocumentAggregateResourceIdentifier(v *types.Aggregat return nil } +func awsAwsjson11_serializeDocumentAggregatorFilterResourceType(v *types.AggregatorFilterResourceType, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Type) > 0 { + ok := object.Key("Type") + ok.String(string(v.Type)) + } + + if v.Value != nil { + ok := object.Key("Value") + if err := awsAwsjson11_serializeDocumentResourceTypeValueList(v.Value, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentAggregatorFilters(v *types.AggregatorFilters, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceType != nil { + ok := object.Key("ResourceType") + if err := awsAwsjson11_serializeDocumentAggregatorFilterResourceType(v.ResourceType, ok); err != nil { + return err + } + } + + if v.ServicePrincipal != nil { + ok := object.Key("ServicePrincipal") + if err := awsAwsjson11_serializeDocumentAggregatorFilterServicePrincipal(v.ServicePrincipal, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentAggregatorFilterServicePrincipal(v *types.AggregatorFilterServicePrincipal, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Type) > 0 { + ok := object.Key("Type") + ok.String(string(v.Type)) + } + + if v.Value != nil { + ok := object.Key("Value") + if err := awsAwsjson11_serializeDocumentServicePrincipalValueList(v.Value, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeDocumentAggregatorRegionList(v []string, value smithyjson.Value) error { array := value.Array() defer array.Close() @@ -5944,6 +6308,11 @@ func awsAwsjson11_serializeDocumentConfigurationRecorder(v *types.ConfigurationR object := value.Object() defer object.Close() + if v.Arn != nil { + ok := object.Key("arn") + ok.String(*v.Arn) + } + if v.Name != nil { ok := object.Key("name") ok.String(*v.Name) @@ -5963,11 +6332,64 @@ func awsAwsjson11_serializeDocumentConfigurationRecorder(v *types.ConfigurationR } } + if len(v.RecordingScope) > 0 { + ok := object.Key("recordingScope") + ok.String(string(v.RecordingScope)) + } + if v.RoleARN != nil { ok := object.Key("roleARN") ok.String(*v.RoleARN) } + if v.ServicePrincipal != nil { + ok := object.Key("servicePrincipal") + ok.String(*v.ServicePrincipal) + } + + return nil +} + +func awsAwsjson11_serializeDocumentConfigurationRecorderFilter(v *types.ConfigurationRecorderFilter, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.FilterName) > 0 { + ok := object.Key("filterName") + ok.String(string(v.FilterName)) + } + + if v.FilterValue != nil { + ok := object.Key("filterValue") + if err := awsAwsjson11_serializeDocumentConfigurationRecorderFilterValues(v.FilterValue, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentConfigurationRecorderFilterList(v []types.ConfigurationRecorderFilter, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsAwsjson11_serializeDocumentConfigurationRecorderFilter(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsAwsjson11_serializeDocumentConfigurationRecorderFilterValues(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } return nil } @@ -7101,6 +7523,17 @@ func awsAwsjson11_serializeDocumentResourceTypesScope(v []string, value smithyjs return nil } +func awsAwsjson11_serializeDocumentResourceTypeValueList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsAwsjson11_serializeDocumentResourceValue(v *types.ResourceValue, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -7153,6 +7586,17 @@ func awsAwsjson11_serializeDocumentScope(v *types.Scope, value smithyjson.Value) return nil } +func awsAwsjson11_serializeDocumentServicePrincipalValueList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsAwsjson11_serializeDocumentSource(v *types.Source, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -7409,6 +7853,25 @@ func awsAwsjson11_serializeDocumentTimeWindow(v *types.TimeWindow, value smithyj return nil } +func awsAwsjson11_serializeOpDocumentAssociateResourceTypesInput(v *AssociateResourceTypesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ConfigurationRecorderArn != nil { + ok := object.Key("ConfigurationRecorderArn") + ok.String(*v.ConfigurationRecorderArn) + } + + if v.ResourceTypes != nil { + ok := object.Key("ResourceTypes") + if err := awsAwsjson11_serializeDocumentResourceTypeList(v.ResourceTypes, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeOpDocumentBatchGetAggregateResourceConfigInput(v *BatchGetAggregateResourceConfigInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -7637,6 +8100,18 @@ func awsAwsjson11_serializeOpDocumentDeleteRetentionConfigurationInput(v *Delete return nil } +func awsAwsjson11_serializeOpDocumentDeleteServiceLinkedConfigurationRecorderInput(v *DeleteServiceLinkedConfigurationRecorderInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ServicePrincipal != nil { + ok := object.Key("ServicePrincipal") + ok.String(*v.ServicePrincipal) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentDeleteStoredQueryInput(v *DeleteStoredQueryInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -7903,6 +8378,11 @@ func awsAwsjson11_serializeOpDocumentDescribeConfigurationRecordersInput(v *Desc object := value.Object() defer object.Close() + if v.Arn != nil { + ok := object.Key("Arn") + ok.String(*v.Arn) + } + if v.ConfigurationRecorderNames != nil { ok := object.Key("ConfigurationRecorderNames") if err := awsAwsjson11_serializeDocumentConfigurationRecorderNameList(v.ConfigurationRecorderNames, ok); err != nil { @@ -7910,6 +8390,11 @@ func awsAwsjson11_serializeOpDocumentDescribeConfigurationRecordersInput(v *Desc } } + if v.ServicePrincipal != nil { + ok := object.Key("ServicePrincipal") + ok.String(*v.ServicePrincipal) + } + return nil } @@ -7917,6 +8402,11 @@ func awsAwsjson11_serializeOpDocumentDescribeConfigurationRecorderStatusInput(v object := value.Object() defer object.Close() + if v.Arn != nil { + ok := object.Key("Arn") + ok.String(*v.Arn) + } + if v.ConfigurationRecorderNames != nil { ok := object.Key("ConfigurationRecorderNames") if err := awsAwsjson11_serializeDocumentConfigurationRecorderNameList(v.ConfigurationRecorderNames, ok); err != nil { @@ -7924,6 +8414,11 @@ func awsAwsjson11_serializeOpDocumentDescribeConfigurationRecorderStatusInput(v } } + if v.ServicePrincipal != nil { + ok := object.Key("ServicePrincipal") + ok.String(*v.ServicePrincipal) + } + return nil } @@ -8236,6 +8731,25 @@ func awsAwsjson11_serializeOpDocumentDescribeRetentionConfigurationsInput(v *Des return nil } +func awsAwsjson11_serializeOpDocumentDisassociateResourceTypesInput(v *DisassociateResourceTypesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ConfigurationRecorderArn != nil { + ok := object.Key("ConfigurationRecorderArn") + ok.String(*v.ConfigurationRecorderArn) + } + + if v.ResourceTypes != nil { + ok := object.Key("ResourceTypes") + if err := awsAwsjson11_serializeDocumentResourceTypeList(v.ResourceTypes, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeOpDocumentGetAggregateComplianceDetailsByConfigRuleInput(v *GetAggregateComplianceDetailsByConfigRuleInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -8735,6 +9249,30 @@ func awsAwsjson11_serializeOpDocumentListAggregateDiscoveredResourcesInput(v *Li return nil } +func awsAwsjson11_serializeOpDocumentListConfigurationRecordersInput(v *ListConfigurationRecordersInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Filters != nil { + ok := object.Key("Filters") + if err := awsAwsjson11_serializeDocumentConfigurationRecorderFilterList(v.Filters, ok); err != nil { + return err + } + } + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentListConformancePackComplianceScoresInput(v *ListConformancePackComplianceScoresInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -8927,6 +9465,13 @@ func awsAwsjson11_serializeOpDocumentPutConfigurationAggregatorInput(v *PutConfi } } + if v.AggregatorFilters != nil { + ok := object.Key("AggregatorFilters") + if err := awsAwsjson11_serializeDocumentAggregatorFilters(v.AggregatorFilters, ok); err != nil { + return err + } + } + if v.ConfigurationAggregatorName != nil { ok := object.Key("ConfigurationAggregatorName") ok.String(*v.ConfigurationAggregatorName) @@ -8960,6 +9505,13 @@ func awsAwsjson11_serializeOpDocumentPutConfigurationRecorderInput(v *PutConfigu } } + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsAwsjson11_serializeDocumentTagsList(v.Tags, ok); err != nil { + return err + } + } + return nil } @@ -9246,6 +9798,25 @@ func awsAwsjson11_serializeOpDocumentPutRetentionConfigurationInput(v *PutRetent return nil } +func awsAwsjson11_serializeOpDocumentPutServiceLinkedConfigurationRecorderInput(v *PutServiceLinkedConfigurationRecorderInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ServicePrincipal != nil { + ok := object.Key("ServicePrincipal") + ok.String(*v.ServicePrincipal) + } + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsAwsjson11_serializeDocumentTagsList(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeOpDocumentPutStoredQueryInput(v *PutStoredQueryInput, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/configservice/snapshot/api_op_AssociateResourceTypes.go.snap b/service/configservice/snapshot/api_op_AssociateResourceTypes.go.snap new file mode 100644 index 00000000000..74cdd520607 --- /dev/null +++ b/service/configservice/snapshot/api_op_AssociateResourceTypes.go.snap @@ -0,0 +1,41 @@ +AssociateResourceTypes + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + OperationInputValidation + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/configservice/snapshot/api_op_DeleteServiceLinkedConfigurationRecorder.go.snap b/service/configservice/snapshot/api_op_DeleteServiceLinkedConfigurationRecorder.go.snap new file mode 100644 index 00000000000..1b4a98f310e --- /dev/null +++ b/service/configservice/snapshot/api_op_DeleteServiceLinkedConfigurationRecorder.go.snap @@ -0,0 +1,41 @@ +DeleteServiceLinkedConfigurationRecorder + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + OperationInputValidation + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/configservice/snapshot/api_op_DisassociateResourceTypes.go.snap b/service/configservice/snapshot/api_op_DisassociateResourceTypes.go.snap new file mode 100644 index 00000000000..02fb388d5af --- /dev/null +++ b/service/configservice/snapshot/api_op_DisassociateResourceTypes.go.snap @@ -0,0 +1,41 @@ +DisassociateResourceTypes + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + OperationInputValidation + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/configservice/snapshot/api_op_ListConfigurationRecorders.go.snap b/service/configservice/snapshot/api_op_ListConfigurationRecorders.go.snap new file mode 100644 index 00000000000..2ff181193f4 --- /dev/null +++ b/service/configservice/snapshot/api_op_ListConfigurationRecorders.go.snap @@ -0,0 +1,40 @@ +ListConfigurationRecorders + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/configservice/snapshot/api_op_PutServiceLinkedConfigurationRecorder.go.snap b/service/configservice/snapshot/api_op_PutServiceLinkedConfigurationRecorder.go.snap new file mode 100644 index 00000000000..385dc5cbe6e --- /dev/null +++ b/service/configservice/snapshot/api_op_PutServiceLinkedConfigurationRecorder.go.snap @@ -0,0 +1,41 @@ +PutServiceLinkedConfigurationRecorder + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + OperationInputValidation + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/configservice/snapshot_test.go b/service/configservice/snapshot_test.go index 7074c2fffac..232d8975ea3 100644 --- a/service/configservice/snapshot_test.go +++ b/service/configservice/snapshot_test.go @@ -62,6 +62,18 @@ func testSnapshot(stack *middleware.Stack, operation string) error { } return snapshotOK{} } +func TestCheckSnapshot_AssociateResourceTypes(t *testing.T) { + svc := New(Options{}) + _, err := svc.AssociateResourceTypes(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "AssociateResourceTypes") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_BatchGetAggregateResourceConfig(t *testing.T) { svc := New(Options{}) _, err := svc.BatchGetAggregateResourceConfig(context.Background(), nil, func(o *Options) { @@ -254,6 +266,18 @@ func TestCheckSnapshot_DeleteRetentionConfiguration(t *testing.T) { } } +func TestCheckSnapshot_DeleteServiceLinkedConfigurationRecorder(t *testing.T) { + svc := New(Options{}) + _, err := svc.DeleteServiceLinkedConfigurationRecorder(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "DeleteServiceLinkedConfigurationRecorder") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_DeleteStoredQuery(t *testing.T) { svc := New(Options{}) _, err := svc.DeleteStoredQuery(context.Background(), nil, func(o *Options) { @@ -578,6 +602,18 @@ func TestCheckSnapshot_DescribeRetentionConfigurations(t *testing.T) { } } +func TestCheckSnapshot_DisassociateResourceTypes(t *testing.T) { + svc := New(Options{}) + _, err := svc.DisassociateResourceTypes(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "DisassociateResourceTypes") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_GetAggregateComplianceDetailsByConfigRule(t *testing.T) { svc := New(Options{}) _, err := svc.GetAggregateComplianceDetailsByConfigRule(context.Background(), nil, func(o *Options) { @@ -818,6 +854,18 @@ func TestCheckSnapshot_ListAggregateDiscoveredResources(t *testing.T) { } } +func TestCheckSnapshot_ListConfigurationRecorders(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListConfigurationRecorders(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "ListConfigurationRecorders") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_ListConformancePackComplianceScores(t *testing.T) { svc := New(Options{}) _, err := svc.ListConformancePackComplianceScores(context.Background(), nil, func(o *Options) { @@ -1046,6 +1094,18 @@ func TestCheckSnapshot_PutRetentionConfiguration(t *testing.T) { } } +func TestCheckSnapshot_PutServiceLinkedConfigurationRecorder(t *testing.T) { + svc := New(Options{}) + _, err := svc.PutServiceLinkedConfigurationRecorder(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "PutServiceLinkedConfigurationRecorder") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_PutStoredQuery(t *testing.T) { svc := New(Options{}) _, err := svc.PutStoredQuery(context.Background(), nil, func(o *Options) { @@ -1165,6 +1225,18 @@ func TestCheckSnapshot_UntagResource(t *testing.T) { t.Fatal(err) } } +func TestUpdateSnapshot_AssociateResourceTypes(t *testing.T) { + svc := New(Options{}) + _, err := svc.AssociateResourceTypes(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "AssociateResourceTypes") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_BatchGetAggregateResourceConfig(t *testing.T) { svc := New(Options{}) _, err := svc.BatchGetAggregateResourceConfig(context.Background(), nil, func(o *Options) { @@ -1357,6 +1429,18 @@ func TestUpdateSnapshot_DeleteRetentionConfiguration(t *testing.T) { } } +func TestUpdateSnapshot_DeleteServiceLinkedConfigurationRecorder(t *testing.T) { + svc := New(Options{}) + _, err := svc.DeleteServiceLinkedConfigurationRecorder(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "DeleteServiceLinkedConfigurationRecorder") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_DeleteStoredQuery(t *testing.T) { svc := New(Options{}) _, err := svc.DeleteStoredQuery(context.Background(), nil, func(o *Options) { @@ -1681,6 +1765,18 @@ func TestUpdateSnapshot_DescribeRetentionConfigurations(t *testing.T) { } } +func TestUpdateSnapshot_DisassociateResourceTypes(t *testing.T) { + svc := New(Options{}) + _, err := svc.DisassociateResourceTypes(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "DisassociateResourceTypes") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_GetAggregateComplianceDetailsByConfigRule(t *testing.T) { svc := New(Options{}) _, err := svc.GetAggregateComplianceDetailsByConfigRule(context.Background(), nil, func(o *Options) { @@ -1921,6 +2017,18 @@ func TestUpdateSnapshot_ListAggregateDiscoveredResources(t *testing.T) { } } +func TestUpdateSnapshot_ListConfigurationRecorders(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListConfigurationRecorders(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "ListConfigurationRecorders") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_ListConformancePackComplianceScores(t *testing.T) { svc := New(Options{}) _, err := svc.ListConformancePackComplianceScores(context.Background(), nil, func(o *Options) { @@ -2149,6 +2257,18 @@ func TestUpdateSnapshot_PutRetentionConfiguration(t *testing.T) { } } +func TestUpdateSnapshot_PutServiceLinkedConfigurationRecorder(t *testing.T) { + svc := New(Options{}) + _, err := svc.PutServiceLinkedConfigurationRecorder(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "PutServiceLinkedConfigurationRecorder") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_PutStoredQuery(t *testing.T) { svc := New(Options{}) _, err := svc.PutStoredQuery(context.Background(), nil, func(o *Options) { diff --git a/service/configservice/types/enums.go b/service/configservice/types/enums.go index 55b6ed58186..b7f65c45906 100644 --- a/service/configservice/types/enums.go +++ b/service/configservice/types/enums.go @@ -62,6 +62,23 @@ func (AggregatedSourceType) Values() []AggregatedSourceType { } } +type AggregatorFilterType string + +// Enum values for AggregatorFilterType +const ( + AggregatorFilterTypeInclude AggregatorFilterType = "INCLUDE" +) + +// Values returns all known values for AggregatorFilterType. 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 (AggregatorFilterType) Values() []AggregatorFilterType { + return []AggregatorFilterType{ + "INCLUDE", + } +} + type ChronologicalOrder string // Enum values for ChronologicalOrder @@ -172,6 +189,24 @@ func (ConfigurationItemStatus) Values() []ConfigurationItemStatus { } } +type ConfigurationRecorderFilterName string + +// Enum values for ConfigurationRecorderFilterName +const ( + ConfigurationRecorderFilterNameRecordingScope ConfigurationRecorderFilterName = "recordingScope" +) + +// Values returns all known values for ConfigurationRecorderFilterName. 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 (ConfigurationRecorderFilterName) Values() []ConfigurationRecorderFilterName { + return []ConfigurationRecorderFilterName{ + "recordingScope", + } +} + type ConformancePackComplianceType string // Enum values for ConformancePackComplianceType @@ -524,9 +559,10 @@ type RecorderStatus string // Enum values for RecorderStatus const ( - RecorderStatusPending RecorderStatus = "Pending" - RecorderStatusSuccess RecorderStatus = "Success" - RecorderStatusFailure RecorderStatus = "Failure" + RecorderStatusPending RecorderStatus = "Pending" + RecorderStatusSuccess RecorderStatus = "Success" + RecorderStatusFailure RecorderStatus = "Failure" + RecorderStatusNotApplicable RecorderStatus = "NotApplicable" ) // Values returns all known values for RecorderStatus. Note that this can be @@ -538,6 +574,7 @@ func (RecorderStatus) Values() []RecorderStatus { "Pending", "Success", "Failure", + "NotApplicable", } } @@ -560,6 +597,25 @@ func (RecordingFrequency) Values() []RecordingFrequency { } } +type RecordingScope string + +// Enum values for RecordingScope +const ( + RecordingScopeInternal RecordingScope = "INTERNAL" + RecordingScopePaid RecordingScope = "PAID" +) + +// Values returns all known values for RecordingScope. 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 (RecordingScope) Values() []RecordingScope { + return []RecordingScope{ + "INTERNAL", + "PAID", + } +} + type RecordingStrategyType string // Enum values for RecordingStrategyType diff --git a/service/configservice/types/errors.go b/service/configservice/types/errors.go index 6df3e572aad..cd2dcae1306 100644 --- a/service/configservice/types/errors.go +++ b/service/configservice/types/errors.go @@ -7,6 +7,57 @@ import ( smithy "github.com/aws/smithy-go" ) +// For [PutServiceLinkedConfigurationRecorder], you cannot create a service-linked recorder because a service-linked +// recorder already exists for the specified service. +// +// For [DeleteServiceLinkedConfigurationRecorder], you cannot delete the service-linked recorder because it is currently in +// use by the linked Amazon Web Services service. +// +// For [DeleteDeliveryChannel], you cannot delete the specified delivery channel because the customer +// managed configuration recorder is running. Use the [StopConfigurationRecorder]operation to stop the +// customer managed configuration recorder. +// +// For [AssociateResourceTypes] and [DisassociateResourceTypes], one of the following errors: +// +// - For service-linked configuration recorders, the configuration recorder is +// not in use by the service. No association or dissociation of resource types is +// permitted. +// +// - For service-linked configuration recorders, your requested change to the +// configuration recorder has been denied by its linked Amazon Web Services +// service. +// +// [PutServiceLinkedConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html +// [DisassociateResourceTypes]: https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html +// [DeleteServiceLinkedConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html +// [StopConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_StopConfigurationRecorder.html +// [AssociateResourceTypes]: https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html +// [DeleteDeliveryChannel]: https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteDeliveryChannel.html +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + // You have specified a template that is not valid or supported. type ConformancePackTemplateValidationException struct { Message *string @@ -62,7 +113,7 @@ func (e *IdempotentParameterMismatch) ErrorCode() string { } func (e *IdempotentParameterMismatch) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// Your Amazon S3 bucket policy does not permit Config to write to it. +// Your Amazon S3 bucket policy does not allow Config to write to it. type InsufficientDeliveryPolicyException struct { Message *string @@ -92,23 +143,31 @@ func (e *InsufficientDeliveryPolicyException) ErrorFault() smithy.ErrorFault { // Indicates one of the following errors: // -// - For PutConfigRule, the rule cannot be created because the IAM role assigned -// to Config lacks permissions to perform the config:Put* action. +// - For [PutConfigRule], the rule cannot be created because the IAM role assigned to Config +// lacks permissions to perform the config:Put* action. // -// - For PutConfigRule, the Lambda function cannot be invoked. Check the -// function ARN, and check the function's permissions. +// - For [PutConfigRule], the Lambda function cannot be invoked. Check the function ARN, and +// check the function's permissions. // -// - For PutOrganizationConfigRule, organization Config rule cannot be created -// because you do not have permissions to call IAM GetRole action or create a -// service-linked role. +// - For [PutOrganizationConfigRule], organization Config rule cannot be created because you do not have +// permissions to call IAM GetRole action or create a service-linked role. // -// - For PutConformancePack and PutOrganizationConformancePack, a conformance -// pack cannot be created because you do not have the following permissions: +// - For [PutConformancePack]and [PutOrganizationConformancePack], a conformance pack cannot be created because you do not have the +// following permissions: // // - You do not have permission to call IAM GetRole action or create a // service-linked role. // // - You do not have permission to read Amazon S3 bucket or call SSM:GetDocument. +// +// - For [PutServiceLinkedConfigurationRecorder], a service-linked configuration recorder cannot be created because you +// do not have the following permissions: IAM CreateServiceLinkedRole . +// +// [PutOrganizationConfigRule]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConfigRule.html +// [PutServiceLinkedConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html +// [PutConfigRule]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html +// [PutConformancePack]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutConformancePack.html +// [PutOrganizationConformancePack]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConformancePack.html type InsufficientPermissionsException struct { Message *string @@ -134,7 +193,8 @@ func (e *InsufficientPermissionsException) ErrorCode() string { } func (e *InsufficientPermissionsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// You have provided a name for the configuration recorder that is not valid. +// You have provided a name for the customer managed configuration recorder that +// is not valid. type InvalidConfigurationRecorderNameException struct { Message *string @@ -296,7 +356,7 @@ func (e *InvalidParameterValueException) ErrorCode() string { } func (e *InvalidParameterValueException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// Indicates one of the following errors: +// One of the following errors: // // - You have provided a combination of parameter values that is not valid. For // example: @@ -368,7 +428,7 @@ func (e *InvalidResultTokenException) ErrorCode() string { func (e *InvalidResultTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // You have provided a null or empty Amazon Resource Name (ARN) for the IAM role -// assumed by Config and used by the configuration recorder. +// assumed by Config and used by the customer managed configuration recorder. type InvalidRoleException struct { Message *string @@ -499,8 +559,8 @@ func (e *InvalidTimeRangeException) ErrorCode() string { } func (e *InvalidTimeRangeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// You cannot delete the delivery channel you specified because the configuration -// recorder is running. +// You cannot delete the delivery channel you specified because the customer +// managed configuration recorder is running. type LastDeliveryChannelDeleteFailedException struct { Message *string @@ -528,6 +588,9 @@ func (e *LastDeliveryChannelDeleteFailedException) ErrorFault() smithy.ErrorFaul return smithy.FaultClient } +// For PutServiceLinkedConfigurationRecorder API, this exception is thrown if the +// number of service-linked roles in the account exceeds the limit. +// // For StartConfigRulesEvaluation API, this exception is thrown if an evaluation // is in progress or if you call the StartConfigRulesEvaluationAPI more than once per minute. // @@ -799,8 +862,11 @@ func (e *MaxNumberOfRetentionConfigurationsExceededException) ErrorFault() smith return smithy.FaultClient } -// There are no configuration recorders available to provide the role needed to -// describe your resources. Create a configuration recorder. +// There are no customer managed configuration recorders available to record your +// resources. Use the [PutConfigurationRecorder]operation to create the customer managed configuration +// recorder. +// +// [PutConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigurationRecorder.html type NoAvailableConfigurationRecorderException struct { Message *string @@ -1264,7 +1330,7 @@ func (e *NoSuchRetentionConfigurationException) ErrorFault() smithy.ErrorFault { // - You are not a registered delegated administrator for Config with // permissions to call ListDelegatedAdministrators API. Ensure that the // management account registers delagated administrator for Config service -// principle name before the delegated administrator creates an aggregator. +// principal name before the delegated administrator creates an aggregator. // // For all OrganizationConfigRule and OrganizationConformancePack APIs, Config // throws an exception if APIs are called from member accounts. All APIs must be @@ -1565,15 +1631,87 @@ func (e *TooManyTagsException) ErrorCode() string { } func (e *TooManyTagsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// The requested action is not valid. +// The requested operation is not valid. +// +// For [PutConfigurationRecorder], you will see this exception because you cannot use this operation to +// create a service-linked configuration recorder. Use the [PutServiceLinkedConfigurationRecorder]operation to create a +// service-linked configuration recorder. +// +// For [DeleteConfigurationRecorder], you will see this exception because you cannot use this operation to +// delete a service-linked configuration recorder. Use the [DeleteServiceLinkedConfigurationRecorder]operation to delete a +// service-linked configuration recorder. +// +// For [StartConfigurationRecorder] and [StopConfigurationRecorder], you will see this exception because these operations do not affect +// service-linked configuration recorders. Service-linked configuration recorders +// are always recording. To stop recording, you must delete the service-linked +// configuration recorder. Use the [DeleteServiceLinkedConfigurationRecorder]operation to delete a service-linked +// configuration recorder. +// +// [PutServiceLinkedConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html +// [DeleteConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteConfigurationRecorder.html +// [DeleteServiceLinkedConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html +// [StopConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_StopConfigurationRecorder.html +// [StartConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_StartConfigurationRecorder.html +// [PutConfigurationRecorder]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigurationRecorder.html +type UnmodifiableEntityException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *UnmodifiableEntityException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *UnmodifiableEntityException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *UnmodifiableEntityException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "UnmodifiableEntityException" + } + return *e.ErrorCodeOverride +} +func (e *UnmodifiableEntityException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The requested operation is not valid. You will see this exception if there are +// missing required fields or if the input value fails the validation. +// +// For [PutStoredQuery], one of the following errors: +// +// - There are missing required fields. +// +// - The input value fails the validation. +// +// - You are trying to create more than 300 queries. +// +// For [DescribeConfigurationRecorders] and [DescribeConfigurationRecorderStatus], one of the following errors: +// +// - You have specified more than one configuration recorder. +// +// - You have provided a service principal for service-linked configuration +// recorder that is not valid. +// +// For [AssociateResourceTypes] and [DisassociateResourceTypes], one of the following errors: +// +// - Your configuraiton recorder has a recording strategy that does not allow +// the association or disassociation of resource types. +// +// - One or more of the specified resource types are already associated or +// disassociated with the configuration recorder. // -// For PutStoredQuery, you will see this exception if there are missing required -// fields or if the input value fails the validation, or if you are trying to -// create more than 300 queries. +// - For service-linked configuration recorders, the configuration recorder does +// not record one or more of the specified resource types. // -// For GetStoredQuery, ListStoredQuery, and DeleteStoredQuery you will see this -// exception if there are missing required fields or if the input value fails the -// validation. +// [DescribeConfigurationRecorders]: https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html +// [PutStoredQuery]: https://docs.aws.amazon.com/config/latest/APIReference/API_PutStoredQuery.html +// [DisassociateResourceTypes]: https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html +// [DescribeConfigurationRecorderStatus]: https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorderStatus.html +// [AssociateResourceTypes]: https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html type ValidationException struct { Message *string diff --git a/service/configservice/types/types.go b/service/configservice/types/types.go index df7e03889ee..30306dd6787 100644 --- a/service/configservice/types/types.go +++ b/service/configservice/types/types.go @@ -293,6 +293,52 @@ type AggregationAuthorization struct { noSmithyDocumentSerde } +// An object to filter the configuration recorders based on the resource types in +// scope for recording. +type AggregatorFilterResourceType struct { + + // The type of resource type filter to apply. INCLUDE specifies that the list of + // resource types in the Value field will be aggregated and no other resource + // types will be filtered. + Type AggregatorFilterType + + // Comma-separate list of resource types to filter your aggregated configuration + // recorders. + Value []string + + noSmithyDocumentSerde +} + +// An object to filter the data you specify for an aggregator. +type AggregatorFilters struct { + + // An object to filter the configuration recorders based on the resource types in + // scope for recording. + ResourceType *AggregatorFilterResourceType + + // An object to filter service-linked configuration recorders in an aggregator + // based on the linked Amazon Web Services service. + ServicePrincipal *AggregatorFilterServicePrincipal + + noSmithyDocumentSerde +} + +// An object to filter service-linked configuration recorders in an aggregator +// based on the linked Amazon Web Services service. +type AggregatorFilterServicePrincipal struct { + + // The type of service principal filter to apply. INCLUDE specifies that the list + // of service principals in the Value field will be aggregated and no other + // service principals will be filtered. + Type AggregatorFilterType + + // Comma-separated list of service principals for the linked Amazon Web Services + // services to filter your aggregated service-linked configuration recorders. + Value []string + + noSmithyDocumentSerde +} + // The detailed configurations of a specified resource. type BaseConfigurationItem struct { @@ -652,7 +698,8 @@ type ConfigRuleComplianceSummaryFilters struct { // rules. The status includes information such as the last time the rule ran, the // last time it failed, and the related error for the last failure. // -// This action does not return status information about Config Custom Lambda rules. +// This operation does not return status information about Config Custom Lambda +// rules. type ConfigRuleEvaluationStatus struct { // The Amazon Resource Name (ARN) of the Config rule. @@ -793,6 +840,9 @@ type ConfigurationAggregator struct { // Provides a list of source accounts and regions to be aggregated. AccountAggregationSources []AccountAggregationSource + // An object to filter the data you specify for an aggregator. + AggregatorFilters *AggregatorFilters + // The Amazon Resource Name (ARN) of the aggregator. ConfigurationAggregatorArn *string @@ -919,25 +969,41 @@ type ConfigurationItem struct { noSmithyDocumentSerde } -// Records configuration changes to your specified resource types. For more -// information about the configuration recorder, see [Managing the Configuration Recorder]in the Config Developer Guide. +// Records configuration changes to the resource types in scope. +// +// For more information about the configuration recorder, see [Working with the Configuration Recorder] in the Config +// Developer Guide. // -// [Managing the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html +// [Working with the Configuration Recorder]: https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html type ConfigurationRecorder struct { - // The name of the configuration recorder. Config automatically assigns the name - // of "default" when creating the configuration recorder. + // The Amazon Resource Name (ARN) of the specified configuration recorder. + Arn *string + + // The name of the configuration recorder. + // + // For customer managed configuration recorders, Config automatically assigns the + // name of "default" when creating a configuration recorder if you do not specify a + // name at creation time. + // + // For service-linked configuration recorders, Config automatically assigns a name + // that has the prefix " AWS " to a new service-linked configuration recorder. + // + // Changing the name of a configuration recorder + // + // To change the name of the customer managed configuration recorder, you must + // delete it and create a new customer managed configuration recorder with a new + // name. // - // You cannot change the name of the configuration recorder after it has been - // created. To change the configuration recorder name, you must delete it and - // create a new configuration recorder with a new name. + // You cannot change the name of a service-linked configuration recorder. Name *string - // Specifies which resource types Config records for configuration changes. + // Specifies which resource types are in scope for the configuration recorder to + // record. // // High Number of Config Evaluations // - // You may notice increased activity in your account during your initial month + // You might notice increased activity in your account during your initial month // recording with Config when compared to subsequent months. During the initial // bootstrapping process, Config runs evaluations on all the resources in your // account that you have selected for Config to record. @@ -946,14 +1012,16 @@ type ConfigurationRecorder struct { // Config as it records configuration changes associated with creating and deleting // these temporary resources. An ephemeral workload is a temporary use of computing // resources that are loaded and run when needed. Examples include Amazon Elastic - // Compute Cloud (Amazon EC2) Spot Instances, Amazon EMR jobs, and Auto Scaling. If - // you want to avoid the increased activity from running ephemeral workloads, you - // can run these types of workloads in a separate account with Config turned off to - // avoid increased configuration recording and rule evaluations. + // Compute Cloud (Amazon EC2) Spot Instances, Amazon EMR jobs, and Auto Scaling. + // + // If you want to avoid the increased activity from running ephemeral workloads, + // you can set up the configuration recorder to exclude these resource types from + // being recorded, or run these types of workloads in a separate account with + // Config turned off to avoid increased configuration recording and rule + // evaluations. RecordingGroup *RecordingGroup - // Specifies the default recording frequency that Config uses to record - // configuration changes. + // Specifies the default recording frequency for the configuration recorder. // // Config supports Continuous recording and Daily recording. // @@ -964,6 +1032,8 @@ type ConfigurationRecorder struct { // representing the most recent state of your resources over the last 24-hour // period, only if it’s different from the previous CI recorded. // + // Some resource types require continuous recording + // // Firewall Manager depends on continuous recording to monitor your resources. If // you are using Firewall Manager, it is recommended that you set the recording // frequency to Continuous. @@ -971,29 +1041,78 @@ type ConfigurationRecorder struct { // You can also override the recording frequency for specific resource types. RecordingMode *RecordingMode - // Amazon Resource Name (ARN) of the IAM role assumed by Config and used by the - // configuration recorder. + // Specifies whether the [ConfigurationItems] in scope for the specified configuration recorder are + // recorded for free ( INTERNAL ) or if it impacts the costs to your bill ( PAID ). + // + // [ConfigurationItems]: https://docs.aws.amazon.com/config/latest/APIReference/API_ConfigurationItem.html + RecordingScope RecordingScope + + // The Amazon Resource Name (ARN) of the IAM role assumed by Config and used by + // the specified configuration recorder. + // + // The server will reject a request without a defined roleARN for the + // configuration recorder // // While the API model does not require this field, the server will reject a // request without a defined roleARN for the configuration recorder. // - // Pre-existing Config role + // Policies and compliance results + // + // [IAM policies]and [other policies managed in Organizations] can impact whether Config has permissions to record configuration changes + // for your resources. Additionally, rules directly evaluate the configuration of a + // resource and rules don't take into account these policies when running + // evaluations. Make sure that the policies in effect align with how you intend to + // use Config. // - // If you have used an Amazon Web Services service that uses Config, such as - // Security Hub or Control Tower, and an Config role has already been created, make - // sure that the IAM role that you use when setting up Config keeps the same - // minimum permissions as the already created Config role. You must do this so that - // the other Amazon Web Services service continues to run as expected. + // Keep Minimum Permisions When Reusing an IAM role // - // For example, if Control Tower has an IAM role that allows Config to read Amazon - // Simple Storage Service (Amazon S3) objects, make sure that the same permissions - // are granted within the IAM role you use when setting up Config. Otherwise, it - // may interfere with how Control Tower operates. For more information about IAM - // roles for Config, see [Identity and Access Management for Config]in the Config Developer Guide. + // If you use an Amazon Web Services service that uses Config, such as Security + // Hub or Control Tower, and an IAM role has already been created, make sure that + // the IAM role that you use when setting up Config keeps the same minimum + // permissions as the pre-existing IAM role. You must do this to ensure that the + // other Amazon Web Services service continues to run as expected. // - // [Identity and Access Management for Config]: https://docs.aws.amazon.com/config/latest/developerguide/security-iam.html + // For example, if Control Tower has an IAM role that allows Config to read S3 + // objects, make sure that the same permissions are granted to the IAM role you use + // when setting up Config. Otherwise, it may interfere with how Control Tower + // operates. + // + // The service-linked IAM role for Config must be used for service-linked + // configuration recorders + // + // For service-linked configuration recorders, you must use the service-linked IAM + // role for Config: [AWSServiceRoleForConfig]. + // + // [AWSServiceRoleForConfig]: https://docs.aws.amazon.com/config/latest/developerguide/using-service-linked-roles.html + // [other policies managed in Organizations]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies.html + // [IAM policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html RoleARN *string + // For service-linked configuration recorders, specifies the linked Amazon Web + // Services service for the configuration recorder. + ServicePrincipal *string + + noSmithyDocumentSerde +} + +// Filters configuration recorders by recording scope. +type ConfigurationRecorderFilter struct { + + // The name of the type of filter. Currently, only recordingScope is supported. + FilterName ConfigurationRecorderFilterName + + // The value of the filter. For recordingScope , valid values include: INTERNAL + // and PAID . + // + // INTERNAL indicates that the [ConfigurationItems] in scope for the configuration recorder are + // recorded for free. + // + // PAID indicates that the [ConfigurationItems] in scope for the configuration recorder impact the + // costs to your bill. + // + // [ConfigurationItems]: https://docs.aws.amazon.com/config/latest/APIReference/API_ConfigurationItem.html + FilterValue []string + noSmithyDocumentSerde } @@ -1003,6 +1122,9 @@ type ConfigurationRecorder struct { // CloudWatch metrics and use CloudWatch metrics. type ConfigurationRecorderStatus struct { + // The Amazon Resource Name (ARN) of the configuration recorder. + Arn *string + // The latest error code from when the recorder last failed. LastErrorCode *string @@ -1028,6 +1150,39 @@ type ConfigurationRecorderStatus struct { // Specifies whether or not the recorder is currently recording. Recording bool + // For service-linked configuration recorders, the service principal of the linked + // Amazon Web Services service. + ServicePrincipal *string + + noSmithyDocumentSerde +} + +// A summary of a configuration recorder, including the arn , name , +// servicePrincipal , and recordingScope . +type ConfigurationRecorderSummary struct { + + // The Amazon Resource Name (ARN) of the configuration recorder. + // + // This member is required. + Arn *string + + // The name of the configuration recorder. + // + // This member is required. + Name *string + + // Indicates whether the [ConfigurationItems] in scope for the configuration recorder are recorded for + // free ( INTERNAL ) or if you are charged a service fee for recording ( PAID ). + // + // [ConfigurationItems]: https://docs.aws.amazon.com/config/latest/APIReference/API_ConfigurationItem.html + // + // This member is required. + RecordingScope RecordingScope + + // For service-linked configuration recorders, indicates which Amazon Web Services + // service the configuration recorder is linked to. + ServicePrincipal *string + noSmithyDocumentSerde } @@ -1578,24 +1733,10 @@ type EvaluationStatus struct { // IAM users, groups, roles, and customer managed policies will be recorded in the // Region where you set up the configuration recorder if that is a Region where // Config was available before February 2022. You cannot be record the global IAM -// resouce types in Regions supported by Config after February 2022. This list -// where you cannot record the global IAM resource types includes the following -// Regions: -// -// - Asia Pacific (Hyderabad) -// -// - Asia Pacific (Melbourne) -// -// - Canada West (Calgary) -// -// - Europe (Spain) -// -// - Europe (Zurich) -// -// - Israel (Tel Aviv) -// -// - Middle East (UAE) +// resouce types in Regions supported by Config after February 2022. For a list of +// those Regions, see [Recording Amazon Web Services Resources | Global Resources]. // +// [Recording Amazon Web Services Resources | Global Resources]: https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html#select-resources-all // [RecordingStrategy]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html type ExclusionByResourceTypes struct { @@ -2446,22 +2587,8 @@ type RecordingGroup struct { // IAM users, groups, roles, and customer managed policies. These global IAM // resource types can only be recorded by Config in Regions where Config was // available before February 2022. You cannot be record the global IAM resouce - // types in Regions supported by Config after February 2022. This list where you - // cannot record the global IAM resource types includes the following Regions: - // - // - Asia Pacific (Hyderabad) - // - // - Asia Pacific (Melbourne) - // - // - Canada West (Calgary) - // - // - Europe (Spain) - // - // - Europe (Zurich) - // - // - Israel (Tel Aviv) - // - // - Middle East (UAE) + // types in Regions supported by Config after February 2022. For a list of those + // Regions, see [Recording Amazon Web Services Resources | Global Resources]. // // Aurora global clusters are recorded in all enabled Regions // @@ -2516,6 +2643,7 @@ type RecordingGroup struct { // not list them in the resourceTypes field in addition to setting the // includeGlobalResourceTypes field to false. // + // [Recording Amazon Web Services Resources | Global Resources]: https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html#select-resources-all // [RecordingStrategy]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html // [Selecting Which Resources are Recorded]: https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html#select-resources-all // [RecordingGroup]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html @@ -2573,24 +2701,10 @@ type RecordingGroup struct { // IAM users, groups, roles, and customer managed policies will be recorded in the // Region where you set up the configuration recorder if that is a Region where // Config was available before February 2022. You cannot be record the global IAM - // resouce types in Regions supported by Config after February 2022. This list - // where you cannot record the global IAM resource types includes the following - // Regions: - // - // - Asia Pacific (Hyderabad) - // - // - Asia Pacific (Melbourne) - // - // - Canada West (Calgary) - // - // - Europe (Spain) - // - // - Europe (Zurich) - // - // - Israel (Tel Aviv) - // - // - Middle East (UAE) + // resouce types in Regions supported by Config after February 2022. For a list of + // those Regions, see [Recording Amazon Web Services Resources | Global Resources]. // + // [Recording Amazon Web Services Resources | Global Resources]: https://docs.aws.amazon.com/config/latest/developerguide/select-resources.html#select-resources-all // [RecordingStrategy]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html // [ExclusionByResourceTypes]: https://docs.aws.amazon.com/config/latest/APIReference/API_ExclusionByResourceTypes.html // [RecordingGroup]: https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html @@ -2652,7 +2766,7 @@ type RecordingMode struct { // The default recording frequency that Config uses to record configuration // changes. // - // Daily recording is not supported for the following resource types: + // Daily recording cannot be specified for the following resource types: // // - AWS::Config::ResourceCompliance // @@ -2698,7 +2812,7 @@ type RecordingModeOverride struct { // A comma-separated list that specifies which resource types Config includes in // the override. // - // Daily recording is not supported for the following resource types: + // Daily recording cannot be specified for the following resource types: // // - AWS::Config::ResourceCompliance // diff --git a/service/configservice/validators.go b/service/configservice/validators.go index 75d3df6b77d..e295cd88506 100644 --- a/service/configservice/validators.go +++ b/service/configservice/validators.go @@ -10,6 +10,26 @@ import ( "github.com/aws/smithy-go/middleware" ) +type validateOpAssociateResourceTypes struct { +} + +func (*validateOpAssociateResourceTypes) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAssociateResourceTypes) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AssociateResourceTypesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAssociateResourceTypesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpBatchGetAggregateResourceConfig struct { } @@ -330,6 +350,26 @@ func (m *validateOpDeleteRetentionConfiguration) HandleInitialize(ctx context.Co return next.HandleInitialize(ctx, in) } +type validateOpDeleteServiceLinkedConfigurationRecorder struct { +} + +func (*validateOpDeleteServiceLinkedConfigurationRecorder) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteServiceLinkedConfigurationRecorder) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteServiceLinkedConfigurationRecorderInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteServiceLinkedConfigurationRecorderInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDeleteStoredQuery struct { } @@ -510,6 +550,26 @@ func (m *validateOpDescribeRemediationExecutionStatus) HandleInitialize(ctx cont return next.HandleInitialize(ctx, in) } +type validateOpDisassociateResourceTypes struct { +} + +func (*validateOpDisassociateResourceTypes) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateResourceTypes) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateResourceTypesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateResourceTypesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetAggregateComplianceDetailsByConfigRule struct { } @@ -1150,6 +1210,26 @@ func (m *validateOpPutRetentionConfiguration) HandleInitialize(ctx context.Conte return next.HandleInitialize(ctx, in) } +type validateOpPutServiceLinkedConfigurationRecorder struct { +} + +func (*validateOpPutServiceLinkedConfigurationRecorder) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutServiceLinkedConfigurationRecorder) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutServiceLinkedConfigurationRecorderInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutServiceLinkedConfigurationRecorderInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpPutStoredQuery struct { } @@ -1330,6 +1410,10 @@ func (m *validateOpUntagResource) HandleInitialize(ctx context.Context, in middl return next.HandleInitialize(ctx, in) } +func addOpAssociateResourceTypesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAssociateResourceTypes{}, middleware.After) +} + func addOpBatchGetAggregateResourceConfigValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpBatchGetAggregateResourceConfig{}, middleware.After) } @@ -1394,6 +1478,10 @@ func addOpDeleteRetentionConfigurationValidationMiddleware(stack *middleware.Sta return stack.Initialize.Add(&validateOpDeleteRetentionConfiguration{}, middleware.After) } +func addOpDeleteServiceLinkedConfigurationRecorderValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteServiceLinkedConfigurationRecorder{}, middleware.After) +} + func addOpDeleteStoredQueryValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteStoredQuery{}, middleware.After) } @@ -1430,6 +1518,10 @@ func addOpDescribeRemediationExecutionStatusValidationMiddleware(stack *middlewa return stack.Initialize.Add(&validateOpDescribeRemediationExecutionStatus{}, middleware.After) } +func addOpDisassociateResourceTypesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateResourceTypes{}, middleware.After) +} + func addOpGetAggregateComplianceDetailsByConfigRuleValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetAggregateComplianceDetailsByConfigRule{}, middleware.After) } @@ -1558,6 +1650,10 @@ func addOpPutRetentionConfigurationValidationMiddleware(stack *middleware.Stack) return stack.Initialize.Add(&validateOpPutRetentionConfiguration{}, middleware.After) } +func addOpPutServiceLinkedConfigurationRecorderValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutServiceLinkedConfigurationRecorder{}, middleware.After) +} + func addOpPutStoredQueryValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutStoredQuery{}, middleware.After) } @@ -2176,6 +2272,24 @@ func validateTemplateSSMDocumentDetails(v *types.TemplateSSMDocumentDetails) err } } +func validateOpAssociateResourceTypesInput(v *AssociateResourceTypesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AssociateResourceTypesInput"} + if v.ConfigurationRecorderArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConfigurationRecorderArn")) + } + if v.ResourceTypes == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceTypes")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpBatchGetAggregateResourceConfigInput(v *BatchGetAggregateResourceConfigInput) error { if v == nil { return nil @@ -2439,6 +2553,21 @@ func validateOpDeleteRetentionConfigurationInput(v *DeleteRetentionConfiguration } } +func validateOpDeleteServiceLinkedConfigurationRecorderInput(v *DeleteServiceLinkedConfigurationRecorderInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteServiceLinkedConfigurationRecorderInput"} + if v.ServicePrincipal == nil { + invalidParams.Add(smithy.NewErrParamRequired("ServicePrincipal")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDeleteStoredQueryInput(v *DeleteStoredQueryInput) error { if v == nil { return nil @@ -2579,6 +2708,24 @@ func validateOpDescribeRemediationExecutionStatusInput(v *DescribeRemediationExe } } +func validateOpDisassociateResourceTypesInput(v *DisassociateResourceTypesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateResourceTypesInput"} + if v.ConfigurationRecorderArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConfigurationRecorderArn")) + } + if v.ResourceTypes == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceTypes")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetAggregateComplianceDetailsByConfigRuleInput(v *GetAggregateComplianceDetailsByConfigRuleInput) error { if v == nil { return nil @@ -3162,6 +3309,21 @@ func validateOpPutRetentionConfigurationInput(v *PutRetentionConfigurationInput) } } +func validateOpPutServiceLinkedConfigurationRecorderInput(v *PutServiceLinkedConfigurationRecorderInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutServiceLinkedConfigurationRecorderInput"} + if v.ServicePrincipal == nil { + invalidParams.Add(smithy.NewErrParamRequired("ServicePrincipal")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpPutStoredQueryInput(v *PutStoredQueryInput) error { if v == nil { return nil diff --git a/service/fsx/deserializers.go b/service/fsx/deserializers.go index 5eea61edc5f..60cc6b22411 100644 --- a/service/fsx/deserializers.go +++ b/service/fsx/deserializers.go @@ -10870,6 +10870,15 @@ func awsAwsjson11_deserializeDocumentLustreFileSystemConfiguration(v **types.Lus sv.DriveCacheType = types.DriveCacheType(jtv) } + case "EfaEnabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Flag to be of type *bool, got %T instead", value) + } + sv.EfaEnabled = ptr.Bool(jtv) + } + case "LogConfiguration": if err := awsAwsjson11_deserializeDocumentLustreLogConfiguration(&sv.LogConfiguration, value); err != nil { return err diff --git a/service/fsx/serializers.go b/service/fsx/serializers.go index f9000b94fb2..6ff7eef1685 100644 --- a/service/fsx/serializers.go +++ b/service/fsx/serializers.go @@ -2965,6 +2965,11 @@ func awsAwsjson11_serializeDocumentCreateFileSystemLustreConfiguration(v *types. ok.String(string(v.DriveCacheType)) } + if v.EfaEnabled != nil { + ok := object.Key("EfaEnabled") + ok.Boolean(*v.EfaEnabled) + } + if v.ExportPath != nil { ok := object.Key("ExportPath") ok.String(*v.ExportPath) diff --git a/service/fsx/types/types.go b/service/fsx/types/types.go index 6a8fdc31c69..54a08304a8d 100644 --- a/service/fsx/types/types.go +++ b/service/fsx/types/types.go @@ -670,6 +670,12 @@ type CreateFileSystemLustreConfiguration struct { // This parameter is required when StorageType is set to HDD . DriveCacheType DriveCacheType + // (Optional) Specifies whether Elastic Fabric Adapter (EFA) and GPUDirect Storage + // (GDS) support is enabled for the Amazon FSx for Lustre file system. + // + // (Default = false ) + EfaEnabled *bool + // (Optional) Specifies the path in the Amazon S3 bucket where the root of your // Amazon FSx file system is exported. The path must use the same Amazon S3 bucket // as specified in ImportPath. You can provide an optional prefix to which new and @@ -2783,6 +2789,10 @@ type LustreFileSystemConfiguration struct { // This parameter is required when StorageType is set to HDD. DriveCacheType DriveCacheType + // Specifies whether Elastic Fabric Adapter (EFA) and GPUDirect Storage (GDS) + // support is enabled for the Amazon FSx for Lustre file system. + EfaEnabled *bool + // The Lustre logging configuration. Lustre logging writes the enabled log events // for your file system to Amazon CloudWatch Logs. LogConfiguration *LustreLogConfiguration diff --git a/service/observabilityadmin/LICENSE.txt b/service/observabilityadmin/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/observabilityadmin/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/observabilityadmin/api_client.go b/service/observabilityadmin/api_client.go new file mode 100644 index 00000000000..1bb3196d747 --- /dev/null +++ b/service/observabilityadmin/api_client.go @@ -0,0 +1,913 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/defaults" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + internalmiddleware "github.com/aws/aws-sdk-go-v2/internal/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/metrics" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net" + "net/http" + "sync/atomic" + "time" +) + +const ServiceID = "ObservabilityAdmin" +const ServiceAPIVersion = "2018-05-10" + +type operationMetrics struct { + Duration metrics.Float64Histogram + SerializeDuration metrics.Float64Histogram + ResolveIdentityDuration metrics.Float64Histogram + ResolveEndpointDuration metrics.Float64Histogram + SignRequestDuration metrics.Float64Histogram + DeserializeDuration metrics.Float64Histogram +} + +func (m *operationMetrics) histogramFor(name string) metrics.Float64Histogram { + switch name { + case "client.call.duration": + return m.Duration + case "client.call.serialization_duration": + return m.SerializeDuration + case "client.call.resolve_identity_duration": + return m.ResolveIdentityDuration + case "client.call.resolve_endpoint_duration": + return m.ResolveEndpointDuration + case "client.call.signing_duration": + return m.SignRequestDuration + case "client.call.deserialization_duration": + return m.DeserializeDuration + default: + panic("unrecognized operation metric") + } +} + +func timeOperationMetric[T any]( + ctx context.Context, metric string, fn func() (T, error), + opts ...metrics.RecordMetricOption, +) (T, error) { + instr := getOperationMetrics(ctx).histogramFor(metric) + opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...) + + start := time.Now() + v, err := fn() + end := time.Now() + + elapsed := end.Sub(start) + instr.Record(ctx, float64(elapsed)/1e9, opts...) + return v, err +} + +func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() { + instr := getOperationMetrics(ctx).histogramFor(metric) + opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...) + + var ended bool + start := time.Now() + return func() { + if ended { + return + } + ended = true + + end := time.Now() + + elapsed := end.Sub(start) + instr.Record(ctx, float64(elapsed)/1e9, opts...) + } +} + +func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption { + return func(o *metrics.RecordMetricOptions) { + o.Properties.Set("rpc.service", middleware.GetServiceID(ctx)) + o.Properties.Set("rpc.method", middleware.GetOperationName(ctx)) + } +} + +type operationMetricsKey struct{} + +func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) { + meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/observabilityadmin") + om := &operationMetrics{} + + var err error + + om.Duration, err = operationMetricTimer(meter, "client.call.duration", + "Overall call duration (including retries and time to send or receive request and response body)") + if err != nil { + return nil, err + } + om.SerializeDuration, err = operationMetricTimer(meter, "client.call.serialization_duration", + "The time it takes to serialize a message body") + if err != nil { + return nil, err + } + om.ResolveIdentityDuration, err = operationMetricTimer(meter, "client.call.auth.resolve_identity_duration", + "The time taken to acquire an identity (AWS credentials, bearer token, etc) from an Identity Provider") + if err != nil { + return nil, err + } + om.ResolveEndpointDuration, err = operationMetricTimer(meter, "client.call.resolve_endpoint_duration", + "The time it takes to resolve an endpoint (endpoint resolver, not DNS) for the request") + if err != nil { + return nil, err + } + om.SignRequestDuration, err = operationMetricTimer(meter, "client.call.auth.signing_duration", + "The time it takes to sign a request") + if err != nil { + return nil, err + } + om.DeserializeDuration, err = operationMetricTimer(meter, "client.call.deserialization_duration", + "The time it takes to deserialize a message body") + if err != nil { + return nil, err + } + + return context.WithValue(parent, operationMetricsKey{}, om), nil +} + +func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Histogram, error) { + return m.Float64Histogram(name, func(o *metrics.InstrumentOptions) { + o.UnitLabel = "s" + o.Description = desc + }) +} + +func getOperationMetrics(ctx context.Context) *operationMetrics { + return ctx.Value(operationMetricsKey{}).(*operationMetrics) +} + +func operationTracer(p tracing.TracerProvider) tracing.Tracer { + return p.Tracer("github.com/aws/aws-sdk-go-v2/service/observabilityadmin") +} + +// Client provides the API client to make operations call for CloudWatch +// Observability Admin Service. +type Client struct { + options Options + + // Difference between the time reported by the server and the client + timeOffset *atomic.Int64 +} + +// 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) + + resolveEndpointResolverV2(&options) + + resolveTracerProvider(&options) + + resolveMeterProvider(&options) + + resolveAuthSchemeResolver(&options) + + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttempts(&options) + + ignoreAnonymousAuth(&options) + + wrapWithAnonymousAuth(&options) + + resolveAuthSchemes(&options) + + client := &Client{ + options: options, + } + + initializeTimeOffsetResolver(client) + + return client +} + +// Options returns a copy of the client configuration. +// +// Callers SHOULD NOT perform mutations on any inner structures within client +// config. Config overrides should instead be made on a per-operation basis through +// functional options. +func (c *Client) Options() Options { + return c.options.Copy() +} + +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) + ctx = middleware.WithServiceID(ctx, ServiceID) + ctx = middleware.WithOperationName(ctx, opID) + + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + + for _, fn := range optFns { + fn(&options) + } + + finalizeOperationRetryMaxAttempts(&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 + } + } + + ctx, err = withOperationMetrics(ctx, options.MeterProvider) + if err != nil { + return nil, metadata, err + } + + tracer := operationTracer(options.TracerProvider) + spanName := fmt.Sprintf("%s.%s", ServiceID, opID) + + ctx = tracing.WithOperationTracer(ctx, tracer) + + ctx, span := tracer.StartSpan(ctx, spanName, func(o *tracing.SpanOptions) { + o.Kind = tracing.SpanKindClient + o.Properties.Set("rpc.system", "aws-api") + o.Properties.Set("rpc.method", opID) + o.Properties.Set("rpc.service", ServiceID) + }) + endTimer := startMetricTimer(ctx, "client.call.duration") + defer endTimer() + defer span.End() + + handler := smithyhttp.NewClientHandlerWithOptions(options.HTTPClient, func(o *smithyhttp.ClientHandler) { + o.Meter = options.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/observabilityadmin") + }) + decorated := middleware.DecorateHandler(handler, stack) + result, metadata, err = decorated.Handle(ctx, params) + if err != nil { + span.SetProperty("exception.type", fmt.Sprintf("%T", err)) + span.SetProperty("exception.message", err.Error()) + + var aerr smithy.APIError + if errors.As(err, &aerr) { + span.SetProperty("api.error_code", aerr.ErrorCode()) + span.SetProperty("api.error_message", aerr.ErrorMessage()) + span.SetProperty("api.error_fault", aerr.ErrorFault().String()) + } + + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + + span.SetProperty("error", err != nil) + if err == nil { + span.SetStatus(tracing.SpanStatusOK) + } else { + span.SetStatus(tracing.SpanStatusError) + } + + return result, metadata, err +} + +type operationInputKey struct{} + +func setOperationInput(ctx context.Context, input interface{}) context.Context { + return middleware.WithStackValue(ctx, operationInputKey{}, input) +} + +func getOperationInput(ctx context.Context) interface{} { + return middleware.GetStackValue(ctx, operationInputKey{}) +} + +type setOperationInputMiddleware struct { +} + +func (*setOperationInputMiddleware) ID() string { + return "setOperationInput" +} + +func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + ctx = setOperationInput(ctx, in.Parameters) + return next.HandleSerialize(ctx, in) +} + +func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { + if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { + return fmt.Errorf("add ResolveAuthScheme: %w", err) + } + if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { + return fmt.Errorf("add GetIdentity: %v", err) + } + if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { + return fmt.Errorf("add ResolveEndpointV2: %v", err) + } + if err := stack.Finalize.Insert(&signRequestMiddleware{options: options}, "ResolveEndpointV2", middleware.After); err != nil { + return fmt.Errorf("add Signing: %w", err) + } + return nil +} +func resolveAuthSchemeResolver(options *Options) { + if options.AuthSchemeResolver == nil { + options.AuthSchemeResolver = &defaultAuthSchemeResolver{} + } +} + +func resolveAuthSchemes(options *Options) { + if options.AuthSchemes == nil { + options.AuthSchemes = []smithyhttp.AuthScheme{ + internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ + Signer: options.HTTPSignerV4, + Logger: options.Logger, + LogSigning: options.ClientLogMode.IsSigning(), + }), + } + } +} + +type noSmithyDocumentSerde = smithydocument.NoSerde + +type legacyEndpointContextSetter struct { + LegacyResolver EndpointResolver +} + +func (*legacyEndpointContextSetter) ID() string { + return "legacyEndpointContextSetter" +} + +func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.LegacyResolver != nil { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true) + } + + return next.HandleInitialize(ctx, in) + +} +func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error { + return stack.Initialize.Add(&legacyEndpointContextSetter{ + LegacyResolver: o.EndpointResolver, + }, middleware.Before) +} + +func resolveDefaultLogger(o *Options) { + if o.Logger != nil { + return + } + o.Logger = logging.Nop{} +} + +func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error { + return middleware.AddSetLoggerMiddleware(stack, o.Logger) +} + +func setResolvedDefaultsMode(o *Options) { + if len(o.resolvedDefaultsMode) > 0 { + return + } + + var mode aws.DefaultsMode + mode.SetFromString(string(o.DefaultsMode)) + + if mode == aws.DefaultsModeAuto { + mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment) + } + + o.resolvedDefaultsMode = mode +} + +// NewFromConfig returns a new client from the provided config. +func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { + opts := Options{ + Region: cfg.Region, + DefaultsMode: cfg.DefaultsMode, + RuntimeEnvironment: cfg.RuntimeEnvironment, + HTTPClient: cfg.HTTPClient, + Credentials: cfg.Credentials, + APIOptions: cfg.APIOptions, + Logger: cfg.Logger, + ClientLogMode: cfg.ClientLogMode, + AppID: cfg.AppID, + } + resolveAWSRetryerProvider(cfg, &opts) + resolveAWSRetryMaxAttempts(cfg, &opts) + resolveAWSRetryMode(cfg, &opts) + resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStackEndpoint(cfg, &opts) + resolveUseFIPSEndpoint(cfg, &opts) + resolveBaseEndpoint(cfg, &opts) + return New(opts, optFns...) +} + +func resolveHTTPClient(o *Options) { + var buildable *awshttp.BuildableClient + + if o.HTTPClient != nil { + var ok bool + buildable, ok = o.HTTPClient.(*awshttp.BuildableClient) + if !ok { + return + } + } else { + buildable = awshttp.NewBuildableClient() + } + + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) { + if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok { + dialer.Timeout = dialerTimeout + } + }) + + buildable = buildable.WithTransportOptions(func(transport *http.Transport) { + if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok { + transport.TLSHandshakeTimeout = tlsHandshakeTimeout + } + }) + } + + o.HTTPClient = buildable +} + +func resolveRetryer(o *Options) { + if o.Retryer != nil { + return + } + + if len(o.RetryMode) == 0 { + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + o.RetryMode = modeConfig.RetryMode + } + } + if len(o.RetryMode) == 0 { + o.RetryMode = aws.RetryModeStandard + } + + var standardOptions []func(*retry.StandardOptions) + if v := o.RetryMaxAttempts; v != 0 { + standardOptions = append(standardOptions, func(so *retry.StandardOptions) { + so.MaxAttempts = v + }) + } + + switch o.RetryMode { + case aws.RetryModeAdaptive: + var adaptiveOptions []func(*retry.AdaptiveModeOptions) + if len(standardOptions) != 0 { + adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) { + ao.StandardOptions = append(ao.StandardOptions, standardOptions...) + }) + } + o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...) + + default: + o.Retryer = retry.NewStandard(standardOptions...) + } +} + +func resolveAWSRetryerProvider(cfg aws.Config, o *Options) { + if cfg.Retryer == nil { + return + } + o.Retryer = cfg.Retryer() +} + +func resolveAWSRetryMode(cfg aws.Config, o *Options) { + if len(cfg.RetryMode) == 0 { + return + } + o.RetryMode = cfg.RetryMode +} +func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { + if cfg.RetryMaxAttempts == 0 { + return + } + o.RetryMaxAttempts = cfg.RetryMaxAttempts +} + +func finalizeRetryMaxAttempts(o *Options) { + if o.RetryMaxAttempts == 0 { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func finalizeOperationRetryMaxAttempts(o *Options, client Client) { + if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func resolveAWSEndpointResolver(cfg aws.Config, o *Options) { + if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil { + return + } + o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions) +} + +func addClientUserAgent(stack *middleware.Stack, options Options) error { + ua, err := getOrAddRequestUserAgent(stack) + if err != nil { + return err + } + + ua.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "observabilityadmin", goModuleVersion) + if len(options.AppID) > 0 { + ua.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID) + } + + return nil +} + +func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUserAgent, error) { + id := (*awsmiddleware.RequestUserAgent)(nil).ID() + mw, ok := stack.Build.Get(id) + if !ok { + mw = awsmiddleware.NewRequestUserAgent() + if err := stack.Build.Add(mw, middleware.After); err != nil { + return nil, err + } + } + + ua, ok := mw.(*awsmiddleware.RequestUserAgent) + if !ok { + return nil, fmt.Errorf("%T for %s middleware did not match expected type", mw, id) + } + + return ua, nil +} + +type HTTPSignerV4 interface { + SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error +} + +func resolveHTTPSignerV4(o *Options) { + if o.HTTPSignerV4 != nil { + return + } + o.HTTPSignerV4 = newDefaultV4Signer(*o) +} + +func newDefaultV4Signer(o Options) *v4.Signer { + return v4.NewSigner(func(so *v4.SignerOptions) { + so.Logger = o.Logger + so.LogSigning = o.ClientLogMode.IsSigning() + }) +} + +func addClientRequestID(stack *middleware.Stack) error { + return stack.Build.Add(&awsmiddleware.ClientRequestID{}, middleware.After) +} + +func addComputeContentLength(stack *middleware.Stack) error { + return stack.Build.Add(&smithyhttp.ComputeContentLength{}, middleware.After) +} + +func addRawResponseToMetadata(stack *middleware.Stack) error { + return stack.Deserialize.Add(&awsmiddleware.AddRawResponse{}, middleware.Before) +} + +func addRecordResponseTiming(stack *middleware.Stack) error { + return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After) +} + +func addSpanRetryLoop(stack *middleware.Stack, options Options) error { + return stack.Finalize.Insert(&spanRetryLoop{options: options}, "Retry", middleware.Before) +} + +type spanRetryLoop struct { + options Options +} + +func (*spanRetryLoop) ID() string { + return "spanRetryLoop" +} + +func (m *spanRetryLoop) HandleFinalize( + ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, +) ( + middleware.FinalizeOutput, middleware.Metadata, error, +) { + tracer := operationTracer(m.options.TracerProvider) + ctx, span := tracer.StartSpan(ctx, "RetryLoop") + defer span.End() + + return next.HandleFinalize(ctx, in) +} +func addStreamingEventsPayload(stack *middleware.Stack) error { + return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before) +} + +func addUnsignedPayload(stack *middleware.Stack) error { + return stack.Finalize.Insert(&v4.UnsignedPayload{}, "ResolveEndpointV2", middleware.After) +} + +func addComputePayloadSHA256(stack *middleware.Stack) error { + return stack.Finalize.Insert(&v4.ComputePayloadSHA256{}, "ResolveEndpointV2", middleware.After) +} + +func addContentSHA256Header(stack *middleware.Stack) error { + return stack.Finalize.Insert(&v4.ContentSHA256Header{}, (*v4.ComputePayloadSHA256)(nil).ID(), middleware.After) +} + +func addIsWaiterUserAgent(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + ua, err := getOrAddRequestUserAgent(stack) + if err != nil { + return err + } + + ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureWaiter) + return nil + }) +} + +func addIsPaginatorUserAgent(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + ua, err := getOrAddRequestUserAgent(stack) + if err != nil { + return err + } + + ua.AddUserAgentFeature(awsmiddleware.UserAgentFeaturePaginator) + return nil + }) +} + +func addRetry(stack *middleware.Stack, o Options) error { + attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) { + m.LogAttempts = o.ClientLogMode.IsRetries() + m.OperationMeter = o.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/observabilityadmin") + }) + if err := stack.Finalize.Insert(attempt, "Signing", middleware.Before); err != nil { + return err + } + if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil { + return err + } + return nil +} + +// 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 resolveAccountID(identity smithyauth.Identity, mode aws.AccountIDEndpointMode) *string { + if mode == aws.AccountIDEndpointModeDisabled { + return nil + } + + if ca, ok := identity.(*internalauthsmithy.CredentialsAdapter); ok && ca.Credentials.AccountID != "" { + return aws.String(ca.Credentials.AccountID) + } + + return nil +} + +func addTimeOffsetBuild(stack *middleware.Stack, c *Client) error { + mw := internalmiddleware.AddTimeOffsetMiddleware{Offset: c.timeOffset} + if err := stack.Build.Add(&mw, middleware.After); err != nil { + return err + } + return stack.Deserialize.Insert(&mw, "RecordResponseTiming", middleware.Before) +} +func initializeTimeOffsetResolver(c *Client) { + c.timeOffset = new(atomic.Int64) +} + +func addUserAgentRetryMode(stack *middleware.Stack, options Options) error { + ua, err := getOrAddRequestUserAgent(stack) + if err != nil { + return err + } + + switch options.Retryer.(type) { + case *retry.Standard: + ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeStandard) + case *retry.AdaptiveMode: + ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeAdaptive) + } + return nil +} + +func resolveTracerProvider(options *Options) { + if options.TracerProvider == nil { + options.TracerProvider = &tracing.NopTracerProvider{} + } +} + +func resolveMeterProvider(options *Options) { + if options.MeterProvider == nil { + options.MeterProvider = metrics.NopMeterProvider{} + } +} + +func addRecursionDetection(stack *middleware.Stack) error { + return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After) +} + +func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { + return stack.Deserialize.Insert(&awsmiddleware.RequestIDRetriever{}, "OperationDeserializer", middleware.Before) + +} + +func addResponseErrorMiddleware(stack *middleware.Stack) error { + return stack.Deserialize.Insert(&awshttp.ResponseErrorWrapper{}, "RequestIDRetriever", middleware.Before) + +} + +func addRequestResponseLogging(stack *middleware.Stack, o Options) error { + return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ + LogRequest: o.ClientLogMode.IsRequest(), + LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), + LogResponse: o.ClientLogMode.IsResponse(), + LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), + }, middleware.After) +} + +type disableHTTPSMiddleware struct { + DisableHTTPS bool +} + +func (*disableHTTPSMiddleware) ID() string { + return "disableHTTPS" +} + +func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleFinalize(ctx, in) +} + +func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Finalize.Insert(&disableHTTPSMiddleware{ + DisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "ResolveEndpointV2", middleware.After) +} + +type spanInitializeStart struct { +} + +func (*spanInitializeStart) ID() string { + return "spanInitializeStart" +} + +func (m *spanInitializeStart) HandleInitialize( + ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, +) ( + middleware.InitializeOutput, middleware.Metadata, error, +) { + ctx, _ = tracing.StartSpan(ctx, "Initialize") + + return next.HandleInitialize(ctx, in) +} + +type spanInitializeEnd struct { +} + +func (*spanInitializeEnd) ID() string { + return "spanInitializeEnd" +} + +func (m *spanInitializeEnd) HandleInitialize( + ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, +) ( + middleware.InitializeOutput, middleware.Metadata, error, +) { + ctx, span := tracing.PopSpan(ctx) + span.End() + + return next.HandleInitialize(ctx, in) +} + +type spanBuildRequestStart struct { +} + +func (*spanBuildRequestStart) ID() string { + return "spanBuildRequestStart" +} + +func (m *spanBuildRequestStart) HandleSerialize( + ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, +) ( + middleware.SerializeOutput, middleware.Metadata, error, +) { + ctx, _ = tracing.StartSpan(ctx, "BuildRequest") + + return next.HandleSerialize(ctx, in) +} + +type spanBuildRequestEnd struct { +} + +func (*spanBuildRequestEnd) ID() string { + return "spanBuildRequestEnd" +} + +func (m *spanBuildRequestEnd) HandleBuild( + ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, +) ( + middleware.BuildOutput, middleware.Metadata, error, +) { + ctx, span := tracing.PopSpan(ctx) + span.End() + + return next.HandleBuild(ctx, in) +} + +func addSpanInitializeStart(stack *middleware.Stack) error { + return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before) +} + +func addSpanInitializeEnd(stack *middleware.Stack) error { + return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After) +} + +func addSpanBuildRequestStart(stack *middleware.Stack) error { + return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before) +} + +func addSpanBuildRequestEnd(stack *middleware.Stack) error { + return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After) +} diff --git a/service/observabilityadmin/api_client_test.go b/service/observabilityadmin/api_client_test.go new file mode 100644 index 00000000000..fc7fea6ca84 --- /dev/null +++ b/service/observabilityadmin/api_client_test.go @@ -0,0 +1,127 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +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, + }, func(o *Options) { + if o.Retryer == nil { + t.Errorf("retryer must not be nil in functional options") + } + }) + + 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/observabilityadmin/api_op_GetTelemetryEvaluationStatus.go b/service/observabilityadmin/api_op_GetTelemetryEvaluationStatus.go new file mode 100644 index 00000000000..a51741b6919 --- /dev/null +++ b/service/observabilityadmin/api_op_GetTelemetryEvaluationStatus.go @@ -0,0 +1,155 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns the current onboarding status of the telemetry config feature, +// +// including the status of the feature and reason the feature failed to start or +// stop. +func (c *Client) GetTelemetryEvaluationStatus(ctx context.Context, params *GetTelemetryEvaluationStatusInput, optFns ...func(*Options)) (*GetTelemetryEvaluationStatusOutput, error) { + if params == nil { + params = &GetTelemetryEvaluationStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTelemetryEvaluationStatus", params, optFns, c.addOperationGetTelemetryEvaluationStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTelemetryEvaluationStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTelemetryEvaluationStatusInput struct { + noSmithyDocumentSerde +} + +type GetTelemetryEvaluationStatusOutput struct { + + // Describes the reason for the failure status. The field will only be populated + // if Status is FAILED_START or FAILED_STOP . + FailureReason *string + + // The onboarding status of the telemetry config feature. + Status types.Status + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTelemetryEvaluationStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTelemetryEvaluationStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTelemetryEvaluationStatus{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetTelemetryEvaluationStatus"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTelemetryEvaluationStatus(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetTelemetryEvaluationStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetTelemetryEvaluationStatus", + } +} diff --git a/service/observabilityadmin/api_op_GetTelemetryEvaluationStatusForOrganization.go b/service/observabilityadmin/api_op_GetTelemetryEvaluationStatusForOrganization.go new file mode 100644 index 00000000000..619797095c9 --- /dev/null +++ b/service/observabilityadmin/api_op_GetTelemetryEvaluationStatusForOrganization.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This returns the onboarding status of the telemetry configuration feature for +// +// the organization. It can only be called by a Management Account of an AWS +// Organization or an assigned Delegated Admin Account of AWS CloudWatch telemetry +// config. +func (c *Client) GetTelemetryEvaluationStatusForOrganization(ctx context.Context, params *GetTelemetryEvaluationStatusForOrganizationInput, optFns ...func(*Options)) (*GetTelemetryEvaluationStatusForOrganizationOutput, error) { + if params == nil { + params = &GetTelemetryEvaluationStatusForOrganizationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTelemetryEvaluationStatusForOrganization", params, optFns, c.addOperationGetTelemetryEvaluationStatusForOrganizationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTelemetryEvaluationStatusForOrganizationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTelemetryEvaluationStatusForOrganizationInput struct { + noSmithyDocumentSerde +} + +type GetTelemetryEvaluationStatusForOrganizationOutput struct { + + // This field describes the reason for the failure status. The field will only be + // populated if Status is FAILED_START or FAILED_STOP . + FailureReason *string + + // The onboarding status of the telemetry config feature for the organization. + Status types.Status + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTelemetryEvaluationStatusForOrganizationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTelemetryEvaluationStatusForOrganization{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTelemetryEvaluationStatusForOrganization{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetTelemetryEvaluationStatusForOrganization"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTelemetryEvaluationStatusForOrganization(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetTelemetryEvaluationStatusForOrganization(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetTelemetryEvaluationStatusForOrganization", + } +} diff --git a/service/observabilityadmin/api_op_ListResourceTelemetry.go b/service/observabilityadmin/api_op_ListResourceTelemetry.go new file mode 100644 index 00000000000..3b5de7cfae3 --- /dev/null +++ b/service/observabilityadmin/api_op_ListResourceTelemetry.go @@ -0,0 +1,279 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of telemetry configurations for AWS resources supported by +// +// telemetry config. For more information, see [Auditing CloudWatch telemetry configurations]. +// +// [Auditing CloudWatch telemetry configurations]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/telemetry-config-cloudwatch.html +func (c *Client) ListResourceTelemetry(ctx context.Context, params *ListResourceTelemetryInput, optFns ...func(*Options)) (*ListResourceTelemetryOutput, error) { + if params == nil { + params = &ListResourceTelemetryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListResourceTelemetry", params, optFns, c.addOperationListResourceTelemetryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListResourceTelemetryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListResourceTelemetryInput struct { + + // A number field used to limit the number of results within the returned list. + MaxResults *int32 + + // The token for the next set of items to return. A previous call generates this + // token. + NextToken *string + + // A string used to filter resources which have a ResourceIdentifier starting + // with the ResourceIdentifierPrefix . + ResourceIdentifierPrefix *string + + // A key-value pair to filter resources based on tags associated with the + // resource. For more information about tags, see [What are tags?] + // + // [What are tags?]: https://docs.aws.amazon.com/whitepapers/latest/tagging-best-practices/what-are-tags.html + ResourceTags map[string]string + + // A list of resource types used to filter resources supported by telemetry + // config. If this parameter is provided, the resources will be returned in the + // same order used in the request. + ResourceTypes []types.ResourceType + + // A key-value pair to filter resources based on the telemetry type and the state + // of the telemetry configuration. The key is the telemetry type and the value is + // the state. + TelemetryConfigurationState map[string]types.TelemetryState + + noSmithyDocumentSerde +} + +type ListResourceTelemetryOutput struct { + + // The token for the next set of items to return. A previous call generates this + // token. + NextToken *string + + // A list of telemetry configurations for AWS resources supported by telemetry + // config in the caller's account. + TelemetryConfigurations []types.TelemetryConfiguration + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListResourceTelemetryMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListResourceTelemetry{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListResourceTelemetry{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListResourceTelemetry"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListResourceTelemetry(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +// ListResourceTelemetryPaginatorOptions is the paginator options for +// ListResourceTelemetry +type ListResourceTelemetryPaginatorOptions struct { + // A number field used to limit the number of results within the returned list. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListResourceTelemetryPaginator is a paginator for ListResourceTelemetry +type ListResourceTelemetryPaginator struct { + options ListResourceTelemetryPaginatorOptions + client ListResourceTelemetryAPIClient + params *ListResourceTelemetryInput + nextToken *string + firstPage bool +} + +// NewListResourceTelemetryPaginator returns a new ListResourceTelemetryPaginator +func NewListResourceTelemetryPaginator(client ListResourceTelemetryAPIClient, params *ListResourceTelemetryInput, optFns ...func(*ListResourceTelemetryPaginatorOptions)) *ListResourceTelemetryPaginator { + if params == nil { + params = &ListResourceTelemetryInput{} + } + + options := ListResourceTelemetryPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListResourceTelemetryPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListResourceTelemetryPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListResourceTelemetry page. +func (p *ListResourceTelemetryPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListResourceTelemetryOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + optFns = append([]func(*Options){ + addIsPaginatorUserAgent, + }, optFns...) + result, err := p.client.ListResourceTelemetry(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +// ListResourceTelemetryAPIClient is a client that implements the +// ListResourceTelemetry operation. +type ListResourceTelemetryAPIClient interface { + ListResourceTelemetry(context.Context, *ListResourceTelemetryInput, ...func(*Options)) (*ListResourceTelemetryOutput, error) +} + +var _ ListResourceTelemetryAPIClient = (*Client)(nil) + +func newServiceMetadataMiddleware_opListResourceTelemetry(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListResourceTelemetry", + } +} diff --git a/service/observabilityadmin/api_op_ListResourceTelemetryForOrganization.go b/service/observabilityadmin/api_op_ListResourceTelemetryForOrganization.go new file mode 100644 index 00000000000..6196c995c6b --- /dev/null +++ b/service/observabilityadmin/api_op_ListResourceTelemetryForOrganization.go @@ -0,0 +1,283 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of telemetry configurations for AWS resources supported by +// +// telemetry config in the organization. +func (c *Client) ListResourceTelemetryForOrganization(ctx context.Context, params *ListResourceTelemetryForOrganizationInput, optFns ...func(*Options)) (*ListResourceTelemetryForOrganizationOutput, error) { + if params == nil { + params = &ListResourceTelemetryForOrganizationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListResourceTelemetryForOrganization", params, optFns, c.addOperationListResourceTelemetryForOrganizationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListResourceTelemetryForOrganizationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListResourceTelemetryForOrganizationInput struct { + + // A list of AWS account IDs used to filter the resources to those associated + // with the specified accounts. + AccountIdentifiers []string + + // A number field used to limit the number of results within the returned list. + MaxResults *int32 + + // The token for the next set of items to return. A previous call provides this + // token. + NextToken *string + + // A string used to filter resources in the organization which have a + // ResourceIdentifier starting with the ResourceIdentifierPrefix . + ResourceIdentifierPrefix *string + + // A key-value pair to filter resources in the organization based on tags + // associated with the resource. Fore more information about tags, see [What are tags?] + // + // [What are tags?]: https://docs.aws.amazon.com/whitepapers/latest/tagging-best-practices/what-are-tags.html + ResourceTags map[string]string + + // A list of resource types used to filter resources in the organization. If this + // parameter is provided, the resources will be returned in the same order used in + // the request. + ResourceTypes []types.ResourceType + + // A key-value pair to filter resources in the organization based on the + // telemetry type and the state of the telemetry configuration. The key is the + // telemetry type and the value is the state. + TelemetryConfigurationState map[string]types.TelemetryState + + noSmithyDocumentSerde +} + +type ListResourceTelemetryForOrganizationOutput struct { + + // The token for the next set of items to return. A previous call provides this + // token. + NextToken *string + + // A list of telemetry configurations for AWS resources supported by telemetry + // config in the organization. + TelemetryConfigurations []types.TelemetryConfiguration + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListResourceTelemetryForOrganizationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpListResourceTelemetryForOrganization{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListResourceTelemetryForOrganization{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ListResourceTelemetryForOrganization"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListResourceTelemetryForOrganization(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +// ListResourceTelemetryForOrganizationPaginatorOptions is the paginator options +// for ListResourceTelemetryForOrganization +type ListResourceTelemetryForOrganizationPaginatorOptions struct { + // A number field used to limit the number of results within the returned list. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListResourceTelemetryForOrganizationPaginator is a paginator for +// ListResourceTelemetryForOrganization +type ListResourceTelemetryForOrganizationPaginator struct { + options ListResourceTelemetryForOrganizationPaginatorOptions + client ListResourceTelemetryForOrganizationAPIClient + params *ListResourceTelemetryForOrganizationInput + nextToken *string + firstPage bool +} + +// NewListResourceTelemetryForOrganizationPaginator returns a new +// ListResourceTelemetryForOrganizationPaginator +func NewListResourceTelemetryForOrganizationPaginator(client ListResourceTelemetryForOrganizationAPIClient, params *ListResourceTelemetryForOrganizationInput, optFns ...func(*ListResourceTelemetryForOrganizationPaginatorOptions)) *ListResourceTelemetryForOrganizationPaginator { + if params == nil { + params = &ListResourceTelemetryForOrganizationInput{} + } + + options := ListResourceTelemetryForOrganizationPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListResourceTelemetryForOrganizationPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListResourceTelemetryForOrganizationPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListResourceTelemetryForOrganization page. +func (p *ListResourceTelemetryForOrganizationPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListResourceTelemetryForOrganizationOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + optFns = append([]func(*Options){ + addIsPaginatorUserAgent, + }, optFns...) + result, err := p.client.ListResourceTelemetryForOrganization(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +// ListResourceTelemetryForOrganizationAPIClient is a client that implements the +// ListResourceTelemetryForOrganization operation. +type ListResourceTelemetryForOrganizationAPIClient interface { + ListResourceTelemetryForOrganization(context.Context, *ListResourceTelemetryForOrganizationInput, ...func(*Options)) (*ListResourceTelemetryForOrganizationOutput, error) +} + +var _ ListResourceTelemetryForOrganizationAPIClient = (*Client)(nil) + +func newServiceMetadataMiddleware_opListResourceTelemetryForOrganization(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ListResourceTelemetryForOrganization", + } +} diff --git a/service/observabilityadmin/api_op_StartTelemetryEvaluation.go b/service/observabilityadmin/api_op_StartTelemetryEvaluation.go new file mode 100644 index 00000000000..f567e16794a --- /dev/null +++ b/service/observabilityadmin/api_op_StartTelemetryEvaluation.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This action begins onboarding onboarding the caller AWS account to the +// +// telemetry config feature. +func (c *Client) StartTelemetryEvaluation(ctx context.Context, params *StartTelemetryEvaluationInput, optFns ...func(*Options)) (*StartTelemetryEvaluationOutput, error) { + if params == nil { + params = &StartTelemetryEvaluationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartTelemetryEvaluation", params, optFns, c.addOperationStartTelemetryEvaluationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartTelemetryEvaluationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartTelemetryEvaluationInput struct { + noSmithyDocumentSerde +} + +type StartTelemetryEvaluationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartTelemetryEvaluationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartTelemetryEvaluation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartTelemetryEvaluation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartTelemetryEvaluation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartTelemetryEvaluation(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartTelemetryEvaluation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartTelemetryEvaluation", + } +} diff --git a/service/observabilityadmin/api_op_StartTelemetryEvaluationForOrganization.go b/service/observabilityadmin/api_op_StartTelemetryEvaluationForOrganization.go new file mode 100644 index 00000000000..33a0ae2773b --- /dev/null +++ b/service/observabilityadmin/api_op_StartTelemetryEvaluationForOrganization.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This actions begins onboarding the organization and all member accounts to the +// +// telemetry config feature. +func (c *Client) StartTelemetryEvaluationForOrganization(ctx context.Context, params *StartTelemetryEvaluationForOrganizationInput, optFns ...func(*Options)) (*StartTelemetryEvaluationForOrganizationOutput, error) { + if params == nil { + params = &StartTelemetryEvaluationForOrganizationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartTelemetryEvaluationForOrganization", params, optFns, c.addOperationStartTelemetryEvaluationForOrganizationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartTelemetryEvaluationForOrganizationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartTelemetryEvaluationForOrganizationInput struct { + noSmithyDocumentSerde +} + +type StartTelemetryEvaluationForOrganizationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartTelemetryEvaluationForOrganizationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartTelemetryEvaluationForOrganization{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartTelemetryEvaluationForOrganization{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StartTelemetryEvaluationForOrganization"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartTelemetryEvaluationForOrganization(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartTelemetryEvaluationForOrganization(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StartTelemetryEvaluationForOrganization", + } +} diff --git a/service/observabilityadmin/api_op_StopTelemetryEvaluation.go b/service/observabilityadmin/api_op_StopTelemetryEvaluation.go new file mode 100644 index 00000000000..d51b5cedd56 --- /dev/null +++ b/service/observabilityadmin/api_op_StopTelemetryEvaluation.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This action begins offboarding the caller AWS account from the telemetry +// +// config feature. +func (c *Client) StopTelemetryEvaluation(ctx context.Context, params *StopTelemetryEvaluationInput, optFns ...func(*Options)) (*StopTelemetryEvaluationOutput, error) { + if params == nil { + params = &StopTelemetryEvaluationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StopTelemetryEvaluation", params, optFns, c.addOperationStopTelemetryEvaluationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StopTelemetryEvaluationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StopTelemetryEvaluationInput struct { + noSmithyDocumentSerde +} + +type StopTelemetryEvaluationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStopTelemetryEvaluationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStopTelemetryEvaluation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStopTelemetryEvaluation{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StopTelemetryEvaluation"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopTelemetryEvaluation(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStopTelemetryEvaluation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StopTelemetryEvaluation", + } +} diff --git a/service/observabilityadmin/api_op_StopTelemetryEvaluationForOrganization.go b/service/observabilityadmin/api_op_StopTelemetryEvaluationForOrganization.go new file mode 100644 index 00000000000..a2b29cd89f7 --- /dev/null +++ b/service/observabilityadmin/api_op_StopTelemetryEvaluationForOrganization.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This action offboards the Organization of the caller AWS account from thef +// +// telemetry config feature. +func (c *Client) StopTelemetryEvaluationForOrganization(ctx context.Context, params *StopTelemetryEvaluationForOrganizationInput, optFns ...func(*Options)) (*StopTelemetryEvaluationForOrganizationOutput, error) { + if params == nil { + params = &StopTelemetryEvaluationForOrganizationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StopTelemetryEvaluationForOrganization", params, optFns, c.addOperationStopTelemetryEvaluationForOrganizationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StopTelemetryEvaluationForOrganizationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StopTelemetryEvaluationForOrganizationInput struct { + noSmithyDocumentSerde +} + +type StopTelemetryEvaluationForOrganizationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStopTelemetryEvaluationForOrganizationMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpStopTelemetryEvaluationForOrganization{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStopTelemetryEvaluationForOrganization{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "StopTelemetryEvaluationForOrganization"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addSpanRetryLoop(stack, options); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addTimeOffsetBuild(stack, c); err != nil { + return err + } + if err = addUserAgentRetryMode(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopTelemetryEvaluationForOrganization(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + if err = addSpanInitializeStart(stack); err != nil { + return err + } + if err = addSpanInitializeEnd(stack); err != nil { + return err + } + if err = addSpanBuildRequestStart(stack); err != nil { + return err + } + if err = addSpanBuildRequestEnd(stack); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStopTelemetryEvaluationForOrganization(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "StopTelemetryEvaluationForOrganization", + } +} diff --git a/service/observabilityadmin/auth.go b/service/observabilityadmin/auth.go new file mode 100644 index 00000000000..6eb50734b5b --- /dev/null +++ b/service/observabilityadmin/auth.go @@ -0,0 +1,313 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + smithy "github.com/aws/smithy-go" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/metrics" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +func bindAuthParamsRegion(_ interface{}, params *AuthResolverParameters, _ interface{}, options Options) { + params.Region = options.Region +} + +type setLegacyContextSigningOptionsMiddleware struct { +} + +func (*setLegacyContextSigningOptionsMiddleware) ID() string { + return "setLegacyContextSigningOptions" +} + +func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + rscheme := getResolvedAuthScheme(ctx) + schemeID := rscheme.Scheme.SchemeID() + + if sn := awsmiddleware.GetSigningName(ctx); sn != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) + } + } + + if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { + if schemeID == "aws.auth#sigv4" { + smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) + } else if schemeID == "aws.auth#sigv4a" { + smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) + } + } + + return next.HandleFinalize(ctx, in) +} + +func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { + return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) +} + +type withAnonymous struct { + resolver AuthSchemeResolver +} + +var _ AuthSchemeResolver = (*withAnonymous)(nil) + +func (v *withAnonymous) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + opts, err := v.resolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return nil, err + } + + opts = append(opts, &smithyauth.Option{ + SchemeID: smithyauth.SchemeIDAnonymous, + }) + return opts, nil +} + +func wrapWithAnonymousAuth(options *Options) { + if _, ok := options.AuthSchemeResolver.(*defaultAuthSchemeResolver); !ok { + return + } + + options.AuthSchemeResolver = &withAnonymous{ + resolver: options.AuthSchemeResolver, + } +} + +// AuthResolverParameters contains the set of inputs necessary for auth scheme +// resolution. +type AuthResolverParameters struct { + // The name of the operation being invoked. + Operation string + + // The region in which the operation is being invoked. + Region string +} + +func bindAuthResolverParams(ctx context.Context, operation string, input interface{}, options Options) *AuthResolverParameters { + params := &AuthResolverParameters{ + Operation: operation, + } + + bindAuthParamsRegion(ctx, params, input, options) + + return params +} + +// AuthSchemeResolver returns a set of possible authentication options for an +// operation. +type AuthSchemeResolver interface { + ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) +} + +type defaultAuthSchemeResolver struct{} + +var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) + +func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { + if overrides, ok := operationAuthOptions[params.Operation]; ok { + return overrides(params), nil + } + return serviceAuthOptions(params), nil +} + +var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} + +func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { + return []*smithyauth.Option{ + { + SchemeID: smithyauth.SchemeIDSigV4, + SignerProperties: func() smithy.Properties { + var props smithy.Properties + smithyhttp.SetSigV4SigningName(&props, "observabilityadmin") + smithyhttp.SetSigV4SigningRegion(&props, params.Region) + return props + }(), + }, + } +} + +type resolveAuthSchemeMiddleware struct { + operation string + options Options +} + +func (*resolveAuthSchemeMiddleware) ID() string { + return "ResolveAuthScheme" +} + +func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "ResolveAuthScheme") + defer span.End() + + params := bindAuthResolverParams(ctx, m.operation, getOperationInput(ctx), m.options) + options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("resolve auth scheme: %w", err) + } + + scheme, ok := m.selectScheme(options) + if !ok { + return out, metadata, fmt.Errorf("could not select an auth scheme") + } + + ctx = setResolvedAuthScheme(ctx, scheme) + + span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID()) + span.End() + return next.HandleFinalize(ctx, in) +} + +func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { + for _, option := range options { + if option.SchemeID == smithyauth.SchemeIDAnonymous { + return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true + } + + for _, scheme := range m.options.AuthSchemes { + if scheme.SchemeID() != option.SchemeID { + continue + } + + if scheme.IdentityResolver(m.options) != nil { + return newResolvedAuthScheme(scheme, option), true + } + } + } + + return nil, false +} + +type resolvedAuthSchemeKey struct{} + +type resolvedAuthScheme struct { + Scheme smithyhttp.AuthScheme + IdentityProperties smithy.Properties + SignerProperties smithy.Properties +} + +func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { + return &resolvedAuthScheme{ + Scheme: scheme, + IdentityProperties: option.IdentityProperties, + SignerProperties: option.SignerProperties, + } +} + +func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { + return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) +} + +func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { + v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) + return v +} + +type getIdentityMiddleware struct { + options Options +} + +func (*getIdentityMiddleware) ID() string { + return "GetIdentity" +} + +func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + innerCtx, span := tracing.StartSpan(ctx, "GetIdentity") + defer span.End() + + rscheme := getResolvedAuthScheme(innerCtx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + resolver := rscheme.Scheme.IdentityResolver(m.options) + if resolver == nil { + return out, metadata, fmt.Errorf("no identity resolver") + } + + identity, err := timeOperationMetric(ctx, "client.call.resolve_identity_duration", + func() (smithyauth.Identity, error) { + return resolver.GetIdentity(innerCtx, rscheme.IdentityProperties) + }, + func(o *metrics.RecordMetricOptions) { + o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID()) + }) + if err != nil { + return out, metadata, fmt.Errorf("get identity: %w", err) + } + + ctx = setIdentity(ctx, identity) + + span.End() + return next.HandleFinalize(ctx, in) +} + +type identityKey struct{} + +func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { + return middleware.WithStackValue(ctx, identityKey{}, identity) +} + +func getIdentity(ctx context.Context) smithyauth.Identity { + v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) + return v +} + +type signRequestMiddleware struct { + options Options +} + +func (*signRequestMiddleware) ID() string { + return "Signing" +} + +func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "SignRequest") + defer span.End() + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + identity := getIdentity(ctx) + if identity == nil { + return out, metadata, fmt.Errorf("no identity") + } + + signer := rscheme.Scheme.Signer() + if signer == nil { + return out, metadata, fmt.Errorf("no signer") + } + + _, err = timeOperationMetric(ctx, "client.call.signing_duration", func() (any, error) { + return nil, signer.SignRequest(ctx, req, identity, rscheme.SignerProperties) + }, func(o *metrics.RecordMetricOptions) { + o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID()) + }) + if err != nil { + return out, metadata, fmt.Errorf("sign request: %w", err) + } + + span.End() + return next.HandleFinalize(ctx, in) +} diff --git a/service/observabilityadmin/deserializers.go b/service/observabilityadmin/deserializers.go new file mode 100644 index 00000000000..fca359353b2 --- /dev/null +++ b/service/observabilityadmin/deserializers.go @@ -0,0 +1,1569 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/types" + smithy "github.com/aws/smithy-go" + smithyio "github.com/aws/smithy-go/io" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithytime "github.com/aws/smithy-go/time" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" + "io/ioutil" + "strings" + "time" +) + +func deserializeS3Expires(v string) (*time.Time, error) { + t, err := smithytime.ParseHTTPDate(v) + if err != nil { + return nil, nil + } + return &t, nil +} + +type awsRestjson1_deserializeOpGetTelemetryEvaluationStatus struct { +} + +func (*awsRestjson1_deserializeOpGetTelemetryEvaluationStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetTelemetryEvaluationStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorGetTelemetryEvaluationStatus(response, &metadata) + } + output := &GetTelemetryEvaluationStatusOutput{} + 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_deserializeOpDocumentGetTelemetryEvaluationStatusOutput(&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(), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorGetTelemetryEvaluationStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetTelemetryEvaluationStatusOutput(v **GetTelemetryEvaluationStatusOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetTelemetryEvaluationStatusOutput + if *v == nil { + sv = &GetTelemetryEvaluationStatusOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "FailureReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailureReason to be of type string, got %T instead", value) + } + sv.FailureReason = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Status to be of type string, got %T instead", value) + } + sv.Status = types.Status(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetTelemetryEvaluationStatusForOrganization struct { +} + +func (*awsRestjson1_deserializeOpGetTelemetryEvaluationStatusForOrganization) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetTelemetryEvaluationStatusForOrganization) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorGetTelemetryEvaluationStatusForOrganization(response, &metadata) + } + output := &GetTelemetryEvaluationStatusForOrganizationOutput{} + 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_deserializeOpDocumentGetTelemetryEvaluationStatusForOrganizationOutput(&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(), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorGetTelemetryEvaluationStatusForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetTelemetryEvaluationStatusForOrganizationOutput(v **GetTelemetryEvaluationStatusForOrganizationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetTelemetryEvaluationStatusForOrganizationOutput + if *v == nil { + sv = &GetTelemetryEvaluationStatusForOrganizationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "FailureReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FailureReason to be of type string, got %T instead", value) + } + sv.FailureReason = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Status to be of type string, got %T instead", value) + } + sv.Status = types.Status(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListResourceTelemetry struct { +} + +func (*awsRestjson1_deserializeOpListResourceTelemetry) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListResourceTelemetry) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListResourceTelemetry(response, &metadata) + } + output := &ListResourceTelemetryOutput{} + 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_deserializeOpDocumentListResourceTelemetryOutput(&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(), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorListResourceTelemetry(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListResourceTelemetryOutput(v **ListResourceTelemetryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListResourceTelemetryOutput + if *v == nil { + sv = &ListResourceTelemetryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "TelemetryConfigurations": + if err := awsRestjson1_deserializeDocumentTelemetryConfigurations(&sv.TelemetryConfigurations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListResourceTelemetryForOrganization struct { +} + +func (*awsRestjson1_deserializeOpListResourceTelemetryForOrganization) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListResourceTelemetryForOrganization) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListResourceTelemetryForOrganization(response, &metadata) + } + output := &ListResourceTelemetryForOrganizationOutput{} + 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_deserializeOpDocumentListResourceTelemetryForOrganizationOutput(&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(), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorListResourceTelemetryForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListResourceTelemetryForOrganizationOutput(v **ListResourceTelemetryForOrganizationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListResourceTelemetryForOrganizationOutput + if *v == nil { + sv = &ListResourceTelemetryForOrganizationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "TelemetryConfigurations": + if err := awsRestjson1_deserializeDocumentTelemetryConfigurations(&sv.TelemetryConfigurations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartTelemetryEvaluation struct { +} + +func (*awsRestjson1_deserializeOpStartTelemetryEvaluation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartTelemetryEvaluation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorStartTelemetryEvaluation(response, &metadata) + } + output := &StartTelemetryEvaluationOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorStartTelemetryEvaluation(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpStartTelemetryEvaluationForOrganization struct { +} + +func (*awsRestjson1_deserializeOpStartTelemetryEvaluationForOrganization) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartTelemetryEvaluationForOrganization) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorStartTelemetryEvaluationForOrganization(response, &metadata) + } + output := &StartTelemetryEvaluationForOrganizationOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorStartTelemetryEvaluationForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpStopTelemetryEvaluation struct { +} + +func (*awsRestjson1_deserializeOpStopTelemetryEvaluation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStopTelemetryEvaluation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorStopTelemetryEvaluation(response, &metadata) + } + output := &StopTelemetryEvaluationOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorStopTelemetryEvaluation(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpStopTelemetryEvaluationForOrganization struct { +} + +func (*awsRestjson1_deserializeOpStopTelemetryEvaluationForOrganization) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStopTelemetryEvaluationForOrganization) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + _, span := tracing.StartSpan(ctx, "OperationDeserializer") + endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") + defer endTimer() + defer span.End() + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorStopTelemetryEvaluationForOrganization(response, &metadata) + } + output := &StopTelemetryEvaluationForOrganizationOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + span.End() + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorStopTelemetryEvaluationForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsAccessDeniedException(v *types.AccessDeniedException, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("x-amzn-ErrorType"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.AmznErrorType = ptr.String(headerValues[0]) + } + + return nil +} +func awsRestjson1_deserializeOpHttpBindingsInternalServerException(v *types.InternalServerException, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("x-amzn-ErrorType"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.AmznErrorType = ptr.String(headerValues[0]) + } + + return nil +} +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + if err := awsRestjson1_deserializeOpHttpBindingsAccessDeniedException(output, response); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} + } + + return output +} + +func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InternalServerException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + if err := awsRestjson1_deserializeOpHttpBindingsInternalServerException(output, response); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} + } + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AccessDeniedException + if *v == nil { + sv = &types.AccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "amznErrorType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AmznErrorType = ptr.String(jtv) + } + + case "message", "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.InternalServerException + if *v == nil { + sv = &types.InternalServerException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "amznErrorType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AmznErrorType = ptr.String(jtv) + } + + case "message", "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTagMapOutput(v *map[string]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]string + if *v == nil { + mv = map[string]string{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentTelemetryConfiguration(v **types.TelemetryConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.TelemetryConfiguration + if *v == nil { + sv = &types.TelemetryConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccountIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccountIdentifier to be of type string, got %T instead", value) + } + sv.AccountIdentifier = ptr.String(jtv) + } + + case "LastUpdateTimeStamp": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.LastUpdateTimeStamp = ptr.Int64(i64) + } + + case "ResourceIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceIdentifier to be of type string, got %T instead", value) + } + sv.ResourceIdentifier = ptr.String(jtv) + } + + case "ResourceTags": + if err := awsRestjson1_deserializeDocumentTagMapOutput(&sv.ResourceTags, value); err != nil { + return err + } + + case "ResourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) + } + sv.ResourceType = types.ResourceType(jtv) + } + + case "TelemetryConfigurationState": + if err := awsRestjson1_deserializeDocumentTelemetryConfigurationState(&sv.TelemetryConfigurationState, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTelemetryConfigurations(v *[]types.TelemetryConfiguration, 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.TelemetryConfiguration + if *v == nil { + cv = []types.TelemetryConfiguration{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.TelemetryConfiguration + destAddr := &col + if err := awsRestjson1_deserializeDocumentTelemetryConfiguration(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTelemetryConfigurationState(v *map[string]types.TelemetryState, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.TelemetryState + if *v == nil { + mv = map[string]types.TelemetryState{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.TelemetryState + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TelemetryState to be of type string, got %T instead", value) + } + parsedVal = types.TelemetryState(jtv) + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ValidationException + if *v == nil { + sv = &types.ValidationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message", "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/observabilityadmin/doc.go b/service/observabilityadmin/doc.go new file mode 100644 index 00000000000..f02bcd358c5 --- /dev/null +++ b/service/observabilityadmin/doc.go @@ -0,0 +1,20 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package observabilityadmin provides the API client, operations, and parameter +// types for CloudWatch Observability Admin Service. +// +// Amazon CloudWatch Obsersavability Admin to control temletry config for your +// +// AWS Organization or account. Telemetry config config to discover and understand +// the state of telemetry configuration for your AWS resources from a central view +// in the CloudWatch console. Telemetry config simplifies the process of auditing +// your telemetry collection configurations across multiple resource types across +// your AWS Organization or account. For more information, see [Auditing CloudWatch telemetry configurations]in the CloudWatch +// User Guide. +// +// For information on the permissions you need to use this API, see [Identity and access management for Amazon CloudWatch] in the +// CloudWatch User Guide. +// +// [Auditing CloudWatch telemetry configurations]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/telemetry-config-cloudwatch.html +// [Identity and access management for Amazon CloudWatch]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/auth-and-access-control-cw.html +package observabilityadmin diff --git a/service/observabilityadmin/endpoints.go b/service/observabilityadmin/endpoints.go new file mode 100644 index 00000000000..49a7c0a10a0 --- /dev/null +++ b/service/observabilityadmin/endpoints.go @@ -0,0 +1,537 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + "github.com/aws/aws-sdk-go-v2/internal/endpoints" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/internal/endpoints" + smithyauth "github.com/aws/smithy-go/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" + "net/url" + "os" + "strings" +) + +// EndpointResolverOptions is the service endpoint resolver options +type EndpointResolverOptions = internalendpoints.Options + +// EndpointResolver interface for resolving service endpoints. +type EndpointResolver interface { + ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) +} + +var _ EndpointResolver = &internalendpoints.Resolver{} + +// NewDefaultEndpointResolver constructs a new service endpoint resolver +func NewDefaultEndpointResolver() *internalendpoints.Resolver { + return internalendpoints.New() +} + +// EndpointResolverFunc is a helper utility that wraps a function so it satisfies +// the EndpointResolver interface. This is useful when you want to add additional +// endpoint resolving logic, or stub out specific endpoints with custom values. +type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error) + +func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return fn(region, options) +} + +// EndpointResolverFromURL returns an EndpointResolver configured using the +// provided endpoint url. By default, the resolved endpoint resolver uses the +// client region as signing region, and the endpoint source is set to +// EndpointSourceCustom.You can provide functional options to configure endpoint +// values for the resolved endpoint. +func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver { + e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom} + for _, fn := range optFns { + fn(&e) + } + + return EndpointResolverFunc( + func(region string, options EndpointResolverOptions) (aws.Endpoint, error) { + if len(e.SigningRegion) == 0 { + e.SigningRegion = region + } + return e, nil + }, + ) +} + +type ResolveEndpoint struct { + Resolver EndpointResolver + Options EndpointResolverOptions +} + +func (*ResolveEndpoint) ID() string { + return "ResolveEndpoint" +} + +func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.Resolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + eo := m.Options + eo.Logger = middleware.GetLogger(ctx) + + var endpoint aws.Endpoint + endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo) + if err != nil { + nf := (&aws.EndpointNotFoundError{}) + if errors.As(err, &nf) { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false) + return next.HandleSerialize(ctx, in) + } + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL, err = url.Parse(endpoint.URL) + if err != nil { + return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) + } + + if len(awsmiddleware.GetSigningName(ctx)) == 0 { + signingName := endpoint.SigningName + if len(signingName) == 0 { + signingName = "observabilityadmin" + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + } + ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source) + ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable) + ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) + ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID) + return next.HandleSerialize(ctx, in) +} +func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + return stack.Serialize.Insert(&ResolveEndpoint{ + Resolver: o.EndpointResolver, + Options: o.EndpointOptions, + }, "OperationSerializer", middleware.Before) +} + +func removeResolveEndpointMiddleware(stack *middleware.Stack) error { + _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID()) + return err +} + +type wrappedEndpointResolver struct { + awsResolver aws.EndpointResolverWithOptions +} + +func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return w.awsResolver.ResolveEndpoint(ServiceID, region, options) +} + +type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error) + +func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) { + return a(service, region) +} + +var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil) + +// withEndpointResolver returns an aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver. +// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error, +// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked +// via its middleware. +// +// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated. +func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver { + var resolver aws.EndpointResolverWithOptions + + if awsResolverWithOptions != nil { + resolver = awsResolverWithOptions + } else if awsResolver != nil { + resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) + } + + return &wrappedEndpointResolver{ + awsResolver: resolver, + } +} + +func finalizeClientEndpointResolverOptions(options *Options) { + options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage() + + if len(options.EndpointOptions.ResolvedRegion) == 0 { + const fipsInfix = "-fips-" + const fipsPrefix = "fips-" + const fipsSuffix = "-fips" + + if strings.Contains(options.Region, fipsInfix) || + strings.Contains(options.Region, fipsPrefix) || + strings.Contains(options.Region, fipsSuffix) { + options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( + options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") + options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled + } + } + +} + +func resolveEndpointResolverV2(options *Options) { + if options.EndpointResolverV2 == nil { + options.EndpointResolverV2 = NewDefaultEndpointResolverV2() + } +} + +func resolveBaseEndpoint(cfg aws.Config, o *Options) { + if cfg.BaseEndpoint != nil { + o.BaseEndpoint = cfg.BaseEndpoint + } + + _, g := os.LookupEnv("AWS_ENDPOINT_URL") + _, s := os.LookupEnv("AWS_ENDPOINT_URL_OBSERVABILITYADMIN") + + if g && !s { + return + } + + value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "ObservabilityAdmin", cfg.ConfigSources) + if found && err == nil { + o.BaseEndpoint = &value + } +} + +func bindRegion(region string) *string { + if region == "" { + return nil + } + return aws.String(endpoints.MapFIPSRegion(region)) +} + +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. +type EndpointParameters struct { + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + return nil +} + +// WithDefaults returns a shallow copy of EndpointParameterswith default values +// applied to members where applicable. +func (p EndpointParameters) WithDefaults() EndpointParameters { + if p.UseDualStack == nil { + p.UseDualStack = ptr.Bool(false) + } + + if p.UseFIPS == nil { + p.UseFIPS = ptr.Bool(false) + } + return p +} + +type stringSlice []string + +func (s stringSlice) Get(i int) *string { + if i < 0 || i >= len(s) { + return nil + } + + v := s[i] + return &v +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, + ) +} + +// resolver provides the implementation for resolving endpoints. +type resolver struct{} + +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolver) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithyendpoints.Endpoint, err error, +) { + params = params.WithDefaults() + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseDualStack := *params.UseDualStack + _UseFIPS := *params.UseFIPS + + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported") + } + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") + } + uriString := _Endpoint + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _PartitionResult := *exprVal + _ = _PartitionResult + if _UseFIPS == true { + if _UseDualStack == true { + if true == _PartitionResult.SupportsFIPS { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://observabilityadmin-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both") + } + } + if _UseFIPS == true { + if _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://observabilityadmin-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") + } + if _UseDualStack == true { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://observabilityadmin.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://observabilityadmin.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region") +} + +type endpointParamsBinder interface { + bindEndpointParams(*EndpointParameters) +} + +func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters { + params := &EndpointParameters{} + + params.Region = bindRegion(options.Region) + params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled) + params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) + params.Endpoint = options.BaseEndpoint + + if b, ok := input.(endpointParamsBinder); ok { + b.bindEndpointParams(params) + } + + return params +} + +type resolveEndpointV2Middleware struct { + options Options +} + +func (*resolveEndpointV2Middleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( + out middleware.FinalizeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "ResolveEndpoint") + defer span.End() + + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleFinalize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.options.EndpointResolverV2 == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := bindEndpointParams(ctx, getOperationInput(ctx), m.options) + endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration", + func() (smithyendpoints.Endpoint, error) { + return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) + }) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + span.SetProperty("client.call.resolved_endpoint", endpt.URI.String()) + + if endpt.URI.RawPath == "" && req.URL.RawPath != "" { + endpt.URI.RawPath = endpt.URI.Path + } + req.URL.Scheme = endpt.URI.Scheme + req.URL.Host = endpt.URI.Host + req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) + req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) + for k := range endpt.Headers { + req.Header.Set(k, endpt.Headers.Get(k)) + } + + rscheme := getResolvedAuthScheme(ctx) + if rscheme == nil { + return out, metadata, fmt.Errorf("no resolved auth scheme") + } + + opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) + for _, o := range opts { + rscheme.SignerProperties.SetAll(&o.SignerProperties) + } + + span.End() + return next.HandleFinalize(ctx, in) +} diff --git a/service/observabilityadmin/endpoints_config_test.go b/service/observabilityadmin/endpoints_config_test.go new file mode 100644 index 00000000000..1f5b93941c0 --- /dev/null +++ b/service/observabilityadmin/endpoints_config_test.go @@ -0,0 +1,139 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "os" + "reflect" + "testing" +) + +type mockConfigSource struct { + global string + service string + ignore bool +} + +// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured +// endpoints feature. +func (m mockConfigSource) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) { + return m.ignore, m.ignore, nil +} + +// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use +// with configured endpoints. +func (m mockConfigSource) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) { + if m.service != "" { + return m.service, true, nil + } + return "", false, nil +} + +func TestResolveBaseEndpoint(t *testing.T) { + cases := map[string]struct { + envGlobal string + envService string + envIgnore bool + configGlobal string + configService string + configIgnore bool + clientEndpoint *string + expectURL *string + }{ + "env ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-observabilityadmin.dev", + envIgnore: true, + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + expectURL: nil, + }, + "env global": { + envGlobal: "https://env-global.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + expectURL: aws.String("https://env-global.dev"), + }, + "env service": { + envGlobal: "https://env-global.dev", + envService: "https://env-observabilityadmin.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + expectURL: aws.String("https://env-observabilityadmin.dev"), + }, + "config ignore": { + envGlobal: "https://env-global.dev", + envService: "https://env-observabilityadmin.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + configIgnore: true, + expectURL: nil, + }, + "config global": { + configGlobal: "http://config-global.dev", + expectURL: aws.String("http://config-global.dev"), + }, + "config service": { + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + expectURL: aws.String("http://config-observabilityadmin.dev"), + }, + "client": { + envGlobal: "https://env-global.dev", + envService: "https://env-observabilityadmin.dev", + configGlobal: "http://config-global.dev", + configService: "http://config-observabilityadmin.dev", + clientEndpoint: aws.String("https://client-observabilityadmin.dev"), + expectURL: aws.String("https://client-observabilityadmin.dev"), + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + os.Clearenv() + + awsConfig := aws.Config{} + ignore := c.envIgnore || c.configIgnore + + if c.configGlobal != "" && !ignore { + awsConfig.BaseEndpoint = aws.String(c.configGlobal) + } + + if c.envGlobal != "" { + t.Setenv("AWS_ENDPOINT_URL", c.envGlobal) + if !ignore { + awsConfig.BaseEndpoint = aws.String(c.envGlobal) + } + } + + if c.envService != "" { + t.Setenv("AWS_ENDPOINT_URL_OBSERVABILITYADMIN", c.envService) + } + + awsConfig.ConfigSources = []interface{}{ + mockConfigSource{ + global: c.envGlobal, + service: c.envService, + ignore: c.envIgnore, + }, + mockConfigSource{ + global: c.configGlobal, + service: c.configService, + ignore: c.configIgnore, + }, + } + + client := NewFromConfig(awsConfig, func(o *Options) { + if c.clientEndpoint != nil { + o.BaseEndpoint = c.clientEndpoint + } + }) + + if e, a := c.expectURL, client.options.BaseEndpoint; !reflect.DeepEqual(e, a) { + t.Errorf("expect endpoint %v , got %v", e, a) + } + }) + } +} diff --git a/service/observabilityadmin/endpoints_test.go b/service/observabilityadmin/endpoints_test.go new file mode 100644 index 00000000000..a2a9562465c --- /dev/null +++ b/service/observabilityadmin/endpoints_test.go @@ -0,0 +1,820 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + smithy "github.com/aws/smithy-go" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/ptr" + "net/http" + "net/url" + "reflect" + "strings" + "testing" +) + +// For region us-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase0(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase1(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase2(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase3(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack enabled +func TestEndpointCase4(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack disabled +func TestEndpointCase5(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack enabled +func TestEndpointCase6(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack disabled +func TestEndpointCase7(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase8(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase9(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase10(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase11(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase12(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase13(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase14(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase15(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase16(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase17(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin-fips.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase18(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase19(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://observabilityadmin.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For custom endpoint with region set and fips disabled and dualstack disabled +func TestEndpointCase20(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For custom endpoint with region not set and fips disabled and dualstack disabled +func TestEndpointCase21(t *testing.T) { + var params = EndpointParameters{ + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if !reflect.DeepEqual(expectEndpoint.Headers, result.Headers) { + t.Errorf("expect headers to match\n%v != %v", expectEndpoint.Headers, result.Headers) + } + + if !reflect.DeepEqual(expectEndpoint.Properties, result.Properties) { + t.Errorf("expect properties to match\n%v != %v", expectEndpoint.Properties, result.Properties) + } +} + +// For custom endpoint with fips enabled and dualstack disabled +func TestEndpointCase22(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: FIPS and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For custom endpoint with fips disabled and dualstack enabled +func TestEndpointCase23(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Dualstack and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// Missing region +func TestEndpointCase24(t *testing.T) { + var params = EndpointParameters{} + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Missing Region", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} diff --git a/service/observabilityadmin/generated.json b/service/observabilityadmin/generated.json new file mode 100644 index 00000000000..020d3fbf9f7 --- /dev/null +++ b/service/observabilityadmin/generated.json @@ -0,0 +1,40 @@ +{ + "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_GetTelemetryEvaluationStatus.go", + "api_op_GetTelemetryEvaluationStatusForOrganization.go", + "api_op_ListResourceTelemetry.go", + "api_op_ListResourceTelemetryForOrganization.go", + "api_op_StartTelemetryEvaluation.go", + "api_op_StartTelemetryEvaluationForOrganization.go", + "api_op_StopTelemetryEvaluation.go", + "api_op_StopTelemetryEvaluationForOrganization.go", + "auth.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "endpoints_config_test.go", + "endpoints_test.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "options.go", + "protocol_test.go", + "serializers.go", + "snapshot_test.go", + "types/enums.go", + "types/errors.go", + "types/types.go", + "validators.go" + ], + "go": "1.15", + "module": "github.com/aws/aws-sdk-go-v2/service/observabilityadmin", + "unstable": false +} diff --git a/service/observabilityadmin/go.mod b/service/observabilityadmin/go.mod new file mode 100644 index 00000000000..4efe5a4ae5e --- /dev/null +++ b/service/observabilityadmin/go.mod @@ -0,0 +1,16 @@ +module github.com/aws/aws-sdk-go-v2/service/observabilityadmin + +go 1.21 + +require ( + github.com/aws/aws-sdk-go-v2 v1.32.5 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 + github.com/aws/smithy-go v1.22.1 +) + +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/observabilityadmin/go.sum b/service/observabilityadmin/go.sum new file mode 100644 index 00000000000..bd2678891af --- /dev/null +++ b/service/observabilityadmin/go.sum @@ -0,0 +1,2 @@ +github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro= +github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= diff --git a/service/observabilityadmin/go_module_metadata.go b/service/observabilityadmin/go_module_metadata.go new file mode 100644 index 00000000000..4b00f5092d8 --- /dev/null +++ b/service/observabilityadmin/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package observabilityadmin + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/observabilityadmin/internal/endpoints/endpoints.go b/service/observabilityadmin/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..37369567dff --- /dev/null +++ b/service/observabilityadmin/internal/endpoints/endpoints.go @@ -0,0 +1,296 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package endpoints + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2" + "github.com/aws/smithy-go/logging" + "regexp" +) + +// Options is the endpoint resolver configuration options +type Options struct { + // Logger is a logging implementation that log events should be sent to. + Logger logging.Logger + + // LogDeprecated indicates that deprecated endpoints should be logged to the + // provided logger. + LogDeprecated bool + + // ResolvedRegion is used to override the region to be resolved, rather then the + // using the value passed to the ResolveEndpoint method. This value is used by the + // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative + // name. You must not set this value directly in your application. + ResolvedRegion string + + // DisableHTTPS informs the resolver to return an endpoint that does not use the + // HTTPS scheme. + DisableHTTPS bool + + // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint. + UseDualStackEndpoint aws.DualStackEndpointState + + // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint. + UseFIPSEndpoint aws.FIPSEndpointState +} + +func (o Options) GetResolvedRegion() string { + return o.ResolvedRegion +} + +func (o Options) GetDisableHTTPS() bool { + return o.DisableHTTPS +} + +func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState { + return o.UseDualStackEndpoint +} + +func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState { + return o.UseFIPSEndpoint +} + +func transformToSharedOptions(options Options) endpoints.Options { + return endpoints.Options{ + Logger: options.Logger, + LogDeprecated: options.LogDeprecated, + ResolvedRegion: options.ResolvedRegion, + DisableHTTPS: options.DisableHTTPS, + UseDualStackEndpoint: options.UseDualStackEndpoint, + UseFIPSEndpoint: options.UseFIPSEndpoint, + } +} + +// Resolver ObservabilityAdmin endpoint resolver +type Resolver struct { + partitions endpoints.Partitions +} + +// ResolveEndpoint resolves the service endpoint for the given region and options +func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { + if len(region) == 0 { + return endpoint, &aws.MissingRegionError{} + } + + opt := transformToSharedOptions(options) + return r.partitions.ResolveEndpoint(region, opt) +} + +// New returns a new Resolver +func New() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsIsoE *regexp.Regexp + AwsIsoF *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"), + AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + +var defaultPartitions = endpoints.Partitions{ + { + ID: "aws", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsCn, + IsRegionalized: true, + }, + { + ID: "aws-iso", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIso, + IsRegionalized: true, + }, + { + ID: "aws-iso-b", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + }, + { + ID: "aws-iso-e", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoE, + IsRegionalized: true, + }, + { + ID: "aws-iso-f", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoF, + IsRegionalized: true, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "observabilityadmin-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "observabilityadmin.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/observabilityadmin/internal/endpoints/endpoints_test.go b/service/observabilityadmin/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/observabilityadmin/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/observabilityadmin/options.go b/service/observabilityadmin/options.go new file mode 100644 index 00000000000..2219db97250 --- /dev/null +++ b/service/observabilityadmin/options.go @@ -0,0 +1,232 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" + smithyauth "github.com/aws/smithy-go/auth" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/metrics" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" +) + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +type Options struct { + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // The optional application specific identifier appended to the User-Agent header. + AppID string + + // This endpoint will be given as input to an EndpointResolverV2. It is used for + // providing a custom base endpoint that is subject to modifications by the + // processing EndpointResolverV2. + BaseEndpoint *string + + // Configures the events that will be sent to the configured logger. + ClientLogMode aws.ClientLogMode + + // The credentials object to use when signing requests. + Credentials aws.CredentialsProvider + + // The configuration DefaultsMode that the SDK should use when constructing the + // clients initial default settings. + DefaultsMode aws.DefaultsMode + + // The endpoint options to be used when attempting to resolve an endpoint. + EndpointOptions EndpointResolverOptions + + // The service endpoint resolver. + // + // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a + // value for this field will likely prevent you from using any endpoint-related + // service features released after the introduction of EndpointResolverV2 and + // BaseEndpoint. + // + // To migrate an EndpointResolver implementation that uses a custom endpoint, set + // the client option BaseEndpoint instead. + EndpointResolver EndpointResolver + + // Resolves the endpoint used for a particular service operation. This should be + // used over the deprecated EndpointResolver. + EndpointResolverV2 EndpointResolverV2 + + // Signature Version 4 (SigV4) Signer + HTTPSignerV4 HTTPSignerV4 + + // The logger writer interface to write logging messages to. + Logger logging.Logger + + // The client meter provider. + MeterProvider metrics.MeterProvider + + // 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. + // + // 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 client tracer provider. + TracerProvider tracing.TracerProvider + + // The initial DefaultsMode used when the client options were constructed. If the + // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved + // value was at that point in time. + // + // Currently does not support per operation call overrides, may in the future. + resolvedDefaultsMode aws.DefaultsMode + + // The HTTP client to invoke API calls with. Defaults to client's default HTTP + // implementation if nil. + HTTPClient HTTPClient + + // The auth scheme resolver which determines how to authenticate for each + // operation. + AuthSchemeResolver AuthSchemeResolver + + // The list of auth schemes supported by the client. + AuthSchemes []smithyhttp.AuthScheme +} + +// Copy creates a clone where the APIOptions list is deep copied. +func (o Options) Copy() Options { + to := o + to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions)) + copy(to.APIOptions, o.APIOptions) + + return to +} + +func (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { + if schemeID == "aws.auth#sigv4" { + return getSigV4IdentityResolver(o) + } + if schemeID == "smithy.api#noAuth" { + return &smithyauth.AnonymousIdentityResolver{} + } + return nil +} + +// WithAPIOptions returns a functional option for setting the Client's APIOptions +// option. +func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { + return func(o *Options) { + o.APIOptions = append(o.APIOptions, optFns...) + } +} + +// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for +// this field will likely prevent you from using any endpoint-related service +// features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// +// To migrate an EndpointResolver implementation that uses a custom endpoint, set +// the client option BaseEndpoint instead. +func WithEndpointResolver(v EndpointResolver) func(*Options) { + return func(o *Options) { + o.EndpointResolver = v + } +} + +// WithEndpointResolverV2 returns a functional option for setting the Client's +// EndpointResolverV2 option. +func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) { + return func(o *Options) { + o.EndpointResolverV2 = v + } +} + +func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { + if o.Credentials != nil { + return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} + } + return nil +} + +// WithSigV4SigningName applies an override to the authentication workflow to +// use the given signing name for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing name from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningName(name string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), + middleware.Before, + ) + }) + } +} + +// WithSigV4SigningRegion applies an override to the authentication workflow to +// use the given signing region for SigV4-authenticated operations. +// +// This is an advanced setting. The value here is FINAL, taking precedence over +// the resolved signing region from both auth scheme resolution and endpoint +// resolution. +func WithSigV4SigningRegion(region string) func(*Options) { + fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, + ) { + return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) + } + return func(o *Options) { + o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { + return s.Initialize.Add( + middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), + middleware.Before, + ) + }) + } +} + +func ignoreAnonymousAuth(options *Options) { + if aws.IsCredentialsProvider(options.Credentials, (*aws.AnonymousCredentials)(nil)) { + options.Credentials = nil + } +} diff --git a/service/observabilityadmin/protocol_test.go b/service/observabilityadmin/protocol_test.go new file mode 100644 index 00000000000..8837f552c7c --- /dev/null +++ b/service/observabilityadmin/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin diff --git a/service/observabilityadmin/serializers.go b/service/observabilityadmin/serializers.go new file mode 100644 index 00000000000..8603a347e33 --- /dev/null +++ b/service/observabilityadmin/serializers.go @@ -0,0 +1,639 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/observabilityadmin/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" + "github.com/aws/smithy-go/tracing" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +type awsRestjson1_serializeOpGetTelemetryEvaluationStatus struct { +} + +func (*awsRestjson1_serializeOpGetTelemetryEvaluationStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetTelemetryEvaluationStatus) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetTelemetryEvaluationStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/GetTelemetryEvaluationStatus") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetTelemetryEvaluationStatusInput(v *GetTelemetryEvaluationStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpGetTelemetryEvaluationStatusForOrganization struct { +} + +func (*awsRestjson1_serializeOpGetTelemetryEvaluationStatusForOrganization) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetTelemetryEvaluationStatusForOrganization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetTelemetryEvaluationStatusForOrganizationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/GetTelemetryEvaluationStatusForOrganization") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetTelemetryEvaluationStatusForOrganizationInput(v *GetTelemetryEvaluationStatusForOrganizationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpListResourceTelemetry struct { +} + +func (*awsRestjson1_serializeOpListResourceTelemetry) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListResourceTelemetry) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListResourceTelemetryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ListResourceTelemetry") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListResourceTelemetryInput(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 + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsListResourceTelemetryInput(v *ListResourceTelemetryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListResourceTelemetryInput(v *ListResourceTelemetryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if v.ResourceIdentifierPrefix != nil { + ok := object.Key("ResourceIdentifierPrefix") + ok.String(*v.ResourceIdentifierPrefix) + } + + if v.ResourceTags != nil { + ok := object.Key("ResourceTags") + if err := awsRestjson1_serializeDocumentTagMapInput(v.ResourceTags, ok); err != nil { + return err + } + } + + if v.ResourceTypes != nil { + ok := object.Key("ResourceTypes") + if err := awsRestjson1_serializeDocumentResourceTypes(v.ResourceTypes, ok); err != nil { + return err + } + } + + if v.TelemetryConfigurationState != nil { + ok := object.Key("TelemetryConfigurationState") + if err := awsRestjson1_serializeDocumentTelemetryConfigurationState(v.TelemetryConfigurationState, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListResourceTelemetryForOrganization struct { +} + +func (*awsRestjson1_serializeOpListResourceTelemetryForOrganization) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListResourceTelemetryForOrganization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListResourceTelemetryForOrganizationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ListResourceTelemetryForOrganization") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentListResourceTelemetryForOrganizationInput(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 + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsListResourceTelemetryForOrganizationInput(v *ListResourceTelemetryForOrganizationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListResourceTelemetryForOrganizationInput(v *ListResourceTelemetryForOrganizationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountIdentifiers != nil { + ok := object.Key("AccountIdentifiers") + if err := awsRestjson1_serializeDocumentAccountIdentifiers(v.AccountIdentifiers, ok); err != nil { + return err + } + } + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if v.ResourceIdentifierPrefix != nil { + ok := object.Key("ResourceIdentifierPrefix") + ok.String(*v.ResourceIdentifierPrefix) + } + + if v.ResourceTags != nil { + ok := object.Key("ResourceTags") + if err := awsRestjson1_serializeDocumentTagMapInput(v.ResourceTags, ok); err != nil { + return err + } + } + + if v.ResourceTypes != nil { + ok := object.Key("ResourceTypes") + if err := awsRestjson1_serializeDocumentResourceTypes(v.ResourceTypes, ok); err != nil { + return err + } + } + + if v.TelemetryConfigurationState != nil { + ok := object.Key("TelemetryConfigurationState") + if err := awsRestjson1_serializeDocumentTelemetryConfigurationState(v.TelemetryConfigurationState, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpStartTelemetryEvaluation struct { +} + +func (*awsRestjson1_serializeOpStartTelemetryEvaluation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartTelemetryEvaluation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*StartTelemetryEvaluationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/StartTelemetryEvaluation") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsStartTelemetryEvaluationInput(v *StartTelemetryEvaluationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpStartTelemetryEvaluationForOrganization struct { +} + +func (*awsRestjson1_serializeOpStartTelemetryEvaluationForOrganization) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartTelemetryEvaluationForOrganization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*StartTelemetryEvaluationForOrganizationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/StartTelemetryEvaluationForOrganization") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsStartTelemetryEvaluationForOrganizationInput(v *StartTelemetryEvaluationForOrganizationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpStopTelemetryEvaluation struct { +} + +func (*awsRestjson1_serializeOpStopTelemetryEvaluation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStopTelemetryEvaluation) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*StopTelemetryEvaluationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/StopTelemetryEvaluation") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsStopTelemetryEvaluationInput(v *StopTelemetryEvaluationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpStopTelemetryEvaluationForOrganization struct { +} + +func (*awsRestjson1_serializeOpStopTelemetryEvaluationForOrganization) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStopTelemetryEvaluationForOrganization) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + _, span := tracing.StartSpan(ctx, "OperationSerializer") + endTimer := startMetricTimer(ctx, "client.call.serialization_duration") + defer endTimer() + defer span.End() + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*StopTelemetryEvaluationForOrganizationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/StopTelemetryEvaluationForOrganization") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + endTimer() + span.End() + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsStopTelemetryEvaluationForOrganizationInput(v *StopTelemetryEvaluationForOrganizationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeDocumentAccountIdentifiers(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentResourceTypes(v []types.ResourceType, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(string(v[i])) + } + return nil +} + +func awsRestjson1_serializeDocumentTagMapInput(v map[string]string, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + for key := range v { + om := object.Key(key) + om.String(v[key]) + } + return nil +} + +func awsRestjson1_serializeDocumentTelemetryConfigurationState(v map[string]types.TelemetryState, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + for key := range v { + om := object.Key(key) + om.String(string(v[key])) + } + return nil +} diff --git a/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatus.go.snap b/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatus.go.snap new file mode 100644 index 00000000000..dfb30de2413 --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatus.go.snap @@ -0,0 +1,40 @@ +GetTelemetryEvaluationStatus + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatusForOrganization.go.snap b/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatusForOrganization.go.snap new file mode 100644 index 00000000000..346d58a2a9c --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_GetTelemetryEvaluationStatusForOrganization.go.snap @@ -0,0 +1,40 @@ +GetTelemetryEvaluationStatusForOrganization + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_ListResourceTelemetry.go.snap b/service/observabilityadmin/snapshot/api_op_ListResourceTelemetry.go.snap new file mode 100644 index 00000000000..d183ee5f9d8 --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_ListResourceTelemetry.go.snap @@ -0,0 +1,40 @@ +ListResourceTelemetry + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_ListResourceTelemetryForOrganization.go.snap b/service/observabilityadmin/snapshot/api_op_ListResourceTelemetryForOrganization.go.snap new file mode 100644 index 00000000000..d9c2932a7d2 --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_ListResourceTelemetryForOrganization.go.snap @@ -0,0 +1,40 @@ +ListResourceTelemetryForOrganization + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluation.go.snap b/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluation.go.snap new file mode 100644 index 00000000000..1b460278dfa --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluation.go.snap @@ -0,0 +1,40 @@ +StartTelemetryEvaluation + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluationForOrganization.go.snap b/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluationForOrganization.go.snap new file mode 100644 index 00000000000..76634e09868 --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_StartTelemetryEvaluationForOrganization.go.snap @@ -0,0 +1,40 @@ +StartTelemetryEvaluationForOrganization + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluation.go.snap b/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluation.go.snap new file mode 100644 index 00000000000..8e83816573b --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluation.go.snap @@ -0,0 +1,40 @@ +StopTelemetryEvaluation + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluationForOrganization.go.snap b/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluationForOrganization.go.snap new file mode 100644 index 00000000000..0a9f9770482 --- /dev/null +++ b/service/observabilityadmin/snapshot/api_op_StopTelemetryEvaluationForOrganization.go.snap @@ -0,0 +1,40 @@ +StopTelemetryEvaluationForOrganization + Initialize stack step + spanInitializeStart + RegisterServiceMetadata + legacyEndpointContextSetter + SetLogger + spanInitializeEnd + Serialize stack step + spanBuildRequestStart + setOperationInput + ResolveEndpoint + OperationSerializer + Build stack step + ClientRequestID + ComputeContentLength + UserAgent + AddTimeOffsetMiddleware + RecursionDetection + spanBuildRequestEnd + Finalize stack step + ResolveAuthScheme + GetIdentity + ResolveEndpointV2 + disableHTTPS + ComputePayloadHash + spanRetryLoop + Retry + RetryMetricsHeader + setLegacyContextSigningOptions + Signing + Deserialize stack step + AddRawResponseToMetadata + ErrorCloseResponseBody + CloseResponseBody + ResponseErrorWrapper + RequestIDRetriever + OperationDeserializer + AddTimeOffsetMiddleware + RecordResponseTiming + RequestResponseLogger diff --git a/service/observabilityadmin/snapshot_test.go b/service/observabilityadmin/snapshot_test.go new file mode 100644 index 00000000000..0347c08f3dc --- /dev/null +++ b/service/observabilityadmin/snapshot_test.go @@ -0,0 +1,254 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +//go:build snapshot + +package observabilityadmin + +import ( + "context" + "errors" + "fmt" + "github.com/aws/smithy-go/middleware" + "io" + "io/fs" + "os" + "testing" +) + +const ssprefix = "snapshot" + +type snapshotOK struct{} + +func (snapshotOK) Error() string { return "error: success" } + +func createp(path string) (*os.File, error) { + if err := os.Mkdir(ssprefix, 0700); err != nil && !errors.Is(err, fs.ErrExist) { + return nil, err + } + return os.Create(path) +} + +func sspath(op string) string { + return fmt.Sprintf("%s/api_op_%s.go.snap", ssprefix, op) +} + +func updateSnapshot(stack *middleware.Stack, operation string) error { + f, err := createp(sspath(operation)) + if err != nil { + return err + } + defer f.Close() + if _, err := f.Write([]byte(stack.String())); err != nil { + return err + } + return snapshotOK{} +} + +func testSnapshot(stack *middleware.Stack, operation string) error { + f, err := os.Open(sspath(operation)) + if errors.Is(err, fs.ErrNotExist) { + return snapshotOK{} + } + if err != nil { + return err + } + defer f.Close() + expected, err := io.ReadAll(f) + if err != nil { + return err + } + if actual := stack.String(); actual != string(expected) { + return fmt.Errorf("%s != %s", expected, actual) + } + return snapshotOK{} +} +func TestCheckSnapshot_GetTelemetryEvaluationStatus(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetTelemetryEvaluationStatus(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "GetTelemetryEvaluationStatus") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_GetTelemetryEvaluationStatusForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetTelemetryEvaluationStatusForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "GetTelemetryEvaluationStatusForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_ListResourceTelemetry(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListResourceTelemetry(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "ListResourceTelemetry") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_ListResourceTelemetryForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListResourceTelemetryForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "ListResourceTelemetryForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_StartTelemetryEvaluation(t *testing.T) { + svc := New(Options{}) + _, err := svc.StartTelemetryEvaluation(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "StartTelemetryEvaluation") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_StartTelemetryEvaluationForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.StartTelemetryEvaluationForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "StartTelemetryEvaluationForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_StopTelemetryEvaluation(t *testing.T) { + svc := New(Options{}) + _, err := svc.StopTelemetryEvaluation(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "StopTelemetryEvaluation") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestCheckSnapshot_StopTelemetryEvaluationForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.StopTelemetryEvaluationForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "StopTelemetryEvaluationForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} +func TestUpdateSnapshot_GetTelemetryEvaluationStatus(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetTelemetryEvaluationStatus(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "GetTelemetryEvaluationStatus") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_GetTelemetryEvaluationStatusForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetTelemetryEvaluationStatusForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "GetTelemetryEvaluationStatusForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_ListResourceTelemetry(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListResourceTelemetry(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "ListResourceTelemetry") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_ListResourceTelemetryForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.ListResourceTelemetryForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "ListResourceTelemetryForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_StartTelemetryEvaluation(t *testing.T) { + svc := New(Options{}) + _, err := svc.StartTelemetryEvaluation(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "StartTelemetryEvaluation") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_StartTelemetryEvaluationForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.StartTelemetryEvaluationForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "StartTelemetryEvaluationForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_StopTelemetryEvaluation(t *testing.T) { + svc := New(Options{}) + _, err := svc.StopTelemetryEvaluation(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "StopTelemetryEvaluation") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + +func TestUpdateSnapshot_StopTelemetryEvaluationForOrganization(t *testing.T) { + svc := New(Options{}) + _, err := svc.StopTelemetryEvaluationForOrganization(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "StopTelemetryEvaluationForOrganization") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} diff --git a/service/observabilityadmin/types/enums.go b/service/observabilityadmin/types/enums.go new file mode 100644 index 00000000000..c2b3724bdcd --- /dev/null +++ b/service/observabilityadmin/types/enums.go @@ -0,0 +1,95 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type ResourceType string + +// Enum values for ResourceType +const ( + ResourceTypeAwsEc2Instance ResourceType = "AWS::EC2::Instance" + ResourceTypeAwsEc2Vpc ResourceType = "AWS::EC2::VPC" + ResourceTypeAwsLamdbaFunction ResourceType = "AWS::Lambda::Function" +) + +// Values returns all known values for ResourceType. Note that this can be +// expanded in the future, and so it is only as up to date as the client. +// +// The ordering of this slice is not guaranteed to be stable across updates. +func (ResourceType) Values() []ResourceType { + return []ResourceType{ + "AWS::EC2::Instance", + "AWS::EC2::VPC", + "AWS::Lambda::Function", + } +} + +type Status string + +// Enum values for Status +const ( + StatusNotStarted Status = "NOT_STARTED" + StatusStarting Status = "STARTING" + StatusFailedStart Status = "FAILED_START" + StatusRunning Status = "RUNNING" + StatusStopping Status = "STOPPING" + StatusFailedStop Status = "FAILED_STOP" + StatusStopped Status = "STOPPED" +) + +// Values returns all known values for Status. Note that this can be expanded in +// the future, and so it is only as up to date as the client. +// +// The ordering of this slice is not guaranteed to be stable across updates. +func (Status) Values() []Status { + return []Status{ + "NOT_STARTED", + "STARTING", + "FAILED_START", + "RUNNING", + "STOPPING", + "FAILED_STOP", + "STOPPED", + } +} + +type TelemetryState string + +// Enum values for TelemetryState +const ( + TelemetryStateEnabled TelemetryState = "Enabled" + TelemetryStateDisabled TelemetryState = "Disabled" + TelemetryStateNotApplicable TelemetryState = "NotApplicable" +) + +// Values returns all known values for TelemetryState. 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 (TelemetryState) Values() []TelemetryState { + return []TelemetryState{ + "Enabled", + "Disabled", + "NotApplicable", + } +} + +type TelemetryType string + +// Enum values for TelemetryType +const ( + TelemetryTypeLogs TelemetryType = "Logs" + TelemetryTypeMetrics TelemetryType = "Metrics" + TelemetryTypeTraces TelemetryType = "Traces" +) + +// Values returns all known values for TelemetryType. 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 (TelemetryType) Values() []TelemetryType { + return []TelemetryType{ + "Logs", + "Metrics", + "Traces", + } +} diff --git a/service/observabilityadmin/types/errors.go b/service/observabilityadmin/types/errors.go new file mode 100644 index 00000000000..c79e1a36900 --- /dev/null +++ b/service/observabilityadmin/types/errors.go @@ -0,0 +1,100 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// Indicates you don't have permissions to perform the requested operation. The +// +// user or role that is making the request must have at least one IAM permissions +// policy attached that grants the required permissions. For more information, see [Access management for AWS resources] +// in the IAM user guide. +// +// [Access management for AWS resources]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html +type AccessDeniedException struct { + Message *string + + ErrorCodeOverride *string + + AmznErrorType *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "AccessDeniedException" + } + return *e.ErrorCodeOverride +} +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Indicates the request has failed to process because of an unknown server +// +// error, exception, or failure. +type InternalServerException struct { + Message *string + + ErrorCodeOverride *string + + AmznErrorType *string + + noSmithyDocumentSerde +} + +func (e *InternalServerException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InternalServerException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InternalServerException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InternalServerException" + } + return *e.ErrorCodeOverride +} +func (e *InternalServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Indicates input validation failed. Check your request parameters and retry the +// +// request. +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ValidationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ValidationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ValidationException" + } + return *e.ErrorCodeOverride +} +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/observabilityadmin/types/types.go b/service/observabilityadmin/types/types.go new file mode 100644 index 00000000000..a25f87b7a1c --- /dev/null +++ b/service/observabilityadmin/types/types.go @@ -0,0 +1,39 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" +) + +// A model representing the state of a resource within an account according to +// +// telemetry config. +type TelemetryConfiguration struct { + + // The account ID which contains the resource managed in telemetry configuration. + // An example of a valid account ID is 012345678901 . + AccountIdentifier *string + + // The timestamp of the last change to the telemetry configuration for the + // resource. For example, 1728679196318 . + LastUpdateTimeStamp *int64 + + // The identifier of the resource, for example i-0b22a22eec53b9321 . + ResourceIdentifier *string + + // Tags associated with the resource, for example { Name: "ExampleInstance", + // Environment: "Development" } . + ResourceTags map[string]string + + // The type of resource, for example AWS::EC2::Instance . + ResourceType ResourceType + + // The configuration state for the resource, for example { Logs: NotApplicable; + // Metrics: Enabled; Traces: NotApplicable; } . + TelemetryConfigurationState map[string]TelemetryState + + noSmithyDocumentSerde +} + +type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/observabilityadmin/validators.go b/service/observabilityadmin/validators.go new file mode 100644 index 00000000000..8837f552c7c --- /dev/null +++ b/service/observabilityadmin/validators.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package observabilityadmin diff --git a/service/swf/internal/endpoints/endpoints.go b/service/swf/internal/endpoints/endpoints.go index 997381a5609..52f93f73f51 100644 --- a/service/swf/internal/endpoints/endpoints.go +++ b/service/swf/internal/endpoints/endpoints.go @@ -178,9 +178,21 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ca-central-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "swf-fips.ca-central-1.amazonaws.com", + }, endpoints.EndpointKey{ Region: "ca-west-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-west-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "swf-fips.ca-west-1.amazonaws.com", + }, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, @@ -205,6 +217,24 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "eu-west-3", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips-ca-central-1", + }: endpoints.Endpoint{ + Hostname: "swf-fips.ca-central-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ca-central-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-ca-west-1", + }: endpoints.Endpoint{ + Hostname: "swf-fips.ca-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ca-west-1", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "fips-us-east-1", }: endpoints.Endpoint{ @@ -355,12 +385,42 @@ var defaultPartitions = endpoints.Partitions{ RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-iso-east-1", + }: endpoints.Endpoint{ + Hostname: "swf-fips.us-iso-east-1.c2s.ic.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-iso-east-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-iso-west-1", + }: endpoints.Endpoint{ + Hostname: "swf-fips.us-iso-west-1.c2s.ic.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-iso-west-1", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "us-iso-east-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-iso-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "swf-fips.us-iso-east-1.c2s.ic.gov", + }, endpoints.EndpointKey{ Region: "us-iso-west-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-iso-west-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "swf-fips.us-iso-west-1.c2s.ic.gov", + }, }, }, { @@ -384,9 +444,24 @@ var defaultPartitions = endpoints.Partitions{ RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-isob-east-1", + }: endpoints.Endpoint{ + Hostname: "swf-fips.us-isob-east-1.sc2s.sgov.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-isob-east-1", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "us-isob-east-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-isob-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "swf-fips.us-isob-east-1.sc2s.sgov.gov", + }, }, }, {