Skip to content

Commit

Permalink
feat(Enterprise Management): re-gen service after update trait object
Browse files Browse the repository at this point in the history
Signed-off-by: namratabhadauriya <[email protected]>
  • Loading branch information
namratabhadauriya committed Jul 3, 2023
1 parent 17e9ac5 commit 832c8c2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 23 deletions.
62 changes: 39 additions & 23 deletions enterprisemanagementv1/enterprise_management_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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),
}
}
Expand Down Expand Up @@ -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"`

Expand All @@ -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),
}
}
Expand Down Expand Up @@ -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.
Expand All @@ -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
}
Expand Down Expand Up @@ -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),
}
}
Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions enterprisemanagementv1/enterprise_management_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 832c8c2

Please sign in to comment.