putRepositoryPermissionsPolicy method

Future<PutRepositoryPermissionsPolicyResult> putRepositoryPermissionsPolicy({
  1. required String domain,
  2. required String policyDocument,
  3. required String repository,
  4. String? domainOwner,
  5. String? policyRevision,
})

Sets the resource policy on a repository that specifies permissions to access it.

When you call PutRepositoryPermissionsPolicy, the resource policy on the repository is ignored when evaluting permissions. This ensures that the owner of a repository cannot lock themselves out of the repository, which would prevent them from being able to update the resource policy.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter domain : The name of the domain containing the repository to set the resource policy on.

Parameter policyDocument : A valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided repository.

Parameter repository : The name of the repository to set the resource policy on.

Parameter domainOwner : The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

Parameter policyRevision : Sets the revision of the resource policy that specifies permissions to access the repository. This revision is used for optimistic locking, which prevents others from overwriting your changes to the repository's resource policy.

Implementation

Future<PutRepositoryPermissionsPolicyResult> putRepositoryPermissionsPolicy({
  required String domain,
  required String policyDocument,
  required String repository,
  String? domainOwner,
  String? policyRevision,
}) async {
  final $query = <String, List<String>>{
    'domain': [domain],
    'repository': [repository],
    if (domainOwner != null) 'domain-owner': [domainOwner],
  };
  final $payload = <String, dynamic>{
    'policyDocument': policyDocument,
    if (policyRevision != null) 'policyRevision': policyRevision,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v1/repository/permissions/policy',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return PutRepositoryPermissionsPolicyResult.fromJson(response);
}