RecycleBin / Client / list_rules

list_rules#

RecycleBin.Client.list_rules(**kwargs)#

Lists the Recycle Bin retention rules in the Region.

See also: AWS API Documentation

Request Syntax

response = client.list_rules(
    MaxResults=123,
    NextToken='string',
    ResourceType='EBS_SNAPSHOT'|'EC2_IMAGE',
    ResourceTags=[
        {
            'ResourceTagKey': 'string',
            'ResourceTagValue': 'string'
        },
    ],
    LockState='locked'|'pending_unlock'|'unlocked',
    ExcludeResourceTags=[
        {
            'ResourceTagKey': 'string',
            'ResourceTagValue': 'string'
        },
    ]
)
Parameters:
  • MaxResults (integer) – The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned NextToken value.

  • NextToken (string) – The token for the next page of results.

  • ResourceType (string) –

    [REQUIRED]

    The resource type retained by the retention rule. Only retention rules that retain the specified resource type are listed. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To list retention rules that retain snapshots, specify EBS_SNAPSHOT. To list retention rules that retain EBS-backed AMIs, specify EC2_IMAGE.

  • ResourceTags (list) –

    [Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

    • (dict) –

      [Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

      • ResourceTagKey (string) – [REQUIRED]

        The tag key.

      • ResourceTagValue (string) –

        The tag value.

  • LockState (string) – The lock state of the retention rules to list. Only retention rules with the specified lock state are returned.

  • ExcludeResourceTags (list) –

    [Region-level retention rules only] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.

    • (dict) –

      [Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

      • ResourceTagKey (string) – [REQUIRED]

        The tag key.

      • ResourceTagValue (string) –

        The tag value.

Return type:

dict

Returns:

Response Syntax

{
    'Rules': [
        {
            'Identifier': 'string',
            'Description': 'string',
            'RetentionPeriod': {
                'RetentionPeriodValue': 123,
                'RetentionPeriodUnit': 'DAYS'
            },
            'LockState': 'locked'|'pending_unlock'|'unlocked',
            'RuleArn': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • Rules (list) –

      Information about the retention rules.

      • (dict) –

        Information about a Recycle Bin retention rule.

        • Identifier (string) –

          The unique ID of the retention rule.

        • Description (string) –

          The retention rule description.

        • RetentionPeriod (dict) –

          Information about the retention period for which the retention rule is to retain resources.

          • RetentionPeriodValue (integer) –

            The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit.

          • RetentionPeriodUnit (string) –

            The unit of time in which the retention period is measured. Currently, only DAYS is supported.

        • LockState (string) –

          [Region-level retention rules only] The lock state for the retention rule.

          • locked - The retention rule is locked and can’t be modified or deleted.

          • pending_unlock - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.

          • unlocked - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.

          • null - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the locked and unlocked states only; it can never transition back to null.

        • RuleArn (string) –

          The Amazon Resource Name (ARN) of the retention rule.

    • NextToken (string) –

      The token to use to retrieve the next page of results. This value is null when there are no more results to return.

Exceptions

  • RecycleBin.Client.exceptions.ValidationException

  • RecycleBin.Client.exceptions.InternalServerException