putResourcePolicy method

Future<PutResourcePolicyResponse> putResourcePolicy({
  1. required Object policy,
  2. String? registryName,
  3. String? revisionId,
})

The name of the policy.

May throw BadRequestException. May throw UnauthorizedException. May throw PreconditionFailedException. May throw InternalServerErrorException. May throw ForbiddenException. May throw NotFoundException. May throw ServiceUnavailableException.

Parameter policy : The resource-based policy.

Parameter registryName : The name of the registry.

Parameter revisionId : The revision ID of the policy.

Implementation

Future<PutResourcePolicyResponse> putResourcePolicy({
  required Object policy,
  String? registryName,
  String? revisionId,
}) async {
  ArgumentError.checkNotNull(policy, 'policy');
  final $query = <String, List<String>>{
    if (registryName != null) 'registryName': [registryName],
  };
  final $payload = <String, dynamic>{
    'Policy': jsonEncode(policy),
    if (revisionId != null) 'RevisionId': revisionId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v1/policy',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return PutResourcePolicyResponse.fromJson(response);
}