putPolicy method

Future<PutPolicyOutput> putPolicy({
  1. required String arn,
  2. required String policy,
  3. String? token,
})

Updates the resource-based policy.

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

Parameter arn : The Amazon Resource Name (ARN) of the resource for which the policy needs to be updated.

Parameter policy : The resource-based policy.

Parameter token : A unique identifier for the current revision of the policy.

Implementation

Future<PutPolicyOutput> putPolicy({
  required String arn,
  required String policy,
  String? token,
}) async {
  final $payload = <String, dynamic>{
    'policy': policy,
    if (token != null) 'token': token,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/policies/${Uri.encodeComponent(arn)}',
    exceptionFnMap: _exceptionFns,
  );
  return PutPolicyOutput.fromJson(response);
}