Skip to content

Commit

Permalink
chore: set engineOptions acountOption.privileges and ParameterOption-…
Browse files Browse the repository at this point in the history
…>versions not required
  • Loading branch information
ldming committed Nov 5, 2024
1 parent 971777f commit f77e0a7
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 70 deletions.
2 changes: 0 additions & 2 deletions .generator/schemas/adminapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17191,7 +17191,6 @@ components:
type: object
required:
- enabled
- privileges
- accountNamePattern
- create
- resetPassword
Expand Down Expand Up @@ -17535,7 +17534,6 @@ components:
required:
- component
- configs
- versions
- exportTpl
- family
- defaultTplName
Expand Down
2 changes: 0 additions & 2 deletions .generator/schemas/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13108,7 +13108,6 @@ components:
type: object
required:
- enabled
- privileges
- accountNamePattern
- create
- resetPassword
Expand Down Expand Up @@ -13452,7 +13451,6 @@ components:
required:
- component
- configs
- versions
- exportTpl
- family
- defaultTplName
Expand Down
41 changes: 22 additions & 19 deletions api/kbcloud/admin/model_account_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

type AccountOption struct {
Enabled bool `json:"enabled"`
Privileges []string `json:"privileges"`
Privileges []string `json:"privileges,omitempty"`
AccountNamePattern string `json:"accountNamePattern"`
Create bool `json:"create"`
ResetPassword bool `json:"resetPassword"`
Expand All @@ -26,10 +26,9 @@ type AccountOption struct {
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewAccountOption(enabled bool, privileges []string, accountNamePattern string, create bool, resetPassword bool, delete bool) *AccountOption {
func NewAccountOption(enabled bool, accountNamePattern string, create bool, resetPassword bool, delete bool) *AccountOption {
this := AccountOption{}
this.Enabled = enabled
this.Privileges = privileges
this.AccountNamePattern = accountNamePattern
this.Create = create
this.ResetPassword = resetPassword
Expand Down Expand Up @@ -68,25 +67,30 @@ func (o *AccountOption) SetEnabled(v bool) {
o.Enabled = v
}

// GetPrivileges returns the Privileges field value.
// GetPrivileges returns the Privileges field value if set, zero value otherwise.
func (o *AccountOption) GetPrivileges() []string {
if o == nil {
if o == nil || o.Privileges == nil {
var ret []string
return ret
}
return o.Privileges
}

// GetPrivilegesOk returns a tuple with the Privileges field value
// GetPrivilegesOk returns a tuple with the Privileges field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountOption) GetPrivilegesOk() (*[]string, bool) {
if o == nil {
if o == nil || o.Privileges == nil {
return nil, false
}
return &o.Privileges, true
}

// SetPrivileges sets field value.
// HasPrivileges returns a boolean if a field has been set.
func (o *AccountOption) HasPrivileges() bool {
return o != nil && o.Privileges != nil
}

// SetPrivileges gets a reference to the given []string and assigns it to the Privileges field.
func (o *AccountOption) SetPrivileges(v []string) {
o.Privileges = v
}
Expand Down Expand Up @@ -190,7 +194,9 @@ func (o AccountOption) MarshalJSON() ([]byte, error) {
return common.Marshal(o.UnparsedObject)
}
toSerialize["enabled"] = o.Enabled
toSerialize["privileges"] = o.Privileges
if o.Privileges != nil {
toSerialize["privileges"] = o.Privileges
}
toSerialize["accountNamePattern"] = o.AccountNamePattern
toSerialize["create"] = o.Create
toSerialize["resetPassword"] = o.ResetPassword
Expand All @@ -205,22 +211,19 @@ func (o AccountOption) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *AccountOption) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Enabled *bool `json:"enabled"`
Privileges *[]string `json:"privileges"`
AccountNamePattern *string `json:"accountNamePattern"`
Create *bool `json:"create"`
ResetPassword *bool `json:"resetPassword"`
Delete *bool `json:"delete"`
Enabled *bool `json:"enabled"`
Privileges []string `json:"privileges,omitempty"`
AccountNamePattern *string `json:"accountNamePattern"`
Create *bool `json:"create"`
ResetPassword *bool `json:"resetPassword"`
Delete *bool `json:"delete"`
}{}
if err = common.Unmarshal(bytes, &all); err != nil {
return common.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Enabled == nil {
return fmt.Errorf("required field enabled missing")
}
if all.Privileges == nil {
return fmt.Errorf("required field privileges missing")
}
if all.AccountNamePattern == nil {
return fmt.Errorf("required field accountNamePattern missing")
}
Expand All @@ -240,7 +243,7 @@ func (o *AccountOption) UnmarshalJSON(bytes []byte) (err error) {
return err
}
o.Enabled = *all.Enabled
o.Privileges = *all.Privileges
o.Privileges = all.Privileges
o.AccountNamePattern = *all.AccountNamePattern
o.Create = *all.Create
o.ResetPassword = *all.ResetPassword
Expand Down
31 changes: 17 additions & 14 deletions api/kbcloud/admin/model_parameter_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type ParameterOption struct {
Component string `json:"component"`
Configs []ParameterConfig `json:"configs"`
// deprecated
Versions []string `json:"versions"`
Versions []string `json:"versions,omitempty"`
ExportTpl bool `json:"exportTpl"`
// a alias with major version.
Family string `json:"family"`
Expand All @@ -32,11 +32,10 @@ type ParameterOption struct {
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewParameterOption(component string, configs []ParameterConfig, versions []string, exportTpl bool, family string, defaultTplName string, defaultTplDescription LocalizedDescription) *ParameterOption {
func NewParameterOption(component string, configs []ParameterConfig, exportTpl bool, family string, defaultTplName string, defaultTplDescription LocalizedDescription) *ParameterOption {
this := ParameterOption{}
this.Component = component
this.Configs = configs
this.Versions = versions
this.ExportTpl = exportTpl
this.Family = family
this.DefaultTplName = defaultTplName
Expand Down Expand Up @@ -102,25 +101,30 @@ func (o *ParameterOption) SetConfigs(v []ParameterConfig) {
o.Configs = v
}

// GetVersions returns the Versions field value.
// GetVersions returns the Versions field value if set, zero value otherwise.
func (o *ParameterOption) GetVersions() []string {
if o == nil {
if o == nil || o.Versions == nil {
var ret []string
return ret
}
return o.Versions
}

// GetVersionsOk returns a tuple with the Versions field value
// GetVersionsOk returns a tuple with the Versions field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ParameterOption) GetVersionsOk() (*[]string, bool) {
if o == nil {
if o == nil || o.Versions == nil {
return nil, false
}
return &o.Versions, true
}

// SetVersions sets field value.
// HasVersions returns a boolean if a field has been set.
func (o *ParameterOption) HasVersions() bool {
return o != nil && o.Versions != nil
}

// SetVersions gets a reference to the given []string and assigns it to the Versions field.
func (o *ParameterOption) SetVersions(v []string) {
o.Versions = v
}
Expand Down Expand Up @@ -281,7 +285,9 @@ func (o ParameterOption) MarshalJSON() ([]byte, error) {
}
toSerialize["component"] = o.Component
toSerialize["configs"] = o.Configs
toSerialize["versions"] = o.Versions
if o.Versions != nil {
toSerialize["versions"] = o.Versions
}
toSerialize["exportTpl"] = o.ExportTpl
toSerialize["family"] = o.Family
if o.MajorVersion != nil {
Expand All @@ -304,7 +310,7 @@ func (o *ParameterOption) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Component *string `json:"component"`
Configs *[]ParameterConfig `json:"configs"`
Versions *[]string `json:"versions"`
Versions []string `json:"versions,omitempty"`
ExportTpl *bool `json:"exportTpl"`
Family *string `json:"family"`
MajorVersion *string `json:"majorVersion,omitempty"`
Expand All @@ -321,9 +327,6 @@ func (o *ParameterOption) UnmarshalJSON(bytes []byte) (err error) {
if all.Configs == nil {
return fmt.Errorf("required field configs missing")
}
if all.Versions == nil {
return fmt.Errorf("required field versions missing")
}
if all.ExportTpl == nil {
return fmt.Errorf("required field exportTpl missing")
}
Expand All @@ -346,7 +349,7 @@ func (o *ParameterOption) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField := false
o.Component = *all.Component
o.Configs = *all.Configs
o.Versions = *all.Versions
o.Versions = all.Versions
o.ExportTpl = *all.ExportTpl
o.Family = *all.Family
o.MajorVersion = all.MajorVersion
Expand Down
41 changes: 22 additions & 19 deletions api/kbcloud/model_account_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

type AccountOption struct {
Enabled bool `json:"enabled"`
Privileges []string `json:"privileges"`
Privileges []string `json:"privileges,omitempty"`
AccountNamePattern string `json:"accountNamePattern"`
Create bool `json:"create"`
ResetPassword bool `json:"resetPassword"`
Expand All @@ -26,10 +26,9 @@ type AccountOption struct {
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewAccountOption(enabled bool, privileges []string, accountNamePattern string, create bool, resetPassword bool, delete bool) *AccountOption {
func NewAccountOption(enabled bool, accountNamePattern string, create bool, resetPassword bool, delete bool) *AccountOption {
this := AccountOption{}
this.Enabled = enabled
this.Privileges = privileges
this.AccountNamePattern = accountNamePattern
this.Create = create
this.ResetPassword = resetPassword
Expand Down Expand Up @@ -68,25 +67,30 @@ func (o *AccountOption) SetEnabled(v bool) {
o.Enabled = v
}

// GetPrivileges returns the Privileges field value.
// GetPrivileges returns the Privileges field value if set, zero value otherwise.
func (o *AccountOption) GetPrivileges() []string {
if o == nil {
if o == nil || o.Privileges == nil {
var ret []string
return ret
}
return o.Privileges
}

// GetPrivilegesOk returns a tuple with the Privileges field value
// GetPrivilegesOk returns a tuple with the Privileges field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountOption) GetPrivilegesOk() (*[]string, bool) {
if o == nil {
if o == nil || o.Privileges == nil {
return nil, false
}
return &o.Privileges, true
}

// SetPrivileges sets field value.
// HasPrivileges returns a boolean if a field has been set.
func (o *AccountOption) HasPrivileges() bool {
return o != nil && o.Privileges != nil
}

// SetPrivileges gets a reference to the given []string and assigns it to the Privileges field.
func (o *AccountOption) SetPrivileges(v []string) {
o.Privileges = v
}
Expand Down Expand Up @@ -190,7 +194,9 @@ func (o AccountOption) MarshalJSON() ([]byte, error) {
return common.Marshal(o.UnparsedObject)
}
toSerialize["enabled"] = o.Enabled
toSerialize["privileges"] = o.Privileges
if o.Privileges != nil {
toSerialize["privileges"] = o.Privileges
}
toSerialize["accountNamePattern"] = o.AccountNamePattern
toSerialize["create"] = o.Create
toSerialize["resetPassword"] = o.ResetPassword
Expand All @@ -205,22 +211,19 @@ func (o AccountOption) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *AccountOption) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Enabled *bool `json:"enabled"`
Privileges *[]string `json:"privileges"`
AccountNamePattern *string `json:"accountNamePattern"`
Create *bool `json:"create"`
ResetPassword *bool `json:"resetPassword"`
Delete *bool `json:"delete"`
Enabled *bool `json:"enabled"`
Privileges []string `json:"privileges,omitempty"`
AccountNamePattern *string `json:"accountNamePattern"`
Create *bool `json:"create"`
ResetPassword *bool `json:"resetPassword"`
Delete *bool `json:"delete"`
}{}
if err = common.Unmarshal(bytes, &all); err != nil {
return common.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Enabled == nil {
return fmt.Errorf("required field enabled missing")
}
if all.Privileges == nil {
return fmt.Errorf("required field privileges missing")
}
if all.AccountNamePattern == nil {
return fmt.Errorf("required field accountNamePattern missing")
}
Expand All @@ -240,7 +243,7 @@ func (o *AccountOption) UnmarshalJSON(bytes []byte) (err error) {
return err
}
o.Enabled = *all.Enabled
o.Privileges = *all.Privileges
o.Privileges = all.Privileges
o.AccountNamePattern = *all.AccountNamePattern
o.Create = *all.Create
o.ResetPassword = *all.ResetPassword
Expand Down
Loading

0 comments on commit f77e0a7

Please sign in to comment.