Skip to content

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

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

// ImageUsage struct for ImageUsage
type ImageUsage struct {
	// Images this organization holds. Curated images are the operator’s and are not counted
	Count float32 `json:"count"`
	// How many images this organization may hold
	Limit float32 `json:"limit"`
	// Sum of the declared sizes of every pulled version, in bytes. A lower bound on what is stored: it counts what the manifests said, and counts a layer once per version that references it
	KnownBytes float32 `json:"knownBytes"`
	AdditionalProperties map[string]interface{}
}

type _ImageUsage ImageUsage

// NewImageUsage instantiates a new ImageUsage 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 NewImageUsage(count float32, limit float32, knownBytes float32) *ImageUsage {
	this := ImageUsage{}
	this.Count = count
	this.Limit = limit
	this.KnownBytes = knownBytes
	return &this
}

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

// GetCount returns the Count field value
func (o *ImageUsage) GetCount() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Count
}

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

// SetCount sets field value
func (o *ImageUsage) SetCount(v float32) {
	o.Count = v
}

// GetLimit returns the Limit field value
func (o *ImageUsage) GetLimit() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Limit
}

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

// SetLimit sets field value
func (o *ImageUsage) SetLimit(v float32) {
	o.Limit = v
}

// GetKnownBytes returns the KnownBytes field value
func (o *ImageUsage) GetKnownBytes() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.KnownBytes
}

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

// SetKnownBytes sets field value
func (o *ImageUsage) SetKnownBytes(v float32) {
	o.KnownBytes = v
}

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

func (o ImageUsage) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["count"] = o.Count
	toSerialize["limit"] = o.Limit
	toSerialize["knownBytes"] = o.KnownBytes

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

	return toSerialize, nil
}

func (o *ImageUsage) 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{
		"count",
		"limit",
		"knownBytes",
	}

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

	varImageUsage := _ImageUsage{}

	err = json.Unmarshal(data, &varImageUsage)

	if err != nil {
		return err
	}

	*o = ImageUsage(varImageUsage)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "count")
		delete(additionalProperties, "limit")
		delete(additionalProperties, "knownBytes")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableImageUsage struct {
	value *ImageUsage
	isSet bool
}

func (v NullableImageUsage) Get() *ImageUsage {
	return v.value
}

func (v *NullableImageUsage) Set(val *ImageUsage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableImageUsage(val *ImageUsage) *NullableImageUsage {
	return &NullableImageUsage{value: val, isSet: true}
}

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

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