getAccessPolicy method

Future<GetAccessPolicyResponse> getAccessPolicy({
  1. required String name,
  2. required AccessPolicyType type,
})

Returns an OpenSearch Serverless access policy. For more information, see Data access control for Amazon OpenSearch Serverless.

May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter name : The name of the access policy.

Parameter type : Tye type of policy. Currently, the only supported value is data.

Implementation

Future<GetAccessPolicyResponse> getAccessPolicy({
  required String name,
  required AccessPolicyType type,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.GetAccessPolicy'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'type': type.value,
    },
  );

  return GetAccessPolicyResponse.fromJson(jsonResponse.body);
}