v1.4.0
This commit is contained in:
@@ -158,6 +158,12 @@ type RecordAccount struct {
|
||||
// Computes
|
||||
Computes Computes `json:"computes"`
|
||||
|
||||
// CPU allocation parameter
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -192,7 +198,7 @@ type RecordAccount struct {
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
|
||||
// Resource types
|
||||
ResourceTypes []string `json:"resourceTypes"`
|
||||
ResTypes []string `json:"resourceTypes"`
|
||||
|
||||
// Send access emails
|
||||
SendAccessEmails bool `json:"sendAccessEmails"`
|
||||
|
||||
@@ -3,8 +3,6 @@ package account
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
@@ -26,15 +24,10 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error)
|
||||
|
||||
url := "/cloudapi/account/restore"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
_, err = a.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
|
||||
return true, nil
|
||||
}
|
||||
|
||||
@@ -35,11 +35,8 @@ type RecordBasicService struct {
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// List of Service Compute Group IDs
|
||||
Groups []uint64 `json:"groups"`
|
||||
|
||||
// List of compute groups by name
|
||||
GroupsName []string `json:"groupsName"`
|
||||
// List of Service Compute Groups
|
||||
Groups ListGroups `json:"groups"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
@@ -95,6 +92,12 @@ type RecordBasicService struct {
|
||||
|
||||
// Main information about Compute
|
||||
type ItemCompute struct {
|
||||
// Account ID
|
||||
AccountID uint64
|
||||
|
||||
// Architecture
|
||||
Architecture string `json:"arch"`
|
||||
|
||||
// Compute group ID
|
||||
CompGroupID uint64 `json:"compgroupId"`
|
||||
|
||||
@@ -109,11 +112,47 @@ type ItemCompute struct {
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// StackID
|
||||
StackID uint64 `json:"stackId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Tech status
|
||||
TechStatus string `json:"techStatus"`
|
||||
}
|
||||
|
||||
// List of Computes
|
||||
type ListComputes []ItemCompute
|
||||
|
||||
// Main information about Group
|
||||
type ItemGroup struct {
|
||||
// Amount of computes
|
||||
Computes uint64 `json:"computes"`
|
||||
|
||||
// Consistency
|
||||
Consistency bool `json:"consistency"`
|
||||
|
||||
// Group ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Group name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// TechStatus
|
||||
TechStatus string `json:"techStatus"`
|
||||
}
|
||||
|
||||
// List of Groups
|
||||
type ListGroups []ItemGroup
|
||||
|
||||
// Main information about Snapshot
|
||||
type ItemSnapshot struct {
|
||||
// GUID
|
||||
|
||||
41
pkg/cloudapi/compute/boot_order_get.go
Normal file
41
pkg/cloudapi/compute/boot_order_get.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting boot order
|
||||
type BootOrderGetRequest struct {
|
||||
// Compute ID
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// BootOrderGet gets actual compute boot order information
|
||||
func (c Compute) BootOrderGet(ctx context.Context, req BootOrderGetRequest) ([]string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/bootOrderGet"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orders := make([]string, 0)
|
||||
|
||||
err = json.Unmarshal(res, &orders)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return orders, nil
|
||||
}
|
||||
49
pkg/cloudapi/compute/boot_order_set.go
Normal file
49
pkg/cloudapi/compute/boot_order_set.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for setting boot order
|
||||
type BootOrderSetRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// List of boot devices
|
||||
// Should be one of:
|
||||
// - cdrom
|
||||
// - network
|
||||
// - hd
|
||||
// Required: true
|
||||
Order []string `url:"order" json:"order" validate:"min=1,computeOrder"`
|
||||
}
|
||||
|
||||
// BootOrderSet sets compute boot order
|
||||
func (c Compute) BootOrderSet(ctx context.Context, req BootOrderSetRequest) ([]string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/bootOrderSet"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orders := make([]string, 0)
|
||||
|
||||
err = json.Unmarshal(res, &orders)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return orders, nil
|
||||
}
|
||||
47
pkg/cloudapi/compute/change_link_state.go
Normal file
47
pkg/cloudapi/compute/change_link_state.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request struct for changing link state
|
||||
type ChangeLinkStateRequest struct {
|
||||
// Compute ID
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// Interface name or MAC address
|
||||
// Required: true
|
||||
Interface string `url:"interface" json:"interface" validate:"required"`
|
||||
|
||||
// Interface state
|
||||
// Must be either "on" or "off"
|
||||
// Required: true
|
||||
State string `url:"state" json:"state" validate:"required,interfaceState"`
|
||||
}
|
||||
|
||||
// ChangeLinkState changes the status link virtual of compute
|
||||
func (c Compute) ChangeLinkState(ctx context.Context, req ChangeLinkStateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/changeLinkState"
|
||||
|
||||
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
|
||||
}
|
||||
@@ -22,6 +22,11 @@ type DiskAddRequest struct {
|
||||
// Required: true
|
||||
Size uint64 `url:"size" json:"size" validate:"required"`
|
||||
|
||||
// Storage endpoint provider ID
|
||||
// By default the same with boot disk
|
||||
// Required: false
|
||||
SepID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Type of the disk
|
||||
// Should be one of:
|
||||
// - D
|
||||
@@ -29,11 +34,6 @@ type DiskAddRequest struct {
|
||||
// Required: false
|
||||
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
|
||||
|
||||
// Storage endpoint provider ID
|
||||
// By default the same with boot disk
|
||||
// Required: false
|
||||
SepID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Pool name
|
||||
// By default will be chosen automatically
|
||||
// Required: false
|
||||
|
||||
@@ -17,6 +17,10 @@ type DiskAttachRequest struct {
|
||||
// ID of the disk to attach
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
|
||||
// Type of the disk B;D
|
||||
// Required: false
|
||||
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"`
|
||||
}
|
||||
|
||||
// DiskAttach attach disk to compute
|
||||
|
||||
@@ -150,6 +150,9 @@ type RecordNetAttach struct {
|
||||
// Default GW
|
||||
DefGW string `json:"defGw"`
|
||||
|
||||
// Enabled
|
||||
Enabled bool `json:"enabled"`
|
||||
|
||||
// FLIPGroup ID
|
||||
FLIPGroupID uint64 `json:"flipgroupId"`
|
||||
|
||||
@@ -178,7 +181,7 @@ type RecordNetAttach struct {
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
// QOS
|
||||
QOS QOS `json:"qos"`
|
||||
@@ -483,6 +486,9 @@ type ItemVNFInterface struct {
|
||||
// Default GW
|
||||
DefGW string `json:"defGw"`
|
||||
|
||||
// Enabled
|
||||
Enabled bool `json:"enabled"`
|
||||
|
||||
// FLIPGroup ID
|
||||
FLIPGroupID uint64 `json:"flipgroupId"`
|
||||
|
||||
@@ -511,7 +517,7 @@ type ItemVNFInterface struct {
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
// QOS
|
||||
QOS QOS `json:"qos"`
|
||||
@@ -611,7 +617,7 @@ type ItemComputeDisk struct {
|
||||
Passwd string `json:"passwd"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
// Pool
|
||||
Pool string `json:"pool"`
|
||||
@@ -895,7 +901,7 @@ type InfoDisk struct {
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// PCISlot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
}
|
||||
|
||||
// List information about computes
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
// Request struct for get list types of disks
|
||||
type ListTypesRequest struct {
|
||||
// Show detailed disk types by seps
|
||||
// Required: false
|
||||
Detailed bool `url:"detailed,omitempty" json:"detailed,omitempty"`
|
||||
// Required: true
|
||||
Detailed bool `url:"detailed" json:"detailed" validate:"required"`
|
||||
}
|
||||
|
||||
// ListTypes gets list defined disk types
|
||||
|
||||
@@ -377,7 +377,7 @@ type RecordDisk struct {
|
||||
ParentID uint64 `json:"parentId"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
// Pool
|
||||
Pool string `json:"pool"`
|
||||
|
||||
@@ -59,6 +59,9 @@ type ListExtNetComputes []ItemExtNetCompute
|
||||
|
||||
// QOS
|
||||
type QOS struct {
|
||||
// EBurst
|
||||
EBurst uint64 `json:"eBurst"`
|
||||
|
||||
// ERate
|
||||
ERate uint64 `json:"eRate"`
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ type RecordK8CI struct {
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network plugins
|
||||
NetworkPlugins []string `json:"networkPlugins"`
|
||||
|
||||
// Version
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ type CreateRequest struct {
|
||||
// Required: true
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required"`
|
||||
|
||||
// Network plugin
|
||||
// Must be one of these values: flannel, weawenet, calico
|
||||
// Required: true
|
||||
NetworkPlugin string `url:"networkPlugin" json:"networkPlugin" validate:"required,networkPlugin"`
|
||||
|
||||
// ID of SEP to create boot disks for master nodes. Uses images SEP ID if not set
|
||||
// Required: false
|
||||
MasterSEPID uint64 `url:"masterSepId,omitempty" json:"masterSepId,omitempty"`
|
||||
|
||||
@@ -101,6 +101,9 @@ type RecordK8S struct {
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network plugin
|
||||
NetworkPlugin string `json:"networkPlugin"`
|
||||
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
@@ -246,6 +249,9 @@ type ItemK8SCluster struct {
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network plugin
|
||||
NetworkPlugin string `json:"networkPlugin"`
|
||||
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ type RecordResourceGroup struct {
|
||||
// Access Control List
|
||||
ACL ListACL `json:"acl"`
|
||||
|
||||
// CPU allocation parameter
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -107,12 +113,18 @@ type RecordResourceGroup struct {
|
||||
// Resource limits
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
|
||||
// List of resource types
|
||||
ResTypes []string `json:"resourceTypes"`
|
||||
|
||||
// Secret
|
||||
Secret string `json:"secret"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// UniqPools
|
||||
UniqPools []string `json:"uniqPools"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
@@ -124,12 +136,6 @@ type RecordResourceGroup struct {
|
||||
|
||||
// List of compute IDs
|
||||
Computes []uint64 `json:"vms"`
|
||||
|
||||
// List of resource types
|
||||
ResTypes []string `json:"resourceTypes"`
|
||||
|
||||
// UniqPools
|
||||
UniqPools []string `json:"uniqPools"`
|
||||
}
|
||||
|
||||
// Main information about resource group
|
||||
@@ -146,6 +152,12 @@ type ItemResourceGroup struct {
|
||||
// Access Control List
|
||||
ACL ListACL `json:"acl"`
|
||||
|
||||
// CPU allocation parameter
|
||||
CPUAllocationParameter string `json:"cpu_allocation_parameter"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
@@ -194,12 +206,18 @@ type ItemResourceGroup struct {
|
||||
// Resource limits
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
|
||||
// List of resource types
|
||||
ResTypes []string `json:"resourceTypes"`
|
||||
|
||||
// Secret
|
||||
Secret string `json:"secret"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// UniqPools
|
||||
UniqPools []string `json:"uniqPools"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
@@ -211,12 +229,6 @@ type ItemResourceGroup struct {
|
||||
|
||||
// List of compute IDs
|
||||
Computes []uint64 `json:"vms"`
|
||||
|
||||
// List of resource types
|
||||
ResTypes []string `json:"resourceTypes"`
|
||||
|
||||
// UniqPools
|
||||
UniqPools []string `json:"uniqPools"`
|
||||
}
|
||||
|
||||
// List of resource groups
|
||||
|
||||
@@ -261,7 +261,7 @@ type ItemVNFInterface struct {
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
// QOS
|
||||
QOS QOS `json:"qos"`
|
||||
|
||||
Reference in New Issue
Block a user