Access Analyzer

2019/12/02 - Access Analyzer - 18 new api methods

Changes  Update accessanalyzer client to latest version

ListArchiveRules (new) Link ¶

Retrieves a list of archive rules created for the specified analyzer.

See also: AWS API Documentation

Request Syntax

client.list_archive_rules(
    analyzerName='string',
    maxResults=123,
    nextToken='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer to retrieve rules from.

type maxResults:

integer

param maxResults:

The maximum number of results to return in the request.

type nextToken:

string

param nextToken:

A token used for pagination of results returned.

rtype:

dict

returns:

Response Syntax

{
    'archiveRules': [
        {
            'createdAt': datetime(2015, 1, 1),
            'filter': {
                'string': {
                    'contains': [
                        'string',
                    ],
                    'eq': [
                        'string',
                    ],
                    'exists': True|False,
                    'neq': [
                        'string',
                    ]
                }
            },
            'ruleName': 'string',
            'updatedAt': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The response to the request.

    • archiveRules (list) --

      A list of archive rules created for the specified analyzer.

      • (dict) --

        Contains information about an archive rule.

        • createdAt (datetime) --

          The time at which the archive rule was created.

        • filter (dict) --

          A filter used to define the archive rule.

          • (string) --

            • (dict) --

              The criteria to use in the filter that defines the rule.

              • contains (list) --

                A "contains" operator to match for the filter used to create the rule.

                • (string) --

              • eq (list) --

                An "equals" operator to match for the filter used to create the rule.

                • (string) --

              • exists (boolean) --

                An "exists" operator to match for the filter used to create the rule.

              • neq (list) --

                A "not equals" operator to match for the filter used to create the rule.

                • (string) --

        • ruleName (string) --

          The name of the archive rule.

        • updatedAt (datetime) --

          The time at which the archive rule was last updated.

    • nextToken (string) --

      A token used for pagination of results returned.

GetAnalyzedResource (new) Link ¶

Retrieves information about an analyzed resource.

See also: AWS API Documentation

Request Syntax

client.get_analyzed_resource(
    analyzerArn='string',
    resourceArn='string'
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer to retrieve information from.

type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the resource to retrieve information about.

rtype:

dict

returns:

Response Syntax

{
    'resource': {
        'actions': [
            'string',
        ],
        'analyzedAt': datetime(2015, 1, 1),
        'createdAt': datetime(2015, 1, 1),
        'error': 'string',
        'isPublic': True|False,
        'resourceArn': 'string',
        'resourceType': 'AWS::IAM::Role'|'AWS::KMS::Key'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::S3::Bucket'|'AWS::SQS::Queue',
        'sharedVia': [
            'string',
        ],
        'status': 'ACTIVE'|'ARCHIVED'|'RESOLVED',
        'updatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    The response to the request.

    • resource (dict) --

      An AnalyedResource object that contains information that Access Analyzer found when it analyzed the resource.

      • actions (list) --

        The actions that an external principal is granted permission to use by the policy that generated the finding.

        • (string) --

      • analyzedAt (datetime) --

        The time at which the resource was analyzed.

      • createdAt (datetime) --

        The time at which the finding was created.

      • error (string) --

        An error message.

      • isPublic (boolean) --

        Indicates whether the policy that generated the finding grants public access to the resource.

      • resourceArn (string) --

        The ARN of the resource that was analyzed.

      • resourceType (string) --

        The type of the resource that was analyzed.

      • sharedVia (list) --

        Indicates how the access that generated the finding is granted.

        • (string) --

      • status (string) --

        The current status of the finding generated from the analyzed resource.

      • updatedAt (datetime) --

        The time at which the finding was updated.

StartResourceScan (new) Link ¶

Starts a scan of the policies applied to the specified resource.

See also: AWS API Documentation

Request Syntax

client.start_resource_scan(
    analyzerArn='string',
    resourceArn='string'
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer to use to scan the policies applied to the specified resource.

type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the resource to scan.

returns:

None

TagResource (new) Link ¶

Adds a tag to the specified resource.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceArn='string',
    tags={
        'string': 'string'
    }
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the resource to add the tag to.

type tags:

dict

param tags:

[REQUIRED]

The tags to add to the resource.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

    The response to the request.

DeleteAnalyzer (new) Link ¶

Deletes the specified analyzer. When you delete an analyzer, Access Analyzer is disabled for the account in the current or specific Region. All findings that were generated by the analyzer are deleted. You cannot undo this action.

See also: AWS API Documentation

Request Syntax

client.delete_analyzer(
    analyzerName='string',
    clientToken='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer to delete.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

returns:

None

CreateAnalyzer (new) Link ¶

Creates an analyzer with a zone of trust set to your account.

See also: AWS API Documentation

Request Syntax

client.create_analyzer(
    analyzerName='string',
    archiveRules=[
        {
            'filter': {
                'string': {
                    'contains': [
                        'string',
                    ],
                    'eq': [
                        'string',
                    ],
                    'exists': True|False,
                    'neq': [
                        'string',
                    ]
                }
            },
            'ruleName': 'string'
        },
    ],
    clientToken='string',
    tags={
        'string': 'string'
    },
    type='ACCOUNT'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer to create.

type archiveRules:

list

param archiveRules:

Specifies the archive rules to add for the analyzer.

  • (dict) --

    An inline archive rule.

    • filter (dict) -- [REQUIRED]

      The criteria for the rule.

      • (string) --

        • (dict) --

          The criteria to use in the filter that defines the rule.

          • contains (list) --

            A "contains" operator to match for the filter used to create the rule.

            • (string) --

          • eq (list) --

            An "equals" operator to match for the filter used to create the rule.

            • (string) --

          • exists (boolean) --

            An "exists" operator to match for the filter used to create the rule.

          • neq (list) --

            A "not equals" operator to match for the filter used to create the rule.

            • (string) --

    • ruleName (string) -- [REQUIRED]

      The name of the rule.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

type tags:

dict

param tags:

The tags to apply to the analyzer.

  • (string) --

    • (string) --

type type:

string

param type:

[REQUIRED]

The zone of trust for the analyzer. You can create only one analyzer per account per Region.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string'
}

Response Structure

  • (dict) --

    The response to the request to create an analyzer.

    • arn (string) --

      The ARN of the analyzer that was created by the request.

GetArchiveRule (new) Link ¶

Retrieves information about an archive rule.

See also: AWS API Documentation

Request Syntax

client.get_archive_rule(
    analyzerName='string',
    ruleName='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer to retrieve rules from.

type ruleName:

string

param ruleName:

[REQUIRED]

The name of the rule to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'archiveRule': {
        'createdAt': datetime(2015, 1, 1),
        'filter': {
            'string': {
                'contains': [
                    'string',
                ],
                'eq': [
                    'string',
                ],
                'exists': True|False,
                'neq': [
                    'string',
                ]
            }
        },
        'ruleName': 'string',
        'updatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    The response to the request.

    • archiveRule (dict) --

      Contains information about an archive rule.

      • createdAt (datetime) --

        The time at which the archive rule was created.

      • filter (dict) --

        A filter used to define the archive rule.

        • (string) --

          • (dict) --

            The criteria to use in the filter that defines the rule.

            • contains (list) --

              A "contains" operator to match for the filter used to create the rule.

              • (string) --

            • eq (list) --

              An "equals" operator to match for the filter used to create the rule.

              • (string) --

            • exists (boolean) --

              An "exists" operator to match for the filter used to create the rule.

            • neq (list) --

              A "not equals" operator to match for the filter used to create the rule.

              • (string) --

      • ruleName (string) --

        The name of the archive rule.

      • updatedAt (datetime) --

        The time at which the archive rule was last updated.

UpdateFindings (new) Link ¶

Updates findings with the new values provided in the request.

See also: AWS API Documentation

Request Syntax

client.update_findings(
    analyzerArn='string',
    clientToken='string',
    ids=[
        'string',
    ],
    resourceArn='string',
    status='ACTIVE'|'ARCHIVED'
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer that generated the findings to update.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

type ids:

list

param ids:

The IDs of the findings to update.

  • (string) --

type resourceArn:

string

param resourceArn:

The ARN of the resource identified in the finding.

type status:

string

param status:

[REQUIRED]

The state represents the action to take to update the finding Status. Use ARCHIVE to change an Active finding to an Archived finding. Use ACTIVE to change an Archived finding to an Active finding.

returns:

None

UpdateArchiveRule (new) Link ¶

Updates the specified archive rule.

See also: AWS API Documentation

Request Syntax

client.update_archive_rule(
    analyzerName='string',
    clientToken='string',
    filter={
        'string': {
            'contains': [
                'string',
            ],
            'eq': [
                'string',
            ],
            'exists': True|False,
            'neq': [
                'string',
            ]
        }
    },
    ruleName='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer to update the archive rules for.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

type filter:

dict

param filter:

[REQUIRED]

A filter to match for the rules to update. Only rules that match the filter are updated.

  • (string) --

    • (dict) --

      The criteria to use in the filter that defines the rule.

      • contains (list) --

        A "contains" operator to match for the filter used to create the rule.

        • (string) --

      • eq (list) --

        An "equals" operator to match for the filter used to create the rule.

        • (string) --

      • exists (boolean) --

        An "exists" operator to match for the filter used to create the rule.

      • neq (list) --

        A "not equals" operator to match for the filter used to create the rule.

        • (string) --

type ruleName:

string

param ruleName:

[REQUIRED]

The name of the rule to update.

returns:

None

GetFinding (new) Link ¶

Retrieves information about the specified finding.

See also: AWS API Documentation

Request Syntax

client.get_finding(
    analyzerArn='string',
    id='string'
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer that generated the finding.

type id:

string

param id:

[REQUIRED]

The ID of the finding to retrieve.

rtype:

dict

returns:

Response Syntax

{
    'finding': {
        'action': [
            'string',
        ],
        'analyzedAt': datetime(2015, 1, 1),
        'condition': {
            'string': 'string'
        },
        'createdAt': datetime(2015, 1, 1),
        'error': 'string',
        'id': 'string',
        'isPublic': True|False,
        'principal': {
            'string': 'string'
        },
        'resource': 'string',
        'resourceType': 'AWS::IAM::Role'|'AWS::KMS::Key'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::S3::Bucket'|'AWS::SQS::Queue',
        'status': 'ACTIVE'|'ARCHIVED'|'RESOLVED',
        'updatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    The resposne to the request.

    • finding (dict) --

      A finding object that contains finding details.

      • action (list) --

        The action in the analyzed policy statement that an external principal has permission to use.

        • (string) --

      • analyzedAt (datetime) --

        The time at which the resource was analyzed.

      • condition (dict) --

        The condition in the analyzed policy statement that resulted in a finding.

        • (string) --

          • (string) --

      • createdAt (datetime) --

        The time at which the finding was generated.

      • error (string) --

        An error.

      • id (string) --

        The ID of the finding.

      • isPublic (boolean) --

        Indicates whether the policy that generated the finding allows public access to the resource.

      • principal (dict) --

        The external principal that access to a resource within the zone of trust.

        • (string) --

          • (string) --

      • resource (string) --

        The resource that an external principal has access to.

      • resourceType (string) --

        The type of the resource reported in the finding.

      • status (string) --

        The current status of the finding.

      • updatedAt (datetime) --

        The time at which the finding was updated.

ListFindings (new) Link ¶

Retrieves a list of findings generated by the specified analyzer.

See also: AWS API Documentation

Request Syntax

client.list_findings(
    analyzerArn='string',
    filter={
        'string': {
            'contains': [
                'string',
            ],
            'eq': [
                'string',
            ],
            'exists': True|False,
            'neq': [
                'string',
            ]
        }
    },
    maxResults=123,
    nextToken='string',
    sort={
        'attributeName': 'string',
        'orderBy': 'ASC'|'DESC'
    }
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer to retrieve findings from.

type filter:

dict

param filter:

A filter to match for the findings to return.

  • (string) --

    • (dict) --

      The criteria to use in the filter that defines the rule.

      • contains (list) --

        A "contains" operator to match for the filter used to create the rule.

        • (string) --

      • eq (list) --

        An "equals" operator to match for the filter used to create the rule.

        • (string) --

      • exists (boolean) --

        An "exists" operator to match for the filter used to create the rule.

      • neq (list) --

        A "not equals" operator to match for the filter used to create the rule.

        • (string) --

type maxResults:

integer

param maxResults:

The maximum number of results to return in the response.

type nextToken:

string

param nextToken:

A token used for pagination of results returned.

type sort:

dict

param sort:

The sort order for the findings returned.

  • attributeName (string) --

    The name of the attribute to sort on.

  • orderBy (string) --

    The sort order, ascending or descending.

rtype:

dict

returns:

Response Syntax

{
    'findings': [
        {
            'action': [
                'string',
            ],
            'analyzedAt': datetime(2015, 1, 1),
            'condition': {
                'string': 'string'
            },
            'createdAt': datetime(2015, 1, 1),
            'error': 'string',
            'id': 'string',
            'isPublic': True|False,
            'principal': {
                'string': 'string'
            },
            'resource': 'string',
            'resourceType': 'AWS::IAM::Role'|'AWS::KMS::Key'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::S3::Bucket'|'AWS::SQS::Queue',
            'status': 'ACTIVE'|'ARCHIVED'|'RESOLVED',
            'updatedAt': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The resposne to the request.

    • findings (list) --

      A list of findings retrieved from the analyzer that match the filter criteria specified, if any.

      • (dict) --

        Contains information about a finding.

        • action (list) --

          The action in the analyzed policy statement that an external principal has permission to use.

          • (string) --

        • analyzedAt (datetime) --

          The time at which the resource-based policy that generated the finding was analyzed.

        • condition (dict) --

          The condition in the analyzed policy statement that resulted in a finding.

          • (string) --

            • (string) --

        • createdAt (datetime) --

          The time at which the finding was created.

        • error (string) --

          The error that resulted in an Error finding.

        • id (string) --

          The ID of the finding.

        • isPublic (boolean) --

          Indicates whether the finding reports a resource that has a policy that allows public access.

        • principal (dict) --

          The external principal that has access to a resource within the zone of trust.

          • (string) --

            • (string) --

        • resource (string) --

          The resource that the external principal has access to.

        • resourceType (string) --

          The type of the resource that the external principal has access to.

        • status (string) --

          The status of the finding.

        • updatedAt (datetime) --

          The time at which the finding was most recently updated.

    • nextToken (string) --

      A token used for pagination of results returned.

ListAnalyzedResources (new) Link ¶

Retrieves a list of resources that have been analyzed.

See also: AWS API Documentation

Request Syntax

client.list_analyzed_resources(
    analyzerArn='string',
    maxResults=123,
    nextToken='string',
    resourceType='AWS::IAM::Role'|'AWS::KMS::Key'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::S3::Bucket'|'AWS::SQS::Queue'
)
type analyzerArn:

string

param analyzerArn:

[REQUIRED]

The ARN of the analyzer to retrieve a list of analyzed resources from.

type maxResults:

integer

param maxResults:

The maximum number of results to return in the response.

type nextToken:

string

param nextToken:

A token used for pagination of results returned.

type resourceType:

string

param resourceType:

The type of resource.

rtype:

dict

returns:

Response Syntax

{
    'analyzedResources': [
        {
            'resourceArn': 'string',
            'resourceType': 'AWS::IAM::Role'|'AWS::KMS::Key'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::S3::Bucket'|'AWS::SQS::Queue'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The response to the request.

    • analyzedResources (list) --

      A list of resources that were analyzed.

      • (dict) --

        Contains the ARN of the analyzed resource.

        • resourceArn (string) --

          The ARN of the analyzed resource.

        • resourceType (string) --

          The type of resource that was analyzed.

    • nextToken (string) --

      A token used for pagination of results returned.

ListAnalyzers (new) Link ¶

Retrieves a list of analyzers.

See also: AWS API Documentation

Request Syntax

client.list_analyzers(
    maxResults=123,
    nextToken='string',
    type='ACCOUNT'
)
type maxResults:

integer

param maxResults:

The maximum number of results to return in the response.

type nextToken:

string

param nextToken:

A token used for pagination of results returned.

type type:

string

param type:

The type of analyzer, which corresponds to the zone of trust selected when the analyzer was created.

rtype:

dict

returns:

Response Syntax

{
    'analyzers': [
        {
            'arn': 'string',
            'createdAt': datetime(2015, 1, 1),
            'lastResourceAnalyzed': 'string',
            'lastResourceAnalyzedAt': datetime(2015, 1, 1),
            'name': 'string',
            'tags': {
                'string': 'string'
            },
            'type': 'ACCOUNT'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    The response to the request.

    • analyzers (list) --

      The analyzers retrieved.

      • (dict) --

        Contains information about the analyzer.

        • arn (string) --

          The ARN of the analyzer.

        • createdAt (datetime) --

          A timestamp for the time at which the analyzer was created.

        • lastResourceAnalyzed (string) --

          The resource that was most recently analyzed by the analyzer.

        • lastResourceAnalyzedAt (datetime) --

          The time at which the most recently analyzed resource was analyzed.

        • name (string) --

          The name of the analyzer.

        • tags (dict) --

          The tags added to the analyzer.

          • (string) --

            • (string) --

        • type (string) --

          The type of analyzer, which corresponds to the zone of trust chosen for the analyzer.

    • nextToken (string) --

      A token used for pagination of results returned.

UntagResource (new) Link ¶

Removes a tag from the specified resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the resource to remove the tag from.

type tagKeys:

list

param tagKeys:

[REQUIRED]

The key for the tag to add.

  • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

    The response tot he request.

ListTagsForResource (new) Link ¶

Retrieves a list of tags applied to the specified resource.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceArn='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the resource to retrieve tags from.

rtype:

dict

returns:

Response Syntax

{
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    The response to the request.

    • tags (dict) --

      The tags that are applied to the specified resource.

      • (string) --

        • (string) --

GetAnalyzer (new) Link ¶

Retrieves information about the specified analyzer.

See also: AWS API Documentation

Request Syntax

client.get_analyzer(
    analyzerName='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer retrieved.

rtype:

dict

returns:

Response Syntax

{
    'analyzer': {
        'arn': 'string',
        'createdAt': datetime(2015, 1, 1),
        'lastResourceAnalyzed': 'string',
        'lastResourceAnalyzedAt': datetime(2015, 1, 1),
        'name': 'string',
        'tags': {
            'string': 'string'
        },
        'type': 'ACCOUNT'
    }
}

Response Structure

  • (dict) --

    The response to the request.

    • analyzer (dict) --

      An AnalyzerSummary object that contains information about the analyzer.

      • arn (string) --

        The ARN of the analyzer.

      • createdAt (datetime) --

        A timestamp for the time at which the analyzer was created.

      • lastResourceAnalyzed (string) --

        The resource that was most recently analyzed by the analyzer.

      • lastResourceAnalyzedAt (datetime) --

        The time at which the most recently analyzed resource was analyzed.

      • name (string) --

        The name of the analyzer.

      • tags (dict) --

        The tags added to the analyzer.

        • (string) --

          • (string) --

      • type (string) --

        The type of analyzer, which corresponds to the zone of trust chosen for the analyzer.

CreateArchiveRule (new) Link ¶

Creates an archive rule for the specified analyzer.

See also: AWS API Documentation

Request Syntax

client.create_archive_rule(
    analyzerName='string',
    clientToken='string',
    filter={
        'string': {
            'contains': [
                'string',
            ],
            'eq': [
                'string',
            ],
            'exists': True|False,
            'neq': [
                'string',
            ]
        }
    },
    ruleName='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the created analyzer.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

type filter:

dict

param filter:

[REQUIRED]

The criteria for the rule.

  • (string) --

    • (dict) --

      The criteria to use in the filter that defines the rule.

      • contains (list) --

        A "contains" operator to match for the filter used to create the rule.

        • (string) --

      • eq (list) --

        An "equals" operator to match for the filter used to create the rule.

        • (string) --

      • exists (boolean) --

        An "exists" operator to match for the filter used to create the rule.

      • neq (list) --

        A "not equals" operator to match for the filter used to create the rule.

        • (string) --

type ruleName:

string

param ruleName:

[REQUIRED]

The name of the rule to create.

returns:

None

DeleteArchiveRule (new) Link ¶

Deletes the specified archive rule.

See also: AWS API Documentation

Request Syntax

client.delete_archive_rule(
    analyzerName='string',
    clientToken='string',
    ruleName='string'
)
type analyzerName:

string

param analyzerName:

[REQUIRED]

The name of the analyzer that was deleted.

type clientToken:

string

param clientToken:

A client token.

This field is autopopulated if not provided.

type ruleName:

string

param ruleName:

[REQUIRED]

The name of the rule to delete.

returns:

None