• 沒有找到結果。

GetGroupConfiguration

在文檔中 AWS Resource Groups (頁 26-54)

GetGroupConfiguration

Retrieves the service configuration associated with the specified resource group. For details about the service configuration syntax, see Service configurations for Resource Groups.

Minimum permissions

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

• resource-groups:GetGroupConfiguration

Request Syntax

POST /get-group-configuration HTTP/1.1 Content-type: application/json

{

"Group": "string"

}

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

Group (p. 20)

The name or the ARN of the resource group for which you want to retrive the service configuration.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: (arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/)?[a-zA-Z0-9_\.-]{1,128}

Required: No

Response Syntax

HTTP/1.1 200

Content-type: application/json { "GroupConfiguration": { "Configuration": [ {

"Parameters": [ {

"Name": "string", "Values": [ "string" ] }

Response Elements

],

"Type": "string"

} ],

"FailureReason": "string", "ProposedConfiguration": [

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

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

GroupConfiguration (p. 20)

A structure that describes the service configuration attached with the specified group. For details about the service configuration syntax, see Service configurations for Resource Groups.

Type: GroupConfiguration (p. 82) object

Errors

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

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 NotFoundException

One or more of the specified resources don't exist.

Examples

HTTP Status Code: 404 TooManyRequestsException

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

HTTP Status Code: 429

Examples

Example

The following example shows the typical output of a resource group that contains capacity reservations.

Sample Request

POST /get-group-configuration HTTP/1.1 Host: resource-groups.us-west-2.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.get-group-configuration

"Group": "CRPGroup"

}

Sample Response

HTTP/1.1 200 OK

Date: Thu, 13 Jan 2022 21:33:46 GMT Content-Type: application/json

"GroupIdentifier":{

"GroupName":"CRPGroup",

"GroupArn":"arn:aws:resource-groups:us-west-2:123456789012:group/CRPGroup"

},

"GroupConfiguration":{

"GroupParameters":[

Examples

"Status":"UPDATE_COMPLETE"

} }

Example

The following example shows the typical output of a resource group that contains a configuration for Amazon EC2 dedicated hosts.

Sample Request

POST /get-group-configuration HTTP/1.1 Host: resource-groups.us-west-2.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.get-group-configuration

"Group": "HostManagementGroup"

}

Sample Response

HTTP/1.1 200 OK

Date: Thu, 13 Jan 2022 21:35:00 GMT Content-Type: application/json

"GroupIdentifier":{

"GroupName":"HostManagementGroup",

"GroupArn":"arn:aws:resource-groups:us-west-2:123456789012:group/

HostManagementGroup"

},

"GroupConfiguration":{

"GroupParameters":[

See Also

"Status":"UPDATE_COMPLETE"

} }

See Also

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

• AWS Command Line Interface

See Also

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GetGroupQuery

GetGroupQuery

Retrieves the resource query associated with the specified resource group. For more information about resource queries, see Create a tag-based group in Resource Groups.

Minimum permissions

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

• resource-groups:GetGroupQuery

Request Syntax

POST /get-group-query HTTP/1.1 Content-type: application/json {

"Group": "string", "GroupName": "string"

}

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

Group (p. 26)

The name or the ARN of the resource group to query.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: (arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/)?[a-zA-Z0-9_\.-]{1,128}

Required: No GroupName (p. 26)

This parameter has been deprecated.

Don't use this parameter. Use Group instead.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [a-zA-Z0-9_\.-]+

Required: No

Response Syntax

Response Syntax

HTTP/1.1 200

Content-type: application/json {

"GroupQuery": {

"GroupName": "string", "ResourceQuery": { "Query": "string", "Type": "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.

GroupQuery (p. 27)

The resource query associated with the specified group. For more information about resource queries, see Create a tag-based group in Resource Groups.

Type: GroupQuery (p. 88) object

Errors

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

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 NotFoundException

One or more of the specified resources don't exist.

HTTP Status Code: 404

Examples

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 GetGroupQuery.

Sample Request

POST /get-group-query HTTP/1.1

Host: resource-groups.us-west-2.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.get-group-query

{ "Group": "MyTagQueryGroup"

}

Sample Response

HTTP/1.1 200 OK

Date: Fri, 14 Jan 2022 18:07:18 GMT Content-Type: application/json

"GroupName":"MyTagQueryGroup", "ResourceQuery":{

"Type":"TAG_FILTERS_1_0",

"Query":"{\"ResourceTypeFilters\":[\"AWS::EC2::Instance\"],\"TagFilters\":

[{\"Key\":\"Name\", \"Values\":[\"WebServers\"]}]}"

} } }

See Also

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

• AWS Command Line Interface

• AWS SDK for .NET

See Also

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GetTags

GetTags

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

Minimum permissions

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

• resource-groups:GetTags

Request Syntax

GET /resources/Arn/tags HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.

Arn (p. 30)

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

Length Constraints: Minimum length of 12. Maximum length of 1600.

Pattern: arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/[a-zA-Z0-9_\.-]{1,128}

Required: Yes

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200

Content-type: application/json { "Arn": "string",

"Tags": {

"string" : "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.

Errors

Arn (p. 30)

The ARN of the tagged resource group.

Type: String

Length Constraints: Minimum length of 12. Maximum length of 1600.

Pattern: arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/[a-zA-Z0-9_\.-]{1,128}

Tags (p. 30)

The tags associated with the specified resource group.

Type: String to string map

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Key Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

Value Length Constraints: Minimum length of 0. Maximum length of 256.

Value Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

Errors

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

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 NotFoundException

One or more of the specified resources don't exist.

HTTP Status Code: 404 TooManyRequestsException

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

HTTP Status Code: 429

Examples

Examples

Example

The following example retrieves the tags attached to the resource group with this ARN:

arn:aws:resource-groups:us-east-1:123456789012:group/MyGroup/tags by querying the service's endpoint in us-east-1. Note that the ARN must be URL encoded.

Sample Request

GET /resources/arn%3Aaws%3Aresource-groups%3Aus-east-1%3A123456789012%3Agroup%2FMyGroup/

tags HTTP/1.1

Host: resource-groups.us-east-1.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.get-tags

Date: Fri, 14 Jan 2022 18:40:33 GMT Content-Type: application/json

{ "Arn": "arn:aws:resource-groups:us-east-1:123456789012:group/MyGroup", "Tags":{

"Stage":"Production"

} }

See Also

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

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

GroupResources

GroupResources

Adds the specified resources to the specified group.

Important

You can use this operation with only resource groups that are configured with the following types:

• AWS::EC2::HostManagement

• AWS::EC2::CapacityReservationPool

Other resource group type and resource types aren't currently supported by this operation.

Minimum permissions

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

• resource-groups:GroupResources

Request Syntax

POST /group-resources HTTP/1.1 Content-type: application/json { "Group": "string",

"ResourceArns": [ "string" ] }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

Group (p. 33)

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: (arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/)?[a-zA-Z0-9_\.-]{1,128}

Required: Yes ResourceArns (p. 33)

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

Type: Array of strings

Response Syntax

Array Members: Minimum number of 1 item. Maximum number of 10 items.

Pattern: arn:aws(-[a-z]+)*:[a-z0-9\-]*:([a-z]{2}(-[a-z]+)+-\d{1})?:([0-9]

{12})?:.+

Required: Yes

Response Syntax

HTTP/1.1 200

Content-type: application/json {

"Failed": [ {

"ErrorCode": "string", "ErrorMessage": "string", "ResourceArn": "string"

} ],

"Pending": [ {

"ResourceArn": "string"

} ],

"Succeeded": [ "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.

Failed (p. 34)

A list of ARNs of any resources that this operation failed to add to the group.

Type: Array of FailedResource (p. 79) objects Pending (p. 34)

A list of ARNs of any resources that this operation is still in the process adding to the group. These pending additions continue asynchronously. You can check the status of pending additions by using the ListGroupResources (p. 37) operation, and checking the Resources array in the response and the Status field of each object in that array.

Type: Array of PendingResource (p. 90) objects Succeeded (p. 34)

A list of ARNs of the resources that this operation successfully added to the group.

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 10 items.

Pattern: arn:aws(-[a-z]+)*:[a-z0-9\-]*:([a-z]{2}(-[a-z]+)+-\d{1})?:([0-9]

{12})?:.+

Errors

Errors

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

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 NotFoundException

One or more of the specified resources don't exist.

HTTP Status Code: 404 TooManyRequestsException

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

HTTP Status Code: 429

Examples

Example

The following example adds two Amazon EC2 capacity reservations to the specified resource group. The group is configured to allow only capacity reservations as group members.

Sample Request

POST /group-resources HTTP/1.1

Host: resource-groups.us-west-2.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.group-resources

X-Amz-Date: 20220114T203701Z

X-Amz-Security-Token: <SECURITY-TOKEN>

Authorization: AWS4-HMAC-SHA256 Credential=<ACCESS-KEY>/20220113/us-west-2/resource-groups/

aws4_request,SignedHeaders=host;x-amz-date;x-amz-security-token,Signature=<SIGV4-SIGNATURE>

Content-Length: 199 { "Group": "CRPGroup",

See Also

"ResourceArns": [

"arn:aws:ec2:us-west-2:123456789012:capacity-reservation/cr-0070b00d13EXAMPLE", "arn:aws:ec2:us-west-2:123456789012:capacity-reservation/cr-061abec820EXAMPLE"

] }

Sample Response

HTTP/1.1 200 OK

Date: Fri, 14 Jan 2022 20:37:01 GMT Content-Type: application/json Content-Length: 119

x-amzn-RequestId: <VARIES>

x-amz-apigw-id: <VARIES>

X-Amzn-Trace-Id: Root=<VARIES>

Connection: keep-alive

{ "Succeeded":[

"arn:aws:ec2:us-west-2:123456789012:capacity-reservation/cr-0070b00d13EXAMPLE", "arn:aws:ec2:us-west-2:123456789012:capacity-reservation/cr-061abec820EXAMPLE"

],

"Failed":[], "Pending":[]

}

See Also

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

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

ListGroupResources

ListGroupResources

Returns a list of 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

Request Syntax

POST /list-group-resources HTTP/1.1 Content-type: application/json {

"Filters": [ {

"Name": "string", "Values": [ "string" ] }

],

"Group": "string", "GroupName": "string", "MaxResults": number, "NextToken": "string"

}

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

Filters (p. 37)

Filters, formatted as ResourceFilter (p. 92) 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:

Request Body

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).

Type: Array of ResourceFilter (p. 92) objects Required: No

Group (p. 37)

The name or the ARN of the resource group Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: (arn:aws(-[a-z]+)*:resource-groups:[a-z]{2}(-[a-z]+)+-\d{1}:[0-9]

{12}:group/)?[a-zA-Z0-9_\.-]{1,128}

Required: No GroupName (p. 37)

Important

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [a-zA-Z0-9_\.-]+

Required: No MaxResults (p. 37)

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.

Type: Integer

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

Required: No NextToken (p. 37)

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.

Type: String

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

Response Syntax { "NextToken": "string", "QueryErrors": [

"ResourceIdentifiers": [ {

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

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

NextToken (p. 39)

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}$

QueryErrors (p. 39)

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.

Type: Array of QueryError (p. 91) objects

Errors

ResourceIdentifiers (p. 39) Important

Deprecated - don't use this parameter. Use the Resources response field instead.

Type: Array of ResourceIdentifier (p. 93) objects Resources (p. 39)

An array of resources from which you can determine each resource's identity, type, and group membership status.

Type: Array of ListGroupResourcesItem (p. 89) objects

Errors

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

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 NotFoundException

One or more of the specified resources don't exist.

HTTP Status Code: 404 TooManyRequestsException

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

HTTP Status Code: 429 UnauthorizedException

The request was rejected because it doesn't have valid credentials for the target resource.

HTTP Status Code: 401

Examples

Example

This example illustrates one usage of ListGroupResources.

See Also

Sample Request

POST /list-group-resources HTTP/1.1

Host: resource-groups.us-west-2.amazonaws.com Accept-Encoding: identity

User-Agent: aws-cli/2.2.40 Python/3.8.8 Windows/10 exe/AMD64 prompt/off command/resource-groups.list-group-resources { "Group": "CRPGroup"

}

Sample Response

HTTP/1.1 200 OK

Date: Fri, 14 Jan 2022 20:57:55 GMT Content-Type: application/json

"ResourceArn":"arn:aws:ec2:us-west-2:123456789012:capacity-reservation/

cr-0070b00d13EXAMPLE",

"ResourceArn":"arn:aws:ec2:us-west-2:123456789012:capacity-reservation/

cr-061abec820EXAMPLE",

"ResourceType":"AWS::EC2::CapacityReservation"

} } ],

"QueryErrors":[]

}

See Also

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

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

See Also

• AWS SDK for Python

• AWS SDK for Ruby V3

ListGroups

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

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 (p. 43)

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

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

在文檔中 AWS Resource Groups (頁 26-54)

相關文件