@@ -1406,6 +1406,12 @@ type CreateSSHKeyRequest struct {
14061406 ProjectID string `json:"project_id"`
14071407}
14081408
1409+ // CreateUserMFAOTPRequest: create user mfaotp request.
1410+ type CreateUserMFAOTPRequest struct {
1411+ // UserID: user ID of the MFA OTP.
1412+ UserID string `json:"-"`
1413+ }
1414+
14091415// CreateUserRequest: create user request.
14101416type CreateUserRequest struct {
14111417 // OrganizationID: ID of the Organization.
@@ -1458,6 +1464,12 @@ type DeleteSSHKeyRequest struct {
14581464 SSHKeyID string `json:"-"`
14591465}
14601466
1467+ // DeleteUserMFAOTPRequest: delete user mfaotp request.
1468+ type DeleteUserMFAOTPRequest struct {
1469+ // UserID: user ID of the MFA OTP.
1470+ UserID string `json:"-"`
1471+ }
1472+
14611473// DeleteUserRequest: delete user request.
14621474type DeleteUserRequest struct {
14631475 // UserID: ID of the user to delete.
@@ -2157,6 +2169,11 @@ type LockUserRequest struct {
21572169 UserID string `json:"-"`
21582170}
21592171
2172+ // MFAOTP: mfaotp.
2173+ type MFAOTP struct {
2174+ Secret string `json:"secret"`
2175+ }
2176+
21602177// OrganizationSecuritySettings: organization security settings.
21612178type OrganizationSecuritySettings struct {
21622179 // EnforcePasswordRenewal: defines whether password renewal is enforced during first login.
@@ -2342,6 +2359,21 @@ type UpdateUserUsernameRequest struct {
23422359 Username string `json:"username"`
23432360}
23442361
2362+ // ValidateUserMFAOTPRequest: validate user mfaotp request.
2363+ type ValidateUserMFAOTPRequest struct {
2364+ // UserID: user ID of the MFA OTP.
2365+ UserID string `json:"-"`
2366+
2367+ // OneTimePassword: a password generated using the OTP.
2368+ OneTimePassword string `json:"one_time_password"`
2369+ }
2370+
2371+ // ValidateUserMFAOTPResponse: validate user mfaotp response.
2372+ type ValidateUserMFAOTPResponse struct {
2373+ // RecoveryCodes: list of recovery codes usable for this OTP method.
2374+ RecoveryCodes []string `json:"recovery_codes"`
2375+ }
2376+
23452377// This API allows you to manage Identity and Access Management (IAM) across your Scaleway Organizations, Projects and resources.
23462378type API struct {
23472379 client * scw.Client
@@ -2672,6 +2704,85 @@ func (s *API) UpdateUserPassword(req *UpdateUserPasswordRequest, opts ...scw.Req
26722704 return & resp , nil
26732705}
26742706
2707+ // CreateUserMFAOTP: Create a MFA OTP. Private Beta feature.
2708+ func (s * API ) CreateUserMFAOTP (req * CreateUserMFAOTPRequest , opts ... scw.RequestOption ) (* MFAOTP , error ) {
2709+ var err error
2710+
2711+ if fmt .Sprint (req .UserID ) == "" {
2712+ return nil , errors .New ("field UserID cannot be empty in request" )
2713+ }
2714+
2715+ scwReq := & scw.ScalewayRequest {
2716+ Method : "POST" ,
2717+ Path : "/iam/v1alpha1/users/" + fmt .Sprint (req .UserID ) + "/mfa-otp" ,
2718+ }
2719+
2720+ err = scwReq .SetBody (req )
2721+ if err != nil {
2722+ return nil , err
2723+ }
2724+
2725+ var resp MFAOTP
2726+
2727+ err = s .client .Do (scwReq , & resp , opts ... )
2728+ if err != nil {
2729+ return nil , err
2730+ }
2731+ return & resp , nil
2732+ }
2733+
2734+ // ValidateUserMFAOTP: Validate a MFA OTP. Private Beta feature.
2735+ func (s * API ) ValidateUserMFAOTP (req * ValidateUserMFAOTPRequest , opts ... scw.RequestOption ) (* ValidateUserMFAOTPResponse , error ) {
2736+ var err error
2737+
2738+ if fmt .Sprint (req .UserID ) == "" {
2739+ return nil , errors .New ("field UserID cannot be empty in request" )
2740+ }
2741+
2742+ scwReq := & scw.ScalewayRequest {
2743+ Method : "POST" ,
2744+ Path : "/iam/v1alpha1/users/" + fmt .Sprint (req .UserID ) + "/validate-mfa-otp" ,
2745+ }
2746+
2747+ err = scwReq .SetBody (req )
2748+ if err != nil {
2749+ return nil , err
2750+ }
2751+
2752+ var resp ValidateUserMFAOTPResponse
2753+
2754+ err = s .client .Do (scwReq , & resp , opts ... )
2755+ if err != nil {
2756+ return nil , err
2757+ }
2758+ return & resp , nil
2759+ }
2760+
2761+ // DeleteUserMFAOTP: Delete a MFA OTP. Private Beta feature.
2762+ func (s * API ) DeleteUserMFAOTP (req * DeleteUserMFAOTPRequest , opts ... scw.RequestOption ) error {
2763+ var err error
2764+
2765+ if fmt .Sprint (req .UserID ) == "" {
2766+ return errors .New ("field UserID cannot be empty in request" )
2767+ }
2768+
2769+ scwReq := & scw.ScalewayRequest {
2770+ Method : "DELETE" ,
2771+ Path : "/iam/v1alpha1/users/" + fmt .Sprint (req .UserID ) + "/mfa-otp" ,
2772+ }
2773+
2774+ err = scwReq .SetBody (req )
2775+ if err != nil {
2776+ return err
2777+ }
2778+
2779+ err = s .client .Do (scwReq , nil , opts ... )
2780+ if err != nil {
2781+ return err
2782+ }
2783+ return nil
2784+ }
2785+
26752786// LockUser: Lock a member. A locked member cannot log in or use API keys until the locked status is removed. Private Beta feature.
26762787func (s * API ) LockUser (req * LockUserRequest , opts ... scw.RequestOption ) (* User , error ) {
26772788 var err error
0 commit comments