AWS SDK for C++  1.9.66
AWS SDK for C++
Public Member Functions | List of all members
Aws::ResourceGroups::Model::ResourceQuery Class Reference

#include <ResourceQuery.h>

Public Member Functions

 ResourceQuery ()
 
 ResourceQuery (Aws::Utils::Json::JsonView jsonValue)
 
ResourceQueryoperator= (Aws::Utils::Json::JsonView jsonValue)
 
Aws::Utils::Json::JsonValue Jsonize () const
 
const QueryTypeGetType () const
 
bool TypeHasBeenSet () const
 
void SetType (const QueryType &value)
 
void SetType (QueryType &&value)
 
ResourceQueryWithType (const QueryType &value)
 
ResourceQueryWithType (QueryType &&value)
 
const Aws::StringGetQuery () const
 
bool QueryHasBeenSet () const
 
void SetQuery (const Aws::String &value)
 
void SetQuery (Aws::String &&value)
 
void SetQuery (const char *value)
 
ResourceQueryWithQuery (const Aws::String &value)
 
ResourceQueryWithQuery (Aws::String &&value)
 
ResourceQueryWithQuery (const char *value)
 

Detailed Description

The query that is used to define a resource group or a search for resources. A query specifies both a query type and a query string as a JSON object. See the examples section for example JSON strings.

The examples that follow are shown as standard JSON strings. If you include such a string as a parameter to the AWS CLI or an SDK API, you might need to 'escape' the string into a single line. For example, see the Quoting strings in the AWS CLI User Guide.

Example 1

The following generic example shows a resource query JSON string that includes only resources that meet the following criteria:

{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": [ "resource_type1", "resource_type2"], "TagFilters": [ { "Key": "Key1", "Values": ["ValueA","ValueB"] }, { "Key":"Key2", "Values":["ValueC","ValueD"] } ] } }

This has the equivalent "shortcut" syntax of the following:

{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": [ "resource_type1", "resource_type2"], "TagFilters": [ { "Key1": ["ValueA","ValueB"] }, { "Key2": ["ValueC","ValueD"] } ] } }

Example 2

The following example shows a resource query JSON string that includes only Amazon EC2 instances that are tagged Stage with a value of Test.

{ "Type": "TAG_FILTERS_1_0", "Query": "{ "ResourceTypeFilters": "AWS::EC2::Instance", "TagFilters": { "Stage": "Test" } } }

Example 3

The following example shows a resource query JSON string that includes resource of any supported type as long as it is tagged Stage with a value of Prod.

{ "Type": "TAG_FILTERS_1_0", "Query": { "ResourceTypeFilters": "AWS::AllSupported", "TagFilters": { "Stage": "Prod" } } }

Example 4

The following example shows a resource query JSON string that includes only Amazon EC2 instances and Amazon S3 buckets that are part of the specified AWS CloudFormation stack.

{ "Type": "CLOUDFORMATION_STACK_1_0", "Query": { "ResourceTypeFilters": [ "AWS::EC2::Instance", "AWS::S3::Bucket" ], "StackIdentifier": "arn:aws:cloudformation:us-west-2:123456789012:stack/AWStestuseraccount/fb0d5000-aba8-00e8-aa9e-50d5cEXAMPLE" } }

See Also:

AWS API Reference

Definition at line 70 of file ResourceQuery.h.

Constructor & Destructor Documentation

◆ ResourceQuery() [1/2]

Aws::ResourceGroups::Model::ResourceQuery::ResourceQuery ( )

◆ ResourceQuery() [2/2]

Aws::ResourceGroups::Model::ResourceQuery::ResourceQuery ( Aws::Utils::Json::JsonView  jsonValue)

Member Function Documentation

◆ GetQuery()

const Aws::String& Aws::ResourceGroups::Model::ResourceQuery::GetQuery ( ) const
inline

The query that defines a group or a search.

Definition at line 305 of file ResourceQuery.h.

◆ GetType()

const QueryType& Aws::ResourceGroups::Model::ResourceQuery::GetType ( ) const
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 114 of file ResourceQuery.h.

◆ Jsonize()

Aws::Utils::Json::JsonValue Aws::ResourceGroups::Model::ResourceQuery::Jsonize ( ) const

◆ operator=()

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::operator= ( Aws::Utils::Json::JsonView  jsonValue)

◆ QueryHasBeenSet()

bool Aws::ResourceGroups::Model::ResourceQuery::QueryHasBeenSet ( ) const
inline

The query that defines a group or a search.

Definition at line 310 of file ResourceQuery.h.

◆ SetQuery() [1/3]

void Aws::ResourceGroups::Model::ResourceQuery::SetQuery ( Aws::String &&  value)
inline

The query that defines a group or a search.

Definition at line 320 of file ResourceQuery.h.

◆ SetQuery() [2/3]

void Aws::ResourceGroups::Model::ResourceQuery::SetQuery ( const Aws::String value)
inline

The query that defines a group or a search.

Definition at line 315 of file ResourceQuery.h.

◆ SetQuery() [3/3]

void Aws::ResourceGroups::Model::ResourceQuery::SetQuery ( const char *  value)
inline

The query that defines a group or a search.

Definition at line 325 of file ResourceQuery.h.

◆ SetType() [1/2]

void Aws::ResourceGroups::Model::ResourceQuery::SetType ( const QueryType value)
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 188 of file ResourceQuery.h.

◆ SetType() [2/2]

void Aws::ResourceGroups::Model::ResourceQuery::SetType ( QueryType &&  value)
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 225 of file ResourceQuery.h.

◆ TypeHasBeenSet()

bool Aws::ResourceGroups::Model::ResourceQuery::TypeHasBeenSet ( ) const
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 151 of file ResourceQuery.h.

◆ WithQuery() [1/3]

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::WithQuery ( Aws::String &&  value)
inline

The query that defines a group or a search.

Definition at line 335 of file ResourceQuery.h.

◆ WithQuery() [2/3]

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::WithQuery ( const Aws::String value)
inline

The query that defines a group or a search.

Definition at line 330 of file ResourceQuery.h.

◆ WithQuery() [3/3]

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::WithQuery ( const char *  value)
inline

The query that defines a group or a search.

Definition at line 340 of file ResourceQuery.h.

◆ WithType() [1/2]

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::WithType ( const QueryType value)
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 262 of file ResourceQuery.h.

◆ WithType() [2/2]

ResourceQuery& Aws::ResourceGroups::Model::ResourceQuery::WithType ( QueryType &&  value)
inline

The type of the query. You can use the following values:

  • CLOUDFORMATION_STACK_1_0: Specifies that the Query contains an ARN for a CloudFormation stack.

  • TAG_FILTERS_1_0: Specifies that the Query parameter contains a JSON string that represents a collection of simple tag filters for resource types and tags. The JSON string uses a syntax similar to the GetResources operation, but uses only the ResourceTypeFilters and TagFilters fields. 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:

    [{"Stage":["Test","Deploy"]},{"Version":["1","2"]}]

    The results of this query could include the following.

    • An EC2 instance that has the following two tags: {"Stage":"Deploy"}, and {"Version":"2"}

    • An S3 bucket that has the following two tags: {"Stage":"Test"}, and {"Version":"1"}

    The query would not include the following items in the results, however.

    • An EC2 instance that has only the following tag: {"Stage":"Deploy"}.

      The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.

    • An RDS database that has the following two tags: {"Stage":"Archived"} and {"Version":"4"}

      The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.

Definition at line 299 of file ResourceQuery.h.


The documentation for this class was generated from the following file: