Skip to content

tag_resource

tag_resource(
    resource_arn: Arn,
    tags: RequestTagMap,
    *,
    config_overrides: Optional[PCSClientConfig] = None,
) -> TagResourceResponse

Adds or edits tags on an PCS resource. Each tag consists of a tag key and a tag value. The tag key and tag value are case-sensitive strings. The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag value. To edit a tag, specify an existing tag key and a new tag value.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the resource.

  • tags (RequestTagMap) –

    1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.

Raises:

  • ResourceNotFoundException –

    The requested resource can't be found. The cluster, node group, or queue you're attempting to get, update, list, or delete doesn't exist.

    Examples

  • ServiceQuotaExceededException –

    You exceeded your service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account. To learn how to increase your service quota, see Requesting a quota increase in the Service Quotas User Guide

    Examples

    • The max number of clusters or queues has been reached for the account.

    • The max number of compute node groups has been reached for the associated cluster.

    • The total of maxInstances across all compute node groups has been reached for associated cluster.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_pcs/_services/pcs.py
def tag_resource(
    self,
    resource_arn: "capo_pcs.types.arn.Arn",
    tags: "capo_pcs.types.request_tag_map.RequestTagMap",
    *,
    config_overrides: Optional[PCSClientConfig] = None,
) -> "capo_pcs.types.tag_resource_response.TagResourceResponse":
    """<p>Adds or edits tags on an PCS resource. Each tag consists of a tag key and a tag value. The tag key and tag value are case-sensitive strings. The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag value. To edit a tag, specify an existing tag key and a new tag value.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
        tags: <p>1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.</p>

    Raises:
        capo_pcs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource can't be found. The cluster, node group, or queue you're attempting to get, update, list, or delete doesn't exist.</p> <p> <u>Examples</u> </p>
        capo_pcs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You exceeded your service quota. Service quotas, also referred to as limits, are the maximum number of service resources or operations for your Amazon Web Services account. To learn how to increase your service quota, see <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html">Requesting a quota increase</a> in the <i>Service Quotas User Guide</i> </p> <p> <u>Examples</u> </p> <ul> <li> <p>The max number of clusters or queues has been reached for the account.</p> </li> <li> <p>The max number of compute node groups has been reached for the associated cluster.</p> </li> <li> <p>The total of <code>maxInstances</code> across all compute node groups has been reached for associated cluster.</p> </li> </ul>
        capo_pcs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_pcs.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[
        "capo_pcs.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_pcs._operations.aws_parallel_computing_service.tag_resource

        output, http_response = (
            capo_pcs._operations.aws_parallel_computing_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_pcs.types.tag_resource_request.TagResourceRequest = {
        "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