getLifecyclePolicies method

Future<GetLifecyclePoliciesResponse> getLifecyclePolicies({
  1. DefaultPoliciesTypeValues? defaultPolicyType,
  2. List<String>? policyIds,
  3. List<ResourceTypeValues>? resourceTypes,
  4. GettablePolicyStateValues? state,
  5. List<String>? tagsToAdd,
  6. List<String>? targetTags,
})

Gets summary information about all or the specified data lifecycle policies.

To get complete information about a policy, use GetLifecyclePolicy.

May throw InternalServerException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException.

Parameter defaultPolicyType : [Default policies only] Specifies the type of default policy to get. Specify one of the following:

  • VOLUME - To get only the default policy for EBS snapshots
  • INSTANCE - To get only the default policy for EBS-backed AMIs
  • ALL - To get all default policies

Parameter policyIds : The identifiers of the data lifecycle policies.

Parameter resourceTypes : The resource type.

Parameter state : The activation state.

Parameter tagsToAdd : The tags to add to objects created by the policy.

Tags are strings in the format key=value.

These user-defined tags are added in addition to the Amazon Web Services-added lifecycle tags.

Parameter targetTags : The target tag for a policy.

Tags are strings in the format key=value.

Implementation

Future<GetLifecyclePoliciesResponse> getLifecyclePolicies({
  DefaultPoliciesTypeValues? defaultPolicyType,
  List<String>? policyIds,
  List<ResourceTypeValues>? resourceTypes,
  GettablePolicyStateValues? state,
  List<String>? tagsToAdd,
  List<String>? targetTags,
}) async {
  final $query = <String, List<String>>{
    if (defaultPolicyType != null)
      'defaultPolicyType': [defaultPolicyType.value],
    if (policyIds != null) 'policyIds': policyIds,
    if (resourceTypes != null)
      'resourceTypes': resourceTypes.map((e) => e.value).toList(),
    if (state != null) 'state': [state.value],
    if (tagsToAdd != null) 'tagsToAdd': tagsToAdd,
    if (targetTags != null) 'targetTags': targetTags,
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/policies',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetLifecyclePoliciesResponse.fromJson(response);
}