Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6185a95ea | ||
|
|
faa9487e03 | ||
|
|
f61319c21b | ||
|
|
fe413c7182 | ||
|
|
3e2edf53a5 |
No files matched your search
+7
-5
@@ -1,4 +1,4 @@
|
|||||||
## Version 14.10.0
|
## Version 14.15.0
|
||||||
|
|
||||||
Методы `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,11 @@
|
|||||||
|
|
||||||
Все методы группы `.SDN()` находятся в альфа-версии.
|
Все методы группы `.SDN()` находятся в альфа-версии.
|
||||||
|
|
||||||
### Удалено
|
|
||||||
|
|
||||||
#### resource_optimizer
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
### Исправлено
|
||||||
|
|
||||||
|
#### client sdk
|
||||||
|
| Идентификатор задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-855 | Группа методов `resource_optimizer` |
|
| BGOS-1135 | Исправлена ошибка в сообщении об ошибке при отсутствии времени истечения токена в клиенте |
|
||||||
@@ -124,6 +124,7 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
|
|||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями;
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### Cloudbroker
|
### Cloudbroker
|
||||||
@@ -161,7 +162,8 @@ go get -u repository.basistech.ru/BASIS/dynamix-golang-sdk/v14
|
|||||||
- `User` - управление пользователями (индивидуально);
|
- `User` - управление пользователями (индивидуально);
|
||||||
- `VGPU` - управление виртуальными графическими процессорами;
|
- `VGPU` - управление виртуальными графическими процессорами;
|
||||||
- `VFPool` - управление пулом виртуальных сетевых функций;
|
- `VFPool` - управление пулом виртуальных сетевых функций;
|
||||||
- `VINS` - управление виртуальными изолированными сетями.
|
- `VINS` - управление виртуальными изолированными сетями;
|
||||||
|
- `VMFolder` – управление директориями ВМ;
|
||||||
- `Zone` - управление зонами.
|
- `Zone` - управление зонами.
|
||||||
|
|
||||||
### SDN
|
### SDN
|
||||||
@@ -337,6 +339,7 @@ func main() {
|
|||||||
- `pkg/cloudapi/vfpool` - для `VFPool`
|
- `pkg/cloudapi/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudapi/vins` - для `VINS`
|
- `pkg/cloudapi/vins` - для `VINS`
|
||||||
- `pkg/cloudapi/vgpu` - для `VGPU`
|
- `pkg/cloudapi/vgpu` - для `VGPU`
|
||||||
|
- `pkg/cloudapi/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudapi/zone` - для `Zone`
|
- `pkg/cloudapi/zone` - для `Zone`
|
||||||
- **cloudbroker**:
|
- **cloudbroker**:
|
||||||
- `pkg/cloudbroker/account` - для `Account`
|
- `pkg/cloudbroker/account` - для `Account`
|
||||||
@@ -370,6 +373,7 @@ func main() {
|
|||||||
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
- `pkg/cloudbroker/vgpu` - для `VGPU`
|
||||||
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
- `pkg/cloudbroker/vfpool` - для `VFPool`
|
||||||
- `pkg/cloudbroker/vins` - для `VINS`
|
- `pkg/cloudbroker/vins` - для `VINS`
|
||||||
|
- `pkg/cloudbroker/vmfolder` - для `VMFolder`
|
||||||
- `pkg/cloudbroker/zone` - для `Zone`
|
- `pkg/cloudbroker/zone` - для `Zone`
|
||||||
- **sdn**:
|
- **sdn**:
|
||||||
- `pkg/sdn/acsgroups` - для `Access groups`
|
- `pkg/sdn/acsgroups` - для `Access groups`
|
||||||
@@ -536,6 +540,7 @@ func main() {
|
|||||||
- `.VFPool()` - для работы с `VFPool`
|
- `.VFPool()` - для работы с `VFPool`
|
||||||
- `.VINS()` - для работы с `VINS`
|
- `.VINS()` - для работы с `VINS`
|
||||||
- `.VGPU()` - для работы с `VGPU`
|
- `.VGPU()` - для работы с `VGPU`
|
||||||
|
- `.VMFolder()` - для работы с `VMFolder`
|
||||||
- `.Zone()` - для работы с `Zone`
|
- `.Zone()` - для работы с `Zone`
|
||||||
|
|
||||||
Доступные методы для `.CloudBroker()`:
|
Доступные методы для `.CloudBroker()`:
|
||||||
@@ -571,6 +576,7 @@ func main() {
|
|||||||
- `.VGPU()` - для работы с `VGPU`
|
- `.VGPU()` - для работы с `VGPU`
|
||||||
- `.VFPool()` - для работы с `VFPool`
|
- `.VFPool()` - для работы с `VFPool`
|
||||||
- `.VINS()` - для работы с `VINS`
|
- `.VINS()` - для работы с `VINS`
|
||||||
|
- `.VMFolder()` - для работы с `VMFolder`
|
||||||
- `.Zone()` - для работы с `Zone`
|
- `.Zone()` - для работы с `Zone`
|
||||||
|
|
||||||
Доступные методы для `.SDN()`:
|
Доступные методы для `.SDN()`:
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ func getTokenExp(token string) (time.Time, error) {
|
|||||||
|
|
||||||
exp, ok := claims["exp"]
|
exp, ok := claims["exp"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return time.Time{}, fmt.Errorf("exp time bot found")
|
return time.Time{}, fmt.Errorf("exp time not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
expTime := time.Unix(int64(exp.(float64)), 0)
|
expTime := time.Unix(int64(exp.(float64)), 0)
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package validators
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/multierror"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package compute
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChangeLinkStateRequest struct to change link state
|
// ChangeLinkStateRequest struct to change link state
|
||||||
|
|||||||
@@ -63,6 +63,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -551,6 +551,9 @@ type RecordCompute struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
// Name
|
// Name
|
||||||
@@ -1249,6 +1252,9 @@ type ItemCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListInfoDisks
|
// ListInfoDisks
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -40,6 +40,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 pcidevice
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudapi/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (ca *CloudAPI) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(ca.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddACLAccessRequest adds ACL access to a vm folder
|
||||||
|
type AddACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to grant access
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
Right string `url:"right" json:"right" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddACLAccess adds ACL access to a vm folder
|
||||||
|
func (v VMFolder) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/add_acl_access"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ComputesMoveRequest struct to move computes to a vm folder
|
||||||
|
type ComputesMoveRequest struct {
|
||||||
|
// IDs of computes to move
|
||||||
|
// Required: true
|
||||||
|
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
|
||||||
|
|
||||||
|
// Target vm folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComputesMove moves computes to a vm folder
|
||||||
|
func (v VMFolder) ComputesMove(ctx context.Context, req ComputesMoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/computes_move"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateRequest struct to create a vm folder
|
||||||
|
type CreateRequest struct {
|
||||||
|
// Resource Group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
// Required: false
|
||||||
|
ParentID uint64 `url:"parent_id,omitempty" json:"parent_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create creates a vm folder
|
||||||
|
func (v VMFolder) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/create"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteACLAccessRequest deletes ACL access from a vm folder
|
||||||
|
type DelACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to revoke access from
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteACLAccess deletes ACL access from a vm foler
|
||||||
|
func (v VMFolder) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/del_acl_access"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteRequest struct to delete a VM folder
|
||||||
|
type DeleteRequest struct {
|
||||||
|
// ID of a folder to delete
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a vm folder
|
||||||
|
func (v VMFolder) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/delete"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get detailed information about a vm folder
|
||||||
|
type GetRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets current configuration of the vm folder as a RecordVMFolder struct
|
||||||
|
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
|
||||||
|
res, err := v.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets current configuration of the vm folder as an array of bytes
|
||||||
|
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to get list of vm folders
|
||||||
|
type ListRequest struct {
|
||||||
|
// Resource group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Page number
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Page size
|
||||||
|
// Required: false
|
||||||
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets list of all vm folders in a resource group as a ListVMFolder struct
|
||||||
|
func (v VMFolder) List(ctx context.Context, req ListRequest) (*ListVMFolder, error) {
|
||||||
|
|
||||||
|
res, err := v.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := ListVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &list)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &list, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets list of all vm folders in a resource group as an array of bytes
|
||||||
|
func (v VMFolder) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
|
||||||
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/list"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
// Detailed information about a folder
|
||||||
|
type RecordVMFolder struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// RG ID
|
||||||
|
RGID uint64 `json:"rg_id"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// Name of a folder
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Time of creation
|
||||||
|
CreatedTime uint64 `json:"created_time"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Status of a folder
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Compute IDs
|
||||||
|
ComputeIDs []uint64 `json:"compute_ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
type ACL struct {
|
||||||
|
// Explicit
|
||||||
|
Explicit bool `json:"explicit"`
|
||||||
|
|
||||||
|
// Right
|
||||||
|
Right string `json:"right"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// User group ID
|
||||||
|
UserGroupID string `json:"userGroupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of vm folders
|
||||||
|
type ListVMFolder struct {
|
||||||
|
// Entry count
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
|
// Data
|
||||||
|
Data []ItemVMFolder `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detailed information about a folder item
|
||||||
|
type ItemVMFolder struct {
|
||||||
|
// Folder ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// VM count
|
||||||
|
VMCount uint64 `json:"vm_count"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MoveRequest to move a vm folder to a compute
|
||||||
|
type MoveRequest struct {
|
||||||
|
// VM Folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// New parent folder ID
|
||||||
|
// Required: true
|
||||||
|
NewParentID uint64 `url:"new_parent_id" json:"new_parent_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move moves a vm folder to a compute
|
||||||
|
func (v VMFolder) Move(ctx context.Context, req MoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/move"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RenameRequest struct to rename a VM folder
|
||||||
|
type RenameRequest struct {
|
||||||
|
// ID of a folder to rename
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// A new name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename renames a vm folder
|
||||||
|
func (v VMFolder) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudapi/vmfolder/rename"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to VMFolder
|
||||||
|
type VMFolder struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for VMFolder endpoints
|
||||||
|
func New(client interfaces.Caller) *VMFolder {
|
||||||
|
return &VMFolder{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,9 @@ package account
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package apiaccess
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -20,23 +20,25 @@ type DescUpdateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DescUpdate sets a new text description of the apiaccess group.
|
// DescUpdate sets a new text description of the apiaccess group.
|
||||||
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (bool, error) {
|
func (a APIAccess) DescUpdate(ctx context.Context, req DescUpdateRequest) (*ItemAPIAccess, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/apiaccess/descUpdate"
|
url := "/cloudbroker/apiaccess/descUpdate"
|
||||||
|
|
||||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
info := ItemAPIAccess{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package apiaccess
|
package apiaccess
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
type ItemAPIAccess struct {
|
type ItemAPIAccess struct {
|
||||||
// APIs
|
// APIs
|
||||||
APIs APIsEndpoints `json:"apis"`
|
APIs APIsEndpoints `json:"apis"`
|
||||||
@@ -88,21 +90,50 @@ type APIsEndpoints struct {
|
|||||||
// CloudBroker endpoints
|
// CloudBroker endpoints
|
||||||
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
|
CloudBroker CloudBrokerEndpoints `json:"cloudbroker,omitempty"`
|
||||||
|
|
||||||
// LibCloud endpoints
|
// SDN endpoints
|
||||||
LibCloud LibCloudEndpoints `json:"libcloud,omitempty"`
|
SDN SDNEndpoints `json:"sdn,omitempty"`
|
||||||
|
|
||||||
// System endpoints
|
// System endpoints
|
||||||
System SystemEndpoints `json:"system,omitempty"`
|
System SystemEndpoints `json:"system,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON omits empty namespaces, so that "{}" is not sent in requests.
|
||||||
|
func (a APIsEndpoints) MarshalJSON() ([]byte, error) {
|
||||||
|
namespaces := []struct {
|
||||||
|
key string
|
||||||
|
value interface{}
|
||||||
|
}{
|
||||||
|
{"cloudapi", a.CloudAPI},
|
||||||
|
{"cloudbroker", a.CloudBroker},
|
||||||
|
{"sdn", a.SDN},
|
||||||
|
{"system", a.System},
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]json.RawMessage, len(namespaces))
|
||||||
|
|
||||||
|
for _, ns := range namespaces {
|
||||||
|
data, err := json.Marshal(ns.value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if string(data) == "{}" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
result[ns.key] = data
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.Marshal(result)
|
||||||
|
}
|
||||||
|
|
||||||
type CloudAPIEndpoints struct {
|
type CloudAPIEndpoints struct {
|
||||||
Account []string `json:"account,omitempty"`
|
Account []string `json:"account,omitempty"`
|
||||||
|
Audit []string `json:"audit,omitempty"`
|
||||||
BService []string `json:"bservice,omitempty"`
|
BService []string `json:"bservice,omitempty"`
|
||||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
|
||||||
Compute []string `json:"compute,omitempty"`
|
Compute []string `json:"compute,omitempty"`
|
||||||
ComputeCI []string `json:"computeci,omitempty"`
|
|
||||||
Disks []string `json:"disks,omitempty"`
|
Disks []string `json:"disks,omitempty"`
|
||||||
DPDK []string `json:"dpdk,omitempty"`
|
DPDKNet []string `json:"dpdknet,omitempty"`
|
||||||
ExtNet []string `json:"extnet,omitempty"`
|
ExtNet []string `json:"extnet,omitempty"`
|
||||||
FLIPGroup []string `json:"flipgroup,omitempty"`
|
FLIPGroup []string `json:"flipgroup,omitempty"`
|
||||||
GPU []string `json:"gpu,omitempty"`
|
GPU []string `json:"gpu,omitempty"`
|
||||||
@@ -112,18 +143,19 @@ type CloudAPIEndpoints struct {
|
|||||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||||
LB []string `json:"lb,omitempty"`
|
LB []string `json:"lb,omitempty"`
|
||||||
Loactions []string `json:"locations,omitempty"`
|
Loactions []string `json:"locations,omitempty"`
|
||||||
Machine []string `json:"machine,omitempty"`
|
|
||||||
Openshift []string `json:"openshift,omitempty"`
|
|
||||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
|
||||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||||
PortForwarding []string `json:"portforwarding,omitempty"`
|
|
||||||
Prometheus []string `json:"prometheus,omitempty"`
|
Prometheus []string `json:"prometheus,omitempty"`
|
||||||
RG []string `json:"rg,omitempty"`
|
RG []string `json:"rg,omitempty"`
|
||||||
Sizes []string `json:"sizes,omitempty"`
|
SecurityGroup []string `json:"security_group,omitempty"`
|
||||||
|
SEP []string `json:"sep,omitempty"`
|
||||||
|
StoragePolicy []string `json:"storage_policy,omitempty"`
|
||||||
Tasks []string `json:"tasks,omitempty"`
|
Tasks []string `json:"tasks,omitempty"`
|
||||||
|
Trunk []string `json:"trunk,omitempty"`
|
||||||
User []string `json:"user,omitempty"`
|
User []string `json:"user,omitempty"`
|
||||||
|
VFPool []string `json:"vfpool,omitempty"`
|
||||||
VGPU []string `json:"vgpu,omitempty"`
|
VGPU []string `json:"vgpu,omitempty"`
|
||||||
VINS []string `json:"vins,omitempty"`
|
VINS []string `json:"vins,omitempty"`
|
||||||
|
Zone []string `json:"zone,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,72 +165,83 @@ type CloudBrokerEndpoints struct {
|
|||||||
Audit interface{} `json:"audit,omitempty"`
|
Audit interface{} `json:"audit,omitempty"`
|
||||||
AuditBeat []string `json:"auditbeat,omitempty"`
|
AuditBeat []string `json:"auditbeat,omitempty"`
|
||||||
AuditCollector []string `json:"auditcollector,omitempty"`
|
AuditCollector []string `json:"auditcollector,omitempty"`
|
||||||
|
Backup []string `json:"backup,omitempty"`
|
||||||
BackupCreator []string `json:"backupcreator,omitempty"`
|
BackupCreator []string `json:"backupcreator,omitempty"`
|
||||||
BService []string `json:"bservice,omitempty"`
|
BService []string `json:"bservice,omitempty"`
|
||||||
CloudSpace []string `json:"cloudspace,omitempty"`
|
|
||||||
Compute []string `json:"compute,omitempty"`
|
Compute []string `json:"compute,omitempty"`
|
||||||
ComputeCI []string `json:"computeci,omitempty"`
|
|
||||||
Desnode []string `json:"desnode,omitempty"`
|
|
||||||
Diagnostics []string `json:"diagnostics,omitempty"`
|
|
||||||
Disks []string `json:"disks,omitempty"`
|
Disks []string `json:"disks,omitempty"`
|
||||||
DPDK []string `json:"dpdk,omitempty"`
|
DPDKNet []string `json:"dpdknet,omitempty"`
|
||||||
Eco []string `json:"eco,omitempty"`
|
Eco []string `json:"eco,omitempty"`
|
||||||
ExtNet []string `json:"extnet,omitempty"`
|
ExtNet []string `json:"extnet,omitempty"`
|
||||||
FlIPgroup []string `json:"flipgroup,omitempty"`
|
FlIPgroup []string `json:"flipgroup,omitempty"`
|
||||||
Grid []string `json:"grid,omitempty"`
|
Grid []string `json:"grid,omitempty"`
|
||||||
Group []string `json:"group,omitempty"`
|
Group []string `json:"group,omitempty"`
|
||||||
Health []string `json:"health,omitempty"`
|
Health []string `json:"health,omitempty"`
|
||||||
IaaS []string `json:"iaas,omitempty"`
|
|
||||||
Image []string `json:"image,omitempty"`
|
Image []string `json:"image,omitempty"`
|
||||||
Job interface{} `json:"job,omitempty"`
|
Job interface{} `json:"job,omitempty"`
|
||||||
K8CI []string `json:"k8ci,omitempty"`
|
K8CI []string `json:"k8ci,omitempty"`
|
||||||
K8S []string `json:"k8s,omitempty"`
|
K8S []string `json:"k8s,omitempty"`
|
||||||
KVMX86 []string `json:"kvmx86,omitempty"`
|
KVMX86 []string `json:"kvmx86,omitempty"`
|
||||||
LB []string `json:"lb,omitempty"`
|
LB []string `json:"lb,omitempty"`
|
||||||
Machine []string `json:"machine,omitempty"`
|
|
||||||
Metering []string `json:"metering,omitempty"`
|
Metering []string `json:"metering,omitempty"`
|
||||||
Milestones []string `json:"milestones,omitempty"`
|
Milestones []string `json:"milestones,omitempty"`
|
||||||
Openshift []string `json:"openshift,omitempty"`
|
Node []string `json:"node,omitempty"`
|
||||||
OpenshiftCI []string `json:"openshiftci,omitempty"`
|
|
||||||
Ovsnode []string `json:"ovsnode,omitempty"`
|
|
||||||
PCIDevice []string `json:"pcidevice,omitempty"`
|
PCIDevice []string `json:"pcidevice,omitempty"`
|
||||||
PGPU []string `json:"pgpu,omitempty"`
|
PGPU []string `json:"pgpu,omitempty"`
|
||||||
Prometheus []string `json:"prometheus,omitempty"`
|
Prometheus []string `json:"prometheus,omitempty"`
|
||||||
QOS []string `json:"qos,omitempty"`
|
|
||||||
Resmon interface{} `json:"resmon,omitempty"`
|
Resmon interface{} `json:"resmon,omitempty"`
|
||||||
|
ResourceOptimizer []string `json:"resource_optimizer,omitempty"`
|
||||||
RG []string `json:"rg,omitempty"`
|
RG []string `json:"rg,omitempty"`
|
||||||
|
SecurityGroup []string `json:"security_group,omitempty"`
|
||||||
Sep []string `json:"sep,omitempty"`
|
Sep []string `json:"sep,omitempty"`
|
||||||
Node []string `json:"node,omitempty"`
|
StoragePolicy []string `json:"storage_policy,omitempty"`
|
||||||
Tasks []string `json:"tasks,omitempty"`
|
Tasks []string `json:"tasks,omitempty"`
|
||||||
TLock []string `json:"tlock,omitempty"`
|
TLock []string `json:"tlock,omitempty"`
|
||||||
|
Trunk []string `json:"trunk,omitempty"`
|
||||||
User []string `json:"user,omitempty"`
|
User []string `json:"user,omitempty"`
|
||||||
|
VFPool []string `json:"vfpool,omitempty"`
|
||||||
VGPU []string `json:"vgpu,omitempty"`
|
VGPU []string `json:"vgpu,omitempty"`
|
||||||
VINS []string `json:"vins,omitempty"`
|
VINS []string `json:"vins,omitempty"`
|
||||||
VNFDev []string `json:"vnfdev,omitempty"`
|
VNFDev []string `json:"vnfdev,omitempty"`
|
||||||
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
ZeroAccess []string `json:"zeroaccess,omitempty"`
|
||||||
|
Zone []string `json:"zone,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LibCloudEndpoints struct {
|
type SDNEndpoints struct {
|
||||||
Libvirt []string `json:"libvirt,omitempty"`
|
AccessGroup []string `json:"access_group,omitempty"`
|
||||||
|
AddressPool []string `json:"address_pool,omitempty"`
|
||||||
|
DefaultSecurityPolicy []string `json:"default_security_policy,omitempty"`
|
||||||
|
ExternalNetwork []string `json:"external_network,omitempty"`
|
||||||
|
FloatingIP []string `json:"floating_ip,omitempty"`
|
||||||
|
Hypervisor []string `json:"hypervisor,omitempty"`
|
||||||
|
L2ExternalNetwork []string `json:"l2_external_network,omitempty"`
|
||||||
|
LogicalPort []string `json:"logical_port,omitempty"`
|
||||||
|
NetworkObjectGroup []string `json:"network_object_group,omitempty"`
|
||||||
|
Router []string `json:"router,omitempty"`
|
||||||
|
RouterGatewayPort []string `json:"router/gateway_port,omitempty"`
|
||||||
|
RouterPolicies []string `json:"router/policies,omitempty"`
|
||||||
|
RouterRouterPort []string `json:"router/router_port,omitempty"`
|
||||||
|
RouterStaticRoute []string `json:"router/static_route,omitempty"`
|
||||||
|
SecurityPolicy []string `json:"security_policy,omitempty"`
|
||||||
|
SecurityPolicyRule []string `json:"security_policy/rule,omitempty"`
|
||||||
|
SecurityRule []string `json:"security_rule,omitempty"`
|
||||||
|
Segment []string `json:"segment,omitempty"`
|
||||||
|
Version []string `json:"version,omitempty"`
|
||||||
All bool `json:"ALL,omitempty"`
|
All bool `json:"ALL,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemEndpoints struct {
|
type SystemEndpoints struct {
|
||||||
AgentController []string `json:"agentcontroller,omitempty"`
|
|
||||||
Alerts []string `json:"alerts,omitempty"`
|
|
||||||
Audits []string `json:"audits,omitempty"`
|
Audits []string `json:"audits,omitempty"`
|
||||||
|
Cache []string `json:"cache,omitempty"`
|
||||||
ContentManager []string `json:"contentmanager,omitempty"`
|
ContentManager []string `json:"contentmanager,omitempty"`
|
||||||
DocGenerator []string `json:"docgenerator,omitempty"`
|
DocGenerator []string `json:"docgenerator,omitempty"`
|
||||||
EmailSender []string `json:"emailsender,omitempty"`
|
EmailSender []string `json:"emailsender,omitempty"`
|
||||||
ErrorConditionHandler []string `json:"errorconditionhandler,omitempty"`
|
|
||||||
GridManager []string `json:"gridmanager,omitempty"`
|
GridManager []string `json:"gridmanager,omitempty"`
|
||||||
Health []string `json:"health,omitempty"`
|
Health []string `json:"health,omitempty"`
|
||||||
Info []string `json:"info,omitempty"`
|
Info []string `json:"info,omitempty"`
|
||||||
|
InfoWellknown []string `json:"info/wellknown,omitempty"`
|
||||||
InfoMGR []string `json:"infomgr,omitempty"`
|
InfoMGR []string `json:"infomgr,omitempty"`
|
||||||
Job []string `json:"job,omitempty"`
|
|
||||||
Log []string `json:"log,omitempty"`
|
|
||||||
Logo []string `json:"logo,omitempty"`
|
|
||||||
Oauth []string `json:"oauth,omitempty"`
|
Oauth []string `json:"oauth,omitempty"`
|
||||||
Task []string `json:"task,omitempty"`
|
Task []string `json:"task,omitempty"`
|
||||||
UserManager []string `json:"usermanager,omitempty"`
|
UserManager []string `json:"usermanager,omitempty"`
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -27,10 +26,10 @@ type wrapperUpdateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update updates apis of apiaccess group.
|
// Update updates apis of apiaccess group.
|
||||||
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (*ItemAPIAccess, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/apiaccess/update"
|
url := "/cloudbroker/apiaccess/update"
|
||||||
@@ -41,20 +40,22 @@ func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error)
|
|||||||
|
|
||||||
apiJSON, err := json.Marshal(&req.APIs)
|
apiJSON, err := json.Marshal(&req.APIs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped.APIString = string(apiJSON)
|
reqWrapped.APIString = string(apiJSON)
|
||||||
|
|
||||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
info := ItemAPIAccess{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,9 @@ package compute
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChangeLinkStateRequest struct for changing link state
|
// ChangeLinkStateRequest struct for changing link state
|
||||||
|
|||||||
@@ -75,6 +75,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||||
|
|
||||||
|
// Find by VM folder ID
|
||||||
|
// Required: false
|
||||||
|
FolderID uint64 `url:"folder_id,omitempty" json:"folder_id,omitempty"`
|
||||||
|
|
||||||
|
// Include computes from descendant folders.
|
||||||
|
// Required: false
|
||||||
|
IncludeDescendants interface{} `url:"include_descendants,omitempty" json:"include_descendants,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|||||||
@@ -902,6 +902,9 @@ type InfoCompute struct {
|
|||||||
|
|
||||||
// Zone ID
|
// Zone ID
|
||||||
ZoneID uint64 `json:"zoneId"`
|
ZoneID uint64 `json:"zoneId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QemuQuest struct {
|
type QemuQuest struct {
|
||||||
@@ -1195,6 +1198,9 @@ type RecordCompute struct {
|
|||||||
|
|
||||||
//todo
|
//todo
|
||||||
_ uint64 `json:"nodeId"`
|
_ uint64 `json:"nodeId"`
|
||||||
|
|
||||||
|
// Folder ID
|
||||||
|
FolderID uint64 `json:"folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoaderMetaIso struct {
|
type LoaderMetaIso struct {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package disks
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DepresentRequest struct to depresent disk from node
|
// DepresentRequest struct to depresent disk from node
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package disks
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PresentRequest struct to present disk to node
|
// PresentRequest struct to present disk to node
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ type RecordGrid struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information about grid
|
// Information about grid
|
||||||
@@ -138,6 +141,9 @@ type ItemGridList struct {
|
|||||||
|
|
||||||
// Is BRO enabled
|
// Is BRO enabled
|
||||||
BROEnabled bool `json:"bro_enabled"`
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
|
|
||||||
|
// Whether VM folders are enabled
|
||||||
|
VMFoldersEnabled bool `json:"vm_folders_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List Grids
|
// List Grids
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package grid
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package grid
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
|
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeleteRequest struct to deleting PCI device
|
// DeleteRequest struct to deleting PCI device
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DisableRequest struct for disabling PCI device
|
// DisableRequest struct for disabling PCI device
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package pcidevice
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableRequest struct for enabling PCI device
|
// EnableRequest struct for enabling PCI device
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package pcidevice
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/serialization"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package rg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package rg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
|
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package sep
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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)
|
||||||
|
|
||||||
for c := range req.Config {
|
|
||||||
b, err := json.Marshal(req.Config[c])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
config = append(config, string(b))
|
config = string(b)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
config = []string{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped := wrapperUpdateRequest{
|
reqWrapped := wrapperUpdateRequest{
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AllocateRequest struct for allocating VGPU
|
// AllocateRequest struct for allocating VGPU
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateRequest struct for creating VGPU
|
// CreateRequest struct for creating VGPU
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeallocateRequest struct for deallocating VGPU
|
// DeallocateRequest struct for deallocating VGPU
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package vgpu
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DestroyRequest struct for destroying VGPU
|
// DestroyRequest struct for destroying VGPU
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cloudbroker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/pkg/cloudbroker/vmfolder"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the VMFolder method group
|
||||||
|
func (cb *CloudBroker) VMFolder() *vmfolder.VMFolder {
|
||||||
|
return vmfolder.New(cb.client)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddACLAccessRequest adds ACL access to a vm folder
|
||||||
|
type AddACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// User or group name to grant access
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user" validate:"required"`
|
||||||
|
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
Right string `url:"right" json:"right" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddACLAccess adds ACL access to a vm folder
|
||||||
|
func (v VMFolder) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/add_acl_access"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ComputesMoveRequest struct to move computes to a vm folder
|
||||||
|
type ComputesMoveRequest struct {
|
||||||
|
// IDs of computes to move
|
||||||
|
// Required: true
|
||||||
|
ComputeIDs []uint64 `url:"compute_ids" json:"compute_ids" validate:"required"`
|
||||||
|
|
||||||
|
// Target vm folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComputesMove moves computes to a vm folder
|
||||||
|
func (v VMFolder) ComputesMove(ctx context.Context, req ComputesMoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/computes_move"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateRequest struct to create a vm folder
|
||||||
|
type CreateRequest struct {
|
||||||
|
// Resource Group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
// Required: false
|
||||||
|
ParentID uint64 `url:"parent_id,omitempty" json:"parent_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create creates a vm folder
|
||||||
|
func (v VMFolder) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/create"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteACLAccessRequest deletes ACL access from a vm folder
|
||||||
|
type DelACLAccessRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// User or group name to revoke access from
|
||||||
|
// Required: true
|
||||||
|
User string `url:"user" json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteACLAccess deletes ACL access from a vm foler
|
||||||
|
func (v VMFolder) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/del_acl_access"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteRequest struct to delete a VM folder
|
||||||
|
type DeleteRequest struct {
|
||||||
|
// ID of a folder to delete
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a vm folder
|
||||||
|
func (v VMFolder) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/delete"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get detailed information about a vm folder
|
||||||
|
type GetRequest struct {
|
||||||
|
// ID of a folder
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets current configuration of the vm folder as a RecordVMFolder struct
|
||||||
|
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
|
||||||
|
res, err := v.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets current configuration of the vm folder as an array of bytes
|
||||||
|
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to get list of vm folders
|
||||||
|
type ListRequest struct {
|
||||||
|
// Resource group ID
|
||||||
|
// Required: true
|
||||||
|
RGID uint64 `url:"rg_id" json:"rg_id" validate:"required"`
|
||||||
|
|
||||||
|
// Page number
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Page size
|
||||||
|
// Required: false
|
||||||
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets list of all vm folders in a resource group as a ListVMFolder struct
|
||||||
|
func (v VMFolder) List(ctx context.Context, req ListRequest) (*ListVMFolder, error) {
|
||||||
|
|
||||||
|
res, err := v.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := ListVMFolder{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &list)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &list, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets list of all vm folders in a resource group as an array of bytes
|
||||||
|
func (v VMFolder) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
|
||||||
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/list"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
// Detailed information about a folder
|
||||||
|
type RecordVMFolder struct {
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// RG ID
|
||||||
|
RGID uint64 `json:"rg_id"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// Name of a folder
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Time of creation
|
||||||
|
CreatedTime uint64 `json:"created_time"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Status of a folder
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Compute IDs
|
||||||
|
ComputeIDs []uint64 `json:"compute_ids"`
|
||||||
|
|
||||||
|
// Time of update
|
||||||
|
UpdatedTime uint64 `json:"updated_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
type ACL struct {
|
||||||
|
// Explicit
|
||||||
|
Explicit bool `json:"explicit"`
|
||||||
|
|
||||||
|
// Right
|
||||||
|
Right string `json:"right"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// User group ID
|
||||||
|
UserGroupID string `json:"userGroupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of vm folders
|
||||||
|
type ListVMFolder struct {
|
||||||
|
// Entry count
|
||||||
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
|
// Data
|
||||||
|
Data []ItemVMFolder `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detailed information about a folder item
|
||||||
|
type ItemVMFolder struct {
|
||||||
|
// Folder ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Parent ID
|
||||||
|
ParentID uint64 `json:"parent_id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
ACL []ACL `json:"acl"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// VM count
|
||||||
|
VMCount uint64 `json:"vm_count"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MoveRequest to move a vm folder to a compute
|
||||||
|
type MoveRequest struct {
|
||||||
|
// VM Folder ID
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id"`
|
||||||
|
|
||||||
|
// New parent folder ID
|
||||||
|
// Required: true
|
||||||
|
NewParentID uint64 `url:"new_parent_id" json:"new_parent_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move moves a vm folder to a compute
|
||||||
|
func (v VMFolder) Move(ctx context.Context, req MoveRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/move"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RenameRequest struct to rename a VM folder
|
||||||
|
type RenameRequest struct {
|
||||||
|
// ID of a folder to rename
|
||||||
|
// Required: true
|
||||||
|
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
|
||||||
|
|
||||||
|
// A new name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename renames a vm folder
|
||||||
|
func (v VMFolder) Rename(ctx context.Context, req RenameRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/vmfolder/rename"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package vmfolder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to VMFolder
|
||||||
|
type VMFolder struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for VMFolder endpoints
|
||||||
|
func New(client interfaces.Caller) *VMFolder {
|
||||||
|
return &VMFolder{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user