Skip to content

Commit d4d6915

Browse files
authored
feat(instance): add server action command (#3309)
1 parent 39a6893 commit d4d6915

10 files changed

+9064
-589
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Perform a raw API action on a server
4+
5+
USAGE:
6+
scw instance server action <server-id ...> [arg=value ...]
7+
8+
EXAMPLES:
9+
Start a server in the default zone with a given id
10+
scw instance server action 11111111-1111-1111-1111-111111111111 action=poweron
11+
12+
ARGS:
13+
action The raw API action to perform, as listed with 'scw instance server list-actions'
14+
server-id ID of the server affected by the action.
15+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config
16+
17+
FLAGS:
18+
-h, --help help for action
19+
-w, --wait wait until the server is ready
20+
21+
GLOBAL FLAGS:
22+
-c, --config string The path to the config file
23+
-D, --debug Enable debug mode
24+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
25+
-p, --profile string The config profile to use
26+
27+
SEE ALSO:
28+
# List available actions for a server
29+
scw instance server list-actions
30+
31+
# Perform reboot action
32+
scw instance server reboot
33+
34+
# Perform start action
35+
scw instance server start
36+
37+
# Perform stop action
38+
scw instance server stop

cmd/scw/testdata/test-all-usage-instance-server-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ USAGE:
88
scw instance server <command>
99

1010
AVAILABLE COMMANDS:
11+
action Perform a raw API action on a server
1112
attach-ip Attach an IP to a server
1213
attach-volume Attach a volume to a server
1314
backup Backup server

docs/commands/instance.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Instance API.
4848
- [Update all the rules of a security group](#update-all-the-rules-of-a-security-group)
4949
- [Update security group](#update-security-group)
5050
- [Instance management commands](#instance-management-commands)
51+
- [Perform a raw API action on a server](#perform-a-raw-api-action-on-a-server)
5152
- [Attach an IP to a server](#attach-an-ip-to-a-server)
5253
- [Attach a volume to a server](#attach-a-volume-to-a-server)
5354
- [Backup server](#backup-server)
@@ -1561,6 +1562,37 @@ Scaleway offers various Instance types including **Virtual Instances** and **ded
15611562

15621563

15631564

1565+
### Perform a raw API action on a server
1566+
1567+
1568+
1569+
**Usage:**
1570+
1571+
```
1572+
scw instance server action <server-id ...> [arg=value ...]
1573+
```
1574+
1575+
1576+
**Args:**
1577+
1578+
| Name | | Description |
1579+
|------|---|-------------|
1580+
| action | Required | The raw API action to perform, as listed with 'scw instance server list-actions' |
1581+
| server-id | Required | ID of the server affected by the action. |
1582+
| zone | Default: `fr-par-1` | Zone to target. If none is passed will use default zone from the config |
1583+
1584+
1585+
**Examples:**
1586+
1587+
1588+
Start a server in the default zone with a given id
1589+
```
1590+
scw instance server action 11111111-1111-1111-1111-111111111111 action=poweron
1591+
```
1592+
1593+
1594+
1595+
15641596
### Attach an IP to a server
15651597

15661598

internal/namespaces/instance/v1/custom.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func GetCommands() *core.Commands {
5656
serverTerminateCommand(),
5757
serverDetachVolumeCommand(),
5858
serverSSHCommand(),
59+
serverActionCommand(),
5960
serverStartCommand(),
6061
serverStopCommand(),
6162
serverStandbyCommand(),

0 commit comments

Comments
 (0)