Skip to content

Commit e1313fc

Browse files
authored
Merge branch 'scaleway:master' into master
2 parents 5098352 + f5814a4 commit e1313fc

File tree

15 files changed

+328
-31
lines changed

15 files changed

+328
-31
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ jobs:
2222
with:
2323
go-version: '1.24'
2424

25+
- name: Verify go.mod is tidy
26+
run: |
27+
go mod tidy
28+
git diff --exit-code
29+
2530
- name: Run GoReleaser
2631
uses: goreleaser/goreleaser-action@v6
2732
with:

.github/workflows/unit-tests.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
uses: actions/setup-go@v5
2525
with:
2626
go-version: '1.24'
27+
- name: Verify go.mod is tidy
28+
run: |
29+
go mod tidy
30+
git diff --exit-code
2731
- name: Run unit tests
2832
run: go test ./...
2933
- name: Execute main binary # Test the runtime for potential panics.

cmd/scw-sweeper/main.go

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,123 +67,164 @@ func mainNoExit() int {
6767

6868
err = accountSweeper.SweepAll(client)
6969
if err != nil {
70+
log.Fatalf("Error sweeping account: %s", err)
71+
7072
return -1
7173
}
7274

7375
err = applesiliconSweeper.SweepAllLocalities(client)
7476
if err != nil {
77+
log.Fatalf("Error sweeping applesilicon: %s", err)
78+
7579
return -1
7680
}
7781

7882
err = baremetalSweeper.SweepAllLocalities(client)
7983
if err != nil {
84+
log.Fatalf("Error sweeping baremetal: %s", err)
85+
8086
return -1
8187
}
8288

8389
err = cockpitSweeper.SweepAllLocalities(client)
8490
if err != nil {
91+
log.Fatalf("Error sweeping cockpit: %s", err)
92+
8593
return -1
8694
}
8795

8896
err = containerSweeper.SweepAllLocalities(client)
8997
if err != nil {
98+
log.Fatalf("Error sweeping container: %s", err)
99+
90100
return -1
91101
}
92102

93103
err = flexibleipSweeper.SweepAllLocalities(client)
94104
if err != nil {
105+
log.Fatalf("Error sweeping flexibleip: %s", err)
106+
95107
return -1
96108
}
97109

98110
err = functionSweeper.SweepAllLocalities(client)
99111
if err != nil {
112+
log.Fatalf("Error sweeping function: %s", err)
113+
100114
return -1
101115
}
102116

103117
err = iamSweeper.SweepSSHKey(client)
104118
if err != nil {
119+
log.Fatalf("Error sweeping iam: %s", err)
120+
105121
return -1
106122
}
107123

108124
err = inferenceSweeper.SweepAllLocalities(client)
109125
if err != nil {
126+
log.Fatalf("Error sweeping inference: %s", err)
127+
110128
return -1
111129
}
112130

113131
err = instanceSweeper.SweepAllLocalities(client)
114132
if err != nil {
133+
log.Fatalf("Error sweeping instance: %s", err)
134+
115135
return -1
116136
}
117137

118138
// Instance servers need to be swept before volumes and snapshots can be swept
119139
// because volumes and snapshots are attached to servers.
120140
err = blockSweeper.SweepAllLocalities(client)
121141
if err != nil {
142+
log.Fatalf("Error sweeping block: %s", err)
143+
122144
return -1
123145
}
124146

125147
err = iotSweeper.SweepAllLocalities(client)
126148
if err != nil {
127-
return -1
128-
}
149+
log.Fatalf("Error sweeping iot: %s", err)
129150

130-
err = ipamSweeper.SweepAllLocalities(client)
131-
if err != nil {
132151
return -1
133152
}
134153

135154
err = jobsSweeper.SweepAllLocalities(client)
136155
if err != nil {
156+
log.Fatalf("Error sweeping jobs: %s", err)
157+
137158
return -1
138159
}
139160

140161
err = k8sSweeper.SweepAllLocalities(client)
141162
if err != nil {
163+
log.Fatalf("Error sweeping k8s: %s", err)
164+
142165
return -1
143166
}
144167

145168
err = lbSweeper.SweepAllLocalities(client)
146169
if err != nil {
170+
log.Fatalf("Error sweeping lb: %s", err)
171+
147172
return -1
148173
}
149174

150175
err = mongodbSweeper.SweepAllLocalities(client)
151176
if err != nil {
177+
log.Fatalf("Error sweeping mongodb: %s", err)
178+
152179
return -1
153180
}
154181

155182
err = mnqSweeper.SweepAllLocalities(client)
156183
if err != nil {
184+
log.Fatalf("Error sweeping mnq: %s", err)
185+
157186
return -1
158187
}
159188

160189
err = rdbSweeper.SweepAllLocalities(client)
161190
if err != nil {
191+
log.Fatalf("Error sweeping rdb: %s", err)
192+
162193
return -1
163194
}
164195

165196
err = redisSweeper.SweepAllLocalities(client)
166197
if err != nil {
198+
log.Fatalf("Error sweeping redis: %s", err)
199+
167200
return -1
168201
}
169202

170203
err = registrySweeper.SweepAllLocalities(client)
171204
if err != nil {
205+
log.Fatalf("Error sweeping registry: %s", err)
206+
172207
return -1
173208
}
174209

175210
err = secretSweeper.SweepAllLocalities(client)
176211
if err != nil {
212+
log.Fatalf("Error sweeping secret: %s", err)
213+
177214
return -1
178215
}
179216

180217
err = sdbSweeper.SweepAllLocalities(client)
181218
if err != nil {
219+
log.Fatalf("Error sweeping sdb: %s", err)
220+
182221
return -1
183222
}
184223

185224
err = vpcSweeper.SweepAllLocalities(client)
186225
if err != nil {
226+
log.Fatalf("Error sweeping vpc: %s", err)
227+
187228
return -1
188229
}
189230

@@ -201,5 +242,14 @@ func mainNoExit() int {
201242
return -1
202243
}
203244

245+
// IPAM IPs need to be swept in the end because we need to be sure
246+
// that every resource with an attached ip is destroyed before executing it.
247+
err = ipamSweeper.SweepAllLocalities(client)
248+
if err != nil {
249+
log.Fatalf("Error sweeping ipam: %s", err)
250+
251+
return -1
252+
}
253+
204254
return 0
205255
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete an existing user on a Database Instance.
4+
5+
USAGE:
6+
scw mongodb user delete [arg=value ...]
7+
8+
ARGS:
9+
instance-id UUID of the Database Instance the user belongs to
10+
name Name of the database user
11+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
12+
13+
FLAGS:
14+
-h, --help help for delete
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Apply preset roles for a user in a Database Instance.
4+
5+
USAGE:
6+
scw mongodb user set-role [arg=value ...]
7+
8+
ARGS:
9+
instance-id UUID of the Database Instance the user belongs to
10+
[user-name] Name of the database user
11+
[roles.{index}.role] Name of the preset role (unknown_role | read | read_write | db_admin | sync)
12+
[roles.{index}.database] Name of the database on which the preset role will be used
13+
[roles.{index}.any-database] Flag to enable the preset role in all databases
14+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
15+
16+
FLAGS:
17+
-h, --help help for set-role
18+
19+
GLOBAL FLAGS:
20+
-c, --config string The path to the config file
21+
-D, --debug Enable debug mode
22+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
23+
-p, --profile string The config profile to use

cmd/scw/testdata/test-all-usage-mongodb-user-usage.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ USAGE:
66
scw mongodb user <command>
77

88
AVAILABLE COMMANDS:
9+
delete Delete a user on a Database Instance
910
list List users of a Database Instance
11+
set-role Apply user roles
1012
update Update a user on a Database Instance
1113

1214
FLAGS:

cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ USAGE:
66
scw vpc private-network create [arg=value ...]
77

88
ARGS:
9-
name=<generated> Name for the Private Network
10-
[project-id] Project ID to use. If none is passed the default project ID will be used
11-
[tags.{index}] Tags for the Private Network
12-
[subnets.{index}] Private Network subnets CIDR
13-
[vpc-id] VPC in which to create the Private Network
14-
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
9+
name=<generated> Name for the Private Network
10+
[project-id] Project ID to use. If none is passed the default project ID will be used
11+
[tags.{index}] Tags for the Private Network
12+
[subnets.{index}] Private Network subnets CIDR
13+
[vpc-id] VPC in which to create the Private Network
14+
[default-route-propagation-enabled] Defines whether default v4 and v6 routes are propagated for this Private Network
15+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
1516

1617
FLAGS:
1718
-h, --help help for create

cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ USAGE:
66
scw vpc private-network update <private-network-id ...> [arg=value ...]
77

88
ARGS:
9-
private-network-id Private Network ID
10-
[name] Name for the Private Network
11-
[tags.{index}] Tags for the Private Network
12-
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
9+
private-network-id Private Network ID
10+
[name] Name for the Private Network
11+
[tags.{index}] Tags for the Private Network
12+
[default-route-propagation-enabled] Defines whether default v4 and v6 routes are propagated for this Private Network
13+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
1314

1415
FLAGS:
1516
-h, --help help for update

docs/commands/mongodb.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ This API allows you to manage your Managed Databases for MongoDB®.
2121
- [Restore a Database Instance snapshot](#restore-a-database-instance-snapshot)
2222
- [Update a Database Instance snapshot](#update-a-database-instance-snapshot)
2323
- [User management commands](#user-management-commands)
24+
- [Delete a user on a Database Instance](#delete-a-user-on-a-database-instance)
2425
- [List users of a Database Instance](#list-users-of-a-database-instance)
26+
- [Apply user roles](#apply-user-roles)
2527
- [Update a user on a Database Instance](#update-a-user-on-a-database-instance)
2628
- [MongoDB® version management commands](#mongodb®-version-management-commands)
2729
- [List available MongoDB® versions](#list-available-mongodb®-versions)
@@ -373,6 +375,27 @@ scw mongodb snapshot update <snapshot-id ...> [arg=value ...]
373375
Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage.
374376

375377

378+
### Delete a user on a Database Instance
379+
380+
Delete an existing user on a Database Instance.
381+
382+
**Usage:**
383+
384+
```
385+
scw mongodb user delete [arg=value ...]
386+
```
387+
388+
389+
**Args:**
390+
391+
| Name | | Description |
392+
|------|---|-------------|
393+
| instance-id | Required | UUID of the Database Instance the user belongs to |
394+
| name | Required | Name of the database user |
395+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
396+
397+
398+
376399
### List users of a Database Instance
377400

378401
List all users of a given Database Instance.
@@ -395,6 +418,30 @@ scw mongodb user list [arg=value ...]
395418

396419

397420

421+
### Apply user roles
422+
423+
Apply preset roles for a user in a Database Instance.
424+
425+
**Usage:**
426+
427+
```
428+
scw mongodb user set-role [arg=value ...]
429+
```
430+
431+
432+
**Args:**
433+
434+
| Name | | Description |
435+
|------|---|-------------|
436+
| instance-id | Required | UUID of the Database Instance the user belongs to |
437+
| user-name | | Name of the database user |
438+
| roles.{index}.role | One of: `unknown_role`, `read`, `read_write`, `db_admin`, `sync` | Name of the preset role |
439+
| roles.{index}.database | | Name of the database on which the preset role will be used |
440+
| roles.{index}.any-database | | Flag to enable the preset role in all databases |
441+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
442+
443+
444+
398445
### Update a user on a Database Instance
399446

400447
Update the parameters of a user on a Database Instance. You can update the `password` parameter, but you cannot change the name of the user.

docs/commands/vpc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ scw vpc private-network create [arg=value ...]
5757
| tags.{index} | | Tags for the Private Network |
5858
| subnets.{index} | | Private Network subnets CIDR |
5959
| vpc-id | | VPC in which to create the Private Network |
60+
| default-route-propagation-enabled | | Defines whether default v4 and v6 routes are propagated for this Private Network |
6061
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
6162

6263

@@ -166,6 +167,7 @@ scw vpc private-network update <private-network-id ...> [arg=value ...]
166167
| private-network-id | Required | Private Network ID |
167168
| name | | Name for the Private Network |
168169
| tags.{index} | | Tags for the Private Network |
170+
| default-route-propagation-enabled | | Defines whether default v4 and v6 routes are propagated for this Private Network |
169171
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
170172

171173

0 commit comments

Comments
 (0)