getResourcePolicies method

Future<GetResourcePoliciesResponse> getResourcePolicies({
  1. required String resourceArn,
  2. int? maxResults,
  3. String? nextToken,
})

Returns an array of the Policy object.

May throw InternalServerError. May throw ResourceNotFoundException. May throw ResourcePolicyInvalidParameterException.

Parameter resourceArn : Amazon Resource Name (ARN) of the resource to which the policies are attached.

Parameter maxResults : The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

Parameter nextToken : A token to start the list. Use this token to get the next set of results.

Implementation

Future<GetResourcePoliciesResponse> getResourcePolicies({
  required String resourceArn,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.GetResourcePolicies'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceArn': resourceArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetResourcePoliciesResponse.fromJson(jsonResponse.body);
}