Skip to content

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

12.6 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"
	"time"
	"fmt"
)

// checks if the RunnerCpuIncident type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RunnerCpuIncident{}

// RunnerCpuIncident struct for RunnerCpuIncident
type RunnerCpuIncident struct {
	// Bigint row ID; keep as a string.
	Id string `json:"id"`
	RunnerId string `json:"runnerId"`
	EventId string `json:"eventId"`
	HighCpuSince time.Time `json:"highCpuSince"`
	WindowStartedAt time.Time `json:"windowStartedAt"`
	WindowEndedAt time.Time `json:"windowEndedAt"`
	// Host-wide percent at trigger.
	RunnerCpuPercent float32 `json:"runnerCpuPercent"`
	BoxId NullableString `json:"boxId"`
	// Winning box Image string at capture time.
	Image NullableString `json:"image"`
	// Measured cumulative CPU-seconds across all cores.
	CpuSeconds float32 `json:"cpuSeconds"`
	SamplingComplete bool `json:"samplingComplete"`
	ReceivedAt time.Time `json:"receivedAt"`
	AdditionalProperties map[string]interface{}
}

type _RunnerCpuIncident RunnerCpuIncident

// NewRunnerCpuIncident instantiates a new RunnerCpuIncident 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 NewRunnerCpuIncident(id string, runnerId string, eventId string, highCpuSince time.Time, windowStartedAt time.Time, windowEndedAt time.Time, runnerCpuPercent float32, boxId NullableString, image NullableString, cpuSeconds float32, samplingComplete bool, receivedAt time.Time) *RunnerCpuIncident {
	this := RunnerCpuIncident{}
	this.Id = id
	this.RunnerId = runnerId
	this.EventId = eventId
	this.HighCpuSince = highCpuSince
	this.WindowStartedAt = windowStartedAt
	this.WindowEndedAt = windowEndedAt
	this.RunnerCpuPercent = runnerCpuPercent
	this.BoxId = boxId
	this.Image = image
	this.CpuSeconds = cpuSeconds
	this.SamplingComplete = samplingComplete
	this.ReceivedAt = receivedAt
	return &this
}

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

// GetId returns the Id field value
func (o *RunnerCpuIncident) 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 *RunnerCpuIncident) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

// GetRunnerId returns the RunnerId field value
func (o *RunnerCpuIncident) GetRunnerId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RunnerId
}

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

// SetRunnerId sets field value
func (o *RunnerCpuIncident) SetRunnerId(v string) {
	o.RunnerId = v
}

// GetEventId returns the EventId field value
func (o *RunnerCpuIncident) GetEventId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.EventId
}

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

// SetEventId sets field value
func (o *RunnerCpuIncident) SetEventId(v string) {
	o.EventId = v
}

// GetHighCpuSince returns the HighCpuSince field value
func (o *RunnerCpuIncident) GetHighCpuSince() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.HighCpuSince
}

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

// SetHighCpuSince sets field value
func (o *RunnerCpuIncident) SetHighCpuSince(v time.Time) {
	o.HighCpuSince = v
}

// GetWindowStartedAt returns the WindowStartedAt field value
func (o *RunnerCpuIncident) GetWindowStartedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.WindowStartedAt
}

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

// SetWindowStartedAt sets field value
func (o *RunnerCpuIncident) SetWindowStartedAt(v time.Time) {
	o.WindowStartedAt = v
}

// GetWindowEndedAt returns the WindowEndedAt field value
func (o *RunnerCpuIncident) GetWindowEndedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.WindowEndedAt
}

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

// SetWindowEndedAt sets field value
func (o *RunnerCpuIncident) SetWindowEndedAt(v time.Time) {
	o.WindowEndedAt = v
}

// GetRunnerCpuPercent returns the RunnerCpuPercent field value
func (o *RunnerCpuIncident) GetRunnerCpuPercent() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.RunnerCpuPercent
}

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

// SetRunnerCpuPercent sets field value
func (o *RunnerCpuIncident) SetRunnerCpuPercent(v float32) {
	o.RunnerCpuPercent = v
}

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

	return *o.BoxId.Get()
}

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

// SetBoxId sets field value
func (o *RunnerCpuIncident) SetBoxId(v string) {
	o.BoxId.Set(&v)
}

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

	return *o.Image.Get()
}

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

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

// GetCpuSeconds returns the CpuSeconds field value
func (o *RunnerCpuIncident) GetCpuSeconds() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CpuSeconds
}

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

// SetCpuSeconds sets field value
func (o *RunnerCpuIncident) SetCpuSeconds(v float32) {
	o.CpuSeconds = v
}

// GetSamplingComplete returns the SamplingComplete field value
func (o *RunnerCpuIncident) GetSamplingComplete() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.SamplingComplete
}

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

// SetSamplingComplete sets field value
func (o *RunnerCpuIncident) SetSamplingComplete(v bool) {
	o.SamplingComplete = v
}

// GetReceivedAt returns the ReceivedAt field value
func (o *RunnerCpuIncident) GetReceivedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.ReceivedAt
}

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

// SetReceivedAt sets field value
func (o *RunnerCpuIncident) SetReceivedAt(v time.Time) {
	o.ReceivedAt = v
}

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

func (o RunnerCpuIncident) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["runnerId"] = o.RunnerId
	toSerialize["eventId"] = o.EventId
	toSerialize["highCpuSince"] = o.HighCpuSince
	toSerialize["windowStartedAt"] = o.WindowStartedAt
	toSerialize["windowEndedAt"] = o.WindowEndedAt
	toSerialize["runnerCpuPercent"] = o.RunnerCpuPercent
	toSerialize["boxId"] = o.BoxId.Get()
	toSerialize["image"] = o.Image.Get()
	toSerialize["cpuSeconds"] = o.CpuSeconds
	toSerialize["samplingComplete"] = o.SamplingComplete
	toSerialize["receivedAt"] = o.ReceivedAt

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

	return toSerialize, nil
}

func (o *RunnerCpuIncident) 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",
		"runnerId",
		"eventId",
		"highCpuSince",
		"windowStartedAt",
		"windowEndedAt",
		"runnerCpuPercent",
		"boxId",
		"image",
		"cpuSeconds",
		"samplingComplete",
		"receivedAt",
	}

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

	varRunnerCpuIncident := _RunnerCpuIncident{}

	err = json.Unmarshal(data, &varRunnerCpuIncident)

	if err != nil {
		return err
	}

	*o = RunnerCpuIncident(varRunnerCpuIncident)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "runnerId")
		delete(additionalProperties, "eventId")
		delete(additionalProperties, "highCpuSince")
		delete(additionalProperties, "windowStartedAt")
		delete(additionalProperties, "windowEndedAt")
		delete(additionalProperties, "runnerCpuPercent")
		delete(additionalProperties, "boxId")
		delete(additionalProperties, "image")
		delete(additionalProperties, "cpuSeconds")
		delete(additionalProperties, "samplingComplete")
		delete(additionalProperties, "receivedAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRunnerCpuIncident struct {
	value *RunnerCpuIncident
	isSet bool
}

func (v NullableRunnerCpuIncident) Get() *RunnerCpuIncident {
	return v.value
}

func (v *NullableRunnerCpuIncident) Set(val *RunnerCpuIncident) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRunnerCpuIncident(val *RunnerCpuIncident) *NullableRunnerCpuIncident {
	return &NullableRunnerCpuIncident{value: val, isSet: true}
}

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

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