putResourcePolicy method

Future<PutResourcePolicyResponse> putResourcePolicy({
  1. required String policy,
  2. required String resourceArn,
})

Attaches a resource-based policy to an OpenSearch Ingestion resource. Resource-based policies grant permissions to principals to perform actions on the resource.

May throw AccessDeniedException. May throw DisabledOperationException. May throw InternalException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter policy : The resource-based policy document in JSON format.

Parameter resourceArn : The Amazon Resource Name (ARN) of the resource to attach the policy to.

Implementation

Future<PutResourcePolicyResponse> putResourcePolicy({
  required String policy,
  required String resourceArn,
}) async {
  final $payload = <String, dynamic>{
    'Policy': policy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/2022-01-01/osis/resourcePolicy/${Uri.encodeComponent(resourceArn)}',
    exceptionFnMap: _exceptionFns,
  );
  return PutResourcePolicyResponse.fromJson(response);
}