Skip to content

Commit 96681c6

Browse files
author
awstools
committed
feat(client-resource-groups): Resource Groups: TagSyncTasks can be created with ResourceQuery
1 parent 4c3f4ec commit 96681c6

File tree

6 files changed

+181
-12
lines changed

6 files changed

+181
-12
lines changed

clients/client-resource-groups/src/commands/GetTagSyncTaskCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export interface GetTagSyncTaskCommandOutput extends GetTagSyncTaskOutput, __Met
5656
* // TaskArn: "STRING_VALUE",
5757
* // TagKey: "STRING_VALUE",
5858
* // TagValue: "STRING_VALUE",
59+
* // ResourceQuery: { // ResourceQuery
60+
* // Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
61+
* // Query: "STRING_VALUE", // required
62+
* // },
5963
* // RoleArn: "STRING_VALUE",
6064
* // Status: "ACTIVE" || "ERROR",
6165
* // ErrorMessage: "STRING_VALUE",

clients/client-resource-groups/src/commands/ListTagSyncTasksCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export interface ListTagSyncTasksCommandOutput extends ListTagSyncTasksOutput, _
6666
* // TaskArn: "STRING_VALUE",
6767
* // TagKey: "STRING_VALUE",
6868
* // TagValue: "STRING_VALUE",
69+
* // ResourceQuery: { // ResourceQuery
70+
* // Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
71+
* // Query: "STRING_VALUE", // required
72+
* // },
6973
* // RoleArn: "STRING_VALUE",
7074
* // Status: "ACTIVE" || "ERROR",
7175
* // ErrorMessage: "STRING_VALUE",

clients/client-resource-groups/src/commands/StartTagSyncTaskCommand.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ export interface StartTagSyncTaskCommandOutput extends StartTagSyncTaskOutput, _
2929

3030
/**
3131
* <p>Creates a new tag-sync task to onboard and sync resources tagged with a specific tag key-value pair to an
32-
* application. </p>
32+
* application. To start a tag-sync task, you need a <a href="https://docs.aws.amazon.com/servicecatalog/latest/arguide/app-tag-sync.html#tag-sync-role">resource tagging role</a>.
33+
* The resource tagging role grants permissions to tag and untag applications resources and must include a
34+
* trust policy that allows Resource Groups to assume the role and perform resource tagging tasks on your behalf. </p>
35+
* <p>For instructions on creating a tag-sync task, see <a href="https://docs.aws.amazon.com/servicecatalog/latest/arguide/app-tag-sync.html#create-tag-sync">Create a tag-sync
36+
* using the Resource Groups API</a> in the <i>Amazon Web Services Service Catalog AppRegistry Administrator Guide</i>. </p>
3337
* <p>
3438
* <b>Minimum permissions</b>
3539
* </p>
@@ -57,8 +61,12 @@ export interface StartTagSyncTaskCommandOutput extends StartTagSyncTaskOutput, _
5761
* const client = new ResourceGroupsClient(config);
5862
* const input = { // StartTagSyncTaskInput
5963
* Group: "STRING_VALUE", // required
60-
* TagKey: "STRING_VALUE", // required
61-
* TagValue: "STRING_VALUE", // required
64+
* TagKey: "STRING_VALUE",
65+
* TagValue: "STRING_VALUE",
66+
* ResourceQuery: { // ResourceQuery
67+
* Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
68+
* Query: "STRING_VALUE", // required
69+
* },
6270
* RoleArn: "STRING_VALUE", // required
6371
* };
6472
* const command = new StartTagSyncTaskCommand(input);
@@ -69,6 +77,10 @@ export interface StartTagSyncTaskCommandOutput extends StartTagSyncTaskOutput, _
6977
* // TaskArn: "STRING_VALUE",
7078
* // TagKey: "STRING_VALUE",
7179
* // TagValue: "STRING_VALUE",
80+
* // ResourceQuery: { // ResourceQuery
81+
* // Type: "TAG_FILTERS_1_0" || "CLOUDFORMATION_STACK_1_0", // required
82+
* // Query: "STRING_VALUE", // required
83+
* // },
7284
* // RoleArn: "STRING_VALUE",
7385
* // };
7486
*

clients/client-resource-groups/src/models/models_0.ts

Lines changed: 135 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,38 @@ export interface GetTagSyncTaskOutput {
906906
*/
907907
TagValue?: string | undefined;
908908

909+
/**
910+
* <p>The query you can use to define a resource group or a search for resources. A
911+
* <code>ResourceQuery</code> specifies both a query <code>Type</code> and a
912+
* <code>Query</code> string as JSON string objects. See the examples section for
913+
* example JSON strings. For more information about creating a resource group with a
914+
* resource query, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html">Build queries and groups in
915+
* Resource Groups</a> in the <i>Resource Groups User Guide</i>
916+
* </p>
917+
* <p>When you combine all of the elements together into a single string, any double quotes
918+
* that are embedded inside another double quote pair must be escaped by preceding the
919+
* embedded double quote with a backslash character (\). For example, a complete
920+
* <code>ResourceQuery</code> parameter must be formatted like the following CLI
921+
* parameter example:</p>
922+
* <p>
923+
* <code>--resource-query
924+
* '\{"Type":"TAG_FILTERS_1_0","Query":"\{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[\{\"Key\":\"Stage\",\"Values\":[\"Test\"]\}]\}"\}'</code>
925+
* </p>
926+
* <p>In the preceding example, all of the double quote characters in the value part of the
927+
* <code>Query</code> element must be escaped because the value itself is surrounded by
928+
* double quotes. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html">Quoting
929+
* strings</a> in the <i>Command Line Interface User Guide</i>.</p>
930+
* <p>For the complete list of resource types that you can use in the array value for
931+
* <code>ResourceTypeFilters</code>, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/supported-resources.html">Resources
932+
* you can use with Resource Groups and Tag Editor</a> in the
933+
* <i>Resource Groups User Guide</i>. For example:</p>
934+
* <p>
935+
* <code>"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"]</code>
936+
* </p>
937+
* @public
938+
*/
939+
ResourceQuery?: ResourceQuery | undefined;
940+
909941
/**
910942
* <p>The Amazon resource name (ARN) of the role assumed by Resource Groups to tag and untag resources on your behalf. </p>
911943
* <p>For more information about this role, review <a href="https://docs.aws.amazon.com/servicecatalog/latest/arguide/app-tag-sync.html#tag-sync-role">Tag-sync required permissions</a>.
@@ -1542,7 +1574,7 @@ export interface ListGroupsInput {
15421574
* </li>
15431575
* <li>
15441576
* <p>
1545-
* <code>AWS::AppRegistry::ApplicationResourceGroups</code>
1577+
* <code>AWS::AppRegistry::ApplicationResourceGroup</code>
15461578
* </p>
15471579
* </li>
15481580
* <li>
@@ -1758,6 +1790,38 @@ export interface TagSyncTaskItem {
17581790
*/
17591791
TagValue?: string | undefined;
17601792

1793+
/**
1794+
* <p>The query you can use to define a resource group or a search for resources. A
1795+
* <code>ResourceQuery</code> specifies both a query <code>Type</code> and a
1796+
* <code>Query</code> string as JSON string objects. See the examples section for
1797+
* example JSON strings. For more information about creating a resource group with a
1798+
* resource query, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html">Build queries and groups in
1799+
* Resource Groups</a> in the <i>Resource Groups User Guide</i>
1800+
* </p>
1801+
* <p>When you combine all of the elements together into a single string, any double quotes
1802+
* that are embedded inside another double quote pair must be escaped by preceding the
1803+
* embedded double quote with a backslash character (\). For example, a complete
1804+
* <code>ResourceQuery</code> parameter must be formatted like the following CLI
1805+
* parameter example:</p>
1806+
* <p>
1807+
* <code>--resource-query
1808+
* '\{"Type":"TAG_FILTERS_1_0","Query":"\{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[\{\"Key\":\"Stage\",\"Values\":[\"Test\"]\}]\}"\}'</code>
1809+
* </p>
1810+
* <p>In the preceding example, all of the double quote characters in the value part of the
1811+
* <code>Query</code> element must be escaped because the value itself is surrounded by
1812+
* double quotes. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html">Quoting
1813+
* strings</a> in the <i>Command Line Interface User Guide</i>.</p>
1814+
* <p>For the complete list of resource types that you can use in the array value for
1815+
* <code>ResourceTypeFilters</code>, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/supported-resources.html">Resources
1816+
* you can use with Resource Groups and Tag Editor</a> in the
1817+
* <i>Resource Groups User Guide</i>. For example:</p>
1818+
* <p>
1819+
* <code>"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"]</code>
1820+
* </p>
1821+
* @public
1822+
*/
1823+
ResourceQuery?: ResourceQuery | undefined;
1824+
17611825
/**
17621826
* <p>The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.</p>
17631827
* @public
@@ -1945,17 +2009,53 @@ export interface StartTagSyncTaskInput {
19452009
* <p>The tag key. Resources tagged with this tag key-value pair will be added to
19462010
* the application. If a resource with this tag is later untagged, the tag-sync task removes
19472011
* the resource from the application. </p>
2012+
* <p>When using the <code>TagKey</code> parameter, you must also specify the <code>TagValue</code> parameter. If you specify a tag key-value pair,
2013+
* you can't use the <code>ResourceQuery</code> parameter. </p>
19482014
* @public
19492015
*/
1950-
TagKey: string | undefined;
2016+
TagKey?: string | undefined;
19512017

19522018
/**
19532019
* <p>The tag value. Resources tagged with this tag key-value pair will be added to
19542020
* the application. If a resource with this tag is later untagged, the tag-sync task removes
19552021
* the resource from the application. </p>
2022+
* <p>When using the <code>TagValue</code> parameter, you must also specify the <code>TagKey</code> parameter. If you specify a tag key-value pair,
2023+
* you can't use the <code>ResourceQuery</code> parameter. </p>
19562024
* @public
19572025
*/
1958-
TagValue: string | undefined;
2026+
TagValue?: string | undefined;
2027+
2028+
/**
2029+
* <p>The query you can use to create the tag-sync task. With this method, all resources matching the query
2030+
* are added to the specified application group. A
2031+
* <code>ResourceQuery</code> specifies both a query <code>Type</code> and a
2032+
* <code>Query</code> string as JSON string objects. For more information on defining a resource query for a
2033+
* tag-sync task, see the tag-based query type in <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html#getting_started-query_types">
2034+
* Types of resource group queries</a> in <i>Resource Groups User Guide</i>. </p>
2035+
* <p>When using the <code>ResourceQuery</code> parameter, you cannot use the <code>TagKey</code> and <code>TagValue</code> parameters. </p>
2036+
* <p>When you combine all of the elements together into a single string, any double quotes
2037+
* that are embedded inside another double quote pair must be escaped by preceding the
2038+
* embedded double quote with a backslash character (\). For example, a complete
2039+
* <code>ResourceQuery</code> parameter must be formatted like the following CLI
2040+
* parameter example:</p>
2041+
* <p>
2042+
* <code>--resource-query
2043+
* '\{"Type":"TAG_FILTERS_1_0","Query":"\{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[\{\"Key\":\"Stage\",\"Values\":[\"Test\"]\}]\}"\}'</code>
2044+
* </p>
2045+
* <p>In the preceding example, all of the double quote characters in the value part of the
2046+
* <code>Query</code> element must be escaped because the value itself is surrounded by
2047+
* double quotes. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html">Quoting
2048+
* strings</a> in the <i>Command Line Interface User Guide</i>.</p>
2049+
* <p>For the complete list of resource types that you can use in the array value for
2050+
* <code>ResourceTypeFilters</code>, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/supported-resources.html">Resources
2051+
* you can use with Resource Groups and Tag Editor</a> in the
2052+
* <i>Resource Groups User Guide</i>. For example:</p>
2053+
* <p>
2054+
* <code>"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"]</code>
2055+
* </p>
2056+
* @public
2057+
*/
2058+
ResourceQuery?: ResourceQuery | undefined;
19592059

