Files
sdk/model_experiment_arm_.go

269 lines
6.8 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the ExperimentArm type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ExperimentArm{}
// ExperimentArm struct for ExperimentArm
type ExperimentArm struct {
// true on the baseline arm every other arm is compared to
Control *bool `json:"control,omitempty"`
// the arm's slug, unique within the experiment
Key *string `json:"key,omitempty"`
Payload interface{} `json:"payload,omitempty"`
// its share of the rollout; the arms sum to 100
Weight *float64 `json:"weight,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ExperimentArm ExperimentArm
// NewExperimentArm instantiates a new ExperimentArm 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 NewExperimentArm() *ExperimentArm {
this := ExperimentArm{}
return &this
}
// NewExperimentArmWithDefaults instantiates a new ExperimentArm 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 NewExperimentArmWithDefaults() *ExperimentArm {
this := ExperimentArm{}
return &this
}
// GetControl returns the Control field value if set, zero value otherwise.
func (o *ExperimentArm) GetControl() bool {
if o == nil || IsNil(o.Control) {
var ret bool
return ret
}
return *o.Control
}
// GetControlOk returns a tuple with the Control field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentArm) GetControlOk() (*bool, bool) {
if o == nil || IsNil(o.Control) {
return nil, false
}
return o.Control, true
}
// HasControl returns a boolean if a field has been set.
func (o *ExperimentArm) HasControl() bool {
if o != nil && !IsNil(o.Control) {
return true
}
return false
}
// SetControl gets a reference to the given bool and assigns it to the Control field.
func (o *ExperimentArm) SetControl(v bool) {
o.Control = &v
}
// GetKey returns the Key field value if set, zero value otherwise.
func (o *ExperimentArm) GetKey() string {
if o == nil || IsNil(o.Key) {
var ret string
return ret
}
return *o.Key
}
// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentArm) GetKeyOk() (*string, bool) {
if o == nil || IsNil(o.Key) {
return nil, false
}
return o.Key, true
}
// HasKey returns a boolean if a field has been set.
func (o *ExperimentArm) HasKey() bool {
if o != nil && !IsNil(o.Key) {
return true
}
return false
}
// SetKey gets a reference to the given string and assigns it to the Key field.
func (o *ExperimentArm) SetKey(v string) {
o.Key = &v
}
// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ExperimentArm) GetPayload() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Payload
}
// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ExperimentArm) GetPayloadOk() (*interface{}, bool) {
if o == nil || IsNil(o.Payload) {
return nil, false
}
return &o.Payload, true
}
// HasPayload returns a boolean if a field has been set.
func (o *ExperimentArm) HasPayload() bool {
if o != nil && !IsNil(o.Payload) {
return true
}
return false
}
// SetPayload gets a reference to the given interface{} and assigns it to the Payload field.
func (o *ExperimentArm) SetPayload(v interface{}) {
o.Payload = v
}
// GetWeight returns the Weight field value if set, zero value otherwise.
func (o *ExperimentArm) GetWeight() float64 {
if o == nil || IsNil(o.Weight) {
var ret float64
return ret
}
return *o.Weight
}
// GetWeightOk returns a tuple with the Weight field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentArm) GetWeightOk() (*float64, bool) {
if o == nil || IsNil(o.Weight) {
return nil, false
}
return o.Weight, true
}
// HasWeight returns a boolean if a field has been set.
func (o *ExperimentArm) HasWeight() bool {
if o != nil && !IsNil(o.Weight) {
return true
}
return false
}
// SetWeight gets a reference to the given float64 and assigns it to the Weight field.
func (o *ExperimentArm) SetWeight(v float64) {
o.Weight = &v
}
func (o ExperimentArm) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ExperimentArm) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Control) {
toSerialize["control"] = o.Control
}
if !IsNil(o.Key) {
toSerialize["key"] = o.Key
}
if o.Payload != nil {
toSerialize["payload"] = o.Payload
}
if !IsNil(o.Weight) {
toSerialize["weight"] = o.Weight
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ExperimentArm) UnmarshalJSON(data []byte) (err error) {
varExperimentArm := _ExperimentArm{}
err = json.Unmarshal(data, &varExperimentArm)
if err != nil {
return err
}
*o = ExperimentArm(varExperimentArm)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "control")
delete(additionalProperties, "key")
delete(additionalProperties, "payload")
delete(additionalProperties, "weight")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableExperimentArm struct {
value *ExperimentArm
isSet bool
}
func (v NullableExperimentArm) Get() *ExperimentArm {
return v.value
}
func (v *NullableExperimentArm) Set(val *ExperimentArm) {
v.value = val
v.isSet = true
}
func (v NullableExperimentArm) IsSet() bool {
return v.isSet
}
func (v *NullableExperimentArm) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableExperimentArm(val *ExperimentArm) *NullableExperimentArm {
return &NullableExperimentArm{value: val, isSet: true}
}
func (v NullableExperimentArm) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableExperimentArm) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}