getGeneratedPolicy method
Retrieves the policy that was generated using
StartPolicyGeneration.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter jobId :
The JobId that is returned by the
StartPolicyGeneration operation. The JobId can
be used with GetGeneratedPolicy to retrieve the generated
policies or used with CancelPolicyGeneration to cancel the
policy generation request.
Parameter includeResourcePlaceholders :
The level of detail that you want to generate. You can specify whether to
generate policies with placeholders for resource ARNs for actions that
support resource level granularity in policies.
For example, in the resource section of a policy, you can receive a
placeholder such as "Resource":"arn:aws:s3:::${BucketName}"
instead of "*".
Parameter includeServiceLevelTemplate :
The level of detail that you want to generate. You can specify whether to
generate service-level policies.
IAM Access Analyzer uses iam:servicelastaccessed to identify
services that have been used recently to create this service-level
template.
Implementation
Future<GetGeneratedPolicyResponse> getGeneratedPolicy({
required String jobId,
bool? includeResourcePlaceholders,
bool? includeServiceLevelTemplate,
}) async {
final $query = <String, List<String>>{
if (includeResourcePlaceholders != null)
'includeResourcePlaceholders': [includeResourcePlaceholders.toString()],
if (includeServiceLevelTemplate != null)
'includeServiceLevelTemplate': [includeServiceLevelTemplate.toString()],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/policy/generation/${Uri.encodeComponent(jobId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetGeneratedPolicyResponse.fromJson(response);
}