start_tag_sync_task
¶
start_tag_sync_task(
group: GroupStringV2,
role_arn: RoleArn,
*,
config_overrides: Optional[ResourceGroupsClientConfig] = None,
tag_key: Optional[TagKey] = None,
tag_value: Optional[TagValue] = None,
resource_query: Optional[ResourceQuery] = None,
) -> StartTagSyncTaskOutput
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:StartTagSyncTaskon the application group -
resource-groups:CreateGroup -
iam:PassRoleon the role provided in the request
Parameters:
-
group(GroupStringV2) –The Amazon resource name (ARN) or name of the application group for which you want to create a tag-sync task.
-
tag_key(Optional[TagKey], default:None) –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
TagKeyparameter, you must also specify theTagValueparameter. If you specify a tag key-value pair, you can't use theResourceQueryparameter. -
tag_value(Optional[TagValue], default:None) –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
TagValueparameter, you must also specify theTagKeyparameter. If you specify a tag key-value pair, you can't use theResourceQueryparameter. -
resource_query(Optional[ResourceQuery], default:None) –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
ResourceQueryspecifies both a queryTypeand aQuerystring 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
ResourceQueryparameter, you cannot use theTagKeyandTagValueparameters.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
ResourceQueryparameter 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
Queryelement 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"] -
role_arn(RoleArn) –The Amazon resource name (ARN) of the role assumed by the service to tag and untag resources on your behalf.
Raises:
-
BadRequestException–The request includes one or more parameters that violate validation rules.
-
ForbiddenException–The caller isn't authorized to make the request. Check permissions.
-
InternalServerErrorException–An internal error occurred while processing the request. Try again later.
-
MethodNotAllowedException–The request uses an HTTP method that isn't allowed for the specified resource.
-
NotFoundException–One or more of the specified resources don't exist.
-
TooManyRequestsException–You've exceeded throttling limits by making too many requests in a period of time.
-
UnauthorizedException–The request was rejected because it doesn't have valid credentials for the target resource.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_resource_groups/_services/resource_groups.py
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | |