@@ -1639,6 +1639,12 @@ type GetLogRequest struct {
16391639 LogID string `json:"-"`
16401640}
16411641
1642+ // GetOrganizationRequest: get organization request.
1643+ type GetOrganizationRequest struct {
1644+ // OrganizationID: ID of the Organization.
1645+ OrganizationID string `json:"-"`
1646+ }
1647+
16421648// GetOrganizationSecuritySettingsRequest: get organization security settings request.
16431649type GetOrganizationSecuritySettingsRequest struct {
16441650 // OrganizationID: ID of the Organization.
@@ -2338,6 +2344,18 @@ type MigrateOrganizationGuestsRequest struct {
23382344 OrganizationID string `json:"-"`
23392345}
23402346
2347+ // Organization: organization.
2348+ type Organization struct {
2349+ // ID: ID of the Organization.
2350+ ID string `json:"id"`
2351+
2352+ // Name: name of the Organization.
2353+ Name string `json:"name"`
2354+
2355+ // Alias: alias of the Organization.
2356+ Alias string `json:"alias"`
2357+ }
2358+
23412359// OrganizationSecuritySettings: organization security settings.
23422360type OrganizationSecuritySettings struct {
23432361 // EnforcePasswordRenewal: defines whether password renewal is enforced during first login.
@@ -2382,6 +2400,15 @@ type SetGroupMembersRequest struct {
23822400 ApplicationIDs []string `json:"application_ids"`
23832401}
23842402
2403+ // SetOrganizationAliasRequest: set organization alias request.
2404+ type SetOrganizationAliasRequest struct {
2405+ // OrganizationID: ID of the Organization.
2406+ OrganizationID string `json:"-"`
2407+
2408+ // Alias: alias of the Organization.
2409+ Alias string `json:"alias"`
2410+ }
2411+
23852412// SetRulesRequest: set rules request.
23862413type SetRulesRequest struct {
23872414 // PolicyID: id of policy to update.
@@ -4206,6 +4233,65 @@ func (s *API) UpdateOrganizationSecuritySettings(req *UpdateOrganizationSecurity
42064233 return & resp , nil
42074234}
42084235
4236+ // SetOrganizationAlias: This will fail if an alias has already been defined. Please contact support if you need to change your Organization's alias.
4237+ func (s * API ) SetOrganizationAlias (req * SetOrganizationAliasRequest , opts ... scw.RequestOption ) (* Organization , error ) {
4238+ var err error
4239+
4240+ if req .OrganizationID == "" {
4241+ defaultOrganizationID , _ := s .client .GetDefaultOrganizationID ()
4242+ req .OrganizationID = defaultOrganizationID
4243+ }
4244+
4245+ if fmt .Sprint (req .OrganizationID ) == "" {
4246+ return nil , errors .New ("field OrganizationID cannot be empty in request" )
4247+ }
4248+
4249+ scwReq := & scw.ScalewayRequest {
4250+ Method : "PUT" ,
4251+ Path : "/iam/v1alpha1/organizations/" + fmt .Sprint (req .OrganizationID ) + "/alias" ,
4252+ }
4253+
4254+ err = scwReq .SetBody (req )
4255+ if err != nil {
4256+ return nil , err
4257+ }
4258+
4259+ var resp Organization
4260+
4261+ err = s .client .Do (scwReq , & resp , opts ... )
4262+ if err != nil {
4263+ return nil , err
4264+ }
4265+ return & resp , nil
4266+ }
4267+
4268+ // GetOrganization: Get your Organization's IAM information.
4269+ func (s * API ) GetOrganization (req * GetOrganizationRequest , opts ... scw.RequestOption ) (* Organization , error ) {
4270+ var err error
4271+
4272+ if req .OrganizationID == "" {
4273+ defaultOrganizationID , _ := s .client .GetDefaultOrganizationID ()
4274+ req .OrganizationID = defaultOrganizationID
4275+ }
4276+
4277+ if fmt .Sprint (req .OrganizationID ) == "" {
4278+ return nil , errors .New ("field OrganizationID cannot be empty in request" )
4279+ }
4280+
4281+ scwReq := & scw.ScalewayRequest {
4282+ Method : "GET" ,
4283+ Path : "/iam/v1alpha1/organizations/" + fmt .Sprint (req .OrganizationID ) + "" ,
4284+ }
4285+
4286+ var resp Organization
4287+
4288+ err = s .client .Do (scwReq , & resp , opts ... )
4289+ if err != nil {
4290+ return nil , err
4291+ }
4292+ return & resp , nil
4293+ }
4294+
42094295// MigrateOrganizationGuests: Migrate the organization's guests to IAM members.
42104296func (s * API ) MigrateOrganizationGuests (req * MigrateOrganizationGuestsRequest , opts ... scw.RequestOption ) error {
42114297 var err error
0 commit comments