@@ -1412,7 +1412,7 @@ type CreateUserRequest struct {
14121412 // Tags: tags associated with the user.
14131413 Tags []string `json:"tags"`
14141414
1415- // Member: a new IAM Member to create .
1415+ // Member: details of IAM member. Private Beta feature .
14161416 // Precisely one of Email, Member must be set.
14171417 Member * CreateUserRequestMember `json:"member,omitempty"`
14181418}
@@ -1500,6 +1500,12 @@ type GetLogRequest struct {
15001500 LogID string `json:"-"`
15011501}
15021502
1503+ // GetOrganizationSecuritySettingsRequest: get organization security settings request.
1504+ type GetOrganizationSecuritySettingsRequest struct {
1505+ // OrganizationID: ID of the Organization.
1506+ OrganizationID string `json:"-"`
1507+ }
1508+
15031509// GetPolicyRequest: get policy request.
15041510type GetPolicyRequest struct {
15051511 // PolicyID: id of policy to search.
@@ -2145,6 +2151,18 @@ type LockUserRequest struct {
21452151 UserID string `json:"-"`
21462152}
21472153
2154+ // OrganizationSecuritySettings: organization security settings.
2155+ type OrganizationSecuritySettings struct {
2156+ // EnforcePasswordRenewal: defines whether password renewal is enforced during first login.
2157+ EnforcePasswordRenewal bool `json:"enforce_password_renewal"`
2158+
2159+ // GracePeriodDuration: duration of the grace period to renew password or enable MFA.
2160+ GracePeriodDuration * scw.Duration `json:"grace_period_duration"`
2161+
2162+ // LoginAttemptsBeforeLocked: number of login attempts before the account is locked.
2163+ LoginAttemptsBeforeLocked uint32 `json:"login_attempts_before_locked"`
2164+ }
2165+
21482166// RemoveGroupMemberRequest: remove group member request.
21492167type RemoveGroupMemberRequest struct {
21502168 // GroupID: ID of the group.
@@ -2231,6 +2249,21 @@ type UpdateGroupRequest struct {
22312249 Tags * []string `json:"tags,omitempty"`
22322250}
22332251
2252+ // UpdateOrganizationSecuritySettingsRequest: update organization security settings request.
2253+ type UpdateOrganizationSecuritySettingsRequest struct {
2254+ // OrganizationID: ID of the Organization.
2255+ OrganizationID string `json:"-"`
2256+
2257+ // EnforcePasswordRenewal: defines whether password renewal is enforced during first login.
2258+ EnforcePasswordRenewal * bool `json:"enforce_password_renewal,omitempty"`
2259+
2260+ // GracePeriodDuration: duration of the grace period to renew password or enable MFA.
2261+ GracePeriodDuration * scw.Duration `json:"grace_period_duration,omitempty"`
2262+
2263+ // LoginAttemptsBeforeLocked: number of login attempts before the account is locked.
2264+ LoginAttemptsBeforeLocked * uint32 `json:"login_attempts_before_locked,omitempty"`
2265+ }
2266+
22342267// UpdatePolicyRequest: update policy request.
22352268type UpdatePolicyRequest struct {
22362269 // PolicyID: id of policy to update.
@@ -2293,7 +2326,7 @@ type UpdateUserRequest struct {
22932326 // Tags: new tags for the user (maximum of 10 tags).
22942327 Tags * []string `json:"tags,omitempty"`
22952328
2296- // Email: new email for the user (only available on Members) .
2329+ // Email: iAM member email .
22972330 Email * string `json:"email,omitempty"`
22982331}
22992332
@@ -2573,7 +2606,7 @@ func (s *API) CreateUser(req *CreateUserRequest, opts ...scw.RequestOption) (*Us
25732606 return & resp , nil
25742607}
25752608
2576- // UpdateUserPassword: Update an user's password.
2609+ // UpdateUserPassword: Update an user's password. Private Beta feature.
25772610func (s * API ) UpdateUserPassword (req * UpdateUserPasswordRequest , opts ... scw.RequestOption ) (* User , error ) {
25782611 var err error
25792612
@@ -2600,7 +2633,7 @@ func (s *API) UpdateUserPassword(req *UpdateUserPasswordRequest, opts ...scw.Req
26002633 return & resp , nil
26012634}
26022635
2603- // LockUser: Lock a user. Note that a locked user cannot log in or use API keys until the locked status is removed.
2636+ // LockUser: Lock a member. A locked member cannot log in or use API keys until the locked status is removed. Private Beta feature .
26042637func (s * API ) LockUser (req * LockUserRequest , opts ... scw.RequestOption ) (* User , error ) {
26052638 var err error
26062639
@@ -2627,7 +2660,7 @@ func (s *API) LockUser(req *LockUserRequest, opts ...scw.RequestOption) (*User,
26272660 return & resp , nil
26282661}
26292662
2630- // UnlockUser: Unlock a user .
2663+ // UnlockUser: Unlock a member. Private Beta feature .
26312664func (s * API ) UnlockUser (req * UnlockUserRequest , opts ... scw.RequestOption ) (* User , error ) {
26322665 var err error
26332666
@@ -2654,7 +2687,7 @@ func (s *API) UnlockUser(req *UnlockUserRequest, opts ...scw.RequestOption) (*Us
26542687 return & resp , nil
26552688}
26562689
2657- // ListGracePeriods: List the grace periods of a user .
2690+ // ListGracePeriods: List the grace periods of a member. Private Beta feature .
26582691func (s * API ) ListGracePeriods (req * ListGracePeriodsRequest , opts ... scw.RequestOption ) (* ListGracePeriodsResponse , error ) {
26592692 var err error
26602693
@@ -3362,7 +3395,7 @@ func (s *API) ListAPIKeys(req *ListAPIKeysRequest, opts ...scw.RequestOption) (*
33623395 return & resp , nil
33633396}
33643397
3365- // CreateAPIKey: Create an API key. You must specify the `application_id` or the `user_id` and the description. You can also specify the `default_project_id` which is the Project ID of your preferred Project, to use with Object Storage. The `access_key` and `secret_key` values are returned in the response. Note that he secret key is only showed once. Make sure that you copy and store both keys somewhere safe.
3398+ // CreateAPIKey: Create an API key. You must specify the `application_id` or the `user_id` and the description. You can also specify the `default_project_id`, which is the Project ID of your preferred Project, to use with Object Storage. The `access_key` and `secret_key` values are returned in the response. Note that the secret key is only shown once. Make sure that you copy and store both keys somewhere safe.
33663399func (s * API ) CreateAPIKey (req * CreateAPIKeyRequest , opts ... scw.RequestOption ) (* APIKey , error ) {
33673400 var err error
33683401
@@ -3678,3 +3711,62 @@ func (s *API) GetLog(req *GetLogRequest, opts ...scw.RequestOption) (*Log, error
36783711 }
36793712 return & resp , nil
36803713}
3714+
3715+ // GetOrganizationSecuritySettings: Retrieve information about the security settings of an Organization, specified by the `organization_id` parameter.
3716+ func (s * API ) GetOrganizationSecuritySettings (req * GetOrganizationSecuritySettingsRequest , opts ... scw.RequestOption ) (* OrganizationSecuritySettings , error ) {
3717+ var err error
3718+
3719+ if req .OrganizationID == "" {
3720+ defaultOrganizationID , _ := s .client .GetDefaultOrganizationID ()
3721+ req .OrganizationID = defaultOrganizationID
3722+ }
3723+
3724+ if fmt .Sprint (req .OrganizationID ) == "" {
3725+ return nil , errors .New ("field OrganizationID cannot be empty in request" )
3726+ }
3727+
3728+ scwReq := & scw.ScalewayRequest {
3729+ Method : "GET" ,
3730+ Path : "/iam/v1alpha1/organizations/" + fmt .Sprint (req .OrganizationID ) + "/security-settings" ,
3731+ }
3732+
3733+ var resp OrganizationSecuritySettings
3734+
3735+ err = s .client .Do (scwReq , & resp , opts ... )
3736+ if err != nil {
3737+ return nil , err
3738+ }
3739+ return & resp , nil
3740+ }
3741+
3742+ // UpdateOrganizationSecuritySettings: Update the security settings of an Organization.
3743+ func (s * API ) UpdateOrganizationSecuritySettings (req * UpdateOrganizationSecuritySettingsRequest , opts ... scw.RequestOption ) (* OrganizationSecuritySettings , error ) {
3744+ var err error
3745+
3746+ if req .OrganizationID == "" {
3747+ defaultOrganizationID , _ := s .client .GetDefaultOrganizationID ()
3748+ req .OrganizationID = defaultOrganizationID
3749+ }
3750+
3751+ if fmt .Sprint (req .OrganizationID ) == "" {
3752+ return nil , errors .New ("field OrganizationID cannot be empty in request" )
3753+ }
3754+
3755+ scwReq := & scw.ScalewayRequest {
3756+ Method : "PATCH" ,
3757+ Path : "/iam/v1alpha1/organizations/" + fmt .Sprint (req .OrganizationID ) + "/security-settings" ,
3758+ }
3759+
3760+ err = scwReq .SetBody (req )
3761+ if err != nil {
3762+ return nil , err
3763+ }
3764+
3765+ var resp OrganizationSecuritySettings
3766+
3767+ err = s .client .Do (scwReq , & resp , opts ... )
3768+ if err != nil {
3769+ return nil , err
3770+ }
3771+ return & resp , nil
3772+ }
0 commit comments