v1.13.0
This commit is contained in:
@@ -43,10 +43,6 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
@@ -35,10 +35,6 @@ type UpdateRequest struct {
|
||||
// Required: false
|
||||
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
@@ -158,7 +158,6 @@ type CloudBrokerEndpoints struct {
|
||||
Machine []string `json:"machine,omitempty"`
|
||||
Metering []string `json:"metering,omitempty"`
|
||||
Milestones []string `json:"milestones,omitempty"`
|
||||
Node []string `json:"node,omitempty"`
|
||||
Openshift []string `json:"openshift,omitempty"`
|
||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
||||
Ovsnode []string `json:"ovsnode,omitempty"`
|
||||
@@ -169,7 +168,7 @@ type CloudBrokerEndpoints struct {
|
||||
Resmon interface{} `json:"resmon,omitempty"`
|
||||
RG []string `json:"rg,omitempty"`
|
||||
Sep []string `json:"sep,omitempty"`
|
||||
Stack []string `json:"stack,omitempty"`
|
||||
Node []string `json:"node,omitempty"`
|
||||
Tasks []string `json:"tasks,omitempty"`
|
||||
TLock []string `json:"tlock,omitempty"`
|
||||
User []string `json:"user,omitempty"`
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/audit"
|
||||
)
|
||||
|
||||
// Accessing the Stack method group
|
||||
// Accessing the Audit method group
|
||||
func (cb *CloudBroker) Audit() *audit.Audit {
|
||||
return audit.New(cb.client)
|
||||
}
|
||||
|
||||
@@ -70,8 +70,9 @@ type GroupAddRequest struct {
|
||||
// Required: false
|
||||
UserData string `url:"userData,omitempty" json:"userData,omitempty"`
|
||||
|
||||
//Chipset "i440fx" or "Q35
|
||||
//Required: false
|
||||
// Chipset "i440fx" or "Q35
|
||||
// Default value : Q35
|
||||
// Required: false
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"chipset"`
|
||||
|
||||
// ID of the chosen storage policy
|
||||
|
||||
@@ -24,7 +24,7 @@ type GroupResizeRequest struct {
|
||||
|
||||
//Chipset for new computes, either i440fx or Q35 (i440fx by default)
|
||||
//Available values : i440fx, Q35
|
||||
//Default value : i440fx
|
||||
//Default value : Q35
|
||||
//Required: true
|
||||
Chipset string `url:"chipset" json:"chipset" validate:"required,chipset"`
|
||||
|
||||
|
||||
@@ -146,8 +146,8 @@ type ItemCompute struct {
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// StackID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// NodeID
|
||||
NodeID uint64 `json:"node_id"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
41
pkg/cloudbroker/compute/change_read_only.go
Normal file
41
pkg/cloudbroker/compute/change_read_only.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ChangeReadOnlyRequest defines parameters for toggling read-only mode.
|
||||
type ChangeReadOnlyRequest struct {
|
||||
// Compute ID
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
|
||||
// ReadOnly indicates whether the read-only mode is enabled
|
||||
// Required: true
|
||||
ReadOnly bool `url:"read_only" json:"read_only" validate:"required"`
|
||||
}
|
||||
|
||||
// ChangeReadOnly toggles compute read-only mode.
|
||||
func (c Compute) ChangeReadOnly(ctx context.Context, req ChangeReadOnlyRequest) (bool, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/change_read_only"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -65,7 +65,7 @@ var computes = ListComputes{
|
||||
MigrationJob: 0,
|
||||
Milestones: 363500,
|
||||
Name: "test",
|
||||
PinnedToStack: 1,
|
||||
PinnedToNode: 1,
|
||||
RAM: 4096,
|
||||
ReferenceID: "c7cb19ac-af4a-4067-852f-c5572949207e",
|
||||
Registered: true,
|
||||
@@ -127,7 +127,7 @@ var computes = ListComputes{
|
||||
MigrationJob: 0,
|
||||
Milestones: 363853,
|
||||
Name: "compute_2",
|
||||
PinnedToStack: 1,
|
||||
PinnedToNode: 1,
|
||||
RAM: 4096,
|
||||
ReferenceID: "a542c449-5b1c-4f90-88c5-7bb5f8ae68ff",
|
||||
Registered: true,
|
||||
|
||||
@@ -42,17 +42,17 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
IPAddress string `url:"ipAddress,omitempty" json:"ipAddress,omitempty"`
|
||||
|
||||
// Find by stack ID
|
||||
// Find by node ID
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||
|
||||
// Find by CD image ID
|
||||
// Required: false
|
||||
CDImageID uint64 `url:"cdImageId,omitempty" json:"cdImageId,omitempty"`
|
||||
|
||||
// Find by stack name
|
||||
// Find by node name
|
||||
// Required: false
|
||||
StackName string `url:"stackName,omitempty" json:"stackName,omitempty"`
|
||||
NodeName string `url:"nodeName,omitempty" json:"nodeName,omitempty"`
|
||||
|
||||
// Find by external network name
|
||||
// Required: false
|
||||
|
||||
@@ -15,9 +15,9 @@ type MigrateRequest struct {
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// Particular Stack ID to migrate this compute to
|
||||
// Particular Node ID to migrate this compute to
|
||||
// Required: false
|
||||
TargetStackID uint64 `url:"targetStackId,omitempty" json:"targetStackId,omitempty"`
|
||||
TargetNodeID uint64 `url:"targetNodeId,omitempty" json:"targetNodeId,omitempty"`
|
||||
|
||||
// If live migration fails, destroy compute
|
||||
// on source node and recreate on the target
|
||||
@@ -30,7 +30,7 @@ type AsyncWrapperMigrateRequest struct {
|
||||
SyncMode bool `url:"sync"`
|
||||
}
|
||||
|
||||
// Migrate migrates compute to another stack
|
||||
// Migrate migrates compute to another node
|
||||
func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
@@ -54,7 +54,7 @@ func (c Compute) Migrate(ctx context.Context, req MigrateRequest) (bool, error)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AsyncMigrate migrates compute to another stack in async mode
|
||||
// AsyncMigrate migrates compute to another node in async mode
|
||||
func (c Compute) AsyncMigrate(ctx context.Context, req MigrateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,9 +22,9 @@ type MigrateStorageRequest struct {
|
||||
// Required: true
|
||||
PoolName string `url:"poolName" json:"poolName" validate:"required"`
|
||||
|
||||
// Target stack ID
|
||||
// Target node ID
|
||||
// Required: true
|
||||
StackID uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Async API call
|
||||
// Required: true
|
||||
@@ -32,7 +32,7 @@ type MigrateStorageRequest struct {
|
||||
}
|
||||
|
||||
// MigrateStorage gets complex compute migration
|
||||
// Compute will be migrated to specified stack, and compute disks will
|
||||
// Compute will be migrated to specified node, and compute disks will
|
||||
// be migrated to specified SEP to specified pool.
|
||||
// This action can take up to 84 hours
|
||||
func (c Compute) MigrateStorage(ctx context.Context, req MigrateStorageRequest) (string, error) {
|
||||
|
||||
@@ -804,8 +804,8 @@ type InfoCompute struct {
|
||||
// Name of OS
|
||||
OSVersion string `json:"os_version"`
|
||||
|
||||
// Pinned to stack
|
||||
PinnedToStack int64 `json:"pinnedToStack"`
|
||||
// Pinned to node
|
||||
PinnedToNode int64 `json:"pinnedToNode"`
|
||||
|
||||
// PreferredCPU
|
||||
PreferredCPU []int64 `json:"preferredCpu"`
|
||||
@@ -813,6 +813,9 @@ type InfoCompute struct {
|
||||
// Qemu_quest
|
||||
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||
|
||||
// ReadOnly indicates read-only mode state
|
||||
ReadOnly bool `json:"read_only"`
|
||||
|
||||
// Number of RAM
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
@@ -837,11 +840,11 @@ type InfoCompute struct {
|
||||
// SnapSets
|
||||
SnapSets ListSnapshots `json:"snapSets"`
|
||||
|
||||
// Stack ID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// Node ID
|
||||
NodeID uint64 `json:"nodeId"`
|
||||
|
||||
// Stack name
|
||||
StackName string `json:"stackName"`
|
||||
// Node name
|
||||
NodeName string `json:"nodeName"`
|
||||
|
||||
// Stateless SEP ID
|
||||
StatelessSEPID int64 `json:"statelessSepId"`
|
||||
@@ -1055,9 +1058,6 @@ type RecordCompute struct {
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Node ID
|
||||
NodeID uint64 `json:"nodeId"`
|
||||
|
||||
// Natable VINS ID
|
||||
NatableVINSID uint64 `json:"natableVinsId"`
|
||||
|
||||
@@ -1091,8 +1091,8 @@ type RecordCompute struct {
|
||||
// Name of OS
|
||||
OSVersion string `json:"os_version"`
|
||||
|
||||
// Pinned to stack
|
||||
PinnedToStack int64 `json:"pinnedToStack"`
|
||||
// Pinned to node
|
||||
PinnedToNode int64 `json:"pinnedToNode"`
|
||||
|
||||
// PreferredCPU
|
||||
PreferredCPU []int64 `json:"preferredCpu"`
|
||||
@@ -1100,6 +1100,9 @@ type RecordCompute struct {
|
||||
// Qemu_quest
|
||||
QemuQuest QemuQuest `json:"qemu_guest"`
|
||||
|
||||
// ReadOnly indicates read-only mode state
|
||||
ReadOnly bool `json:"read_only"`
|
||||
|
||||
// Number of RAM
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
@@ -1124,11 +1127,11 @@ type RecordCompute struct {
|
||||
// SnapSets
|
||||
SnapSets ListSnapshots `json:"snapSets"`
|
||||
|
||||
// Stack ID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// Node ID
|
||||
NodeID uint64 `json:"node_id"`
|
||||
|
||||
// Stack name
|
||||
StackName string `json:"stackName"`
|
||||
// Node name
|
||||
NodeName string `json:"nodeName"`
|
||||
|
||||
// Stateless SEP ID
|
||||
StatelessSEPID int64 `json:"statelessSepId"`
|
||||
@@ -1338,8 +1341,8 @@ type ItemPCIDevice struct {
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// Stack ID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// Node ID
|
||||
NodeID uint64 `json:"nodeId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
@@ -1441,14 +1444,14 @@ type MigrateStorageItem struct {
|
||||
// Migration process log
|
||||
Log []string `json:"log"`
|
||||
|
||||
// Source stack ID
|
||||
SourceStackID uint64 `json:"sourceStackId"`
|
||||
// Source node ID
|
||||
SourceNodeID uint64 `json:"sourceNodeId"`
|
||||
|
||||
// Migration status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Target stack ID
|
||||
TargetStackID uint64 `json:"targetStackId"`
|
||||
// Target node ID
|
||||
TargetNodeID uint64 `json:"targetNodeId"`
|
||||
}
|
||||
|
||||
type RecordCloneStatus struct {
|
||||
|
||||
@@ -8,15 +8,15 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// PinToStackRequest struct to pin compute to stack
|
||||
type PinToStackRequest struct {
|
||||
// PinToNodeRequest struct to pin compute to node
|
||||
type PinToNodeRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// Stack ID to pin to
|
||||
// Node ID to pin to
|
||||
// Required: false
|
||||
TargetStackID uint64 `url:"targetStackId" json:"targetStackId"`
|
||||
TargetNodeID uint64 `url:"targetNodeId" json:"targetNodeId"`
|
||||
|
||||
// Try to migrate or not if compute in running states
|
||||
// Required: false
|
||||
@@ -28,14 +28,14 @@ type PinToStackRequest struct {
|
||||
AutoStart bool `url:"autoStart" json:"autoStart"`
|
||||
}
|
||||
|
||||
// PinToStack pins compute to current stack
|
||||
func (c Compute) PinToStack(ctx context.Context, req PinToStackRequest) (uint64, error) {
|
||||
// PinToNode pins compute to current node
|
||||
func (c Compute) PinToNode(ctx context.Context, req PinToNodeRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/pinToStack"
|
||||
url := "/cloudbroker/compute/pin_to_node"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
@@ -24,7 +24,7 @@ type RedeployRequest struct {
|
||||
|
||||
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
|
||||
// New size for the boot disk in GB, if boot disk size change is required
|
||||
// Required: false
|
||||
|
||||
@@ -18,9 +18,9 @@ type StartRequest struct {
|
||||
// Required: false
|
||||
AltBootID uint64 `url:"altBootId,omitempty" json:"altBootId,omitempty"`
|
||||
|
||||
// ID of stack to start compute
|
||||
// ID of node to start compute
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"`
|
||||
}
|
||||
|
||||
// Start starts compute
|
||||
|
||||
@@ -13,9 +13,9 @@ type StartMigrationINRequest struct {
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// ID of the stack where the compute will be staged for migration-in
|
||||
// ID of the node where the compute will be staged for migration-in
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||
}
|
||||
|
||||
// StartMigrationIN starts compute for external migration in
|
||||
|
||||
@@ -8,21 +8,21 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UnpinFromStackRequest struct to unpin from stack
|
||||
type UnpinFromStackRequest struct {
|
||||
// UnpinFromNodeRequest struct to unpin from node
|
||||
type UnpinFromNodeRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// UnpinFromStack unpins compute from current stack
|
||||
func (c Compute) UnpinFromStack(ctx context.Context, req UnpinFromStackRequest) (bool, error) {
|
||||
// UnpinFromNode unpins compute from current node
|
||||
func (c Compute) UnpinFromNode(ctx context.Context, req UnpinFromNodeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/unpinFromStack"
|
||||
url := "/cloudbroker/compute/unpin_from_node"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
@@ -14,9 +14,9 @@ type DeviceMigrateRequest struct {
|
||||
// Required: true
|
||||
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
||||
|
||||
// Target stack ID to migrate to
|
||||
// Target node ID to migrate to
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||
|
||||
// Target device to migrate
|
||||
// Required: false
|
||||
|
||||
@@ -9,15 +9,6 @@ func (li ListImages) IDs() []uint64 {
|
||||
return res
|
||||
}
|
||||
|
||||
// IDs gets array of StackIDs from ListStacks struct
|
||||
func (ls ListStacks) IDs() []uint64 {
|
||||
res := make([]uint64, 0, len(ls.Data))
|
||||
for _, h := range ls.Data {
|
||||
res = append(res, h.ID)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// IDs gets array of HistoryIDs from ListHistory struct
|
||||
func (lh ListHistory) IDs() []uint64 {
|
||||
res := make([]uint64, 0, len(lh))
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListStacksRequest struct to get list of stack
|
||||
type ListStacksRequest struct {
|
||||
// Image ID
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
|
||||
// Find by name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Find by status
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Find by type
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
}
|
||||
|
||||
// ListStacks gets list stack by image ID
|
||||
func (i Image) ListStacks(ctx context.Context, req ListStacksRequest) (*ListStacks, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/image/listStacks"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListStacks{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
@@ -329,84 +329,6 @@ func (r *GUID) UnmarshalJSON(b []byte) error {
|
||||
// List history
|
||||
type ListHistory []History
|
||||
|
||||
// List stacks
|
||||
type ListStacks struct {
|
||||
// Data
|
||||
Data []ItemListStacks `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Detailed information about image
|
||||
type ItemListStacks struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// API URL
|
||||
APIURL string `json:"apiUrl"`
|
||||
|
||||
// API key
|
||||
APIKey string `json:"apikey"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"appId"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Descr
|
||||
Descr string `json:"descr"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Eco
|
||||
Eco interface{} `json:"eco"`
|
||||
|
||||
// Error
|
||||
Error uint64 `json:"error"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
// Login
|
||||
Login string `json:"login"`
|
||||
|
||||
// Mem allocation ratio
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Packegas
|
||||
Packages Packages `json:"packages"`
|
||||
|
||||
// Password
|
||||
Password string `json:"passwd"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Package
|
||||
type Packages struct {
|
||||
// LibvirtBin
|
||||
|
||||
@@ -171,6 +171,7 @@ type CreateRequest struct {
|
||||
|
||||
// Type of the emulated system, Q35 or i440fx
|
||||
// Required: false
|
||||
// Default: Q35
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
|
||||
|
||||
// Zone ID
|
||||
|
||||
@@ -24,6 +24,7 @@ type WorkerAddRequest struct {
|
||||
|
||||
// Type of the emulated system, Q35 or i440fx
|
||||
// Required: false
|
||||
// Default: Q35
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ type WorkersGroupAddRequest struct {
|
||||
|
||||
// Type of the emulated system, Q35 or i440fx
|
||||
// Required: false
|
||||
// Default: Q35
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
|
||||
}
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
Start bool `url:"start" json:"start"`
|
||||
|
||||
// Stack ID
|
||||
// Node ID
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
NodeID uint64 `url:"node_id,omitempty" json:"node_id,omitempty"`
|
||||
|
||||
// System name
|
||||
// Required: false
|
||||
@@ -191,6 +191,7 @@ type CreateRequest struct {
|
||||
|
||||
// Type of the emulated system, Q35 or i440fx
|
||||
// Required: false
|
||||
// Default: Q35
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
|
||||
|
||||
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
|
||||
|
||||
@@ -67,8 +67,27 @@ type CreateBlankRequest struct {
|
||||
|
||||
// Type of the emulated system, Q35 or i440fx
|
||||
// Required: false
|
||||
// Default: Q35
|
||||
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"omitempty,chipset"`
|
||||
|
||||
// Use Huge Pages to allocate RAM of the virtual machine. The system must be pre-configured by allocating Huge Pages on the physical node
|
||||
// Required: false
|
||||
// Default: false
|
||||
HPBacked bool `url:"hp_backed" json:"hp_backed"`
|
||||
|
||||
// Run VM on dedicated CPUs. To use this feature, the system must be pre-configured by allocating CPUs on the physical node
|
||||
// Required: false
|
||||
// Default: false
|
||||
CPUPin bool `url:"cpu_pin" json:"cpu_pin"`
|
||||
|
||||
// Rule for VM placement with NUMA affinity.
|
||||
// Possible values - none (placement without NUMA affinity),
|
||||
// strict (strictly with NUMA affinity, if not possible - do not start VM),
|
||||
// loose (use NUMA affinity if possible)
|
||||
// Required: false
|
||||
// Default: none
|
||||
NumaAffinity string `url:"numa_affinity,omitempty" json:"numa_affinity,omitempty" validate:"omitempty,numaAffinity"`
|
||||
|
||||
// Recommended isolated CPUs. Field is ignored if compute.cpupin=False or compute.pinned=False
|
||||
// Required: false
|
||||
PreferredCPU []int64 `url:"preferredCpu,omitempty" json:"preferredCpu,omitempty" validate:"omitempty,preferredCPU"`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package stack
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -8,21 +8,21 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetLogicalCoresCountRequest struct to get logical cores count by stack
|
||||
// GetLogicalCoresCountRequest struct to get logical cores count by node
|
||||
type GetLogicalCoresCountRequest struct {
|
||||
// Stack ID
|
||||
// Node ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
NodeId uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
}
|
||||
|
||||
// GetLogicalCoresCount get logical cores count by stack
|
||||
func (i Stack) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCountRequest) (uint64, error) {
|
||||
// GetLogicalCoresCount get logical cores count by node
|
||||
func (i Node) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCountRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/getLogicalCoresCount"
|
||||
url := "/cloudbroker/node/get_logical_cores_count"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
@@ -53,9 +53,6 @@ type RecordNode struct {
|
||||
// SriovEnabled
|
||||
SriovEnabled bool `json:"sriovEnabled"`
|
||||
|
||||
// StackID
|
||||
StackID uint64 `json:"stackId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
@@ -76,6 +73,15 @@ type RecordNode struct {
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
|
||||
// OpenvSwitch Bridges
|
||||
OpenvSwitchBridges []string `json:"openvswitch_bridges"`
|
||||
|
||||
// Description
|
||||
Description string `json:"description"`
|
||||
|
||||
// SDN Hypervisor Name
|
||||
SDNHypervisorName string `json:"sdn_hypervisor_name"`
|
||||
}
|
||||
|
||||
// Resource consumption of the node
|
||||
@@ -102,7 +108,7 @@ type FreeResourcesInfo struct {
|
||||
RAM float64 `json:"RAM"`
|
||||
|
||||
// VCPU
|
||||
VCPU uint64 `json:"vCPU"`
|
||||
VCPU uint64 `json:"vCPUs"`
|
||||
}
|
||||
|
||||
// Resources Info
|
||||
@@ -136,6 +142,12 @@ type CpuInfo struct {
|
||||
|
||||
// PhysCount
|
||||
PhysCount uint64 `json:"physCount"`
|
||||
|
||||
// Flags
|
||||
Flags []string `json:"flags"`
|
||||
|
||||
// Mddel name
|
||||
ModelName string `json:"model_name"`
|
||||
}
|
||||
|
||||
// Main information about node
|
||||
@@ -245,9 +257,6 @@ type ItemNode struct {
|
||||
// SriovEnabled
|
||||
SriovEnabled bool `json:"sriovEnabled"`
|
||||
|
||||
// StackID
|
||||
StackID uint64 `json:"stackId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
@@ -265,6 +274,34 @@ type ItemNode struct {
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
|
||||
// OpenvSwitch Bridges
|
||||
OpenvSwitchBridges []string `json:"openvswitch_bridges"`
|
||||
|
||||
// APIUrl
|
||||
APIUrl string `json:"apiUrl"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Old Compat LVM ID
|
||||
OldCompatLVMID uint64 `json:"old_compat_lvm_id"`
|
||||
|
||||
// CPU Allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// MemAllocationRatio
|
||||
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
// Packages
|
||||
Packages map[string]PackageInfo `json:"packages"`
|
||||
}
|
||||
|
||||
type PackageInfo struct {
|
||||
// Installed size
|
||||
InstalledSize string `json:"installed_size"`
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Numa Topology Info
|
||||
|
||||
36
pkg/cloudbroker/node/set_cpu_allocation_ratio.go
Normal file
36
pkg/cloudbroker/node/set_cpu_allocation_ratio.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// SetCpuAllocationRatioRequest struct to set CPU allocation ratio
|
||||
type SetCpuAllocationRatioRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Allocation ratio (zero or positive value)
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCpuAllocationRatio set CPU allocation ratio
|
||||
func (i Node) SetCpuAllocationRatio(ctx context.Context, req SetCpuAllocationRatioRequest) error {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/set_cpu_allocation_ratio"
|
||||
|
||||
_, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
36
pkg/cloudbroker/node/set_mem_allocation_ratio.go
Normal file
36
pkg/cloudbroker/node/set_mem_allocation_ratio.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// SetMemAllocationRatioRequest struct to set memory allocation ratio
|
||||
type SetMemAllocationRatioRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Allocation ratio (zero or positive value)
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetMemAllocationRatio set memory allocation ratio
|
||||
func (i Node) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) error {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/set_mem_allocation_ratio"
|
||||
|
||||
_, err = i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -3,15 +3,16 @@ package pcidevice
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// CreateRequest struct to creating PCI device
|
||||
type CreateRequest struct {
|
||||
// StackID
|
||||
// NodeID
|
||||
// Required: true
|
||||
StackID uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
|
||||
@@ -29,8 +29,8 @@ type ItemPCIDevice struct {
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// Stack ID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// Node ID
|
||||
NodeID uint64 `json:"nodeId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
@@ -47,4 +47,3 @@ type ListPCIDevices struct {
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/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
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/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"`
|
||||
|
||||
@@ -39,10 +39,6 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
@@ -35,7 +35,6 @@ var rgs = ListRG{
|
||||
CuD: -1,
|
||||
CUI: -1,
|
||||
CUM: -1,
|
||||
CUNP: -1,
|
||||
GPUUnits: -1,
|
||||
},
|
||||
Secret: "",
|
||||
@@ -78,7 +77,6 @@ var rgs = ListRG{
|
||||
CuD: -1,
|
||||
CUI: -1,
|
||||
CUM: -1,
|
||||
CUNP: -1,
|
||||
GPUUnits: -1,
|
||||
},
|
||||
Secret: "",
|
||||
@@ -121,7 +119,6 @@ var rgs = ListRG{
|
||||
CuD: -1,
|
||||
CUI: -1,
|
||||
CUM: -1,
|
||||
CUNP: -1,
|
||||
GPUUnits: -1,
|
||||
},
|
||||
Secret: "",
|
||||
|
||||
@@ -121,9 +121,6 @@ type ResourceLimits struct {
|
||||
// CUM
|
||||
CUM float64 `json:"CU_M"`
|
||||
|
||||
// CUNP
|
||||
CUNP float64 `json:"CU_NP"`
|
||||
|
||||
// GPU units
|
||||
GPUUnits float64 `json:"gpu_units"`
|
||||
|
||||
|
||||
@@ -35,10 +35,6 @@ type UpdateRequest struct {
|
||||
// Required: false
|
||||
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
@@ -7,7 +7,7 @@ type SecurityGroup struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
// Builder for security group endpoint
|
||||
func New(client interfaces.Caller) *SecurityGroup {
|
||||
return &SecurityGroup{
|
||||
client: client,
|
||||
|
||||
@@ -13,12 +13,13 @@ type AddPoolRequest struct {
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// method Async/Sync
|
||||
// Method Async/Sync
|
||||
// Default: true
|
||||
// Required: false
|
||||
Sync bool `url:"sync" json:"sync"`
|
||||
|
||||
// Pool structure which contains fields such as "name", "types", "accessAccountIds", "accessResGroupIds"
|
||||
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
|
||||
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
|
||||
// Required: true
|
||||
Pool string `url:"pool" json:"pool" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack"
|
||||
)
|
||||
|
||||
// Accessing the Stack method group
|
||||
func (cb *CloudBroker) Stack() *stack.Stack {
|
||||
return stack.New(cb.client)
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetRequest struct to get list of stacks
|
||||
type GetRequest struct {
|
||||
// Find by ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets stack details by ID as an InfoStack struct
|
||||
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
res, err := i.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := InfoStack{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets stack details by ID as an array of bytes
|
||||
func (i Stack) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package stack
|
||||
|
||||
// IDs gets array of StackIDs from ListStacks struct
|
||||
func (ls ListStacks) IDs() []uint64 {
|
||||
res := make([]uint64, 0, len(ls.Data))
|
||||
for _, s := range ls.Data {
|
||||
res = append(res, s.ID)
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of stacks
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Find by name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Find by type
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Find by status
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of stacks as a ListStacks struct
|
||||
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
|
||||
res, err := i.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListStacks{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of stacks as an array of bytes
|
||||
func (i Stack) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package stack
|
||||
|
||||
// Main information about stack
|
||||
type InfoStack struct {
|
||||
// CKey
|
||||
Ckey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
//API URL
|
||||
APIURL string `json:"apiUrl"`
|
||||
|
||||
//API key
|
||||
Apikey string `json:"apikey"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"appId"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Descr
|
||||
Descr string `json:"descr"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Eco
|
||||
Eco interface{} `json:"eco"`
|
||||
|
||||
// Error
|
||||
Error uint64 `json:"error"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
// Login
|
||||
Login string `json:"login"`
|
||||
|
||||
// Mem allocation ratio
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Packegas
|
||||
Packages Packages `json:"packages"`
|
||||
|
||||
//Password
|
||||
Password string `json:"passwd"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// List of stacks
|
||||
type ListStacks struct {
|
||||
//List
|
||||
Data []InfoStack `json:"data"`
|
||||
|
||||
//Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Package
|
||||
type Packages struct {
|
||||
// LibGuestFSTools
|
||||
LibGuestFSTools LibGuestFSTools `json:"libguestfs-tools"`
|
||||
|
||||
// LibvirtBin
|
||||
LibvirtBin LibvirtBin `json:"libvirt-bin"`
|
||||
|
||||
// LibvirtDaemon
|
||||
LibvirtDaemon LibvirtDaemon `json:"libvirt-daemon"`
|
||||
|
||||
// Lvm2Lockd
|
||||
Lvm2Lockd Lvm2Lockd `json:"lvm2-lockd"`
|
||||
|
||||
// OpenvswitchCommon
|
||||
OpenvswitchCommon OpenvswitchCommon `json:"openvswitch-common"`
|
||||
|
||||
// OpenvswitchSwitch
|
||||
OpenvswitchSwitch OpenvswitchSwitch `json:"openvswitch-switch"`
|
||||
|
||||
// QemuSystemX86
|
||||
QemuSystemX86 QemuSystemX86 `json:"qemu-system-x86"`
|
||||
|
||||
// Sanlock
|
||||
Sanlock Sanlock `json:"sanlock"`
|
||||
}
|
||||
|
||||
// LibGuestFSTools
|
||||
type LibGuestFSTools struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// LibvirtBin
|
||||
type LibvirtBin struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
type LibvirtDaemon struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Lvm2Lockd
|
||||
type Lvm2Lockd struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchCommon
|
||||
type OpenvswitchCommon struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchSwitch
|
||||
type OpenvswitchSwitch struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// QemuSystemX86
|
||||
type QemuSystemX86 struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Sanlock
|
||||
type Sanlock struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// SetCpuAllocationRatioRequest struct to set CPU allocation ratio
|
||||
type SetCpuAllocationRatioRequest struct {
|
||||
// Stack ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
|
||||
// Allocation ratio (zero or positive value)
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCpuAllocationRatio set CPU allocation ratio
|
||||
func (i Stack) SetCpuAllocationRatio(ctx context.Context, req SetCpuAllocationRatioRequest) (*InfoStack, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/setCpuAllocationRatio"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := InfoStack{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// SetMemAllocationRatioRequest struct to set memory allocation ratio
|
||||
type SetMemAllocationRatioRequest struct {
|
||||
// Stack ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
|
||||
// Allocation ratio (zero or positive value)
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetMemAllocationRatio set memory allocation ratio
|
||||
func (i Stack) SetMemAllocationRatio(ctx context.Context, req SetMemAllocationRatioRequest) (*InfoStack, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/setMemAllocationRatio"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := InfoStack{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package stack
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to stack
|
||||
type Stack struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
func New(client interfaces.Caller) *Stack {
|
||||
return &Stack{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ type StPolicy struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
// Builder for storage policy endpoint
|
||||
func New(client interfaces.Caller) *StPolicy {
|
||||
return &StPolicy{
|
||||
client: client,
|
||||
|
||||
@@ -237,7 +237,6 @@ type CloudBrokerEndpoints struct {
|
||||
Machine []string `json:"machine,omitempty"`
|
||||
Metering []string `json:"metering,omitempty"`
|
||||
Milestones []string `json:"milestones,omitempty"`
|
||||
Node []string `json:"node,omitempty"`
|
||||
Openshift []string `json:"openshift,omitempty"`
|
||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
||||
Ovsnode []string `json:"ovsnode,omitempty"`
|
||||
@@ -248,7 +247,7 @@ type CloudBrokerEndpoints struct {
|
||||
Resmon []string `json:"resmon,omitempty"`
|
||||
RG []string `json:"rg,omitempty"`
|
||||
Sep []string `json:"sep,omitempty"`
|
||||
Stack []string `json:"stack,omitempty"`
|
||||
Node []string `json:"node,omitempty"`
|
||||
Tasks []string `json:"tasks,omitempty"`
|
||||
TLock []string `json:"tlock,omitempty"`
|
||||
User []string `json:"user,omitempty"`
|
||||
|
||||
@@ -74,8 +74,8 @@ type Resources struct {
|
||||
// Number of RAM
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
// Stack ID
|
||||
StackID uint64 `json:"stackId"`
|
||||
// Node ID
|
||||
NodeID uint64 `json:"node_id"`
|
||||
|
||||
// UUID
|
||||
UUID string `json:"uuid"`
|
||||
|
||||
Reference in New Issue
Block a user