mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
383 lines
11 KiB
Go
383 lines
11 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 AgentTargetReq type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &AgentTargetReq{}
|
|
|
|
// AgentTargetReq struct for AgentTargetReq
|
|
type AgentTargetReq struct {
|
|
// Capacity is a human summary of the machine's size, up to 256 characters. Prose only; a scheduler reads Spec.
|
|
Capacity *string `json:"capacity,omitempty"`
|
|
// Host is the hostname sessions on this machine will report. It is what makes a re-link IDEMPOTENT: the same (org, host, owner) refreshes the existing row and answers 200, while a request with no host always creates a new target and answers 201. It never adopts a row owned by somebody else.
|
|
Host *string `json:"host,omitempty"`
|
|
// Kind is laptop | cloud | gpu | cluster | machine. Empty registers a `machine`; anything outside the five is a 400.
|
|
Kind *string `json:"kind,omitempty"`
|
|
// Label is the name to show for this machine, up to 128 characters. REQUIRED — it is the only field here a person reads.
|
|
Label *string `json:"label,omitempty"`
|
|
// Metrics is a live sample, and sending one IS A HEARTBEAT: it refreshes the row and starts the 90-second liveness window, and it is appended to the fleet series as one point. Its own `at` is ignored — the server stamps the time, so a client can never age or backdate its own machine. Omit it to register a machine without claiming it is alive.
|
|
Metrics *AgentMetrics `json:"metrics,omitempty"`
|
|
// Spec is the machine's static capability — os, arch, cores, RAM, accelerators. Every field is bounded on write and at most 32 accelerators are accepted, so what comes back may be clamped. Omit it for a destination nothing probes.
|
|
Spec *AgentSpec `json:"spec,omitempty"`
|
|
// Status is online | offline | draining. Empty registers `online`. It states INTENT — a heartbeat is what decides whether an online machine is actually reachable, so declaring online does not make it so.
|
|
Status *string `json:"status,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _AgentTargetReq AgentTargetReq
|
|
|
|
// NewAgentTargetReq instantiates a new AgentTargetReq 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 NewAgentTargetReq() *AgentTargetReq {
|
|
this := AgentTargetReq{}
|
|
return &this
|
|
}
|
|
|
|
// NewAgentTargetReqWithDefaults instantiates a new AgentTargetReq 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 NewAgentTargetReqWithDefaults() *AgentTargetReq {
|
|
this := AgentTargetReq{}
|
|
return &this
|
|
}
|
|
|
|
// GetCapacity returns the Capacity field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetCapacity(v string) {
|
|
o.Capacity = &v
|
|
}
|
|
|
|
// GetHost returns the Host field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetHost(v string) {
|
|
o.Host = &v
|
|
}
|
|
|
|
// GetKind returns the Kind field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetKind(v string) {
|
|
o.Kind = &v
|
|
}
|
|
|
|
// GetLabel returns the Label field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetLabel(v string) {
|
|
o.Label = &v
|
|
}
|
|
|
|
// GetMetrics returns the Metrics field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetMetrics(v AgentMetrics) {
|
|
o.Metrics = &v
|
|
}
|
|
|
|
// GetSpec returns the Spec field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetSpec(v AgentSpec) {
|
|
o.Spec = &v
|
|
}
|
|
|
|
// GetStatus returns the Status field value if set, zero value otherwise.
|
|
func (o *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) 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 *AgentTargetReq) SetStatus(v string) {
|
|
o.Status = &v
|
|
}
|
|
|
|
func (o AgentTargetReq) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o AgentTargetReq) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Capacity) {
|
|
toSerialize["capacity"] = o.Capacity
|
|
}
|
|
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.Spec) {
|
|
toSerialize["spec"] = o.Spec
|
|
}
|
|
if !IsNil(o.Status) {
|
|
toSerialize["status"] = o.Status
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *AgentTargetReq) UnmarshalJSON(data []byte) (err error) {
|
|
varAgentTargetReq := _AgentTargetReq{}
|
|
|
|
err = json.Unmarshal(data, &varAgentTargetReq)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = AgentTargetReq(varAgentTargetReq)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "capacity")
|
|
delete(additionalProperties, "host")
|
|
delete(additionalProperties, "kind")
|
|
delete(additionalProperties, "label")
|
|
delete(additionalProperties, "metrics")
|
|
delete(additionalProperties, "spec")
|
|
delete(additionalProperties, "status")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableAgentTargetReq struct {
|
|
value *AgentTargetReq
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableAgentTargetReq) Get() *AgentTargetReq {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableAgentTargetReq) Set(val *AgentTargetReq) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableAgentTargetReq) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableAgentTargetReq) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableAgentTargetReq(val *AgentTargetReq) *NullableAgentTargetReq {
|
|
return &NullableAgentTargetReq{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableAgentTargetReq) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableAgentTargetReq) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|