v1.16.3
This commit is contained in:
40
CHANGELOG.md
40
CHANGELOG.md
@@ -1,4 +1,4 @@
|
|||||||
## Version 1.16.2
|
## Version 1.16.3
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
@@ -21,40 +21,28 @@
|
|||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### audit
|
#### extnet
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1025 | Вычисляемое поле `PublicSessionID` в структуры ответа `ItemAudit` и `RecordAudit` в cloudbroker/audit и cloudapi/audit |
|
| BGOS-1034 | Методы `AsyncCreate`, `AsyncDeviceDeploy` и `AsyncSetHAMode` в cloudbroker/extnet |
|
||||||
| BGOS-1025 | Опциональное поле `PublicSessionID` в структуру запроса `ListRequest` в cloudbroker/audit и cloudapi/audit |
|
|
||||||
|
|
||||||
#### grid
|
|
||||||
|
#### locations
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1028 | Вычисляемое поле `Budget` в структуры ответа `ItemGridList` и `RecordGrid` в cloudbroker/grid |
|
| BGOS-1032 | Вычисляемое поле `VMFoldersEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
|
||||||
|
|
||||||
#### vins
|
#### vins
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1027 | Вычисляемое поле `QoSPolicies` в структуру ответа `ItemVNFInterface` в cloudbroker/vins и cloudapi/vins |
|
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy` и `AsyncVNFDevRestart` в cloudapi/vins |
|
||||||
|
| BGOS-1033 | Методы `AsyncCreateInAccount`, `AsyncCreateInRG`, `AsyncEnable`, `AsyncVNFDevRedeploy`, `AsyncVNFDevRestart` и `AsyncVNFDevStart` в cloudbroker/vins |
|
||||||
|
| BGOS-1033 | Структура запроса `DisableRequest` и метод `Disable` в cloudapi/vins |
|
||||||
|
| BGOS-1033 | Структура запроса `EnableRequest` и метод `Enable` в cloudapi/vins |
|
||||||
|
|
||||||
#### session
|
### Исправлено
|
||||||
|
|
||||||
|
#### kvmx86
|
||||||
| Идентификатор задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-1026 | Группа ручек cloudbroker/session |
|
| BGOS-1040 | JSON-тэг опционального поля `AsyncMode` с `asyncMode` на `async_mode` в структуре запроса `CreateRequest` в cloudapi/kvmx86 и cloudbroker/kvmx86 |
|
||||||
|
|
||||||
|
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### network qos policy
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1030 | Тип вычисляемых полей `PCPTag` и `DSCPValue` с `uint64` на `*uint64` в структуре ответа `Rule` в cloudapi/qospolicy и cloudbroker/qospolicy |
|
|
||||||
| BGOS-1030 | Тип опциональных полей `Name` и `Description` с `string` на `*string` в структуре запроса `UpdateRequest` в cloudapi/qospolicy и cloudbroker/qospolicy |
|
|
||||||
|
|
||||||
|
|
||||||
### Удалено
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-1029 | Опциональное поле `Type` из структуры запроса `ListVGPURequest` в cloudbroker/compute и cloudapi/compute |
|
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
|
|||||||
|
|
||||||
type wrapperCreateRequest struct {
|
type wrapperCreateRequest struct {
|
||||||
CreateRequest
|
CreateRequest
|
||||||
AsyncMode bool `json:"asyncMode"`
|
AsyncMode bool `json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates KVM x86 VM based on specified OS image
|
// Create creates KVM x86 VM based on specified OS image
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ type ItemLocation struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Are VM Folders enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of locations
|
// List of locations
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -69,6 +70,11 @@ type CreateInAccountRequest struct {
|
|||||||
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperCreateInAccountRequest struct {
|
||||||
|
CreateInAccountRequest
|
||||||
|
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) {
|
func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -78,7 +84,12 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
|
|
||||||
url := "/cloudapi/vins/createInAccount"
|
url := "/cloudapi/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
syncReq := asyncWrapperCreateInAccountRequest{
|
||||||
|
CreateInAccountRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -90,3 +101,32 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateInAccount creates VINS in account level in async mode
|
||||||
|
func (v VINS) AsyncCreateInAccount(ctx context.Context, req CreateInAccountRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperCreateInAccountRequest{
|
||||||
|
CreateInAccountRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/createInAccount"
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -63,6 +64,11 @@ type CreateInRGRequest struct {
|
|||||||
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperCreateInRgRequest struct {
|
||||||
|
CreateInRGRequest
|
||||||
|
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) {
|
func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -72,7 +78,12 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
|
|
||||||
url := "/cloudapi/vins/createInRG"
|
url := "/cloudapi/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
syncReq := asyncWrapperCreateInRgRequest{
|
||||||
|
CreateInRGRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -84,3 +95,32 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateInRG creates VINS in resource group level in async mode
|
||||||
|
func (v VINS) AsyncCreateInRG(ctx context.Context, req CreateInRGRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/createInRG"
|
||||||
|
|
||||||
|
syncReq := asyncWrapperCreateInRgRequest{
|
||||||
|
CreateInRGRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
39
pkg/cloudapi/vins/disable.go
Normal file
39
pkg/cloudapi/vins/disable.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DisableRequest struct to disable VINS
|
||||||
|
type DisableRequest struct {
|
||||||
|
// VINS ID
|
||||||
|
// Required: true
|
||||||
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable disables VINS
|
||||||
|
func (v VINS) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/disable"
|
||||||
|
|
||||||
|
res, err := v.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
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package vins
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DisableEnableRequest struct to disable/enable VINS
|
|
||||||
type DisableEnableRequest struct {
|
|
||||||
// VINS ID
|
|
||||||
// Required: true
|
|
||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable disables VINS
|
|
||||||
func (v VINS) Disable(ctx context.Context, req DisableEnableRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/disable"
|
|
||||||
|
|
||||||
res, err := v.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
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable enables VINS
|
|
||||||
func (v VINS) Enable(ctx context.Context, req DisableEnableRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudapi/vins/enable"
|
|
||||||
|
|
||||||
res, err := v.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
|
|
||||||
|
|
||||||
}
|
|
||||||
78
pkg/cloudapi/vins/enable.go
Normal file
78
pkg/cloudapi/vins/enable.go
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// EnableRequest struct to enable VINS
|
||||||
|
type EnableRequest struct {
|
||||||
|
// VINS ID
|
||||||
|
// Required: true
|
||||||
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type asyncWrapperEnableRequest struct {
|
||||||
|
EnableRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable enables VINS
|
||||||
|
func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/enable"
|
||||||
|
|
||||||
|
syncReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable enables VINS by ID in async mode
|
||||||
|
func (v VINS) AsyncEnable(ctx context.Context, req EnableRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/enable"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type VNFDevRedeployRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperVNFDevRedeployRequest struct {
|
||||||
|
VNFDevRedeployRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// VNFDevRedeploy redeploys VINS VNFDevs
|
// VNFDevRedeploy redeploys VINS VNFDevs
|
||||||
func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) {
|
func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
|
|||||||
|
|
||||||
url := "/cloudapi/vins/vnfdevRedeploy"
|
url := "/cloudapi/vins/vnfdevRedeploy"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperVNFDevRedeployRequest{
|
||||||
|
VNFDevRedeployRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VNFDevRedeploy redeploys VINS VNFDevs in async mode
|
||||||
|
func (v VINS) AsyncVNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/vnfdevRedeploy"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperVNFDevRedeployRequest{
|
||||||
|
VNFDevRedeployRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type VNFDevRestartRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperVNFDevRestartRequest struct {
|
||||||
|
VNFDevRestartRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// VNFDevRestart reboots VINSes primary VNF device
|
// VNFDevRestart reboots VINSes primary VNF device
|
||||||
func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) {
|
func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
|
|||||||
|
|
||||||
url := "/cloudapi/vins/vnfdevRestart"
|
url := "/cloudapi/vins/vnfdevRestart"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperVNFDevRestartRequest{
|
||||||
|
VNFDevRestartRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VNFDevRestart reboots VINSes primary VNF device in async mode
|
||||||
|
func (v VINS) AsyncVNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vins/vnfdevRestart"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperVNFDevRestartRequest{
|
||||||
|
VNFDevRestartRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ type wrapperCreateRequest struct {
|
|||||||
Routes []string `url:"routes,omitempty"`
|
Routes []string `url:"routes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperCreateRequest struct {
|
||||||
|
wrapperCreateRequest
|
||||||
|
AsyncMode bool `url:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// Create creates new external network into platform
|
// Create creates new external network into platform
|
||||||
func (e ExtNet) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
func (e ExtNet) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -145,9 +150,14 @@ func (e ExtNet) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
|||||||
Routes: routes,
|
Routes: routes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqWrappedAsync := asyncWrapperCreateRequest{
|
||||||
|
wrapperCreateRequest: reqWrapped,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/extnet/create"
|
url := "/cloudbroker/extnet/create"
|
||||||
|
|
||||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, reqWrappedAsync)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -159,3 +169,54 @@ func (e ExtNet) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AsyncCreate creates new external network into platform in async mode
|
||||||
|
func (e ExtNet) AsyncCreate(ctx context.Context, req CreateRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
var routes []string
|
||||||
|
|
||||||
|
if len(req.Routes) != 0 {
|
||||||
|
routes = make([]string, 0, len(req.Routes))
|
||||||
|
|
||||||
|
for r := range req.Routes {
|
||||||
|
b, err := json.Marshal(req.Routes[r])
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
routes = append(routes, string(b))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
routes = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
reqWrapped := wrapperCreateRequest{
|
||||||
|
CreateRequest: req,
|
||||||
|
Routes: routes,
|
||||||
|
}
|
||||||
|
|
||||||
|
reqWrappedAsync := asyncWrapperCreateRequest{
|
||||||
|
wrapperCreateRequest: reqWrapped,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/extnet/create"
|
||||||
|
|
||||||
|
result, err := e.client.DecortApiCall(ctx, http.MethodPost, url, reqWrappedAsync)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package extnet
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type DeviceDeployRequest struct {
|
|||||||
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperDeviceDeployRequest struct {
|
||||||
|
DeviceDeployRequest
|
||||||
|
AsyncMode bool `url:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// DeviceDeploy deploys network device for external network (make not virtual, "physical")
|
// DeviceDeploy deploys network device for external network (make not virtual, "physical")
|
||||||
func (e ExtNet) DeviceDeploy(ctx context.Context, req DeviceDeployRequest) (bool, error) {
|
func (e ExtNet) DeviceDeploy(ctx context.Context, req DeviceDeployRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (e ExtNet) DeviceDeploy(ctx context.Context, req DeviceDeployRequest) (bool
|
|||||||
|
|
||||||
url := "/cloudbroker/extnet/deviceDeploy"
|
url := "/cloudbroker/extnet/deviceDeploy"
|
||||||
|
|
||||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperDeviceDeployRequest{
|
||||||
|
DeviceDeployRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (e ExtNet) DeviceDeploy(ctx context.Context, req DeviceDeployRequest) (bool
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AsyncDeviceDeploy deploys network device for external network (make not virtual, "physical") in async mode
|
||||||
|
func (e ExtNet) AsyncDeviceDeploy(ctx context.Context, req DeviceDeployRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/extnet/deviceDeploy"
|
||||||
|
|
||||||
|
syncReq := asyncWrapperDeviceDeployRequest{
|
||||||
|
DeviceDeployRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := e.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package extnet
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -19,6 +20,11 @@ type SetHAModeRequest struct {
|
|||||||
HAMode bool `url:"highly_available" json:"highly_available" validate:"required"`
|
HAMode bool `url:"highly_available" json:"highly_available" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperSetHAModeRequest struct {
|
||||||
|
SetHAModeRequest
|
||||||
|
AsyncMode bool `url:"async_mode"`
|
||||||
|
}
|
||||||
|
|
||||||
// SetHAMode set HA mode for external network
|
// SetHAMode set HA mode for external network
|
||||||
func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, error) {
|
func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -28,7 +34,12 @@ func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, erro
|
|||||||
|
|
||||||
url := "/cloudbroker/extnet/set_highly_available"
|
url := "/cloudbroker/extnet/set_highly_available"
|
||||||
|
|
||||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperSetHAModeRequest{
|
||||||
|
SetHAModeRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -40,3 +51,32 @@ func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, erro
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AsyncSetHAMode set HA mode for external network in async mode
|
||||||
|
func (e ExtNet) AsyncSetHAMode(ctx context.Context, req SetHAModeRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/extnet/set_highly_available"
|
||||||
|
|
||||||
|
syncReq := asyncWrapperSetHAModeRequest{
|
||||||
|
SetHAModeRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := e.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ func (r CreateRequest) GetRAM() map[string]uint64 {
|
|||||||
|
|
||||||
type wrapperCreateRequest struct {
|
type wrapperCreateRequest struct {
|
||||||
CreateRequest
|
CreateRequest
|
||||||
AsyncMode bool `json:"asyncMode"`
|
AsyncMode bool `json:"async_mode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates KVM PowerPC VM based on specified OS image
|
// Create creates KVM PowerPC VM based on specified OS image
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -69,6 +70,11 @@ type CreateInAccountRequest struct {
|
|||||||
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperCreateInAccountRequest struct {
|
||||||
|
CreateInAccountRequest
|
||||||
|
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateInAccount creates VINS in account level
|
// CreateInAccount creates VINS in account level
|
||||||
func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) {
|
func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -78,7 +84,12 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/createInAccount"
|
url := "/cloudbroker/vins/createInAccount"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
syncReq := asyncWrapperCreateInAccountRequest{
|
||||||
|
CreateInAccountRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -90,3 +101,32 @@ func (v VINS) CreateInAccount(ctx context.Context, req CreateInAccountRequest) (
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateInAccount creates VINS in account level in async mode
|
||||||
|
func (v VINS) AsyncCreateInAccount(ctx context.Context, req CreateInAccountRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperCreateInAccountRequest{
|
||||||
|
CreateInAccountRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/createInAccount"
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -63,6 +64,11 @@ type CreateInRGRequest struct {
|
|||||||
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
EnableDefaultGateway interface{} `url:"enable_default_gateway,omitempty" json:"enable_default_gateway,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperCreateInRgRequest struct {
|
||||||
|
CreateInRGRequest
|
||||||
|
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateInRG creates VINS in resource group level
|
// CreateInRG creates VINS in resource group level
|
||||||
func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) {
|
func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -72,7 +78,12 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/createInRG"
|
url := "/cloudbroker/vins/createInRG"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
syncReq := asyncWrapperCreateInRgRequest{
|
||||||
|
CreateInRGRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -84,3 +95,32 @@ func (v VINS) CreateInRG(ctx context.Context, req CreateInRGRequest) (uint64, er
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateInRG creates VINS in resource group level in async mode
|
||||||
|
func (v VINS) AsyncCreateInRG(ctx context.Context, req CreateInRGRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/createInRG"
|
||||||
|
|
||||||
|
syncReq := asyncWrapperCreateInRgRequest{
|
||||||
|
CreateInRGRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, syncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type EnableRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperEnableRequest struct {
|
||||||
|
EnableRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// Enable enables VINS by ID
|
// Enable enables VINS by ID
|
||||||
func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/enable"
|
url := "/cloudbroker/vins/enable"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable enables VINS by ID in async mode
|
||||||
|
func (v VINS) AsyncEnable(ctx context.Context, req EnableRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/enable"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperEnableRequest{
|
||||||
|
EnableRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type VNFDevRedeployRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperVNFDevRedeployRequest struct {
|
||||||
|
VNFDevRedeployRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// VNFDevRedeploy redeploys VINS VNFDevs
|
// VNFDevRedeploy redeploys VINS VNFDevs
|
||||||
func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) {
|
func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/vnfdevRedeploy"
|
url := "/cloudbroker/vins/vnfdevRedeploy"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperVNFDevRedeployRequest{
|
||||||
|
VNFDevRedeployRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (bo
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VNFDevRedeploy redeploys VINS VNFDevs in async mode
|
||||||
|
func (v VINS) AsyncVNFDevRedeploy(ctx context.Context, req VNFDevRedeployRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/vnfdevRedeploy"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperVNFDevRedeployRequest{
|
||||||
|
VNFDevRedeployRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type VNFDevRestartRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperVNFDevRestartRequest struct {
|
||||||
|
VNFDevRestartRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// VNFDevRestart reboots VINSes primary VNF device
|
// VNFDevRestart reboots VINSes primary VNF device
|
||||||
func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) {
|
func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/vnfdevRestart"
|
url := "/cloudbroker/vins/vnfdevRestart"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperVNFDevRestartRequest{
|
||||||
|
VNFDevRestartRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) VNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (bool
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VNFDevRestart reboots VINSes primary VNF device in async mode
|
||||||
|
func (v VINS) AsyncVNFDevRestart(ctx context.Context, req VNFDevRestartRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/vnfdevRestart"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperVNFDevRestartRequest{
|
||||||
|
VNFDevRestartRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package vins
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ type VNFDevStartRequest struct {
|
|||||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type asyncWrapperVNFDevStartRequest struct {
|
||||||
|
VNFDevStartRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
// VNFDevStart starts VINSes primary VNF device
|
// VNFDevStart starts VINSes primary VNF device
|
||||||
func (v VINS) VNFDevStart(ctx context.Context, req VNFDevStartRequest) (bool, error) {
|
func (v VINS) VNFDevStart(ctx context.Context, req VNFDevStartRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
@@ -24,7 +30,12 @@ func (v VINS) VNFDevStart(ctx context.Context, req VNFDevStartRequest) (bool, er
|
|||||||
|
|
||||||
url := "/cloudbroker/vins/vnfdevStart"
|
url := "/cloudbroker/vins/vnfdevStart"
|
||||||
|
|
||||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
syncReq := asyncWrapperVNFDevStartRequest{
|
||||||
|
VNFDevStartRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -36,3 +47,32 @@ func (v VINS) VNFDevStart(ctx context.Context, req VNFDevStartRequest) (bool, er
|
|||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VNFDevStart starts VINSes primary VNF device
|
||||||
|
func (v VINS) AsyncVNFDevStart(ctx context.Context, req VNFDevStartRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vins/vnfdevStart"
|
||||||
|
|
||||||
|
asyncReq := asyncWrapperVNFDevStartRequest{
|
||||||
|
VNFDevStartRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := v.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
var resp string
|
||||||
|
|
||||||
|
err = json.Unmarshal(result, &resp)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -461,9 +461,9 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
|||||||
"/restmachine/cloudapi/vins/createInAccount": vins.CreateInAccountRequest{},
|
"/restmachine/cloudapi/vins/createInAccount": vins.CreateInAccountRequest{},
|
||||||
"/restmachine/cloudapi/vins/createInRG": vins.CreateInRGRequest{},
|
"/restmachine/cloudapi/vins/createInRG": vins.CreateInRGRequest{},
|
||||||
"/restmachine/cloudapi/vins/delete": vins.DeleteRequest{},
|
"/restmachine/cloudapi/vins/delete": vins.DeleteRequest{},
|
||||||
"/restmachine/cloudapi/vins/disable": vins.DisableEnableRequest{},
|
"/restmachine/cloudapi/vins/disable": vins.DisableRequest{},
|
||||||
"/restmachine/cloudapi/vins/dnsApply": vins.DNSApplyRequest{},
|
"/restmachine/cloudapi/vins/dnsApply": vins.DNSApplyRequest{},
|
||||||
"/restmachine/cloudapi/vins/enable": vins.DisableEnableRequest{},
|
"/restmachine/cloudapi/vins/enable": vins.EnableRequest{},
|
||||||
"/restmachine/cloudapi/vins/extNetConnect": vins.ExtNetConnectRequest{},
|
"/restmachine/cloudapi/vins/extNetConnect": vins.ExtNetConnectRequest{},
|
||||||
"/restmachine/cloudapi/vins/extNetDisconnect": vins.ExtNetDisconnectRequest{},
|
"/restmachine/cloudapi/vins/extNetDisconnect": vins.ExtNetDisconnectRequest{},
|
||||||
"/restmachine/cloudapi/vins/extNetList": vins.ExtNetListRequest{},
|
"/restmachine/cloudapi/vins/extNetList": vins.ExtNetListRequest{},
|
||||||
|
|||||||
Reference in New Issue
Block a user