Skip to content

Commit

Permalink
doc: Document deleting and restoring entities (#1182)
Browse files Browse the repository at this point in the history
* doc: Document deleting and restoring entities

* fixup! doc: Document deleting and restoring entities

* fixup! doc: Document deleting and restoring entities
  • Loading branch information
nejraselimovic authored Oct 5, 2023
1 parent c6dabac commit 553b680
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 14 deletions.
104 changes: 90 additions & 14 deletions doc/content/the-things-stack/management/purge/_index.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,99 @@
---
title: "Purging Entities"
title: "Deleting, Restoring and Purging Entities"
description: ""
weight:
aliases: [/reference/purge]
---

When entities are deleted, {{% tts %}} [retains some IDs]({{< ref "reference/id-eui-constraints" >}}) by default to prevent another user re-registering the ID and obtaining historical data.
When entities are deleted, {{% tts %}} [retains some IDs]({{< ref "reference/id-eui-constraints" >}}) by default to prevent another user re-registering the ID and obtaining historical data. Deleted entities can be restored within a limited time period, but it is also possible for administrators to purge these entities, so that their IDs may be reused.

It is also possible for administrators to purge IDs so that they may be reused. This reference contains information about how to do this, and the implications of purging IDs.
This reference contains information about how to do delete, restore and purge entities.

<!--more-->

{{< note >}} End devices cannot be soft deleted, i.e. once they are deleted, they cannot be restored anymore. Hence, information below regarding restoring and manual purging refers to other entities - applications, gateways, clients, users and organizations. {{</ note >}}

## Deleting and Restoring Entities

{{< tabs/container "Console" "CLI" >}}

{{< tabs/tab "Console" >}}

Go to the **General Settings** tab of the entity and click **Delete**.

{{< figure src="delete.png" >}}

If you are an administrator, you will also be presented with the option to purge the entity. For implications of purging entities and other details, check [sections below]({{< relref "#what-happens-to-purged-entities" >}}).

{{</ tabs/tab >}}

{{< tabs/tab "CLI" >}}

To delete an end device (keep in mind the note above!):

```bash
ttn-lw-cli applications delete --application-id <application-id> --device-id <device-id>
```

To delete an application:

```bash
ttn-lw-cli applications delete --application-id <application-id>
```

To delete a client:

```bash
ttn-lw-cli clients delete --client-id <client-id>
```

To delete a gateway:

```bash
# By EUI
ttn-lw-cli gateways delete --gateway-eui <gateway-eui>
# Or by ID
ttn-lw-cli gateways delete --gateway-id <gateway-id>
```

To delete an organization:

```bash
ttn-lw-cli organizations delete --organization-id <organization-id>
```

To delete a user:

```bash
ttn-lw-cli users delete --user-id <user-id>
```

{{</ tabs/tab >}}

{{</ tabs/container >}}

When entities are deleted, there is a default time period of 24h when an administrator can restore them. For {{% tts %}} Enterprise deployments, it is possible to configure this restoration period. For more info, check [Identity Server Options]({{< ref "/reference/configuration/identity-server#general-options" >}}).

Note again that restoring entities is not possible if they have been purged.

{{< tabs/container "Console" "CLI" >}}

{{< tabs/tab "Console" >}}

To restore an entity using the Console, navigate to the **Deleted (Admin)** tab for the entity of interest, and click **Restore**.

{{< figure src="restore-app.png" >}}

{{< /tabs/tab >}}

{{< tabs/tab "CLI" >}}

To restore an entity using the CLI, just replace `delete` with `restore` in commands presented above.

{{< /tabs/tab >}}

{{< /tabs/container >}}

## What Happens to Purged Entities?

Only administrators may purge entities. Purging an entity has the following effects:
Expand All @@ -37,24 +120,17 @@ Purging entities using the Console or the CLI is usually most convenient, so tho

{{< tabs/tab "Console" >}}

Go to the **General Settings** tab of the entity and click **Delete**.

{{< figure src="delete.png" >}}

If you are an administrator, you will be presented with the option to purge the entity. Check the **Also release entity IDs** box to also purge the entity.
There are two ways to purge an entity:
- Go to the **General Settings** tab of the entity and click **Delete**. If you are an administrator, you will be presented with the option to purge the entity. Check the **Also release entity IDs** box to also purge the entity.

{{< figure src="purge.png" >}}

- After soft-deleting the entity with **Delete**, navigate to the **Deleted (Admin)** panel (the same panel where you restore entities), find your deleted entity and click **Purge**.

{{</ tabs/tab >}}

{{< tabs/tab "CLI" >}}

To view soft-deleted users:

```bash
ttn-lw-cli user list --deleted --all
```

To purge an application:

```bash
Expand Down
Binary file modified doc/content/the-things-stack/management/purge/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/content/the-things-stack/management/purge/purge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 553b680

Please sign in to comment.