Skip to content

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

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

// Image struct for Image
type Image struct {
	// What to pass as a box image to boot from this: the curated short name, or the upstream repository path
	Name string `json:"name"`
	// Catalog row ID. Null for curated images, which are operator configuration rather than rows
	Id NullableString `json:"id"`
	// Whether this is one of the operator-provided images every organization shares. Curated images cannot be deleted and do not count against the organization limit
	Curated bool `json:"curated"`
	// The exact reference a curated image resolves to. Null for catalog images, which resolve through their versions
	CuratedRef NullableString `json:"curatedRef"`
	// Aliases recorded for this image. Empty for curated images, whose reference the operator pins
	Aliases []string `json:"aliases"`
	// How many pulled manifest digests this image holds
	VersionCount float32 `json:"versionCount"`
	// Sum of the pulled versions’ declared sizes, in bytes. Layers shared between versions are counted once per version. Null for curated images, whose bytes this system never measured
	SizeBytes NullableFloat32 `json:"sizeBytes"`
	// When a box last booted from this image
	LastUsedAt NullableString `json:"lastUsedAt"`
	// When this image first entered the catalog. Null for curated images
	CreatedAt NullableString `json:"createdAt"`
	AdditionalProperties map[string]interface{}
}

type _Image Image

// NewImage instantiates a new Image 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 NewImage(name string, id NullableString, curated bool, curatedRef NullableString, aliases []string, versionCount float32, sizeBytes NullableFloat32, lastUsedAt NullableString, createdAt NullableString) *Image {
	this := Image{}
	this.Name = name
	this.Id = id
	this.Curated = curated
	this.CuratedRef = curatedRef
	this.Aliases = aliases
	this.VersionCount = versionCount
	this.SizeBytes = sizeBytes
	this.LastUsedAt = lastUsedAt
	this.CreatedAt = createdAt
	return &this
}

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

// GetName returns the Name field value
func (o *Image) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *Image) SetName(v string) {
	o.Name = v
}

// GetId returns the Id field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Image) GetId() string {
	if o == nil || o.Id.Get() == nil {
		var ret string
		return ret
	}

	return *o.Id.Get()
}

// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Image) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Id.Get(), o.Id.IsSet()
}

// SetId sets field value
func (o *Image) SetId(v string) {
	o.Id.Set(&v)
}

// GetCurated returns the Curated field value
func (o *Image) GetCurated() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.Curated
}

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

// SetCurated sets field value
func (o *Image) SetCurated(v bool) {
	o.Curated = v
}

// GetCuratedRef returns the CuratedRef field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Image) GetCuratedRef() string {
	if o == nil || o.CuratedRef.Get() == nil {
		var ret string
		return ret
	}

	return *o.CuratedRef.Get()
}

// GetCuratedRefOk returns a tuple with the CuratedRef field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Image) GetCuratedRefOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.CuratedRef.Get(), o.CuratedRef.IsSet()
}

// SetCuratedRef sets field value
func (o *Image) SetCuratedRef(v string) {
	o.CuratedRef.Set(&v)
}

// GetAliases returns the Aliases field value
func (o *Image) GetAliases() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.Aliases
}

// GetAliasesOk returns a tuple with the Aliases field value
// and a boolean to check if the value has been set.
func (o *Image) GetAliasesOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Aliases, true
}

// SetAliases sets field value
func (o *Image) SetAliases(v []string) {
	o.Aliases = v
}

// GetVersionCount returns the VersionCount field value
func (o *Image) GetVersionCount() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.VersionCount
}

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

// SetVersionCount sets field value
func (o *Image) SetVersionCount(v float32) {
	o.VersionCount = v
}

// GetSizeBytes returns the SizeBytes field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *Image) GetSizeBytes() float32 {
	if o == nil || o.SizeBytes.Get() == nil {
		var ret float32
		return ret
	}

	return *o.SizeBytes.Get()
}

// GetSizeBytesOk returns a tuple with the SizeBytes field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Image) GetSizeBytesOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.SizeBytes.Get(), o.SizeBytes.IsSet()
}

// SetSizeBytes sets field value
func (o *Image) SetSizeBytes(v float32) {
	o.SizeBytes.Set(&v)
}

// GetLastUsedAt returns the LastUsedAt field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Image) GetLastUsedAt() string {
	if o == nil || o.LastUsedAt.Get() == nil {
		var ret string
		return ret
	}

	return *o.LastUsedAt.Get()
}

// GetLastUsedAtOk returns a tuple with the LastUsedAt field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Image) GetLastUsedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastUsedAt.Get(), o.LastUsedAt.IsSet()
}

// SetLastUsedAt sets field value
func (o *Image) SetLastUsedAt(v string) {
	o.LastUsedAt.Set(&v)
}

// GetCreatedAt returns the CreatedAt field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Image) GetCreatedAt() string {
	if o == nil || o.CreatedAt.Get() == nil {
		var ret string
		return ret
	}

	return *o.CreatedAt.Get()
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Image) GetCreatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.CreatedAt.Get(), o.CreatedAt.IsSet()
}

// SetCreatedAt sets field value
func (o *Image) SetCreatedAt(v string) {
	o.CreatedAt.Set(&v)
}

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

func (o Image) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["name"] = o.Name
	toSerialize["id"] = o.Id.Get()
	toSerialize["curated"] = o.Curated
	toSerialize["curatedRef"] = o.CuratedRef.Get()
	toSerialize["aliases"] = o.Aliases
	toSerialize["versionCount"] = o.VersionCount
	toSerialize["sizeBytes"] = o.SizeBytes.Get()
	toSerialize["lastUsedAt"] = o.LastUsedAt.Get()
	toSerialize["createdAt"] = o.CreatedAt.Get()

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

	return toSerialize, nil
}

func (o *Image) 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{
		"name",
		"id",
		"curated",
		"curatedRef",
		"aliases",
		"versionCount",
		"sizeBytes",
		"lastUsedAt",
		"createdAt",
	}

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

	varImage := _Image{}

	err = json.Unmarshal(data, &varImage)

	if err != nil {
		return err
	}

	*o = Image(varImage)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "name")
		delete(additionalProperties, "id")
		delete(additionalProperties, "curated")
		delete(additionalProperties, "curatedRef")
		delete(additionalProperties, "aliases")
		delete(additionalProperties, "versionCount")
		delete(additionalProperties, "sizeBytes")
		delete(additionalProperties, "lastUsedAt")
		delete(additionalProperties, "createdAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableImage struct {
	value *Image
	isSet bool
}

func (v NullableImage) Get() *Image {
	return v.value
}

func (v *NullableImage) Set(val *Image) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableImage(val *Image) *NullableImage {
	return &NullableImage{value: val, isSet: true}
}

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

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