Skip to content

Commit

Permalink
feat(block): add volume wait command
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax committed Jan 15, 2025
1 parent 172349b commit 8ac82f9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ AVAILABLE COMMANDS:
list List volumes
update Update a volume

WORKFLOW COMMANDS:
wait Wait for volume to reach a stable state

FLAGS:
-h, --help help for volume

Expand Down
25 changes: 25 additions & 0 deletions cmd/scw/testdata/test-all-usage-block-volume-wait-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Wait for volume to reach a stable state. This is similar to using --wait flag on other action commands, but without requiring a new action on the volume.

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

EXAMPLES:
Wait for a volume to be available
scw block volume wait 11111111-1111-1111-1111-111111111111 terminal-status=available

ARGS:
[timeout=5m0s] Timeout of the wait
volume-id ID of the volume affected by the action.
[terminal-status] Expected terminal status, will wait until this status is reached. (unknown_status | creating | available | in_use | deleting | deleted | resizing | error | snapshotting | locked | updating)
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)

FLAGS:
-h, --help help for wait

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
2 changes: 2 additions & 0 deletions internal/namespaces/block/v1alpha1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var (
func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

cmds.Add(volumeWaitCommand())

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-and-test (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-and-test (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / Ensure docs are generated

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / build-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / os-tests (1.22.x, ubuntu-latest)

undefined: volumeWaitCommand

Check failure on line 48 in internal/namespaces/block/v1alpha1/custom.go

View workflow job for this annotation

GitHub Actions / os-tests (1.22.x, macos-latest)

undefined: volumeWaitCommand

human.RegisterMarshalerFunc(block.VolumeStatus(""), human.EnumMarshalFunc(volumeStatusMarshalSpecs))
human.RegisterMarshalerFunc(block.SnapshotStatus(""), human.EnumMarshalFunc(snapshotStatusMarshalSpecs))
human.RegisterMarshalerFunc(block.ReferenceStatus(""), human.EnumMarshalFunc(referenceStatusMarshalSpecs))
Expand Down

0 comments on commit 8ac82f9

Please sign in to comment.