mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
459 lines
12 KiB
Go
459 lines
12 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 PlatformRunReq type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &PlatformRunReq{}
|
|
|
|
// PlatformRunReq struct for PlatformRunReq
|
|
type PlatformRunReq struct {
|
|
// Env is the run's environment. Keys must match `^[A-Za-z_][A-Za-z0-9_]*$`; a variable marked `secret: true` is sealed into KMS.
|
|
Env []PlatformEnvVarJSON `json:"env,omitempty"`
|
|
// GPU is how many GPUs the run asks for; a negative value is 400.
|
|
Gpu *int64 `json:"gpu,omitempty"`
|
|
// Image is the container image to run. Required.
|
|
Image *string `json:"image,omitempty"`
|
|
// MaxScale above the floor declares an autoscaling ceiling; 0 means no autoscaler at all — a fixed run at the floor.
|
|
MaxScale *int64 `json:"maxScale,omitempty"`
|
|
// MinScale is the replica floor, clamped to the deployment's limit.
|
|
MinScale *int64 `json:"minScale,omitempty"`
|
|
// Name is the run's name, and the slug is derived from it. Required, and it must resolve to `^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$`. Re-running the same name updates that run in place.
|
|
Name *string `json:"name,omitempty"`
|
|
// Port is the container port the run listens on.
|
|
Port *int64 `json:"port,omitempty"`
|
|
// Runtime is accepted for the client contract and echoed nowhere: the image IS the runtime unit.
|
|
Runtime *string `json:"runtime,omitempty"`
|
|
// Shape is a compute size label, echoed back; sizing is the operator's default. Defaults to \"auto\".
|
|
Shape *string `json:"shape,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _PlatformRunReq PlatformRunReq
|
|
|
|
// NewPlatformRunReq instantiates a new PlatformRunReq 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 NewPlatformRunReq() *PlatformRunReq {
|
|
this := PlatformRunReq{}
|
|
return &this
|
|
}
|
|
|
|
// NewPlatformRunReqWithDefaults instantiates a new PlatformRunReq 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 NewPlatformRunReqWithDefaults() *PlatformRunReq {
|
|
this := PlatformRunReq{}
|
|
return &this
|
|
}
|
|
|
|
// GetEnv returns the Env field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetEnv() []PlatformEnvVarJSON {
|
|
if o == nil || IsNil(o.Env) {
|
|
var ret []PlatformEnvVarJSON
|
|
return ret
|
|
}
|
|
return o.Env
|
|
}
|
|
|
|
// GetEnvOk returns a tuple with the Env field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetEnvOk() ([]PlatformEnvVarJSON, bool) {
|
|
if o == nil || IsNil(o.Env) {
|
|
return nil, false
|
|
}
|
|
return o.Env, true
|
|
}
|
|
|
|
// HasEnv returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasEnv() bool {
|
|
if o != nil && !IsNil(o.Env) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetEnv gets a reference to the given []PlatformEnvVarJSON and assigns it to the Env field.
|
|
func (o *PlatformRunReq) SetEnv(v []PlatformEnvVarJSON) {
|
|
o.Env = v
|
|
}
|
|
|
|
// GetGpu returns the Gpu field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetGpu() int64 {
|
|
if o == nil || IsNil(o.Gpu) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Gpu
|
|
}
|
|
|
|
// GetGpuOk returns a tuple with the Gpu field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetGpuOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Gpu) {
|
|
return nil, false
|
|
}
|
|
return o.Gpu, true
|
|
}
|
|
|
|
// HasGpu returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasGpu() bool {
|
|
if o != nil && !IsNil(o.Gpu) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetGpu gets a reference to the given int64 and assigns it to the Gpu field.
|
|
func (o *PlatformRunReq) SetGpu(v int64) {
|
|
o.Gpu = &v
|
|
}
|
|
|
|
// GetImage returns the Image field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetImage() string {
|
|
if o == nil || IsNil(o.Image) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Image
|
|
}
|
|
|
|
// GetImageOk returns a tuple with the Image field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetImageOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Image) {
|
|
return nil, false
|
|
}
|
|
return o.Image, true
|
|
}
|
|
|
|
// HasImage returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasImage() bool {
|
|
if o != nil && !IsNil(o.Image) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetImage gets a reference to the given string and assigns it to the Image field.
|
|
func (o *PlatformRunReq) SetImage(v string) {
|
|
o.Image = &v
|
|
}
|
|
|
|
// GetMaxScale returns the MaxScale field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetMaxScale() int64 {
|
|
if o == nil || IsNil(o.MaxScale) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.MaxScale
|
|
}
|
|
|
|
// GetMaxScaleOk returns a tuple with the MaxScale field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetMaxScaleOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.MaxScale) {
|
|
return nil, false
|
|
}
|
|
return o.MaxScale, true
|
|
}
|
|
|
|
// HasMaxScale returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasMaxScale() bool {
|
|
if o != nil && !IsNil(o.MaxScale) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMaxScale gets a reference to the given int64 and assigns it to the MaxScale field.
|
|
func (o *PlatformRunReq) SetMaxScale(v int64) {
|
|
o.MaxScale = &v
|
|
}
|
|
|
|
// GetMinScale returns the MinScale field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetMinScale() int64 {
|
|
if o == nil || IsNil(o.MinScale) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.MinScale
|
|
}
|
|
|
|
// GetMinScaleOk returns a tuple with the MinScale field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetMinScaleOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.MinScale) {
|
|
return nil, false
|
|
}
|
|
return o.MinScale, true
|
|
}
|
|
|
|
// HasMinScale returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasMinScale() bool {
|
|
if o != nil && !IsNil(o.MinScale) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMinScale gets a reference to the given int64 and assigns it to the MinScale field.
|
|
func (o *PlatformRunReq) SetMinScale(v int64) {
|
|
o.MinScale = &v
|
|
}
|
|
|
|
// GetName returns the Name field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetName() string {
|
|
if o == nil || IsNil(o.Name) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Name
|
|
}
|
|
|
|
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetNameOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Name) {
|
|
return nil, false
|
|
}
|
|
return o.Name, true
|
|
}
|
|
|
|
// HasName returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasName() bool {
|
|
if o != nil && !IsNil(o.Name) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetName gets a reference to the given string and assigns it to the Name field.
|
|
func (o *PlatformRunReq) SetName(v string) {
|
|
o.Name = &v
|
|
}
|
|
|
|
// GetPort returns the Port field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetPort() int64 {
|
|
if o == nil || IsNil(o.Port) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Port
|
|
}
|
|
|
|
// GetPortOk returns a tuple with the Port field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetPortOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Port) {
|
|
return nil, false
|
|
}
|
|
return o.Port, true
|
|
}
|
|
|
|
// HasPort returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasPort() bool {
|
|
if o != nil && !IsNil(o.Port) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPort gets a reference to the given int64 and assigns it to the Port field.
|
|
func (o *PlatformRunReq) SetPort(v int64) {
|
|
o.Port = &v
|
|
}
|
|
|
|
// GetRuntime returns the Runtime field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetRuntime() string {
|
|
if o == nil || IsNil(o.Runtime) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Runtime
|
|
}
|
|
|
|
// GetRuntimeOk returns a tuple with the Runtime field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetRuntimeOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Runtime) {
|
|
return nil, false
|
|
}
|
|
return o.Runtime, true
|
|
}
|
|
|
|
// HasRuntime returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasRuntime() bool {
|
|
if o != nil && !IsNil(o.Runtime) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetRuntime gets a reference to the given string and assigns it to the Runtime field.
|
|
func (o *PlatformRunReq) SetRuntime(v string) {
|
|
o.Runtime = &v
|
|
}
|
|
|
|
// GetShape returns the Shape field value if set, zero value otherwise.
|
|
func (o *PlatformRunReq) GetShape() string {
|
|
if o == nil || IsNil(o.Shape) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Shape
|
|
}
|
|
|
|
// GetShapeOk returns a tuple with the Shape field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PlatformRunReq) GetShapeOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Shape) {
|
|
return nil, false
|
|
}
|
|
return o.Shape, true
|
|
}
|
|
|
|
// HasShape returns a boolean if a field has been set.
|
|
func (o *PlatformRunReq) HasShape() bool {
|
|
if o != nil && !IsNil(o.Shape) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetShape gets a reference to the given string and assigns it to the Shape field.
|
|
func (o *PlatformRunReq) SetShape(v string) {
|
|
o.Shape = &v
|
|
}
|
|
|
|
func (o PlatformRunReq) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o PlatformRunReq) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Env) {
|
|
toSerialize["env"] = o.Env
|
|
}
|
|
if !IsNil(o.Gpu) {
|
|
toSerialize["gpu"] = o.Gpu
|
|
}
|
|
if !IsNil(o.Image) {
|
|
toSerialize["image"] = o.Image
|
|
}
|
|
if !IsNil(o.MaxScale) {
|
|
toSerialize["maxScale"] = o.MaxScale
|
|
}
|
|
if !IsNil(o.MinScale) {
|
|
toSerialize["minScale"] = o.MinScale
|
|
}
|
|
if !IsNil(o.Name) {
|
|
toSerialize["name"] = o.Name
|
|
}
|
|
if !IsNil(o.Port) {
|
|
toSerialize["port"] = o.Port
|
|
}
|
|
if !IsNil(o.Runtime) {
|
|
toSerialize["runtime"] = o.Runtime
|
|
}
|
|
if !IsNil(o.Shape) {
|
|
toSerialize["shape"] = o.Shape
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *PlatformRunReq) UnmarshalJSON(data []byte) (err error) {
|
|
varPlatformRunReq := _PlatformRunReq{}
|
|
|
|
err = json.Unmarshal(data, &varPlatformRunReq)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = PlatformRunReq(varPlatformRunReq)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "env")
|
|
delete(additionalProperties, "gpu")
|
|
delete(additionalProperties, "image")
|
|
delete(additionalProperties, "maxScale")
|
|
delete(additionalProperties, "minScale")
|
|
delete(additionalProperties, "name")
|
|
delete(additionalProperties, "port")
|
|
delete(additionalProperties, "runtime")
|
|
delete(additionalProperties, "shape")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullablePlatformRunReq struct {
|
|
value *PlatformRunReq
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullablePlatformRunReq) Get() *PlatformRunReq {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullablePlatformRunReq) Set(val *PlatformRunReq) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullablePlatformRunReq) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullablePlatformRunReq) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullablePlatformRunReq(val *PlatformRunReq) *NullablePlatformRunReq {
|
|
return &NullablePlatformRunReq{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullablePlatformRunReq) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullablePlatformRunReq) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|