getResourcePolicy method

Future<GetResourcePolicyResponse> getResourcePolicy({
  1. String? resourceArn,
})

Retrieves the resource policy document attached to a given resource.

Cross-account use: No. You cannot perform this operation on an CloudHSM resource in a different Amazon Web Services account.

May throw CloudHsmAccessDeniedException. May throw CloudHsmInternalFailureException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmServiceException.

Parameter resourceArn : Amazon Resource Name (ARN) of the resource to which a policy is attached.

Implementation

Future<GetResourcePolicyResponse> getResourcePolicy({
  String? resourceArn,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'BaldrApiService.GetResourcePolicy'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (resourceArn != null) 'ResourceArn': resourceArn,
    },
  );

  return GetResourcePolicyResponse.fromJson(jsonResponse.body);
}