Files
sdk/model_usage_spend_point.go

193 lines
4.8 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 UsageSpendPoint type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UsageSpendPoint{}
// UsageSpendPoint struct for UsageSpendPoint
type UsageSpendPoint struct {
// Cents is the consumption recorded in that bucket, in US cents.
Cents *int64 `json:"cents,omitempty"`
// T is the bucket's start instant, RFC3339 UTC. Buckets are gap-filled, so a window with no spend still has its points.
T *string `json:"t,omitempty"`
AdditionalProperties map[string]interface{}
}
type _UsageSpendPoint UsageSpendPoint
// NewUsageSpendPoint instantiates a new UsageSpendPoint 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 NewUsageSpendPoint() *UsageSpendPoint {
this := UsageSpendPoint{}
return &this
}
// NewUsageSpendPointWithDefaults instantiates a new UsageSpendPoint 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 NewUsageSpendPointWithDefaults() *UsageSpendPoint {
this := UsageSpendPoint{}
return &this
}
// GetCents returns the Cents field value if set, zero value otherwise.
func (o *UsageSpendPoint) GetCents() int64 {
if o == nil || IsNil(o.Cents) {
var ret int64
return ret
}
return *o.Cents
}
// GetCentsOk returns a tuple with the Cents field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageSpendPoint) GetCentsOk() (*int64, bool) {
if o == nil || IsNil(o.Cents) {
return nil, false
}
return o.Cents, true
}
// HasCents returns a boolean if a field has been set.
func (o *UsageSpendPoint) HasCents() bool {
if o != nil && !IsNil(o.Cents) {
return true
}
return false
}
// SetCents gets a reference to the given int64 and assigns it to the Cents field.
func (o *UsageSpendPoint) SetCents(v int64) {
o.Cents = &v
}
// GetT returns the T field value if set, zero value otherwise.
func (o *UsageSpendPoint) GetT() string {
if o == nil || IsNil(o.T) {
var ret string
return ret
}
return *o.T
}
// GetTOk returns a tuple with the T field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UsageSpendPoint) GetTOk() (*string, bool) {
if o == nil || IsNil(o.T) {
return nil, false
}
return o.T, true
}
// HasT returns a boolean if a field has been set.
func (o *UsageSpendPoint) HasT() bool {
if o != nil && !IsNil(o.T) {
return true
}
return false
}
// SetT gets a reference to the given string and assigns it to the T field.
func (o *UsageSpendPoint) SetT(v string) {
o.T = &v
}
func (o UsageSpendPoint) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o UsageSpendPoint) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Cents) {
toSerialize["cents"] = o.Cents
}
if !IsNil(o.T) {
toSerialize["t"] = o.T
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *UsageSpendPoint) UnmarshalJSON(data []byte) (err error) {
varUsageSpendPoint := _UsageSpendPoint{}
err = json.Unmarshal(data, &varUsageSpendPoint)
if err != nil {
return err
}
*o = UsageSpendPoint(varUsageSpendPoint)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "cents")
delete(additionalProperties, "t")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableUsageSpendPoint struct {
value *UsageSpendPoint
isSet bool
}
func (v NullableUsageSpendPoint) Get() *UsageSpendPoint {
return v.value
}
func (v *NullableUsageSpendPoint) Set(val *UsageSpendPoint) {
v.value = val
v.isSet = true
}
func (v NullableUsageSpendPoint) IsSet() bool {
return v.isSet
}
func (v *NullableUsageSpendPoint) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUsageSpendPoint(val *UsageSpendPoint) *NullableUsageSpendPoint {
return &NullableUsageSpendPoint{value: val, isSet: true}
}
func (v NullableUsageSpendPoint) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUsageSpendPoint) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}