Skip to content

Commit d2eda0b

Browse files
authored
chore(instance): bump sdk-go with breaking changes (#3227)
1 parent 23a6aa5 commit d2eda0b

9 files changed

+29
-29
lines changed

cmd/scw/testdata/test-all-usage-instance-ssh-add-key-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ USAGE:
1111
ARGS:
1212
[server-id] Server to add your key to
1313
[public-key] Public key you want to add to your server
14-
[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 | pl-waw-1 | pl-waw-2)
14+
[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)
1515

1616
FLAGS:
1717
-h, --help help for add-key

cmd/scw/testdata/test-all-usage-instance-ssh-install-config-usage.golden

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

88
ARGS:
99
[project-id] Project ID to use. If none is passed the default project ID will be used
10-
[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 | pl-waw-1 | pl-waw-2)
10+
[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)
1111

1212
FLAGS:
1313
-h, --help help for install-config

cmd/scw/testdata/test-all-usage-instance-ssh-list-keys-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ USAGE:
99

1010
ARGS:
1111
server-id Server to add your key to
12-
[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 | pl-waw-1 | pl-waw-2)
12+
[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)
1313

1414
FLAGS:
1515
-h, --help help for list-keys

cmd/scw/testdata/test-all-usage-instance-ssh-remove-key-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ARGS:
1111
server-id Server to add your key to
1212
[name] Name of the key you want to remove, has to be the key comment or the index
1313
[public-key] Public key you want to remove
14-
[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 | pl-waw-1 | pl-waw-2)
14+
[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)
1515

1616
FLAGS:
1717
-h, --help help for remove-key

docs/commands/instance.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ scw instance ssh add-key [arg=value ...]
26322632
|------|---|-------------|
26332633
| server-id | | Server to add your key to |
26342634
| public-key | | Public key you want to add to your server |
2635-
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
2635+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
26362636

26372637

26382638

@@ -2653,7 +2653,7 @@ scw instance ssh install-config [arg=value ...]
26532653
| Name | | Description |
26542654
|------|---|-------------|
26552655
| project-id | | Project ID to use. If none is passed the default project ID will be used |
2656-
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
2656+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
26572657

26582658

26592659

@@ -2675,7 +2675,7 @@ scw instance ssh list-keys <server-id ...> [arg=value ...]
26752675
| Name | | Description |
26762676
|------|---|-------------|
26772677
| server-id | Required | Server to add your key to |
2678-
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
2678+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
26792679

26802680

26812681

@@ -2699,7 +2699,7 @@ scw instance ssh remove-key [arg=value ...]
26992699
| server-id | Required | Server to add your key to |
27002700
| name | | Name of the key you want to remove, has to be the key comment or the index |
27012701
| public-key | | Public key you want to remove |
2702-
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
2702+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
27032703

27042704

27052705

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require (
2424
github.com/moby/buildkit v0.11.6
2525
github.com/opencontainers/go-digest v1.0.0
2626
github.com/pkg/errors v0.9.1
27-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230614162946-6279e7999742
27+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230619154501-6a12f2ddaa47
2828
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2929
github.com/spf13/cobra v1.7.0
3030
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
497497
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
498498
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
499499
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
500-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230614162946-6279e7999742 h1:tYilRVnAW/yYmlMOmMrU1zZuIPcCuNmpLmnHXMZV1vs=
501-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230614162946-6279e7999742/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
500+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230619154501-6a12f2ddaa47 h1:eGARFgFhRDgxFF6QwimHe+MV21xhuPKLPNhJyML3JkA=
501+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230619154501-6a12f2ddaa47/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
502502
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
503503
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
504504
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=

internal/namespaces/instance/v1/custom_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ func serverUpdateBuilder(c *core.Command) *core.Command {
287287
for i, volumeID := range *customRequest.VolumeIDs {
288288
index := strconv.Itoa(i)
289289
volumes[index] = &instance.VolumeServerTemplate{
290-
ID: volumeID,
291-
Name: getServerResponse.Server.Name + "-" + index,
290+
ID: scw.StringPtr(volumeID),
291+
Name: scw.StringPtr(getServerResponse.Server.Name + "-" + index),
292292
}
293293
}
294294
customRequest.Volumes = &volumes

internal/namespaces/instance/v1/custom_server_create.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,10 @@ func buildVolumes(api *instance.API, zone scw.Zone, serverName, rootVolume strin
447447
return nil, err
448448
}
449449
index := strconv.Itoa(i + 1)
450-
volumeTemplate.Name = serverName + "-" + index
450+
volumeTemplate.Name = scw.StringPtr(serverName + "-" + index)
451451

452452
// Remove extra data for API validation.
453-
if volumeTemplate.ID != "" {
453+
if volumeTemplate.ID != nil {
454454
volumeTemplate = &instance.VolumeServerTemplate{
455455
ID: volumeTemplate.ID,
456456
Name: volumeTemplate.Name,
@@ -495,7 +495,7 @@ func buildVolumeTemplate(api *instance.API, zone scw.Zone, flagV string) (*insta
495495
if err != nil {
496496
return nil, fmt.Errorf("invalid size format %s in %s volume", parts[1], flagV)
497497
}
498-
vt.Size = scw.Size(size)
498+
vt.Size = scw.SizePtr(scw.Size(size))
499499

500500
return vt, nil
501501
}
@@ -534,9 +534,9 @@ func buildVolumeTemplateFromUUID(api *instance.API, zone scw.Zone, volumeUUID st
534534
}
535535

536536
return &instance.VolumeServerTemplate{
537-
ID: res.Volume.ID,
537+
ID: &res.Volume.ID,
538538
VolumeType: res.Volume.VolumeType,
539-
Size: res.Volume.Size,
539+
Size: &res.Volume.Size,
540540
}, nil
541541
}
542542

@@ -562,10 +562,10 @@ func buildVolumeTemplateFromSnapshot(api *instance.API, zone scw.Zone, snapshotU
562562
}
563563

564564
return &instance.VolumeServerTemplate{
565-
Name: res.Snapshot.Name,
565+
Name: &res.Snapshot.Name,
566566
VolumeType: volumeType,
567-
BaseSnapshot: res.Snapshot.ID,
568-
Size: res.Snapshot.Size,
567+
BaseSnapshot: &res.Snapshot.ID,
568+
Size: &res.Snapshot.Size,
569569
}, nil
570570
}
571571

@@ -592,8 +592,8 @@ func validateLocalVolumeSizes(volumes map[string]*instance.VolumeServerTemplate,
592592
// Calculate local volume total size.
593593
var localVolumeTotalSize scw.Size
594594
for _, volume := range volumes {
595-
if volume.VolumeType == instance.VolumeVolumeTypeLSSD {
596-
localVolumeTotalSize += volume.Size
595+
if volume.VolumeType == instance.VolumeVolumeTypeLSSD && volume.Size != nil {
596+
localVolumeTotalSize += *volume.Size
597597
}
598598
}
599599

@@ -622,14 +622,14 @@ func validateRootVolume(imageRequiredSize scw.Size, rootVolume *instance.VolumeS
622622
return nil
623623
}
624624

625-
if rootVolume.ID != "" {
625+
if rootVolume.ID != nil {
626626
return &core.CliError{
627627
Err: fmt.Errorf("you cannot use an existing volume as a root volume"),
628628
Details: "You must create an image of this volume and use its ID in the 'image' argument.",
629629
}
630630
}
631631

632-
if rootVolume.Size < imageRequiredSize {
632+
if rootVolume.Size != nil && *rootVolume.Size < imageRequiredSize {
633633
return fmt.Errorf("first volume size must be at least %s for this image", humanize.Bytes(uint64(imageRequiredSize)))
634634
}
635635

@@ -641,22 +641,22 @@ func sanitizeVolumeMap(serverName string, volumes map[string]*instance.VolumeSer
641641
m := make(map[string]*instance.VolumeServerTemplate)
642642

643643
for index, v := range volumes {
644-
v.Name = serverName + "-" + index
644+
v.Name = scw.StringPtr(serverName + "-" + index)
645645

646646
// Remove extra data for API validation.
647647
switch {
648-
case v.ID != "":
648+
case v.ID != nil:
649649
v = &instance.VolumeServerTemplate{
650650
ID: v.ID,
651651
Name: v.Name,
652652
}
653-
case v.BaseSnapshot != "":
653+
case v.BaseSnapshot != nil:
654654
v = &instance.VolumeServerTemplate{
655655
BaseSnapshot: v.BaseSnapshot,
656656
Name: v.Name,
657657
VolumeType: v.VolumeType,
658658
}
659-
case index == "0" && v.Size != 0:
659+
case index == "0" && v.Size != nil:
660660
v = &instance.VolumeServerTemplate{
661661
VolumeType: v.VolumeType,
662662
Size: v.Size,

0 commit comments

Comments
 (0)