createImage method

Future<CreateImageResponse> createImage({
  1. required String imageName,
  2. required String roleArn,
  3. String? description,
  4. String? displayName,
  5. List<Tag>? tags,
})

Creates a custom SageMaker image. A SageMaker image is a set of image versions. Each image version represents a container image stored in Amazon Container Registry (ECR). For more information, see Bring your own SageMaker image.

May throw ResourceInUse. May throw ResourceLimitExceeded.

Parameter imageName : The name of the image. Must be unique to your account.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf.

Parameter description : The description of the image.

Parameter displayName : The display name of the image. If not provided, ImageName is displayed.

Parameter tags : A list of tags to apply to the image.

Implementation

Future<CreateImageResponse> createImage({
  required String imageName,
  required String roleArn,
  String? description,
  String? displayName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(imageName, 'imageName');
  _s.validateStringLength(
    'imageName',
    imageName,
    1,
    63,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    512,
  );
  _s.validateStringLength(
    'displayName',
    displayName,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateImage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ImageName': imageName,
      'RoleArn': roleArn,
      if (description != null) 'Description': description,
      if (displayName != null) 'DisplayName': displayName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateImageResponse.fromJson(jsonResponse.body);
}