Files
sdk/model_usage_accounts.go

231 lines
6.1 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 UsageAccounts type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UsageAccounts{}
// UsageAccounts struct for UsageAccounts
type UsageAccounts struct {
// Account is the state of the caller's own linked-account side.
Account *UsageSourceState `json:"account,omitempty"`
// Hanzo is the state of the org's Hanzo-routed side.
Hanzo *UsageSourceState `json:"hanzo,omitempty"`
// Rows is the two row sets CONCATENATED, never summed — each row says which side it came from. A percent is not money and a provider's own spend is not a Hanzo charge, so adding them would produce a number that means nothing.
Rows []UsageTotalView `json:"rows,omitempty"`
AdditionalProperties map[string]interface{}
}
type _UsageAccounts UsageAccounts
// NewUsageAccounts instantiates a new UsageAccounts 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 NewUsageAccounts() *UsageAccounts {
this := UsageAccounts{}
return &this
}
// NewUsageAccountsWithDefaults instantiates a new UsageAccounts 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 NewUsageAccountsWithDefaults() *UsageAccounts {
this := UsageAccounts{}
return &this
}
// GetAccount returns the Account field value if set, zero value otherwise.
func (o *UsageAccounts) GetAccount() UsageSourceState {
if o == nil || IsNil(o.Account) {
var ret UsageSourceState
return ret
}
return *o.Account
}
// GetAccountOk returns a tuple with the Account field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageAccounts) GetAccountOk() (*UsageSourceState, bool) {
if o == nil || IsNil(o.Account) {
return nil, false
}
return o.Account, true
}
// HasAccount returns a boolean if a field has been set.
func (o *UsageAccounts) HasAccount() bool {
if o != nil && !IsNil(o.Account) {
return true
}
return false
}
// SetAccount gets a reference to the given UsageSourceState and assigns it to the Account field.
func (o *UsageAccounts) SetAccount(v UsageSourceState) {
o.Account = &v
}
// GetHanzo returns the Hanzo field value if set, zero value otherwise.
func (o *UsageAccounts) GetHanzo() UsageSourceState {
if o == nil || IsNil(o.Hanzo) {
var ret UsageSourceState
return ret
}
return *o.Hanzo
}
// GetHanzoOk returns a tuple with the Hanzo field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageAccounts) GetHanzoOk() (*UsageSourceState, bool) {
if o == nil || IsNil(o.Hanzo) {
return nil, false
}
return o.Hanzo, true
}
// HasHanzo returns a boolean if a field has been set.
func (o *UsageAccounts) HasHanzo() bool {
if o != nil && !IsNil(o.Hanzo) {
return true
}
return false
}
// SetHanzo gets a reference to the given UsageSourceState and assigns it to the Hanzo field.
func (o *UsageAccounts) SetHanzo(v UsageSourceState) {
o.Hanzo = &v
}
// GetRows returns the Rows field value if set, zero value otherwise.
func (o *UsageAccounts) GetRows() []UsageTotalView {
if o == nil || IsNil(o.Rows) {
var ret []UsageTotalView
return ret
}
return o.Rows
}
// GetRowsOk returns a tuple with the Rows field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageAccounts) GetRowsOk() ([]UsageTotalView, bool) {
if o == nil || IsNil(o.Rows) {
return nil, false
}
return o.Rows, true
}
// HasRows returns a boolean if a field has been set.
func (o *UsageAccounts) HasRows() bool {
if o != nil && !IsNil(o.Rows) {
return true
}
return false
}
// SetRows gets a reference to the given []UsageTotalView and assigns it to the Rows field.
func (o *UsageAccounts) SetRows(v []UsageTotalView) {
o.Rows = v
}
func (o UsageAccounts) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o UsageAccounts) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Account) {
toSerialize["account"] = o.Account
}
if !IsNil(o.Hanzo) {
toSerialize["hanzo"] = o.Hanzo
}
if !IsNil(o.Rows) {
toSerialize["rows"] = o.Rows
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *UsageAccounts) UnmarshalJSON(data []byte) (err error) {
varUsageAccounts := _UsageAccounts{}
err = json.Unmarshal(data, &varUsageAccounts)
if err != nil {
return err
}
*o = UsageAccounts(varUsageAccounts)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "account")
delete(additionalProperties, "hanzo")
delete(additionalProperties, "rows")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableUsageAccounts struct {
value *UsageAccounts
isSet bool
}
func (v NullableUsageAccounts) Get() *UsageAccounts {
return v.value
}
func (v *NullableUsageAccounts) Set(val *UsageAccounts) {
v.value = val
v.isSet = true
}
func (v NullableUsageAccounts) IsSet() bool {
return v.isSet
}
func (v *NullableUsageAccounts) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUsageAccounts(val *UsageAccounts) *NullableUsageAccounts {
return &NullableUsageAccounts{value: val, isSet: true}
}
func (v NullableUsageAccounts) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUsageAccounts) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}