putImageTagMutability method

Future<PutImageTagMutabilityResponse> putImageTagMutability({
  1. required ImageTagMutability imageTagMutability,
  2. required String repositoryName,
  3. String? registryId,
})

Updates the image tag mutability settings for the specified repository. For more information, see Image Tag Mutability in the Amazon Elastic Container Registry User Guide.

May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException.

Parameter imageTagMutability : The tag mutability setting for the repository. If MUTABLE is specified, image tags can be overwritten. If IMMUTABLE is specified, all image tags within the repository will be immutable which will prevent them from being overwritten.

Parameter repositoryName : The name of the repository in which to update the image tag mutability settings.

Parameter registryId : The AWS account ID associated with the registry that contains the repository in which to update the image tag mutability settings. If you do not specify a registry, the default registry is assumed.

Implementation

Future<PutImageTagMutabilityResponse> putImageTagMutability({
  required ImageTagMutability imageTagMutability,
  required String repositoryName,
  String? registryId,
}) async {
  ArgumentError.checkNotNull(imageTagMutability, 'imageTagMutability');
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    2,
    256,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AmazonEC2ContainerRegistry_V20150921.PutImageTagMutability'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'imageTagMutability': imageTagMutability.toValue(),
      'repositoryName': repositoryName,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return PutImageTagMutabilityResponse.fromJson(jsonResponse.body);
}