Files
sdk/model_train_task_view.go

495 lines
12 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 TrainTaskView type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainTaskView{}
// TrainTaskView struct for TrainTaskView
type TrainTaskView struct {
// Device is the accelerator class it runs on — gpu or cpu — and Devices how many.
Device *string `json:"device,omitempty"`
Devices *int64 `json:"devices,omitempty"`
Held *int64 `json:"held,omitempty"`
// Host is the machine that claimed it.
Host *string `json:"host,omitempty"`
// ID names the task.
Id *string `json:"id,omitempty"`
// Machine is the machine it was placed on, or empty for any.
Machine *string `json:"machine,omitempty"`
// Role is lead or join.
Role *string `json:"role,omitempty"`
// Seconds are the device-seconds its reports metered, and Held those held for it.
Seconds *int64 `json:"seconds,omitempty"`
// Seen is its last report, unix seconds.
Seen *int64 `json:"seen,omitempty"`
// Status is open, claimed, done or lost.
Status *string `json:"status,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainTaskView TrainTaskView
// NewTrainTaskView instantiates a new TrainTaskView 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 NewTrainTaskView() *TrainTaskView {
this := TrainTaskView{}
return &this
}
// NewTrainTaskViewWithDefaults instantiates a new TrainTaskView 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 NewTrainTaskViewWithDefaults() *TrainTaskView {
this := TrainTaskView{}
return &this
}
// GetDevice returns the Device field value if set, zero value otherwise.
func (o *TrainTaskView) GetDevice() string {
if o == nil || IsNil(o.Device) {
var ret string
return ret
}
return *o.Device
}
// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetDeviceOk() (*string, bool) {
if o == nil || IsNil(o.Device) {
return nil, false
}
return o.Device, true
}
// HasDevice returns a boolean if a field has been set.
func (o *TrainTaskView) HasDevice() bool {
if o != nil && !IsNil(o.Device) {
return true
}
return false
}
// SetDevice gets a reference to the given string and assigns it to the Device field.
func (o *TrainTaskView) SetDevice(v string) {
o.Device = &v
}
// GetDevices returns the Devices field value if set, zero value otherwise.
func (o *TrainTaskView) GetDevices() int64 {
if o == nil || IsNil(o.Devices) {
var ret int64
return ret
}
return *o.Devices
}
// GetDevicesOk returns a tuple with the Devices field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetDevicesOk() (*int64, bool) {
if o == nil || IsNil(o.Devices) {
return nil, false
}
return o.Devices, true
}
// HasDevices returns a boolean if a field has been set.
func (o *TrainTaskView) HasDevices() bool {
if o != nil && !IsNil(o.Devices) {
return true
}
return false
}
// SetDevices gets a reference to the given int64 and assigns it to the Devices field.
func (o *TrainTaskView) SetDevices(v int64) {
o.Devices = &v
}
// GetHeld returns the Held field value if set, zero value otherwise.
func (o *TrainTaskView) GetHeld() int64 {
if o == nil || IsNil(o.Held) {
var ret int64
return ret
}
return *o.Held
}
// GetHeldOk returns a tuple with the Held field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetHeldOk() (*int64, bool) {
if o == nil || IsNil(o.Held) {
return nil, false
}
return o.Held, true
}
// HasHeld returns a boolean if a field has been set.
func (o *TrainTaskView) HasHeld() bool {
if o != nil && !IsNil(o.Held) {
return true
}
return false
}
// SetHeld gets a reference to the given int64 and assigns it to the Held field.
func (o *TrainTaskView) SetHeld(v int64) {
o.Held = &v
}
// GetHost returns the Host field value if set, zero value otherwise.
func (o *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) SetHost(v string) {
o.Host = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) SetId(v string) {
o.Id = &v
}
// GetMachine returns the Machine field value if set, zero value otherwise.
func (o *TrainTaskView) GetMachine() string {
if o == nil || IsNil(o.Machine) {
var ret string
return ret
}
return *o.Machine
}
// GetMachineOk returns a tuple with the Machine field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetMachineOk() (*string, bool) {
if o == nil || IsNil(o.Machine) {
return nil, false
}
return o.Machine, true
}
// HasMachine returns a boolean if a field has been set.
func (o *TrainTaskView) HasMachine() bool {
if o != nil && !IsNil(o.Machine) {
return true
}
return false
}
// SetMachine gets a reference to the given string and assigns it to the Machine field.
func (o *TrainTaskView) SetMachine(v string) {
o.Machine = &v
}
// GetRole returns the Role field value if set, zero value otherwise.
func (o *TrainTaskView) GetRole() string {
if o == nil || IsNil(o.Role) {
var ret string
return ret
}
return *o.Role
}
// GetRoleOk returns a tuple with the Role field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetRoleOk() (*string, bool) {
if o == nil || IsNil(o.Role) {
return nil, false
}
return o.Role, true
}
// HasRole returns a boolean if a field has been set.
func (o *TrainTaskView) HasRole() bool {
if o != nil && !IsNil(o.Role) {
return true
}
return false
}
// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *TrainTaskView) SetRole(v string) {
o.Role = &v
}
// GetSeconds returns the Seconds field value if set, zero value otherwise.
func (o *TrainTaskView) GetSeconds() int64 {
if o == nil || IsNil(o.Seconds) {
var ret int64
return ret
}
return *o.Seconds
}
// GetSecondsOk returns a tuple with the Seconds field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetSecondsOk() (*int64, bool) {
if o == nil || IsNil(o.Seconds) {
return nil, false
}
return o.Seconds, true
}
// HasSeconds returns a boolean if a field has been set.
func (o *TrainTaskView) HasSeconds() bool {
if o != nil && !IsNil(o.Seconds) {
return true
}
return false
}
// SetSeconds gets a reference to the given int64 and assigns it to the Seconds field.
func (o *TrainTaskView) SetSeconds(v int64) {
o.Seconds = &v
}
// GetSeen returns the Seen field value if set, zero value otherwise.
func (o *TrainTaskView) GetSeen() int64 {
if o == nil || IsNil(o.Seen) {
var ret int64
return ret
}
return *o.Seen
}
// GetSeenOk returns a tuple with the Seen field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainTaskView) GetSeenOk() (*int64, bool) {
if o == nil || IsNil(o.Seen) {
return nil, false
}
return o.Seen, true
}
// HasSeen returns a boolean if a field has been set.
func (o *TrainTaskView) HasSeen() bool {
if o != nil && !IsNil(o.Seen) {
return true
}
return false
}
// SetSeen gets a reference to the given int64 and assigns it to the Seen field.
func (o *TrainTaskView) SetSeen(v int64) {
o.Seen = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) 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 *TrainTaskView) SetStatus(v string) {
o.Status = &v
}
func (o TrainTaskView) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainTaskView) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Device) {
toSerialize["device"] = o.Device
}
if !IsNil(o.Devices) {
toSerialize["devices"] = o.Devices
}
if !IsNil(o.Held) {
toSerialize["held"] = o.Held
}
if !IsNil(o.Host) {
toSerialize["host"] = o.Host
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Machine) {
toSerialize["machine"] = o.Machine
}
if !IsNil(o.Role) {
toSerialize["role"] = o.Role
}
if !IsNil(o.Seconds) {
toSerialize["seconds"] = o.Seconds
}
if !IsNil(o.Seen) {
toSerialize["seen"] = o.Seen
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainTaskView) UnmarshalJSON(data []byte) (err error) {
varTrainTaskView := _TrainTaskView{}
err = json.Unmarshal(data, &varTrainTaskView)
if err != nil {
return err
}
*o = TrainTaskView(varTrainTaskView)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "device")
delete(additionalProperties, "devices")
delete(additionalProperties, "held")
delete(additionalProperties, "host")
delete(additionalProperties, "id")
delete(additionalProperties, "machine")
delete(additionalProperties, "role")
delete(additionalProperties, "seconds")
delete(additionalProperties, "seen")
delete(additionalProperties, "status")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainTaskView struct {
value *TrainTaskView
isSet bool
}
func (v NullableTrainTaskView) Get() *TrainTaskView {
return v.value
}
func (v *NullableTrainTaskView) Set(val *TrainTaskView) {
v.value = val
v.isSet = true
}
func (v NullableTrainTaskView) IsSet() bool {
return v.isSet
}
func (v *NullableTrainTaskView) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainTaskView(val *TrainTaskView) *NullableTrainTaskView {
return &NullableTrainTaskView{value: val, isSet: true}
}
func (v NullableTrainTaskView) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainTaskView) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}