mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
421 lines
12 KiB
Go
421 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 SandboxLeased type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &SandboxLeased{}
|
|
|
|
// SandboxLeased struct for SandboxLeased
|
|
type SandboxLeased struct {
|
|
// Carried says the lease is extended for as long as it works and its wallet pays for the next hour. A lease that is not carried ends at ExpiresAt whatever it is doing: a free one.
|
|
Carried *bool `json:"carried,omitempty"`
|
|
// Class is what was actually leased, from the closed set LeaseIn.Class names: exec | dev | desktop | browser | android. A request that named none leased an `exec`, so this is where a caller learns which kind of computer it is holding, and it is what Workdir below follows from.
|
|
Class *string `json:"class,omitempty"`
|
|
// Cluster is the attached cluster this sandbox runs on, when one was named. Empty is the home cluster.
|
|
Cluster *string `json:"cluster,omitempty"`
|
|
// ExpiresAt is when the lease ends, Unix seconds. A resumed sandbox keeps the expiry it had, so this is not always a fresh lease's.
|
|
ExpiresAt *int64 `json:"expiresAt,omitempty"`
|
|
// ID names this computer for every later call — run, read, write, stop and end all take it, and a LeaseIn carrying it resumes THIS sandbox instead of leasing a second one. Minted here; a caller cannot choose it, and a resumed lease that had expired comes back under a new one.
|
|
Id *string `json:"id,omitempty"`
|
|
// Runtime is the boundary this sandbox GOT, which need not be the one asked for — carried for the same reason Workdir is, that it is a fact only the owner knows and a caller assuming it would be holding a second copy. Empty is the node's default runtime, and a real answer.
|
|
Runtime *string `json:"runtime,omitempty"`
|
|
// Status is where the pod stands, from the store's three: pending | running | error. A lease that ANSWERS has already waited for the pod, so this reads `running` — a start that failed is a 503 and no sandbox at all. Read it anyway: exec refuses a sandbox that is not running, so anything else here is the reason the next call will not work.
|
|
Status *string `json:"status,omitempty"`
|
|
// Workdir is the absolute directory this sandbox keeps files in, and what a relative path in a later read, write or run resolves against — /work for dev, desktop and android (the project volume's mount point), /mnt/data for exec (the artifact directory the code tool tells the model to write to). A path that climbs above it is refused rather than rewritten.
|
|
Workdir *string `json:"workdir,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _SandboxLeased SandboxLeased
|
|
|
|
// NewSandboxLeased instantiates a new SandboxLeased 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 NewSandboxLeased() *SandboxLeased {
|
|
this := SandboxLeased{}
|
|
return &this
|
|
}
|
|
|
|
// NewSandboxLeasedWithDefaults instantiates a new SandboxLeased 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 NewSandboxLeasedWithDefaults() *SandboxLeased {
|
|
this := SandboxLeased{}
|
|
return &this
|
|
}
|
|
|
|
// GetCarried returns the Carried field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetCarried() bool {
|
|
if o == nil || IsNil(o.Carried) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Carried
|
|
}
|
|
|
|
// GetCarriedOk returns a tuple with the Carried field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetCarriedOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Carried) {
|
|
return nil, false
|
|
}
|
|
return o.Carried, true
|
|
}
|
|
|
|
// HasCarried returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasCarried() bool {
|
|
if o != nil && !IsNil(o.Carried) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCarried gets a reference to the given bool and assigns it to the Carried field.
|
|
func (o *SandboxLeased) SetCarried(v bool) {
|
|
o.Carried = &v
|
|
}
|
|
|
|
// GetClass returns the Class field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetClass() string {
|
|
if o == nil || IsNil(o.Class) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Class
|
|
}
|
|
|
|
// GetClassOk returns a tuple with the Class field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetClassOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Class) {
|
|
return nil, false
|
|
}
|
|
return o.Class, true
|
|
}
|
|
|
|
// HasClass returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasClass() bool {
|
|
if o != nil && !IsNil(o.Class) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetClass gets a reference to the given string and assigns it to the Class field.
|
|
func (o *SandboxLeased) SetClass(v string) {
|
|
o.Class = &v
|
|
}
|
|
|
|
// GetCluster returns the Cluster field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetCluster() string {
|
|
if o == nil || IsNil(o.Cluster) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Cluster
|
|
}
|
|
|
|
// GetClusterOk returns a tuple with the Cluster field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetClusterOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Cluster) {
|
|
return nil, false
|
|
}
|
|
return o.Cluster, true
|
|
}
|
|
|
|
// HasCluster returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasCluster() bool {
|
|
if o != nil && !IsNil(o.Cluster) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCluster gets a reference to the given string and assigns it to the Cluster field.
|
|
func (o *SandboxLeased) SetCluster(v string) {
|
|
o.Cluster = &v
|
|
}
|
|
|
|
// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetExpiresAt() int64 {
|
|
if o == nil || IsNil(o.ExpiresAt) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.ExpiresAt
|
|
}
|
|
|
|
// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetExpiresAtOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.ExpiresAt) {
|
|
return nil, false
|
|
}
|
|
return o.ExpiresAt, true
|
|
}
|
|
|
|
// HasExpiresAt returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasExpiresAt() bool {
|
|
if o != nil && !IsNil(o.ExpiresAt) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetExpiresAt gets a reference to the given int64 and assigns it to the ExpiresAt field.
|
|
func (o *SandboxLeased) SetExpiresAt(v int64) {
|
|
o.ExpiresAt = &v
|
|
}
|
|
|
|
// GetId returns the Id field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetId() string {
|
|
if o == nil || IsNil(o.Id) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Id
|
|
}
|
|
|
|
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetIdOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Id) {
|
|
return nil, false
|
|
}
|
|
return o.Id, true
|
|
}
|
|
|
|
// HasId returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasId() bool {
|
|
if o != nil && !IsNil(o.Id) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetId gets a reference to the given string and assigns it to the Id field.
|
|
func (o *SandboxLeased) SetId(v string) {
|
|
o.Id = &v
|
|
}
|
|
|
|
// GetRuntime returns the Runtime field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) 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 *SandboxLeased) 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 *SandboxLeased) 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 *SandboxLeased) SetRuntime(v string) {
|
|
o.Runtime = &v
|
|
}
|
|
|
|
// GetStatus returns the Status field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetStatus() string {
|
|
if o == nil || IsNil(o.Status) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Status
|
|
}
|
|
|
|
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetStatusOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Status) {
|
|
return nil, false
|
|
}
|
|
return o.Status, true
|
|
}
|
|
|
|
// HasStatus returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasStatus() bool {
|
|
if o != nil && !IsNil(o.Status) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetStatus gets a reference to the given string and assigns it to the Status field.
|
|
func (o *SandboxLeased) SetStatus(v string) {
|
|
o.Status = &v
|
|
}
|
|
|
|
// GetWorkdir returns the Workdir field value if set, zero value otherwise.
|
|
func (o *SandboxLeased) GetWorkdir() string {
|
|
if o == nil || IsNil(o.Workdir) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Workdir
|
|
}
|
|
|
|
// GetWorkdirOk returns a tuple with the Workdir field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *SandboxLeased) GetWorkdirOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Workdir) {
|
|
return nil, false
|
|
}
|
|
return o.Workdir, true
|
|
}
|
|
|
|
// HasWorkdir returns a boolean if a field has been set.
|
|
func (o *SandboxLeased) HasWorkdir() bool {
|
|
if o != nil && !IsNil(o.Workdir) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetWorkdir gets a reference to the given string and assigns it to the Workdir field.
|
|
func (o *SandboxLeased) SetWorkdir(v string) {
|
|
o.Workdir = &v
|
|
}
|
|
|
|
func (o SandboxLeased) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o SandboxLeased) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Carried) {
|
|
toSerialize["carried"] = o.Carried
|
|
}
|
|
if !IsNil(o.Class) {
|
|
toSerialize["class"] = o.Class
|
|
}
|
|
if !IsNil(o.Cluster) {
|
|
toSerialize["cluster"] = o.Cluster
|
|
}
|
|
if !IsNil(o.ExpiresAt) {
|
|
toSerialize["expiresAt"] = o.ExpiresAt
|
|
}
|
|
if !IsNil(o.Id) {
|
|
toSerialize["id"] = o.Id
|
|
}
|
|
if !IsNil(o.Runtime) {
|
|
toSerialize["runtime"] = o.Runtime
|
|
}
|
|
if !IsNil(o.Status) {
|
|
toSerialize["status"] = o.Status
|
|
}
|
|
if !IsNil(o.Workdir) {
|
|
toSerialize["workdir"] = o.Workdir
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *SandboxLeased) UnmarshalJSON(data []byte) (err error) {
|
|
varSandboxLeased := _SandboxLeased{}
|
|
|
|
err = json.Unmarshal(data, &varSandboxLeased)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = SandboxLeased(varSandboxLeased)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "carried")
|
|
delete(additionalProperties, "class")
|
|
delete(additionalProperties, "cluster")
|
|
delete(additionalProperties, "expiresAt")
|
|
delete(additionalProperties, "id")
|
|
delete(additionalProperties, "runtime")
|
|
delete(additionalProperties, "status")
|
|
delete(additionalProperties, "workdir")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableSandboxLeased struct {
|
|
value *SandboxLeased
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableSandboxLeased) Get() *SandboxLeased {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableSandboxLeased) Set(val *SandboxLeased) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableSandboxLeased) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableSandboxLeased) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableSandboxLeased(val *SandboxLeased) *NullableSandboxLeased {
|
|
return &NullableSandboxLeased{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableSandboxLeased) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableSandboxLeased) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|