Files
sdk/model_agent_spend_view.go

421 lines
12 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the AgentSpendView type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AgentSpendView{}
// AgentSpendView struct for AgentSpendView
type AgentSpendView struct {
// ByComponent holds only the components with spend. Absent, not zero.
ByComponent map[string]int64 `json:"by_component,omitempty"`
// CapMicroUSD is the total this agent may spend within one Period, as an integer number of micro-USD (1,000,000 = $1). It is required at creation: a cap of zero would mean no limit and no per-agent spend record at all.
CapMicroUsd *int64 `json:"cap_micro_usd,omitempty"`
// ConsumedMicroUSD is what has been spent in the current period, in micro-USD. It is settled from what the gateway reported, not from the quote.
ConsumedMicroUsd *int64 `json:"consumed_micro_usd,omitempty"`
// MaxTaskMicroUSD is the ceiling for a single run, in micro-USD. A session cannot exceed it even when the period cap still has room, so one runaway task cannot consume a month.
MaxTaskMicroUsd *int64 `json:"max_task_micro_usd,omitempty"`
// Period is the window the cap resets on: day, week or month.
Period *string `json:"period,omitempty"`
// PeriodStartedAt is when the current period began, as a Unix second.
PeriodStartedAt *int64 `json:"period_started_at,omitempty"`
// Ref names the agent this spend belongs to.
Ref *string `json:"ref,omitempty"`
// RemainingMicroUSD is what the cap still allows this period, in micro-USD.
RemainingMicroUsd *int64 `json:"remaining_micro_usd,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AgentSpendView AgentSpendView
// NewAgentSpendView instantiates a new AgentSpendView 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 NewAgentSpendView() *AgentSpendView {
this := AgentSpendView{}
return &this
}
// NewAgentSpendViewWithDefaults instantiates a new AgentSpendView 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 NewAgentSpendViewWithDefaults() *AgentSpendView {
this := AgentSpendView{}
return &this
}
// GetByComponent returns the ByComponent field value if set, zero value otherwise.
func (o *AgentSpendView) GetByComponent() map[string]int64 {
if o == nil || IsNil(o.ByComponent) {
var ret map[string]int64
return ret
}
return o.ByComponent
}
// GetByComponentOk returns a tuple with the ByComponent field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetByComponentOk() (map[string]int64, bool) {
if o == nil || IsNil(o.ByComponent) {
return map[string]int64{}, false
}
return o.ByComponent, true
}
// HasByComponent returns a boolean if a field has been set.
func (o *AgentSpendView) HasByComponent() bool {
if o != nil && !IsNil(o.ByComponent) {
return true
}
return false
}
// SetByComponent gets a reference to the given map[string]int64 and assigns it to the ByComponent field.
func (o *AgentSpendView) SetByComponent(v map[string]int64) {
o.ByComponent = v
}
// GetCapMicroUsd returns the CapMicroUsd field value if set, zero value otherwise.
func (o *AgentSpendView) GetCapMicroUsd() int64 {
if o == nil || IsNil(o.CapMicroUsd) {
var ret int64
return ret
}
return *o.CapMicroUsd
}
// GetCapMicroUsdOk returns a tuple with the CapMicroUsd field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetCapMicroUsdOk() (*int64, bool) {
if o == nil || IsNil(o.CapMicroUsd) {
return nil, false
}
return o.CapMicroUsd, true
}
// HasCapMicroUsd returns a boolean if a field has been set.
func (o *AgentSpendView) HasCapMicroUsd() bool {
if o != nil && !IsNil(o.CapMicroUsd) {
return true
}
return false
}
// SetCapMicroUsd gets a reference to the given int64 and assigns it to the CapMicroUsd field.
func (o *AgentSpendView) SetCapMicroUsd(v int64) {
o.CapMicroUsd = &v
}
// GetConsumedMicroUsd returns the ConsumedMicroUsd field value if set, zero value otherwise.
func (o *AgentSpendView) GetConsumedMicroUsd() int64 {
if o == nil || IsNil(o.ConsumedMicroUsd) {
var ret int64
return ret
}
return *o.ConsumedMicroUsd
}
// GetConsumedMicroUsdOk returns a tuple with the ConsumedMicroUsd field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetConsumedMicroUsdOk() (*int64, bool) {
if o == nil || IsNil(o.ConsumedMicroUsd) {
return nil, false
}
return o.ConsumedMicroUsd, true
}
// HasConsumedMicroUsd returns a boolean if a field has been set.
func (o *AgentSpendView) HasConsumedMicroUsd() bool {
if o != nil && !IsNil(o.ConsumedMicroUsd) {
return true
}
return false
}
// SetConsumedMicroUsd gets a reference to the given int64 and assigns it to the ConsumedMicroUsd field.
func (o *AgentSpendView) SetConsumedMicroUsd(v int64) {
o.ConsumedMicroUsd = &v
}
// GetMaxTaskMicroUsd returns the MaxTaskMicroUsd field value if set, zero value otherwise.
func (o *AgentSpendView) GetMaxTaskMicroUsd() int64 {
if o == nil || IsNil(o.MaxTaskMicroUsd) {
var ret int64
return ret
}
return *o.MaxTaskMicroUsd
}
// GetMaxTaskMicroUsdOk returns a tuple with the MaxTaskMicroUsd field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetMaxTaskMicroUsdOk() (*int64, bool) {
if o == nil || IsNil(o.MaxTaskMicroUsd) {
return nil, false
}
return o.MaxTaskMicroUsd, true
}
// HasMaxTaskMicroUsd returns a boolean if a field has been set.
func (o *AgentSpendView) HasMaxTaskMicroUsd() bool {
if o != nil && !IsNil(o.MaxTaskMicroUsd) {
return true
}
return false
}
// SetMaxTaskMicroUsd gets a reference to the given int64 and assigns it to the MaxTaskMicroUsd field.
func (o *AgentSpendView) SetMaxTaskMicroUsd(v int64) {
o.MaxTaskMicroUsd = &v
}
// GetPeriod returns the Period field value if set, zero value otherwise.
func (o *AgentSpendView) GetPeriod() string {
if o == nil || IsNil(o.Period) {
var ret string
return ret
}
return *o.Period
}
// GetPeriodOk returns a tuple with the Period field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetPeriodOk() (*string, bool) {
if o == nil || IsNil(o.Period) {
return nil, false
}
return o.Period, true
}
// HasPeriod returns a boolean if a field has been set.
func (o *AgentSpendView) HasPeriod() bool {
if o != nil && !IsNil(o.Period) {
return true
}
return false
}
// SetPeriod gets a reference to the given string and assigns it to the Period field.
func (o *AgentSpendView) SetPeriod(v string) {
o.Period = &v
}
// GetPeriodStartedAt returns the PeriodStartedAt field value if set, zero value otherwise.
func (o *AgentSpendView) GetPeriodStartedAt() int64 {
if o == nil || IsNil(o.PeriodStartedAt) {
var ret int64
return ret
}
return *o.PeriodStartedAt
}
// GetPeriodStartedAtOk returns a tuple with the PeriodStartedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetPeriodStartedAtOk() (*int64, bool) {
if o == nil || IsNil(o.PeriodStartedAt) {
return nil, false
}
return o.PeriodStartedAt, true
}
// HasPeriodStartedAt returns a boolean if a field has been set.
func (o *AgentSpendView) HasPeriodStartedAt() bool {
if o != nil && !IsNil(o.PeriodStartedAt) {
return true
}
return false
}
// SetPeriodStartedAt gets a reference to the given int64 and assigns it to the PeriodStartedAt field.
func (o *AgentSpendView) SetPeriodStartedAt(v int64) {
o.PeriodStartedAt = &v
}
// GetRef returns the Ref field value if set, zero value otherwise.
func (o *AgentSpendView) GetRef() string {
if o == nil || IsNil(o.Ref) {
var ret string
return ret
}
return *o.Ref
}
// GetRefOk returns a tuple with the Ref field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetRefOk() (*string, bool) {
if o == nil || IsNil(o.Ref) {
return nil, false
}
return o.Ref, true
}
// HasRef returns a boolean if a field has been set.
func (o *AgentSpendView) HasRef() bool {
if o != nil && !IsNil(o.Ref) {
return true
}
return false
}
// SetRef gets a reference to the given string and assigns it to the Ref field.
func (o *AgentSpendView) SetRef(v string) {
o.Ref = &v
}
// GetRemainingMicroUsd returns the RemainingMicroUsd field value if set, zero value otherwise.
func (o *AgentSpendView) GetRemainingMicroUsd() int64 {
if o == nil || IsNil(o.RemainingMicroUsd) {
var ret int64
return ret
}
return *o.RemainingMicroUsd
}
// GetRemainingMicroUsdOk returns a tuple with the RemainingMicroUsd field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AgentSpendView) GetRemainingMicroUsdOk() (*int64, bool) {
if o == nil || IsNil(o.RemainingMicroUsd) {
return nil, false
}
return o.RemainingMicroUsd, true
}
// HasRemainingMicroUsd returns a boolean if a field has been set.
func (o *AgentSpendView) HasRemainingMicroUsd() bool {
if o != nil && !IsNil(o.RemainingMicroUsd) {
return true
}
return false
}
// SetRemainingMicroUsd gets a reference to the given int64 and assigns it to the RemainingMicroUsd field.
func (o *AgentSpendView) SetRemainingMicroUsd(v int64) {
o.RemainingMicroUsd = &v
}
func (o AgentSpendView) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AgentSpendView) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.ByComponent) {
toSerialize["by_component"] = o.ByComponent
}
if !IsNil(o.CapMicroUsd) {
toSerialize["cap_micro_usd"] = o.CapMicroUsd
}
if !IsNil(o.ConsumedMicroUsd) {
toSerialize["consumed_micro_usd"] = o.ConsumedMicroUsd
}
if !IsNil(o.MaxTaskMicroUsd) {
toSerialize["max_task_micro_usd"] = o.MaxTaskMicroUsd
}
if !IsNil(o.Period) {
toSerialize["period"] = o.Period
}
if !IsNil(o.PeriodStartedAt) {
toSerialize["period_started_at"] = o.PeriodStartedAt
}
if !IsNil(o.Ref) {
toSerialize["ref"] = o.Ref
}
if !IsNil(o.RemainingMicroUsd) {
toSerialize["remaining_micro_usd"] = o.RemainingMicroUsd
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AgentSpendView) UnmarshalJSON(data []byte) (err error) {
varAgentSpendView := _AgentSpendView{}
err = json.Unmarshal(data, &varAgentSpendView)
if err != nil {
return err
}
*o = AgentSpendView(varAgentSpendView)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "by_component")
delete(additionalProperties, "cap_micro_usd")
delete(additionalProperties, "consumed_micro_usd")
delete(additionalProperties, "max_task_micro_usd")
delete(additionalProperties, "period")
delete(additionalProperties, "period_started_at")
delete(additionalProperties, "ref")
delete(additionalProperties, "remaining_micro_usd")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAgentSpendView struct {
value *AgentSpendView
isSet bool
}
func (v NullableAgentSpendView) Get() *AgentSpendView {
return v.value
}
func (v *NullableAgentSpendView) Set(val *AgentSpendView) {
v.value = val
v.isSet = true
}
func (v NullableAgentSpendView) IsSet() bool {
return v.isSet
}
func (v *NullableAgentSpendView) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAgentSpendView(val *AgentSpendView) *NullableAgentSpendView {
return &NullableAgentSpendView{value: val, isSet: true}
}
func (v NullableAgentSpendView) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAgentSpendView) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}