Skip to content

remove_tags

remove_tags(
    resource_id: String,
    tags_list: TagsList,
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
) -> RemoveTagsResponse

Removes the specified tags from a trail, event data store, dashboard, or channel.

Parameters:

  • resource_id (String) –

    Specifies the ARN of the trail, event data store, dashboard, or channel from which tags should be removed.

    Example trail ARN format: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    Example event data store ARN format: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

    Example dashboard ARN format: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash

    Example channel ARN format: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

  • tags_list (TagsList) –

    Specifies a list of tags to be removed.

Raises:

  • ChannelARNInvalidException –

    This exception is thrown when the specified value of ChannelARN is not valid.

  • ChannelNotFoundException –

    This exception is thrown when CloudTrail cannot find the specified channel.

  • CloudTrailARNInvalidException –

    This exception is thrown when an operation is called with an ARN that is not valid.

    The following is the format of a trail ARN: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    The following is the format of an event data store ARN: arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

    The following is the format of a dashboard ARN: arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash

    The following is the format of a channel ARN: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

  • ConflictException –

    This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

  • EventDataStoreARNInvalidException –

    The specified event data store ARN is not valid or does not map to an event data store in your account.

  • EventDataStoreNotFoundException –

    The specified event data store was not found.

  • InactiveEventDataStoreException –

    The event data store is inactive.

  • InvalidTagParameterException –

    This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.

  • InvalidTrailNameException –

    This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:

    • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)

    • Start with a letter or number, and end with a letter or number

    • Be between 3 and 128 characters

    • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.

    • Not be in IP address format (for example, 192.168.5.4)

  • NoManagementAccountSLRExistsException –

    This exception is thrown when the management account does not have a service-linked role.

  • NotOrganizationMasterAccountException –

    This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see Prepare For Creating a Trail For Your Organization or Organization event data stores.

  • OperationNotPermittedException –

    This exception is thrown when the requested operation is not permitted.

  • ResourceNotFoundException –

    This exception is thrown when the specified resource is not found.

  • ResourceTypeNotSupportedException –

    This exception is thrown when the specified resource type is not supported by CloudTrail.

  • UnsupportedOperationException –

    This exception is thrown when the requested operation is not supported.

  • UnknownServiceError –

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

Source code in docs_src/capo_cloudtrail/_services/cloud_trail.py
def remove_tags(
    self,
    resource_id: "capo_cloudtrail.types.string.String",
    tags_list: "capo_cloudtrail.types.tags_list.TagsList",
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
) -> "capo_cloudtrail.types.remove_tags_response.RemoveTagsResponse":
    """<p>Removes the specified tags from a trail, event data store, dashboard, or channel.</p>

    Args:
        resource_id: <p>Specifies the ARN of the trail, event data store, dashboard, or channel from which tags should be removed.</p> <p> Example trail ARN format: <code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code> </p> <p>Example event data store ARN format: <code>arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE</code> </p> <p>Example dashboard ARN format: <code>arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash</code> </p> <p>Example channel ARN format: <code>arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890</code> </p>
        tags_list: <p>Specifies a list of tags to be removed.</p>

    Raises:
        capo_cloudtrail.errors.channel_arn_invalid_exception.ChannelARNInvalidException: <p>This exception is thrown when the specified value of <code>ChannelARN</code> is not valid.</p>
        capo_cloudtrail.errors.channel_not_found_exception.ChannelNotFoundException: <p>This exception is thrown when CloudTrail cannot find the specified channel.</p>
        capo_cloudtrail.errors.cloud_trail_arn_invalid_exception.CloudTrailARNInvalidException: <p>This exception is thrown when an operation is called with an ARN that is not valid.</p> <p>The following is the format of a trail ARN: <code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code> </p> <p>The following is the format of an event data store ARN: <code>arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE</code> </p> <p>The following is the format of a dashboard ARN: <code>arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDash</code> </p> <p>The following is the format of a channel ARN: <code>arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890</code> </p>
        capo_cloudtrail.errors.conflict_exception.ConflictException: <p>This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.</p>
        capo_cloudtrail.errors.event_data_store_arn_invalid_exception.EventDataStoreARNInvalidException: <p>The specified event data store ARN is not valid or does not map to an event data store in your account.</p>
        capo_cloudtrail.errors.event_data_store_not_found_exception.EventDataStoreNotFoundException: <p>The specified event data store was not found.</p>
        capo_cloudtrail.errors.inactive_event_data_store_exception.InactiveEventDataStoreException: <p>The event data store is inactive.</p>
        capo_cloudtrail.errors.invalid_tag_parameter_exception.InvalidTagParameterException: <p>This exception is thrown when the specified tag key or values are not valid. It can also occur if there are duplicate tags or too many tags on the resource.</p>
        capo_cloudtrail.errors.invalid_trail_name_exception.InvalidTrailNameException: <p>This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:</p> <ul> <li> <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p> </li> <li> <p>Start with a letter or number, and end with a letter or number</p> </li> <li> <p>Be between 3 and 128 characters</p> </li> <li> <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p> </li> <li> <p>Not be in IP address format (for example, 192.168.5.4)</p> </li> </ul>
        capo_cloudtrail.errors.no_management_account_slr_exists_exception.NoManagementAccountSLRExistsException: <p> This exception is thrown when the management account does not have a service-linked role. </p>
        capo_cloudtrail.errors.not_organization_master_account_exception.NotOrganizationMasterAccountException: <p>This exception is thrown when the Amazon Web Services account making the request to create or update an organization trail or event data store is not the management account for an organization in Organizations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/creating-an-organizational-trail-prepare.html">Prepare For Creating a Trail For Your Organization</a> or <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-organizations.html">Organization event data stores</a>.</p>
        capo_cloudtrail.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>This exception is thrown when the requested operation is not permitted.</p>
        capo_cloudtrail.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when the specified resource is not found.</p>
        capo_cloudtrail.errors.resource_type_not_supported_exception.ResourceTypeNotSupportedException: <p>This exception is thrown when the specified resource type is not supported by CloudTrail.</p>
        capo_cloudtrail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>This exception is thrown when the requested operation is not supported.</p>
        capo_cloudtrail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudtrail.types.remove_tags_request.RemoveTagsRequest]",
    ) -> OperationResponse[
        "capo_cloudtrail.types.remove_tags_response.RemoveTagsResponse"
    ]:
        import capo_cloudtrail._operations.cloud_trail_20131101.remove_tags

        output, http_response = (
            capo_cloudtrail._operations.cloud_trail_20131101.remove_tags.remove_tags(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RemoveTags")
    )
    input_: capo_cloudtrail.types.remove_tags_request.RemoveTagsRequest = {
        "resource_id": resource_id,
        "tags_list": tags_list,
    }

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