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

package arcregionswitch

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

// Updates an in-progress plan execution. This operation allows you to modify
// certain aspects of the execution, such as adding a comment or changing the
// action.
func (c *Client) UpdatePlanExecution(ctx context.Context, params *UpdatePlanExecutionInput, optFns ...func(*Options)) (*UpdatePlanExecutionOutput, error) {
	if params == nil {
		params = &UpdatePlanExecutionInput{}
	}

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

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

type UpdatePlanExecutionInput struct {

	// The action specified for a plan execution, for example, Switch to Graceful or
	// Pause.
	//
	// This member is required.
	Action types.UpdatePlanExecutionAction

	// The execution identifier of a plan execution.
	//
	// This member is required.
	ExecutionId *string

	// The Amazon Resource Name (ARN) of the plan with the execution to update.
	//
	// This member is required.
	PlanArn *string

	// An optional comment about the plan execution.
	Comment *string

	noSmithyDocumentSerde
}

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdatePlanExecutionMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&smithyRpcv2cbor_serializeOpUpdatePlanExecution{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&smithyRpcv2cbor_deserializeOpUpdatePlanExecution{}, 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 = addOpUpdatePlanExecutionValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "UpdatePlanExecution"), 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
}
