listSecurityPolicies method

Future<ListSecurityPoliciesResponse> listSecurityPolicies({
  1. required SecurityPolicyType type,
  2. int? maxResults,
  3. String? nextToken,
  4. List<String>? resource,
})

Returns information about configured OpenSearch Serverless security policies.

May throw InternalServerException. May throw ValidationException.

Parameter type : The type of policy.

Parameter maxResults : An optional parameter that specifies the maximum number of results to return. You can use nextToken to get the next page of results. The default is 20.

Parameter nextToken : If your initial ListSecurityPolicies operation returns a nextToken, you can include the returned nextToken in subsequent ListSecurityPolicies operations, which returns results in the next page.

Parameter resource : Resource filters (can be collection or indexes) that policies can apply to.

Implementation

Future<ListSecurityPoliciesResponse> listSecurityPolicies({
  required SecurityPolicyType type,
  int? maxResults,
  String? nextToken,
  List<String>? resource,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.ListSecurityPolicies'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'type': type.value,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (resource != null) 'resource': resource,
    },
  );

  return ListSecurityPoliciesResponse.fromJson(jsonResponse.body);
}