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

package applicationsignals

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/applicationsignals/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Reports the status of one or more instrumentation configurations from SDK
// instances. Use this to record when configurations become ready, hit errors,
// become active, or are disabled by limits.
//
// Report READY , ERROR , and DISABLED when the status changes. Report ACTIVE
// periodically (for example, every minute) while instrumentation is running.
func (c *Client) ReportInstrumentationConfigurationStatus(ctx context.Context, params *ReportInstrumentationConfigurationStatusInput, optFns ...func(*Options)) (*ReportInstrumentationConfigurationStatusOutput, error) {
	if params == nil {
		params = &ReportInstrumentationConfigurationStatusInput{}
	}

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

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

type ReportInstrumentationConfigurationStatusInput struct {

	// An array of configuration status reports (up to 100) that include the
	// instrumentation type, signal type, location hash, status, timestamp, and
	// optional error cause.
	//
	// This member is required.
	Configurations []types.InstrumentationConfigurationStatusReport

	// The environment that the service is running in.
	//
	// This member is required.
	Environment *string

	// The service that the reported configurations belong to.
	//
	// This member is required.
	Service *string

	noSmithyDocumentSerde
}

type ReportInstrumentationConfigurationStatusOutput struct {

	// The environment echoed from the request.
	//
	// This member is required.
	Environment *string

	// The service name echoed from the request.
	//
	// This member is required.
	Service *string

	// Status events that failed to be processed. Each entry includes the
	// configuration identifiers, status, timestamp, and a reason for the failure.
	//
	// This member is required.
	UnprocessedStatusEvents []types.UnprocessedStatusEvent

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationReportInstrumentationConfigurationStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpReportInstrumentationConfigurationStatus{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpReportInstrumentationConfigurationStatus{}, 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 = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpReportInstrumentationConfigurationStatusValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "ReportInstrumentationConfigurationStatus"), 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
}
