Files
sdk/model_link_route_plan.go

231 lines
6.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 LinkRoutePlan type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LinkRoutePlan{}
// LinkRoutePlan struct for LinkRoutePlan
type LinkRoutePlan struct {
// Candidates is every linked account in preference order: subscriptions first, then metered api-key accounts as the backstop.
Candidates []LinkRouteCandidate `json:"candidates,omitempty"`
// GeneratedAt is when the plan was computed, RFC 3339 UTC.
GeneratedAt *string `json:"generatedAt,omitempty"`
// Primary is the first available candidate; absent when every account is rate-limited.
Primary *LinkRouteCandidate `json:"primary,omitempty"`
AdditionalProperties map[string]interface{}
}
type _LinkRoutePlan LinkRoutePlan
// NewLinkRoutePlan instantiates a new LinkRoutePlan 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 NewLinkRoutePlan() *LinkRoutePlan {
this := LinkRoutePlan{}
return &this
}
// NewLinkRoutePlanWithDefaults instantiates a new LinkRoutePlan 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 NewLinkRoutePlanWithDefaults() *LinkRoutePlan {
this := LinkRoutePlan{}
return &this
}
// GetCandidates returns the Candidates field value if set, zero value otherwise.
func (o *LinkRoutePlan) GetCandidates() []LinkRouteCandidate {
if o == nil || IsNil(o.Candidates) {
var ret []LinkRouteCandidate
return ret
}
return o.Candidates
}
// GetCandidatesOk returns a tuple with the Candidates field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutePlan) GetCandidatesOk() ([]LinkRouteCandidate, bool) {
if o == nil || IsNil(o.Candidates) {
return nil, false
}
return o.Candidates, true
}
// HasCandidates returns a boolean if a field has been set.
func (o *LinkRoutePlan) HasCandidates() bool {
if o != nil && !IsNil(o.Candidates) {
return true
}
return false
}
// SetCandidates gets a reference to the given []LinkRouteCandidate and assigns it to the Candidates field.
func (o *LinkRoutePlan) SetCandidates(v []LinkRouteCandidate) {
o.Candidates = v
}
// GetGeneratedAt returns the GeneratedAt field value if set, zero value otherwise.
func (o *LinkRoutePlan) GetGeneratedAt() string {
if o == nil || IsNil(o.GeneratedAt) {
var ret string
return ret
}
return *o.GeneratedAt
}
// GetGeneratedAtOk returns a tuple with the GeneratedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutePlan) GetGeneratedAtOk() (*string, bool) {
if o == nil || IsNil(o.GeneratedAt) {
return nil, false
}
return o.GeneratedAt, true
}
// HasGeneratedAt returns a boolean if a field has been set.
func (o *LinkRoutePlan) HasGeneratedAt() bool {
if o != nil && !IsNil(o.GeneratedAt) {
return true
}
return false
}
// SetGeneratedAt gets a reference to the given string and assigns it to the GeneratedAt field.
func (o *LinkRoutePlan) SetGeneratedAt(v string) {
o.GeneratedAt = &v
}
// GetPrimary returns the Primary field value if set, zero value otherwise.
func (o *LinkRoutePlan) GetPrimary() LinkRouteCandidate {
if o == nil || IsNil(o.Primary) {
var ret LinkRouteCandidate
return ret
}
return *o.Primary
}
// GetPrimaryOk returns a tuple with the Primary field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LinkRoutePlan) GetPrimaryOk() (*LinkRouteCandidate, bool) {
if o == nil || IsNil(o.Primary) {
return nil, false
}
return o.Primary, true
}
// HasPrimary returns a boolean if a field has been set.
func (o *LinkRoutePlan) HasPrimary() bool {
if o != nil && !IsNil(o.Primary) {
return true
}
return false
}
// SetPrimary gets a reference to the given LinkRouteCandidate and assigns it to the Primary field.
func (o *LinkRoutePlan) SetPrimary(v LinkRouteCandidate) {
o.Primary = &v
}
func (o LinkRoutePlan) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LinkRoutePlan) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Candidates) {
toSerialize["candidates"] = o.Candidates
}
if !IsNil(o.GeneratedAt) {
toSerialize["generatedAt"] = o.GeneratedAt
}
if !IsNil(o.Primary) {
toSerialize["primary"] = o.Primary
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LinkRoutePlan) UnmarshalJSON(data []byte) (err error) {
varLinkRoutePlan := _LinkRoutePlan{}
err = json.Unmarshal(data, &varLinkRoutePlan)
if err != nil {
return err
}
*o = LinkRoutePlan(varLinkRoutePlan)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "candidates")
delete(additionalProperties, "generatedAt")
delete(additionalProperties, "primary")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLinkRoutePlan struct {
value *LinkRoutePlan
isSet bool
}
func (v NullableLinkRoutePlan) Get() *LinkRoutePlan {
return v.value
}
func (v *NullableLinkRoutePlan) Set(val *LinkRoutePlan) {
v.value = val
v.isSet = true
}
func (v NullableLinkRoutePlan) IsSet() bool {
return v.isSet
}
func (v *NullableLinkRoutePlan) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLinkRoutePlan(val *LinkRoutePlan) *NullableLinkRoutePlan {
return &NullableLinkRoutePlan{value: val, isSet: true}
}
func (v NullableLinkRoutePlan) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLinkRoutePlan) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}