Skip to content

Commit cd0e1bd

Browse files
authored
feat(iam): add multi-factor authentication (#1632)
1 parent 44191a1 commit cd0e1bd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

api/iam/v1alpha1/iam_sdk.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,11 +784,13 @@ type User struct {
784784
// Type: type of user.
785785
// Default value: unknown_type
786786
Type UserType `json:"type"`
787-
// TwoFactorEnabled: whether MFA is enabled.
788-
TwoFactorEnabled bool `json:"two_factor_enabled"`
787+
// Deprecated: TwoFactorEnabled: deprecated, use "mfa" instead.
788+
TwoFactorEnabled *bool `json:"two_factor_enabled,omitempty"`
789789
// Status: status of user invitation.
790790
// Default value: unknown_status
791791
Status UserStatus `json:"status"`
792+
// Mfa: whether MFA is enabled.
793+
Mfa bool `json:"mfa"`
792794
}
793795

794796
// Service API
@@ -997,6 +999,8 @@ type ListUsersRequest struct {
997999
OrganizationID *string `json:"-"`
9981000
// UserIDs: filter by list of IDs.
9991001
UserIDs []string `json:"-"`
1002+
// Mfa: filter by MFA status.
1003+
Mfa *bool `json:"-"`
10001004
}
10011005

10021006
// ListUsers: list users of an Organization.
@@ -1015,6 +1019,7 @@ func (s *API) ListUsers(req *ListUsersRequest, opts ...scw.RequestOption) (*List
10151019
parameter.AddToQuery(query, "page", req.Page)
10161020
parameter.AddToQuery(query, "organization_id", req.OrganizationID)
10171021
parameter.AddToQuery(query, "user_ids", req.UserIDs)
1022+
parameter.AddToQuery(query, "mfa", req.Mfa)
10181023

10191024
scwReq := &scw.ScalewayRequest{
10201025
Method: "GET",
@@ -1038,7 +1043,7 @@ type GetUserRequest struct {
10381043
}
10391044

10401045
// GetUser: get a given user.
1041-
// Retrieve information about a user, specified by the `user_id` parameter. The user's full details, including `id`, `email`, `organization_id`, `status` and `two_factor_enabled` are returned in the response.
1046+
// Retrieve information about a user, specified by the `user_id` parameter. The user's full details, including `id`, `email`, `organization_id`, `status` and `mfa` are returned in the response.
10421047
func (s *API) GetUser(req *GetUserRequest, opts ...scw.RequestOption) (*User, error) {
10431048
var err error
10441049

0 commit comments

Comments
 (0)