@@ -13,8 +13,8 @@ import (
1313// AlertMetric Alert metric information
1414type AlertMetric struct {
1515 Key string `json:"key"`
16- Threshold int32 `json:"threshold"`
17- Notation string `json:"notation"`
16+ Threshold * int32 `json:"threshold,omitempty "`
17+ Notation * string `json:"notation,omitempty "`
1818 Category * string `json:"category,omitempty"`
1919 // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2020 UnparsedObject map [string ]interface {} `json:"-"`
@@ -25,11 +25,9 @@ type AlertMetric struct {
2525// This constructor will assign default values to properties that have it defined,
2626// and makes sure properties required by API are set, but the set of arguments
2727// will change when the set of required properties is changed.
28- func NewAlertMetric (key string , threshold int32 , notation string ) * AlertMetric {
28+ func NewAlertMetric (key string ) * AlertMetric {
2929 this := AlertMetric {}
3030 this .Key = key
31- this .Threshold = threshold
32- this .Notation = notation
3331 return & this
3432}
3533
@@ -64,50 +62,60 @@ func (o *AlertMetric) SetKey(v string) {
6462 o .Key = v
6563}
6664
67- // GetThreshold returns the Threshold field value.
65+ // GetThreshold returns the Threshold field value if set, zero value otherwise .
6866func (o * AlertMetric ) GetThreshold () int32 {
69- if o == nil {
67+ if o == nil || o . Threshold == nil {
7068 var ret int32
7169 return ret
7270 }
73- return o .Threshold
71+ return * o .Threshold
7472}
7573
76- // GetThresholdOk returns a tuple with the Threshold field value
74+ // GetThresholdOk returns a tuple with the Threshold field value if set, nil otherwise
7775// and a boolean to check if the value has been set.
7876func (o * AlertMetric ) GetThresholdOk () (* int32 , bool ) {
79- if o == nil {
77+ if o == nil || o . Threshold == nil {
8078 return nil , false
8179 }
82- return & o .Threshold , true
80+ return o .Threshold , true
81+ }
82+
83+ // HasThreshold returns a boolean if a field has been set.
84+ func (o * AlertMetric ) HasThreshold () bool {
85+ return o != nil && o .Threshold != nil
8386}
8487
85- // SetThreshold sets field value .
88+ // SetThreshold gets a reference to the given int32 and assigns it to the Threshold field .
8689func (o * AlertMetric ) SetThreshold (v int32 ) {
87- o .Threshold = v
90+ o .Threshold = & v
8891}
8992
90- // GetNotation returns the Notation field value.
93+ // GetNotation returns the Notation field value if set, zero value otherwise .
9194func (o * AlertMetric ) GetNotation () string {
92- if o == nil {
95+ if o == nil || o . Notation == nil {
9396 var ret string
9497 return ret
9598 }
96- return o .Notation
99+ return * o .Notation
97100}
98101
99- // GetNotationOk returns a tuple with the Notation field value
102+ // GetNotationOk returns a tuple with the Notation field value if set, nil otherwise
100103// and a boolean to check if the value has been set.
101104func (o * AlertMetric ) GetNotationOk () (* string , bool ) {
102- if o == nil {
105+ if o == nil || o . Notation == nil {
103106 return nil , false
104107 }
105- return & o .Notation , true
108+ return o .Notation , true
106109}
107110
108- // SetNotation sets field value.
111+ // HasNotation returns a boolean if a field has been set.
112+ func (o * AlertMetric ) HasNotation () bool {
113+ return o != nil && o .Notation != nil
114+ }
115+
116+ // SetNotation gets a reference to the given string and assigns it to the Notation field.
109117func (o * AlertMetric ) SetNotation (v string ) {
110- o .Notation = v
118+ o .Notation = & v
111119}
112120
113121// GetCategory returns the Category field value if set, zero value otherwise.
@@ -145,8 +153,12 @@ func (o AlertMetric) MarshalJSON() ([]byte, error) {
145153 return common .Marshal (o .UnparsedObject )
146154 }
147155 toSerialize ["key" ] = o .Key
148- toSerialize ["threshold" ] = o .Threshold
149- toSerialize ["notation" ] = o .Notation
156+ if o .Threshold != nil {
157+ toSerialize ["threshold" ] = o .Threshold
158+ }
159+ if o .Notation != nil {
160+ toSerialize ["notation" ] = o .Notation
161+ }
150162 if o .Category != nil {
151163 toSerialize ["category" ] = o .Category
152164 }
@@ -161,8 +173,8 @@ func (o AlertMetric) MarshalJSON() ([]byte, error) {
161173func (o * AlertMetric ) UnmarshalJSON (bytes []byte ) (err error ) {
162174 all := struct {
163175 Key * string `json:"key"`
164- Threshold * int32 `json:"threshold"`
165- Notation * string `json:"notation"`
176+ Threshold * int32 `json:"threshold,omitempty "`
177+ Notation * string `json:"notation,omitempty "`
166178 Category * string `json:"category,omitempty"`
167179 }{}
168180 if err = common .Unmarshal (bytes , & all ); err != nil {
@@ -171,21 +183,15 @@ func (o *AlertMetric) UnmarshalJSON(bytes []byte) (err error) {
171183 if all .Key == nil {
172184 return fmt .Errorf ("required field key missing" )
173185 }
174- if all .Threshold == nil {
175- return fmt .Errorf ("required field threshold missing" )
176- }
177- if all .Notation == nil {
178- return fmt .Errorf ("required field notation missing" )
179- }
180186 additionalProperties := make (map [string ]interface {})
181187 if err = common .Unmarshal (bytes , & additionalProperties ); err == nil {
182188 common .DeleteKeys (additionalProperties , & []string {"key" , "threshold" , "notation" , "category" })
183189 } else {
184190 return err
185191 }
186192 o .Key = * all .Key
187- o .Threshold = * all .Threshold
188- o .Notation = * all .Notation
193+ o .Threshold = all .Threshold
194+ o .Notation = all .Notation
189195 o .Category = all .Category
190196
191197 if len (additionalProperties ) > 0 {
0 commit comments