putRegistryPolicy method

Future<PutRegistryPolicyResponse> putRegistryPolicy({
  1. required String policyText,
})

Creates or updates the permissions policy for your registry.

A registry policy is used to specify permissions for another AWS account and is used when configuring cross-account replication. For more information, see Registry permissions in the Amazon Elastic Container Registry User Guide.

May throw ServerException. May throw InvalidParameterException.

Parameter policyText : The JSON policy text to apply to your registry. The policy text follows the same format as IAM policy text. For more information, see Registry permissions in the Amazon Elastic Container Registry User Guide.

Implementation

Future<PutRegistryPolicyResponse> putRegistryPolicy({
  required String policyText,
}) async {
  ArgumentError.checkNotNull(policyText, 'policyText');
  _s.validateStringLength(
    'policyText',
    policyText,
    0,
    10240,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.PutRegistryPolicy'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'policyText': policyText,
    },
  );

  return PutRegistryPolicyResponse.fromJson(jsonResponse.body);
}