Skip to content

Commit 5502c76

Browse files
authored
feat(instance): add boot-type to create server (#1465)
Signed-off-by: Patrik Cyvoct <[email protected]>
1 parent 1954148 commit 5502c76

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ARGS:
3636
[placement-group-id] The placement group ID in witch the server has to be created
3737
[bootscript-id] The bootscript ID to use, if empty the local boot will be used
3838
[cloud-init] The cloud-init script to use
39+
[boot-type=local] The boot type to use, if empty the local boot will be used. Will be overwritten to bootscript if bootscript-id is set. (local | bootscript | rescue)
3940
[project-id] Project ID to use. If none is passed the default project ID will be used
4041
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config
4142

internal/namespaces/instance/v1/custom_server_create.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type instanceCreateServerRequest struct {
3535
PlacementGroupID string
3636
BootscriptID string
3737
CloudInit string
38+
BootType string
3839

3940
// Deprecated, use project-id instead
4041
OrganizationID *string
@@ -108,6 +109,12 @@ func serverCreateCommand() *core.Command {
108109
Name: "cloud-init",
109110
Short: "The cloud-init script to use",
110111
},
112+
{
113+
Name: "boot-type",
114+
Short: "The boot type to use, if empty the local boot will be used. Will be overwritten to bootscript if bootscript-id is set.",
115+
Default: core.DefaultValueSetter(instance.BootTypeLocal.String()),
116+
EnumValues: []string{instance.BootTypeLocal.String(), instance.BootTypeBootscript.String(), instance.BootTypeRescue.String()},
117+
},
111118
core.ProjectIDArgSpec(),
112119
core.ZoneArgSpec(),
113120
core.OrganizationIDDeprecatedArgSpec(),
@@ -286,6 +293,12 @@ func instanceServerCreateRun(ctx context.Context, argsI interface{}) (i interfac
286293
serverReq.Volumes = sanitizeVolumeMap(serverReq.Name, volumes)
287294
}
288295

296+
//
297+
// BootType.
298+
//
299+
bootType := instance.BootType(args.BootType)
300+
serverReq.BootType = &bootType
301+
289302
//
290303
// Bootscript.
291304
//

0 commit comments

Comments
 (0)