Files
sdk/model_train_protect.go

307 lines
8.3 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 TrainProtect type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainProtect{}
// TrainProtect struct for TrainProtect
type TrainProtect struct {
// Budget bounds the regression per protected suite.
Budget *TrainBudget `json:"budget,omitempty"`
// Capabilities are capability artifacts, by sha256.
Capabilities []string `json:"capabilities,omitempty"`
// Distillation adds KL to the base's answers on a preservation set drawn from the suites.
Distillation *bool `json:"distillation,omitempty"`
// Projection projects every update off the protected directions — the suites' gradient subspace at the base and each named capability's subspace — by its strength; absent is no projection.
Projection *TrainProjection `json:"projection,omitempty"`
// Suites are capabilities the base already has, by suite.
Suites []string `json:"suites,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainProtect TrainProtect
// NewTrainProtect instantiates a new TrainProtect 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 NewTrainProtect() *TrainProtect {
this := TrainProtect{}
return &this
}
// NewTrainProtectWithDefaults instantiates a new TrainProtect 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 NewTrainProtectWithDefaults() *TrainProtect {
this := TrainProtect{}
return &this
}
// GetBudget returns the Budget field value if set, zero value otherwise.
func (o *TrainProtect) GetBudget() TrainBudget {
if o == nil || IsNil(o.Budget) {
var ret TrainBudget
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 *TrainProtect) GetBudgetOk() (*TrainBudget, 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 *TrainProtect) HasBudget() bool {
if o != nil && !IsNil(o.Budget) {
return true
}
return false
}
// SetBudget gets a reference to the given TrainBudget and assigns it to the Budget field.
func (o *TrainProtect) SetBudget(v TrainBudget) {
o.Budget = &v
}
// GetCapabilities returns the Capabilities field value if set, zero value otherwise.
func (o *TrainProtect) GetCapabilities() []string {
if o == nil || IsNil(o.Capabilities) {
var ret []string
return ret
}
return o.Capabilities
}
// GetCapabilitiesOk returns a tuple with the Capabilities field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainProtect) GetCapabilitiesOk() ([]string, bool) {
if o == nil || IsNil(o.Capabilities) {
return nil, false
}
return o.Capabilities, true
}
// HasCapabilities returns a boolean if a field has been set.
func (o *TrainProtect) HasCapabilities() bool {
if o != nil && !IsNil(o.Capabilities) {
return true
}
return false
}
// SetCapabilities gets a reference to the given []string and assigns it to the Capabilities field.
func (o *TrainProtect) SetCapabilities(v []string) {
o.Capabilities = v
}
// GetDistillation returns the Distillation field value if set, zero value otherwise.
func (o *TrainProtect) GetDistillation() bool {
if o == nil || IsNil(o.Distillation) {
var ret bool
return ret
}
return *o.Distillation
}
// GetDistillationOk returns a tuple with the Distillation field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainProtect) GetDistillationOk() (*bool, bool) {
if o == nil || IsNil(o.Distillation) {
return nil, false
}
return o.Distillation, true
}
// HasDistillation returns a boolean if a field has been set.
func (o *TrainProtect) HasDistillation() bool {
if o != nil && !IsNil(o.Distillation) {
return true
}
return false
}
// SetDistillation gets a reference to the given bool and assigns it to the Distillation field.
func (o *TrainProtect) SetDistillation(v bool) {
o.Distillation = &v
}
// GetProjection returns the Projection field value if set, zero value otherwise.
func (o *TrainProtect) GetProjection() TrainProjection {
if o == nil || IsNil(o.Projection) {
var ret TrainProjection
return ret
}
return *o.Projection
}
// GetProjectionOk returns a tuple with the Projection field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainProtect) GetProjectionOk() (*TrainProjection, bool) {
if o == nil || IsNil(o.Projection) {
return nil, false
}
return o.Projection, true
}
// HasProjection returns a boolean if a field has been set.
func (o *TrainProtect) HasProjection() bool {
if o != nil && !IsNil(o.Projection) {
return true
}
return false
}
// SetProjection gets a reference to the given TrainProjection and assigns it to the Projection field.
func (o *TrainProtect) SetProjection(v TrainProjection) {
o.Projection = &v
}
// GetSuites returns the Suites field value if set, zero value otherwise.
func (o *TrainProtect) GetSuites() []string {
if o == nil || IsNil(o.Suites) {
var ret []string
return ret
}
return o.Suites
}
// GetSuitesOk returns a tuple with the Suites field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainProtect) GetSuitesOk() ([]string, bool) {
if o == nil || IsNil(o.Suites) {
return nil, false
}
return o.Suites, true
}
// HasSuites returns a boolean if a field has been set.
func (o *TrainProtect) HasSuites() bool {
if o != nil && !IsNil(o.Suites) {
return true
}
return false
}
// SetSuites gets a reference to the given []string and assigns it to the Suites field.
func (o *TrainProtect) SetSuites(v []string) {
o.Suites = v
}
func (o TrainProtect) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainProtect) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Budget) {
toSerialize["budget"] = o.Budget
}
if !IsNil(o.Capabilities) {
toSerialize["capabilities"] = o.Capabilities
}
if !IsNil(o.Distillation) {
toSerialize["distillation"] = o.Distillation
}
if !IsNil(o.Projection) {
toSerialize["projection"] = o.Projection
}
if !IsNil(o.Suites) {
toSerialize["suites"] = o.Suites
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainProtect) UnmarshalJSON(data []byte) (err error) {
varTrainProtect := _TrainProtect{}
err = json.Unmarshal(data, &varTrainProtect)
if err != nil {
return err
}
*o = TrainProtect(varTrainProtect)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "budget")
delete(additionalProperties, "capabilities")
delete(additionalProperties, "distillation")
delete(additionalProperties, "projection")
delete(additionalProperties, "suites")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainProtect struct {
value *TrainProtect
isSet bool
}
func (v NullableTrainProtect) Get() *TrainProtect {
return v.value
}
func (v *NullableTrainProtect) Set(val *TrainProtect) {
v.value = val
v.isSet = true
}
func (v NullableTrainProtect) IsSet() bool {
return v.isSet
}
func (v *NullableTrainProtect) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainProtect(val *TrainProtect) *NullableTrainProtect {
return &NullableTrainProtect{value: val, isSet: true}
}
func (v NullableTrainProtect) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainProtect) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}