Skip to content

untag_log_group

untag_log_group(
    log_group_name: LogGroupName,
    tags: TagList,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None

The UntagLogGroup operation is on the path to deprecation. We recommend that you use UntagResource instead.

Removes the specified tags from the specified log group.

To list the tags for a log group, use ListTagsForResource. To add tags, use TagResource.

When using IAM policies to control tag management for CloudWatch Logs log groups, the condition keys aws:Resource/key-name and aws:TagKeys cannot be used to restrict which tags users can assign.

Parameters:

  • log_group_name (LogGroupName) –

    The name of the log group.

  • tags (TagList) –

    The tag keys. The corresponding tags are removed from the log group.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def untag_log_group(
    self,
    log_group_name: "capo_cloudwatch_logs.types.log_group_name.LogGroupName",
    tags: "capo_cloudwatch_logs.types.tag_list.TagList",
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None:
    """<important> <p>The UntagLogGroup operation is on the path to deprecation. We recommend that you use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html">UntagResource</a> instead.</p> </important> <p>Removes the specified tags from the specified log group.</p> <p>To list the tags for a log group, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html">ListTagsForResource</a>. To add tags, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html">TagResource</a>.</p> <p>When using IAM policies to control tag management for CloudWatch Logs log groups, the condition keys <code>aws:Resource/key-name</code> and <code>aws:TagKeys</code> cannot be used to restrict which tags users can assign. </p>

    Args:
        log_group_name: <p>The name of the log group.</p>
        tags: <p>The tag keys. The corresponding tags are removed from the log group.</p>

    Raises:
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch_logs.types.untag_log_group_request.UntagLogGroupRequest]",
    ) -> OperationResponse[None]:
        import capo_cloudwatch_logs._operations.logs_20140328.untag_log_group

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.untag_log_group.untag_log_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UntagLogGroup")
    )
    input_: capo_cloudwatch_logs.types.untag_log_group_request.UntagLogGroupRequest = {
        "log_group_name": log_group_name,
        "tags": tags,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output