Skip to content

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

6.7 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 BoxVolume type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &BoxVolume{}

// BoxVolume struct for BoxVolume
type BoxVolume struct {
	// The ID of the volume (bucket-backed or Filestore-backed)
	VolumeId string `json:"volumeId"`
	// The mount path for the volume
	MountPath string `json:"mountPath"`
	// The Filestore instance reference; absent for bucket-backed volumes
	Filestore *BoxVolumeFilestoreRef `json:"filestore,omitempty"`
	// Optional subpath within the volume to mount. When specified, only this S3 prefix will be accessible. When omitted, the entire volume is mounted.
	Subpath *string `json:"subpath,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _BoxVolume BoxVolume

// NewBoxVolume instantiates a new BoxVolume 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 NewBoxVolume(volumeId string, mountPath string) *BoxVolume {
	this := BoxVolume{}
	this.VolumeId = volumeId
	this.MountPath = mountPath
	return &this
}

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

// GetVolumeId returns the VolumeId field value
func (o *BoxVolume) GetVolumeId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.VolumeId
}

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

// SetVolumeId sets field value
func (o *BoxVolume) SetVolumeId(v string) {
	o.VolumeId = v
}

// GetMountPath returns the MountPath field value
func (o *BoxVolume) GetMountPath() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.MountPath
}

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

// SetMountPath sets field value
func (o *BoxVolume) SetMountPath(v string) {
	o.MountPath = v
}

// GetFilestore returns the Filestore field value if set, zero value otherwise.
func (o *BoxVolume) GetFilestore() BoxVolumeFilestoreRef {
	if o == nil || IsNil(o.Filestore) {
		var ret BoxVolumeFilestoreRef
		return ret
	}
	return *o.Filestore
}

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

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

	return false
}

// SetFilestore gets a reference to the given BoxVolumeFilestoreRef and assigns it to the Filestore field.
func (o *BoxVolume) SetFilestore(v BoxVolumeFilestoreRef) {
	o.Filestore = &v
}

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

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

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

	return false
}

// SetSubpath gets a reference to the given string and assigns it to the Subpath field.
func (o *BoxVolume) SetSubpath(v string) {
	o.Subpath = &v
}

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

func (o BoxVolume) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["volumeId"] = o.VolumeId
	toSerialize["mountPath"] = o.MountPath
	if !IsNil(o.Filestore) {
		toSerialize["filestore"] = o.Filestore
	}
	if !IsNil(o.Subpath) {
		toSerialize["subpath"] = o.Subpath
	}

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

	return toSerialize, nil
}

func (o *BoxVolume) 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{
		"volumeId",
		"mountPath",
	}

	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)
		}
	}

	varBoxVolume := _BoxVolume{}

	err = json.Unmarshal(data, &varBoxVolume)

	if err != nil {
		return err
	}

	*o = BoxVolume(varBoxVolume)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "volumeId")
		delete(additionalProperties, "mountPath")
		delete(additionalProperties, "filestore")
		delete(additionalProperties, "subpath")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableBoxVolume struct {
	value *BoxVolume
	isSet bool
}

func (v NullableBoxVolume) Get() *BoxVolume {
	return v.value
}

func (v *NullableBoxVolume) Set(val *BoxVolume) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBoxVolume(val *BoxVolume) *NullableBoxVolume {
	return &NullableBoxVolume{value: val, isSet: true}
}

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

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