Skip to content

Commit f551ea5

Browse files
feat(iam): add guest migration endpoint (scaleway#2558)
Co-authored-by: Laure-di <[email protected]>
1 parent 10ab085 commit f551ea5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

api/iam/v1alpha1/iam_sdk.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,12 @@ type MFAOTP struct {
23112311
Secret string `json:"secret"`
23122312
}
23132313

2314+
// MigrateOrganizationGuestsRequest: migrate organization guests request.
2315+
type MigrateOrganizationGuestsRequest struct {
2316+
// OrganizationID: ID of the Organization.
2317+
OrganizationID string `json:"-"`
2318+
}
2319+
23142320
// OrganizationSecuritySettings: organization security settings.
23152321
type OrganizationSecuritySettings struct {
23162322
// EnforcePasswordRenewal: defines whether password renewal is enforced during first login.
@@ -4092,3 +4098,28 @@ func (s *API) UpdateOrganizationSecuritySettings(req *UpdateOrganizationSecurity
40924098
}
40934099
return &resp, nil
40944100
}
4101+
4102+
// MigrateOrganizationGuests: Migrate the organization's guests to IAM members.
4103+
func (s *API) MigrateOrganizationGuests(req *MigrateOrganizationGuestsRequest, opts ...scw.RequestOption) error {
4104+
var err error
4105+
4106+
if req.OrganizationID == "" {
4107+
defaultOrganizationID, _ := s.client.GetDefaultOrganizationID()
4108+
req.OrganizationID = defaultOrganizationID
4109+
}
4110+
4111+
if fmt.Sprint(req.OrganizationID) == "" {
4112+
return errors.New("field OrganizationID cannot be empty in request")
4113+
}
4114+
4115+
scwReq := &scw.ScalewayRequest{
4116+
Method: "POST",
4117+
Path: "/iam/v1alpha1/organizations/" + fmt.Sprint(req.OrganizationID) + "/migrate-guests",
4118+
}
4119+
4120+
err = s.client.Do(scwReq, nil, opts...)
4121+
if err != nil {
4122+
return err
4123+
}
4124+
return nil
4125+
}

0 commit comments

Comments
 (0)