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

package bedrockagentcore

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

// Generates authentication tokens for payment providers that use vendor-specific
// authentication mechanisms.
func (c *Client) GetResourcePaymentToken(ctx context.Context, params *GetResourcePaymentTokenInput, optFns ...func(*Options)) (*GetResourcePaymentTokenOutput, error) {
	if params == nil {
		params = &GetResourcePaymentTokenInput{}
	}

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

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

type GetResourcePaymentTokenInput struct {

	// Vendor-specific token request input. Contains all request parameters in a
	// type-safe, vendor-specific structure.
	//
	// This member is required.
	PaymentTokenRequest types.PaymentTokenRequestInput

	// Name of the payment credential provider to use.
	//
	// This member is required.
	ResourceCredentialProviderName *string

	// Workload access token for authorization.
	//
	// This member is required.
	WorkloadIdentityToken *string

	noSmithyDocumentSerde
}

type GetResourcePaymentTokenOutput struct {

	// Vendor-specific token response output. Contains all response data in a
	// type-safe, vendor-specific structure.
	//
	// This member is required.
	PaymentTokenResponse types.PaymentTokenResponseOutput

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

	noSmithyDocumentSerde
}

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