Skip to content

tag_resource

tag_resource(
    resource_arn: AmazonResourceName,
    tags: TagList,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
) -> TagResourceResponse

Applies the specified tags to the specified WorkMailorganization resource.

Parameters:

Raises:

Source code in docs_src/capo_workmail/_services/work_mail.py
def tag_resource(
    self,
    resource_arn: "capo_workmail.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_workmail.types.tag_list.TagList",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
) -> "capo_workmail.types.tag_resource_response.TagResourceResponse":
    """<p>Applies the specified tags to the specified WorkMailorganization resource.</p>

    Args:
        resource_arn: <p>The resource ARN.</p>
        tags: <p>The tag key-value pairs.</p>

    Raises:
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource cannot be found.</p>
        capo_workmail.errors.too_many_tags_exception.TooManyTagsException: <p>The resource can have up to 50 user-applied tags.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        output, http_response = (
            capo_workmail._operations.work_mail_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_workmail.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