ListGroups - AWS Resource Groups

ListGroups

Returns a list of existing resource groups in your account.

Minimum permissions

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

  • resource-groups:ListGroups

Related operations

Request Syntax

POST /groups-list?maxResults=MaxResults&nextToken=NextToken HTTP/1.1 Content-type: application/json { "Filters": [ { "Name": "string", "Values": [ "string" ] } ] }

URI Request Parameters

The request uses the following URI parameters.

MaxResults

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.

Valid Range: Minimum value of 1. Maximum value of 50.

NextToken

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.

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: ^[a-zA-Z0-9+/]*={0,2}$

Request Body

The request accepts the following data in JSON format.

Filters

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

Type: Array of GroupFilter objects

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "GroupIdentifiers": [ { "GroupArn": "string", "GroupName": "string" } ], "Groups": [ { "Description": "string", "GroupArn": "string", "Name": "string" } ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

GroupIdentifiers

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

Type: Array of GroupIdentifier objects

Groups

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

Type: Array of Group objects

NextToken

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.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 8192.

Pattern: ^[a-zA-Z0-9+/]*={0,2}$

Errors

For information about the errors that are common to all actions, see Common Errors.

BadRequestException

The request includes one or more parameters that violate validation rules.

HTTP Status Code: 400

ForbiddenException

The caller isn't authorized to make the request. Check permissions.

HTTP Status Code: 403

InternalServerErrorException

An internal error occurred while processing the request. Try again later.

HTTP Status Code: 500

MethodNotAllowedException

The request uses an HTTP method that isn't allowed for the specified resource.

HTTP Status Code: 405

TooManyRequestsException

You've exceeded throttling limits by making too many requests in a period of time.

HTTP Status Code: 429

Examples

Example

This example illustrates one usage of ListGroups.

Sample Request

POST /groups-list HTTP/1.1

Sample Response

HTTP/1.1 200 OK Content-Type: application/json { "GroupIdentifiers": [ { "GroupName": "TestCRPGroup", "GroupArn": "arn:aws:resource-groups-gamma:us-east-1:123456789012:group/TestCRPGroup", "ServiceLinkType": "AWS::EC2::CapacityReservationPool", "OwnerId": "123456789012" }, { "GroupName": "TestQueryGroup", "GroupArn": "arn:aws:resource-groups-gamma:us-east-1:123456789012:group/TestQueryGroup", "OwnerId": "123456789012" } ], "Groups": [ { "GroupArn": "arn:aws:resource-groups-gamma:us-east-1:123456789012:group/TestCRPGroup", "Name": "TestCRPGroup", "ServiceLinkType": "AWS::EC2::CapacityReservationPool", "OwnerId": "123456789012" }, { "GroupArn": "arn:aws:resource-groups-gamma:us-east-1:123456789012:group/TestQueryGroup", "Name": "TestQueryGroup", "OwnerId": "123456789012" } ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: