/AWS1/CL_RGR=>STARTTAGSYNCTASK()
¶
About StartTagSyncTask¶
Creates a new tag-sync task to onboard and sync resources tagged with a specific tag key-value pair to an application. To start a tag-sync task, you need a resource tagging role. The resource tagging role grants permissions to tag and untag applications resources and must include a trust policy that allows Resource Groups to assume the role and perform resource tagging tasks on your behalf.
For instructions on creating a tag-sync task, see Create a tag-sync using the Resource Groups API in the Amazon Web Services Service Catalog AppRegistry Administrator Guide.
Minimum permissions
To run this command, you must have the following permissions:
-
resource-groups:StartTagSyncTask
on the application group -
resource-groups:CreateGroup
-
iam:PassRole
on the role provided in the request
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_group
TYPE /AWS1/RGRGROUPSTRINGV2
/AWS1/RGRGROUPSTRINGV2
¶
The Amazon resource name (ARN) or name of the application group for which you want to create a tag-sync task.
iv_rolearn
TYPE /AWS1/RGRROLEARN
/AWS1/RGRROLEARN
¶
The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.
Optional arguments:¶
iv_tagkey
TYPE /AWS1/RGRTAGKEY
/AWS1/RGRTAGKEY
¶
The tag key. Resources tagged with this tag key-value pair will be added to the application. If a resource with this tag is later untagged, the tag-sync task removes the resource from the application.
When using the
TagKey
parameter, you must also specify theTagValue
parameter. If you specify a tag key-value pair, you can't use theResourceQuery
parameter.
iv_tagvalue
TYPE /AWS1/RGRTAGVALUE
/AWS1/RGRTAGVALUE
¶
The tag value. Resources tagged with this tag key-value pair will be added to the application. If a resource with this tag is later untagged, the tag-sync task removes the resource from the application.
When using the
TagValue
parameter, you must also specify theTagKey
parameter. If you specify a tag key-value pair, you can't use theResourceQuery
parameter.
io_resourcequery
TYPE REF TO /AWS1/CL_RGRRESOURCEQUERY
/AWS1/CL_RGRRESOURCEQUERY
¶
The query you can use to create the tag-sync task. With this method, all resources matching the query are added to the specified application group. A
ResourceQuery
specifies both a queryType
and aQuery
string as JSON string objects. For more information on defining a resource query for a tag-sync task, see the tag-based query type in Types of resource group queries in Resource Groups User Guide.When using the
ResourceQuery
parameter, you cannot use theTagKey
andTagValue
parameters.When you combine all of the elements together into a single string, any double quotes that are embedded inside another double quote pair must be escaped by preceding the embedded double quote with a backslash character (). For example, a complete
ResourceQuery
parameter must be formatted like the following CLI parameter example:
--resource-query '{"Type":"TAG_FILTERS_1_0","Query":"{\"ResourceTypeFilters\":[\"AWS::AllSupported\"],\"TagFilters\":[{\"Key\":\"Stage\",\"Values\":[\"Test\"]}]}"}'
In the preceding example, all of the double quote characters in the value part of the
Query
element must be escaped because the value itself is surrounded by double quotes. For more information, see Quoting strings in the Command Line Interface User Guide.For the complete list of resource types that you can use in the array value for
ResourceTypeFilters
, see Resources you can use with Resource Groups and Tag Editor in the Resource Groups User Guide. For example:
"ResourceTypeFilters":["AWS::S3::Bucket", "AWS::EC2::Instance"]
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_rgrstrttagsynctaskout
/AWS1/CL_RGRSTRTTAGSYNCTASKOUT
¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->/aws1/if_rgr~starttagsynctask(
io_resourcequery = new /aws1/cl_rgrresourcequery(
iv_query = |string|
iv_type = |string|
)
iv_group = |string|
iv_rolearn = |string|
iv_tagkey = |string|
iv_tagvalue = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_grouparnv2 = lo_result->get_grouparn( ).
lv_groupname = lo_result->get_groupname( ).
lv_tagsynctaskarn = lo_result->get_taskarn( ).
lv_tagkey = lo_result->get_tagkey( ).
lv_tagvalue = lo_result->get_tagvalue( ).
lo_resourcequery = lo_result->get_resourcequery( ).
IF lo_resourcequery IS NOT INITIAL.
lv_querytype = lo_resourcequery->get_type( ).
lv_query = lo_resourcequery->get_query( ).
ENDIF.
lv_rolearn = lo_result->get_rolearn( ).
ENDIF.