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

// Updates an existing registry record. This operation uses PATCH semantics, so
// you only need to specify the fields you want to change. The update is processed
// asynchronously and returns HTTP 202 Accepted.
func (c *Client) UpdateRegistryRecord(ctx context.Context, params *UpdateRegistryRecordInput, optFns ...func(*Options)) (*UpdateRegistryRecordOutput, error) {
	if params == nil {
		params = &UpdateRegistryRecordInput{}
	}

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

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

type UpdateRegistryRecordInput struct {

	// The identifier of the registry record to update. 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

	// The updated description for the registry record. To clear the description,
	// include the UpdatedDescription wrapper with optionalValue not specified.
	Description *types.UpdatedDescription

	// The updated descriptor type for the registry record. Changing the descriptor
	// type may require updating the descriptors field to match the new type's schema
	// requirements.
	DescriptorType types.DescriptorType

	// The updated descriptor-type-specific configuration containing the resource
	// schema and metadata. Uses PATCH semantics where individual descriptor fields can
	// be updated independently.
	Descriptors *types.UpdatedDescriptors

	// The updated name for the registry record.
	Name *string

	// The version of the registry record for optimistic locking. If provided, it must
	// match the current version of the record. The service automatically increments
	// the version after a successful update.
	RecordVersion *string

	// The updated synchronization configuration for the registry record.
	SynchronizationConfiguration *types.UpdatedSynchronizationConfiguration

	// The updated synchronization type for the registry record.
	SynchronizationType *types.UpdatedSynchronizationType

	// Whether to trigger synchronization using the stored or provided configuration.
	// When set to true , the service will synchronize the record metadata from the
	// configured external source.
	TriggerSynchronization *bool

	noSmithyDocumentSerde
}

type UpdateRegistryRecordOutput struct {

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

	// The descriptor type of the updated registry record. Possible values are MCP ,
	// A2A , CUSTOM , and AGENT_SKILLS .
	//
	// This member is required.
	DescriptorType types.DescriptorType

	// The descriptor-type-specific configuration of the updated registry record. For
	// details, see the Descriptors data type.
	//
	// This member is required.
	Descriptors *types.Descriptors

	// The name of the updated registry record.
	//
	// This member is required.
	Name *string

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

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

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

	// The current status of the updated registry record. Possible values include
	// CREATING , DRAFT , APPROVED , PENDING_APPROVAL , REJECTED , DEPRECATED ,
	// UPDATING , CREATE_FAILED , and UPDATE_FAILED .
	//
	// This member is required.
	Status types.RegistryRecordStatus

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

	// The description of the updated registry record.
	Description *string

	// The version of the updated registry record.
	RecordVersion *string

	// The reason for the current status of the updated registry record.
	StatusReason *string

	// The synchronization configuration of the updated registry record.
	SynchronizationConfiguration *types.SynchronizationConfiguration

	// The synchronization type of the updated registry record.
	SynchronizationType types.SynchronizationType

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

	noSmithyDocumentSerde
}

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