ResourceGroups

Table of Contents

Client

class ResourceGroups.Client

A low-level client representing AWS Resource Groups:

import boto3

client = boto3.client('resource-groups')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
create_group(**kwargs)

Creates a resource group with the specified name and description. You can optionally include a resource query, or a service configuration.

See also: AWS API Documentation

Request Syntax

response = client.create_group(
    Name='string',
    Description='string',
    ResourceQuery={
        'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
        'Query': 'string'
    },
    Tags={
        'string': 'string'
    },
    Configuration=[
        {
            'Type': 'string',
            'Parameters': [
                {
                    'Name': 'string',
                    'Values': [
                        'string',
                    ]
                },
            ]
        },
    ]
)
Parameters
  • Name (string) --

    [REQUIRED]

    The name of the group, which is the identifier of the group in other operations. You can't change the name of a resource group after you create it. A resource group name can consist of letters, numbers, hyphens, periods, and underscores. The name cannot start with AWS or aws ; these are reserved. A resource group name must be unique within each AWS Region in your AWS account.

  • Description (string) -- The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.
  • ResourceQuery (dict) --

    The resource query that determines which AWS resources are members of this group.

    Note

    You can specify either a ResourceQuery or a Configuration , but not both.

    • Type (string) -- [REQUIRED]

      The type of the query. The valid values in this release are the following:

      • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

      The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

      • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
      • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
      • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
    • Query (string) -- [REQUIRED]

      The query that defines a group or a search.

  • Tags (dict) --

    The tags to add to the group. A tag is key-value pair string.

    • (string) --
      • (string) --
  • Configuration (list) --

    A configuration associates the resource group with an AWS service and specifies how the service can interact with the resources in the group. A configuration is an array of GroupConfigurationItem elements.

    Note

    You can specify either a Configuration or a ResourceQuery in a group, but not both.

    • (dict) --

      An item in a group configuration. A group configuration can have one or more items.

      • Type (string) -- [REQUIRED]

        Specifies the type of group configuration item. Each item must have a unique value for type .

        You can specify the following string values:

        • AWS::EC2::CapacityReservationPool For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .
        • AWS::ResourceGroups::Generic - Supports parameters that configure the behavior of resource groups of any type.
      • Parameters (list) --

        A collection of parameters for this group configuration item.

        • (dict) --

          A parameter for a group configuration item.

          • Name (string) -- [REQUIRED]

            The name of the group configuration parameter.

            You can specify the following string values:

            • For configuration item type AWS::ResourceGroups::Generic :
              • allowed-resource-types Specifies the types of resources that you can add to this group by using the GroupResources operation.
            • For configuration item type AWS::EC2::CapacityReservationPool :
              • None - This configuration item type doesn't support any parameters.

            For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .

          • Values (list) --

            The values of for this parameter.

            You can specify the following string value:

            • For item type allowed-resource-types : the only supported parameter value is AWS::EC2::CapacityReservation .
            • (string) --
Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupArn': 'string',
        'Name': 'string',
        'Description': 'string'
    },
    'ResourceQuery': {
        'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
        'Query': 'string'
    },
    'Tags': {
        'string': 'string'
    },
    'GroupConfiguration': {
        'Configuration': [
            {
                'Type': 'string',
                'Parameters': [
                    {
                        'Name': 'string',
                        'Values': [
                            'string',
                        ]
                    },
                ]
            },
        ],
        'ProposedConfiguration': [
            {
                'Type': 'string',
                'Parameters': [
                    {
                        'Name': 'string',
                        'Values': [
                            'string',
                        ]
                    },
                ]
            },
        ],
        'Status': 'UPDATING'|'UPDATE_COMPLETE'|'UPDATE_FAILED',
        'FailureReason': 'string'
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      The description of the resource group.

      • GroupArn (string) --

        The ARN of the resource group.

      • Name (string) --

        The name of the resource group.

      • Description (string) --

        The description of the resource group.

    • ResourceQuery (dict) --

      The resource query associated with the group.

      • Type (string) --

        The type of the query. The valid values in this release are the following:

        • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
          • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
          • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

        The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

        • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
        • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
        • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
      • Query (string) --

        The query that defines a group or a search.

    • Tags (dict) --

      The tags associated with the group.

      • (string) --
        • (string) --
    • GroupConfiguration (dict) --

      The service configuration associated with the resource group. AWS Resource Groups supports adding service configurations for the following resource group types:

      • Configuration (list) --

        The configuration currently associated with the group and in effect.

        • (dict) --

          An item in a group configuration. A group configuration can have one or more items.

          • Type (string) --

            Specifies the type of group configuration item. Each item must have a unique value for type .

            You can specify the following string values:

            • AWS::EC2::CapacityReservationPool For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .
            • AWS::ResourceGroups::Generic - Supports parameters that configure the behavior of resource groups of any type.
          • Parameters (list) --

            A collection of parameters for this group configuration item.

            • (dict) --

              A parameter for a group configuration item.

              • Name (string) --

                The name of the group configuration parameter.

                You can specify the following string values:

                • For configuration item type AWS::ResourceGroups::Generic :
                  • allowed-resource-types Specifies the types of resources that you can add to this group by using the GroupResources operation.
                • For configuration item type AWS::EC2::CapacityReservationPool :
                  • None - This configuration item type doesn't support any parameters.

                For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .

              • Values (list) --

                The values of for this parameter.

                You can specify the following string value:

                • For item type allowed-resource-types : the only supported parameter value is AWS::EC2::CapacityReservation .
                • (string) --
      • ProposedConfiguration (list) --

        If present, the new configuration that is in the process of being applied to the group.

        • (dict) --

          An item in a group configuration. A group configuration can have one or more items.

          • Type (string) --

            Specifies the type of group configuration item. Each item must have a unique value for type .

            You can specify the following string values:

            • AWS::EC2::CapacityReservationPool For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .
            • AWS::ResourceGroups::Generic - Supports parameters that configure the behavior of resource groups of any type.
          • Parameters (list) --

            A collection of parameters for this group configuration item.

            • (dict) --

              A parameter for a group configuration item.

              • Name (string) --

                The name of the group configuration parameter.

                You can specify the following string values:

                • For configuration item type AWS::ResourceGroups::Generic :
                  • allowed-resource-types Specifies the types of resources that you can add to this group by using the GroupResources operation.
                • For configuration item type AWS::EC2::CapacityReservationPool :
                  • None - This configuration item type doesn't support any parameters.

                For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .

              • Values (list) --

                The values of for this parameter.

                You can specify the following string value:

                • For item type allowed-resource-types : the only supported parameter value is AWS::EC2::CapacityReservation .
                • (string) --
      • Status (string) --

        The current status of an attempt to update the group configuration.

      • FailureReason (string) --

        If present, the reason why a request to update the group configuration failed.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
delete_group(**kwargs)

Deletes the specified resource group. Deleting a resource group does not delete any resources that are members of the group; it only deletes the group structure.

See also: AWS API Documentation

Request Syntax

response = client.delete_group(
    GroupName='string',
    Group='string'
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group to delete.
Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupArn': 'string',
        'Name': 'string',
        'Description': 'string'
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      A full description of the deleted resource group.

      • GroupArn (string) --

        The ARN of the resource group.

      • Name (string) --

        The name of the resource group.

      • Description (string) --

        The description of the resource group.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_group(**kwargs)

Returns information about a specified resource group.

See also: AWS API Documentation

Request Syntax

response = client.get_group(
    GroupName='string',
    Group='string'
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group to retrieve.
Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupArn': 'string',
        'Name': 'string',
        'Description': 'string'
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      A full description of the resource group.

      • GroupArn (string) --

        The ARN of the resource group.

      • Name (string) --

        The name of the resource group.

      • Description (string) --

        The description of the resource group.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
get_group_configuration(**kwargs)

Returns the service configuration associated with the specified resource group. AWS Resource Groups supports configurations for the following resource group types:

See also: AWS API Documentation

Request Syntax

response = client.get_group_configuration(
    Group='string'
)
Parameters
Group (string) -- The name or the ARN of the resource group.
Return type
dict
Returns
Response Syntax
{
    'GroupConfiguration': {
        'Configuration': [
            {
                'Type': 'string',
                'Parameters': [
                    {
                        'Name': 'string',
                        'Values': [
                            'string',
                        ]
                    },
                ]
            },
        ],
        'ProposedConfiguration': [
            {
                'Type': 'string',
                'Parameters': [
                    {
                        'Name': 'string',
                        'Values': [
                            'string',
                        ]
                    },
                ]
            },
        ],
        'Status': 'UPDATING'|'UPDATE_COMPLETE'|'UPDATE_FAILED',
        'FailureReason': 'string'
    }
}

Response Structure

  • (dict) --
    • GroupConfiguration (dict) --

      The configuration associated with the specified group.

      • Configuration (list) --

        The configuration currently associated with the group and in effect.

        • (dict) --

          An item in a group configuration. A group configuration can have one or more items.

          • Type (string) --

            Specifies the type of group configuration item. Each item must have a unique value for type .

            You can specify the following string values:

            • AWS::EC2::CapacityReservationPool For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .
            • AWS::ResourceGroups::Generic - Supports parameters that configure the behavior of resource groups of any type.
          • Parameters (list) --

            A collection of parameters for this group configuration item.

            • (dict) --

              A parameter for a group configuration item.

              • Name (string) --

                The name of the group configuration parameter.

                You can specify the following string values:

                • For configuration item type AWS::ResourceGroups::Generic :
                  • allowed-resource-types Specifies the types of resources that you can add to this group by using the GroupResources operation.
                • For configuration item type AWS::EC2::CapacityReservationPool :
                  • None - This configuration item type doesn't support any parameters.

                For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .

              • Values (list) --

                The values of for this parameter.

                You can specify the following string value:

                • For item type allowed-resource-types : the only supported parameter value is AWS::EC2::CapacityReservation .
                • (string) --
      • ProposedConfiguration (list) --

        If present, the new configuration that is in the process of being applied to the group.

        • (dict) --

          An item in a group configuration. A group configuration can have one or more items.

          • Type (string) --

            Specifies the type of group configuration item. Each item must have a unique value for type .

            You can specify the following string values:

            • AWS::EC2::CapacityReservationPool For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .
            • AWS::ResourceGroups::Generic - Supports parameters that configure the behavior of resource groups of any type.
          • Parameters (list) --

            A collection of parameters for this group configuration item.

            • (dict) --

              A parameter for a group configuration item.

              • Name (string) --

                The name of the group configuration parameter.

                You can specify the following string values:

                • For configuration item type AWS::ResourceGroups::Generic :
                  • allowed-resource-types Specifies the types of resources that you can add to this group by using the GroupResources operation.
                • For configuration item type AWS::EC2::CapacityReservationPool :
                  • None - This configuration item type doesn't support any parameters.

                For more information about EC2 capacity reservation groups, see Working with capacity reservation groups in the EC2 Users Guide .

              • Values (list) --

                The values of for this parameter.

                You can specify the following string value:

                • For item type allowed-resource-types : the only supported parameter value is AWS::EC2::CapacityReservation .
                • (string) --
      • Status (string) --

        The current status of an attempt to update the group configuration.

      • FailureReason (string) --

        If present, the reason why a request to update the group configuration failed.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
get_group_query(**kwargs)

Retrieves the resource query associated with the specified resource group.

See also: AWS API Documentation

Request Syntax

response = client.get_group_query(
    GroupName='string',
    Group='string'
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group to query.
Return type

dict

Returns

Response Syntax

{
    'GroupQuery': {
        'GroupName': 'string',
        'ResourceQuery': {
            'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
            'Query': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • GroupQuery (dict) --

      The resource query associated with the specified group.

      • GroupName (string) --

        The name of the resource group that is associated with the specified resource query.

      • ResourceQuery (dict) --

        The resource query that determines which AWS resources are members of the associated resource group.

        • Type (string) --

          The type of the query. The valid values in this release are the following:

          • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
            • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
            • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

          The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

          • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
          • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
          • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
        • Query (string) --

          The query that defines a group or a search.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_tags(**kwargs)

Returns a list of tags that are associated with a resource group, specified by an ARN.

See also: AWS API Documentation

Request Syntax

response = client.get_tags(
    Arn='string'
)
Parameters
Arn (string) --

[REQUIRED]

The ARN of the resource group whose tags you want to retrieve.

Return type
dict
Returns
Response Syntax
{
    'Arn': 'string',
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --
    • Arn (string) --

      The ARN of the tagged resource group.

    • Tags (dict) --

      The tags associated with the specified resource group.

      • (string) --
        • (string) --

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
group_resources(**kwargs)

Adds the specified resources to the specified group.

See also: AWS API Documentation

Request Syntax

response = client.group_resources(
    Group='string',
    ResourceArns=[
        'string',
    ]
)
Parameters
  • Group (string) --

    [REQUIRED]

    The name or the ARN of the resource group to add resources to.

  • ResourceArns (list) --

    [REQUIRED]

    The list of ARNs for resources to be added to the group.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Succeeded': [
        'string',
    ],
    'Failed': [
        {
            'ResourceArn': 'string',
            'ErrorMessage': 'string',
            'ErrorCode': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Succeeded (list) --

      The ARNs of the resources that were successfully added to the group by this operation.

      • (string) --
    • Failed (list) --

      The ARNs of the resources that failed to be added to the group by this operation.

      • (dict) --

        A resource that failed to be added to or removed from a group.

        • ResourceArn (string) --

          The ARN of the resource that failed to be added or removed.

        • ErrorMessage (string) --

          The error message text associated with the failure.

        • ErrorCode (string) --

          The error code associated with the failure.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
list_group_resources(**kwargs)

Returns a list of ARNs of resources that are members of a specified resource group.

See also: AWS API Documentation

Request Syntax

response = client.list_group_resources(
    GroupName='string',
    Group='string',
    Filters=[
        {
            'Name': 'resource-type',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group
  • Filters (list) --

    Filters, formatted as ResourceFilter objects, that you want to apply to a ListGroupResources operation. Filters the results to include only those of the specified resource types.

    • resource-type - Filter resources by their type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType . For example, AWS::EC2::Instance , or AWS::S3::Bucket .

    When you specify a resource-type filter for ListGroupResources , AWS Resource Groups validates your filter resource types against the types that are defined in the query associated with the group. For example, if a group contains only S3 buckets because its query specifies only that resource type, but your resource-type filter includes EC2 instances, AWS Resource Groups does not filter for EC2 instances. In this case, a ListGroupResources request returns a BadRequestException error with a message similar to the following:

    The resource types specified as filters in the request are not valid.

    The error includes a list of resource types that failed the validation because they are not part of the query associated with the group. This validation doesn't occur when the group query specifies AWS::AllSupported , because a group based on such a query can contain any of the allowed resource types for the query type (tag-based or AWS CloudFormation stack-based queries).

    • (dict) --

      A filter name and value pair that is used to obtain more specific results from a list of resources.

      • Name (string) -- [REQUIRED]

        The name of the filter. Filter names are case-sensitive.

      • Values (list) -- [REQUIRED]

        One or more filter values. Allowed filter values vary by resource filter name, and are case-sensitive.

        • (string) --
  • MaxResults (integer) -- The total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.
  • NextToken (string) -- The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value provided by a previous call's NextToken response to indicate where the output should continue from.
Return type

dict

Returns

Response Syntax

{
    'ResourceIdentifiers': [
        {
            'ResourceArn': 'string',
            'ResourceType': 'string'
        },
    ],
    'NextToken': 'string',
    'QueryErrors': [
        {
            'ErrorCode': 'CLOUDFORMATION_STACK_INACTIVE'|'CLOUDFORMATION_STACK_NOT_EXISTING',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ResourceIdentifiers (list) --

      The ARNs and resource types of resources that are members of the group that you specified.

      • (dict) --

        The ARN of a resource, and its resource type.

        • ResourceArn (string) --

          The ARN of a resource.

        • ResourceType (string) --

          The resource type of a resource, such as AWS::EC2::Instance .

    • NextToken (string) --

      If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null .

    • QueryErrors (list) --

      A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

      • (dict) --

        A two-part error structure that can occur in ListGroupResources or SearchResources operations on CloudFormation stack-based queries. The error occurs if the CloudFormation stack on which the query is based either does not exist, or has a status that renders the stack inactive. A QueryError occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.

        • ErrorCode (string) --

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

        • Message (string) --

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE , the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED .

Exceptions

  • ResourceGroups.Client.exceptions.UnauthorizedException
  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
list_groups(**kwargs)

Returns a list of existing resource groups in your account.

See also: AWS API Documentation

Request Syntax

response = client.list_groups(
    Filters=[
        {
            'Name': 'resource-type'|'configuration-type',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
Parameters
  • Filters (list) --

    Filters, formatted as GroupFilter objects, that you want to apply to a ListGroups operation.

    • resource-type - Filter the results to include only those of the specified resource types. Specify up to five resource types in the format AWS::*ServiceCode* ::*ResourceType* `` . For example, ``AWS::EC2::Instance , or AWS::S3::Bucket .
    • configuration-type - Filter the results to include only those groups that have the specified configuration types attached. The current supported values are:
      • AWS:EC2::CapacityReservationPool
    • (dict) --

      A filter collection that you can use to restrict the results from a List operation to only those you want to include.

      • Name (string) -- [REQUIRED]

        The name of the filter. Filter names are case-sensitive.

      • Values (list) -- [REQUIRED]

        One or more filter values. Allowed filter values vary by group filter name, and are case-sensitive.

        • (string) --
  • MaxResults (integer) -- The total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.
  • NextToken (string) -- The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value provided by a previous call's NextToken response to indicate where the output should continue from.
Return type

dict

Returns

Response Syntax

{
    'GroupIdentifiers': [
        {
            'GroupName': 'string',
            'GroupArn': 'string'
        },
    ],
    'Groups': [
        {
            'GroupArn': 'string',
            'Name': 'string',
            'Description': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • GroupIdentifiers (list) --

      A list of GroupIdentifier objects. Each identifier is an object that contains both the Name and the GroupArn .

      • (dict) --

        The unique identifiers for a resource group.

        • GroupName (string) --

          The name of the resource group.

        • GroupArn (string) --

          The ARN of the resource group.

    • Groups (list) --

      This output element is deprecated and shouldn't be used. Refer to GroupIdentifiers instead.

      • (dict) --

        A resource group that contains AWS resources. You can assign resources to the group by associating either of the following elements with the group:

        • ResourceQuery - Use a resource query to specify a set of tag keys and values. All resources in the same AWS Region and AWS account that have those keys with the same values are included in the group. You can add a resource query when you create the group.
        • GroupConfiguration - Use a service configuration to associate the group with an AWS service. The configuration specifies which resource types can be included in the group.
        • GroupArn (string) --

          The ARN of the resource group.

        • Name (string) --

          The name of the resource group.

        • Description (string) --

          The description of the resource group.

    • NextToken (string) --

      If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null .

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
search_resources(**kwargs)

Returns a list of AWS resource identifiers that matches a specified query. The query uses the same format as a resource query in a CreateGroup or UpdateGroupQuery operation.

See also: AWS API Documentation

Request Syntax

response = client.search_resources(
    ResourceQuery={
        'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
        'Query': 'string'
    },
    MaxResults=123,
    NextToken='string'
)
Parameters
  • ResourceQuery (dict) --

    [REQUIRED]

    The search query, using the same formats that are supported for resource group definition. For more information, see CreateGroup .

    • Type (string) -- [REQUIRED]

      The type of the query. The valid values in this release are the following:

      • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

      The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

      • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
      • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
      • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
    • Query (string) -- [REQUIRED]

      The query that defines a group or a search.

  • MaxResults (integer) -- The total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.
  • NextToken (string) -- The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value provided by a previous call's NextToken response to indicate where the output should continue from.
Return type

dict

Returns

Response Syntax

{
    'ResourceIdentifiers': [
        {
            'ResourceArn': 'string',
            'ResourceType': 'string'
        },
    ],
    'NextToken': 'string',
    'QueryErrors': [
        {
            'ErrorCode': 'CLOUDFORMATION_STACK_INACTIVE'|'CLOUDFORMATION_STACK_NOT_EXISTING',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ResourceIdentifiers (list) --

      The ARNs and resource types of resources that are members of the group that you specified.

      • (dict) --

        The ARN of a resource, and its resource type.

        • ResourceArn (string) --

          The ARN of a resource.

        • ResourceType (string) --

          The resource type of a resource, such as AWS::EC2::Instance .

    • NextToken (string) --

      If present, indicates that more output is available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null .

    • QueryErrors (list) --

      A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

      • (dict) --

        A two-part error structure that can occur in ListGroupResources or SearchResources operations on CloudFormation stack-based queries. The error occurs if the CloudFormation stack on which the query is based either does not exist, or has a status that renders the stack inactive. A QueryError occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.

        • ErrorCode (string) --

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

        • Message (string) --

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE , the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED .

Exceptions

  • ResourceGroups.Client.exceptions.UnauthorizedException
  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
tag(**kwargs)

Adds tags to a resource group with the specified ARN. Existing tags on a resource group are not changed if they are not specified in the request parameters.

Warning

Do not store personally identifiable information (PII) or other confidential or sensitive information in tags. We use tags to provide you with billing and administration services. Tags are not intended to be used for private or sensitive data.

See also: AWS API Documentation

Request Syntax

response = client.tag(
    Arn='string',
    Tags={
        'string': 'string'
    }
)
Parameters
  • Arn (string) --

    [REQUIRED]

    The ARN of the resource group to which to add tags.

  • Tags (dict) --

    [REQUIRED]

    The tags to add to the specified resource group. A tag is a string-to-string map of key-value pairs.

    • (string) --
      • (string) --
Return type

dict

Returns

Response Syntax

{
    'Arn': 'string',
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • Arn (string) --

      The ARN of the tagged resource.

    • Tags (dict) --

      The tags that have been added to the specified resource group.

      • (string) --
        • (string) --

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
ungroup_resources(**kwargs)

Removes the specified resources from the specified group.

See also: AWS API Documentation

Request Syntax

response = client.ungroup_resources(
    Group='string',
    ResourceArns=[
        'string',
    ]
)
Parameters
  • Group (string) --

    [REQUIRED]

    The name or the ARN of the resource group from which to remove the resources.

  • ResourceArns (list) --

    [REQUIRED]

    The ARNs of the resources to be removed from the group.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Succeeded': [
        'string',
    ],
    'Failed': [
        {
            'ResourceArn': 'string',
            'ErrorMessage': 'string',
            'ErrorCode': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Succeeded (list) --

      The ARNs of the resources that were successfully removed from the group.

      • (string) --
    • Failed (list) --

      The resources that failed to be removed from the group.

      • (dict) --

        A resource that failed to be added to or removed from a group.

        • ResourceArn (string) --

          The ARN of the resource that failed to be added or removed.

        • ErrorMessage (string) --

          The error message text associated with the failure.

        • ErrorCode (string) --

          The error code associated with the failure.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
untag(**kwargs)

Deletes tags from a specified resource group.

See also: AWS API Documentation

Request Syntax

response = client.untag(
    Arn='string',
    Keys=[
        'string',
    ]
)
Parameters
  • Arn (string) --

    [REQUIRED]

    The ARN of the resource group from which to remove tags. The command removed both the specified keys and any values associated with those keys.

  • Keys (list) --

    [REQUIRED]

    The keys of the tags to be removed.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Arn': 'string',
    'Keys': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • Arn (string) --

      The ARN of the resource group from which tags have been removed.

    • Keys (list) --

      The keys of the tags that were removed.

      • (string) --

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
update_group(**kwargs)

Updates the description for an existing group. You cannot update the name of a resource group.

See also: AWS API Documentation

Request Syntax

response = client.update_group(
    GroupName='string',
    Group='string',
    Description='string'
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group to modify.
  • Description (string) -- The new description that you want to update the resource group with. Descriptions can contain letters, numbers, hyphens, underscores, periods, and spaces.
Return type

dict

Returns

Response Syntax

{
    'Group': {
        'GroupArn': 'string',
        'Name': 'string',
        'Description': 'string'
    }
}

Response Structure

  • (dict) --

    • Group (dict) --

      The update description of the resource group.

      • GroupArn (string) --

        The ARN of the resource group.

      • Name (string) --

        The name of the resource group.

      • Description (string) --

        The description of the resource group.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException
update_group_query(**kwargs)

Updates the resource query of a group.

See also: AWS API Documentation

Request Syntax

response = client.update_group_query(
    GroupName='string',
    Group='string',
    ResourceQuery={
        'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
        'Query': 'string'
    }
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group to query.
  • ResourceQuery (dict) --

    [REQUIRED]

    The resource query to determine which AWS resources are members of this resource group.

    • Type (string) -- [REQUIRED]

      The type of the query. The valid values in this release are the following:

      • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

      The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

      • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
      • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
      • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
    • Query (string) -- [REQUIRED]

      The query that defines a group or a search.

Return type

dict

Returns

Response Syntax

{
    'GroupQuery': {
        'GroupName': 'string',
        'ResourceQuery': {
            'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
            'Query': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • GroupQuery (dict) --

      The updated resource query associated with the resource group after the update.

      • GroupName (string) --

        The name of the resource group that is associated with the specified resource query.

      • ResourceQuery (dict) --

        The resource query that determines which AWS resources are members of the associated resource group.

        • Type (string) --

          The type of the query. The valid values in this release are the following:

          • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
            • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
            • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

          The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

          • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
          • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
          • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
        • Query (string) --

          The query that defines a group or a search.

Exceptions

  • ResourceGroups.Client.exceptions.BadRequestException
  • ResourceGroups.Client.exceptions.ForbiddenException
  • ResourceGroups.Client.exceptions.NotFoundException
  • ResourceGroups.Client.exceptions.MethodNotAllowedException
  • ResourceGroups.Client.exceptions.TooManyRequestsException
  • ResourceGroups.Client.exceptions.InternalServerErrorException

Paginators

The available paginators are:

class ResourceGroups.Paginator.ListGroupResources
paginator = client.get_paginator('list_group_resources')
paginate(**kwargs)

Creates an iterator that will paginate through responses from ResourceGroups.Client.list_group_resources().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    GroupName='string',
    Group='string',
    Filters=[
        {
            'Name': 'resource-type',
            'Values': [
                'string',
            ]
        },
    ],
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • GroupName (string) -- Don't use this parameter. Use Group instead.
  • Group (string) -- The name or the ARN of the resource group
  • Filters (list) --

    Filters, formatted as ResourceFilter objects, that you want to apply to a ListGroupResources operation. Filters the results to include only those of the specified resource types.

    • resource-type - Filter resources by their type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType . For example, AWS::EC2::Instance , or AWS::S3::Bucket .

    When you specify a resource-type filter for ListGroupResources , AWS Resource Groups validates your filter resource types against the types that are defined in the query associated with the group. For example, if a group contains only S3 buckets because its query specifies only that resource type, but your resource-type filter includes EC2 instances, AWS Resource Groups does not filter for EC2 instances. In this case, a ListGroupResources request returns a BadRequestException error with a message similar to the following:

    The resource types specified as filters in the request are not valid.

    The error includes a list of resource types that failed the validation because they are not part of the query associated with the group. This validation doesn't occur when the group query specifies AWS::AllSupported , because a group based on such a query can contain any of the allowed resource types for the query type (tag-based or AWS CloudFormation stack-based queries).

    • (dict) --

      A filter name and value pair that is used to obtain more specific results from a list of resources.

      • Name (string) -- [REQUIRED]

        The name of the filter. Filter names are case-sensitive.

      • Values (list) -- [REQUIRED]

        One or more filter values. Allowed filter values vary by resource filter name, and are case-sensitive.

        • (string) --
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'ResourceIdentifiers': [
        {
            'ResourceArn': 'string',
            'ResourceType': 'string'
        },
    ],
    'QueryErrors': [
        {
            'ErrorCode': 'CLOUDFORMATION_STACK_INACTIVE'|'CLOUDFORMATION_STACK_NOT_EXISTING',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ResourceIdentifiers (list) --

      The ARNs and resource types of resources that are members of the group that you specified.

      • (dict) --

        The ARN of a resource, and its resource type.

        • ResourceArn (string) --

          The ARN of a resource.

        • ResourceType (string) --

          The resource type of a resource, such as AWS::EC2::Instance .

    • QueryErrors (list) --

      A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

      • (dict) --

        A two-part error structure that can occur in ListGroupResources or SearchResources operations on CloudFormation stack-based queries. The error occurs if the CloudFormation stack on which the query is based either does not exist, or has a status that renders the stack inactive. A QueryError occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.

        • ErrorCode (string) --

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

        • Message (string) --

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE , the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED .

class ResourceGroups.Paginator.ListGroups
paginator = client.get_paginator('list_groups')
paginate(**kwargs)

Creates an iterator that will paginate through responses from ResourceGroups.Client.list_groups().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    Filters=[
        {
            'Name': 'resource-type'|'configuration-type',
            'Values': [
                'string',
            ]
        },
    ],
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • Filters (list) --

    Filters, formatted as GroupFilter objects, that you want to apply to a ListGroups operation.

    • resource-type - Filter the results to include only those of the specified resource types. Specify up to five resource types in the format AWS::*ServiceCode* ::*ResourceType* `` . For example, ``AWS::EC2::Instance , or AWS::S3::Bucket .
    • configuration-type - Filter the results to include only those groups that have the specified configuration types attached. The current supported values are:
      • AWS:EC2::CapacityReservationPool
    • (dict) --

      A filter collection that you can use to restrict the results from a List operation to only those you want to include.

      • Name (string) -- [REQUIRED]

        The name of the filter. Filter names are case-sensitive.

      • Values (list) -- [REQUIRED]

        One or more filter values. Allowed filter values vary by group filter name, and are case-sensitive.

        • (string) --
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'GroupIdentifiers': [
        {
            'GroupName': 'string',
            'GroupArn': 'string'
        },
    ],
    'Groups': [
        {
            'GroupArn': 'string',
            'Name': 'string',
            'Description': 'string'
        },
    ],

}

Response Structure

  • (dict) --

    • GroupIdentifiers (list) --

      A list of GroupIdentifier objects. Each identifier is an object that contains both the Name and the GroupArn .

      • (dict) --

        The unique identifiers for a resource group.

        • GroupName (string) --

          The name of the resource group.

        • GroupArn (string) --

          The ARN of the resource group.

    • Groups (list) --

      This output element is deprecated and shouldn't be used. Refer to GroupIdentifiers instead.

      • (dict) --

        A resource group that contains AWS resources. You can assign resources to the group by associating either of the following elements with the group:

        • ResourceQuery - Use a resource query to specify a set of tag keys and values. All resources in the same AWS Region and AWS account that have those keys with the same values are included in the group. You can add a resource query when you create the group.
        • GroupConfiguration - Use a service configuration to associate the group with an AWS service. The configuration specifies which resource types can be included in the group.
        • GroupArn (string) --

          The ARN of the resource group.

        • Name (string) --

          The name of the resource group.

        • Description (string) --

          The description of the resource group.

class ResourceGroups.Paginator.SearchResources
paginator = client.get_paginator('search_resources')
paginate(**kwargs)

Creates an iterator that will paginate through responses from ResourceGroups.Client.search_resources().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    ResourceQuery={
        'Type': 'TAG_FILTERS_1_0'|'CLOUDFORMATION_STACK_1_0',
        'Query': 'string'
    },
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • ResourceQuery (dict) --

    [REQUIRED]

    The search query, using the same formats that are supported for resource group definition. For more information, see CreateGroup .

    • Type (string) -- [REQUIRED]

      The type of the query. The valid values in this release are the following:

      • ``TAG_FILTERS_1_0:`` * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, as supported by the AWS Tagging API `GetResources <https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html>`__ operation. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches *any of the specified values. For example, consider the following sample query for resources that have two tags, Stage and Version , with two values each. ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}] ) The results of this query might include the following.
        • An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"} , and {"Key":"Version","Value":"2"}
        • An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"} , and {"Key":"Version","Value":"1"}

      The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

      • An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"} .
      • An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"} , and {"Key":"Version","Value":"4"}
      • *CLOUDFORMATION_STACK_1_0: * A JSON syntax that lets you specify a CloudFormation stack ARN.
    • Query (string) -- [REQUIRED]

      The query that defines a group or a search.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'ResourceIdentifiers': [
        {
            'ResourceArn': 'string',
            'ResourceType': 'string'
        },
    ],
    'QueryErrors': [
        {
            'ErrorCode': 'CLOUDFORMATION_STACK_INACTIVE'|'CLOUDFORMATION_STACK_NOT_EXISTING',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ResourceIdentifiers (list) --

      The ARNs and resource types of resources that are members of the group that you specified.

      • (dict) --

        The ARN of a resource, and its resource type.

        • ResourceArn (string) --

          The ARN of a resource.

        • ResourceType (string) --

          The resource type of a resource, such as AWS::EC2::Instance .

    • QueryErrors (list) --

      A list of QueryError objects. Each error is an object that contains ErrorCode and Message structures. Possible values for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

      • (dict) --

        A two-part error structure that can occur in ListGroupResources or SearchResources operations on CloudFormation stack-based queries. The error occurs if the CloudFormation stack on which the query is based either does not exist, or has a status that renders the stack inactive. A QueryError occurrence does not necessarily mean that AWS Resource Groups could not complete the operation, but the resulting group might have no member resources.

        • ErrorCode (string) --

          Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING .

        • Message (string) --

          A message that explains the ErrorCode value. Messages might state that the specified CloudFormation stack does not exist (or no longer exists). For CLOUDFORMATION_STACK_INACTIVE , the message typically states that the CloudFormation stack has a status that is not (or no longer) active, such as CREATE_FAILED .