Files
sdk/model_traffic_window.go

228 lines
5.6 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 TrafficWindow type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrafficWindow{}
// TrafficWindow struct for TrafficWindow
type TrafficWindow struct {
Minutes *int32 `json:"minutes,omitempty"`
Since *string `json:"since,omitempty"`
Until *string `json:"until,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrafficWindow TrafficWindow
// NewTrafficWindow instantiates a new TrafficWindow 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 NewTrafficWindow() *TrafficWindow {
this := TrafficWindow{}
return &this
}
// NewTrafficWindowWithDefaults instantiates a new TrafficWindow 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 NewTrafficWindowWithDefaults() *TrafficWindow {
this := TrafficWindow{}
return &this
}
// GetMinutes returns the Minutes field value if set, zero value otherwise.
func (o *TrafficWindow) GetMinutes() int32 {
if o == nil || IsNil(o.Minutes) {
var ret int32
return ret
}
return *o.Minutes
}
// GetMinutesOk returns a tuple with the Minutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrafficWindow) GetMinutesOk() (*int32, bool) {
if o == nil || IsNil(o.Minutes) {
return nil, false
}
return o.Minutes, true
}
// HasMinutes returns a boolean if a field has been set.
func (o *TrafficWindow) HasMinutes() bool {
if o != nil && !IsNil(o.Minutes) {
return true
}
return false
}
// SetMinutes gets a reference to the given int32 and assigns it to the Minutes field.
func (o *TrafficWindow) SetMinutes(v int32) {
o.Minutes = &v
}
// GetSince returns the Since field value if set, zero value otherwise.
func (o *TrafficWindow) GetSince() string {
if o == nil || IsNil(o.Since) {
var ret string
return ret
}
return *o.Since
}
// GetSinceOk returns a tuple with the Since field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrafficWindow) GetSinceOk() (*string, bool) {
if o == nil || IsNil(o.Since) {
return nil, false
}
return o.Since, true
}
// HasSince returns a boolean if a field has been set.
func (o *TrafficWindow) HasSince() bool {
if o != nil && !IsNil(o.Since) {
return true
}
return false
}
// SetSince gets a reference to the given string and assigns it to the Since field.
func (o *TrafficWindow) SetSince(v string) {
o.Since = &v
}
// GetUntil returns the Until field value if set, zero value otherwise.
func (o *TrafficWindow) GetUntil() string {
if o == nil || IsNil(o.Until) {
var ret string
return ret
}
return *o.Until
}
// GetUntilOk returns a tuple with the Until field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrafficWindow) GetUntilOk() (*string, bool) {
if o == nil || IsNil(o.Until) {
return nil, false
}
return o.Until, true
}
// HasUntil returns a boolean if a field has been set.
func (o *TrafficWindow) HasUntil() bool {
if o != nil && !IsNil(o.Until) {
return true
}
return false
}
// SetUntil gets a reference to the given string and assigns it to the Until field.
func (o *TrafficWindow) SetUntil(v string) {
o.Until = &v
}
func (o TrafficWindow) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrafficWindow) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Minutes) {
toSerialize["minutes"] = o.Minutes
}
if !IsNil(o.Since) {
toSerialize["since"] = o.Since
}
if !IsNil(o.Until) {
toSerialize["until"] = o.Until
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrafficWindow) UnmarshalJSON(data []byte) (err error) {
varTrafficWindow := _TrafficWindow{}
err = json.Unmarshal(data, &varTrafficWindow)
if err != nil {
return err
}
*o = TrafficWindow(varTrafficWindow)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "minutes")
delete(additionalProperties, "since")
delete(additionalProperties, "until")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrafficWindow struct {
value *TrafficWindow
isSet bool
}
func (v NullableTrafficWindow) Get() *TrafficWindow {
return v.value
}
func (v *NullableTrafficWindow) Set(val *TrafficWindow) {
v.value = val
v.isSet = true
}
func (v NullableTrafficWindow) IsSet() bool {
return v.isSet
}
func (v *NullableTrafficWindow) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrafficWindow(val *TrafficWindow) *NullableTrafficWindow {
return &NullableTrafficWindow{value: val, isSet: true}
}
func (v NullableTrafficWindow) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrafficWindow) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}