Files
sdk/model_train_claimed.go

458 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 TrainClaimed type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainClaimed{}
// TrainClaimed struct for TrainClaimed
type TrainClaimed struct {
// Coordinator is where a join task reaches its lead.
Coordinator *string `json:"coordinator,omitempty"`
// Device is the accelerator kind it runs on, and Devices how many of them.
Device *string `json:"device,omitempty"`
Devices *int64 `json:"devices,omitempty"`
// Held is the device-seconds held for it. The cloud meters the task by the clock and stops its job before it runs past them.
Held *int64 `json:"held,omitempty"`
// ID names the task.
Id *string `json:"id,omitempty"`
// Job names its job.
Job *string `json:"job,omitempty"`
// Lease authenticates every report for the task; it is answered once.
Lease *string `json:"lease,omitempty"`
// Report is the most seconds that may pass between its reports.
Report *int64 `json:"report,omitempty"`
// Role is lead or join.
Role *string `json:"role,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainClaimed TrainClaimed
// NewTrainClaimed instantiates a new TrainClaimed 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 NewTrainClaimed() *TrainClaimed {
this := TrainClaimed{}
return &this
}
// NewTrainClaimedWithDefaults instantiates a new TrainClaimed 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 NewTrainClaimedWithDefaults() *TrainClaimed {
this := TrainClaimed{}
return &this
}
// GetCoordinator returns the Coordinator field value if set, zero value otherwise.
func (o *TrainClaimed) GetCoordinator() string {
if o == nil || IsNil(o.Coordinator) {
var ret string
return ret
}
return *o.Coordinator
}
// GetCoordinatorOk returns a tuple with the Coordinator field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainClaimed) GetCoordinatorOk() (*string, bool) {
if o == nil || IsNil(o.Coordinator) {
return nil, false
}
return o.Coordinator, true
}
// HasCoordinator returns a boolean if a field has been set.
func (o *TrainClaimed) HasCoordinator() bool {
if o != nil && !IsNil(o.Coordinator) {
return true
}
return false
}
// SetCoordinator gets a reference to the given string and assigns it to the Coordinator field.
func (o *TrainClaimed) SetCoordinator(v string) {
o.Coordinator = &v
}
// GetDevice returns the Device field value if set, zero value otherwise.
func (o *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) SetDevice(v string) {
o.Device = &v
}
// GetDevices returns the Devices field value if set, zero value otherwise.
func (o *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) SetDevices(v int64) {
o.Devices = &v
}
// GetHeld returns the Held field value if set, zero value otherwise.
func (o *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) SetHeld(v int64) {
o.Held = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) SetId(v string) {
o.Id = &v
}
// GetJob returns the Job field value if set, zero value otherwise.
func (o *TrainClaimed) GetJob() string {
if o == nil || IsNil(o.Job) {
var ret string
return ret
}
return *o.Job
}
// GetJobOk returns a tuple with the Job field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainClaimed) GetJobOk() (*string, bool) {
if o == nil || IsNil(o.Job) {
return nil, false
}
return o.Job, true
}
// HasJob returns a boolean if a field has been set.
func (o *TrainClaimed) HasJob() bool {
if o != nil && !IsNil(o.Job) {
return true
}
return false
}
// SetJob gets a reference to the given string and assigns it to the Job field.
func (o *TrainClaimed) SetJob(v string) {
o.Job = &v
}
// GetLease returns the Lease field value if set, zero value otherwise.
func (o *TrainClaimed) GetLease() string {
if o == nil || IsNil(o.Lease) {
var ret string
return ret
}
return *o.Lease
}
// GetLeaseOk returns a tuple with the Lease field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainClaimed) GetLeaseOk() (*string, bool) {
if o == nil || IsNil(o.Lease) {
return nil, false
}
return o.Lease, true
}
// HasLease returns a boolean if a field has been set.
func (o *TrainClaimed) HasLease() bool {
if o != nil && !IsNil(o.Lease) {
return true
}
return false
}
// SetLease gets a reference to the given string and assigns it to the Lease field.
func (o *TrainClaimed) SetLease(v string) {
o.Lease = &v
}
// GetReport returns the Report field value if set, zero value otherwise.
func (o *TrainClaimed) GetReport() int64 {
if o == nil || IsNil(o.Report) {
var ret int64
return ret
}
return *o.Report
}
// GetReportOk returns a tuple with the Report field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainClaimed) GetReportOk() (*int64, bool) {
if o == nil || IsNil(o.Report) {
return nil, false
}
return o.Report, true
}
// HasReport returns a boolean if a field has been set.
func (o *TrainClaimed) HasReport() bool {
if o != nil && !IsNil(o.Report) {
return true
}
return false
}
// SetReport gets a reference to the given int64 and assigns it to the Report field.
func (o *TrainClaimed) SetReport(v int64) {
o.Report = &v
}
// GetRole returns the Role field value if set, zero value otherwise.
func (o *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) 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 *TrainClaimed) SetRole(v string) {
o.Role = &v
}
func (o TrainClaimed) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainClaimed) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Coordinator) {
toSerialize["coordinator"] = o.Coordinator
}
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.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Job) {
toSerialize["job"] = o.Job
}
if !IsNil(o.Lease) {
toSerialize["lease"] = o.Lease
}
if !IsNil(o.Report) {
toSerialize["report"] = o.Report
}
if !IsNil(o.Role) {
toSerialize["role"] = o.Role
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainClaimed) UnmarshalJSON(data []byte) (err error) {
varTrainClaimed := _TrainClaimed{}
err = json.Unmarshal(data, &varTrainClaimed)
if err != nil {
return err
}
*o = TrainClaimed(varTrainClaimed)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "coordinator")
delete(additionalProperties, "device")
delete(additionalProperties, "devices")
delete(additionalProperties, "held")
delete(additionalProperties, "id")
delete(additionalProperties, "job")
delete(additionalProperties, "lease")
delete(additionalProperties, "report")
delete(additionalProperties, "role")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainClaimed struct {
value *TrainClaimed
isSet bool
}
func (v NullableTrainClaimed) Get() *TrainClaimed {
return v.value
}
func (v *NullableTrainClaimed) Set(val *TrainClaimed) {
v.value = val
v.isSet = true
}
func (v NullableTrainClaimed) IsSet() bool {
return v.isSet
}
func (v *NullableTrainClaimed) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainClaimed(val *TrainClaimed) *NullableTrainClaimed {
return &NullableTrainClaimed{value: val, isSet: true}
}
func (v NullableTrainClaimed) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainClaimed) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}