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

package outposts

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

// Starts the decommission process to return the Outposts racks or servers.
func (c *Client) StartOutpostDecommission(ctx context.Context, params *StartOutpostDecommissionInput, optFns ...func(*Options)) (*StartOutpostDecommissionOutput, error) {
	if params == nil {
		params = &StartOutpostDecommissionInput{}
	}

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

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

type StartOutpostDecommissionInput struct {

	// The ID or ARN of the Outpost that you want to decommission.
	//
	// This member is required.
	OutpostIdentifier *string

	// Validates the request without starting the decommission process.
	ValidateOnly bool

	noSmithyDocumentSerde
}

type StartOutpostDecommissionOutput struct {

	// The resources still associated with the Outpost that you are decommissioning.
	BlockingResourceTypes []types.BlockingResourceType

	// The status of the decommission request.
	Status types.DecommissionRequestStatus

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

	noSmithyDocumentSerde
}

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