Files
sdk/model_train_run.go

231 lines
5.8 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 TrainRun type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainRun{}
// TrainRun struct for TrainRun
type TrainRun struct {
// Devices are the accelerator kinds it runs on there; none is the executor's own.
Devices []string `json:"devices,omitempty"`
// Price is what one device-second costs there, in nano-USD: 0 on the org's machines.
PriceNanoUsd *int64 `json:"price_nano_usd,omitempty"`
// Where is hanzo, Hanzo's devices, charged by the device-second to the payer inside the job's budget; or machines, the org's linked machines, charged nothing.
Where *string `json:"where,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainRun TrainRun
// NewTrainRun instantiates a new TrainRun 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 NewTrainRun() *TrainRun {
this := TrainRun{}
return &this
}
// NewTrainRunWithDefaults instantiates a new TrainRun 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 NewTrainRunWithDefaults() *TrainRun {
this := TrainRun{}
return &this
}
// GetDevices returns the Devices field value if set, zero value otherwise.
func (o *TrainRun) GetDevices() []string {
if o == nil || IsNil(o.Devices) {
var ret []string
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 *TrainRun) GetDevicesOk() ([]string, 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 *TrainRun) HasDevices() bool {
if o != nil && !IsNil(o.Devices) {
return true
}
return false
}
// SetDevices gets a reference to the given []string and assigns it to the Devices field.
func (o *TrainRun) SetDevices(v []string) {
o.Devices = v
}
// GetPriceNanoUsd returns the PriceNanoUsd field value if set, zero value otherwise.
func (o *TrainRun) GetPriceNanoUsd() int64 {
if o == nil || IsNil(o.PriceNanoUsd) {
var ret int64
return ret
}
return *o.PriceNanoUsd
}
// GetPriceNanoUsdOk returns a tuple with the PriceNanoUsd field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainRun) GetPriceNanoUsdOk() (*int64, bool) {
if o == nil || IsNil(o.PriceNanoUsd) {
return nil, false
}
return o.PriceNanoUsd, true
}
// HasPriceNanoUsd returns a boolean if a field has been set.
func (o *TrainRun) HasPriceNanoUsd() bool {
if o != nil && !IsNil(o.PriceNanoUsd) {
return true
}
return false
}
// SetPriceNanoUsd gets a reference to the given int64 and assigns it to the PriceNanoUsd field.
func (o *TrainRun) SetPriceNanoUsd(v int64) {
o.PriceNanoUsd = &v
}
// GetWhere returns the Where field value if set, zero value otherwise.
func (o *TrainRun) GetWhere() string {
if o == nil || IsNil(o.Where) {
var ret string
return ret
}
return *o.Where
}
// GetWhereOk returns a tuple with the Where field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainRun) GetWhereOk() (*string, bool) {
if o == nil || IsNil(o.Where) {
return nil, false
}
return o.Where, true
}
// HasWhere returns a boolean if a field has been set.
func (o *TrainRun) HasWhere() bool {
if o != nil && !IsNil(o.Where) {
return true
}
return false
}
// SetWhere gets a reference to the given string and assigns it to the Where field.
func (o *TrainRun) SetWhere(v string) {
o.Where = &v
}
func (o TrainRun) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainRun) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Devices) {
toSerialize["devices"] = o.Devices
}
if !IsNil(o.PriceNanoUsd) {
toSerialize["price_nano_usd"] = o.PriceNanoUsd
}
if !IsNil(o.Where) {
toSerialize["where"] = o.Where
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainRun) UnmarshalJSON(data []byte) (err error) {
varTrainRun := _TrainRun{}
err = json.Unmarshal(data, &varTrainRun)
if err != nil {
return err
}
*o = TrainRun(varTrainRun)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "devices")
delete(additionalProperties, "price_nano_usd")
delete(additionalProperties, "where")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainRun struct {
value *TrainRun
isSet bool
}
func (v NullableTrainRun) Get() *TrainRun {
return v.value
}
func (v *NullableTrainRun) Set(val *TrainRun) {
v.value = val
v.isSet = true
}
func (v NullableTrainRun) IsSet() bool {
return v.isSet
}
func (v *NullableTrainRun) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainRun(val *TrainRun) *NullableTrainRun {
return &NullableTrainRun{value: val, isSet: true}
}
func (v NullableTrainRun) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainRun) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}