createImageVersion method
Creates a version of the SageMaker image specified by
ImageName
. The version represents the Amazon Container
Registry (ECR) container image specified by BaseImage
.
May throw ResourceInUse. May throw ResourceLimitExceeded. May throw ResourceNotFound.
Parameter baseImage
:
The registry path of the container image to use as the starting point for
this version. The path is an Amazon Container Registry (ECR) URI in the
following format:
<acct-id>.dkr.ecr.<region>.amazonaws.com/<repo-name
:tag
or @digest
>
Parameter imageName
:
The ImageName
of the Image
to create a version
of.
Parameter clientToken
:
A unique ID. If not specified, the AWS CLI and AWS SDKs, such as the SDK
for Python (Boto3), add a unique value to the call.
Implementation
Future<CreateImageVersionResponse> createImageVersion({
required String baseImage,
required String imageName,
String? clientToken,
}) async {
ArgumentError.checkNotNull(baseImage, 'baseImage');
_s.validateStringLength(
'baseImage',
baseImage,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(imageName, 'imageName');
_s.validateStringLength(
'imageName',
imageName,
1,
63,
isRequired: true,
);
_s.validateStringLength(
'clientToken',
clientToken,
1,
36,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.CreateImageVersion'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'BaseImage': baseImage,
'ImageName': imageName,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
},
);
return CreateImageVersionResponse.fromJson(jsonResponse.body);
}