Files
sdk/model_billing_usage_report.go

345 lines
9.5 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 BillingUsageReport type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &BillingUsageReport{}
// BillingUsageReport struct for BillingUsageReport
type BillingUsageReport struct {
// Amount is what the act costs, as an exact decimal in USD. It must be greater than zero.
Amount *BillingMoney `json:"amount,omitempty"`
// ID names the act, chosen by the reporting application and stable across its retries: the ledger debits one act once. At most 128 printable characters, no whitespace. Reusing an ID for a different amount is a 409.
Id *string `json:"id,omitempty"`
// Model names the unit the amount prices (a machine size, a model id), and is recorded with the debit.
Model *string `json:"model,omitempty"`
// Org is the organization this usage is billed to. It must be the org the token acts in — the application's own, or one that granted it membership and is selected with X-Org-Id — and any other is refused before money moves.
Org *string `json:"org,omitempty"`
// Project attributes the debit to one project of the org. Empty is the org's default project.
Project *string `json:"project,omitempty"`
// Service scopes the debit for spend caps and attributes it to a product, as a lowercase slug. Empty takes the reporting application's name.
Service *string `json:"service,omitempty"`
AdditionalProperties map[string]interface{}
}
type _BillingUsageReport BillingUsageReport
// NewBillingUsageReport instantiates a new BillingUsageReport 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 NewBillingUsageReport() *BillingUsageReport {
this := BillingUsageReport{}
return &this
}
// NewBillingUsageReportWithDefaults instantiates a new BillingUsageReport 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 NewBillingUsageReportWithDefaults() *BillingUsageReport {
this := BillingUsageReport{}
return &this
}
// GetAmount returns the Amount field value if set, zero value otherwise.
func (o *BillingUsageReport) GetAmount() BillingMoney {
if o == nil || IsNil(o.Amount) {
var ret BillingMoney
return ret
}
return *o.Amount
}
// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetAmountOk() (*BillingMoney, bool) {
if o == nil || IsNil(o.Amount) {
return nil, false
}
return o.Amount, true
}
// HasAmount returns a boolean if a field has been set.
func (o *BillingUsageReport) HasAmount() bool {
if o != nil && !IsNil(o.Amount) {
return true
}
return false
}
// SetAmount gets a reference to the given BillingMoney and assigns it to the Amount field.
func (o *BillingUsageReport) SetAmount(v BillingMoney) {
o.Amount = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *BillingUsageReport) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *BillingUsageReport) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *BillingUsageReport) SetId(v string) {
o.Id = &v
}
// GetModel returns the Model field value if set, zero value otherwise.
func (o *BillingUsageReport) GetModel() string {
if o == nil || IsNil(o.Model) {
var ret string
return ret
}
return *o.Model
}
// GetModelOk returns a tuple with the Model field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetModelOk() (*string, bool) {
if o == nil || IsNil(o.Model) {
return nil, false
}
return o.Model, true
}
// HasModel returns a boolean if a field has been set.
func (o *BillingUsageReport) HasModel() bool {
if o != nil && !IsNil(o.Model) {
return true
}
return false
}
// SetModel gets a reference to the given string and assigns it to the Model field.
func (o *BillingUsageReport) SetModel(v string) {
o.Model = &v
}
// GetOrg returns the Org field value if set, zero value otherwise.
func (o *BillingUsageReport) GetOrg() string {
if o == nil || IsNil(o.Org) {
var ret string
return ret
}
return *o.Org
}
// GetOrgOk returns a tuple with the Org field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetOrgOk() (*string, bool) {
if o == nil || IsNil(o.Org) {
return nil, false
}
return o.Org, true
}
// HasOrg returns a boolean if a field has been set.
func (o *BillingUsageReport) HasOrg() bool {
if o != nil && !IsNil(o.Org) {
return true
}
return false
}
// SetOrg gets a reference to the given string and assigns it to the Org field.
func (o *BillingUsageReport) SetOrg(v string) {
o.Org = &v
}
// GetProject returns the Project field value if set, zero value otherwise.
func (o *BillingUsageReport) GetProject() string {
if o == nil || IsNil(o.Project) {
var ret string
return ret
}
return *o.Project
}
// GetProjectOk returns a tuple with the Project field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetProjectOk() (*string, bool) {
if o == nil || IsNil(o.Project) {
return nil, false
}
return o.Project, true
}
// HasProject returns a boolean if a field has been set.
func (o *BillingUsageReport) HasProject() bool {
if o != nil && !IsNil(o.Project) {
return true
}
return false
}
// SetProject gets a reference to the given string and assigns it to the Project field.
func (o *BillingUsageReport) SetProject(v string) {
o.Project = &v
}
// GetService returns the Service field value if set, zero value otherwise.
func (o *BillingUsageReport) GetService() string {
if o == nil || IsNil(o.Service) {
var ret string
return ret
}
return *o.Service
}
// GetServiceOk returns a tuple with the Service field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *BillingUsageReport) GetServiceOk() (*string, bool) {
if o == nil || IsNil(o.Service) {
return nil, false
}
return o.Service, true
}
// HasService returns a boolean if a field has been set.
func (o *BillingUsageReport) HasService() bool {
if o != nil && !IsNil(o.Service) {
return true
}
return false
}
// SetService gets a reference to the given string and assigns it to the Service field.
func (o *BillingUsageReport) SetService(v string) {
o.Service = &v
}
func (o BillingUsageReport) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o BillingUsageReport) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Amount) {
toSerialize["amount"] = o.Amount
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Model) {
toSerialize["model"] = o.Model
}
if !IsNil(o.Org) {
toSerialize["org"] = o.Org
}
if !IsNil(o.Project) {
toSerialize["project"] = o.Project
}
if !IsNil(o.Service) {
toSerialize["service"] = o.Service
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *BillingUsageReport) UnmarshalJSON(data []byte) (err error) {
varBillingUsageReport := _BillingUsageReport{}
err = json.Unmarshal(data, &varBillingUsageReport)
if err != nil {
return err
}
*o = BillingUsageReport(varBillingUsageReport)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "amount")
delete(additionalProperties, "id")
delete(additionalProperties, "model")
delete(additionalProperties, "org")
delete(additionalProperties, "project")
delete(additionalProperties, "service")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableBillingUsageReport struct {
value *BillingUsageReport
isSet bool
}
func (v NullableBillingUsageReport) Get() *BillingUsageReport {
return v.value
}
func (v *NullableBillingUsageReport) Set(val *BillingUsageReport) {
v.value = val
v.isSet = true
}
func (v NullableBillingUsageReport) IsSet() bool {
return v.isSet
}
func (v *NullableBillingUsageReport) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableBillingUsageReport(val *BillingUsageReport) *NullableBillingUsageReport {
return &NullableBillingUsageReport{value: val, isSet: true}
}
func (v NullableBillingUsageReport) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableBillingUsageReport) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}