Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a3999648e | |||
| d17241c460 | |||
|
|
e9adcfec1c | ||
| f6bc14c7be |
24
CHANGELOG.md
24
CHANGELOG.md
@@ -1,4 +1,4 @@
|
|||||||
## Version 1.14.9
|
## Version 1.14.13
|
||||||
|
|
||||||
Методы `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 с соответствующими фильтрами
|
||||||
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены
|
||||||
@@ -7,9 +7,25 @@
|
|||||||
|
|
||||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
Все методы группы `.SDN()` находятся в альфа-версии.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### vgpu
|
#### sdn logicalports
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-851 | Группа методов `cloudapi/vgpu` |
|
| BGOS-967 | Вычисляемое поле `ExcludeFirewall` в структуру ответа `LogicalPort` в sdn/logicalports |
|
||||||
|
|
||||||
|
|
||||||
|
### Изменено
|
||||||
|
|
||||||
|
#### sdn logicalports
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-967 | Тип опционального поля `LogicalPortAddresses` в структуре запроса `CreateRequest` с `[]LogicalPortAddress` на `[]LogicalPortAddressRequest` в sdn/logicalports |
|
||||||
|
| BGOS-967 | Тип обязательного поля `IP` в структуре запроса `LogicalPortAddressRequest` с `string` на `interface{}` в sdn/logicalports |
|
||||||
|
| BGOS-967 | Тип поля `IsDiscovered` c опционального на обязательное в структурах запросов `UpdateAddress` и `AddAddress` в sdn/logicalports |
|
||||||
|
| BGOS-967 | Тип обязательного поля `IsDiscovered` в структуре запроса `UpdateAddress` и `AddAddress` с `bool` на `interface{}` в sdn/logicalports |
|
||||||
|
| BGOS-967 | Тип опционального поля `Labels` в структуре запроса `CreateRequest` с `CreateLabels` на `*CreateLabels` в sdn/logicalports |
|
||||||
|
| BGOS-967 | Тип опционального поля `Labels` в структуре запроса `UpdateRequest` с `UpdateLabels` на `*UpdateLabels` в sdn/logicalports |
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ go get -u repository.basistech.ru/BASIS/decort-golang-sdk
|
|||||||
- `PCIDevice` - управление устройствами;
|
- `PCIDevice` - управление устройствами;
|
||||||
- `Prometheus` - получение статистики prometheus;
|
- `Prometheus` - получение статистики prometheus;
|
||||||
- `Resmon` - получение статистики resource monitoring;
|
- `Resmon` - получение статистики resource monitoring;
|
||||||
- `ResourceOptimizer` - управление инструментом оптимизации ресурсов (DRS);
|
|
||||||
- `RG` - управление ресурсными группами аккаунта;
|
- `RG` - управление ресурсными группами аккаунта;
|
||||||
- `Security group` – управление группами безопасности;
|
- `Security group` – управление группами безопасности;
|
||||||
- `SEP` - управление storage endpoint (sep);
|
- `SEP` - управление storage endpoint (sep);
|
||||||
@@ -370,7 +369,6 @@ func main() {
|
|||||||
- `pkg/cloudbroker/pcidevice` - для `PCIDevice`
|
- `pkg/cloudbroker/pcidevice` - для `PCIDevice`
|
||||||
- `pkg/cloudbroker/prometheus` - для `Prometheus`
|
- `pkg/cloudbroker/prometheus` - для `Prometheus`
|
||||||
- `pkg/cloudbroker/resmon` - для `Resmon`
|
- `pkg/cloudbroker/resmon` - для `Resmon`
|
||||||
- `pkg/cloudbroker/resource_optimizer` - для `ResourceOptimizer`
|
|
||||||
- `pkg/cloudbroker/rg` - для `RG`
|
- `pkg/cloudbroker/rg` - для `RG`
|
||||||
- `pkg/cloudbroker/secgroup` - для `Security group`
|
- `pkg/cloudbroker/secgroup` - для `Security group`
|
||||||
- `pkg/cloudbroker/sep` - для `SEP`
|
- `pkg/cloudbroker/sep` - для `SEP`
|
||||||
|
|||||||
@@ -350,6 +350,10 @@ func isBoolTypeValidator(fe validator.FieldLevel) bool {
|
|||||||
return fe.Field().CanConvert(reflect.TypeOf(true))
|
return fe.Field().CanConvert(reflect.TypeOf(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isStringTypeValidator(fe validator.FieldLevel) bool {
|
||||||
|
return fe.Field().Kind() == reflect.String
|
||||||
|
}
|
||||||
|
|
||||||
func urlValidartor(fl validator.FieldLevel) bool {
|
func urlValidartor(fl validator.FieldLevel) bool {
|
||||||
fieldValues := fl.Field().String()
|
fieldValues := fl.Field().String()
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ func errorMessage(fe validator.FieldError) string {
|
|||||||
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
|
return fmt.Sprintf("%s %s: unexpected E-Mail format", prefix, fe.Field())
|
||||||
case "isBool":
|
case "isBool":
|
||||||
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
|
return fmt.Sprintf("%s %s: must be bool type", prefix, fe.Field())
|
||||||
|
case "isString":
|
||||||
|
return fmt.Sprintf("%s %s: must be string type", prefix, fe.Field())
|
||||||
|
|
||||||
case "accessType":
|
case "accessType":
|
||||||
return fmt.Sprintf("%s %s must be one of the following: %s",
|
return fmt.Sprintf("%s %s must be one of the following: %s",
|
||||||
|
|||||||
@@ -231,6 +231,11 @@ func registerAllValidators(validate *validator.Validate) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = validate.RegisterValidation("isString", isStringTypeValidator)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = validate.RegisterValidation("url", urlValidartor)
|
err = validate.RegisterValidation("url", urlValidartor)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ type RedeployRequest struct {
|
|||||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||||
|
|
||||||
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
||||||
// Required: true
|
// Required: false
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||||
|
|
||||||
// ID of the new OS image, if image change is required
|
// ID of the new OS image, if image change is required
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type RedeployRequest struct {
|
|||||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||||
|
|
||||||
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
||||||
// Required: true
|
// Required: false
|
||||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||||
|
|
||||||
// New size for the boot disk in GB, if boot disk size change is required
|
// New size for the boot disk in GB, if boot disk size change is required
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package cloudbroker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/resource_optimizer"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Accessing the ResourceOptimizer method group
|
|
||||||
func (cb *CloudBroker) ResourceOptimizer() *resource_optimizer.ResourceOptimizer {
|
|
||||||
return resource_optimizer.New(cb.client)
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSAddNodesRequest struct to add nodes to DRS
|
|
||||||
type DRSAddNodesRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
|
|
||||||
// IDs of the nodes to add
|
|
||||||
// Required: true
|
|
||||||
NodeIDs []uint64 `url:"node_ids" json:"node_ids" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSAddNodes adds nodes to DRS in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSAddNodes(ctx context.Context, req DRSAddNodesRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_add_nodes"
|
|
||||||
|
|
||||||
res, err := ro.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,87 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSCreateRequest struct to create DRS
|
|
||||||
type DRSCreateRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
|
|
||||||
// SSO provider type
|
|
||||||
// Available values: bvs, decs3o
|
|
||||||
// Required: true
|
|
||||||
SSOType string `url:"sso_type" json:"sso_type" validate:"required,oneof=bvs decs3o"`
|
|
||||||
|
|
||||||
// Application ID
|
|
||||||
// Required: true
|
|
||||||
AppID string `url:"app_id" json:"app_id" validate:"required"`
|
|
||||||
|
|
||||||
// Application secret
|
|
||||||
// Required: true
|
|
||||||
AppSecret string `url:"app_secret" json:"app_secret" validate:"required"`
|
|
||||||
|
|
||||||
// Decort URL
|
|
||||||
// Required: true
|
|
||||||
DecortURL string `url:"decort_url" json:"decort_url" validate:"required"`
|
|
||||||
|
|
||||||
// SSO URL
|
|
||||||
// Required: true
|
|
||||||
SSOURL string `url:"sso_url" json:"sso_url" validate:"required"`
|
|
||||||
|
|
||||||
// DRS name
|
|
||||||
// Required: true
|
|
||||||
DRSName string `url:"drs_name" json:"drs_name" validate:"required"`
|
|
||||||
|
|
||||||
// Username
|
|
||||||
// Required: false
|
|
||||||
Username string `url:"username,omitempty" json:"username,omitempty"`
|
|
||||||
|
|
||||||
// Password
|
|
||||||
// Required: false
|
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
|
||||||
|
|
||||||
// Broadcast address
|
|
||||||
// Required: false
|
|
||||||
BroadcastAddr string `url:"broadcast_addr,omitempty" json:"broadcast_addr,omitempty"`
|
|
||||||
|
|
||||||
// Ping address
|
|
||||||
// Required: false
|
|
||||||
PingAddr string `url:"ping_addr,omitempty" json:"ping_addr,omitempty"`
|
|
||||||
|
|
||||||
// Skip SSL certificate verification
|
|
||||||
// Required: false
|
|
||||||
SSLSkipVerify interface{} `url:"ssl_skip_verify,omitempty" json:"ssl_skip_verify,omitempty"`
|
|
||||||
|
|
||||||
// Domain
|
|
||||||
// Required: false
|
|
||||||
Domain string `url:"domain,omitempty" json:"domain,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSCreate creates a new DRS in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSCreate(ctx context.Context, req DRSCreateRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_create"
|
|
||||||
|
|
||||||
res, err := ro.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,42 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSDelNodesRequest struct to delete nodes from DRS
|
|
||||||
type DRSDelNodesRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
|
|
||||||
// IDs of the nodes to delete
|
|
||||||
// Required: true
|
|
||||||
NodeIDs []uint64 `url:"node_ids" json:"node_ids" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSDelNodes removes nodes from DRS in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSDelNodes(ctx context.Context, req DRSDelNodesRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_del_nodes"
|
|
||||||
|
|
||||||
res, err := ro.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,38 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSRemoveRequest struct to remove DRS
|
|
||||||
type DRSRemoveRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSRemove removes DRS from the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSRemove(ctx context.Context, req DRSRemoveRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_remove"
|
|
||||||
|
|
||||||
res, err := ro.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,38 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSStartRequest struct to start DRS
|
|
||||||
type DRSStartRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSStart starts DRS in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSStart(ctx context.Context, req DRSStartRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_start"
|
|
||||||
|
|
||||||
res, err := ro.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,38 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSStopRequest struct to stop DRS
|
|
||||||
type DRSStopRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSStop stops DRS in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSStop(ctx context.Context, req DRSStopRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_stop"
|
|
||||||
|
|
||||||
res, err := ro.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,87 +0,0 @@
|
|||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DRSUpdateRequest struct to update DRS
|
|
||||||
type DRSUpdateRequest struct {
|
|
||||||
// ID of the zone
|
|
||||||
// Required: true
|
|
||||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
||||||
|
|
||||||
// SSO provider type
|
|
||||||
// Available values: bvs, decs3o
|
|
||||||
// Required: true
|
|
||||||
SSOType string `url:"sso_type" json:"sso_type" validate:"required,oneof=bvs decs3o"`
|
|
||||||
|
|
||||||
// Application ID
|
|
||||||
// Required: false
|
|
||||||
AppID string `url:"app_id,omitempty" json:"app_id,omitempty"`
|
|
||||||
|
|
||||||
// Application secret
|
|
||||||
// Required: false
|
|
||||||
AppSecret string `url:"app_secret,omitempty" json:"app_secret,omitempty"`
|
|
||||||
|
|
||||||
// Decort URL
|
|
||||||
// Required: false
|
|
||||||
DecortURL string `url:"decort_url,omitempty" json:"decort_url,omitempty"`
|
|
||||||
|
|
||||||
// SSO URL
|
|
||||||
// Required: false
|
|
||||||
SSOURL string `url:"sso_url,omitempty" json:"sso_url,omitempty"`
|
|
||||||
|
|
||||||
// DRS name
|
|
||||||
// Required: false
|
|
||||||
DRSName string `url:"drs_name,omitempty" json:"drs_name,omitempty"`
|
|
||||||
|
|
||||||
// Username
|
|
||||||
// Required: false
|
|
||||||
Username string `url:"username,omitempty" json:"username,omitempty"`
|
|
||||||
|
|
||||||
// Password
|
|
||||||
// Required: false
|
|
||||||
Password string `url:"password,omitempty" json:"password,omitempty"`
|
|
||||||
|
|
||||||
// Broadcast address
|
|
||||||
// Required: false
|
|
||||||
BroadcastAddr string `url:"broadcast_addr,omitempty" json:"broadcast_addr,omitempty"`
|
|
||||||
|
|
||||||
// Ping address
|
|
||||||
// Required: false
|
|
||||||
PingAddr string `url:"ping_addr,omitempty" json:"ping_addr,omitempty"`
|
|
||||||
|
|
||||||
// Skip SSL certificate verification
|
|
||||||
// Required: false
|
|
||||||
SSLSkipVerify interface{} `url:"ssl_skip_verify,omitempty" json:"ssl_skip_verify,omitempty"`
|
|
||||||
|
|
||||||
// Domain
|
|
||||||
// Required: false
|
|
||||||
Domain string `url:"domain,omitempty" json:"domain,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DRSUpdate updates DRS configuration in the specified zone
|
|
||||||
func (ro ResourceOptimizer) DRSUpdate(ctx context.Context, req DRSUpdateRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/resource_optimizer/drs_update"
|
|
||||||
|
|
||||||
res, err := ro.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,16 +0,0 @@
|
|||||||
// API Actor API for managing resource optimizer
|
|
||||||
package resource_optimizer
|
|
||||||
|
|
||||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
|
||||||
|
|
||||||
// Structure for creating request to resource_optimizer
|
|
||||||
type ResourceOptimizer struct {
|
|
||||||
client interfaces.Caller
|
|
||||||
}
|
|
||||||
|
|
||||||
// Builder for resource_optimizer endpoints
|
|
||||||
func New(client interfaces.Caller) *ResourceOptimizer {
|
|
||||||
return &ResourceOptimizer{
|
|
||||||
client: client,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@ package sep
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -20,23 +20,24 @@ type AddConsumerNodesRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddConsumerNodes adds consumer nodes to SEP parameters
|
// AddConsumerNodes adds consumer nodes to SEP parameters
|
||||||
func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (uint64, error) {
|
func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) ([]uint64, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
|
list := []uint64{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return list, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/sep/addConsumerNodes"
|
url := "/cloudbroker/sep/addConsumerNodes"
|
||||||
|
|
||||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
err = json.Unmarshal(res, &list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ type UpdateRequest struct {
|
|||||||
|
|
||||||
type wrapperUpdateRequest struct {
|
type wrapperUpdateRequest struct {
|
||||||
UpdateRequest
|
UpdateRequest
|
||||||
Config []string `url:"config,omitempty"`
|
Config string `url:"config,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates vfpool device
|
// Update updates vfpool device
|
||||||
@@ -48,21 +48,15 @@ func (v VFPool) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
|||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
var config []string
|
var config string
|
||||||
|
|
||||||
if len(req.Config) != 0 {
|
if len(req.Config) != 0 {
|
||||||
config = make([]string, 0, len(req.Config))
|
b, err := json.Marshal(req.Config)
|
||||||
|
if err != nil {
|
||||||
for c := range req.Config {
|
return false, err
|
||||||
b, err := json.Marshal(req.Config[c])
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
config = append(config, string(b))
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
config = []string{}
|
config = string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped := wrapperUpdateRequest{
|
reqWrapped := wrapperUpdateRequest{
|
||||||
|
|||||||
@@ -55,34 +55,35 @@ type CreateRequest struct {
|
|||||||
|
|
||||||
// Logical port addresses
|
// Logical port addresses
|
||||||
// Required: false
|
// Required: false
|
||||||
LogicalPortAddresses []LogicalPortAddress `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
|
LogicalPortAddresses []LogicalPortAddressRequest `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
// Required: false
|
// Required: false
|
||||||
Labels CreateLabels `url:"labels,omitempty" json:"labels,omitempty"`
|
Labels *CreateLabels `url:"labels,omitempty" json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogicalPortAddressRequest struct representing logical port address
|
// LogicalPortAddressRequest struct representing logical port address
|
||||||
type LogicalPortAddressRequest struct {
|
type LogicalPortAddressRequest struct {
|
||||||
// IP address
|
// IP address. IPv4 or IPv6 address of the logical port
|
||||||
|
// If nil (allowed only when IsPrimary is true), the system will automatically generate a valid address
|
||||||
// Required: true
|
// Required: true
|
||||||
IP string `url:"ip" json:"ip" validate:"required"`
|
IP interface{} `url:"ip" json:"ip" validate:"omitempty,isString"`
|
||||||
|
|
||||||
// IP type
|
// IP type
|
||||||
// Required: true
|
// Required: true
|
||||||
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
||||||
|
|
||||||
// Is primary. True or False
|
// Is primary
|
||||||
// Required: true
|
// Required: true
|
||||||
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
||||||
|
|
||||||
|
// Is discovered
|
||||||
|
// Required: true
|
||||||
|
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
|
||||||
|
|
||||||
// MAC address
|
// MAC address
|
||||||
// Required: false
|
// Required: false
|
||||||
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
||||||
|
|
||||||
// Is discovered. True or False
|
|
||||||
// Required: false
|
|
||||||
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a logical port
|
// Create creates a logical port
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ type LogicalPort struct {
|
|||||||
// Enabled
|
// Enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Exclude firewall information
|
||||||
|
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
|
||||||
|
|
||||||
// External network ID
|
// External network ID
|
||||||
ExternalNetworkID string `json:"external_network_id"`
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
@@ -162,6 +165,18 @@ type MigrationStatus struct {
|
|||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExcludeFirewall information
|
||||||
|
type ExcludeFirewall struct {
|
||||||
|
// Exclusion reason
|
||||||
|
ExclusionReason string `json:"exclusion_reason"`
|
||||||
|
|
||||||
|
// Whether logical port addresses are excluded from firewall
|
||||||
|
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
|
||||||
|
|
||||||
|
// Whether logical port is excluded from firewall
|
||||||
|
LogicalPortExcluded bool `json:"logical_port_excluded"`
|
||||||
|
}
|
||||||
|
|
||||||
// Labels information
|
// Labels information
|
||||||
type Labels struct {
|
type Labels struct {
|
||||||
// VM ID
|
// VM ID
|
||||||
|
|||||||
@@ -67,11 +67,15 @@ type UpdateRequest struct {
|
|||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
// Required: false
|
// Required: false
|
||||||
Labels UpdateLabels `url:"labels,omitempty" json:"labels,omitempty"`
|
Labels *UpdateLabels `url:"labels,omitempty" json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateAddress struct representing update address
|
// UpdateAddress struct representing update address
|
||||||
type UpdateAddress struct {
|
type UpdateAddress struct {
|
||||||
|
// ID of the address
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
// IP address
|
// IP address
|
||||||
// Required: true
|
// Required: true
|
||||||
IP string `url:"ip" json:"ip" validate:"required"`
|
IP string `url:"ip" json:"ip" validate:"required"`
|
||||||
@@ -81,8 +85,8 @@ type UpdateAddress struct {
|
|||||||
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
||||||
|
|
||||||
// Is discovered. True or False
|
// Is discovered. True or False
|
||||||
// Required: false
|
// Required: true
|
||||||
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
|
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
|
||||||
|
|
||||||
// Is primary. True or False
|
// Is primary. True or False
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -103,11 +107,11 @@ type AddAddress struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
IPType string `url:"ip_type" json:"ip_type" validate:"required,oneof=IPv4 IPv6"`
|
||||||
|
|
||||||
// Is discovered. True or False
|
// Is discovered
|
||||||
// Required: false
|
// Required: true
|
||||||
IsDiscovered interface{} `url:"is_discovered,omitempty" json:"is_discovered,omitempty" validate:"omitempty,isBool"`
|
IsDiscovered interface{} `url:"is_discovered" json:"is_discovered" validate:"required,isBool"`
|
||||||
|
|
||||||
// Is primary. True or False
|
// Is primary
|
||||||
// Required: true
|
// Required: true
|
||||||
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
IsPrimary interface{} `url:"is_primary" json:"is_primary" validate:"required,isBool"`
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ import (
|
|||||||
node_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
node_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
||||||
pcidevice_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
pcidevice_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
||||||
prometheus_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/prometheus"
|
prometheus_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/prometheus"
|
||||||
resource_optimizer_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/resource_optimizer"
|
|
||||||
rg_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
rg_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
||||||
secgroup_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/secgroup"
|
secgroup_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/secgroup"
|
||||||
sep_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
sep_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||||
@@ -928,15 +927,6 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/prometheus/computeMemoryUsage": prometheus_cb.ComputeMemoryUsageRequest{},
|
"/restmachine/cloudbroker/prometheus/computeMemoryUsage": prometheus_cb.ComputeMemoryUsageRequest{},
|
||||||
"/restmachine/cloudbroker/prometheus/computeMemoryUnused": prometheus_cb.ComputeMemoryUnusedRequest{},
|
"/restmachine/cloudbroker/prometheus/computeMemoryUnused": prometheus_cb.ComputeMemoryUnusedRequest{},
|
||||||
|
|
||||||
// resource_optimizer
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_add_nodes": resource_optimizer_cb.DRSAddNodesRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_create": resource_optimizer_cb.DRSCreateRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_del_nodes": resource_optimizer_cb.DRSDelNodesRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_remove": resource_optimizer_cb.DRSRemoveRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_start": resource_optimizer_cb.DRSStartRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_stop": resource_optimizer_cb.DRSStopRequest{},
|
|
||||||
"/restmachine/cloudbroker/resource_optimizer/drs_update": resource_optimizer_cb.DRSUpdateRequest{},
|
|
||||||
|
|
||||||
// rg
|
// rg
|
||||||
"/restmachine/cloudbroker/rg/accessGrant": rg_cb.AccessGrantRequest{},
|
"/restmachine/cloudbroker/rg/accessGrant": rg_cb.AccessGrantRequest{},
|
||||||
"/restmachine/cloudbroker/rg/accessRevoke": rg_cb.AccessRevokeRequest{},
|
"/restmachine/cloudbroker/rg/accessRevoke": rg_cb.AccessRevokeRequest{},
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ var DEPRECATED_GROUPS = []string{
|
|||||||
"/cloudapi/compute/affinityGroupCheckStart",
|
"/cloudapi/compute/affinityGroupCheckStart",
|
||||||
"/cloudapi/vins/staticRouteAccessGrant",
|
"/cloudapi/vins/staticRouteAccessGrant",
|
||||||
"/cloudapi/vins/staticRouteAccessRevoke",
|
"/cloudapi/vins/staticRouteAccessRevoke",
|
||||||
|
"/cloudbroker/resource_optimizer",
|
||||||
|
|
||||||
"/cloudbroker/account/listVMs",
|
"/cloudbroker/account/listVMs",
|
||||||
"/cloudbroker/account/listCS",
|
"/cloudbroker/account/listCS",
|
||||||
|
|||||||
Reference in New Issue
Block a user