Files
sdk/model_ingress_backend.go

193 lines
4.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 IngressBackend type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &IngressBackend{}
// IngressBackend struct for IngressBackend
type IngressBackend struct {
// URL is the upstream server, http(s)://host[:port].
Url *string `json:"url,omitempty"`
// Weight is this member's share of the round-robin; must be >= 0.
Weight *int64 `json:"weight,omitempty"`
AdditionalProperties map[string]interface{}
}
type _IngressBackend IngressBackend
// NewIngressBackend instantiates a new IngressBackend 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 NewIngressBackend() *IngressBackend {
this := IngressBackend{}
return &this
}
// NewIngressBackendWithDefaults instantiates a new IngressBackend 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 NewIngressBackendWithDefaults() *IngressBackend {
this := IngressBackend{}
return &this
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *IngressBackend) GetUrl() string {
if o == nil || IsNil(o.Url) {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IngressBackend) GetUrlOk() (*string, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *IngressBackend) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *IngressBackend) SetUrl(v string) {
o.Url = &v
}
// GetWeight returns the Weight field value if set, zero value otherwise.
func (o *IngressBackend) GetWeight() int64 {
if o == nil || IsNil(o.Weight) {
var ret int64
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 *IngressBackend) GetWeightOk() (*int64, 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 *IngressBackend) HasWeight() bool {
if o != nil && !IsNil(o.Weight) {
return true
}
return false
}
// SetWeight gets a reference to the given int64 and assigns it to the Weight field.
func (o *IngressBackend) SetWeight(v int64) {
o.Weight = &v
}
func (o IngressBackend) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o IngressBackend) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Url) {
toSerialize["url"] = o.Url
}
if !IsNil(o.Weight) {
toSerialize["weight"] = o.Weight
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *IngressBackend) UnmarshalJSON(data []byte) (err error) {
varIngressBackend := _IngressBackend{}
err = json.Unmarshal(data, &varIngressBackend)
if err != nil {
return err
}
*o = IngressBackend(varIngressBackend)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "url")
delete(additionalProperties, "weight")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableIngressBackend struct {
value *IngressBackend
isSet bool
}
func (v NullableIngressBackend) Get() *IngressBackend {
return v.value
}
func (v *NullableIngressBackend) Set(val *IngressBackend) {
v.value = val
v.isSet = true
}
func (v NullableIngressBackend) IsSet() bool {
return v.isSet
}
func (v *NullableIngressBackend) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIngressBackend(val *IngressBackend) *NullableIngressBackend {
return &NullableIngressBackend{value: val, isSet: true}
}
func (v NullableIngressBackend) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIngressBackend) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}