Files
sdk/model_experiment_assignment.go

307 lines
8.3 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 ExperimentAssignment type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ExperimentAssignment{}
// ExperimentAssignment struct for ExperimentAssignment
type ExperimentAssignment struct {
// Trial is the experiment that was evaluated.
Experiment *string `json:"experiment,omitempty"`
// On is false when the flag returned nothing for this subject, which means the subject is not enrolled — not an error.
On *bool `json:"on,omitempty"`
Payload interface{} `json:"payload,omitempty"`
// Subject is the unit that was bucketed.
Subject *string `json:"subject,omitempty"`
// Arm is the arm the subject falls in, empty when the flag enrolled it in none.
Variant *string `json:"variant,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ExperimentAssignment ExperimentAssignment
// NewExperimentAssignment instantiates a new ExperimentAssignment 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 NewExperimentAssignment() *ExperimentAssignment {
this := ExperimentAssignment{}
return &this
}
// NewExperimentAssignmentWithDefaults instantiates a new ExperimentAssignment 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 NewExperimentAssignmentWithDefaults() *ExperimentAssignment {
this := ExperimentAssignment{}
return &this
}
// GetExperiment returns the Experiment field value if set, zero value otherwise.
func (o *ExperimentAssignment) GetExperiment() string {
if o == nil || IsNil(o.Experiment) {
var ret string
return ret
}
return *o.Experiment
}
// GetExperimentOk returns a tuple with the Experiment field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentAssignment) GetExperimentOk() (*string, bool) {
if o == nil || IsNil(o.Experiment) {
return nil, false
}
return o.Experiment, true
}
// HasExperiment returns a boolean if a field has been set.
func (o *ExperimentAssignment) HasExperiment() bool {
if o != nil && !IsNil(o.Experiment) {
return true
}
return false
}
// SetExperiment gets a reference to the given string and assigns it to the Experiment field.
func (o *ExperimentAssignment) SetExperiment(v string) {
o.Experiment = &v
}
// GetOn returns the On field value if set, zero value otherwise.
func (o *ExperimentAssignment) GetOn() bool {
if o == nil || IsNil(o.On) {
var ret bool
return ret
}
return *o.On
}
// GetOnOk returns a tuple with the On field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentAssignment) GetOnOk() (*bool, bool) {
if o == nil || IsNil(o.On) {
return nil, false
}
return o.On, true
}
// HasOn returns a boolean if a field has been set.
func (o *ExperimentAssignment) HasOn() bool {
if o != nil && !IsNil(o.On) {
return true
}
return false
}
// SetOn gets a reference to the given bool and assigns it to the On field.
func (o *ExperimentAssignment) SetOn(v bool) {
o.On = &v
}
// GetPayload returns the Payload field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ExperimentAssignment) 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 *ExperimentAssignment) 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 *ExperimentAssignment) 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 *ExperimentAssignment) SetPayload(v interface{}) {
o.Payload = v
}
// GetSubject returns the Subject field value if set, zero value otherwise.
func (o *ExperimentAssignment) GetSubject() string {
if o == nil || IsNil(o.Subject) {
var ret string
return ret
}
return *o.Subject
}
// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentAssignment) GetSubjectOk() (*string, bool) {
if o == nil || IsNil(o.Subject) {
return nil, false
}
return o.Subject, true
}
// HasSubject returns a boolean if a field has been set.
func (o *ExperimentAssignment) HasSubject() bool {
if o != nil && !IsNil(o.Subject) {
return true
}
return false
}
// SetSubject gets a reference to the given string and assigns it to the Subject field.
func (o *ExperimentAssignment) SetSubject(v string) {
o.Subject = &v
}
// GetVariant returns the Variant field value if set, zero value otherwise.
func (o *ExperimentAssignment) GetVariant() string {
if o == nil || IsNil(o.Variant) {
var ret string
return ret
}
return *o.Variant
}
// GetVariantOk returns a tuple with the Variant field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ExperimentAssignment) GetVariantOk() (*string, bool) {
if o == nil || IsNil(o.Variant) {
return nil, false
}
return o.Variant, true
}
// HasVariant returns a boolean if a field has been set.
func (o *ExperimentAssignment) HasVariant() bool {
if o != nil && !IsNil(o.Variant) {
return true
}
return false
}
// SetVariant gets a reference to the given string and assigns it to the Variant field.
func (o *ExperimentAssignment) SetVariant(v string) {
o.Variant = &v
}
func (o ExperimentAssignment) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ExperimentAssignment) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Experiment) {
toSerialize["experiment"] = o.Experiment
}
if !IsNil(o.On) {
toSerialize["on"] = o.On
}
if o.Payload != nil {
toSerialize["payload"] = o.Payload
}
if !IsNil(o.Subject) {
toSerialize["subject"] = o.Subject
}
if !IsNil(o.Variant) {
toSerialize["variant"] = o.Variant
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ExperimentAssignment) UnmarshalJSON(data []byte) (err error) {
varExperimentAssignment := _ExperimentAssignment{}
err = json.Unmarshal(data, &varExperimentAssignment)
if err != nil {
return err
}
*o = ExperimentAssignment(varExperimentAssignment)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "experiment")
delete(additionalProperties, "on")
delete(additionalProperties, "payload")
delete(additionalProperties, "subject")
delete(additionalProperties, "variant")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableExperimentAssignment struct {
value *ExperimentAssignment
isSet bool
}
func (v NullableExperimentAssignment) Get() *ExperimentAssignment {
return v.value
}
func (v *NullableExperimentAssignment) Set(val *ExperimentAssignment) {
v.value = val
v.isSet = true
}
func (v NullableExperimentAssignment) IsSet() bool {
return v.isSet
}
func (v *NullableExperimentAssignment) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableExperimentAssignment(val *ExperimentAssignment) *NullableExperimentAssignment {
return &NullableExperimentAssignment{value: val, isSet: true}
}
func (v NullableExperimentAssignment) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableExperimentAssignment) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}