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

package bedrockagentcorecontrol

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

// Deletes a gateway target.
//
// You cannot delete a target that is in a pending authorization state (
// CREATE_PENDING_AUTH , UPDATE_PENDING_AUTH , or SYNCHRONIZE_PENDING_AUTH ). Wait
// for the authorization to complete or fail before deleting the target.
func (c *Client) DeleteGatewayTarget(ctx context.Context, params *DeleteGatewayTargetInput, optFns ...func(*Options)) (*DeleteGatewayTargetOutput, error) {
	if params == nil {
		params = &DeleteGatewayTargetInput{}
	}

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

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

type DeleteGatewayTargetInput struct {

	// The unique identifier of the gateway associated with the target.
	//
	// This member is required.
	GatewayIdentifier *string

	// The unique identifier of the gateway target to delete.
	//
	// This member is required.
	TargetId *string

	noSmithyDocumentSerde
}

type DeleteGatewayTargetOutput struct {

	// The Amazon Resource Name (ARN) of the gateway.
	//
	// This member is required.
	GatewayArn *string

	// The current status of the gateway target deletion.
	//
	// This member is required.
	Status types.TargetStatus

	// The unique identifier of the deleted gateway target.
	//
	// This member is required.
	TargetId *string

	// The reasons for the current status of the gateway target deletion.
	StatusReasons []string

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

	noSmithyDocumentSerde
}

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