getPolicyVersion method

Future<GetPolicyVersionResponse> getPolicyVersion({
  1. required String policyArn,
  2. required String versionId,
})

Retrieves information about the specified version of the specified managed policy, including the policy document. To list the available versions for a policy, use ListPolicyVersions.

This API retrieves information about managed policies. To retrieve information about an inline policy that is embedded in a user, group, or role, use the GetUserPolicy, GetGroupPolicy, or GetRolePolicy API.

For more information about the types of policies, see Managed Policies and Inline Policies in the IAM User Guide.

For more information about managed policy versions, see Versioning for Managed Policies in the IAM User Guide.

May throw NoSuchEntityException. May throw InvalidInputException. May throw ServiceFailureException.

Parameter policyArn : The Amazon Resource Name (ARN) of the managed policy that you want information about.

For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Parameter versionId : Identifies the policy version to retrieve.

This parameter allows (through its regex pattern) a string of characters that consists of the lowercase letter 'v' followed by one or two digits, and optionally followed by a period '.' and a string of letters and digits.

Implementation

Future<GetPolicyVersionResponse> getPolicyVersion({
  required String policyArn,
  required String versionId,
}) async {
  ArgumentError.checkNotNull(policyArn, 'policyArn');
  _s.validateStringLength(
    'policyArn',
    policyArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(versionId, 'versionId');
  final $request = <String, dynamic>{};
  $request['PolicyArn'] = policyArn;
  $request['VersionId'] = versionId;
  final $result = await _protocol.send(
    $request,
    action: 'GetPolicyVersion',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['GetPolicyVersionRequest'],
    shapes: shapes,
    resultWrapper: 'GetPolicyVersionResult',
  );
  return GetPolicyVersionResponse.fromXml($result);
}