Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/reference/manual/hcloud_storage-box.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ Manage Storage Boxes

* [hcloud](hcloud.md) - Hetzner Cloud CLI
* [hcloud storage-box add-label](hcloud_storage-box_add-label.md) - Add a label to a Storage Box
* [hcloud storage-box change-type](hcloud_storage-box_change-type.md) - Change type of a Storage Box
* [hcloud storage-box create](hcloud_storage-box_create.md) - Create a new Storage Box
* [hcloud storage-box delete](hcloud_storage-box_delete.md) - Delete a Storage Box
* [hcloud storage-box describe](hcloud_storage-box_describe.md) - Describe a Storage Box
* [hcloud storage-box disable-protection](hcloud_storage-box_disable-protection.md) - Disable resource protection for a Storage Box
* [hcloud storage-box disable-snapshot-plan](hcloud_storage-box_disable-snapshot-plan.md) - Disable automatic snapshots for a Storage Box
* [hcloud storage-box enable-protection](hcloud_storage-box_enable-protection.md) - Enable resource protection for a Storage Box
* [hcloud storage-box enable-snapshot-plan](hcloud_storage-box_enable-snapshot-plan.md) - Enable automatic snapshots for a Storage Box
* [hcloud storage-box folders](hcloud_storage-box_folders.md) - List folders of a Storage Box
* [hcloud storage-box list](hcloud_storage-box_list.md) - List Storage Boxes
* [hcloud storage-box remove-label](hcloud_storage-box_remove-label.md) - Remove a label from a Storage Box
* [hcloud storage-box reset-password](hcloud_storage-box_reset-password.md) - Reset the password of a Storage Box
* [hcloud storage-box rollback-snapshot](hcloud_storage-box_rollback-snapshot.md) - Rolls back the Storage Box to the given Snapshot
* [hcloud storage-box update](hcloud_storage-box_update.md) - Update a Storage Box
* [hcloud storage-box update-access-settings](hcloud_storage-box_update-access-settings.md) - Update access settings of the primary Storage Box account
36 changes: 36 additions & 0 deletions docs/reference/manual/hcloud_storage-box_change-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## hcloud storage-box change-type

Change type of a Storage Box

### Synopsis

Requests a Storage Box to be upgraded or downgraded to another Storage Box Type.
Please note that it is not possible to downgrade to a Storage Box Type that offers less disk space than you are currently using.

```
hcloud storage-box change-type <storage-box> <storage-box-type>
```

### Options

```
-h, --help help for change-type
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
10 changes: 5 additions & 5 deletions docs/reference/manual/hcloud_storage-box_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ hcloud storage-box create [options] --name <name> --type <type> --location <loca

```
--enable-protection strings Enable protection (delete) (default: none)
--enable-samba Whether the Samba subsystem should be enabled
--enable-ssh Whether the SSH subsystem should be enabled
--enable-webdav Whether the WebDAV subsystem should be enabled
--enable-zfs Whether the ZFS Snapshot folder should be visible
--enable-samba Whether the Samba subsystem should be enabled (true, false)
--enable-ssh Whether the SSH subsystem should be enabled (true, false)
--enable-webdav Whether the WebDAV subsystem should be enabled (true, false)
--enable-zfs Whether the ZFS Snapshot folder should be visible (true, false)
-h, --help help for create
--label stringToString User-defined labels ('key=value') (can be specified multiple times) (default [])
--location string Location (ID or name) (required)
--name string Storage Box name (required)
-o, --output stringArray output options: json|yaml
--password string The password that will be set for this Storage Box (required)
--reachable-externally Whether the Storage Box should be accessible from outside the Hetzner network
--reachable-externally Whether the Storage Box should be accessible from outside the Hetzner network (true, false)
--ssh-key stringArray SSH public keys in OpenSSH format or as the ID or name of an existing SSH key
--type string Storage Box Type (ID or name) (required)
```
Expand Down
31 changes: 31 additions & 0 deletions docs/reference/manual/hcloud_storage-box_disable-protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## hcloud storage-box disable-protection

Disable resource protection for a Storage Box

```
hcloud storage-box disable-protection <storage-box> delete
```

### Options

```
-h, --help help for disable-protection
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
31 changes: 31 additions & 0 deletions docs/reference/manual/hcloud_storage-box_disable-snapshot-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## hcloud storage-box disable-snapshot-plan

Disable automatic snapshots for a Storage Box

```
hcloud storage-box disable-snapshot-plan <storage-box>
```

### Options

```
-h, --help help for disable-snapshot-plan
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
31 changes: 31 additions & 0 deletions docs/reference/manual/hcloud_storage-box_enable-protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## hcloud storage-box enable-protection

Enable resource protection for a Storage Box

```
hcloud storage-box enable-protection <storage-box> delete
```

### Options

```
-h, --help help for enable-protection
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
49 changes: 49 additions & 0 deletions docs/reference/manual/hcloud_storage-box_enable-snapshot-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## hcloud storage-box enable-snapshot-plan

Enable automatic snapshots for a Storage Box

