Files
sdk/model_account_key_edit.go

345 lines
8.7 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 AccountKeyEdit type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AccountKeyEdit{}
// AccountKeyEdit struct for AccountKeyEdit
type AccountKeyEdit struct {
// Budget replaces the key's spend caps, in cents; a zero drops that cap.
Budget *AccountKeyBudget `json:"budget,omitempty"`
// Expires replaces when the key stops working, RFC 3339. An empty string means never.
Expires *string `json:"expires,omitempty"`
// ID is the key to edit, from the path.
Id *string `json:"id,omitempty"`
// Limit replaces what the key may reach. An empty list makes it unrestricted.
Limit []string `json:"limit,omitempty"`
// Name relabels the key.
Name *string `json:"name,omitempty"`
// Rate replaces the key's requests a minute; zero drops the limit.
Rate *int64 `json:"rate,omitempty"`
AdditionalProperties map[string]interface{}
}
type _AccountKeyEdit AccountKeyEdit
// NewAccountKeyEdit instantiates a new AccountKeyEdit 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 NewAccountKeyEdit() *AccountKeyEdit {
this := AccountKeyEdit{}
return &this
}
// NewAccountKeyEditWithDefaults instantiates a new AccountKeyEdit 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 NewAccountKeyEditWithDefaults() *AccountKeyEdit {
this := AccountKeyEdit{}
return &this
}
// GetBudget returns the Budget field value if set, zero value otherwise.
func (o *AccountKeyEdit) GetBudget() AccountKeyBudget {
if o == nil || IsNil(o.Budget) {
var ret AccountKeyBudget
return ret
}
return *o.Budget
}
// GetBudgetOk returns a tuple with the Budget field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountKeyEdit) GetBudgetOk() (*AccountKeyBudget, bool) {
if o == nil || IsNil(o.Budget) {
return nil, false
}
return o.Budget, true
}
// HasBudget returns a boolean if a field has been set.
func (o *AccountKeyEdit) HasBudget() bool {
if o != nil && !IsNil(o.Budget) {
return true
}
return false
}
// SetBudget gets a reference to the given AccountKeyBudget and assigns it to the Budget field.
func (o *AccountKeyEdit) SetBudget(v AccountKeyBudget) {
o.Budget = &v
}
// GetExpires returns the Expires field value if set, zero value otherwise.
func (o *AccountKeyEdit) GetExpires() string {
if o == nil || IsNil(o.Expires) {
var ret string
return ret
}
return *o.Expires
}
// GetExpiresOk returns a tuple with the Expires field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountKeyEdit) GetExpiresOk() (*string, bool) {
if o == nil || IsNil(o.Expires) {
return nil, false
}
return o.Expires, true
}
// HasExpires returns a boolean if a field has been set.
func (o *AccountKeyEdit) HasExpires() bool {
if o != nil && !IsNil(o.Expires) {
return true
}
return false
}
// SetExpires gets a reference to the given string and assigns it to the Expires field.
func (o *AccountKeyEdit) SetExpires(v string) {
o.Expires = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *AccountKeyEdit) 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 *AccountKeyEdit) 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 *AccountKeyEdit) 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 *AccountKeyEdit) SetId(v string) {
o.Id = &v
}
// GetLimit returns the Limit field value if set, zero value otherwise.
func (o *AccountKeyEdit) GetLimit() []string {
if o == nil || IsNil(o.Limit) {
var ret []string
return ret
}
return o.Limit
}
// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountKeyEdit) GetLimitOk() ([]string, bool) {
if o == nil || IsNil(o.Limit) {
return nil, false
}
return o.Limit, true
}
// HasLimit returns a boolean if a field has been set.
func (o *AccountKeyEdit) HasLimit() bool {
if o != nil && !IsNil(o.Limit) {
return true
}
return false
}
// SetLimit gets a reference to the given []string and assigns it to the Limit field.
func (o *AccountKeyEdit) SetLimit(v []string) {
o.Limit = v
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *AccountKeyEdit) GetName() string {
if o == nil || IsNil(o.Name) {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountKeyEdit) GetNameOk() (*string, bool) {
if o == nil || IsNil(o.Name) {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *AccountKeyEdit) HasName() bool {
if o != nil && !IsNil(o.Name) {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *AccountKeyEdit) SetName(v string) {
o.Name = &v
}
// GetRate returns the Rate field value if set, zero value otherwise.
func (o *AccountKeyEdit) GetRate() int64 {
if o == nil || IsNil(o.Rate) {
var ret int64
return ret
}
return *o.Rate
}
// GetRateOk returns a tuple with the Rate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccountKeyEdit) GetRateOk() (*int64, bool) {
if o == nil || IsNil(o.Rate) {
return nil, false
}
return o.Rate, true
}
// HasRate returns a boolean if a field has been set.
func (o *AccountKeyEdit) HasRate() bool {
if o != nil && !IsNil(o.Rate) {
return true
}
return false
}
// SetRate gets a reference to the given int64 and assigns it to the Rate field.
func (o *AccountKeyEdit) SetRate(v int64) {
o.Rate = &v
}
func (o AccountKeyEdit) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AccountKeyEdit) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Budget) {
toSerialize["budget"] = o.Budget
}
if !IsNil(o.Expires) {
toSerialize["expires"] = o.Expires
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Limit) {
toSerialize["limit"] = o.Limit
}
if !IsNil(o.Name) {
toSerialize["name"] = o.Name
}
if !IsNil(o.Rate) {
toSerialize["rate"] = o.Rate
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *AccountKeyEdit) UnmarshalJSON(data []byte) (err error) {
varAccountKeyEdit := _AccountKeyEdit{}
err = json.Unmarshal(data, &varAccountKeyEdit)
if err != nil {
return err
}
*o = AccountKeyEdit(varAccountKeyEdit)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "budget")
delete(additionalProperties, "expires")
delete(additionalProperties, "id")
delete(additionalProperties, "limit")
delete(additionalProperties, "name")
delete(additionalProperties, "rate")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableAccountKeyEdit struct {
value *AccountKeyEdit
isSet bool
}
func (v NullableAccountKeyEdit) Get() *AccountKeyEdit {
return v.value
}
func (v *NullableAccountKeyEdit) Set(val *AccountKeyEdit) {
v.value = val
v.isSet = true
}
func (v NullableAccountKeyEdit) IsSet() bool {
return v.isSet
}
func (v *NullableAccountKeyEdit) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccountKeyEdit(val *AccountKeyEdit) *NullableAccountKeyEdit {
return &NullableAccountKeyEdit{value: val, isSet: true}
}
func (v NullableAccountKeyEdit) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccountKeyEdit) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}