Skip to content

feat(block): add commands #3505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
To create a snapshot, the volume must be in the `in_use` or the `available` status.
If your volume is in a transient state, you need to wait until the end of the current operation.

USAGE:
scw block snapshot create [arg=value ...]

ARGS:
[volume-id] UUID of the volume to snapshot
[name] Name of the snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[tags.{index}] List of tags assigned to the snapshot
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for create

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
You must specify the `snapshot_id` of the snapshot you want to delete. The snapshot must not be in use.

USAGE:
scw block snapshot delete [arg=value ...]

ARGS:
snapshot-id UUID of the snapshot
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for delete

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-snapshot-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve technical information about a specific snapshot. Details such as size, volume type, and status are returned in the response.

USAGE:
scw block snapshot get <snapshot-id ...> [arg=value ...]

ARGS:
snapshot-id UUID of the snapshot
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all available snapshots in a specified zone. By default, the snapshots listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.

USAGE:
scw block snapshot list [arg=value ...]

ARGS:
[order-by] Criteria to use when ordering the list (created_at_asc | created_at_desc | name_asc | name_desc)
[project-id] Filter by Project ID
[volume-id] Filter snapshots by the ID of the original volume
[name] Filter snapshots by their names
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3 | all)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update the name or tags of the snapshot.

USAGE:
scw block snapshot update <snapshot-id ...> [arg=value ...]

ARGS:
snapshot-id UUID of the snapshot
[name] When defined, is the name of the snapshot
[tags.{index}] List of tags assigned to the snapshot
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for update

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
24 changes: 24 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-snapshot-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
You can then revert your data to the previous snapshot. You can also create a new read/write Block volume from a previous snapshot.

USAGE:
scw block snapshot <command>

AVAILABLE COMMANDS:
create Create a snapshot of a volume
delete Delete a snapshot
get Get a snapshot
list List all snapshots
update Update a snapshot

FLAGS:
-h, --help help for snapshot

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw block snapshot [command] --help" for more information about a command.
22 changes: 22 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
This API allows you to use and manage your Block Storage volumes.

USAGE:
scw block <command>

AVAILABLE COMMANDS:
snapshot A Block Storage snapshot is a read-only picture of a Block volume, taken at a specific time
volume A Block Storage volume is a logical storage drive on a network-connected storage system. It is exposed to Instances as if it were a physical disk, and can be attached and detached like a hard drive. Several Block volumes can be attached to one Instance at a time
volume-type Block Storage volume types are determined by their storage class and their IOPS. There are two storage classes available: `bssd` and `sbs`. The IOPS can be chosen for volumes of the `sbs` storage class

FLAGS:
-h, --help help for block

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw block [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
To create a new volume from scratch, you must specify `from_empty` and the `size`.
To create a volume from an existing snapshot, specify `from_snapshot` and the `snapshot_id` in the request payload instead, size is optional and can be specified if you need to extend the original size. The volume will take on the same volume class and underlying IOPS limitations as the original snapshot.

USAGE:
scw block volume create [arg=value ...]

ARGS:
name Name of the volume
perf-iops The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`)
[project-id] Project ID to use. If none is passed the default project ID will be used
[from-empty.size] Volume size in bytes, with a granularity of 1 GB (10^9 bytes)
[from-snapshot.size] Volume size in bytes, with a granularity of 1 GB (10^9 bytes)
[from-snapshot.snapshot-id] Source snapshot from which volume will be created
[tags.{index}] List of tags assigned to the volume
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for create

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
You must specify the `volume_id` of the volume you want to delete. The volume must not be in the `in_use` status.

USAGE:
scw block volume delete [arg=value ...]

ARGS:
volume-id UUID of the volume
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for delete

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve technical information about a specific volume. Details such as size, type, and status are returned in the response.

USAGE:
scw block volume get <volume-id ...> [arg=value ...]

ARGS:
volume-id UUID of the volume
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
22 changes: 22 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all existing volumes in a specified zone. By default, the volumes listed are ordered by creation date in ascending order. This can be modified via the `order_by` field.

USAGE:
scw block volume list [arg=value ...]

ARGS:
[order-by] Criteria to use when ordering the list (created_at_asc | created_at_desc | name_asc | name_desc)
[project-id] Filter by Project ID
[name] Filter the return volumes by their names
[product-resource-id] Filter by a product resource ID linked to this volume (such as an Instance ID)
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3 | all)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all available volume types in a specified zone. The volume types listed are ordered by name in ascending order.

USAGE:
scw block volume-type list [arg=value ...]

ARGS:
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3 | all)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
20 changes: 20 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-type-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Block Storage volume types are determined by their storage class and their IOPS. There are two storage classes available: `bssd` and `sbs`. The IOPS can be chosen for volumes of the `sbs` storage class.

USAGE:
scw block volume-type <command>

AVAILABLE COMMANDS:
list List volume types

FLAGS:
-h, --help help for volume-type

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw block volume-type [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update the technical details of a volume, such as its name, tags, or its new size and `volume_type` (within the same Block Storage class).
You can only resize a volume to a larger size. It is currently not possible to change your Block Storage Class.

USAGE:
scw block volume update <volume-id ...> [arg=value ...]

ARGS:
volume-id UUID of the volume
[name] When defined, is the new name of the volume
[size] Optional field for increasing the size of a volume (size must be equal or larger than the current one)
[tags.{index}] List of tags assigned to the volume
[perf-iops] The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`)
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | pl-waw-3)

FLAGS:
-h, --help help for update

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
24 changes: 24 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Block volumes can be snapshotted, mounted or unmounted.

USAGE:
scw block volume <command>

AVAILABLE COMMANDS:
create Create a volume
delete Delete a detached volume
get Get a volume
list List volumes
update Update a volume

FLAGS:
-h, --help help for volume

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw block volume [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-main-usage-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AVAILABLE COMMANDS:
autocomplete Autocomplete related commands
baremetal Elastic Metal API
billing This API allows you to query your consumption
block This API allows you to use and manage your Block Storage volumes
cockpit Cockpit API
container Container as a Service API
dns Domains and DNS API
Expand Down
Loading