Skip to content

Commit 1b1777f

Browse files
authored
Merge branch 'master' into feat/redis-connect
2 parents 384c8b6 + bed543b commit 1b1777f

File tree

9 files changed

+211
-8
lines changed

9 files changed

+211
-8
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Retrieve information about the security settings of an Organization, specified by the `organization_id` parameter.
4+
5+
USAGE:
6+
scw iam security-settings get [arg=value ...]
7+
8+
ARGS:
9+
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
10+
11+
FLAGS:
12+
-h, --help help for get
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-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+
Update the security settings of an Organization.
4+
5+
USAGE:
6+
scw iam security-settings update [arg=value ...]
7+
8+
ARGS:
9+
[enforce-password-renewal] Defines whether password renewal is enforced during first login
10+
[grace-period-duration] Duration of the grace period to renew password or enable MFA.
11+
[login-attempts-before-locked] Number of login attempts before the account is locked
12+
[max-login-session-duration] Maximum duration a login session will stay active before needing to relogin.
13+
[max-api-key-expiration-duration] Maximum duration the `expires_at` field of an API key can represent. A value of 0 means there is no maximum duration.
14+
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
15+
16+
FLAGS:
17+
-h, --help help for update
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
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Security settings management commands.
4+
5+
USAGE:
6+
scw iam security-settings <command>
7+
8+
AVAILABLE COMMANDS:
9+
get Get security settings of an Organization
10+
update Update the security settings of an Organization
11+
12+
FLAGS:
13+
-h, --help help for security-settings
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
20+
21+
Use "scw iam security-settings [command] --help" for more information about a command.

cmd/scw/testdata/test-all-usage-iam-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ AVAILABLE COMMANDS:
1717
rule Rules management commands
1818
saml SAML management commands
1919
saml-certificates SAML Certificates management commands
20+
security-settings Security settings management commands
2021
ssh-key SSH keys management commands
2122
user Users management commands
2223

