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
1 change: 1 addition & 0 deletions docs/reference/manual/hcloud_storage-box.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ Manage Storage Boxes
* [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 snapshot](hcloud_storage-box_snapshot.md) - Manage Storage Box Snapshots
* [hcloud storage-box subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
* [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
34 changes: 34 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## hcloud storage-box subaccount

Manage Storage Box Subaccounts

### Options

```
-h, --help help for subaccount
```

### 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
* [hcloud storage-box subaccount create](hcloud_storage-box_subaccount_create.md) - Create a Storage Box Subaccount
* [hcloud storage-box subaccount delete](hcloud_storage-box_subaccount_delete.md) - Delete a Storage Box Subaccount
* [hcloud storage-box subaccount describe](hcloud_storage-box_subaccount_describe.md) - Describe a Storage Box Subaccount
* [hcloud storage-box subaccount list](hcloud_storage-box_subaccount_list.md) - List Storage Box Subaccounts
* [hcloud storage-box subaccount reset-password](hcloud_storage-box_subaccount_reset-password.md) - Reset the password of a Storage Box Subaccount
* [hcloud storage-box subaccount update](hcloud_storage-box_subaccount_update.md) - Update a Storage Box Subaccount
* [hcloud storage-box subaccount update-access-settings](hcloud_storage-box_subaccount_update-access-settings.md) - Update access settings of the Storage Box Subaccount
41 changes: 41 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## hcloud storage-box subaccount create

Create a Storage Box Subaccount

```
hcloud storage-box subaccount create [options] --password <password> --home-directory <home-directory> <storage-box>
```

### Options

```
--description string Description for the Subaccount
--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)
-h, --help help for create
--home-directory string Home directory for the Subaccount (required)
--label stringToString User-defined labels ('key=value') (can be specified multiple times) (default [])
-o, --output stringArray output options: json|yaml
--password string Password for the Subaccount (required)
--reachable-externally Whether the Storage Box should be accessible from outside the Hetzner network (true, false)
--readonly Whether the Subaccount should be read-only (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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
31 changes: 31 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## hcloud storage-box subaccount delete

Delete a Storage Box Subaccount

```
hcloud storage-box subaccount delete <storage-box> <subaccount>...
```

### Options

```
-h, --help help for delete
```

### 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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
32 changes: 32 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount_describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## hcloud storage-box subaccount describe

Describe a Storage Box Subaccount

```
hcloud storage-box subaccount describe [options] <storage-box> <subaccount>
```

### Options

```
-h, --help help for describe
-o, --output stringArray output options: json|yaml|format
```

### 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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
52 changes: 52 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## hcloud storage-box subaccount list

List Storage Box Subaccounts

### Synopsis

Displays a list of Storage Box Subaccounts.

Output can be controlled with the -o flag. Use -o noheader to suppress the
table header. Displayed columns and their order can be set with
-o columns=age,created (see available columns below).

Columns:
- age
- created
- description
- home_directory
- id
- labels
- server
- username

```
hcloud storage-box subaccount list [options] <storage-box>
```

### Options

```
-h, --help help for list
-o, --output stringArray output options: noheader|columns=...|json|yaml
-l, --selector string Selector to filter by labels
-s, --sort strings Determine the sorting of the result
```

### 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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## hcloud storage-box subaccount reset-password

Reset the password of a Storage Box Subaccount

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

### Options

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

### 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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## hcloud storage-box subaccount update-access-settings

Update access settings of the Storage Box Subaccount

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

### 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)
-h, --help help for update-access-settings
--home-directory string Home directory of the Subaccount. Will be created if it doesn't exist yet
--reachable-externally Whether the Storage Box should be accessible from outside the Hetzner network (true, false)
--readonly Whether the Subaccount should be read-only (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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
32 changes: 32 additions & 0 deletions docs/reference/manual/hcloud_storage-box_subaccount_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## hcloud storage-box subaccount update

Update a Storage Box Subaccount

```
hcloud storage-box subaccount update [options] <storage-box> <subaccount>
```

### Options

```
--description string Description of the Storage Box Snapshot
-h, --help help for update
```

### 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 subaccount](hcloud_storage-box_subaccount.md) - Manage Storage Box Subaccounts
2 changes: 2 additions & 0 deletions internal/cmd/storagebox/storage_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/storagebox/snapshot"
"github.com/hetznercloud/cli/internal/cmd/storagebox/subaccount"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/state"
)
Expand Down Expand Up @@ -43,6 +44,7 @@ func NewCommand(s state.State) *cobra.Command {
)

util.AddGroup(cmd, "account", "Account",
subaccount.NewCommand(s),
ResetPasswordCmd.CobraCommand(s),
UpdateAccessSettingsCmd.CobraCommand(s),
)
Expand Down
35 changes: 35 additions & 0 deletions internal/cmd/storagebox/subaccount/cmpl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package subaccount

import (
"context"
"strconv"

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/hcapi2"
)

func SuggestSubaccounts(client hcapi2.Client) cobra.CompletionFunc {
return cmpl.SuggestCandidatesCtx(func(cmd *cobra.Command, args []string) []string {
if len(args) == 0 {
return nil
}

storageBox, _, err := client.StorageBox().Get(cmd.Context(), args[0])
if err != nil || storageBox == nil {
return nil
}

subaccounts, err := client.StorageBox().AllSubaccounts(context.Background(), storageBox)
if err != nil {
return nil
}

subaccountIDs := make([]string, 0, len(subaccounts))
for _, subaccount := range subaccounts {
subaccountIDs = append(subaccountIDs, strconv.FormatInt(subaccount.ID, 10))
}
return subaccountIDs
})
}
Loading