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 that are 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 that are associated with the image.

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

Parameter imageManifest : The image manifest that corresponds to the image to be uploaded.

Parameter repositoryName : The name of the repository where the image is put.

Parameter imageDigest : The image digest of the image manifest that corresponds to the image.

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

Parameter imageTag : The tag to associate with the image. This parameter is required for images that use the Docker Image Manifest V2 Schema 2 or Open Container Initiative (OCI) formats.

Parameter registryId : The Amazon Web Services account ID, or registry alias, that's associated with the public registry that contains the repository where the image is put. If you do not specify a registry, the default public 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': 'SpencerFrontendService.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);
}