Files
sdk/model_train_assignment.go

231 lines
5.7 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 TrainAssignment type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainAssignment{}
// TrainAssignment struct for TrainAssignment
type TrainAssignment struct {
// Job is the job it belongs to.
Job *TrainJob `json:"job,omitempty"`
// Org is the job's org. A platform executor reports for the task acting in it.
Org *string `json:"org,omitempty"`
// Task is the unit this executor now holds.
Task *TrainClaimed `json:"task,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainAssignment TrainAssignment
// NewTrainAssignment instantiates a new TrainAssignment 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 NewTrainAssignment() *TrainAssignment {
this := TrainAssignment{}
return &this
}
// NewTrainAssignmentWithDefaults instantiates a new TrainAssignment 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 NewTrainAssignmentWithDefaults() *TrainAssignment {
this := TrainAssignment{}
return &this
}
// GetJob returns the Job field value if set, zero value otherwise.
func (o *TrainAssignment) GetJob() TrainJob {
if o == nil || IsNil(o.Job) {
var ret TrainJob
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 *TrainAssignment) GetJobOk() (*TrainJob, 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 *TrainAssignment) HasJob() bool {
if o != nil && !IsNil(o.Job) {
return true
}
return false
}
// SetJob gets a reference to the given TrainJob and assigns it to the Job field.
func (o *TrainAssignment) SetJob(v TrainJob) {
o.Job = &v
}
// GetOrg returns the Org field value if set, zero value otherwise.
func (o *TrainAssignment) GetOrg() string {
if o == nil || IsNil(o.Org) {
var ret string
return ret
}
return *o.Org
}
// GetOrgOk returns a tuple with the Org field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAssignment) GetOrgOk() (*string, bool) {
if o == nil || IsNil(o.Org) {
return nil, false
}
return o.Org, true
}
// HasOrg returns a boolean if a field has been set.
func (o *TrainAssignment) HasOrg() bool {
if o != nil && !IsNil(o.Org) {
return true
}
return false
}
// SetOrg gets a reference to the given string and assigns it to the Org field.
func (o *TrainAssignment) SetOrg(v string) {
o.Org = &v
}
// GetTask returns the Task field value if set, zero value otherwise.
func (o *TrainAssignment) GetTask() TrainClaimed {
if o == nil || IsNil(o.Task) {
var ret TrainClaimed
return ret
}
return *o.Task
}
// GetTaskOk returns a tuple with the Task field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainAssignment) GetTaskOk() (*TrainClaimed, bool) {
if o == nil || IsNil(o.Task) {
return nil, false
}
return o.Task, true
}
// HasTask returns a boolean if a field has been set.
func (o *TrainAssignment) HasTask() bool {
if o != nil && !IsNil(o.Task) {
return true
}
return false
}
// SetTask gets a reference to the given TrainClaimed and assigns it to the Task field.
func (o *TrainAssignment) SetTask(v TrainClaimed) {
o.Task = &v
}
func (o TrainAssignment) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainAssignment) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Job) {
toSerialize["job"] = o.Job
}
if !IsNil(o.Org) {
toSerialize["org"] = o.Org
}
if !IsNil(o.Task) {
toSerialize["task"] = o.Task
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainAssignment) UnmarshalJSON(data []byte) (err error) {
varTrainAssignment := _TrainAssignment{}
err = json.Unmarshal(data, &varTrainAssignment)
if err != nil {
return err
}
*o = TrainAssignment(varTrainAssignment)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "job")
delete(additionalProperties, "org")
delete(additionalProperties, "task")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainAssignment struct {
value *TrainAssignment
isSet bool
}
func (v NullableTrainAssignment) Get() *TrainAssignment {
return v.value
}
func (v *NullableTrainAssignment) Set(val *TrainAssignment) {
v.value = val
v.isSet = true
}
func (v NullableTrainAssignment) IsSet() bool {
return v.isSet
}
func (v *NullableTrainAssignment) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainAssignment(val *TrainAssignment) *NullableTrainAssignment {
return &NullableTrainAssignment{value: val, isSet: true}
}
func (v NullableTrainAssignment) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainAssignment) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}