parent
7d6cda7119
commit
aaf0857ff0
@ -1,33 +1,44 @@
|
||||
## Version 1.3.1
|
||||
## Version 1.4.0
|
||||
|
||||
### Features
|
||||
|
||||
- Added FilterByGID for cloudapi/locations/list handler response, used to filter locations by specified GID.
|
||||
- Added /cloudbroker/pcidevices endpoints support
|
||||
- /cloudbroker/pcidevices/create
|
||||
- /cloudbroker/pcidevices/delete
|
||||
- /cloudbroker/pcidevices/disable
|
||||
- /cloudbroker/pcidevices/enable
|
||||
- /cloudbroker/pcidevices/list
|
||||
- Added /cloudbroker/vgpu endpoints support
|
||||
- /cloudbroker/vgpu/allocate
|
||||
- /cloudbroker/vgpu/create
|
||||
- /cloudbroker/vgpu/deallocate
|
||||
- /cloudbroker/vgpu/destroy
|
||||
- /cloudbroker/vgpu/list
|
||||
- Actualized SDK to platform version 3.8.6:
|
||||
- Added required field networkPlugin to requests in:
|
||||
- /cloudapi/cloudbroker/k8s/create;
|
||||
- /cloudbroker/k8ci/create.
|
||||
- Added networkPlugin field in models:
|
||||
- /cloudapi/cloudbroker/k8s;
|
||||
- /cloudbroker/k8ci.
|
||||
- Updated list of compute objects fields and added list of group objects in bservice model.
|
||||
- Added cpuAllocationRatio and cpuAllocationParameter fields in models:
|
||||
- /cloudapi/cloudbroker/rg;
|
||||
- /cloudapi/cloudbroker/account.
|
||||
- Added setCpuAllocationRatio endpoint support in:
|
||||
- /cloudbroker/account;
|
||||
- /cloudbroker/rg.
|
||||
- Added /cloudbrocker/grid/setCpuAllocationRatioForVM endpoint support.
|
||||
- Added setCpuAllocationParameter endpoint support in:
|
||||
- /cloudbroker/account;
|
||||
- /cloudbroker/rg;
|
||||
- /cloudbroker/grid.
|
||||
- Added cloudapi/cloudbroker/compute/changeLinkState endpoint support.
|
||||
|
||||
- Added enabled field in cloudapi/compute models:
|
||||
- interfaces in compute/list response;
|
||||
- RecordNetAttach (compute/netAttach response).
|
||||
|
||||
- Added cloudapi/compute/bootOrderSet endpoint support.
|
||||
|
||||
- Added cloudapi/compute/bootOrderGet endpoint support.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed cloudbroker/cloudapi/account/update request model types.
|
||||
- Fixed cloudbroker/cloudapi/rg/update request model types.
|
||||
- Fixed cloudapi/account DeactivationTime field type.
|
||||
- Fixed cloudapi/k8s/workersGroupAdd return value type.
|
||||
- Fixed cloudapi/disks/listUnattached return value type.
|
||||
- Added ListDisksUnattached model as a cloudapi/disks/listUnattached handler response with filters.
|
||||
- Fixed cloudapi/extnet Excluded field type.
|
||||
- Fixed cloudapi/rg RecordResourceUsage model.
|
||||
- Fixed cloudapi/compute ItemACL model.
|
||||
- Fixed pciSlot field type in models:
|
||||
- cloudapi/cloudbroker/computes;
|
||||
- cloudapi/cloudbroker/vins.
|
||||
|
||||
- Fixed handling cloudapi/account/restore endpoint response (panicked when marhalling).
|
||||
|
||||
### Tests
|
||||
- Added missing field diskType in cloudapi/compute/diskAttach request.
|
||||
|
||||
- Covered cloudapi/disks ListDisksUnattached filters with unit tests.
|
||||
- Added missing eBurst field in cloudapi/extnet QOS model.
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation parameter
|
||||
type SetCPUAllocationParameterRequest struct {
|
||||
// Account ID
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accoutnId" validate:"required"`
|
||||
|
||||
// CPU allocation parameter.
|
||||
// If "strict" VM can't be run if not enough CPU resources.
|
||||
// "loose" allow running VM if not enough resources.
|
||||
// Required: true
|
||||
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationParameter sets CPU allocation parameter
|
||||
func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationParameter"
|
||||
|
||||
res, 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
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation ratio
|
||||
type SetCPUAllocationRatioRequest struct {
|
||||
// Account ID
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accoutnId" validate:"required"`
|
||||
|
||||
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatio sets CPU allocation ratio
|
||||
func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationRatio"
|
||||
|
||||
res, 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
|
||||
}
|
@ -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 := "/cloudbroker/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
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation parameter
|
||||
type SetCPUAllocationParameterRequest struct {
|
||||
// Grid ID
|
||||
// Required: true
|
||||
GridID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
|
||||
// CPU allocation parameter.
|
||||
// If "strict" VM can't be run if not enough CPU resources.
|
||||
// "loose" allow running VM if not enough resources.
|
||||
// Required: true
|
||||
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationParameter sets CPU allocation parameter
|
||||
func (g Grid) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/setCpuAllocationParameter"
|
||||
|
||||
res, err := g.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
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation ratio for computes
|
||||
type SetCPUAllocationRatioForVMRequest struct {
|
||||
// Grid ID
|
||||
// Required: true
|
||||
GridID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
|
||||
// Default CPU allocation ratio for computes
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatio sets CPU allocation ratio for computes
|
||||
func (g Grid) SetCPUAllocationRatioForVM(ctx context.Context, req SetCPUAllocationRatioForVMRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/setCpuAllocationRatioForVM"
|
||||
|
||||
res, err := g.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
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package rg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation parameter
|
||||
type SetCPUAllocationParameterRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
|
||||
|
||||
// CPU allocation parameter.
|
||||
// If "strict" VM can't be run if not enough CPU resources.
|
||||
// "loose" allow running VM if not enough resources.
|
||||
// Required: true
|
||||
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationParameter sets CPU allocation parameter
|
||||
func (r RG) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/rg/setCpuAllocationParameter"
|
||||
|
||||
res, err := r.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
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package rg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request for setting CPU allocation ratio
|
||||
type SetCPUAllocationRatioRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
|
||||
|
||||
// CPU allocation ratio, i.e. one pCPU = ratio*vCPU
|
||||
// Required: true
|
||||
Ratio float64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatio sets CPU allocation ratio
|
||||
func (r RG) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/rg/setCpuAllocationRatio"
|
||||
|
||||
res, err := r.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
|
||||
}
|
Loading…
Reference in new issue