Skip to content

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

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

// OutboundNetworkSpec struct for OutboundNetworkSpec
type OutboundNetworkSpec struct {
	// Whether the guest may reach out
	Mode NetworkMode `json:"mode"`
	// Outbound allowlist in force; empty means unrestricted egress
	AllowNet []string `json:"allow_net"`
	AdditionalProperties map[string]interface{}
}

type _OutboundNetworkSpec OutboundNetworkSpec

// NewOutboundNetworkSpec instantiates a new OutboundNetworkSpec 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 NewOutboundNetworkSpec(mode NetworkMode, allowNet []string) *OutboundNetworkSpec {
	this := OutboundNetworkSpec{}
	this.Mode = mode
	this.AllowNet = allowNet
	return &this
}

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

// GetMode returns the Mode field value
func (o *OutboundNetworkSpec) GetMode() NetworkMode {
	if o == nil {
		var ret NetworkMode
		return ret
	}

	return o.Mode
}

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

// SetMode sets field value
func (o *OutboundNetworkSpec) SetMode(v NetworkMode) {
	o.Mode = v
}

// GetAllowNet returns the AllowNet field value
func (o *OutboundNetworkSpec) GetAllowNet() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.AllowNet
}

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

// SetAllowNet sets field value
func (o *OutboundNetworkSpec) SetAllowNet(v []string) {
	o.AllowNet = v
}

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

func (o OutboundNetworkSpec) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["mode"] = o.Mode
	toSerialize["allow_net"] = o.AllowNet

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

	return toSerialize, nil
}

func (o *OutboundNetworkSpec) 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{
		"mode",
		"allow_net",
	}

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

	varOutboundNetworkSpec := _OutboundNetworkSpec{}

	err = json.Unmarshal(data, &varOutboundNetworkSpec)

	if err != nil {
		return err
	}

	*o = OutboundNetworkSpec(varOutboundNetworkSpec)

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

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

	return err
}

type NullableOutboundNetworkSpec struct {
	value *OutboundNetworkSpec
	isSet bool
}

func (v NullableOutboundNetworkSpec) Get() *OutboundNetworkSpec {
	return v.value
}

func (v *NullableOutboundNetworkSpec) Set(val *OutboundNetworkSpec) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOutboundNetworkSpec(val *OutboundNetworkSpec) *NullableOutboundNetworkSpec {
	return &NullableOutboundNetworkSpec{value: val, isSet: true}
}

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

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