Files
sdk/model_ingress_upstream.go

231 lines
6.2 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 IngressUpstream type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &IngressUpstream{}
// IngressUpstream struct for IngressUpstream
type IngressUpstream struct {
// Backends are the upstream servers to balance across: 1..32 of them.
Backends []IngressBackend `json:"backends,omitempty"`
// ID identifies the pool within the org: [A-Za-z0-9-_.], at most 128 chars. A create that omits it gets a generated one. Routes reference it by this id.
Id *string `json:"id,omitempty"`
// PassHostHeader forwards the client's original Host header upstream instead of rewriting it to the backend's.
PassHostHeader *bool `json:"passHostHeader,omitempty"`
AdditionalProperties map[string]interface{}
}
type _IngressUpstream IngressUpstream
// NewIngressUpstream instantiates a new IngressUpstream 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 NewIngressUpstream() *IngressUpstream {
this := IngressUpstream{}
return &this
}
// NewIngressUpstreamWithDefaults instantiates a new IngressUpstream 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 NewIngressUpstreamWithDefaults() *IngressUpstream {
this := IngressUpstream{}
return &this
}
// GetBackends returns the Backends field value if set, zero value otherwise.
func (o *IngressUpstream) GetBackends() []IngressBackend {
if o == nil || IsNil(o.Backends) {
var ret []IngressBackend
return ret
}
return o.Backends
}
// GetBackendsOk returns a tuple with the Backends field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IngressUpstream) GetBackendsOk() ([]IngressBackend, bool) {
if o == nil || IsNil(o.Backends) {
return nil, false
}
return o.Backends, true
}
// HasBackends returns a boolean if a field has been set.
func (o *IngressUpstream) HasBackends() bool {
if o != nil && !IsNil(o.Backends) {
return true
}
return false
}
// SetBackends gets a reference to the given []IngressBackend and assigns it to the Backends field.
func (o *IngressUpstream) SetBackends(v []IngressBackend) {
o.Backends = v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *IngressUpstream) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IngressUpstream) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *IngressUpstream) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *IngressUpstream) SetId(v string) {
o.Id = &v
}
// GetPassHostHeader returns the PassHostHeader field value if set, zero value otherwise.
func (o *IngressUpstream) GetPassHostHeader() bool {
if o == nil || IsNil(o.PassHostHeader) {
var ret bool
return ret
}
return *o.PassHostHeader
}
// GetPassHostHeaderOk returns a tuple with the PassHostHeader field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *IngressUpstream) GetPassHostHeaderOk() (*bool, bool) {
if o == nil || IsNil(o.PassHostHeader) {
return nil, false
}
return o.PassHostHeader, true
}
// HasPassHostHeader returns a boolean if a field has been set.
func (o *IngressUpstream) HasPassHostHeader() bool {
if o != nil && !IsNil(o.PassHostHeader) {
return true
}
return false
}
// SetPassHostHeader gets a reference to the given bool and assigns it to the PassHostHeader field.
func (o *IngressUpstream) SetPassHostHeader(v bool) {
o.PassHostHeader = &v
}
func (o IngressUpstream) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o IngressUpstream) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Backends) {
toSerialize["backends"] = o.Backends
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.PassHostHeader) {
toSerialize["passHostHeader"] = o.PassHostHeader
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *IngressUpstream) UnmarshalJSON(data []byte) (err error) {
varIngressUpstream := _IngressUpstream{}
err = json.Unmarshal(data, &varIngressUpstream)
if err != nil {
return err
}
*o = IngressUpstream(varIngressUpstream)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "backends")
delete(additionalProperties, "id")
delete(additionalProperties, "passHostHeader")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableIngressUpstream struct {
value *IngressUpstream
isSet bool
}
func (v NullableIngressUpstream) Get() *IngressUpstream {
return v.value
}
func (v *NullableIngressUpstream) Set(val *IngressUpstream) {
v.value = val
v.isSet = true
}
func (v NullableIngressUpstream) IsSet() bool {
return v.isSet
}
func (v *NullableIngressUpstream) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIngressUpstream(val *IngressUpstream) *NullableIngressUpstream {
return &NullableIngressUpstream{value: val, isSet: true}
}
func (v NullableIngressUpstream) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIngressUpstream) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}