Files
sdk/model_usage_total_view.go

497 lines
13 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
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 UsageTotalView type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UsageTotalView{}
// UsageTotalView struct for UsageTotalView
type UsageTotalView struct {
// Confidence says how much the counters mean; a percentage-only meter leaves them at zero.
Confidence *string `json:"confidence,omitempty"`
// CostCents is the row's cost in US cents. For an \"account\" row this is the PROVIDER's own charge, not a Hanzo one.
CostCents *int64 `json:"costCents,omitempty"`
// Provider is the upstream the usage was measured against.
Provider *string `json:"provider,omitempty"`
// Requests is how many requests the row covers.
Requests *int64 `json:"requests,omitempty"`
// Scope is whose row it is: \"user\" for the caller's own linked accounts, \"org\" for the whole tenant's Hanzo-routed usage.
Scope *string `json:"scope,omitempty"`
// Source is where the row came from: \"account\" is the provider's own meter on the caller's linked account, \"hanzo\" is Hanzo-routed inference. The two are never summed.
Source *string `json:"source,omitempty"`
// Tokens is the total tokens the row covers.
Tokens *int64 `json:"tokens,omitempty"`
// UsedPct is how much of a plan window the row consumed, 0–100. It is a share, never money.
UsedPct *float64 `json:"usedPct,omitempty"`
// Window is the meter window class the row rolls up, when it has one.
Window *string `json:"window,omitempty"`
// Windows is how many window instances rolled up into the row.
Windows *int64 `json:"windows,omitempty"`
AdditionalProperties map[string]interface{}
}
type _UsageTotalView UsageTotalView
// NewUsageTotalView instantiates a new UsageTotalView 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 NewUsageTotalView() *UsageTotalView {
this := UsageTotalView{}
return &this
}
// NewUsageTotalViewWithDefaults instantiates a new UsageTotalView 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 NewUsageTotalViewWithDefaults() *UsageTotalView {
this := UsageTotalView{}
return &this
}
// GetConfidence returns the Confidence field value if set, zero value otherwise.
func (o *UsageTotalView) GetConfidence() string {
if o == nil || IsNil(o.Confidence) {
var ret string
return ret
}
return *o.Confidence
}
// GetConfidenceOk returns a tuple with the Confidence field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetConfidenceOk() (*string, bool) {
if o == nil || IsNil(o.Confidence) {
return nil, false
}
return o.Confidence, true
}
// HasConfidence returns a boolean if a field has been set.
func (o *UsageTotalView) HasConfidence() bool {
if o != nil && !IsNil(o.Confidence) {
return true
}
return false
}
// SetConfidence gets a reference to the given string and assigns it to the Confidence field.
func (o *UsageTotalView) SetConfidence(v string) {
o.Confidence = &v
}
// GetCostCents returns the CostCents field value if set, zero value otherwise.
func (o *UsageTotalView) GetCostCents() int64 {
if o == nil || IsNil(o.CostCents) {
var ret int64
return ret
}
return *o.CostCents
}
// GetCostCentsOk returns a tuple with the CostCents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetCostCentsOk() (*int64, bool) {
if o == nil || IsNil(o.CostCents) {
return nil, false
}
return o.CostCents, true
}
// HasCostCents returns a boolean if a field has been set.
func (o *UsageTotalView) HasCostCents() bool {
if o != nil && !IsNil(o.CostCents) {
return true
}
return false
}
// SetCostCents gets a reference to the given int64 and assigns it to the CostCents field.
func (o *UsageTotalView) SetCostCents(v int64) {
o.CostCents = &v
}
// GetProvider returns the Provider field value if set, zero value otherwise.
func (o *UsageTotalView) GetProvider() string {
if o == nil || IsNil(o.Provider) {
var ret string
return ret
}
return *o.Provider
}
// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetProviderOk() (*string, bool) {
if o == nil || IsNil(o.Provider) {
return nil, false
}
return o.Provider, true
}
// HasProvider returns a boolean if a field has been set.
func (o *UsageTotalView) HasProvider() bool {
if o != nil && !IsNil(o.Provider) {
return true
}
return false
}
// SetProvider gets a reference to the given string and assigns it to the Provider field.
func (o *UsageTotalView) SetProvider(v string) {
o.Provider = &v
}
// GetRequests returns the Requests field value if set, zero value otherwise.
func (o *UsageTotalView) GetRequests() int64 {
if o == nil || IsNil(o.Requests) {
var ret int64
return ret
}
return *o.Requests
}
// GetRequestsOk returns a tuple with the Requests field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetRequestsOk() (*int64, bool) {
if o == nil || IsNil(o.Requests) {
return nil, false
}
return o.Requests, true
}
// HasRequests returns a boolean if a field has been set.
func (o *UsageTotalView) HasRequests() bool {
if o != nil && !IsNil(o.Requests) {
return true
}
return false
}
// SetRequests gets a reference to the given int64 and assigns it to the Requests field.
func (o *UsageTotalView) SetRequests(v int64) {
o.Requests = &v
}
// GetScope returns the Scope field value if set, zero value otherwise.
func (o *UsageTotalView) GetScope() string {
if o == nil || IsNil(o.Scope) {
var ret string
return ret
}
return *o.Scope
}
// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetScopeOk() (*string, bool) {
if o == nil || IsNil(o.Scope) {
return nil, false
}
return o.Scope, true
}
// HasScope returns a boolean if a field has been set.
func (o *UsageTotalView) HasScope() bool {
if o != nil && !IsNil(o.Scope) {
return true
}
return false
}
// SetScope gets a reference to the given string and assigns it to the Scope field.
func (o *UsageTotalView) SetScope(v string) {
o.Scope = &v
}
// GetSource returns the Source field value if set, zero value otherwise.
func (o *UsageTotalView) GetSource() string {
if o == nil || IsNil(o.Source) {
var ret string
return ret
}
return *o.Source
}
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetSourceOk() (*string, bool) {
if o == nil || IsNil(o.Source) {
return nil, false
}
return o.Source, true
}
// HasSource returns a boolean if a field has been set.
func (o *UsageTotalView) HasSource() bool {
if o != nil && !IsNil(o.Source) {
return true
}
return false
}
// SetSource gets a reference to the given string and assigns it to the Source field.
func (o *UsageTotalView) SetSource(v string) {
o.Source = &v
}
// GetTokens returns the Tokens field value if set, zero value otherwise.
func (o *UsageTotalView) GetTokens() int64 {
if o == nil || IsNil(o.Tokens) {
var ret int64
return ret
}
return *o.Tokens
}
// GetTokensOk returns a tuple with the Tokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetTokensOk() (*int64, bool) {
if o == nil || IsNil(o.Tokens) {
return nil, false
}
return o.Tokens, true
}
// HasTokens returns a boolean if a field has been set.
func (o *UsageTotalView) HasTokens() bool {
if o != nil && !IsNil(o.Tokens) {
return true
}
return false
}
// SetTokens gets a reference to the given int64 and assigns it to the Tokens field.
func (o *UsageTotalView) SetTokens(v int64) {
o.Tokens = &v
}
// GetUsedPct returns the UsedPct field value if set, zero value otherwise.
func (o *UsageTotalView) GetUsedPct() float64 {
if o == nil || IsNil(o.UsedPct) {
var ret float64
return ret
}
return *o.UsedPct
}
// GetUsedPctOk returns a tuple with the UsedPct field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetUsedPctOk() (*float64, bool) {
if o == nil || IsNil(o.UsedPct) {
return nil, false
}
return o.UsedPct, true
}
// HasUsedPct returns a boolean if a field has been set.
func (o *UsageTotalView) HasUsedPct() bool {
if o != nil && !IsNil(o.UsedPct) {
return true
}
return false
}
// SetUsedPct gets a reference to the given float64 and assigns it to the UsedPct field.
func (o *UsageTotalView) SetUsedPct(v float64) {
o.UsedPct = &v
}
// GetWindow returns the Window field value if set, zero value otherwise.
func (o *UsageTotalView) GetWindow() string {
if o == nil || IsNil(o.Window) {
var ret string
return ret
}
return *o.Window
}
// GetWindowOk returns a tuple with the Window field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetWindowOk() (*string, bool) {
if o == nil || IsNil(o.Window) {
return nil, false
}
return o.Window, true
}
// HasWindow returns a boolean if a field has been set.
func (o *UsageTotalView) HasWindow() bool {
if o != nil && !IsNil(o.Window) {
return true
}
return false
}
// SetWindow gets a reference to the given string and assigns it to the Window field.
func (o *UsageTotalView) SetWindow(v string) {
o.Window = &v
}
// GetWindows returns the Windows field value if set, zero value otherwise.
func (o *UsageTotalView) GetWindows() int64 {
if o == nil || IsNil(o.Windows) {
var ret int64
return ret
}
return *o.Windows
}
// GetWindowsOk returns a tuple with the Windows field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageTotalView) GetWindowsOk() (*int64, bool) {
if o == nil || IsNil(o.Windows) {
return nil, false
}
return o.Windows, true
}
// HasWindows returns a boolean if a field has been set.
func (o *UsageTotalView) HasWindows() bool {
if o != nil && !IsNil(o.Windows) {
return true
}
return false
}
// SetWindows gets a reference to the given int64 and assigns it to the Windows field.
func (o *UsageTotalView) SetWindows(v int64) {
o.Windows = &v
}
func (o UsageTotalView) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o UsageTotalView) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Confidence) {
toSerialize["confidence"] = o.Confidence
}
if !IsNil(o.CostCents) {
toSerialize["costCents"] = o.CostCents
}
if !IsNil(o.Provider) {
toSerialize["provider"] = o.Provider
}
if !IsNil(o.Requests) {
toSerialize["requests"] = o.Requests
}
if !IsNil(o.Scope) {
toSerialize["scope"] = o.Scope
}
if !IsNil(o.Source) {
toSerialize["source"] = o.Source
}
if !IsNil(o.Tokens) {
toSerialize["tokens"] = o.Tokens
}
if !IsNil(o.UsedPct) {
toSerialize["usedPct"] = o.UsedPct
}
if !IsNil(o.Window) {
toSerialize["window"] = o.Window
}
if !IsNil(o.Windows) {
toSerialize["windows"] = o.Windows
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *UsageTotalView) UnmarshalJSON(data []byte) (err error) {
varUsageTotalView := _UsageTotalView{}
err = json.Unmarshal(data, &varUsageTotalView)
if err != nil {
return err
}
*o = UsageTotalView(varUsageTotalView)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "confidence")
delete(additionalProperties, "costCents")
delete(additionalProperties, "provider")
delete(additionalProperties, "requests")
delete(additionalProperties, "scope")
delete(additionalProperties, "source")
delete(additionalProperties, "tokens")
delete(additionalProperties, "usedPct")
delete(additionalProperties, "window")
delete(additionalProperties, "windows")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableUsageTotalView struct {
value *UsageTotalView
isSet bool
}
func (v NullableUsageTotalView) Get() *UsageTotalView {
return v.value
}
func (v *NullableUsageTotalView) Set(val *UsageTotalView) {
v.value = val
v.isSet = true
}
func (v NullableUsageTotalView) IsSet() bool {
return v.isSet
}
func (v *NullableUsageTotalView) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUsageTotalView(val *UsageTotalView) *NullableUsageTotalView {
return &NullableUsageTotalView{value: val, isSet: true}
}
func (v NullableUsageTotalView) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUsageTotalView) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}