19602060
/**
19612061
* <p>The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.</p>
@@ -1998,6 +2098,38 @@ export interface StartTagSyncTaskOutput {
19982098
*/
19992099
TagValue?: string | undefined;
20002100

2101+
/**
2102+
* <p>The query you can use to define a resource group or a search for resources. A
2103+
* <code>ResourceQuery</code> specifies both a query <code>Type</code> and a
2104+
* <code>Query</code> string as JSON string objects. See the examples section for
2105+
* example JSON strings. For more information about creating a resource group with a
2106+
* resource query, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html">Build queries and groups in
2107+
* Resource Groups</a> in the <i>Resource Groups User Guide</i>
2108+
* </p>
2109+
* <p>When you combine all of the elements together into a single string, any double quotes
2110+
* that are embedded inside another double quote pair must be escaped by preceding the
2111+
* embedded double quote with a backslash character (\). For example, a complete
2112+
* <code>ResourceQuery</code> parameter must be formatted like the following CLI
2113+
* parameter example:</p>
2114+
* <p>
2115+
* <code>--resource-query
2116+
* '\{"Type":"TAG_FILTERS_1_0","Query":"\{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[\{\"Key\":\"Stage\",\"Values\":[\"Test\"]\}]\}"\}'</code>
2117+
* </p>
2118+
* <p>In the preceding example, all of the double quote characters in the value part of the
2119+
* <code>Query</code> element must be escaped because the value itself is surrounded by
2120+
* double quotes. For more information, see <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html">Quoting
2121+
* strings</a> in the <i>Command Line Interface User Guide</i>.</p>
2122+
* <p>For the complete list of resource types that you can use in the array value for
2123+
* <code>ResourceTypeFilters</code>, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/supported-resources.html">Resources
2124+
* you can use with Resource Groups and Tag Editor</a> in the
2125+
* <i>Resource Groups User Guide</i>. For example:</p>
2126+
* <p>
2127+
* <code>"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"]</code>
2128+
* </p>
2129+
* @public
2130+
*/
2131+
ResourceQuery?: ResourceQuery | undefined;
2132+
20012133
/**
20022134
* <p>The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.</p>
20032135
* @public

clients/client-resource-groups/src/protocols/Aws_restJson1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ export const se_StartTagSyncTaskCommand = async (
460460
body = JSON.stringify(
461461
take(input, {
462462
Group: [],
463+
ResourceQuery: (_) => _json(_),
463464
RoleArn: [],
464465
TagKey: [],
465466
TagValue: [],
@@ -792,6 +793,7 @@ export const de_GetTagSyncTaskCommand = async (
792793
ErrorMessage: __expectString,
793794
GroupArn: __expectString,
794795
GroupName: __expectString,
796+
ResourceQuery: _json,
795797
RoleArn: __expectString,
796798
Status: __expectString,
797799
TagKey: __expectString,
@@ -974,6 +976,7 @@ export const de_StartTagSyncTaskCommand = async (
974976
const doc = take(data, {
975977
GroupArn: __expectString,
976978
GroupName: __expectString,
979+
ResourceQuery: _json,
977980
RoleArn: __expectString,
978981
TagKey: __expectString,
979982
TagValue: __expectString,
@@ -1411,6 +1414,7 @@ const de_TagSyncTaskItem = (output: any, context: __SerdeContext): TagSyncTaskIt
14111414
ErrorMessage: __expectString,
14121415
GroupArn: __expectString,
14131416
GroupName: __expectString,
1417+
ResourceQuery: _json,
14141418
RoleArn: __expectString,
14151419
Status: __expectString,
14161420
TagKey: __expectString,

0 commit comments

Comments
 (0)