// Code generated by smithy-go-codegen DO NOT EDIT.

package cloudwatch

import (
	"context"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Enables enrichment and PromQL access for CloudWatch vended metrics for [supported Amazon Web Services resources] in the
// account. Once enabled, metrics that contain a resource identifier dimension (for
// example, EC2 CPUUtilization with an InstanceId dimension) are enriched with
// resource ARN and resource tag labels and become queryable using PromQL.
//
// Before calling this operation, you must enable resource tags on telemetry for
// your account. For more information, see [Enable resource tags on telemetry].
//
// [supported Amazon Web Services resources]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/UsingResourceTagsForTelemetry.html
// [Enable resource tags on telemetry]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/EnableResourceTagsOnTelemetry.html
func (c *Client) StartOTelEnrichment(ctx context.Context, params *StartOTelEnrichmentInput, optFns ...func(*Options)) (*StartOTelEnrichmentOutput, error) {
	if params == nil {
		params = &StartOTelEnrichmentInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "StartOTelEnrichment", params, optFns, c.addOperationStartOTelEnrichmentMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*StartOTelEnrichmentOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type StartOTelEnrichmentInput struct {
	noSmithyDocumentSerde
}

type StartOTelEnrichmentOutput struct {
	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationStartOTelEnrichmentMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&smithyRpcv2cbor_serializeOpStartOTelEnrichment{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&smithyRpcv2cbor_deserializeOpStartOTelEnrichment{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); 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 = addRecordResponseTiming(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 = addUserAgentFeatureProtocolRPCV2CBOR(stack, options); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "StartOTelEnrichment"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
