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

package bedrockagentcorecontrol

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

// Retrieves information about a specific gateway target.
func (c *Client) GetGatewayTarget(ctx context.Context, params *GetGatewayTargetInput, optFns ...func(*Options)) (*GetGatewayTargetOutput, error) {
	if params == nil {
		params = &GetGatewayTargetInput{}
	}

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

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

type GetGatewayTargetInput struct {

	// The identifier of the gateway that contains the target.
	//
	// This member is required.
	GatewayIdentifier *string

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

	noSmithyDocumentSerde
}

type GetGatewayTargetOutput struct {

	// The timestamp when the gateway target was created.
	//
	// This member is required.
	CreatedAt *time.Time

	// The credential provider configurations for the gateway target.
	//
	// This member is required.
	CredentialProviderConfigurations []types.CredentialProviderConfiguration

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

	// The name of the gateway target.
	//
	// This member is required.
	Name *string

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

	// The configuration for a gateway target. This structure defines how the gateway
	// connects to and interacts with the target endpoint.
	//
	// This member is required.
	TargetConfiguration types.TargetConfiguration

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

	// The timestamp when the gateway target was last updated.
	//
	// This member is required.
	UpdatedAt *time.Time

	// The description of the gateway target.
	Description *string

	// The last synchronization of the target.
	LastSynchronizedAt *time.Time

	// The metadata configuration for HTTP header and query parameter propagation for
	// the retrieved gateway target.
	MetadataConfiguration *types.MetadataConfiguration

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

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationGetGatewayTargetMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
		return err
	}
	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGatewayTarget{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGatewayTarget{}, middleware.After)
	if err != nil {
		return err
	}
	if err := addProtocolFinalizerMiddlewares(stack, options, "GetGatewayTarget"); err != nil {
		return fmt.Errorf("add protocol finalizers: %v", err)
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addSetLoggerMiddleware(stack, options); err != nil {
		return err
	}
	if err = addClientRequestID(stack); 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 = addRetry(stack, options); err != nil {
		return err
	}
	if err = addRawResponseToMetadata(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = addSpanRetryLoop(stack, options); err != nil {
		return err
	}
	if err = addClientUserAgent(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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
		return err
	}
	if err = addTimeOffsetBuild(stack, c); err != nil {
		return err
	}
	if err = addUserAgentRetryMode(stack, options); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpGetGatewayTargetValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGatewayTarget(options.Region), middleware.Before); err != nil {
		return err
	}
	if err = addRecursionDetection(stack); 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 = addInterceptBeforeRetryLoop(stack, options); err != nil {
		return err
	}
	if err = addInterceptAttempt(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}

func newServiceMetadataMiddleware_opGetGatewayTarget(region string) *awsmiddleware.RegisterServiceMetadata {
	return &awsmiddleware.RegisterServiceMetadata{
		Region:        region,
		ServiceID:     ServiceID,
		OperationName: "GetGatewayTarget",
	}
}
