model_static_condition.go•4.91 kB
/*
Metoro API
API for managing Metoro environments, alerts, and dashboards.
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package model
import (
"bytes"
"encoding/json"
"fmt"
)
// checks if the StaticCondition type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &StaticCondition{}
// StaticCondition struct for StaticCondition
type StaticCondition struct {
// List of operator conditions that must be met
Operators []OperatorConfig `json:"operators"`
PersistenceSettings PersistenceSettings `json:"persistenceSettings"`
}
type _StaticCondition StaticCondition
// NewStaticCondition instantiates a new StaticCondition object
// 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 NewStaticCondition(operators []OperatorConfig, persistenceSettings PersistenceSettings) *StaticCondition {
this := StaticCondition{}
this.Operators = operators
this.PersistenceSettings = persistenceSettings
return &this
}
// NewStaticConditionWithDefaults instantiates a new StaticCondition object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewStaticConditionWithDefaults() *StaticCondition {
this := StaticCondition{}
return &this
}
// GetOperators returns the Operators field value
func (o *StaticCondition) GetOperators() []OperatorConfig {
if o == nil {
var ret []OperatorConfig
return ret
}
return o.Operators
}
// GetOperatorsOk returns a tuple with the Operators field value
// and a boolean to check if the value has been set.
func (o *StaticCondition) GetOperatorsOk() ([]OperatorConfig, bool) {
if o == nil {
return nil, false
}
return o.Operators, true
}
// SetOperators sets field value
func (o *StaticCondition) SetOperators(v []OperatorConfig) {
o.Operators = v
}
// GetPersistenceSettings returns the PersistenceSettings field value
func (o *StaticCondition) GetPersistenceSettings() PersistenceSettings {
if o == nil {
var ret PersistenceSettings
return ret
}
return o.PersistenceSettings
}
// GetPersistenceSettingsOk returns a tuple with the PersistenceSettings field value
// and a boolean to check if the value has been set.
func (o *StaticCondition) GetPersistenceSettingsOk() (*PersistenceSettings, bool) {
if o == nil {
return nil, false
}
return &o.PersistenceSettings, true
}
// SetPersistenceSettings sets field value
func (o *StaticCondition) SetPersistenceSettings(v PersistenceSettings) {
o.PersistenceSettings = v
}
func (o StaticCondition) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o StaticCondition) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["operators"] = o.Operators
toSerialize["persistenceSettings"] = o.PersistenceSettings
return toSerialize, nil
}
func (o *StaticCondition) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"operators",
"persistenceSettings",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varStaticCondition := _StaticCondition{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varStaticCondition)
if err != nil {
return err
}
*o = StaticCondition(varStaticCondition)
return err
}
type NullableStaticCondition struct {
value *StaticCondition
isSet bool
}
func (v NullableStaticCondition) Get() *StaticCondition {
return v.value
}
func (v *NullableStaticCondition) Set(val *StaticCondition) {
v.value = val
v.isSet = true
}
func (v NullableStaticCondition) IsSet() bool {
return v.isSet
}
func (v *NullableStaticCondition) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableStaticCondition(val *StaticCondition) *NullableStaticCondition {
return &NullableStaticCondition{value: val, isSet: true}
}
func (v NullableStaticCondition) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableStaticCondition) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}