Files
sdk/model_root.go

191 lines
4.5 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 Root type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Root{}
// Root struct for Root
type Root struct {
Links map[string]Link `json:"_links,omitempty"`
Capabilities []Capability `json:"capabilities,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Root Root
// NewRoot instantiates a new Root 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 NewRoot() *Root {
this := Root{}
return &this
}
// NewRootWithDefaults instantiates a new Root 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 NewRootWithDefaults() *Root {
this := Root{}
return &this
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *Root) GetLinks() map[string]Link {
if o == nil || IsNil(o.Links) {
var ret map[string]Link
return ret
}
return o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Root) GetLinksOk() (map[string]Link, bool) {
if o == nil || IsNil(o.Links) {
return map[string]Link{}, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *Root) HasLinks() bool {
if o != nil && !IsNil(o.Links) {
return true
}
return false
}
// SetLinks gets a reference to the given map[string]Link and assigns it to the Links field.
func (o *Root) SetLinks(v map[string]Link) {
o.Links = v
}
// GetCapabilities returns the Capabilities field value if set, zero value otherwise.
func (o *Root) GetCapabilities() []Capability {
if o == nil || IsNil(o.Capabilities) {
var ret []Capability
return ret
}
return o.Capabilities
}
// GetCapabilitiesOk returns a tuple with the Capabilities field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Root) GetCapabilitiesOk() ([]Capability, bool) {
if o == nil || IsNil(o.Capabilities) {
return nil, false
}
return o.Capabilities, true
}
// HasCapabilities returns a boolean if a field has been set.
func (o *Root) HasCapabilities() bool {
if o != nil && !IsNil(o.Capabilities) {
return true
}
return false
}
// SetCapabilities gets a reference to the given []Capability and assigns it to the Capabilities field.
func (o *Root) SetCapabilities(v []Capability) {
o.Capabilities = v
}
func (o Root) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Root) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Links) {
toSerialize["_links"] = o.Links
}
if !IsNil(o.Capabilities) {
toSerialize["capabilities"] = o.Capabilities
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Root) UnmarshalJSON(data []byte) (err error) {
varRoot := _Root{}
err = json.Unmarshal(data, &varRoot)
if err != nil {
return err
}
*o = Root(varRoot)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "_links")
delete(additionalProperties, "capabilities")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableRoot struct {
value *Root
isSet bool
}
func (v NullableRoot) Get() *Root {
return v.value
}
func (v *NullableRoot) Set(val *Root) {
v.value = val
v.isSet = true
}
func (v NullableRoot) IsSet() bool {
return v.isSet
}
func (v *NullableRoot) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRoot(val *Root) *NullableRoot {
return &NullableRoot{value: val, isSet: true}
}
func (v NullableRoot) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRoot) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}