mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
302 lines
8.2 KiB
Go
302 lines
8.2 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 ResourceMetrics type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &ResourceMetrics{}
|
|
|
|
// ResourceMetrics struct for ResourceMetrics
|
|
type ResourceMetrics struct {
|
|
CpuPercentage *float32 `json:"cpuPercentage,omitempty"`
|
|
CpuUsage *string `json:"cpuUsage,omitempty"`
|
|
MemoryPercentage *float32 `json:"memoryPercentage,omitempty"`
|
|
MemoryUsage *string `json:"memoryUsage,omitempty"`
|
|
PodCount *int32 `json:"podCount,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _ResourceMetrics ResourceMetrics
|
|
|
|
// NewResourceMetrics instantiates a new ResourceMetrics 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 NewResourceMetrics() *ResourceMetrics {
|
|
this := ResourceMetrics{}
|
|
return &this
|
|
}
|
|
|
|
// NewResourceMetricsWithDefaults instantiates a new ResourceMetrics 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 NewResourceMetricsWithDefaults() *ResourceMetrics {
|
|
this := ResourceMetrics{}
|
|
return &this
|
|
}
|
|
|
|
// GetCpuPercentage returns the CpuPercentage field value if set, zero value otherwise.
|
|
func (o *ResourceMetrics) GetCpuPercentage() float32 {
|
|
if o == nil || IsNil(o.CpuPercentage) {
|
|
var ret float32
|
|
return ret
|
|
}
|
|
return *o.CpuPercentage
|
|
}
|
|
|
|
// GetCpuPercentageOk returns a tuple with the CpuPercentage field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceMetrics) GetCpuPercentageOk() (*float32, bool) {
|
|
if o == nil || IsNil(o.CpuPercentage) {
|
|
return nil, false
|
|
}
|
|
return o.CpuPercentage, true
|
|
}
|
|
|
|
// HasCpuPercentage returns a boolean if a field has been set.
|
|
func (o *ResourceMetrics) HasCpuPercentage() bool {
|
|
if o != nil && !IsNil(o.CpuPercentage) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCpuPercentage gets a reference to the given float32 and assigns it to the CpuPercentage field.
|
|
func (o *ResourceMetrics) SetCpuPercentage(v float32) {
|
|
o.CpuPercentage = &v
|
|
}
|
|
|
|
// GetCpuUsage returns the CpuUsage field value if set, zero value otherwise.
|
|
func (o *ResourceMetrics) GetCpuUsage() string {
|
|
if o == nil || IsNil(o.CpuUsage) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.CpuUsage
|
|
}
|
|
|
|
// GetCpuUsageOk returns a tuple with the CpuUsage field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceMetrics) GetCpuUsageOk() (*string, bool) {
|
|
if o == nil || IsNil(o.CpuUsage) {
|
|
return nil, false
|
|
}
|
|
return o.CpuUsage, true
|
|
}
|
|
|
|
// HasCpuUsage returns a boolean if a field has been set.
|
|
func (o *ResourceMetrics) HasCpuUsage() bool {
|
|
if o != nil && !IsNil(o.CpuUsage) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCpuUsage gets a reference to the given string and assigns it to the CpuUsage field.
|
|
func (o *ResourceMetrics) SetCpuUsage(v string) {
|
|
o.CpuUsage = &v
|
|
}
|
|
|
|
// GetMemoryPercentage returns the MemoryPercentage field value if set, zero value otherwise.
|
|
func (o *ResourceMetrics) GetMemoryPercentage() float32 {
|
|
if o == nil || IsNil(o.MemoryPercentage) {
|
|
var ret float32
|
|
return ret
|
|
}
|
|
return *o.MemoryPercentage
|
|
}
|
|
|
|
// GetMemoryPercentageOk returns a tuple with the MemoryPercentage field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceMetrics) GetMemoryPercentageOk() (*float32, bool) {
|
|
if o == nil || IsNil(o.MemoryPercentage) {
|
|
return nil, false
|
|
}
|
|
return o.MemoryPercentage, true
|
|
}
|
|
|
|
// HasMemoryPercentage returns a boolean if a field has been set.
|
|
func (o *ResourceMetrics) HasMemoryPercentage() bool {
|
|
if o != nil && !IsNil(o.MemoryPercentage) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMemoryPercentage gets a reference to the given float32 and assigns it to the MemoryPercentage field.
|
|
func (o *ResourceMetrics) SetMemoryPercentage(v float32) {
|
|
o.MemoryPercentage = &v
|
|
}
|
|
|
|
// GetMemoryUsage returns the MemoryUsage field value if set, zero value otherwise.
|
|
func (o *ResourceMetrics) GetMemoryUsage() string {
|
|
if o == nil || IsNil(o.MemoryUsage) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.MemoryUsage
|
|
}
|
|
|
|
// GetMemoryUsageOk returns a tuple with the MemoryUsage field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceMetrics) GetMemoryUsageOk() (*string, bool) {
|
|
if o == nil || IsNil(o.MemoryUsage) {
|
|
return nil, false
|
|
}
|
|
return o.MemoryUsage, true
|
|
}
|
|
|
|
// HasMemoryUsage returns a boolean if a field has been set.
|
|
func (o *ResourceMetrics) HasMemoryUsage() bool {
|
|
if o != nil && !IsNil(o.MemoryUsage) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMemoryUsage gets a reference to the given string and assigns it to the MemoryUsage field.
|
|
func (o *ResourceMetrics) SetMemoryUsage(v string) {
|
|
o.MemoryUsage = &v
|
|
}
|
|
|
|
// GetPodCount returns the PodCount field value if set, zero value otherwise.
|
|
func (o *ResourceMetrics) GetPodCount() int32 {
|
|
if o == nil || IsNil(o.PodCount) {
|
|
var ret int32
|
|
return ret
|
|
}
|
|
return *o.PodCount
|
|
}
|
|
|
|
// GetPodCountOk returns a tuple with the PodCount field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *ResourceMetrics) GetPodCountOk() (*int32, bool) {
|
|
if o == nil || IsNil(o.PodCount) {
|
|
return nil, false
|
|
}
|
|
return o.PodCount, true
|
|
}
|
|
|
|
// HasPodCount returns a boolean if a field has been set.
|
|
func (o *ResourceMetrics) HasPodCount() bool {
|
|
if o != nil && !IsNil(o.PodCount) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPodCount gets a reference to the given int32 and assigns it to the PodCount field.
|
|
func (o *ResourceMetrics) SetPodCount(v int32) {
|
|
o.PodCount = &v
|
|
}
|
|
|
|
func (o ResourceMetrics) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o ResourceMetrics) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.CpuPercentage) {
|
|
toSerialize["cpuPercentage"] = o.CpuPercentage
|
|
}
|
|
if !IsNil(o.CpuUsage) {
|
|
toSerialize["cpuUsage"] = o.CpuUsage
|
|
}
|
|
if !IsNil(o.MemoryPercentage) {
|
|
toSerialize["memoryPercentage"] = o.MemoryPercentage
|
|
}
|
|
if !IsNil(o.MemoryUsage) {
|
|
toSerialize["memoryUsage"] = o.MemoryUsage
|
|
}
|
|
if !IsNil(o.PodCount) {
|
|
toSerialize["podCount"] = o.PodCount
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *ResourceMetrics) UnmarshalJSON(data []byte) (err error) {
|
|
varResourceMetrics := _ResourceMetrics{}
|
|
|
|
err = json.Unmarshal(data, &varResourceMetrics)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = ResourceMetrics(varResourceMetrics)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "cpuPercentage")
|
|
delete(additionalProperties, "cpuUsage")
|
|
delete(additionalProperties, "memoryPercentage")
|
|
delete(additionalProperties, "memoryUsage")
|
|
delete(additionalProperties, "podCount")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableResourceMetrics struct {
|
|
value *ResourceMetrics
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableResourceMetrics) Get() *ResourceMetrics {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableResourceMetrics) Set(val *ResourceMetrics) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableResourceMetrics) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableResourceMetrics) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableResourceMetrics(val *ResourceMetrics) *NullableResourceMetrics {
|
|
return &NullableResourceMetrics{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableResourceMetrics) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableResourceMetrics) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|