v13.0.0
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
type GetByComputeRequest struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
type GetByComputesRequest struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
type GetByGRIDRequest struct {
|
||||
|
||||
@@ -5,13 +5,13 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
type GetByStackRequest struct {
|
||||
// Stack ID
|
||||
type GetByNodeRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
StackID uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
NodeID uint64 `url:"nodeId" json:"nodeId" validate:"required"`
|
||||
|
||||
// Start of time period - unixtime
|
||||
// Required: false
|
||||
@@ -23,13 +23,13 @@ type GetByStackRequest struct {
|
||||
}
|
||||
|
||||
// Get a grid resource monitoring for the specified time period
|
||||
func (r Resmon) GetByStack(ctx context.Context, req GetByStackRequest) (*GetByStackData, error) {
|
||||
res, err := r.GetByStackRaw(ctx, req)
|
||||
func (r Resmon) GetByNode(ctx context.Context, req GetByNodeRequest) (*GetByNodeData, error) {
|
||||
res, err := r.GetByNodeRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := GetByStackData{}
|
||||
info := GetByNodeData{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
@@ -40,13 +40,13 @@ func (r Resmon) GetByStack(ctx context.Context, req GetByStackRequest) (*GetBySt
|
||||
}
|
||||
|
||||
// GetRaw gets information about compute as an array of bytes
|
||||
func (r Resmon) GetByStackRaw(ctx context.Context, req GetByStackRequest) ([]byte, error) {
|
||||
func (r Resmon) GetByNodeRaw(ctx context.Context, req GetByNodeRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/resmon/getByStack"
|
||||
url := "/cloudbroker/resmon/get_by_node"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
|
||||
)
|
||||
|
||||
type GetByStacksRequest struct {
|
||||
type GetByNodesRequest struct {
|
||||
// Start of time period - unixtime
|
||||
// Required: false
|
||||
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
|
||||
@@ -19,13 +19,13 @@ type GetByStacksRequest struct {
|
||||
}
|
||||
|
||||
// Get a grid resource monitoring for the specified time period
|
||||
func (r Resmon) GetByStacks(ctx context.Context, req GetByStacksRequest) (*GetByStackData, error) {
|
||||
res, err := r.GetByStacksRaw(ctx, req)
|
||||
func (r Resmon) GetByNodes(ctx context.Context, req GetByNodesRequest) (*GetByNodeData, error) {
|
||||
res, err := r.GetByNodesRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := GetByStackData{}
|
||||
info := GetByNodeData{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
@@ -36,13 +36,13 @@ func (r Resmon) GetByStacks(ctx context.Context, req GetByStacksRequest) (*GetBy
|
||||
}
|
||||
|
||||
// GetRaw gets information about compute as an array of bytes
|
||||
func (r Resmon) GetByStacksRaw(ctx context.Context, req GetByStacksRequest) ([]byte, error) {
|
||||
func (r Resmon) GetByNodesRaw(ctx context.Context, req GetByNodesRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/resmon/getByStacks"
|
||||
url := "/cloudbroker/resmon/get_by_nodes"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
@@ -12,7 +12,7 @@ type GetByComputePoint struct {
|
||||
Usage ComputeUsage `json:"usage"`
|
||||
Disks []ItemDisk `json:"disks"`
|
||||
UID string `json:"uid"`
|
||||
StackID uint64 `json:"stackId"`
|
||||
NodeID uint64 `json:"nodeId"`
|
||||
}
|
||||
|
||||
type ComputeUsage struct {
|
||||
@@ -46,7 +46,7 @@ type GetByGRIDPoint struct {
|
||||
}
|
||||
|
||||
type ItemTotalByGRID struct {
|
||||
StacksCPU uint64 `json:"stacksCPU"`
|
||||
NodesCPU uint64 `json:"nodesCPU"`
|
||||
StorageCapacity uint64 `json:"storageCapacity"`
|
||||
CPUPower uint64 `json:"cpuPower"`
|
||||
CPUUtil uint64 `json:"cpuUtil"`
|
||||
@@ -64,17 +64,17 @@ type ItemStorage struct {
|
||||
UID string `json:"uid"`
|
||||
}
|
||||
|
||||
// GetByStackData represents an array of data points
|
||||
type GetByStackData []GetByStackPoint
|
||||
// GetByNodeData represents an array of data points
|
||||
type GetByNodeData []GetByNodePoint
|
||||
|
||||
type GetByStackPoint struct {
|
||||
Usage StackUsage `json:"usage"`
|
||||
CPUInfo CPUinfoByStack `json:"cpuInfo"`
|
||||
Name string `json:"name"`
|
||||
ID uint64 `json:"id"`
|
||||
type GetByNodePoint struct {
|
||||
Usage NodeUsage `json:"usage"`
|
||||
CPUInfo CPUinfoByNode `json:"cpuInfo"`
|
||||
Name string `json:"name"`
|
||||
ID uint64 `json:"id"`
|
||||
}
|
||||
|
||||
type StackUsage struct {
|
||||
type NodeUsage struct {
|
||||
CPUPower uint64 `json:"cpuPower"`
|
||||
UsedVCPUs uint64 `json:"usedVcpus"`
|
||||
PCPU uint64 `json:"pcpu"`
|
||||
@@ -84,7 +84,7 @@ type StackUsage struct {
|
||||
FreeMem uint64 `json:"freeMem"`
|
||||
}
|
||||
|
||||
type CPUinfoByStack struct {
|
||||
type CPUinfoByNode struct {
|
||||
ClockSpeed uint64 `json:"clockSpeed"`
|
||||
CoreCount uint64 `json:"coreCount"`
|
||||
PhysCount uint64 `json:"physCount"`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package resmon
|
||||
|
||||
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/interfaces"
|
||||
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/interfaces"
|
||||
|
||||
// Structure for creating request to resource monitoring
|
||||
type Resmon struct {
|
||||
|
||||
Reference in New Issue
Block a user