Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf5c01b40b | |||
|
|
095a18f27a |
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,34 +1,12 @@
|
||||
## Version 1.12.5
|
||||
## Version 1.12.7
|
||||
|
||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||
Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами
|
||||
Метод `ListStacks` в cloudbroker/image стал deprecated и в следующих версиях будет удалён
|
||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
||||
|
||||
### Добавлено
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-625 | Обязательное поле `StoragePolicyID` и опциональные поля `PoolName` и `SEPID` в структуру запроса `CloneRequest` в cloudapi/compute и cloudbroker/compute |
|
||||
| BGOS-626 | Методы `CloneAbort` и `GetCloneStatus` и структуры запросов `CloneAbortRequest` и `GetCloneStatusRequest` в cloudbroker/compute |
|
||||
| BGOS-630 | Поле `BootImageID` в структуры ответа `ItemCompute` и `RecordCompute` в cloudapi/compute и в структуры ответа `RecordCompute` и `InfoCompute` в cloudbroker/compute |
|
||||
|
||||
#### disks
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-627 | Методы `Migrate`, `MigrateAbort` и `GetMigrateStatus`, структуры запросов `MigrateRequest`, `CloneMigrateRequest` и `GetMigrateStatusRequest` и структура ответа `MigrateStatus` в cloudbroker/disks |
|
||||
|
||||
### Исправлено
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-623 | Тип поля `EnableSecGroups` с `bool` на `interface{}` в структуре запроса `ChangeSecGroupsRequest` в cloudapi/compute и в cloudbroker/compute |
|
||||
| BGOS-625 | Возвращаемое значение в функции `Clone` с `uint64` на `string` в cloudapi/compute и cloudbroker/compute |
|
||||
| BGOS-629 | Возвращаемое значение метода `CreateTemplate` изменено с `uint64` на `string` в cloudapi/compute и в cloudbroker/compute |
|
||||
|
||||
### Удалено
|
||||
|
||||
#### compute
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
| --- | --- |
|
||||
| BGOS-629 | Методы `CreateTemplateAsync` в cloudapi/compute и в cloudbroker/compute |
|
||||
|
||||
#### rg
|
||||
| Идентификатор<br>задачи | Описание |
|
||||
|-------------------------|--------------------------------------------------------|
|
||||
| BGOS-641 | Методы `AddStoragePolicy` и `DelStoragePolicy` и структуры запроса `AddStoragePolicyRequest` и `DelStoragePolicyRequest` в cloudapi/rg |
|
||||
|
||||
24
check.go
24
check.go
@@ -28,7 +28,13 @@ func (de DecortClient) Check() (*CheckInfo, error) {
|
||||
|
||||
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var v string
|
||||
json.Unmarshal([]byte(res), &v)
|
||||
if _, exists := constants.VersionMap[v]; exists {
|
||||
info.Version = v
|
||||
} else {
|
||||
return nil, fmt.Errorf("platform version isn't supported")
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := constants.VersionMap[info.Version]; ok {
|
||||
@@ -51,7 +57,13 @@ func (bvs BVSDecortClient) Check() (*CheckInfo, error) {
|
||||
|
||||
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var v string
|
||||
json.Unmarshal([]byte(res), &v)
|
||||
if _, exists := constants.VersionMap[v]; exists {
|
||||
info.Version = v
|
||||
} else {
|
||||
return nil, fmt.Errorf("platform version isn't supported")
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := constants.VersionMap[info.Version]; ok {
|
||||
@@ -74,7 +86,13 @@ func (ldc LegacyDecortClient) Check() (*CheckInfo, error) {
|
||||
|
||||
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var v string
|
||||
json.Unmarshal([]byte(res), &v)
|
||||
if _, exists := constants.VersionMap[v]; exists {
|
||||
info.Version = v
|
||||
} else {
|
||||
return nil, fmt.Errorf("platform version isn't supported")
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := constants.VersionMap[info.Version]; ok {
|
||||
|
||||
@@ -28,5 +28,9 @@ var FileName = map[string]string{
|
||||
var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"}
|
||||
|
||||
var VersionMap = map[string]string{
|
||||
"4.4.0": "-",
|
||||
"4.3.0": "-",
|
||||
"4.2.0": "-",
|
||||
"4.1.1": "-",
|
||||
"4.1.0": "-",
|
||||
}
|
||||
|
||||
46
pkg/cloudapi/rg/add_storage_policy.go
Normal file
46
pkg/cloudapi/rg/add_storage_policy.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package rg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AddStoragePolicyRequest struct for adding storage policy to the resource group
|
||||
type AddStoragePolicyRequest struct {
|
||||
// ID of resource group to add to
|
||||
// Required: true
|
||||
RGID uint64 `url:"resgroup_id" json:"resgroup_id" validate:"required"`
|
||||
|
||||
// ID of the storage policy to which to connect resource group
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
|
||||
// Limit storage resources GB. Or -1 unlimit
|
||||
// Required: false
|
||||
Limit int `url:"limit,omitempty" json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
// AddStoragePolicy add storage policy to the account.
|
||||
func (r RG) AddStoragePolicy(ctx context.Context, req AddStoragePolicyRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/add_storage_policy"
|
||||
|
||||
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
|
||||
}
|
||||
42
pkg/cloudapi/rg/del_storage_policy.go
Normal file
42
pkg/cloudapi/rg/del_storage_policy.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package rg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DelStoragePolicyRequest struct for deleting storage policy to the resource group
|
||||
type DelStoragePolicyRequest struct {
|
||||
// ID of resource group
|
||||
// Required: true
|
||||
RGID uint64 `url:"resgroup_id" json:"resgroup_id" validate:"required"`
|
||||
|
||||
// ID of the storage policy to which to disconnect account
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
// DelStoragePolicy delete storage policy to the account.
|
||||
func (r RG) DelStoragePolicy(ctx context.Context, req DelStoragePolicyRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/del_storage_policy"
|
||||
|
||||
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
|
||||
}
|
||||
@@ -30,6 +30,9 @@ type ItemStoragePolicy struct {
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
@@ -56,6 +59,9 @@ type InfoStoragePolicy struct {
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// ID of the storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
@@ -214,6 +214,9 @@ type RecordVNFDev struct {
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
|
||||
// Live migration job ID
|
||||
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||
}
|
||||
|
||||
// VNF config
|
||||
|
||||
@@ -2,6 +2,7 @@ package image
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -43,6 +44,11 @@ type CreateCDROMImageRequest struct {
|
||||
PasswordDl string `url:"passwordDL,omitempty" json:"passwordDL,omitempty"`
|
||||
}
|
||||
|
||||
type asyncWrapperCreateCDROMImageRequest struct {
|
||||
CreateCDROMImageRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// CreateCDROMImage creates CD-ROM image from an ISO identified by URL
|
||||
func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -52,7 +58,9 @@ func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest
|
||||
|
||||
url := "/cloudbroker/image/createCDROMImage"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
syncReq := asyncWrapperCreateCDROMImageRequest{CreateCDROMImageRequest: req, AsyncMode: false}
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -64,3 +72,29 @@ func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AsyncCreateCDROMImage creates CD-ROM image from an ISO identified by URL in async mode
|
||||
func (i Image) AsyncCreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/image/createCDROMImage"
|
||||
|
||||
asyncReq := asyncWrapperCreateCDROMImageRequest{CreateCDROMImageRequest: req, AsyncMode: true}
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||
if err != nil {
|
||||
return " ", err
|
||||
}
|
||||
|
||||
var taskID string
|
||||
|
||||
err = json.Unmarshal(res, &taskID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return taskID, nil
|
||||
}
|
||||
|
||||
42
pkg/cloudbroker/node/update_description.go
Normal file
42
pkg/cloudbroker/node/update_description.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateDescriptionRequest struct to update description of the node
|
||||
type UpdateDescriptionRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"nid" json:"nid" validate:"required"`
|
||||
|
||||
// New description for the node
|
||||
// Required: true
|
||||
Description string `url:"description" json:"description" validate:"required"`
|
||||
}
|
||||
|
||||
// UpdateDescription updates description of the node
|
||||
func (n Node) UpdateDescription(ctx context.Context, req UpdateDescriptionRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/update_description"
|
||||
|
||||
res, err := n.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
|
||||
}
|
||||
@@ -56,6 +56,9 @@ type ItemStoragePolicy struct {
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
@@ -82,6 +85,9 @@ type InfoStoragePolicy struct {
|
||||
// Max IOPS for the storage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
@@ -250,6 +250,9 @@ type VNFDev struct {
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
|
||||
// Live migration job ID
|
||||
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
|
||||
}
|
||||
|
||||
// Main information about reservation
|
||||
|
||||
@@ -385,6 +385,8 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/rg/update": rg.UpdateRequest{},
|
||||
"/restmachine/cloudapi/rg/usage": rg.UsageRequest{},
|
||||
"/restmachine/cloudapi/rg/removeDefNet": rg.RemoveDefNetRequest{},
|
||||
"/restmachine/cloudapi/rg/add_storage_policy": rg.AddStoragePolicyRequest{},
|
||||
"/restmachine/cloudapi/rg/del_storage_policy": rg.DelStoragePolicyRequest{},
|
||||
|
||||
// security_group
|
||||
"/restmachine/cloudapi/security_group/create": secgroup.CreateRequest{},
|
||||
@@ -848,23 +850,24 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/lb/updateSysctlParams": lb_cb.UpdateSysctParamsRequest{},
|
||||
|
||||
// node
|
||||
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
|
||||
"/restmachine/cloudbroker/node/applyIpmiAction": node_cb.ApplyIpmiActionRequest{},
|
||||
"/restmachine/cloudbroker/node/consumption": node_cb.ConsumptionRequest{},
|
||||
"/restmachine/cloudbroker/node/decommission": node_cb.DecommissionRequest{},
|
||||
"/restmachine/cloudbroker/node/enable": node_cb.EnableRequest{},
|
||||
"/restmachine/cloudbroker/node/enableNodes": node_cb.EnableNodesRequest{},
|
||||
"/restmachine/cloudbroker/node/get": node_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/node/get_ssh_identity": node_cb.GetSSHIdentityRequest{},
|
||||
"/restmachine/cloudbroker/node/list": node_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/node/maintenance": node_cb.MaintenanceRequest{},
|
||||
"/restmachine/cloudbroker/node/restrict": node_cb.RestrictRequest{},
|
||||
"/restmachine/cloudbroker/node/setCoreIsolation": node_cb.SetCoreIsolationRequest{},
|
||||
"/restmachine/cloudbroker/node/setHugePages": node_cb.SetHugePagesRequest{},
|
||||
"/restmachine/cloudbroker/node/setsriovstatus": node_cb.SetSRIOVStatusRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
|
||||
"/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsParams": node_cb.VFParam{},
|
||||
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
|
||||
"/restmachine/cloudbroker/node/applyIpmiAction": node_cb.ApplyIpmiActionRequest{},
|
||||
"/restmachine/cloudbroker/node/consumption": node_cb.ConsumptionRequest{},
|
||||
"/restmachine/cloudbroker/node/decommission": node_cb.DecommissionRequest{},
|
||||
"/restmachine/cloudbroker/node/enable": node_cb.EnableRequest{},
|
||||
"/restmachine/cloudbroker/node/enableNodes": node_cb.EnableNodesRequest{},
|
||||
"/restmachine/cloudbroker/node/get": node_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/node/get_ssh_identity": node_cb.GetSSHIdentityRequest{},
|
||||
"/restmachine/cloudbroker/node/list": node_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/node/maintenance": node_cb.MaintenanceRequest{},
|
||||
"/restmachine/cloudbroker/node/restrict": node_cb.RestrictRequest{},
|
||||
"/restmachine/cloudbroker/node/setCoreIsolation": node_cb.SetCoreIsolationRequest{},
|
||||
"/restmachine/cloudbroker/node/setHugePages": node_cb.SetHugePagesRequest{},
|
||||
"/restmachine/cloudbroker/node/setsriovstatus": node_cb.SetSRIOVStatusRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
|
||||
"/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/node/update_description": node_cb.UpdateDescriptionRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsParams": node_cb.VFParam{},
|
||||
|
||||
// pcidevice
|
||||
"/restmachine/cloudbroker/pcidevice/create": pcidevice_cb.CreateRequest{},
|
||||
|
||||
Reference in New Issue
Block a user