From 832c8c2a1b609b18022cf3010fb82b5a10a5577e Mon Sep 17 00:00:00 2001 From: namratabhadauriya Date: Mon, 3 Jul 2023 23:26:44 +0530 Subject: [PATCH] feat(Enterprise Management): re-gen service after update trait object Signed-off-by: namratabhadauriya --- .../enterprise_management_v1.go | 62 ++++++++++++------- .../enterprise_management_v1_test.go | 7 +++ 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/enterprisemanagementv1/enterprise_management_v1.go b/enterprisemanagementv1/enterprise_management_v1.go index 7366b27e..039bf90e 100644 --- a/enterprisemanagementv1/enterprise_management_v1.go +++ b/enterprisemanagementv1/enterprise_management_v1.go @@ -43,7 +43,7 @@ type EnterpriseManagementV1 struct { } // DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://enterprise.cloud.ibm.com/v1" +const DefaultServiceURL = "https://enterprise.test.cloud.ibm.com/v1" // DefaultServiceName is the default key used to find external configuration information. const DefaultServiceName = "enterprise_management" @@ -467,7 +467,7 @@ func (enterpriseManagement *EnterpriseManagementV1) ImportAccountToEnterpriseWit pathParamsMap := map[string]string{ "enterprise_id": *importAccountToEnterpriseOptions.EnterpriseID, - "account_id": *importAccountToEnterpriseOptions.AccountID, + "account_id": *importAccountToEnterpriseOptions.AccountID, } builder := core.NewRequestBuilder(core.PUT) @@ -1425,8 +1425,8 @@ type CreateAccountGroupOptions struct { // NewCreateAccountGroupOptions : Instantiate CreateAccountGroupOptions func (*EnterpriseManagementV1) NewCreateAccountGroupOptions(parent string, name string, primaryContactIamID string) *CreateAccountGroupOptions { return &CreateAccountGroupOptions{ - Parent: core.StringPtr(parent), - Name: core.StringPtr(name), + Parent: core.StringPtr(parent), + Name: core.StringPtr(name), PrimaryContactIamID: core.StringPtr(primaryContactIamID), } } @@ -1484,7 +1484,8 @@ type CreateAccountOptions struct { // The IAM ID of the account owner, such as `IBMid-0123ABC`. The IAM ID must already exist. OwnerIamID *string `json:"owner_iam_id" validate:"required"` - // The traits object can be used to opt-out of Multi-Factor Authentication setting when creating a child account in the + // The traits object can be used to set properties on child accounts of an enterprise. You can pass a field to opt-out + // of Multi-Factor Authentication setting or setup enterprise IAM settings when creating a child account in the // enterprise. This is an optional field. Traits *CreateAccountRequestTraits `json:"traits,omitempty"` @@ -1495,8 +1496,8 @@ type CreateAccountOptions struct { // NewCreateAccountOptions : Instantiate CreateAccountOptions func (*EnterpriseManagementV1) NewCreateAccountOptions(parent string, name string, ownerIamID string) *CreateAccountOptions { return &CreateAccountOptions{ - Parent: core.StringPtr(parent), - Name: core.StringPtr(name), + Parent: core.StringPtr(parent), + Name: core.StringPtr(name), OwnerIamID: core.StringPtr(ownerIamID), } } @@ -1531,12 +1532,17 @@ func (options *CreateAccountOptions) SetHeaders(param map[string]string) *Create return options } -// CreateAccountRequestTraits : The traits object can be used to opt-out of Multi-Factor Authentication setting when creating a child account in the +// CreateAccountRequestTraits : The traits object can be used to set properties on child accounts of an enterprise. You can pass a field to opt-out +// of Multi-Factor Authentication setting or setup enterprise IAM settings when creating a child account in the // enterprise. This is an optional field. type CreateAccountRequestTraits struct { - // By default MFA will be set on the account. To opt out, pass the traits object with the mfa field set to empty - // string. + // By default MFA will be enabled on a child account. To opt out, pass the traits object with the mfa field set to + // empty string. This is an optional field. Mfa *string `json:"mfa,omitempty"` + + // The Enterprise IAM settings property will be turned off for a newly created child account by default. You can enable + // this property by passing 'true' in this boolean field. This is an optional field. + EnterpriseIamManaged *bool `json:"enterprise_iam_managed,omitempty"` } // UnmarshalCreateAccountRequestTraits unmarshals an instance of CreateAccountRequestTraits from the specified map of raw messages. @@ -1546,6 +1552,10 @@ func UnmarshalCreateAccountRequestTraits(m map[string]json.RawMessage, result in if err != nil { return } + err = core.UnmarshalPrimitive(m, "enterprise_iam_managed", &obj.EnterpriseIamManaged) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -1588,8 +1598,8 @@ type CreateEnterpriseOptions struct { // NewCreateEnterpriseOptions : Instantiate CreateEnterpriseOptions func (*EnterpriseManagementV1) NewCreateEnterpriseOptions(sourceAccountID string, name string, primaryContactIamID string) *CreateEnterpriseOptions { return &CreateEnterpriseOptions{ - SourceAccountID: core.StringPtr(sourceAccountID), - Name: core.StringPtr(name), + SourceAccountID: core.StringPtr(sourceAccountID), + Name: core.StringPtr(name), PrimaryContactIamID: core.StringPtr(primaryContactIamID), } } @@ -1914,7 +1924,7 @@ type ImportAccountToEnterpriseOptions struct { func (*EnterpriseManagementV1) NewImportAccountToEnterpriseOptions(enterpriseID string, accountID string) *ImportAccountToEnterpriseOptions { return &ImportAccountToEnterpriseOptions{ EnterpriseID: core.StringPtr(enterpriseID), - AccountID: core.StringPtr(accountID), + AccountID: core.StringPtr(accountID), } } @@ -2346,7 +2356,7 @@ type UpdateAccountOptions struct { func (*EnterpriseManagementV1) NewUpdateAccountOptions(accountID string, parent string) *UpdateAccountOptions { return &UpdateAccountOptions{ AccountID: core.StringPtr(accountID), - Parent: core.StringPtr(parent), + Parent: core.StringPtr(parent), } } @@ -2423,11 +2433,13 @@ func (options *UpdateEnterpriseOptions) SetHeaders(param map[string]string) *Upd return options } +// // EnterprisesPager can be used to simplify the use of the "ListEnterprises" method. +// type EnterprisesPager struct { - hasNext bool - options *ListEnterprisesOptions - client *EnterpriseManagementV1 + hasNext bool + options *ListEnterprisesOptions + client *EnterpriseManagementV1 pageContext struct { next *string } @@ -2508,11 +2520,13 @@ func (pager *EnterprisesPager) GetAll() (allItems []Enterprise, err error) { return pager.GetAllWithContext(context.Background()) } +// // AccountsPager can be used to simplify the use of the "ListAccounts" method. +// type AccountsPager struct { - hasNext bool - options *ListAccountsOptions - client *EnterpriseManagementV1 + hasNext bool + options *ListAccountsOptions + client *EnterpriseManagementV1 pageContext struct { next *string } @@ -2593,11 +2607,13 @@ func (pager *AccountsPager) GetAll() (allItems []Account, err error) { return pager.GetAllWithContext(context.Background()) } +// // AccountGroupsPager can be used to simplify the use of the "ListAccountGroups" method. +// type AccountGroupsPager struct { - hasNext bool - options *ListAccountGroupsOptions - client *EnterpriseManagementV1 + hasNext bool + options *ListAccountGroupsOptions + client *EnterpriseManagementV1 pageContext struct { next *string } diff --git a/enterprisemanagementv1/enterprise_management_v1_test.go b/enterprisemanagementv1/enterprise_management_v1_test.go index ac377f3c..4f4b5292 100644 --- a/enterprisemanagementv1/enterprise_management_v1_test.go +++ b/enterprisemanagementv1/enterprise_management_v1_test.go @@ -1181,6 +1181,7 @@ var _ = Describe(`EnterpriseManagementV1`, func() { // Construct an instance of the CreateAccountRequestTraits model createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) // Construct an instance of the CreateAccountOptions model createAccountOptionsModel := new(enterprisemanagementv1.CreateAccountOptions) @@ -1255,6 +1256,7 @@ var _ = Describe(`EnterpriseManagementV1`, func() { // Construct an instance of the CreateAccountRequestTraits model createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) // Construct an instance of the CreateAccountOptions model createAccountOptionsModel := new(enterprisemanagementv1.CreateAccountOptions) @@ -1337,6 +1339,7 @@ var _ = Describe(`EnterpriseManagementV1`, func() { // Construct an instance of the CreateAccountRequestTraits model createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) // Construct an instance of the CreateAccountOptions model createAccountOptionsModel := new(enterprisemanagementv1.CreateAccountOptions) @@ -1364,6 +1367,7 @@ var _ = Describe(`EnterpriseManagementV1`, func() { // Construct an instance of the CreateAccountRequestTraits model createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) // Construct an instance of the CreateAccountOptions model createAccountOptionsModel := new(enterprisemanagementv1.CreateAccountOptions) @@ -1412,6 +1416,7 @@ var _ = Describe(`EnterpriseManagementV1`, func() { // Construct an instance of the CreateAccountRequestTraits model createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) // Construct an instance of the CreateAccountOptions model createAccountOptionsModel := new(enterprisemanagementv1.CreateAccountOptions) @@ -3151,7 +3156,9 @@ var _ = Describe(`EnterpriseManagementV1`, func() { createAccountRequestTraitsModel := new(enterprisemanagementv1.CreateAccountRequestTraits) Expect(createAccountRequestTraitsModel).ToNot(BeNil()) createAccountRequestTraitsModel.Mfa = core.StringPtr("testString") + createAccountRequestTraitsModel.EnterpriseIamManaged = core.BoolPtr(true) Expect(createAccountRequestTraitsModel.Mfa).To(Equal(core.StringPtr("testString"))) + Expect(createAccountRequestTraitsModel.EnterpriseIamManaged).To(Equal(core.BoolPtr(true))) // Construct an instance of the CreateAccountOptions model createAccountOptionsParent := "testString"