createModelCopyJob method
Copies a model to another region so that it can be used there. For more information, see Copy models to be used in other regions in the Amazon Bedrock User Guide.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw TooManyTagsException.
Parameter sourceModelArn :
The Amazon Resource Name (ARN) of the model to be copied.
Parameter targetModelName :
A name for the copied model.
Parameter clientRequestToken :
A unique, case-sensitive identifier to ensure that the API request
completes no more than one time. If this token matches a previous request,
Amazon Bedrock ignores the request, but does not return an error. For more
information, see Ensuring
idempotency.
Parameter modelKmsKeyId :
The ARN of the KMS key that you use to encrypt the model copy.
Parameter targetModelTags :
Tags to associate with the target model. For more information, see Tag
resources in the Amazon
Bedrock User Guide.
Implementation
Future<CreateModelCopyJobResponse> createModelCopyJob({
required String sourceModelArn,
required String targetModelName,
String? clientRequestToken,
String? modelKmsKeyId,
List<Tag>? targetModelTags,
}) async {
final $payload = <String, dynamic>{
'sourceModelArn': sourceModelArn,
'targetModelName': targetModelName,
'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
if (modelKmsKeyId != null) 'modelKmsKeyId': modelKmsKeyId,
if (targetModelTags != null) 'targetModelTags': targetModelTags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/model-copy-jobs',
exceptionFnMap: _exceptionFns,
);
return CreateModelCopyJobResponse.fromJson(response);
}