Files
sdk/model_compute_fleet_unit.go

535 lines
15 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 ComputeFleetUnit type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ComputeFleetUnit{}
// ComputeFleetUnit struct for ComputeFleetUnit
type ComputeFleetUnit struct {
// Host is the unit's hostname. Empty for a unit that is not one host: a cluster row has no hostname to report.
Host *string `json:"host,omitempty"`
// Kind is what the unit IS: laptop, cloud, gpu, cluster, machine or worker.
Kind *string `json:"kind,omitempty"`
// Label is the name to show a human — a target's label, a worker's hostname, a machine's display name. Empty when the source has none to give.
Label *string `json:"label,omitempty"`
// Metrics is the unit's latest utilization: its own live snapshot when it keeps one (a run-target's heartbeat wins), else the newest sample from the series for the SAME source. Absent means nothing is known about this unit's load — which is deliberately not the same as a reading of zero.
Metrics *ComputeFleetMetrics `json:"metrics,omitempty"`
// Queued is how many renders are waiting on THIS GPU's own lane in the org's gpu-jobs queue. BYO units only — an agent run-target dispatches, it does not queue — and omitted when nothing is waiting.
Queued *int64 `json:"queued,omitempty"`
// Running is what the unit is executing right now: agent sessions in flight for a run-target, claimed renders for a BYO GPU.
Running *int64 `json:"running,omitempty"`
// Sessions is how many agent sessions are open on this unit. Always present, and 0 for a source that cannot host agent sessions at all — a fact about that plane, not a gap in the reading.
Sessions *int64 `json:"sessions,omitempty"`
// Source is the plane this row came from: \"agent\" (a linked run-target), \"byo\" (a worker or cluster the org dialed in) or \"visor\" (a machine Hanzo provisioned). It is half the row's identity, and it says which face owns the unit — /v1/agent/targets, /v1/compute/fleet/workers, /v1/compute/machines.
Source *string `json:"source,omitempty"`
// Spec is the unit's static capability. Absent when the source reported none — unknown capability, never a zeroed one.
Spec *ComputeFleetSpec `json:"spec,omitempty"`
// Status is liveness in the SOURCE's own vocabulary, because each plane decides it differently: a run-target's is derived from its heartbeat, a BYO worker's is online/offline on the 90s window, a BYO cluster's is \"attached\", and a Visor machine's is the provider's word for its lifecycle state.
Status *string `json:"status,omitempty"`
// Unit is the SOURCE's own id for this unit — a run-target id, a BYO worker id, a Visor machine name — so a row links straight back to the face that owns it. It is unique within a source, not across them: two planes may mint the same id, which is why (source, unit) together is the identity.
Unit *string `json:"unit,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ComputeFleetUnit ComputeFleetUnit
// NewComputeFleetUnit instantiates a new ComputeFleetUnit 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 NewComputeFleetUnit() *ComputeFleetUnit {
this := ComputeFleetUnit{}
return &this
}
// NewComputeFleetUnitWithDefaults instantiates a new ComputeFleetUnit 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 NewComputeFleetUnitWithDefaults() *ComputeFleetUnit {
this := ComputeFleetUnit{}
return &this
}
// GetHost returns the Host field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetHost() string {
if o == nil || IsNil(o.Host) {
var ret string
return ret
}
return *o.Host
}
// GetHostOk returns a tuple with the Host field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetHostOk() (*string, bool) {
if o == nil || IsNil(o.Host) {
return nil, false
}
return o.Host, true
}
// HasHost returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasHost() bool {
if o != nil && !IsNil(o.Host) {
return true
}
return false
}
// SetHost gets a reference to the given string and assigns it to the Host field.
func (o *ComputeFleetUnit) SetHost(v string) {
o.Host = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *ComputeFleetUnit) SetKind(v string) {
o.Kind = &v
}
// GetLabel returns the Label field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetLabel() string {
if o == nil || IsNil(o.Label) {
var ret string
return ret
}
return *o.Label
}
// GetLabelOk returns a tuple with the Label field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetLabelOk() (*string, bool) {
if o == nil || IsNil(o.Label) {
return nil, false
}
return o.Label, true
}
// HasLabel returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasLabel() bool {
if o != nil && !IsNil(o.Label) {
return true
}
return false
}
// SetLabel gets a reference to the given string and assigns it to the Label field.
func (o *ComputeFleetUnit) SetLabel(v string) {
o.Label = &v
}
// GetMetrics returns the Metrics field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetMetrics() ComputeFleetMetrics {
if o == nil || IsNil(o.Metrics) {
var ret ComputeFleetMetrics
return ret
}
return *o.Metrics
}
// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetMetricsOk() (*ComputeFleetMetrics, bool) {
if o == nil || IsNil(o.Metrics) {
return nil, false
}
return o.Metrics, true
}
// HasMetrics returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasMetrics() bool {
if o != nil && !IsNil(o.Metrics) {
return true
}
return false
}
// SetMetrics gets a reference to the given ComputeFleetMetrics and assigns it to the Metrics field.
func (o *ComputeFleetUnit) SetMetrics(v ComputeFleetMetrics) {
o.Metrics = &v
}
// GetQueued returns the Queued field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetQueued() int64 {
if o == nil || IsNil(o.Queued) {
var ret int64
return ret
}
return *o.Queued
}
// GetQueuedOk returns a tuple with the Queued field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetQueuedOk() (*int64, bool) {
if o == nil || IsNil(o.Queued) {
return nil, false
}
return o.Queued, true
}
// HasQueued returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasQueued() bool {
if o != nil && !IsNil(o.Queued) {
return true
}
return false
}
// SetQueued gets a reference to the given int64 and assigns it to the Queued field.
func (o *ComputeFleetUnit) SetQueued(v int64) {
o.Queued = &v
}
// GetRunning returns the Running field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetRunning() int64 {
if o == nil || IsNil(o.Running) {
var ret int64
return ret
}
return *o.Running
}
// GetRunningOk returns a tuple with the Running field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetRunningOk() (*int64, bool) {
if o == nil || IsNil(o.Running) {
return nil, false
}
return o.Running, true
}
// HasRunning returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasRunning() bool {
if o != nil && !IsNil(o.Running) {
return true
}
return false
}
// SetRunning gets a reference to the given int64 and assigns it to the Running field.
func (o *ComputeFleetUnit) SetRunning(v int64) {
o.Running = &v
}
// GetSessions returns the Sessions field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetSessions() int64 {
if o == nil || IsNil(o.Sessions) {
var ret int64
return ret
}
return *o.Sessions
}
// GetSessionsOk returns a tuple with the Sessions field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetSessionsOk() (*int64, bool) {
if o == nil || IsNil(o.Sessions) {
return nil, false
}
return o.Sessions, true
}
// HasSessions returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasSessions() bool {
if o != nil && !IsNil(o.Sessions) {
return true
}
return false
}
// SetSessions gets a reference to the given int64 and assigns it to the Sessions field.
func (o *ComputeFleetUnit) SetSessions(v int64) {
o.Sessions = &v
}
// GetSource returns the Source field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetSource() string {
if o == nil || IsNil(o.Source) {
var ret string
return ret
}
return *o.Source
}
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetSourceOk() (*string, bool) {
if o == nil || IsNil(o.Source) {
return nil, false
}
return o.Source, true
}
// HasSource returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasSource() bool {
if o != nil && !IsNil(o.Source) {
return true
}
return false
}
// SetSource gets a reference to the given string and assigns it to the Source field.
func (o *ComputeFleetUnit) SetSource(v string) {
o.Source = &v
}
// GetSpec returns the Spec field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetSpec() ComputeFleetSpec {
if o == nil || IsNil(o.Spec) {
var ret ComputeFleetSpec
return ret
}
return *o.Spec
}
// GetSpecOk returns a tuple with the Spec field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetSpecOk() (*ComputeFleetSpec, bool) {
if o == nil || IsNil(o.Spec) {
return nil, false
}
return o.Spec, true
}
// HasSpec returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasSpec() bool {
if o != nil && !IsNil(o.Spec) {
return true
}
return false
}
// SetSpec gets a reference to the given ComputeFleetSpec and assigns it to the Spec field.
func (o *ComputeFleetUnit) SetSpec(v ComputeFleetSpec) {
o.Spec = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *ComputeFleetUnit) SetStatus(v string) {
o.Status = &v
}
// GetUnit returns the Unit field value if set, zero value otherwise.
func (o *ComputeFleetUnit) GetUnit() string {
if o == nil || IsNil(o.Unit) {
var ret string
return ret
}
return *o.Unit
}
// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ComputeFleetUnit) GetUnitOk() (*string, bool) {
if o == nil || IsNil(o.Unit) {
return nil, false
}
return o.Unit, true
}
// HasUnit returns a boolean if a field has been set.
func (o *ComputeFleetUnit) HasUnit() bool {
if o != nil && !IsNil(o.Unit) {
return true
}
return false
}
// SetUnit gets a reference to the given string and assigns it to the Unit field.
func (o *ComputeFleetUnit) SetUnit(v string) {
o.Unit = &v
}
func (o ComputeFleetUnit) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ComputeFleetUnit) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Host) {
toSerialize["host"] = o.Host
}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.Label) {
toSerialize["label"] = o.Label
}
if !IsNil(o.Metrics) {
toSerialize["metrics"] = o.Metrics
}
if !IsNil(o.Queued) {
toSerialize["queued"] = o.Queued
}
if !IsNil(o.Running) {
toSerialize["running"] = o.Running
}
if !IsNil(o.Sessions) {
toSerialize["sessions"] = o.Sessions
}
if !IsNil(o.Source) {
toSerialize["source"] = o.Source
}
if !IsNil(o.Spec) {
toSerialize["spec"] = o.Spec
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if !IsNil(o.Unit) {
toSerialize["unit"] = o.Unit
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ComputeFleetUnit) UnmarshalJSON(data []byte) (err error) {
varComputeFleetUnit := _ComputeFleetUnit{}
err = json.Unmarshal(data, &varComputeFleetUnit)
if err != nil {
return err
}
*o = ComputeFleetUnit(varComputeFleetUnit)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "host")
delete(additionalProperties, "kind")
delete(additionalProperties, "label")
delete(additionalProperties, "metrics")
delete(additionalProperties, "queued")
delete(additionalProperties, "running")
delete(additionalProperties, "sessions")
delete(additionalProperties, "source")
delete(additionalProperties, "spec")
delete(additionalProperties, "status")
delete(additionalProperties, "unit")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableComputeFleetUnit struct {
value *ComputeFleetUnit
isSet bool
}
func (v NullableComputeFleetUnit) Get() *ComputeFleetUnit {
return v.value
}
func (v *NullableComputeFleetUnit) Set(val *ComputeFleetUnit) {
v.value = val
v.isSet = true
}
func (v NullableComputeFleetUnit) IsSet() bool {
return v.isSet
}
func (v *NullableComputeFleetUnit) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableComputeFleetUnit(val *ComputeFleetUnit) *NullableComputeFleetUnit {
return &NullableComputeFleetUnit{value: val, isSet: true}
}
func (v NullableComputeFleetUnit) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableComputeFleetUnit) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}