mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
191 lines
4.8 KiB
Go
191 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 ResourceRequests type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &ResourceRequests{}
|
|
|
|
// ResourceRequests struct for ResourceRequests
|
|
type ResourceRequests struct {
|
|
Cpu *string `json:"cpu,omitempty"`
|
|
Memory *string `json:"memory,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _ResourceRequests ResourceRequests
|
|
|
|
// NewResourceRequests instantiates a new ResourceRequests 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 NewResourceRequests() *ResourceRequests {
|
|
this := ResourceRequests{}
|
|
return &this
|
|
}
|
|
|
|
// NewResourceRequestsWithDefaults instantiates a new ResourceRequests 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 NewResourceRequestsWithDefaults() *ResourceRequests {
|
|
this := ResourceRequests{}
|
|
return &this
|
|
}
|
|
|
|
// GetCpu returns the Cpu field value if set, zero value otherwise.
|
|
func (o *ResourceRequests) GetCpu() string {
|
|
if o == nil || IsNil(o.Cpu) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Cpu
|
|
}
|
|
|
|
// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceRequests) GetCpuOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Cpu) {
|
|
return nil, false
|
|
}
|
|
return o.Cpu, true
|
|
}
|
|
|
|
// HasCpu returns a boolean if a field has been set.
|
|
func (o *ResourceRequests) HasCpu() bool {
|
|
if o != nil && !IsNil(o.Cpu) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCpu gets a reference to the given string and assigns it to the Cpu field.
|
|
func (o *ResourceRequests) SetCpu(v string) {
|
|
o.Cpu = &v
|
|
}
|
|
|
|
// GetMemory returns the Memory field value if set, zero value otherwise.
|
|
func (o *ResourceRequests) GetMemory() string {
|
|
if o == nil || IsNil(o.Memory) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Memory
|
|
}
|
|
|
|
// GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceRequests) GetMemoryOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Memory) {
|
|
return nil, false
|
|
}
|
|
return o.Memory, true
|
|
}
|
|
|
|
// HasMemory returns a boolean if a field has been set.
|
|
func (o *ResourceRequests) HasMemory() bool {
|
|
if o != nil && !IsNil(o.Memory) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMemory gets a reference to the given string and assigns it to the Memory field.
|
|
func (o *ResourceRequests) SetMemory(v string) {
|
|
o.Memory = &v
|
|
}
|
|
|
|
func (o ResourceRequests) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o ResourceRequests) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Cpu) {
|
|
toSerialize["cpu"] = o.Cpu
|
|
}
|
|
if !IsNil(o.Memory) {
|
|
toSerialize["memory"] = o.Memory
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *ResourceRequests) UnmarshalJSON(data []byte) (err error) {
|
|
varResourceRequests := _ResourceRequests{}
|
|
|
|
err = json.Unmarshal(data, &varResourceRequests)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = ResourceRequests(varResourceRequests)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "cpu")
|
|
delete(additionalProperties, "memory")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableResourceRequests struct {
|
|
value *ResourceRequests
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableResourceRequests) Get() *ResourceRequests {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableResourceRequests) Set(val *ResourceRequests) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableResourceRequests) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableResourceRequests) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableResourceRequests(val *ResourceRequests) *NullableResourceRequests {
|
|
return &NullableResourceRequests{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableResourceRequests) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableResourceRequests) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|