Files
sdk/model_agent_target_view.go

649 lines
19 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
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 AgentTargetView type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AgentTargetView{}
// AgentTargetView struct for AgentTargetView
type AgentTargetView struct {
// Capacity is a human summary of what the machine has (\"8 vCPU / 32G\", \"1× GB10\"), up to 256 characters. Prose for a card — Spec is the same thing in a form a scheduler can read, and nothing derives one from the other.
Capacity *string `json:"capacity,omitempty"`
// CreatedAt is when the machine was first registered, RFC 3339 in UTC. A re-link refreshes the row and leaves this alone, so it dates the machine and not the connection.
CreatedAt *string `json:"createdAt,omitempty"`
// Host is the hostname sessions on this machine report, and it is a JOIN KEY, not a label: a session naming this host counts against the load below even when it names no target id, and a re-link of the same (org, host, owner) refreshes this row instead of creating a second. Empty means the machine is addressable only by ID.
Host *string `json:"host,omitempty"`
// ID is the machine's handle, minted as \"tgt_\" + 32 hex characters. It is what a session records to say it ran here, and what every later patch, claim or delete addresses.
Id *string `json:"id,omitempty"`
// Kind is what sort of destination this is, from a closed five: laptop | cloud | gpu | cluster | machine. A register that named none is a `machine`.
Kind *string `json:"kind,omitempty"`
// Label is the name a person gave the machine (\"workshop\"), up to 128 characters. Required at register, free text, and the only field here meant for reading rather than matching.
Label *string `json:"label,omitempty"`
// Metrics is what the machine was DOING at its last heartbeat — loadavg, memory, accelerator utilization. Absent when it has never beaten. It is a SNAPSHOT: the series over time lives in the fleet samples, not here.
Metrics *AgentMetrics `json:"metrics,omitempty"`
// MetricsAt is when that heartbeat was recorded, RFC 3339 in UTC, and the SERVER stamps it — a client cannot backdate or forge the staleness clock. Absent means never beaten, which is exactly the case where Status is taken at its word.
MetricsAt *string `json:"metricsAt,omitempty"`
// Running is how many of those are in `running` right now — the number a dispatcher weighs against Capacity. paused sessions are in Sessions and not here.
Running *int64 `json:"running,omitempty"`
// Serving says whether a run the caller sends here now would be taken: the machine is the caller's (or the caller is an org admin), and it is online with a runner that polled for work within the last 90 seconds — the online and runner half is what dispatch checks (TargetDispatchable). A heartbeat alone keeps a machine online, not serving, and a colleague's machine never serves the caller.
Serving *bool `json:"serving,omitempty"`
// Sessions is how many of the org's sessions are mapped to this machine, by target id OR by matching Host. All of them, whatever their status.
Sessions *int64 `json:"sessions,omitempty"`
// Spec is what the machine IS — os, arch, cores, RAM, accelerators — the static half, changed only when something reports it again. Absent when nothing has ever been reported, and a scheduler reads absence as \"cannot satisfy a floor\" rather than as \"no limits\".
Spec *AgentSpec `json:"spec,omitempty"`
// Status is the EFFECTIVE liveness — online | offline | draining — not the stored one. offline and draining are operator INTENT and are reported as they stand; `online` is checked against the heartbeat, and a machine that has beaten before but not in the last 90 seconds reports offline whatever its row says. A target that has NEVER beaten keeps its stored status, because a hand-registered destination has no fact to check.
Status *string `json:"status,omitempty"`
// UpdatedAt is the last write to the row, same format — which for a beating machine is its last heartbeat, since a heartbeat IS a write.
UpdatedAt *string `json:"updatedAt,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AgentTargetView AgentTargetView
// NewAgentTargetView instantiates a new AgentTargetView 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 NewAgentTargetView() *AgentTargetView {
this := AgentTargetView{}
return &this
}
// NewAgentTargetViewWithDefaults instantiates a new AgentTargetView 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 NewAgentTargetViewWithDefaults() *AgentTargetView {
this := AgentTargetView{}
return &this
}
// GetCapacity returns the Capacity field value if set, zero value otherwise.
func (o *AgentTargetView) GetCapacity() string {
if o == nil || IsNil(o.Capacity) {
var ret string
return ret
}
return *o.Capacity
}
// GetCapacityOk returns a tuple with the Capacity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetCapacityOk() (*string, bool) {
if o == nil || IsNil(o.Capacity) {
return nil, false
}
return o.Capacity, true
}
// HasCapacity returns a boolean if a field has been set.
func (o *AgentTargetView) HasCapacity() bool {
if o != nil && !IsNil(o.Capacity) {
return true
}
return false
}
// SetCapacity gets a reference to the given string and assigns it to the Capacity field.
func (o *AgentTargetView) SetCapacity(v string) {
o.Capacity = &v
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *AgentTargetView) GetCreatedAt() string {
if o == nil || IsNil(o.CreatedAt) {
var ret string
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetCreatedAtOk() (*string, bool) {
if o == nil || IsNil(o.CreatedAt) {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *AgentTargetView) HasCreatedAt() bool {
if o != nil && !IsNil(o.CreatedAt) {
return true
}
return false
}
// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field.
func (o *AgentTargetView) SetCreatedAt(v string) {
o.CreatedAt = &v
}
// GetHost returns the Host field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetHost(v string) {
o.Host = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *AgentTargetView) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *AgentTargetView) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *AgentTargetView) SetId(v string) {
o.Id = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetKind(v string) {
o.Kind = &v
}
// GetLabel returns the Label field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetLabel(v string) {
o.Label = &v
}
// GetMetrics returns the Metrics field value if set, zero value otherwise.
func (o *AgentTargetView) GetMetrics() AgentMetrics {
if o == nil || IsNil(o.Metrics) {
var ret AgentMetrics
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 *AgentTargetView) GetMetricsOk() (*AgentMetrics, 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 *AgentTargetView) HasMetrics() bool {
if o != nil && !IsNil(o.Metrics) {
return true
}
return false
}
// SetMetrics gets a reference to the given AgentMetrics and assigns it to the Metrics field.
func (o *AgentTargetView) SetMetrics(v AgentMetrics) {
o.Metrics = &v
}
// GetMetricsAt returns the MetricsAt field value if set, zero value otherwise.
func (o *AgentTargetView) GetMetricsAt() string {
if o == nil || IsNil(o.MetricsAt) {
var ret string
return ret
}
return *o.MetricsAt
}
// GetMetricsAtOk returns a tuple with the MetricsAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetMetricsAtOk() (*string, bool) {
if o == nil || IsNil(o.MetricsAt) {
return nil, false
}
return o.MetricsAt, true
}
// HasMetricsAt returns a boolean if a field has been set.
func (o *AgentTargetView) HasMetricsAt() bool {
if o != nil && !IsNil(o.MetricsAt) {
return true
}
return false
}
// SetMetricsAt gets a reference to the given string and assigns it to the MetricsAt field.
func (o *AgentTargetView) SetMetricsAt(v string) {
o.MetricsAt = &v
}
// GetRunning returns the Running field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetRunning(v int64) {
o.Running = &v
}
// GetServing returns the Serving field value if set, zero value otherwise.
func (o *AgentTargetView) GetServing() bool {
if o == nil || IsNil(o.Serving) {
var ret bool
return ret
}
return *o.Serving
}
// GetServingOk returns a tuple with the Serving field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetServingOk() (*bool, bool) {
if o == nil || IsNil(o.Serving) {
return nil, false
}
return o.Serving, true
}
// HasServing returns a boolean if a field has been set.
func (o *AgentTargetView) HasServing() bool {
if o != nil && !IsNil(o.Serving) {
return true
}
return false
}
// SetServing gets a reference to the given bool and assigns it to the Serving field.
func (o *AgentTargetView) SetServing(v bool) {
o.Serving = &v
}
// GetSessions returns the Sessions field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetSessions(v int64) {
o.Sessions = &v
}
// GetSpec returns the Spec field value if set, zero value otherwise.
func (o *AgentTargetView) GetSpec() AgentSpec {
if o == nil || IsNil(o.Spec) {
var ret AgentSpec
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 *AgentTargetView) GetSpecOk() (*AgentSpec, 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 *AgentTargetView) HasSpec() bool {
if o != nil && !IsNil(o.Spec) {
return true
}
return false
}
// SetSpec gets a reference to the given AgentSpec and assigns it to the Spec field.
func (o *AgentTargetView) SetSpec(v AgentSpec) {
o.Spec = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) 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 *AgentTargetView) SetStatus(v string) {
o.Status = &v
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *AgentTargetView) GetUpdatedAt() string {
if o == nil || IsNil(o.UpdatedAt) {
var ret string
return ret
}
return *o.UpdatedAt
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentTargetView) GetUpdatedAtOk() (*string, bool) {
if o == nil || IsNil(o.UpdatedAt) {
return nil, false
}
return o.UpdatedAt, true
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *AgentTargetView) HasUpdatedAt() bool {
if o != nil && !IsNil(o.UpdatedAt) {
return true
}
return false
}
// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field.
func (o *AgentTargetView) SetUpdatedAt(v string) {
o.UpdatedAt = &v
}
func (o AgentTargetView) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AgentTargetView) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Capacity) {
toSerialize["capacity"] = o.Capacity
}
if !IsNil(o.CreatedAt) {
toSerialize["createdAt"] = o.CreatedAt
}
if !IsNil(o.Host) {
toSerialize["host"] = o.Host
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
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.MetricsAt) {
toSerialize["metricsAt"] = o.MetricsAt
}
if !IsNil(o.Running) {
toSerialize["running"] = o.Running
}
if !IsNil(o.Serving) {
toSerialize["serving"] = o.Serving
}
if !IsNil(o.Sessions) {
toSerialize["sessions"] = o.Sessions
}
if !IsNil(o.Spec) {
toSerialize["spec"] = o.Spec
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if !IsNil(o.UpdatedAt) {
toSerialize["updatedAt"] = o.UpdatedAt
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AgentTargetView) UnmarshalJSON(data []byte) (err error) {
varAgentTargetView := _AgentTargetView{}
err = json.Unmarshal(data, &varAgentTargetView)
if err != nil {
return err
}
*o = AgentTargetView(varAgentTargetView)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "capacity")
delete(additionalProperties, "createdAt")
delete(additionalProperties, "host")
delete(additionalProperties, "id")
delete(additionalProperties, "kind")
delete(additionalProperties, "label")
delete(additionalProperties, "metrics")
delete(additionalProperties, "metricsAt")
delete(additionalProperties, "running")
delete(additionalProperties, "serving")
delete(additionalProperties, "sessions")
delete(additionalProperties, "spec")
delete(additionalProperties, "status")
delete(additionalProperties, "updatedAt")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAgentTargetView struct {
value *AgentTargetView
isSet bool
}
func (v NullableAgentTargetView) Get() *AgentTargetView {
return v.value
}
func (v *NullableAgentTargetView) Set(val *AgentTargetView) {
v.value = val
v.isSet = true
}
func (v NullableAgentTargetView) IsSet() bool {
return v.isSet
}
func (v *NullableAgentTargetView) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAgentTargetView(val *AgentTargetView) *NullableAgentTargetView {
return &NullableAgentTargetView{value: val, isSet: true}
}
func (v NullableAgentTargetView) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAgentTargetView) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}