Files
sdk/model_agent_spec.go

307 lines
7.4 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 AgentSpec type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AgentSpec{}
// AgentSpec struct for AgentSpec
type AgentSpec struct {
// amd64 | arm64 | ...
Arch *string `json:"arch,omitempty"`
// logical cores
Cpus *int64 `json:"cpus,omitempty"`
// GPUs is every accelerator the machine advertises, one entry each, capped at 32 on write. Empty means the probe found none — and that is the answer a Need is checked against, so a machine with no entry here clears no accelerator floor. The list is not vendor-filtered: what satisfies a job is counts and VRAM, never a brand (see Need).
Gpus []AgentGPU `json:"gpus,omitempty"`
// total RAM, bytes
Memory *int64 `json:"memory,omitempty"`
// linux | darwin | windows
Os *string `json:"os,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AgentSpec AgentSpec
// NewAgentSpec instantiates a new AgentSpec 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 NewAgentSpec() *AgentSpec {
this := AgentSpec{}
return &this
}
// NewAgentSpecWithDefaults instantiates a new AgentSpec 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 NewAgentSpecWithDefaults() *AgentSpec {
this := AgentSpec{}
return &this
}
// GetArch returns the Arch field value if set, zero value otherwise.
func (o *AgentSpec) GetArch() string {
if o == nil || IsNil(o.Arch) {
var ret string
return ret
}
return *o.Arch
}
// GetArchOk returns a tuple with the Arch field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpec) GetArchOk() (*string, bool) {
if o == nil || IsNil(o.Arch) {
return nil, false
}
return o.Arch, true
}
// HasArch returns a boolean if a field has been set.
func (o *AgentSpec) HasArch() bool {
if o != nil && !IsNil(o.Arch) {
return true
}
return false
}
// SetArch gets a reference to the given string and assigns it to the Arch field.
func (o *AgentSpec) SetArch(v string) {
o.Arch = &v
}
// GetCpus returns the Cpus field value if set, zero value otherwise.
func (o *AgentSpec) GetCpus() int64 {
if o == nil || IsNil(o.Cpus) {
var ret int64
return ret
}
return *o.Cpus
}
// GetCpusOk returns a tuple with the Cpus field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpec) GetCpusOk() (*int64, bool) {
if o == nil || IsNil(o.Cpus) {
return nil, false
}
return o.Cpus, true
}
// HasCpus returns a boolean if a field has been set.
func (o *AgentSpec) HasCpus() bool {
if o != nil && !IsNil(o.Cpus) {
return true
}
return false
}
// SetCpus gets a reference to the given int64 and assigns it to the Cpus field.
func (o *AgentSpec) SetCpus(v int64) {
o.Cpus = &v
}
// GetGpus returns the Gpus field value if set, zero value otherwise.
func (o *AgentSpec) GetGpus() []AgentGPU {
if o == nil || IsNil(o.Gpus) {
var ret []AgentGPU
return ret
}
return o.Gpus
}
// GetGpusOk returns a tuple with the Gpus field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpec) GetGpusOk() ([]AgentGPU, bool) {
if o == nil || IsNil(o.Gpus) {
return nil, false
}
return o.Gpus, true
}
// HasGpus returns a boolean if a field has been set.
func (o *AgentSpec) HasGpus() bool {
if o != nil && !IsNil(o.Gpus) {
return true
}
return false
}
// SetGpus gets a reference to the given []AgentGPU and assigns it to the Gpus field.
func (o *AgentSpec) SetGpus(v []AgentGPU) {
o.Gpus = v
}
// GetMemory returns the Memory field value if set, zero value otherwise.
func (o *AgentSpec) GetMemory() int64 {
if o == nil || IsNil(o.Memory) {
var ret int64
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 *AgentSpec) GetMemoryOk() (*int64, 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 *AgentSpec) HasMemory() bool {
if o != nil && !IsNil(o.Memory) {
return true
}
return false
}
// SetMemory gets a reference to the given int64 and assigns it to the Memory field.
func (o *AgentSpec) SetMemory(v int64) {
o.Memory = &v
}
// GetOs returns the Os field value if set, zero value otherwise.
func (o *AgentSpec) GetOs() string {
if o == nil || IsNil(o.Os) {
var ret string
return ret
}
return *o.Os
}
// GetOsOk returns a tuple with the Os field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpec) GetOsOk() (*string, bool) {
if o == nil || IsNil(o.Os) {
return nil, false
}
return o.Os, true
}
// HasOs returns a boolean if a field has been set.
func (o *AgentSpec) HasOs() bool {
if o != nil && !IsNil(o.Os) {
return true
}
return false
}
// SetOs gets a reference to the given string and assigns it to the Os field.
func (o *AgentSpec) SetOs(v string) {
o.Os = &v
}
func (o AgentSpec) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AgentSpec) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Arch) {
toSerialize["arch"] = o.Arch
}
if !IsNil(o.Cpus) {
toSerialize["cpus"] = o.Cpus
}
if !IsNil(o.Gpus) {
toSerialize["gpus"] = o.Gpus
}
if !IsNil(o.Memory) {
toSerialize["memory"] = o.Memory
}
if !IsNil(o.Os) {
toSerialize["os"] = o.Os
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AgentSpec) UnmarshalJSON(data []byte) (err error) {
varAgentSpec := _AgentSpec{}
err = json.Unmarshal(data, &varAgentSpec)
if err != nil {
return err
}
*o = AgentSpec(varAgentSpec)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "arch")
delete(additionalProperties, "cpus")
delete(additionalProperties, "gpus")
delete(additionalProperties, "memory")
delete(additionalProperties, "os")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAgentSpec struct {
value *AgentSpec
isSet bool
}
func (v NullableAgentSpec) Get() *AgentSpec {
return v.value
}
func (v *NullableAgentSpec) Set(val *AgentSpec) {
v.value = val
v.isSet = true
}
func (v NullableAgentSpec) IsSet() bool {
return v.isSet
}
func (v *NullableAgentSpec) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAgentSpec(val *AgentSpec) *NullableAgentSpec {
return &NullableAgentSpec{value: val, isSet: true}
}
func (v NullableAgentSpec) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAgentSpec) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}