listLifecyclePolicies method
Returns a list of OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.
May throw InternalServerException.
May throw ValidationException.
Parameter type :
The type of lifecycle policy.
Parameter maxResults :
An optional parameter that specifies the maximum number of results to
return. You can use use nextToken to get the next page of
results. The default is 10.
Parameter nextToken :
If your initial ListLifecyclePolicies operation returns a
nextToken, you can include the returned
nextToken in subsequent ListLifecyclePolicies
operations, which returns results in the next page.
Parameter resources :
Resource filters that policies can apply to. Currently, the only supported
resource type is index.
Implementation
Future<ListLifecyclePoliciesResponse> listLifecyclePolicies({
required LifecyclePolicyType type,
int? maxResults,
String? nextToken,
List<String>? resources,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'OpenSearchServerless.ListLifecyclePolicies'
};
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 (resources != null) 'resources': resources,
},
);
return ListLifecyclePoliciesResponse.fromJson(jsonResponse.body);
}