Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

8.5 KB
Raw Blame
/*
BoxLite

BoxLite AI platform API Docs

API version: 1.0
Contact: [email protected]
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package apiclient

import (
	"encoding/json"
	"fmt"
)

// checks if the UpdateBoxStateDto type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateBoxStateDto{}

// UpdateBoxStateDto struct for UpdateBoxStateDto
type UpdateBoxStateDto struct {
	// The new state for the box
	State string `json:"state"`
	// Optional error message when reporting an error state
	ErrorReason *string `json:"errorReason,omitempty"`
	// Whether the box is recoverable
	Recoverable *bool `json:"recoverable,omitempty"`
	// Registry digest of the image the box booted from
	ImageDigest *string `json:"imageDigest,omitempty"`
	// Declared on-registry size of that image, in bytes
	ImageSizeBytes *int64 `json:"imageSizeBytes,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _UpdateBoxStateDto UpdateBoxStateDto

// NewUpdateBoxStateDto instantiates a new UpdateBoxStateDto 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 NewUpdateBoxStateDto(state string) *UpdateBoxStateDto {
	this := UpdateBoxStateDto{}
	this.State = state
	return &this
}

// NewUpdateBoxStateDtoWithDefaults instantiates a new UpdateBoxStateDto 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 NewUpdateBoxStateDtoWithDefaults() *UpdateBoxStateDto {
	this := UpdateBoxStateDto{}
	return &this
}

// GetState returns the State field value
func (o *UpdateBoxStateDto) GetState() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.State
}

// GetStateOk returns a tuple with the State field value
// and a boolean to check if the value has been set.
func (o *UpdateBoxStateDto) GetStateOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.State, true
}

// SetState sets field value
func (o *UpdateBoxStateDto) SetState(v string) {
	o.State = v
}

// GetErrorReason returns the ErrorReason field value if set, zero value otherwise.
func (o *UpdateBoxStateDto) GetErrorReason() string {
	if o == nil || IsNil(o.ErrorReason) {
		var ret string
		return ret
	}
	return *o.ErrorReason
}

// GetErrorReasonOk returns a tuple with the ErrorReason field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateBoxStateDto) GetErrorReasonOk() (*string, bool) {
	if o == nil || IsNil(o.ErrorReason) {
		return nil, false
	}
	return o.ErrorReason, true
}

// HasErrorReason returns a boolean if a field has been set.
func (o *UpdateBoxStateDto) HasErrorReason() bool {
	if o != nil && !IsNil(o.ErrorReason) {
		return true
	}

	return false
}

// SetErrorReason gets a reference to the given string and assigns it to the ErrorReason field.
func (o *UpdateBoxStateDto) SetErrorReason(v string) {
	o.ErrorReason = &v
}

// GetRecoverable returns the Recoverable field value if set, zero value otherwise.
func (o *UpdateBoxStateDto) GetRecoverable() bool {
	if o == nil || IsNil(o.Recoverable) {
		var ret bool
		return ret
	}
	return *o.Recoverable
}

// GetRecoverableOk returns a tuple with the Recoverable field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateBoxStateDto) GetRecoverableOk() (*bool, bool) {
	if o == nil || IsNil(o.Recoverable) {
		return nil, false
	}
	return o.Recoverable, true
}

// HasRecoverable returns a boolean if a field has been set.
func (o *UpdateBoxStateDto) HasRecoverable() bool {
	if o != nil && !IsNil(o.Recoverable) {
		return true
	}

	return false
}

// SetRecoverable gets a reference to the given bool and assigns it to the Recoverable field.
func (o *UpdateBoxStateDto) SetRecoverable(v bool) {
	o.Recoverable = &v
}

// GetImageDigest returns the ImageDigest field value if set, zero value otherwise.
func (o *UpdateBoxStateDto) GetImageDigest() string {
	if o == nil || IsNil(o.ImageDigest) {
		var ret string
		return ret
	}
	return *o.ImageDigest
}

// GetImageDigestOk returns a tuple with the ImageDigest field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateBoxStateDto) GetImageDigestOk() (*string, bool) {
	if o == nil || IsNil(o.ImageDigest) {
		return nil, false
	}
	return o.ImageDigest, true
}

// HasImageDigest returns a boolean if a field has been set.
func (o *UpdateBoxStateDto) HasImageDigest() bool {
	if o != nil && !IsNil(o.ImageDigest) {
		return true
	}

	return false
}

// SetImageDigest gets a reference to the given string and assigns it to the ImageDigest field.
func (o *UpdateBoxStateDto) SetImageDigest(v string) {
	o.ImageDigest = &v
}

// GetImageSizeBytes returns the ImageSizeBytes field value if set, zero value otherwise.
func (o *UpdateBoxStateDto) GetImageSizeBytes() int64 {
	if o == nil || IsNil(o.ImageSizeBytes) {
		var ret int64
		return ret
	}
	return *o.ImageSizeBytes
}

// GetImageSizeBytesOk returns a tuple with the ImageSizeBytes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateBoxStateDto) GetImageSizeBytesOk() (*int64, bool) {
	if o == nil || IsNil(o.ImageSizeBytes) {
		return nil, false
	}
	return o.ImageSizeBytes, true
}

// HasImageSizeBytes returns a boolean if a field has been set.
func (o *UpdateBoxStateDto) HasImageSizeBytes() bool {
	if o != nil && !IsNil(o.ImageSizeBytes) {
		return true
	}

	return false
}

// SetImageSizeBytes gets a reference to the given int64 and assigns it to the ImageSizeBytes field.
func (o *UpdateBoxStateDto) SetImageSizeBytes(v int64) {
	o.ImageSizeBytes = &v
}

func (o UpdateBoxStateDto) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o UpdateBoxStateDto) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["state"] = o.State
	if !IsNil(o.ErrorReason) {
		toSerialize["errorReason"] = o.ErrorReason
	}
	if !IsNil(o.Recoverable) {
		toSerialize["recoverable"] = o.Recoverable
	}
	if !IsNil(o.ImageDigest) {
		toSerialize["imageDigest"] = o.ImageDigest
	}
	if !IsNil(o.ImageSizeBytes) {
		toSerialize["imageSizeBytes"] = o.ImageSizeBytes
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *UpdateBoxStateDto) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"state",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varUpdateBoxStateDto := _UpdateBoxStateDto{}

	err = json.Unmarshal(data, &varUpdateBoxStateDto)

	if err != nil {
		return err
	}

	*o = UpdateBoxStateDto(varUpdateBoxStateDto)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "state")
		delete(additionalProperties, "errorReason")
		delete(additionalProperties, "recoverable")
		delete(additionalProperties, "imageDigest")
		delete(additionalProperties, "imageSizeBytes")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableUpdateBoxStateDto struct {
	value *UpdateBoxStateDto
	isSet bool
}

func (v NullableUpdateBoxStateDto) Get() *UpdateBoxStateDto {
	return v.value
}

func (v *NullableUpdateBoxStateDto) Set(val *UpdateBoxStateDto) {
	v.value = val
	v.isSet = true
}

func (v NullableUpdateBoxStateDto) IsSet() bool {
	return v.isSet
}

func (v *NullableUpdateBoxStateDto) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableUpdateBoxStateDto(val *UpdateBoxStateDto) *NullableUpdateBoxStateDto {
	return &NullableUpdateBoxStateDto{value: val, isSet: true}
}

func (v NullableUpdateBoxStateDto) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableUpdateBoxStateDto) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}