### Synopsis

Enable automatic snapshots for a Storage Box

Allowed values for --day-of-week are:
- Sunday, Sun, 0, 7
- Monday, Mon, 1
- Tuesday, Tue, 2
- Wednesday, Wed, 3
- Thursday, Thu, 4
- Friday, Fri, 5
- Saturday, Sat, 6

```
hcloud storage-box enable-snapshot-plan [options] <storage-box>
```

### Options

```
--day-of-month int Day of the month the Snapshot Plan should be executed on. Not specified means every day
--day-of-week string Day of the week the Snapshot Plan should be executed on. Not specified means every day
-h, --help help for enable-snapshot-plan
--hour int Hour the Snapshot Plan should be executed on (UTC). Not specified means every hour
--max-snapshots int Maximum amount of Snapshots that should be created by this Snapshot Plan
--minute int Minute the Snapshot Plan should be executed on (UTC). Not specified means every minute
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
32 changes: 32 additions & 0 deletions docs/reference/manual/hcloud_storage-box_reset-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## hcloud storage-box reset-password

Reset the password of a Storage Box

```
hcloud storage-box reset-password --password <password> <storage-box>
```

### Options

```
-h, --help help for reset-password
--password string New password for the Storage Box
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
32 changes: 32 additions & 0 deletions docs/reference/manual/hcloud_storage-box_rollback-snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## hcloud storage-box rollback-snapshot

Rolls back the Storage Box to the given Snapshot

```
hcloud storage-box rollback-snapshot --snapshot <snapshot> <storage-box>
```

### Options

```
-h, --help help for rollback-snapshot
--snapshot string The name or ID of the snapshot to roll back to
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
36 changes: 36 additions & 0 deletions docs/reference/manual/hcloud_storage-box_update-access-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## hcloud storage-box update-access-settings

Update access settings of the primary Storage Box account

```
hcloud storage-box update-access-settings [options] <storage-box>
```

### Options

```
--enable-samba Whether the Samba subsystem should be enabled (true, false)
--enable-ssh Whether the SSH subsystem should be enabled (true, false)
--enable-webdav Whether the WebDAV subsystem should be enabled (true, false)
--enable-zfs Whether the ZFS Snapshot folder should be visible (true, false)
-h, --help help for update-access-settings
--reachable-externally Whether the Storage Box should be accessible from outside the Hetzner network (true, false)
```

### Options inherited from parent commands

```
--config string Config file path (default "~/.config/hcloud/cli.toml")
--context string Currently active context
--debug Enable debug output
--debug-file string File to write debug output to
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
--hetzner-endpoint string Hetzner API endpoint (default "https://api.hetzner.com/v1")
--no-experimental-warnings If true, experimental warnings are not shown
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
--quiet If true, only print error messages
```

### SEE ALSO

* [hcloud storage-box](hcloud_storage-box.md) - Manage Storage Boxes
69 changes: 69 additions & 0 deletions internal/cmd/storagebox/change_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package storagebox

import (
"fmt"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/base"
"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/hcloud-go/v2/hcloud"
)

var ChangeTypeCmd = base.Cmd{
BaseCobraCommand: func(client hcapi2.Client) *cobra.Command {
cmd := &cobra.Command{
Use: "change-type <storage-box> <storage-box-type>",
Short: "Change type of a Storage Box",
Long: `Requests a Storage Box to be upgraded or downgraded to another Storage Box Type.
Please note that it is not possible to downgrade to a Storage Box Type that offers less disk space than you are currently using.`,
ValidArgsFunction: cmpl.SuggestArgs(
cmpl.SuggestCandidatesF(client.StorageBox().Names),
cmpl.SuggestCandidatesF(client.StorageBoxType().Names),
),
TraverseChildren: true,
DisableFlagsInUseLine: true,
}
return cmd
},
Run: func(s state.State, cmd *cobra.Command, args []string) error {
idOrName := args[0]
storageBox, _, err := s.Client().StorageBox().Get(s, idOrName)
if err != nil {
return err
}
if storageBox == nil {
return fmt.Errorf("Storage Box not found: %s", idOrName)
}

storageBoxTypeIDOrName := args[1]
storageBoxType, _, err := s.Client().StorageBoxType().Get(s, storageBoxTypeIDOrName)
if err != nil {
return err
}
if storageBoxType == nil {
return fmt.Errorf("Storage Box Type not found: %s", storageBoxTypeIDOrName)
}

if storageBoxType.IsDeprecated() {
cmd.Print(warningDeprecatedStorageBoxType(storageBoxType))
}

opts := hcloud.StorageBoxChangeTypeOpts{
StorageBoxType: storageBoxType,
}
action, _, err := s.Client().StorageBox().ChangeType(s, storageBox, opts)
if err != nil {
return err
}

if err := s.WaitForActions(s, cmd, action); err != nil {
return err
}

cmd.Printf("Storage Box %d upgraded to type %s\n", storageBox.ID, storageBoxType.Name)
return nil
},
}
Loading
Loading