AccessAnalyzer / Client / start_policy_generation

start_policy_generation#

AccessAnalyzer.Client.start_policy_generation(**kwargs)#

Starts the policy generation request.

See also: AWS API Documentation

Request Syntax

response = client.start_policy_generation(
    policyGenerationDetails={
        'principalArn': 'string'
    },
    cloudTrailDetails={
        'trails': [
            {
                'cloudTrailArn': 'string',
                'regions': [
                    'string',
                ],
                'allRegions': True|False
            },
        ],
        'accessRole': 'string',
        'startTime': datetime(2015, 1, 1),
        'endTime': datetime(2015, 1, 1)
    },
    clientToken='string'
)
Parameters:
  • policyGenerationDetails (dict) –

    [REQUIRED]

    Contains the ARN of the IAM entity (user or role) for which you are generating a policy.

    • principalArn (string) – [REQUIRED]

      The ARN of the IAM entity (user or role) for which you are generating a policy.

  • cloudTrailDetails (dict) –

    A CloudTrailDetails object that contains details about a Trail that you want to analyze to generate policies.

    • trails (list) – [REQUIRED]

      A Trail object that contains settings for a trail.

      • (dict) –

        Contains details about the CloudTrail trail being analyzed to generate a policy.

        • cloudTrailArn (string) – [REQUIRED]

          Specifies the ARN of the trail. The format of a trail ARN is arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail.

        • regions (list) –

          A list of regions to get CloudTrail data from and analyze to generate a policy.

          • (string) –

        • allRegions (boolean) –

          Possible values are true or false. If set to true, IAM Access Analyzer retrieves CloudTrail data from all regions to analyze and generate a policy.

    • accessRole (string) – [REQUIRED]

      The ARN of the service role that IAM Access Analyzer uses to access your CloudTrail trail and service last accessed information.

    • startTime (datetime) – [REQUIRED]

      The start of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp before this time are not considered to generate a policy.

    • endTime (datetime) –

      The end of the time range for which IAM Access Analyzer reviews your CloudTrail events. Events with a timestamp after this time are not considered to generate a policy. If this is not included in the request, the default value is the current time.

  • clientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.

    If you do not specify a client token, one is automatically generated by the Amazon Web Services SDK.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'jobId': 'string'
}

Response Structure

  • (dict) –

    • jobId (string) –

      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.

Exceptions