@@ -18,12 +18,12 @@ type ComponentOption struct {
1818 // Determine whether the componentDef of kb-cluster belongs to this component type through this matching regularization.
1919 // if not set, componentDef must be equal to component type.
2020 //
21- MatchRegex * string `json:"matchRegex,omitempty"`
22- Title LocalizedDescription `json:"title"`
23- Order int32 `json:"order"`
24- RoleOrder []string `json:"roleOrder,omitempty"`
25- DisasterRecoveryRoleOrder []string `json:"disasterRecoveryRoleOrder,omitempty"`
26- Version * ComponentOptionVersion `json:"version,omitempty "`
21+ MatchRegex * string `json:"matchRegex,omitempty"`
22+ Title LocalizedDescription `json:"title"`
23+ Order int32 `json:"order"`
24+ RoleOrder []string `json:"roleOrder,omitempty"`
25+ DisasterRecoveryRoleOrder []string `json:"disasterRecoveryRoleOrder,omitempty"`
26+ Version ComponentOptionVersion `json:"version"`
2727 // Main component flag
2828 Main * bool `json:"main,omitempty"`
2929 // whether the component supports custom secret
@@ -37,11 +37,12 @@ type ComponentOption struct {
3737// This constructor will assign default values to properties that have it defined,
3838// and makes sure properties required by API are set, but the set of arguments
3939// will change when the set of required properties is changed.
40- func NewComponentOption (name string , title LocalizedDescription , order int32 ) * ComponentOption {
40+ func NewComponentOption (name string , title LocalizedDescription , order int32 , version ComponentOptionVersion ) * ComponentOption {
4141 this := ComponentOption {}
4242 this .Name = name
4343 this .Title = title
4444 this .Order = order
45+ this .Version = version
4546 return & this
4647}
4748
@@ -234,32 +235,27 @@ func (o *ComponentOption) SetDisasterRecoveryRoleOrder(v []string) {
234235 o .DisasterRecoveryRoleOrder = v
235236}
236237
237- // GetVersion returns the Version field value if set, zero value otherwise .
238+ // GetVersion returns the Version field value.
238239func (o * ComponentOption ) GetVersion () ComponentOptionVersion {
239- if o == nil || o . Version == nil {
240+ if o == nil {
240241 var ret ComponentOptionVersion
241242 return ret
242243 }
243- return * o .Version
244+ return o .Version
244245}
245246
246- // GetVersionOk returns a tuple with the Version field value if set, nil otherwise
247+ // GetVersionOk returns a tuple with the Version field value
247248// and a boolean to check if the value has been set.
248249func (o * ComponentOption ) GetVersionOk () (* ComponentOptionVersion , bool ) {
249- if o == nil || o . Version == nil {
250+ if o == nil {
250251 return nil , false
251252 }
252- return o .Version , true
253- }
254-
255- // HasVersion returns a boolean if a field has been set.
256- func (o * ComponentOption ) HasVersion () bool {
257- return o != nil && o .Version != nil
253+ return & o .Version , true
258254}
259255
260- // SetVersion gets a reference to the given ComponentOptionVersion and assigns it to the Version field.
256+ // SetVersion sets field value .
261257func (o * ComponentOption ) SetVersion (v ComponentOptionVersion ) {
262- o .Version = & v
258+ o .Version = v
263259}
264260
265261// GetMain returns the Main field value if set, zero value otherwise.
@@ -339,9 +335,7 @@ func (o ComponentOption) MarshalJSON() ([]byte, error) {
339335 if o .DisasterRecoveryRoleOrder != nil {
340336 toSerialize ["disasterRecoveryRoleOrder" ] = o .DisasterRecoveryRoleOrder
341337 }
342- if o .Version != nil {
343- toSerialize ["version" ] = o .Version
344- }
338+ toSerialize ["version" ] = o .Version
345339 if o .Main != nil {
346340 toSerialize ["main" ] = o .Main
347341 }
@@ -365,7 +359,7 @@ func (o *ComponentOption) UnmarshalJSON(bytes []byte) (err error) {
365359 Order * int32 `json:"order"`
366360 RoleOrder []string `json:"roleOrder,omitempty"`
367361 DisasterRecoveryRoleOrder []string `json:"disasterRecoveryRoleOrder,omitempty"`
368- Version * ComponentOptionVersion `json:"version,omitempty "`
362+ Version * ComponentOptionVersion `json:"version"`
369363 Main * bool `json:"main,omitempty"`
370364 CustomSecret * bool `json:"customSecret,omitempty"`
371365 }{}
@@ -381,6 +375,9 @@ func (o *ComponentOption) UnmarshalJSON(bytes []byte) (err error) {
381375 if all .Order == nil {
382376 return fmt .Errorf ("required field order missing" )
383377 }
378+ if all .Version == nil {
379+ return fmt .Errorf ("required field version missing" )
380+ }
384381 additionalProperties := make (map [string ]interface {})
385382 if err = common .Unmarshal (bytes , & additionalProperties ); err == nil {
386383 common .DeleteKeys (additionalProperties , & []string {"cloudShellType" , "name" , "matchRegex" , "title" , "order" , "roleOrder" , "disasterRecoveryRoleOrder" , "version" , "main" , "customSecret" })
@@ -399,10 +396,10 @@ func (o *ComponentOption) UnmarshalJSON(bytes []byte) (err error) {
399396 o .Order = * all .Order
400397 o .RoleOrder = all .RoleOrder
401398 o .DisasterRecoveryRoleOrder = all .DisasterRecoveryRoleOrder
402- if all .Version != nil && all . Version .UnparsedObject != nil && o .UnparsedObject == nil {
399+ if all .Version .UnparsedObject != nil && o .UnparsedObject == nil {
403400 hasInvalidField = true
404401 }
405- o .Version = all .Version
402+ o .Version = * all .Version
406403 o .Main = all .Main
407404 o .CustomSecret = all .CustomSecret
408405
0 commit comments