-
Notifications
You must be signed in to change notification settings - Fork 162
baremetal: Add list server command #726
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
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
cmd/scw/testdata/test-all-usage-baremetal-bmc-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Baseboard Management Controller (BMC) offers a low-level access to your baremetal instance. |
1 change: 1 addition & 0 deletions
1
cmd/scw/testdata/test-all-usage-baremetal-ip-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| IP fail-over management |
1 change: 1 addition & 0 deletions
1
cmd/scw/testdata/test-all-usage-baremetal-offer-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Commercial offers. |
1 change: 1 addition & 0 deletions
1
cmd/scw/testdata/test-all-usage-baremetal-os-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| An Operating System (OS) is the underlying software installed on your server. |
20 changes: 20 additions & 0 deletions
20
cmd/scw/testdata/test-all-usage-baremetal-server-create-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| Create a new server. Once the server is created, you probably want to install an OS. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server create [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| offer-id Offer ID of the new server | ||
| name Name of the server (≠hostname) | ||
| description Description associated to the server, max 255 characters | ||
| [tags.{index}] Tags to associate to the server | ||
| [organization-id] Organization ID to use. If none is passed will use default organization ID from the config | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for create | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
16 changes: 16 additions & 0 deletions
16
cmd/scw/testdata/test-all-usage-baremetal-server-delete-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Delete the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server delete [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server to delete | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for delete | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
16 changes: 16 additions & 0 deletions
16
cmd/scw/testdata/test-all-usage-baremetal-server-get-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Get the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server get [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for get | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
19 changes: 19 additions & 0 deletions
19
cmd/scw/testdata/test-all-usage-baremetal-server-install-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Install an OS on the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server install [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id Server ID to install | ||
| os-id ID of the OS to install on the server | ||
| hostname Hostname of the server | ||
| ssh-key-ids.{index} SSH key IDs authorized on the server | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for install | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
24 changes: 24 additions & 0 deletions
24
cmd/scw/testdata/test-all-usage-baremetal-server-list-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| List all created servers. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server list [flags] [arg=value ...] | ||
|
|
||
| EXAMPLES: | ||
| List all servers on your default zone | ||
| scw baremetal server list | ||
|
|
||
| ARGS: | ||
| [order-by] Order of the servers (created_at_asc | created_at_desc) | ||
| [tags.{index}] Filter servers by tags | ||
|
remyleone marked this conversation as resolved.
|
||
| [status.{index}] Filter servers by status | ||
| [name] Filter servers by name | ||
| [organization-id] Filter servers by organization ID | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for list | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use | ||
17 changes: 17 additions & 0 deletions
17
cmd/scw/testdata/test-all-usage-baremetal-server-reboot-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Reboot the server associated with the given ID, use boot param to reboot in rescue. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server reboot [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server to reboot | ||
| [boot-type] The type of boot (normal | rescue) | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for reboot | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
16 changes: 16 additions & 0 deletions
16
cmd/scw/testdata/test-all-usage-baremetal-server-start-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Start the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server start [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server to start | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for start | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
16 changes: 16 additions & 0 deletions
16
cmd/scw/testdata/test-all-usage-baremetal-server-stop-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Stop the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server stop [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server to stop | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for stop | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
19 changes: 19 additions & 0 deletions
19
cmd/scw/testdata/test-all-usage-baremetal-server-update-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Update the server associated with the given ID. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server update [flags] [arg=value ...] | ||
|
|
||
| ARGS: | ||
| server-id ID of the server to update | ||
| [name] Name of the server (≠hostname), not updated if null | ||
| [description] Description associated to the server, max 255 characters, not updated if null | ||
| [tags] Tags associated to the server, not updated if null | ||
| [zone] Zone to target. If none is passed will use default zone from the config (fr-par-2) | ||
|
|
||
| FLAGS: | ||
| -h, --help help for update | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use |
25 changes: 25 additions & 0 deletions
25
cmd/scw/testdata/test-all-usage-baremetal-server-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| A server is a denomination of a type of instances provided by Scaleway. | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal server <command> [flags] | ||
|
|
||
| AVAILABLE COMMANDS: | ||
| list List servers | ||
| get Get server | ||
| create Create server | ||
| update Update server | ||
| install Install server | ||
| delete Delete server | ||
| reboot Reboot server | ||
| start Start server | ||
| stop Stop server | ||
|
|
||
| FLAGS: | ||
| -h, --help help for server | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use | ||
|
|
||
| Use "scw baremetal server [command] --help" for more information about a command. |
25 changes: 25 additions & 0 deletions
25
cmd/scw/testdata/test-all-usage-baremetal-usage.stderr.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| Baremetal API | ||
|
|
||
| USAGE: | ||
| scw [global-flags] baremetal <command> [flags] | ||
|
|
||
| AVAILABLE COMMANDS: | ||
| server A server is a denomination of a type of instances provided by Scaleway | ||
|
|
||
| FLAGS: | ||
| -h, --help help for baremetal | ||
|
|
||
| GLOBAL FLAGS: | ||
| -D, --debug Enable debug mode | ||
| -o, --output string Output format: json or human | ||
| -p, --profile string The config profile to use | ||
|
|
||
| Additional help topics: | ||
| scw baremetal os An Operating System (OS) is the underlying software installed on your server | ||
| scw baremetal ip The IPs failovers could be attach to any server in the same zone. | ||
| A server could be linked with multiple failovers. | ||
|
|
||
| scw baremetal bmc Baseboard Management Controller (BMC) offers a low-level access to your baremetal instance | ||
| scw baremetal offer Commercial offers | ||
|
|
||
| Use "scw baremetal [command] --help" for more information about a command. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
internal/namespaces/baremetal/v1alpha1/baremetal_cli_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package baremetal | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/scaleway/scaleway-cli/internal/core" | ||
| "github.com/scaleway/scaleway-sdk-go/api/instance/v1" | ||
| "github.com/scaleway/scaleway-sdk-go/scw" | ||
| ) | ||
|
|
||
| func init() { | ||
| if !core.UpdateCassettes { | ||
| instance.RetryInterval = 0 | ||
| } | ||
| } | ||
|
|
||
| // | ||
| // Server | ||
| // | ||
| func Test_ListServer(t *testing.T) { | ||
| t.Run("Simple", core.Test(&core.TestConfig{ | ||
| Commands: GetCommands(), | ||
| Cmd: "scw baremetal server list", | ||
| Check: core.TestCheckCombine( | ||
| core.TestCheckGolden(), | ||
| core.TestCheckExitCode(0), | ||
| ), | ||
| DefaultZone: scw.ZoneFrPar2, | ||
| })) | ||
|
|
||
| t.Run("List with tags", core.Test(&core.TestConfig{ | ||
| Commands: GetCommands(), | ||
| Cmd: "scw baremetal server list tags.0=a", | ||
| Check: core.TestCheckCombine( | ||
| core.TestCheckGolden(), | ||
| core.TestCheckExitCode(0), | ||
| ), | ||
| DefaultZone: scw.ZoneFrPar2, | ||
| })) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package baremetal | ||
|
|
||
| import "github.com/scaleway/scaleway-cli/internal/core" | ||
|
|
||
| func GetCommands() *core.Commands { | ||
| cmds := GetGeneratedCommands() | ||
| return cmds | ||
| } |
35 changes: 35 additions & 0 deletions
35
...rnal/namespaces/baremetal/v1alpha1/testdata/test-list-server-list-with-tags.cassette.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| version: 1 | ||
| interactions: | ||
| - request: | ||
| body: "" | ||
| form: {} | ||
| headers: | ||
| User-Agent: | ||
| - scaleway-sdk-go/v1.0.0-beta.5+dev (go1.14; darwin; amd64) cli-e2e-test | ||
| url: https://api.scaleway.com/baremetal/v1alpha1/zones/fr-par-2/servers?order_by=created_at_asc&page=1&tags=a | ||
| method: GET | ||
| response: | ||
| body: '{"total_count":1,"servers":[{"id":"188b71df-4193-4f33-9151-df07234f3ef4","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"bm-determined-ellis","description":"","updated_at":"2020-03-10T13:49:42.602599Z","created_at":"2020-02-24T09:54:57.367412Z","status":"ready","offer_id":"737f18c8-febc-4408-b69e-776bca0a3f48","install":{"os_id":"f2aeab5d-6015-4b7c-b4ed-d76e89093621","hostname":"bm-determined-ellis","ssh_key_ids":["77021435-ad22-4748-8861-0a1c512154d0","90bf1977-43ab-4eb7-b178-3dd96963ce99"],"status":"completed"},"tags":["a"],"ips":[{"id":"80e3d13b-b5df-4c00-b38c-afc4e96f8ea5","address":"51.159.0.4","reverse":"188b71df-4193-4f33-9151-df07234f3ef4.fr-par-2.baremetal.scw.cloud","version":"Ipv4","reverse_status":"active","reverse_status_message":null},{"id":"b7abae59-34a3-49fc-87b4-93e95da83207","address":"2001:0bc8:6005:0000:529a:4cff:fe84:ea3d","reverse":"188b71df-4193-4f33-9151-df07234f3ef4.fr-par-2.baremetal.scw.cloud","version":"Ipv6","reverse_status":"active","reverse_status_message":null}],"domain":"188b71df-4193-4f33-9151-df07234f3ef4.fr-par-2.baremetal.scw.cloud","boot_type":"normal","zone":"fr-par-2"}]}' | ||
| headers: | ||
| Content-Length: | ||
| - "1144" | ||
| Content-Security-Policy: | ||
| - default-src 'none'; frame-ancestors 'none' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Tue, 10 Mar 2020 13:53:55 GMT | ||
| Server: | ||
| - scaleway_api | ||
| Strict-Transport-Security: | ||
| - max-age=63072000 | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| X-Frame-Options: | ||
| - DENY | ||
| X-Request-Id: | ||
| - ca407d93-163d-4711-8993-d10b8e919490 | ||
| status: 200 OK | ||
| code: 200 | ||
| duration: "" |
2 changes: 2 additions & 0 deletions
2
...rnal/namespaces/baremetal/v1alpha1/testdata/test-list-server-list-with-tags.stdout.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ID ORGANIZATION ID NAME DESCRIPTION UPDATED AT CREATED AT STATUS OFFER ID TAGS IPS DOMAIN BOOT TYPE ZONE | ||
| 188b71df-4193-4f33-9151-df07234f3ef4 951df375-e094-4d26-97c1-ba548eeb9c42 bm-determined-ellis - few seconds ago few seconds ago ready 737f18c8-febc-4408-b69e-776bca0a3f48 [a] 2 188b71df-4193-4f33-9151-df07234f3ef4.fr-par-2.baremetal.scw.cloud normal fr-par-2 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.