Skip to content

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

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

// ImageVersion struct for ImageVersion
type ImageVersion struct {
	// Version ID
	Id string `json:"id"`
	// OCI manifest digest this version was pulled at
	Digest string `json:"digest"`
	// Sum of the layer sizes the manifest declared, in bytes
	SizeBytes float32 `json:"sizeBytes"`
	// The reference the caller asked for, kept verbatim as provenance
	SourceRef string `json:"sourceRef"`
	// Aliases that point at this version now, so a reference with one of them boots it
	Aliases []string `json:"aliases"`
	// When a box last started from this version. Null when none has since this was recorded
	LastUsedAt NullableString `json:"lastUsedAt"`
	// When a pull of this version first failed because its registry no longer has it. Runners that cached it still start it; elsewhere, create a new alias for a version the registry still has. Null while no pull has found it gone
	UpstreamMissingAt NullableString `json:"upstreamMissingAt"`
	// When this version was first recorded
	CreatedAt string `json:"createdAt"`
	AdditionalProperties map[string]interface{}
}

type _ImageVersion ImageVersion

// NewImageVersion instantiates a new ImageVersion 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 NewImageVersion(id string, digest string, sizeBytes float32, sourceRef string, aliases []string, lastUsedAt NullableString, upstreamMissingAt NullableString, createdAt string) *ImageVersion {
	this := ImageVersion{}
	this.Id = id
	this.Digest = digest
	this.SizeBytes = sizeBytes
	this.SourceRef = sourceRef
	this.Aliases = aliases
	this.LastUsedAt = lastUsedAt
	this.UpstreamMissingAt = upstreamMissingAt
	this.CreatedAt = createdAt
	return &this
}

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

// GetId returns the Id field value
func (o *ImageVersion) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *ImageVersion) SetId(v string) {
	o.Id = v
}

// GetDigest returns the Digest field value
func (o *ImageVersion) GetDigest() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Digest
}

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

// SetDigest sets field value
func (o *ImageVersion) SetDigest(v string) {
	o.Digest = v
}

// GetSizeBytes returns the SizeBytes field value
func (o *ImageVersion) GetSizeBytes() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.SizeBytes
}

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

// SetSizeBytes sets field value
func (o *ImageVersion) SetSizeBytes(v float32) {
	o.SizeBytes = v
}

// GetSourceRef returns the SourceRef field value
func (o *ImageVersion) GetSourceRef() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SourceRef
}

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

// SetSourceRef sets field value
func (o *ImageVersion) SetSourceRef(v string) {
	o.SourceRef = v
}

// GetAliases returns the Aliases field value
func (o *ImageVersion) 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 *ImageVersion) GetAliasesOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Aliases, true
}

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

// GetLastUsedAt returns the LastUsedAt field value
// If the value is explicit nil, the zero value for string will be returned
func (o *ImageVersion) 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 *ImageVersion) GetLastUsedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastUsedAt.Get(), o.LastUsedAt.IsSet()
}

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

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

	return *o.UpstreamMissingAt.Get()
}

// GetUpstreamMissingAtOk returns a tuple with the UpstreamMissingAt 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 *ImageVersion) GetUpstreamMissingAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.UpstreamMissingAt.Get(), o.UpstreamMissingAt.IsSet()
}

// SetUpstreamMissingAt sets field value
func (o *ImageVersion) SetUpstreamMissingAt(v string) {
	o.UpstreamMissingAt.Set(&v)
}

// GetCreatedAt returns the CreatedAt field value
func (o *ImageVersion) GetCreatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CreatedAt
}

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

// SetCreatedAt sets field value
func (o *ImageVersion) SetCreatedAt(v string) {
	o.CreatedAt = v
}

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

func (o ImageVersion) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["digest"] = o.Digest
	toSerialize["sizeBytes"] = o.SizeBytes
	toSerialize["sourceRef"] = o.SourceRef
	toSerialize["aliases"] = o.Aliases
	toSerialize["lastUsedAt"] = o.LastUsedAt.Get()
	toSerialize["upstreamMissingAt"] = o.UpstreamMissingAt.Get()
	toSerialize["createdAt"] = o.CreatedAt

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

	return toSerialize, nil
}

func (o *ImageVersion) 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{
		"id",
		"digest",
		"sizeBytes",
		"sourceRef",
		"aliases",
		"lastUsedAt",
		"upstreamMissingAt",
		"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)
		}
	}

	varImageVersion := _ImageVersion{}

	err = json.Unmarshal(data, &varImageVersion)

	if err != nil {
		return err
	}

	*o = ImageVersion(varImageVersion)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "digest")
		delete(additionalProperties, "sizeBytes")
		delete(additionalProperties, "sourceRef")
		delete(additionalProperties, "aliases")
		delete(additionalProperties, "lastUsedAt")
		delete(additionalProperties, "upstreamMissingAt")
		delete(additionalProperties, "createdAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableImageVersion struct {
	value *ImageVersion
	isSet bool
}

func (v NullableImageVersion) Get() *ImageVersion {
	return v.value
}

func (v *NullableImageVersion) Set(val *ImageVersion) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableImageVersion(val *ImageVersion) *NullableImageVersion {
	return &NullableImageVersion{value: val, isSet: true}
}

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

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