// 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"
	"time"
)

// Submits a registry record for approval. This transitions the record from DRAFT
// status to PENDING_APPROVAL status. If the registry has auto-approval enabled,
// the record is automatically approved.
func (c *Client) SubmitRegistryRecordForApproval(ctx context.Context, params *SubmitRegistryRecordForApprovalInput, optFns ...func(*Options)) (*SubmitRegistryRecordForApprovalOutput, error) {
	if params == nil {
		params = &SubmitRegistryRecordForApprovalInput{}
	}

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

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

type SubmitRegistryRecordForApprovalInput struct {

	// The identifier of the registry record to submit for approval. You can specify
	// either the Amazon Resource Name (ARN) or the ID of the record.
	//
	// This member is required.
	RecordId *string

	// The identifier of the registry containing the record. You can specify either
	// the Amazon Resource Name (ARN) or the ID of the registry.
	//
	// This member is required.
	RegistryId *string

	noSmithyDocumentSerde
}

type SubmitRegistryRecordForApprovalOutput struct {

	// The Amazon Resource Name (ARN) of the registry record.
	//
	// This member is required.
	RecordArn *string

	// The unique identifier of the registry record.
	//
	// This member is required.
	RecordId *string

	// The Amazon Resource Name (ARN) of the registry that contains the record.
	//
	// This member is required.
	RegistryArn *string

	// The resulting status of the registry record after submission.
	//
	// This member is required.
	Status types.RegistryRecordStatus

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

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

	noSmithyDocumentSerde
}

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