Skip to content

Commit 442e50c

Browse files
authored
Merge branch 'scaleway:master' into master
2 parents 13cd76c + e529aea commit 442e50c

12 files changed

+647
-32
lines changed

.github/codecov.yml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
codecov:
2+
branch: master
3+
4+
component_management:
5+
individual_components:
6+
- component_id: account
7+
name: account
8+
paths:
9+
- internal/namespaces/account/**
10+
- component_id: alias
11+
name: alias
12+
paths:
13+
- internal/namespaces/alias/**
14+
- component_id: applesilicon
15+
name: applesilicon
16+
paths:
17+
- internal/namespaces/applesilicon/**
18+
- component_id: audit_trail
19+
name: audit_trail
20+
paths:
21+
- internal/namespaces/audit_trail/**
22+
- component_id: autocomplete
23+
name: autocomplete
24+
paths:
25+
- internal/namespaces/autocomplete/**
26+
- component_id: baremetal
27+
name: baremetal
28+
paths:
29+
- internal/namespaces/baremetal/**
30+
- component_id: billing
31+
name: billing
32+
paths:
33+
- internal/namespaces/billing/**
34+
- component_id: block
35+
name: block
36+
paths:
37+
- internal/namespaces/block/**
38+
- component_id: cockpit
39+
name: cockpit
40+
paths:
41+
- internal/namespaces/cockpit/**
42+
- component_id: config
43+
name: config
44+
paths:
45+
- internal/namespaces/config/**
46+
- component_id: container
47+
name: container
48+
paths:
49+
- internal/namespaces/container/**
50+
- component_id: dedibox
51+
name: dedibox
52+
paths:
53+
- internal/namespaces/dedibox/**
54+
- component_id: domain
55+
name: domain
56+
paths:
57+
- internal/namespaces/domain/**
58+
- component_id: edge_services
59+
name: edge_services
60+
paths:
61+
- internal/namespaces/edge_services/**
62+
- component_id: feedback
63+
name: feedback
64+
paths:
65+
- internal/namespaces/feedback/**
66+
- component_id: file
67+
name: file
68+
paths:
69+
- internal/namespaces/file/**
70+
- component_id: flexibleip
71+
name: flexibleip
72+
paths:
73+
- internal/namespaces/flexibleip/**
74+
- component_id: function
75+
name: function
76+
paths:
77+
- internal/namespaces/function/**
78+
- component_id: help
79+
name: help
80+
paths:
81+
- internal/namespaces/help/**
82+
- component_id: iam
83+
name: iam
84+
paths:
85+
- internal/namespaces/iam/**
86+
- component_id: inference
87+
name: inference
88+
paths:
89+
- internal/namespaces/inference/**
90+
- component_id: info
91+
name: info
92+
paths:
93+
- internal/namespaces/info/**
94+
- component_id: init
95+
name: init
96+
paths:
97+
- internal/namespaces/init/**
98+
- component_id: instance
99+
name: instance
100+
paths:
101+
- internal/namespaces/instance/**
102+
- component_id: interlink
103+
name: interlink
104+
paths:
105+
- internal/namespaces/interlink/**
106+
- component_id: iot
107+
name: iot
108+
paths:
109+
- internal/namespaces/iot/**
110+
- component_id: ipam
111+
name: ipam
112+
paths:
113+
- internal/namespaces/ipam/**
114+
- component_id: jobs
115+
name: jobs
116+
paths:
117+
- internal/namespaces/jobs/**
118+
- component_id: k8s
119+
name: k8s
120+
paths:
121+
- internal/namespaces/k8s/**
122+
- component_id: key_manager
123+
name: key_manager
124+
paths:
125+
- internal/namespaces/key_manager/**
126+
- component_id: lb
127+
name: lb
128+
paths:
129+
- internal/namespaces/lb/**
130+
- component_id: login
131+
name: login
132+
paths:
133+
- internal/namespaces/login/**
134+
- component_id: marketplace
135+
name: marketplace
136+
paths:
137+
- internal/namespaces/marketplace/**
138+
- component_id: mnq
139+
name: mnq
140+
paths:
141+
- internal/namespaces/mnq/**
142+
- component_id: mongodb
143+
name: mongodb
144+
paths:
145+
- internal/namespaces/mongodb/**
146+
- component_id: object
147+
name: object
148+
paths:
149+
- internal/namespaces/object/**
150+
- component_id: rdb
151+
name: rdb
152+
paths:
153+
- internal/namespaces/rdb/**
154+
- component_id: redis
155+
name: redis
156+
paths:
157+
- internal/namespaces/redis/**
158+
- component_id: registry
159+
name: registry
160+
paths:
161+
- internal/namespaces/registry/**
162+
- component_id: secret
163+
name: secret
164+
paths:
165+
- internal/namespaces/secret/**
166+
- component_id: serverless_sqldb
167+
name: serverless_sqldb
168+
paths:
169+
- internal/namespaces/serverless_sqldb/**
170+
- component_id: shell
171+
name: shell
172+
paths:
173+
- internal/namespaces/shell/**
174+
- component_id: tem
175+
name: tem
176+
paths:
177+
- internal/namespaces/tem/**
178+
- component_id: test
179+
name: test
180+
paths:
181+
- internal/namespaces/test/**
182+
- component_id: version
183+
name: version
184+
paths:
185+
- internal/namespaces/version/**
186+
- component_id: vpc
187+
name: vpc
188+
paths:
189+
- internal/namespaces/vpc/**
190+
- component_id: vpcgw
191+
name: vpcgw
192+
paths:
193+
- internal/namespaces/vpcgw/**
194+
- component_id: webhosting
195+
name: webhosting
196+
paths:
197+
- internal/namespaces/webhosting/**

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/docker/docker v28.5.1+incompatible
1515
github.com/dustin/go-humanize v1.0.1
1616
github.com/fatih/color v1.18.0
17-
github.com/getsentry/sentry-go v0.36.0
17+
github.com/getsentry/sentry-go v0.36.1
1818
github.com/ghodss/yaml v1.0.0
1919
github.com/gorilla/websocket v1.5.3
2020
github.com/hashicorp/go-version v1.7.0
@@ -23,7 +23,7 @@ require (
2323
github.com/mattn/go-isatty v0.0.20
2424
github.com/moby/buildkit v0.25.1
2525
github.com/opencontainers/go-digest v1.0.0
26-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251015050748-12aafea99911
26+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9
2727
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2828
github.com/spf13/cobra v1.10.1
2929
github.com/spf13/pflag v1.0.10

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uh
231231
github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo=
232232
github.com/gdamore/tcell/v2 v2.9.0 h1:N6t+eqK7/xwtRPwxzs1PXeRWnm0H9l02CrgJ7DLn1ys=
233233
github.com/gdamore/tcell/v2 v2.9.0/go.mod h1:8/ZoqM9rxzYphT9tH/9LnunhV9oPBqwS8WHGYm5nrmo=
234-
github.com/getsentry/sentry-go v0.36.0 h1:UkCk0zV28PiGf+2YIONSSYiYhxwlERE5Li3JPpZqEns=
235-
github.com/getsentry/sentry-go v0.36.0/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
234+
github.com/getsentry/sentry-go v0.36.1 h1:kMJt0WWsxWATUxkvFgVBZdIeHSk/Oiv5P0jZ9e5m/Lw=
235+
github.com/getsentry/sentry-go v0.36.1/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
236236
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
237237
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
238238
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
@@ -462,8 +462,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
462462
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
463463
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
464464
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
465-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251015050748-12aafea99911 h1:puwRtGGoGw9Rw3qlB7ltimV2+uugkalN08DyVEL1VoE=
466-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251015050748-12aafea99911/go.mod h1:SVm1Zk6UpZtqZN6KtEQpjC+v+Lir4tyVfhQTU19q3PA=
465+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9 h1:ZwoABMCRbJRspA/zO14tnAg5wCnotc+cuZRB8ec3dsA=
466+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251021162421-9dee01f565c9/go.mod h1:SVm1Zk6UpZtqZN6KtEQpjC+v+Lir4tyVfhQTU19q3PA=
467467
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
468468
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
469469
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/iam/v1alpha1/custom_test.go

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
iam "github.com/scaleway/scaleway-cli/v2/internal/namespaces/iam/v1alpha1"
1010
"github.com/scaleway/scaleway-cli/v2/internal/testhelpers"
1111
iamsdk "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
12+
"github.com/stretchr/testify/assert"
13+
"github.com/stretchr/testify/require"
1214
)
1315

1416
func Test_initWithSSHKeyCommand(t *testing.T) {
@@ -43,11 +45,11 @@ func Test_initWithSSHKeyCommand(t *testing.T) {
4345
}
4446

4547
func Test_SSHKeyCreateCommand(t *testing.T) {
46-
key := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar`
48+
key1 := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar`
4749
t.Run("simple", core.Test(&core.TestConfig{
4850
Commands: iam.GetCommands(),
4951
Args: []string{
50-
"scw", "iam", "ssh-key", "create", "name=foobar", "public-key=" + key,
52+
"scw", "iam", "ssh-key", "create", "name=foobar", "public-key=" + key1,
5153
},
5254
Check: core.TestCheckCombine(
5355
core.TestCheckGolden(),
@@ -62,6 +64,44 @@ func Test_SSHKeyCreateCommand(t *testing.T) {
6264
})
6365
},
6466
}))
67+
68+
////
69+
// File import will test the @/path/file import functionality
70+
////
71+
key2 := "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIHoWVcE8ItB7WPbmanQY/GhMWqU2XKQthfoAv51IE4OAgnnMWo7RHf1grLdiRZ4MxIwW2SaDBGIDminJCw1OMo= foobar@foobar2"
72+
t.Run("file_import", func(t *testing.T) {
73+
f, err := os.CreateTemp(t.TempDir(), "ssh.pub")
74+
require.NoError(t, err)
75+
assert.NotNil(t, f)
76+
defer os.Remove(f.Name()) // clean up
77+
78+
_, err = f.WriteString(key2)
79+
require.NoError(t, err)
80+
t.Logf("public key written on %s (will be deleted at the end of the test)", f.Name())
81+
82+
err = f.Close()
83+
require.NoError(t, err)
84+
85+
testConfig := &core.TestConfig{
86+
Commands: iam.GetCommands(),
87+
Args: []string{
88+
"scw", "iam", "ssh-key", "create", "name=foobar2", "public-key=@" + f.Name(),
89+
},
90+
Check: core.TestCheckCombine(
91+
core.TestCheckGolden(),
92+
core.TestCheckExitCode(0),
93+
),
94+
AfterFunc: func(ctx *core.AfterFuncCtx) error {
95+
api := iamsdk.NewAPI(ctx.Client)
96+
key := testhelpers.Value[*iamsdk.SSHKey](t, ctx.CmdResult)
97+
98+
return api.DeleteSSHKey(&iamsdk.DeleteSSHKeyRequest{
99+
SSHKeyID: key.ID,
100+
})
101+
},
102+
}
103+
core.Test(testConfig)(t)
104+
})
65105
}
66106

67107
func Test_SSHKeyRemoveCommand(t *testing.T) {
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: '{"id":"35d4a543-ba4f-46b8-94a1-3e7d1caeccb9", "name":"foobar2", "public_key":"ecdsa-sha2-nistp256
6+
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIHoWVcE8ItB7WPbmanQY/GhMWqU2XKQthfoAv51IE4OAgnnMWo7RHf1grLdiRZ4MxIwW2SaDBGIDminJCw1OMo=",
7+
"fingerprint":"256 MD5:a5:b1:5a:ff:d2:71:ed:53:d7:8c:fb:b0:ec:12:10:de (ecdsa-sha2-nistp256)",
8+
"created_at":"2025-10-21T10:06:35.771313Z", "updated_at":"2025-10-21T10:06:35.771313Z",
9+
"organization_id":"9e9389ca-503a-44c3-bbd5-7a3812303bb0", "project_id":"9e9389ca-503a-44c3-bbd5-7a3812303bb0",
10+
"disabled":false}'
11+
form: {}
12+
headers:
13+
Content-Type:
14+
- application/json
15+
User-Agent:
16+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.0; linux; amd64) cli-e2e-test
17+
url: https://api.scaleway.com/iam/v1alpha1/ssh-keys
18+
method: POST
19+
response:
20+
body: '{"id":"35d4a543-ba4f-46b8-94a1-3e7d1caeccb9", "name":"foobar2", "public_key":"ecdsa-sha2-nistp256
21+
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIHoWVcE8ItB7WPbmanQY/GhMWqU2XKQthfoAv51IE4OAgnnMWo7RHf1grLdiRZ4MxIwW2SaDBGIDminJCw1OMo=",
22+
"fingerprint":"256 MD5:a5:b1:5a:ff:d2:71:ed:53:d7:8c:fb:b0:ec:12:10:de (ecdsa-sha2-nistp256)",
23+
"created_at":"2025-10-21T10:06:35.771313Z", "updated_at":"2025-10-21T10:06:35.771313Z",
24+
"organization_id":"9e9389ca-503a-44c3-bbd5-7a3812303bb0", "project_id":"9e9389ca-503a-44c3-bbd5-7a3812303bb0",
25+
"disabled":false}'
26+
headers:
27+
Content-Length:
28+
- "552"
29+
Content-Security-Policy:
30+
- default-src 'none'; frame-ancestors 'none'
31+
Content-Type:
32+
- application/json
33+
Date:
34+
- Tue, 21 Oct 2025 10:06:35 GMT
35+
Server:
36+
- Scaleway API Gateway (fr-par-1;edge02)
37+
Strict-Transport-Security:
38+
- max-age=63072000
39+
X-Content-Type-Options:
40+
- nosniff
41+
X-Frame-Options:
42+
- DENY
43+
X-Request-Id:
44+
- 686dc9c2-3fe0-42ca-92fa-9a3ff0b60e1e
45+
status: 200 OK
46+
code: 200
47+
duration: ""
48+
- request:
49+
body: ""
50+
form: {}
51+
headers:
52+
User-Agent:
53+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.25.0; linux; amd64) cli-e2e-test
54+
url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/35d4a543-ba4f-46b8-94a1-3e7d1caeccb9
55+
method: DELETE
56+
response:
57+
body: ""
58+
headers:
59+
Content-Security-Policy:
60+
- default-src 'none'; frame-ancestors 'none'
61+
Content-Type:
62+
- application/json
63+
Date:
64+
- Tue, 21 Oct 2025 10:06:35 GMT
65+
Server:
66+
- Scaleway API Gateway (fr-par-1;edge02)
67+
Strict-Transport-Security:
68+
- max-age=63072000
69+
X-Content-Type-Options:
70+
- nosniff
71+
X-Frame-Options:
72+
- DENY
73+
X-Request-Id:
74+
- bc788029-3879-4eff-a462-68b6adbddcb7
75+
status: 204 No Content
76+
code: 204
77+
duration: ""

0 commit comments

Comments
 (0)