Assigns a set of tags to the specified Amazon Cognito identity pool. A tag is a label that you can use to categorize and manage identity pools in different ways, such as by purpose, owner, environment, or other criteria.
Each tag consists of a key and value, both of which you define. A key is a general category for more specific values. For example, if you have two versions of an identity pool, one for testing and another for production, you might assign an Environment tag key to both identity pools. The value of this key might be Test for one identity pool and Production for the other.
Tags are useful for cost tracking and access control. You can activate your tags so that they appear on the Billing and Cost Management console, where you can track the costs associated with your identity pools. In an IAM policy, you can constrain permissions for identity pools based on specific tags or tag values.
You can use this action up to 5 times per second, per account. An identity pool can have as many as 50 tags.
Parameters:
-
resource_arn
(ARNString)
–
The Amazon Resource Name (ARN) of the identity pool.
-
tags
(IdentityPoolTagsType)
–
The tags to assign to the identity pool.
Raises:
Source code in docs_src/capo_cognito_identity/_services/cognito_identity.py
| def tag_resource(
self,
resource_arn: "capo_cognito_identity.types.arn_string.ARNString",
tags: "capo_cognito_identity.types.identity_pool_tags_type.IdentityPoolTagsType",
*,
config_overrides: Optional[CognitoIdentityClientConfig] = None,
) -> "capo_cognito_identity.types.tag_resource_response.TagResourceResponse":
"""<p>Assigns a set of tags to the specified Amazon Cognito identity pool. A tag is a label that you can use to categorize and manage identity pools in different ways, such as by purpose, owner, environment, or other criteria.</p> <p>Each tag consists of a key and value, both of which you define. A key is a general category for more specific values. For example, if you have two versions of an identity pool, one for testing and another for production, you might assign an <code>Environment</code> tag key to both identity pools. The value of this key might be <code>Test</code> for one identity pool and <code>Production</code> for the other.</p> <p>Tags are useful for cost tracking and access control. You can activate your tags so that they appear on the Billing and Cost Management console, where you can track the costs associated with your identity pools. In an IAM policy, you can constrain permissions for identity pools based on specific tags or tag values.</p> <p>You can use this action up to 5 times per second, per account. An identity pool can have as many as 50 tags.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the identity pool.</p>
tags: <p>The tags to assign to the identity pool.</p>
Raises:
capo_cognito_identity.errors.internal_error_exception.InternalErrorException: <p>Thrown when the service encounters an error during processing the request.</p>
capo_cognito_identity.errors.invalid_parameter_exception.InvalidParameterException: <p>Thrown for missing or bad input parameter(s).</p>
capo_cognito_identity.errors.not_authorized_exception.NotAuthorizedException: <p>Thrown when a user is not authorized to access the requested resource.</p>
capo_cognito_identity.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when the requested resource (for example, a dataset or record) does not exist.</p>
capo_cognito_identity.errors.too_many_requests_exception.TooManyRequestsException: <p>Thrown when a request is throttled.</p>
capo_cognito_identity.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cognito_identity.types.tag_resource_input.TagResourceInput]",
) -> OperationResponse[
"capo_cognito_identity.types.tag_resource_response.TagResourceResponse"
]:
import capo_cognito_identity._operations.aws_cognito_identity_service.tag_resource
output, http_response = (
capo_cognito_identity._operations.aws_cognito_identity_service.tag_resource.tag_resource(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TagResource")
)
input_: capo_cognito_identity.types.tag_resource_input.TagResourceInput = {
"resource_arn": resource_arn,
"tags": tags,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|