/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace ResourceGroups { namespace Model { /** *

The query that is used to define a resource group or a search for * resources.

See Also:

AWS * API Reference

*/ class AWS_RESOURCEGROUPS_API ResourceQuery { public: ResourceQuery(); ResourceQuery(Aws::Utils::Json::JsonView jsonValue); ResourceQuery& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline const QueryType& GetType() const{ return m_type; } /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline void SetType(const QueryType& value) { m_typeHasBeenSet = true; m_type = value; } /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline void SetType(QueryType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline ResourceQuery& WithType(const QueryType& value) { SetType(value); return *this;} /** *

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

  • * CLOUDFORMATION_STACK_1_0: A JSON syntax that lets you * specify a CloudFormation stack ARN.

  • * 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 * ResourceTypeFilters parameter of the * tagging:GetResources 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 could 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 include the following items in the results, however.

    • An * EC2 instance that has only the following tag: * {"Key":"Stage","Value":"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: * {"Key":"Stage","Value":"Archived"}, and * {"Key":"Version","Value":"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.

*/ inline ResourceQuery& WithType(QueryType&& value) { SetType(std::move(value)); return *this;} /** *

The query that defines a group or a search.

*/ inline const Aws::String& GetQuery() const{ return m_query; } /** *

The query that defines a group or a search.

*/ inline bool QueryHasBeenSet() const { return m_queryHasBeenSet; } /** *

The query that defines a group or a search.

*/ inline void SetQuery(const Aws::String& value) { m_queryHasBeenSet = true; m_query = value; } /** *

The query that defines a group or a search.

*/ inline void SetQuery(Aws::String&& value) { m_queryHasBeenSet = true; m_query = std::move(value); } /** *

The query that defines a group or a search.

*/ inline void SetQuery(const char* value) { m_queryHasBeenSet = true; m_query.assign(value); } /** *

The query that defines a group or a search.

*/ inline ResourceQuery& WithQuery(const Aws::String& value) { SetQuery(value); return *this;} /** *

The query that defines a group or a search.

*/ inline ResourceQuery& WithQuery(Aws::String&& value) { SetQuery(std::move(value)); return *this;} /** *

The query that defines a group or a search.

*/ inline ResourceQuery& WithQuery(const char* value) { SetQuery(value); return *this;} private: QueryType m_type; bool m_typeHasBeenSet; Aws::String m_query; bool m_queryHasBeenSet; }; } // namespace Model } // namespace ResourceGroups } // namespace Aws