docs/commands/iam.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ This API allows you to manage Identity and Access Management (IAM) across your S
5555
- [Add a SAML certificate](#add-a-saml-certificate)
5656
- [Delete a SAML certificate](#delete-a-saml-certificate)
5757
- [List SAML certificates](#list-saml-certificates)
58+
- [Security settings management commands](#security-settings-management-commands)
59+
- [Get security settings of an Organization](#get-security-settings-of-an-organization)
60+
- [Update the security settings of an Organization](#update-the-security-settings-of-an-organization)
5861
- [SSH keys management commands](#ssh-keys-management-commands)
5962
- [Create an SSH key](#create-an-ssh-key)
6063
- [Delete an SSH key](#delete-an-ssh-key)
@@ -1064,6 +1067,54 @@ scw iam saml-certificates list <saml-id ...> [arg=value ...]
10641067

10651068

10661069

1070+
## Security settings management commands
1071+
1072+
Security settings management commands.
1073+
1074+
1075+
### Get security settings of an Organization
1076+
1077+
Retrieve information about the security settings of an Organization, specified by the `organization_id` parameter.
1078+
1079+
**Usage:**
1080+
1081+
```
1082+
scw iam security-settings get [arg=value ...]
1083+
```
1084+
1085+
1086+
**Args:**
1087+
1088+
| Name | | Description |
1089+
|------|---|-------------|
1090+
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
1091+
1092+
1093+
1094+
### Update the security settings of an Organization
1095+
1096+
Update the security settings of an Organization.
1097+
1098+
**Usage:**
1099+
1100+
```
1101+
scw iam security-settings update [arg=value ...]
1102+
```
1103+
1104+
1105+
**Args:**
1106+
1107+
| Name | | Description |
1108+
|------|---|-------------|
1109+
| enforce-password-renewal | | Defines whether password renewal is enforced during first login |
1110+
| grace-period-duration | | Duration of the grace period to renew password or enable MFA. |
1111+
| login-attempts-before-locked | | Number of login attempts before the account is locked |
1112+
| max-login-session-duration | | Maximum duration a login session will stay active before needing to relogin. |
1113+
| max-api-key-expiration-duration | | Maximum duration the `expires_at` field of an API key can represent. A value of 0 means there is no maximum duration. |
1114+
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
1115+
1116+
1117+
10671118
## SSH keys management commands
10681119

10691120
SSH keys management commands.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/mattn/go-isatty v0.0.20
2424
github.com/moby/buildkit v0.26.2
2525
github.com/opencontainers/go-digest v1.0.0
26-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251201083602-34ad6e238d5e
26+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251202131048-1c7b2248aaba
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
464464
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
465465
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
466466
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
467-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251201083602-34ad6e238d5e h1:GdOB9k6UI1zh3nOLmW4v/EYzK4GaWLbAsb/PixYrTts=
468-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251201083602-34ad6e238d5e/go.mod h1:h/elW4JdNo225GP5FZHJ/RPyCNz79lxaeub3PyGzE9o=
467+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251202131048-1c7b2248aaba h1:uROS5GNQhplrMMeuuSHC47/Nztx4CWP07JoQMykzPxQ=
468+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251202131048-1c7b2248aaba/go.mod h1:h/elW4JdNo225GP5FZHJ/RPyCNz79lxaeub3PyGzE9o=
469469
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
470470
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
471471
github.com/secure-systems-lab/go-securesystemslib v0.9.1 h1:nZZaNz4DiERIQguNy0cL5qTdn9lR8XKHf4RUyG1Sx3g=

internal/namespaces/iam/v1alpha1/iam_cli.go

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func GetGeneratedCommands() *core.Commands {
3333
iamOrganization(),
3434
iamSaml(),
3535
iamSamlCertificates(),
36+
iamSecuritySettings(),
3637
iamSSHKeyList(),
3738
iamSSHKeyCreate(),
3839
iamSSHKeyGet(),
@@ -80,6 +81,8 @@ func GetGeneratedCommands() *core.Commands {
8081
iamJwtDelete(),
8182
iamLogList(),
8283
iamLogGet(),
84+
iamSecuritySettingsGet(),
85+
iamSecuritySettingsUpdate(),
8386
iamOrganizationGetSaml(),
8487
iamOrganizationEnableSaml(),
8588
iamSamlUpdate(),
@@ -215,6 +218,15 @@ func iamSamlCertificates() *core.Command {
215218
}
216219
}
217220

221+
func iamSecuritySettings() *core.Command {
222+
return &core.Command{
223+
Short: `Security settings management commands`,
224+
Long: `Security settings management commands.`,
225+
Namespace: "iam",
226+
Resource: "security-settings",
227+
}
228+
}
229+
218230
func iamSSHKeyList() *core.Command {
219231
return &core.Command{
220232
Short: `List SSH keys`,
@@ -2730,6 +2742,87 @@ func iamLogGet() *core.Command {
27302742
}
27312743
}
27322744

2745+
func iamSecuritySettingsGet() *core.Command {
2746+
return &core.Command{
2747+
Short: `Get security settings of an Organization`,
2748+
Long: `Retrieve information about the security settings of an Organization, specified by the ` + "`" + `organization_id` + "`" + ` parameter.`,
2749+
Namespace: "iam",
2750+
Resource: "security-settings",
2751+
Verb: "get",
2752+
// Deprecated: false,
2753+
ArgsType: reflect.TypeOf(iam.GetOrganizationSecuritySettingsRequest{}),
2754+
ArgSpecs: core.ArgSpecs{
2755+
core.OrganizationIDArgSpec(),
2756+
},
2757+
Run: func(ctx context.Context, args any) (i any, e error) {
2758+
request := args.(*iam.GetOrganizationSecuritySettingsRequest)
2759+
2760+
client := core.ExtractClient(ctx)
2761+
api := iam.NewAPI(client)
2762+
2763+
return api.GetOrganizationSecuritySettings(request)
2764+
},
2765+
}
2766+
}
2767+
2768+
func iamSecuritySettingsUpdate() *core.Command {
2769+
return &core.Command{
2770+
Short: `Update the security settings of an Organization`,
2771+
Long: `Update the security settings of an Organization.`,
2772+
Namespace: "iam",
2773+
Resource: "security-settings",
2774+
Verb: "update",
2775+
// Deprecated: false,
2776+
ArgsType: reflect.TypeOf(iam.UpdateOrganizationSecuritySettingsRequest{}),
2777+
ArgSpecs: core.ArgSpecs{
2778+
{
2779+
Name: "enforce-password-renewal",
2780+
Short: `Defines whether password renewal is enforced during first login`,
2781+
Required: false,
2782+
Deprecated: false,
2783+
Positional: false,
2784+
},
2785+
{
2786+
Name: "grace-period-duration",
2787+
Short: `Duration of the grace period to renew password or enable MFA.`,
2788+
Required: false,
2789+
Deprecated: false,
2790+
Positional: false,
2791+
},
2792+
{
2793+
Name: "login-attempts-before-locked",
2794+
Short: `Number of login attempts before the account is locked`,
2795+
Required: false,
2796+
Deprecated: false,
2797+
Positional: false,
2798+
},
2799+
{
2800+
Name: "max-login-session-duration",
2801+
Short: `Maximum duration a login session will stay active before needing to relogin.`,
2802+
Required: false,
2803+
Deprecated: false,
2804+
Positional: false,
2805+
},
2806+
{
2807+
Name: "max-api-key-expiration-duration",
2808+
Short: `Maximum duration the ` + "`" + `expires_at` + "`" + ` field of an API key can represent. A value of 0 means there is no maximum duration.`,
2809+
Required: false,
2810+
Deprecated: false,
2811+
Positional: false,
2812+
},
2813+
core.OrganizationIDArgSpec(),
2814+
},
2815+
Run: func(ctx context.Context, args any) (i any, e error) {
2816+
request := args.(*iam.UpdateOrganizationSecuritySettingsRequest)
2817+
2818+
client := core.ExtractClient(ctx)
2819+
api := iam.NewAPI(client)
2820+
2821+
return api.UpdateOrganizationSecuritySettings(request)
2822+
},
2823+
}
2824+
}
2825+
27332826
func iamOrganizationGetSaml() *core.Command {
27342827
return &core.Command{
27352828
Short: `Get SAML Identity Provider configuration of an Organization`,

internal/namespaces/instance/v1/helpers_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ func deleteServer(metaKey string) core.AfterFunc {
8888

8989
// createVolume creates a volume of the given size and type and
9090
// register it in the context Meta at metaKey.
91-
//
92-
//nolint:unparam
9391
func createVolume(
9492
metaKey string,
9593
sizeInGb int,
@@ -110,14 +108,12 @@ func createVolume(
110108
}
111109

112110
// deleteVolume deletes a volume previously registered in the context Meta at metaKey.
113-
func deleteVolume(metaKey string) core.AfterFunc { //nolint: unparam
111+
func deleteVolume(metaKey string) core.AfterFunc {
114112
return core.ExecAfterCmd("scw instance volume delete {{ ." + metaKey + ".ID }}")
115113
}
116114

117115
// createSbsVolume creates a volume of the given size and
118116
// register it in the context Meta at metaKey
119-
//
120-
//nolint:unparam
121117
func createSbsVolume(metaKey string, sizeInGb int) core.BeforeFunc {
122118
return func(ctx *core.BeforeFuncCtx) error {
123119
cmd := fmt.Sprintf(

0 commit comments

Comments
 (0)