Skip to content

tag_resource

tag_resource(
    resource_arn: Arn,
    tags: TagList,
    *,
    config_overrides: Optional[SFNClientConfig] = None,
) -> TagResourceOutput

Add a tag to a Step Functions resource.

An array of key-value pairs. For more information, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide, and Controlling Access Using IAM Tags.

Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) for the Step Functions state machine or activity.

  • tags (TagList) –

    The list of tags to add to a resource.

    Tags may only contain Unicode letters, digits, white space, or these symbols: _ . : / = + - @.

Raises:

  • InvalidArn –

    The provided Amazon Resource Name (ARN) is not valid.

  • ResourceNotFound –

    Could not find the referenced resource.

  • TooManyTags –

    You've exceeded the number of tags allowed for a resource. See the Limits Topic in the Step Functions Developer Guide.

  • UnknownServiceError –

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

Source code in docs_src/capo_sfn/_services/sfn.py
def tag_resource(
    self,
    resource_arn: "capo_sfn.types.arn.Arn",
    tags: "capo_sfn.types.tag_list.TagList",
    *,
    config_overrides: Optional[SFNClientConfig] = None,
) -> "capo_sfn.types.tag_resource_output.TagResourceOutput":
    """<p>Add a tag to a Step Functions resource.</p> <p>An array of key-value pairs. For more information, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html">Using Cost Allocation Tags</a> in the <i>Amazon Web Services Billing and Cost Management User Guide</i>, and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_iam-tags.html">Controlling Access Using IAM Tags</a>.</p> <p>Tags may only contain Unicode letters, digits, white space, or these symbols: <code>_ . : / = + - @</code>.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) for the Step Functions state machine or activity.</p>
        tags: <p>The list of tags to add to a resource.</p> <p>Tags may only contain Unicode letters, digits, white space, or these symbols: <code>_ . : / = + - @</code>.</p>

    Raises:
        capo_sfn.errors.invalid_arn.InvalidArn: <p>The provided Amazon Resource Name (ARN) is not valid.</p>
        capo_sfn.errors.resource_not_found.ResourceNotFound: <p>Could not find the referenced resource.</p>
        capo_sfn.errors.too_many_tags.TooManyTags: <p>You've exceeded the number of tags allowed for a resource. See the <a href="https://docs.aws.amazon.com/step-functions/latest/dg/limits.html"> Limits Topic</a> in the Step Functions Developer Guide.</p>
        capo_sfn.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sfn.types.tag_resource_input.TagResourceInput]",
    ) -> OperationResponse["capo_sfn.types.tag_resource_output.TagResourceOutput"]:
        import capo_sfn._operations.aws_step_functions.tag_resource

        output, http_response = (
            capo_sfn._operations.aws_step_functions.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_sfn.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