Rename snapshot -> backup (#963)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Joakim Sørensen 2021-07-27 10:10:38 +02:00 committed by GitHub
parent 99986314be
commit c5656e0c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 174 additions and 174 deletions

View File

@ -179,10 +179,10 @@ image: repo/{arch}-my-custom-addon
| panel_icon | string | no | Default: `mdi:puzzle`. MDI icon for the menu panel integration.
| panel_title | string | no | Default is the add-on name, but can be modified with this option.
| panel_admin | bool | no | Default `true`. Make menu entry only available with admin privileged.
| snapshot | string | no | `hot` (default) or `cold`. If `cold`, the supervisor turns the add-on off before taking a snapshot (the `pre/post` options are ignored when `cold` is used).
| snapshot_pre | string | no | Command to execute in the context of the add-on before the snapshot is taken.
| snapshot_post | string | no | Command to execute in the context of the add-on after the snapshot was taken.
| snapshot_exclude | list | no | List of file/path (with glob support) that are excluded from snapshots.
| backup | string | no | `hot` (default) or `cold`. If `cold`, the supervisor turns the add-on off before taking a backup (the `pre/post` options are ignored when `cold` is used).
| backup_pre | string | no | Command to execute in the context of the add-on before the backup is taken.
| backup_post | string | no | Command to execute in the context of the add-on after the backup was taken.
| backup_exclude | list | no | List of file/path (with glob support) that are excluded from backups.
| advanced | bool | no | Default `false`. Make addon visible in simple mode.
| stage | string | no | Default `stable`. Flag add-on with follow attribute: `stable`, `experimental` or `deprecated`
| init | bool | no | Default `true`. Disable the Docker default system init. Use this if the image has its own init system.

View File

@ -14,7 +14,7 @@ For access to Supervisor API you need define a role or you run in default mode.
|------|-------------|
| default | Have access to all `info` calls |
| homeassistant | Can access all Home Assistant API endpoints |
| backup | Can access all snapshot API endpoints |
| backup | Can access all backup API endpoints |
| manager | Is for Add-ons that run CLIs and need extended rights |
| admin | Have access to every API call. That is the only one they can disable/enable the Add-on protection mode |

View File

@ -694,6 +694,149 @@ Reset internal authentication cache, this is useful if you have changed the pass
</ApiEndpoint>
### Backup
<ApiEndpoint path="/backups" method="get">
Return a list of [Backups](api/supervisor/models.md#backup)
**Example response:**
```json
{
"backups": [
{
"slug": "skuwe823",
"date": "2020-09-30T20:25:34.273Z",
"name": "Awesome backup",
"type": "partial",
"protected": true,
"content": {
"homeassistant": true,
"addons": ["awesome_addon"],
"folders": ["ssl", "media"]
}
}
]
}
```
</ApiEndpoint>
<ApiEndpoint path="/backups/new/full" method="post">
Create a full backup.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------------ |
| name | string | True | The name you want to give the backup |
| password | string | True | The password you want to give the backup |
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/backups/new/upload" method="post">
Upload a backup.
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/backups/new/partial" method="post">
Create a partial backup.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------------- |
| name | string | True | The name you want to give the backup |
| password | string | True | The password you want to give the backup |
| addons | list | True | A list of strings representing add-on slugs |
| folders | list | True | A list of strings representing directories |
**You need to supply at least one key in the payload.**
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/backups/reload" method="post">
Reload backup from storage.
</ApiEndpoint>
<ApiEndpoint path="/backups/<backup>/download" method="get">
Download the backup file with the given slug.
</ApiEndpoint>
<ApiEndpoint path="/backups/<backup>/info" method="get">
Returns a [Backup details model](api/supervisor/models.md#backup-details) for the add-on.
</ApiEndpoint>
<ApiEndpoint path="/backups/<backup>" method="delete">
Removes the backup file with the given slug.
</ApiEndpoint>
<ApiEndpoint path="/backups/<backup>/restore/full" method="post">
Does a full restore of the backup with the given slug.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------ |
| password | string | True | The password for the backup if any |
</ApiEndpoint>
<ApiEndpoint path="/backups/<backup>/restore/partial" method="post">
Does a partial restore of the backup with the given slug.
**Payload:**
| key | type | optional | description |
| ------------- | ------- | -------- | ---------------------------------------------- |
| homeassistant | boolean | True | `true` if Home Assistant should be restored |
| addons | list | True | A list of add-on slugs that should be restored |
| folders | list | True | A list of directories that should be restored |
| password | string | True | The password for the backup if any |
**You need to supply at least one key in the payload.**
</ApiEndpoint>
### CLI
<ApiEndpoint path="/cli/info" method="get">
@ -1713,7 +1856,7 @@ Update Home Assistant OS
"suggestions": [
{
"uuid": "B9923620C9A11EBBDC3C403FC2CA371",
"type": "clear_snapshots",
"type": "clear_backups",
"context": "system",
"reference": null
}
@ -1899,149 +2042,6 @@ Deletes the service definitions
</ApiEndpoint>
### Snapshot
<ApiEndpoint path="/snapshots" method="get">
Return a list of [Snapshot models](api/supervisor/models.md#snapshot)
**Example response:**
```json
{
"snapshots": [
{
"slug": "skuwe823",
"date": "2020-09-30T20:25:34.273Z",
"name": "Awesome snapshot",
"type": "partial",
"protected": true,
"content": {
"homeassistant": true,
"addons": ["awesome_addon"],
"folders": ["ssl", "media"]
}
}
]
}
```
</ApiEndpoint>
<ApiEndpoint path="/snapshots/new/full" method="post">
Create a full snapshot.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------------ |
| name | string | True | The name you want to give the snapshot |
| password | string | True | The password you want to give the snapshot |
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/snapshots/new/upload" method="post">
Upload a snapshot.
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/snapshots/new/partial" method="post">
Create a partial snapshot.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------------- |
| name | string | True | The name you want to give the snapshot |
| password | string | True | The password you want to give the snapshot |
| addons | list | True | A list of strings representing add-on slugs |
| folders | list | True | A list of strings representing directories |
**You need to supply at least one key in the payload.**
**Example response:**
```json
{
"slug": "skuwe823"
}
```
</ApiEndpoint>
<ApiEndpoint path="/snapshots/reload" method="post">
Reload snapshots from storage.
</ApiEndpoint>
<ApiEndpoint path="/snapshots/<snapshot>/download" method="get">
Download the snapshot file with the given slug.
</ApiEndpoint>
<ApiEndpoint path="/snapshots/<snapshot>/info" method="get">
Returns a [Snapshot details model](api/supervisor/models.md#snapshot-details) for the add-on.
</ApiEndpoint>
<ApiEndpoint path="/snapshots/<snapshot>" method="delete">
Removes the snapshot file with the given slug.
</ApiEndpoint>
<ApiEndpoint path="/snapshots/<snapshot>/restore/full" method="post">
Does a full restore of the snapshot with the given slug.
**Payload:**
| key | type | optional | description |
| -------- | ------ | -------- | ------------------------------------ |
| password | string | True | The password for the snapshot if any |
</ApiEndpoint>
<ApiEndpoint path="/snapshots/<snapshot>/restore/partial" method="post">
Does a partial restore of the snapshot with the given slug.
**Payload:**
| key | type | optional | description |
| ------------- | ------- | -------- | ---------------------------------------------- |
| homeassistant | boolean | True | `true` if Home Assistant should be restored |
| addons | list | True | A list of add-on slugs that should be restored |
| folders | list | True | A list of directories that should be restored |
| password | string | True | The password for the snapshot if any |
**You need to supply at least one key in the payload.**
</ApiEndpoint>
### Store
<ApiEndpoint path="/store" method="get">
@ -2380,6 +2380,6 @@ Some of the endpoints uses placeholders indicated with `<...>` in the endpoint U
| interface | A valid interface name, example `eth0`, to get the interface name you can call `/network/info`. You can use `default` to get the primary interface |
| registry | A registry hostname defined in the container registry configuration, to get the hostname you can call `/docker/registries` |
| service | The service name for a service on the host. |
| snapshot | A valid snapshot slug, example `skuwe823`, to get the slug you can call `/snapshots` |
| suggestion | A valid suggestion, example `clear_full_snapshot`, to get the suggestion you can call `/resolution` |
| backup | A valid backup slug, example `skuwe823`, to get the slug you can call `/backups` |
| suggestion | A valid suggestion, example `clear_full_backup`, to get the suggestion you can call `/resolution` |
| uuid | The UUID of a discovery service, to get the UUID you can call `/discovery` |

View File

@ -166,39 +166,39 @@ These models are describing objects that are getting returned from the superviso
| available | boolean | `true` if the service is available |
| providers | list | A list of providers for the service |
## Snapshot
## Backup
| key | type | description |
| --------- | ------- | --------------------------------------------------------------------- |
| slug | string | A generated slug for the snapshot |
| date | string | ISO date string representation of the date the snapshot was created |
| name | string | The name given to the snapshot |
| type | string | The type of snapshot (full, partial) |
| protected | boolean | `true` if the snapshot is password protected |
| content | dictionary | A dictionary describing the content of the snapshot |
| slug | string | A generated slug for the backup |
| date | string | ISO date string representation of the date the backup was created |
| name | string | The name given to the backup |
| type | string | The type of backup (full, partial) |
| protected | boolean | `true` if the backup is password protected |
| content | dictionary | A dictionary describing the content of the backup |
### Snapshot -> content
### Backup -> content
The `content` key of a snapshot object contains the following keys:
The `content` key of a backup object contains the following keys:
| key | type | description |
| --------- | ------- | --------------------------------------------------------------------- |
| homeassistant | boolean | `true` if the snapshot contains homeassistant
| addons | list | A list of add-on slugs included in the snapshot
| folders | list | A list of folder names included in the snapshot
| homeassistant | boolean | `true` if the backup contains homeassistant
| addons | list | A list of add-on slugs included in the backup
| folders | list | A list of folder names included in the backup
## Snapshot details
## Backup details
| key | type | description |
| ------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| slug | string | A generated slug for the snapshot |
| type | string | The type of snapshot (full, partial) |
| name | string | The name given to the snapshot |
| date | string | ISO date string representation of the date the snapshot was created |
| size | string | The size of the snapshot in MB |
| protected | boolean | `true` if the snapshot is password protected |
| slug | string | A generated slug for the backup |
| type | string | The type of backup (full, partial) |
| name | string | The name given to the backup |
| date | string | ISO date string representation of the date the backup was created |
| size | string | The size of the backup in MB |
| protected | boolean | `true` if the backup is password protected |
| homeassistant | string | The version of Home Assistant that was in use |
| addons | list | A list of add-ons in the snapshot, addons are represented as a dictionary with these keys [`slug`,`name`,`version`,`size`] |
| addons | list | A list of add-ons in the backup, addons are represented as a dictionary with these keys [`slug`,`name`,`version`,`size`] |
| repositories | list | A list of add-on repository URL's as strings |
| folders | list | A list of strings representing directories |

View File

@ -130,11 +130,11 @@ this.hass.callWS({
### `hass.callApi(method, path, data)`
Call an API on the Home Assistant server. For example, if you want to fetch all Home Assistant snapshots by issuing a GET request to `/api/hassio/snapshots`:
Call an API on the Home Assistant server. For example, if you want to fetch all Home Assistant backups by issuing a GET request to `/api/hassio/backups`:
```js
hass.callApi('get', 'hassio/snapshots')
.then(snapshots => console.log('Received snapshots!', snapshots));
hass.callApi('get', 'hassio/backups')
.then(backups => console.log('Received backups!', backups));
```
If you need to pass in data, pass a third argument: