putImage method

Future<PutImageResponse> putImage({
  1. required String imageManifest,
  2. required String repositoryName,
  3. String? imageDigest,
  4. String? imageManifestMediaType,
  5. String? imageTag,
  6. String? registryId,
})

Creates or updates the image manifest and tags associated with an image.

When an image is pushed and all new image layers have been uploaded, the PutImage API is called once to create or update the image manifest and the tags associated with the image.

May throw ImageAlreadyExistsException. May throw ImageDigestDoesNotMatchException. May throw ImageTagAlreadyExistsException. May throw InvalidParameterException. May throw KmsException. May throw LayersNotFoundException. May throw LimitExceededException. May throw ReferencedImagesNotFoundException. May throw RepositoryNotFoundException. May throw ServerException.

Parameter imageManifest : The image manifest corresponding to the image to be uploaded.

Parameter repositoryName : The name of the repository in which to put the image.

Parameter imageDigest : The image digest of the image manifest corresponding to the image.

Parameter imageManifestMediaType : The media type of the image manifest. If you push an image manifest that does not contain the mediaType field, you must specify the imageManifestMediaType in the request.

Parameter imageTag : The tag to associate with the image. This parameter is optional.

Parameter registryId : The Amazon Web Services account ID associated with the registry that contains the repository in which to put the image. If you do not specify a registry, the default registry is assumed.

Implementation

Future<PutImageResponse> putImage({
  required String imageManifest,
  required String repositoryName,
  String? imageDigest,
  String? imageManifestMediaType,
  String? imageTag,
  String? registryId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.PutImage'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'imageManifest': imageManifest,
      'repositoryName': repositoryName,
      if (imageDigest != null) 'imageDigest': imageDigest,
      if (imageManifestMediaType != null)
        'imageManifestMediaType': imageManifestMediaType,
      if (imageTag != null) 'imageTag': imageTag,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return PutImageResponse.fromJson(jsonResponse.body);
}