Skip to content

list_group_resources async

list_group_resources(
    *,
    config_overrides: Optional[AsyncResourceGroupsClientConfig] = None,
    group_name: Optional[GroupName] = None,
    group: Optional[GroupStringV2] = None,
    filters: Optional[ResourceFilterList] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListGroupResourcesOutput

Returns a list of Amazon resource names (ARNs) of the resources that are members of a specified resource group.

Minimum permissions

To run this command, you must have the following permissions:

  • resource-groups:ListGroupResources

  • cloudformation:DescribeStacks

  • cloudformation:ListStackResources

  • tag:GetResources

Parameters:

  • group_name (Optional[GroupName], default: None ) –

    Deprecated - don't use this parameter. Use the Group request field instead.

  • group (Optional[GroupStringV2], default: None ) –

    The name or the Amazon resource name (ARN) of the resource group.

  • filters (Optional[ResourceFilterList], default: None ) –

    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, 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 Amazon CloudFront stack-based queries).

  • max_results (Optional[MaxResults], default: None ) –

    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.

  • next_token (Optional[NextToken], default: None ) –

    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.

Raises:

Source code in docs_src/capo_resource_groups/_services/async_resource_groups.py
async def list_group_resources(
    self,
    *,
    config_overrides: Optional[AsyncResourceGroupsClientConfig] = None,
    group_name: Optional["capo_resource_groups.types.group_name.GroupName"] = None,
    group: Optional[
        "capo_resource_groups.types.group_string_v2.GroupStringV2"
    ] = None,
    filters: Optional[
        "capo_resource_groups.types.resource_filter_list.ResourceFilterList"
    ] = None,
    max_results: Optional[
        "capo_resource_groups.types.max_results.MaxResults"
    ] = None,
    next_token: Optional["capo_resource_groups.types.next_token.NextToken"] = None,
) -> "capo_resource_groups.types.list_group_resources_output.ListGroupResourcesOutput":
    """<p>Returns a list of Amazon resource names (ARNs) of the resources that are members of a specified resource group.</p> <p> <b>Minimum permissions</b> </p> <p>To run this command, you must have the following permissions:</p> <ul> <li> <p> <code>resource-groups:ListGroupResources</code> </p> </li> <li> <p> <code>cloudformation:DescribeStacks</code> </p> </li> <li> <p> <code>cloudformation:ListStackResources</code> </p> </li> <li> <p> <code>tag:GetResources</code> </p> </li> </ul>

    Args:
        group_name: <important> <p> <i> <b>Deprecated - don't use this parameter. Use the <code>Group</code> request field instead.</b> </i> </p> </important>
        group: <p>The name or the Amazon resource name (ARN) of the resource group. </p>
        filters: <p>Filters, formatted as <a>ResourceFilter</a> objects, that you want to apply to a <code>ListGroupResources</code> operation. Filters the results to include only those of the specified resource types.</p> <ul> <li> <p> <code>resource-type</code> - Filter resources by their type. Specify up to five resource types in the format <code>AWS::ServiceCode::ResourceType</code>. For example, <code>AWS::EC2::Instance</code>, or <code>AWS::S3::Bucket</code>. </p> </li> </ul> <p>When you specify a <code>resource-type</code> filter for <code>ListGroupResources</code>, 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 <code>resource-type</code> filter includes EC2 instances, AWS Resource Groups does not filter for EC2 instances. In this case, a <code>ListGroupResources</code> request returns a <code>BadRequestException</code> error with a message similar to the following:</p> <p> <code>The resource types specified as filters in the request are not valid.</code> </p> <p>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 <code>AWS::AllSupported</code>, because a group based on such a query can contain any of the allowed resource types for the query type (tag-based or Amazon CloudFront stack-based queries).</p>
        max_results: <p>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 <code>NextToken</code> response element is present and has a value (is not null). Include that value as the <code>NextToken</code> 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 <code>NextToken</code> after every operation to ensure that you receive all of the results.</p>
        next_token: <p>The parameter for receiving additional results if you receive a <code>NextToken</code> response in a previous request. A <code>NextToken</code> response indicates that more output is available. Set this parameter to the value provided by a previous call's <code>NextToken</code> response to indicate where the output should continue from.</p>

    Raises:
        capo_resource_groups.errors.bad_request_exception.BadRequestException: <p>The request includes one or more parameters that violate validation rules.</p>
        capo_resource_groups.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request. Check permissions.</p>
        capo_resource_groups.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal error occurred while processing the request. Try again later.</p>
        capo_resource_groups.errors.method_not_allowed_exception.MethodNotAllowedException: <p>The request uses an HTTP method that isn't allowed for the specified resource.</p>
        capo_resource_groups.errors.not_found_exception.NotFoundException: <p>One or more of the specified resources don't exist.</p>
        capo_resource_groups.errors.too_many_requests_exception.TooManyRequestsException: <p>You've exceeded throttling limits by making too many requests in a period of time.</p>
        capo_resource_groups.errors.unauthorized_exception.UnauthorizedException: <p>The request was rejected because it doesn't have valid credentials for the target resource.</p>
        capo_resource_groups.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_resource_groups.types.list_group_resources_input.ListGroupResourcesInput]",
    ) -> AsyncOperationResponse[
        "capo_resource_groups.types.list_group_resources_output.ListGroupResourcesOutput"
    ]:
        import capo_resource_groups._operations.ardi.list_group_resources

        (
            output,
            http_response,
        ) = await capo_resource_groups._operations.ardi.list_group_resources.async_list_group_resources(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListGroupResources")
    )
    input_: capo_resource_groups.types.list_group_resources_input.ListGroupResourcesInput = {}
    if group_name is not None:
        input_["group_name"] = group_name
    if group is not None:
        input_["group"] = group
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output