Skip to content

Commit fee885b

Browse files
authored
feat(apple_silicon): add os selection fields (#3790)
1 parent ec3263f commit fee885b

File tree

6 files changed

+24
-5
lines changed

6 files changed

+24
-5
lines changed

cmd/scw/testdata/test-all-usage-apple-silicon-server-create-usage.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ USAGE:
88
ARGS:
99
[name=<generated>] Create a server with this given name
1010
[project-id] Project ID to use. If none is passed the default project ID will be used
11-
[type] Create a server of the given type
11+
[type=M1-M] Create a server of the given type
12+
[os-id] Create a server with the given os_id
1213
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-3)
1314

1415
FLAGS:

cmd/scw/testdata/test-all-usage-apple-silicon-server-reinstall-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ USAGE:
77

88
ARGS:
99
server-id UUID of the server you want to reinstall
10+
[os-id] Reinstall the server with the OS corresponding to the os_id
1011
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-3)
1112

1213
FLAGS:

docs/commands/apple-silicon.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ scw apple-silicon server create [arg=value ...]
8888
|------|---|-------------|
8989
| name | Default: `<generated>` | Create a server with this given name |
9090
| project-id | | Project ID to use. If none is passed the default project ID will be used |
91-
| type | | Create a server of the given type |
91+
| type | Default: `M1-M` | Create a server of the given type |
92+
| os-id | | Create a server with the given os_id |
9293
| zone | Default: `fr-par-1`<br />One of: `fr-par-3` | Zone to target. If none is passed will use default zone from the config |
9394

9495

@@ -191,6 +192,7 @@ scw apple-silicon server reinstall <server-id ...> [arg=value ...]
191192
| Name | | Description |
192193
|------|---|-------------|
193194
| server-id | Required | UUID of the server you want to reinstall |
195+
| os-id | | Reinstall the server with the OS corresponding to the os_id |
194196
| zone | Default: `fr-par-1`<br />One of: `fr-par-3` | Zone to target. If none is passed will use default zone from the config |
195197

196198

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/mattn/go-isatty v0.0.20
2626
github.com/moby/buildkit v0.13.1
2727
github.com/opencontainers/go-digest v1.0.0
28-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240423143305-90f2be290160
28+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240424161651-0ea1f231f7b9
2929
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3030
github.com/spf13/cobra v1.8.0
3131
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
451451
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
452452
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
453453
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
454-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240423143305-90f2be290160 h1:znYgQ3fNt63dMk5kJ9+56YzEPWVKgIRkcmI++ThuHU4=
455-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240423143305-90f2be290160/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
454+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240424161651-0ea1f231f7b9 h1:XdyRhuhdO4HVcwdRuKzv3fiJ/DHYT8PyotTby3v/doc=
455+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26.0.20240424161651-0ea1f231f7b9/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
456456
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
457457
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
458458
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/applesilicon/v1alpha1/applesilicon_cli.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ func appleSiliconServerCreate() *core.Command {
149149
Required: false,
150150
Deprecated: false,
151151
Positional: false,
152+
Default: core.DefaultValueSetter("M1-M"),
153+
},
154+
{
155+
Name: "os-id",
156+
Short: `Create a server with the given os_id`,
157+
Required: false,
158+
Deprecated: false,
159+
Positional: false,
152160
},
153161
core.ZoneArgSpec(scw.ZoneFrPar3),
154162
},
@@ -443,6 +451,13 @@ func appleSiliconServerReinstall() *core.Command {
443451
Deprecated: false,
444452
Positional: true,
445453
},
454+
{
455+
Name: "os-id",
456+
Short: `Reinstall the server with the OS corresponding to the os_id`,
457+
Required: false,
458+
Deprecated: false,
459+
Positional: false,
460+
},
446461
core.ZoneArgSpec(scw.ZoneFrPar3),
447462
},
448463
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

0 commit comments

Comments
 (0)