Skip to content

Commit

Permalink
chore: auto update client api apecloud/apecloud@9d6d9a3
Browse files Browse the repository at this point in the history
  • Loading branch information
apecloud-bot committed Jan 20, 2025
1 parent 9deb3e1 commit 1408566
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .generator/schemas/adminapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17094,8 +17094,6 @@ components:
format: double
type: number
required:
- limits
- requests
- usage
type: object
node:
Expand Down Expand Up @@ -18087,6 +18085,8 @@ components:
$ref: '#/components/schemas/resourceStats'
memoryStats:
$ref: '#/components/schemas/resourceStats'
filesystemStats:
$ref: '#/components/schemas/resourceStats'
name:
description: Name of the node.
type: string
Expand Down
2 changes: 1 addition & 1 deletion apecloud
Submodule apecloud updated from 589834 to 9d6d9a
46 changes: 42 additions & 4 deletions api/kbcloud/admin/model_node_resource_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type NodeResourceStats struct {
CpuStats ResourceStats `json:"cpuStats"`
// ResourceStats holds the requests, limits, and available stats for a resource.
MemoryStats ResourceStats `json:"memoryStats"`
// ResourceStats holds the requests, limits, and available stats for a resource.
FilesystemStats *ResourceStats `json:"filesystemStats,omitempty"`
// Name of the node.
Name string `json:"name"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -89,6 +91,34 @@ func (o *NodeResourceStats) SetMemoryStats(v ResourceStats) {
o.MemoryStats = v
}

// GetFilesystemStats returns the FilesystemStats field value if set, zero value otherwise.
func (o *NodeResourceStats) GetFilesystemStats() ResourceStats {
if o == nil || o.FilesystemStats == nil {
var ret ResourceStats
return ret
}
return *o.FilesystemStats
}

// GetFilesystemStatsOk returns a tuple with the FilesystemStats field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NodeResourceStats) GetFilesystemStatsOk() (*ResourceStats, bool) {
if o == nil || o.FilesystemStats == nil {
return nil, false
}
return o.FilesystemStats, true
}

// HasFilesystemStats returns a boolean if a field has been set.
func (o *NodeResourceStats) HasFilesystemStats() bool {
return o != nil && o.FilesystemStats != nil
}

// SetFilesystemStats gets a reference to the given ResourceStats and assigns it to the FilesystemStats field.
func (o *NodeResourceStats) SetFilesystemStats(v ResourceStats) {
o.FilesystemStats = &v
}

// GetName returns the Name field value.
func (o *NodeResourceStats) GetName() string {
if o == nil {
Expand Down Expand Up @@ -120,6 +150,9 @@ func (o NodeResourceStats) MarshalJSON() ([]byte, error) {
}
toSerialize["cpuStats"] = o.CpuStats
toSerialize["memoryStats"] = o.MemoryStats
if o.FilesystemStats != nil {
toSerialize["filesystemStats"] = o.FilesystemStats
}
toSerialize["name"] = o.Name

for key, value := range o.AdditionalProperties {
Expand All @@ -131,9 +164,10 @@ func (o NodeResourceStats) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *NodeResourceStats) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
CpuStats *ResourceStats `json:"cpuStats"`
MemoryStats *ResourceStats `json:"memoryStats"`
Name *string `json:"name"`
CpuStats *ResourceStats `json:"cpuStats"`
MemoryStats *ResourceStats `json:"memoryStats"`
FilesystemStats *ResourceStats `json:"filesystemStats,omitempty"`
Name *string `json:"name"`
}{}
if err = common.Unmarshal(bytes, &all); err != nil {
return err
Expand All @@ -149,7 +183,7 @@ func (o *NodeResourceStats) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = common.Unmarshal(bytes, &additionalProperties); err == nil {
common.DeleteKeys(additionalProperties, &[]string{"cpuStats", "memoryStats", "name"})
common.DeleteKeys(additionalProperties, &[]string{"cpuStats", "memoryStats", "filesystemStats", "name"})
} else {
return err
}
Expand All @@ -163,6 +197,10 @@ func (o *NodeResourceStats) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.MemoryStats = *all.MemoryStats
if all.FilesystemStats != nil && all.FilesystemStats.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.FilesystemStats = all.FilesystemStats
o.Name = *all.Name

if len(additionalProperties) > 0 {
Expand Down
72 changes: 39 additions & 33 deletions api/kbcloud/admin/model_resource_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type ResourceStats struct {
// The amount of CPU or Memory resources that are available on the node. Unit is GiB for memory and Cores for CPU.
Allocatable *float64 `json:"allocatable,omitempty"`
// The maximum number of CPU or Memory resources pods are allowed to use on the node. Unit is GiB for memory and Cores for CPU
Limits float64 `json:"limits"`
Limits *float64 `json:"limits,omitempty"`
// The number of CPU or Memory resources requested by pods running on the node. Unit is GiB for memory and Cores for CPU.
Requests float64 `json:"requests"`
Requests *float64 `json:"requests,omitempty"`
// The amount of CPU or Memory resources that are already used on the node. Unit is GiB for memory and Cores for CPU.
Usage float64 `json:"usage"`
// The total amount of physical resources available on the node. Unit is GiB for memory and Cores for CPU.
Expand All @@ -31,10 +31,8 @@ type ResourceStats struct {
// 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 NewResourceStats(limits float64, requests float64, usage float64) *ResourceStats {
func NewResourceStats(usage float64) *ResourceStats {
this := ResourceStats{}
this.Limits = limits
this.Requests = requests
this.Usage = usage
return &this
}
Expand Down Expand Up @@ -75,50 +73,60 @@ func (o *ResourceStats) SetAllocatable(v float64) {
o.Allocatable = &v
}

// GetLimits returns the Limits field value.
// GetLimits returns the Limits field value if set, zero value otherwise.
func (o *ResourceStats) GetLimits() float64 {
if o == nil {
if o == nil || o.Limits == nil {
var ret float64
return ret
}
return o.Limits
return *o.Limits
}

// GetLimitsOk returns a tuple with the Limits field value
// GetLimitsOk returns a tuple with the Limits field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceStats) GetLimitsOk() (*float64, bool) {
if o == nil {
if o == nil || o.Limits == nil {
return nil, false
}
return &o.Limits, true
return o.Limits, true
}

// HasLimits returns a boolean if a field has been set.
func (o *ResourceStats) HasLimits() bool {
return o != nil && o.Limits != nil
}

// SetLimits sets field value.
// SetLimits gets a reference to the given float64 and assigns it to the Limits field.
func (o *ResourceStats) SetLimits(v float64) {
o.Limits = v
o.Limits = &v
}

// GetRequests returns the Requests field value.
// GetRequests returns the Requests field value if set, zero value otherwise.
func (o *ResourceStats) GetRequests() float64 {
if o == nil {
if o == nil || o.Requests == nil {
var ret float64
return ret
}
return o.Requests
return *o.Requests
}

// GetRequestsOk returns a tuple with the Requests field value
// GetRequestsOk returns a tuple with the Requests field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceStats) GetRequestsOk() (*float64, bool) {
if o == nil {
if o == nil || o.Requests == nil {
return nil, false
}
return &o.Requests, true
return o.Requests, true
}

// SetRequests sets field value.
// HasRequests returns a boolean if a field has been set.
func (o *ResourceStats) HasRequests() bool {
return o != nil && o.Requests != nil
}

// SetRequests gets a reference to the given float64 and assigns it to the Requests field.
func (o *ResourceStats) SetRequests(v float64) {
o.Requests = v
o.Requests = &v
}

// GetUsage returns the Usage field value.
Expand Down Expand Up @@ -181,8 +189,12 @@ func (o ResourceStats) MarshalJSON() ([]byte, error) {
if o.Allocatable != nil {
toSerialize["allocatable"] = o.Allocatable
}
toSerialize["limits"] = o.Limits
toSerialize["requests"] = o.Requests
if o.Limits != nil {
toSerialize["limits"] = o.Limits
}
if o.Requests != nil {
toSerialize["requests"] = o.Requests
}
toSerialize["usage"] = o.Usage
if o.Capacity != nil {
toSerialize["capacity"] = o.Capacity
Expand All @@ -198,20 +210,14 @@ func (o ResourceStats) MarshalJSON() ([]byte, error) {
func (o *ResourceStats) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Allocatable *float64 `json:"allocatable,omitempty"`
Limits *float64 `json:"limits"`
Requests *float64 `json:"requests"`
Limits *float64 `json:"limits,omitempty"`
Requests *float64 `json:"requests,omitempty"`
Usage *float64 `json:"usage"`
Capacity *float64 `json:"capacity,omitempty"`
}{}
if err = common.Unmarshal(bytes, &all); err != nil {
return err
}
if all.Limits == nil {
return fmt.Errorf("required field limits missing")
}
if all.Requests == nil {
return fmt.Errorf("required field requests missing")
}
if all.Usage == nil {
return fmt.Errorf("required field usage missing")
}
Expand All @@ -222,8 +228,8 @@ func (o *ResourceStats) UnmarshalJSON(bytes []byte) (err error) {
return err
}
o.Allocatable = all.Allocatable
o.Limits = *all.Limits
o.Requests = *all.Requests
o.Limits = all.Limits
o.Requests = all.Requests
o.Usage = *all.Usage
o.Capacity = all.Capacity

Expand Down

0 comments on commit 1408566

Please sign in to comment.