mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
307 lines
8.2 KiB
Go
307 lines
8.2 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 TrainResources type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &TrainResources{}
|
|
|
|
// TrainResources struct for TrainResources
|
|
type TrainResources struct {
|
|
// Budget bounds what the job's compute costs, in US cents; 0 is none beyond the payer's balance. Only a job Hanzo runs costs anything, so only it takes one.
|
|
Budget *int64 `json:"budget,omitempty"`
|
|
// Devices are the accelerator kinds the job may run on — cuda, rocm, metal, vulkan, cpu; none named is any its base runs.
|
|
Devices []string `json:"devices,omitempty"`
|
|
// Machines are the org's linked machines by name; the first leads. When it names none, Hanzo's executor runs the job and its compute is charged by the device-second.
|
|
Machines []string `json:"machines,omitempty"`
|
|
// MaxSeconds bounds the device-seconds the job's tasks use together; 0 is none.
|
|
MaxSeconds *int64 `json:"max_seconds,omitempty"`
|
|
// Steps bounds optimizer steps; 0 runs the plan.
|
|
Steps *int64 `json:"steps,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _TrainResources TrainResources
|
|
|
|
// NewTrainResources instantiates a new TrainResources 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 NewTrainResources() *TrainResources {
|
|
this := TrainResources{}
|
|
return &this
|
|
}
|
|
|
|
// NewTrainResourcesWithDefaults instantiates a new TrainResources 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 NewTrainResourcesWithDefaults() *TrainResources {
|
|
this := TrainResources{}
|
|
return &this
|
|
}
|
|
|
|
// GetBudget returns the Budget field value if set, zero value otherwise.
|
|
func (o *TrainResources) GetBudget() int64 {
|
|
if o == nil || IsNil(o.Budget) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Budget
|
|
}
|
|
|
|
// GetBudgetOk returns a tuple with the Budget field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainResources) GetBudgetOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Budget) {
|
|
return nil, false
|
|
}
|
|
return o.Budget, true
|
|
}
|
|
|
|
// HasBudget returns a boolean if a field has been set.
|
|
func (o *TrainResources) HasBudget() bool {
|
|
if o != nil && !IsNil(o.Budget) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBudget gets a reference to the given int64 and assigns it to the Budget field.
|
|
func (o *TrainResources) SetBudget(v int64) {
|
|
o.Budget = &v
|
|
}
|
|
|
|
// GetDevices returns the Devices field value if set, zero value otherwise.
|
|
func (o *TrainResources) 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 *TrainResources) 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 *TrainResources) 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 *TrainResources) SetDevices(v []string) {
|
|
o.Devices = v
|
|
}
|
|
|
|
// GetMachines returns the Machines field value if set, zero value otherwise.
|
|
func (o *TrainResources) GetMachines() []string {
|
|
if o == nil || IsNil(o.Machines) {
|
|
var ret []string
|
|
return ret
|
|
}
|
|
return o.Machines
|
|
}
|
|
|
|
// GetMachinesOk returns a tuple with the Machines field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainResources) GetMachinesOk() ([]string, bool) {
|
|
if o == nil || IsNil(o.Machines) {
|
|
return nil, false
|
|
}
|
|
return o.Machines, true
|
|
}
|
|
|
|
// HasMachines returns a boolean if a field has been set.
|
|
func (o *TrainResources) HasMachines() bool {
|
|
if o != nil && !IsNil(o.Machines) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMachines gets a reference to the given []string and assigns it to the Machines field.
|
|
func (o *TrainResources) SetMachines(v []string) {
|
|
o.Machines = v
|
|
}
|
|
|
|
// GetMaxSeconds returns the MaxSeconds field value if set, zero value otherwise.
|
|
func (o *TrainResources) GetMaxSeconds() int64 {
|
|
if o == nil || IsNil(o.MaxSeconds) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.MaxSeconds
|
|
}
|
|
|
|
// GetMaxSecondsOk returns a tuple with the MaxSeconds field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainResources) GetMaxSecondsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.MaxSeconds) {
|
|
return nil, false
|
|
}
|
|
return o.MaxSeconds, true
|
|
}
|
|
|
|
// HasMaxSeconds returns a boolean if a field has been set.
|
|
func (o *TrainResources) HasMaxSeconds() bool {
|
|
if o != nil && !IsNil(o.MaxSeconds) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMaxSeconds gets a reference to the given int64 and assigns it to the MaxSeconds field.
|
|
func (o *TrainResources) SetMaxSeconds(v int64) {
|
|
o.MaxSeconds = &v
|
|
}
|
|
|
|
// GetSteps returns the Steps field value if set, zero value otherwise.
|
|
func (o *TrainResources) GetSteps() int64 {
|
|
if o == nil || IsNil(o.Steps) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Steps
|
|
}
|
|
|
|
// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *TrainResources) GetStepsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Steps) {
|
|
return nil, false
|
|
}
|
|
return o.Steps, true
|
|
}
|
|
|
|
// HasSteps returns a boolean if a field has been set.
|
|
func (o *TrainResources) HasSteps() bool {
|
|
if o != nil && !IsNil(o.Steps) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSteps gets a reference to the given int64 and assigns it to the Steps field.
|
|
func (o *TrainResources) SetSteps(v int64) {
|
|
o.Steps = &v
|
|
}
|
|
|
|
func (o TrainResources) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o TrainResources) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Budget) {
|
|
toSerialize["budget"] = o.Budget
|
|
}
|
|
if !IsNil(o.Devices) {
|
|
toSerialize["devices"] = o.Devices
|
|
}
|
|
if !IsNil(o.Machines) {
|
|
toSerialize["machines"] = o.Machines
|
|
}
|
|
if !IsNil(o.MaxSeconds) {
|
|
toSerialize["max_seconds"] = o.MaxSeconds
|
|
}
|
|
if !IsNil(o.Steps) {
|
|
toSerialize["steps"] = o.Steps
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *TrainResources) UnmarshalJSON(data []byte) (err error) {
|
|
varTrainResources := _TrainResources{}
|
|
|
|
err = json.Unmarshal(data, &varTrainResources)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = TrainResources(varTrainResources)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "budget")
|
|
delete(additionalProperties, "devices")
|
|
delete(additionalProperties, "machines")
|
|
delete(additionalProperties, "max_seconds")
|
|
delete(additionalProperties, "steps")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableTrainResources struct {
|
|
value *TrainResources
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableTrainResources) Get() *TrainResources {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableTrainResources) Set(val *TrainResources) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableTrainResources) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableTrainResources) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableTrainResources(val *TrainResources) *NullableTrainResources {
|
|
return &NullableTrainResources{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableTrainResources) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableTrainResources) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|