Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bd93e92c2 | ||
|
|
5cdae8520f | ||
| 30e464e4d2 | |||
| 9258a1574b | |||
|
|
444a33dc7e | ||
| 17017b6d5d |
85
CHANGELOG.md
85
CHANGELOG.md
@@ -1,4 +1,4 @@
|
|||||||
## Version 1.14.2
|
## Version 1.14.8
|
||||||
|
|
||||||
Методы `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 и в следующих версиях будут удалены
|
||||||
@@ -9,47 +9,86 @@
|
|||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### account
|
#### resource optimizer
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-796 | Опциональное поле `CpuAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/account |
|
| BGOS-842 | Опциональные поля `Username`, `Password`, `BroadcastAddr`, `PingAddr`, `SSLSkipVerify` и `Domain` в структуры запросов `DRSCreateRequest` и `DRSUpdateRequest` в `cloudbroker/resource_optimizer` |
|
||||||
| BGOS-790 | Вычисляемое поле `UpdatedBy` в структуру ответа `ItemAccount` в cloudapi/account |
|
| BGOS-842 | Обязательное поле `SSOType` в структуры запросов `DRSCreateRequest` и `DRSUpdateRequest` в `cloudbroker/resource_optimizer` |
|
||||||
|
|
||||||
#### compute
|
#### grid
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-793 | Вычисляемые поля `Aborted` и `BlockcopyAbortJobID` в структуру ответа `RecordCloneAbort` в cloudbroker/compute |
|
| BGOS-846 | Вычисляемое поле `BROEnabled` в структуры ответов `RecordGrid` и `ItemGridList` в cloudbroker/grid |
|
||||||
| BGOS-792 | Структуры ответа `RecordCloneAbort` и `ListCloneAbort` в cloudapi/compute |
|
|
||||||
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
|
|
||||||
|
|
||||||
#### disks
|
#### locations
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-791 | Вычисляемое поле `Independent` в структуры ответа `ItemDisk` и `RecordDisk` в cloudapi/disks и в структуру ответа `RecordDisk` в cloudbroker/disks |
|
| BGOS-845 | Вычисляемое поле `BROEnabled` в структуру ответа `ItemLocation` в cloudapi/locations |
|
||||||
| BGOS-797 | Вычисляемые поля `ToClean` и `StoragePolicyID` в структуру ответа `ItemDiskUnattached` в cloudapi/disks |
|
|
||||||
|
|
||||||
#### image
|
#### zone
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `RecordImage` в cloudapi/image и в структуры ответа `RecordImage` и `ItemImage` в cloudbroker/image |
|
| BGOS-841 | Вычисляемые поля `PingAddr`, `BroadcastAddr`, `SSLSkipVerify` и `Domain` в структуры ответов `ItemZone` и `RecordZone` в cloudapi/zone и в cloudbroker/zone |
|
||||||
|
| BGOS-844 | Вычисляемое поле `SSOType` в структуры ответов `ItemZone` и `RecordZone` в cloudapi/zone и в cloudbroker/zone |
|
||||||
|
|
||||||
|
#### SDN segments
|
||||||
### Изменено
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-799 | Минимальное значение поля `MTU` в структуре запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute с 1 на 1500 |
|
| BGOS-798 | Опциональное поле `OperationStatus` в структуру запроса `ListRequest` в sdn/segments |
|
||||||
| BGOS-792 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `ListCloneAbort` в cloudapi/compute |
|
| BGOS-798 | Опциональные поля `Type` в структуры запросов `CreateRequest` и `UpdateRequest` в sdn/segments |
|
||||||
|
| BGOS-798 | Метод `GetFAA`, структура запроса `GetFAARequest` и структура ответа `GetFAAResponse` в sdn/segments |
|
||||||
|
| BGOS-798 | Вычисляемые поля `Type` и `L2ConnectionPort` в структуру ответа `SegmentResponse` в sdn/segments |
|
||||||
|
| BGOS-798 | Вычисляемое поле `OperationStatus` в структуры `Status` и `HypervisorStatus`, структуры `L2ConnectionPort` и `L2ExternalNetwork` в sdn/segments |
|
||||||
|
|
||||||
#### node
|
#### SDN network object groups
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-789 | Дефолтное значение поля `Force` в структуре запроса `EnableRequest` в cloudbroker/node с `true` на `false` |
|
| BGOS-837 | Опциональные поля `Addresses` и `L2ConnectionPortsBindings` в структуру запроса `CreateRequest` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Опциональное поле `Addresses` в структуру запроса `UpdateRequest` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поле `PortBindings` и структура `DetachLogicalPortBinding` в структуру запроса `DetachLogicalPortsRequest` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `Purpose`, `Type`, `Addresses`, `L2ConnectionPorts` в структуру ответа `RecordNetObjGroup` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `AddressesCount`, `L2ConnectionPortsCount` в структуру ответа `Counter` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `Type`, `AppliedNetObjectGroups` в структуру ответа `SecurityPolicy` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `AccessGroupID`, `Action`, `Direction`, `DisplayName`, `Enabled`, `LogEnabled`, `LogSeverity`, `Priority`, `StatisticsEnabled`, `VersionID`, `Description`, `DestinationNetObject`, `Filter`, `ID`, `LogName`, `SecurityPolicyID`, `SourceNetObject` и `Type` в структуру ответа `SecurityRule` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `ExcludeFirewall`, `Labels` в структуру ответа `LogicalPort` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поля `AccessGroupID`, `AccessGroupName` в структуру ответа `ExternalNetworkPort` в sdn/netobjgroups |
|
||||||
|
|
||||||
|
### Исправлено
|
||||||
|
|
||||||
|
#### SDN access groups
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-836 | Тип возвращаемого значения с `bool` на `string` в методе `Delete` в sdn/acsgroups |
|
||||||
|
|
||||||
|
#### SDN hypervisors
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-847 | Тип вычисляемого поля `Ports` с `[]string` на структуру `Ports` в структуре ответа `RecordHypervisor` в sdn/hypervisors |
|
||||||
|
|
||||||
|
#### SDN hetwork object groups
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-837 | Тип ответа метода `AttachExtNetPorts` с `bool` на `*RecordVersion` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Тип ответа метода `AttachLogicalPorts` с `bool` на `*RecordVersion` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поле `Common` на `OperationStatus` в структуре `Status` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поле `Status` на `OperationStatus` в структуре `HypervisorInfo` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Тип поля `VersionID` со `string` на `uint64` в структуре `ExternalNetworkPort` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Тип поля `VLANTag` со `string` на `int` в структуре `ExternalNetworkPort` в sdn/netobjgroups |
|
||||||
|
|
||||||
### Удалено
|
### Удалено
|
||||||
|
|
||||||
#### compute
|
#### SDN access groups
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-793 | Вычисляемое поле `Status` из структуры ответа `RecordCloneAbort` в cloudbroker/compute |
|
| BGOS-836 | Поля `CreatedBy` и `UpdatedBy` в структуре ответа `AccessGroup` в sdn/acsgroups |
|
||||||
|
|
||||||
|
#### SDN segments
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-798 | Метод `GetStatus` и структура запроса `GetStatusRequest` в sdn/segments |
|
||||||
|
|
||||||
|
#### SDN network object groups
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-837 | Поле `IsExcludedFromFirewall` из структуры `Bindings` в sdn/netobjgroups |
|
||||||
|
| BGOS-837 | Поле `AppliedToNetObjectGroupID` из структуры `SecurityPolicy` в sdn/netobjgroups |
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ 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);
|
||||||
@@ -181,12 +182,14 @@ go get -u repository.basistech.ru/BASIS/decort-golang-sdk
|
|||||||
- `Address pool` - управление пулами адресов;
|
- `Address pool` - управление пулами адресов;
|
||||||
- `DefaultSecurityPolicies` - управление политиками хранения по умолчанию;
|
- `DefaultSecurityPolicies` - управление политиками хранения по умолчанию;
|
||||||
- `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ;
|
- `ExtNet` - управление виртуальными сетями, отвечающими за внешний доступ;
|
||||||
|
- `Hypervisors` - управление гипервизорами;
|
||||||
- `FloatingIPs` - управление плавающими IP-адресами;
|
- `FloatingIPs` - управление плавающими IP-адресами;
|
||||||
- `Logical ports` - управление логическими портами;
|
- `Logical ports` - управление логическими портами;
|
||||||
- `NetworkObjectGroups` - управление группами объектов сети;
|
- `NetworkObjectGroups` - управление группами объектов сети;
|
||||||
- `Routers` - управление роутерами;
|
- `Routers` - управление роутерами;
|
||||||
- `SecurityPolicies` - управление политиками хранения;
|
- `SecurityPolicies` - управление политиками хранения;
|
||||||
- `Segments` - управление сегментами;
|
- `Segments` - управление сегментами;
|
||||||
|
- `Version` - получение информации о версии SDN;
|
||||||
|
|
||||||
## Работа с библиотекой
|
## Работа с библиотекой
|
||||||
|
|
||||||
@@ -365,6 +368,7 @@ 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`
|
||||||
@@ -381,12 +385,14 @@ func main() {
|
|||||||
- `pkg/sdn/adrspools` - для `Address pool`
|
- `pkg/sdn/adrspools` - для `Address pool`
|
||||||
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
|
- `pkg/sdn/defsecpolicies` - для `DefaultSecurityPolicies`
|
||||||
- `pkg/sdn/external_networks` - для `ExtNet`
|
- `pkg/sdn/external_networks` - для `ExtNet`
|
||||||
|
- `pkg/sdn/hypervisors` - для `Hypervisors`
|
||||||
- `pkg/sdn/flips` - для `FloatingIPs`
|
- `pkg/sdn/flips` - для `FloatingIPs`
|
||||||
- `pkg/sdn/logicalports` - для `Logical ports`
|
- `pkg/sdn/logicalports` - для `Logical ports`
|
||||||
- `pkg/sdn/netobjgroups` - для `NetworkObjectGroups`
|
- `pkg/sdn/netobjgroups` - для `NetworkObjectGroups`
|
||||||
- `pkg/sdn/routers` - для `Routers`
|
- `pkg/sdn/routers` - для `Routers`
|
||||||
- `pkg/sdn/secpolicies` - для `SecurityPolicies`
|
- `pkg/sdn/secpolicies` - для `SecurityPolicies`
|
||||||
- `pkg/sdn/segments` - для `Segments`
|
- `pkg/sdn/segments` - для `Segments`
|
||||||
|
- `pkg/sdn/version` - для `Version`
|
||||||
|
|
||||||
Все поля структуры имеют описание, в которых содержится:
|
Все поля структуры имеют описание, в которых содержится:
|
||||||
|
|
||||||
@@ -563,6 +569,7 @@ func main() {
|
|||||||
- `.PCIDevice()` - для работы с `PCIDevice`
|
- `.PCIDevice()` - для работы с `PCIDevice`
|
||||||
- `.Prometheus()` - для работы с `Prometheus`
|
- `.Prometheus()` - для работы с `Prometheus`
|
||||||
- `.Resmon()` - для работы с `Resmon`
|
- `.Resmon()` - для работы с `Resmon`
|
||||||
|
- `.ResourceOptimizer()` - для работы с `ResourceOptimizer`
|
||||||
- `.RG()` - для работы с `RG`
|
- `.RG()` - для работы с `RG`
|
||||||
- `.SecurityGroup()` - для работы с `Security Group`
|
- `.SecurityGroup()` - для работы с `Security Group`
|
||||||
- `.SEP()` - для работы с `SEP`
|
- `.SEP()` - для работы с `SEP`
|
||||||
@@ -581,12 +588,14 @@ func main() {
|
|||||||
- `.AddressPool()` - для работы с `Addres pool`
|
- `.AddressPool()` - для работы с `Addres pool`
|
||||||
- `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies`
|
- `.DefaultSecurityPolicies()` - для работы с `DefaultSecurityPolicies`
|
||||||
- `.ExtNet()` - для работы с `ExtNet`
|
- `.ExtNet()` - для работы с `ExtNet`
|
||||||
|
- `.Hypervisors()` - для работы с `Hypervisors`
|
||||||
- `.FloatingIPs()` - для работы с `FloatingIPs`
|
- `.FloatingIPs()` - для работы с `FloatingIPs`
|
||||||
- `.LogicalPorts()` - для работы с `Logical ports`
|
- `.LogicalPorts()` - для работы с `Logical ports`
|
||||||
- `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups`
|
- `.NetworkObjectGroups()` - для работы с `NetworkObjectGroups`
|
||||||
- `.Routers()` - для работы с `Routers`
|
- `.Routers()` - для работы с `Routers`
|
||||||
- `.SecurityPolicies()` - для работы с `SecurityPolicies`
|
- `.SecurityPolicies()` - для работы с `SecurityPolicies`
|
||||||
- `.Segments()` - для работы с `Segments`
|
- `.Segments()` - для работы с `Segments`
|
||||||
|
- `.Version()` - для работы с `Version`
|
||||||
|
|
||||||
3. Вызвать метод, отвечающий за выполнение запроса и передать в него:
|
3. Вызвать метод, отвечающий за выполнение запроса и передать в него:
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package compute
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"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 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||||
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (bool, error) {
|
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/compute/abort_shared_snapshot_merge"
|
url := "/cloudapi/compute/abort_shared_snapshot_merge"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
return string(res), nil
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -882,6 +882,9 @@ type ItemComputeDisk struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge time
|
// Purge time
|
||||||
PurgeTime uint64 `json:"purgeTime"`
|
PurgeTime uint64 `json:"purgeTime"`
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ type NetAttachRequest struct {
|
|||||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||||
|
|
||||||
// Flag indicating whether security groups are enabled for this interface
|
// Flag indicating whether security groups are enabled for this interface
|
||||||
|
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ type SnapshotCreateRequest struct {
|
|||||||
|
|
||||||
// Text label for snapshot.
|
// Text label for snapshot.
|
||||||
// Must be unique among this compute snapshots
|
// Must be unique among this compute snapshots
|
||||||
|
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
|
||||||
|
// Maximum length: 36 characters
|
||||||
// Required: true
|
// Required: true
|
||||||
Label string `url:"label" json:"label" validate:"required"`
|
Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotCreate create compute snapshot
|
// SnapshotCreate create compute snapshot
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ type ItemDisk struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge time
|
// Purge time
|
||||||
PurgeTime uint64 `json:"purgeTime"`
|
PurgeTime uint64 `json:"purgeTime"`
|
||||||
|
|
||||||
@@ -241,6 +244,9 @@ type ItemDiskUnattached struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge attempts
|
// Purge attempts
|
||||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
PurgeAttempts uint64 `json:"purgeAttempts"`
|
||||||
|
|
||||||
@@ -471,6 +477,9 @@ type RecordDisk struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge time
|
// Purge time
|
||||||
PurgeTime uint64 `json:"purgeTime"`
|
PurgeTime uint64 `json:"purgeTime"`
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,9 @@ type RecordImage struct {
|
|||||||
// Link to
|
// Link to
|
||||||
LinkTo uint64 `json:"linkTo"`
|
LinkTo uint64 `json:"linkTo"`
|
||||||
|
|
||||||
|
// Links to
|
||||||
|
LinksTo []uint64 `json:"linksTo"`
|
||||||
|
|
||||||
// Milestones
|
// Milestones
|
||||||
Milestones uint64 `json:"milestones"`
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ type Interface struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
||||||
|
|
||||||
// Maximum transmission unit, must be 1-9216
|
// Used for EXTNET, TRUNK and DPDK
|
||||||
// Used only to DPDK net type
|
// Must be 1500-9216
|
||||||
// Required: false
|
// Required: false
|
||||||
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
||||||
|
|
||||||
@@ -69,6 +69,7 @@ type Interface struct {
|
|||||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||||
|
|
||||||
// Flag indicating whether security groups are enabled for this interface
|
// Flag indicating whether security groups are enabled for this interface
|
||||||
|
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -16,22 +16,22 @@ type HighlyAvailableRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HighlyAvailable makes load balancer highly available
|
// HighlyAvailable makes load balancer highly available
|
||||||
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) {
|
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudapi/lb/makeHighlyAvailable"
|
url := "/cloudapi/lb/makeHighlyAvailable"
|
||||||
|
|
||||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
result, err := strconv.ParseBool(string(res))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ type ItemLocation struct {
|
|||||||
|
|
||||||
// Support of SDN
|
// Support of SDN
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
|
// Is Zero Access enabled
|
||||||
|
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
|
||||||
|
|
||||||
|
// Is BRO enabled
|
||||||
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of locations
|
// List of locations
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for VINS
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
type wrapperCreateRequestInAcc struct {
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for VINS
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
type wrapperCreateRequestInRG struct {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package zone
|
|||||||
|
|
||||||
// FilterByID returns ListZones with specified ID.
|
// FilterByID returns ListZones with specified ID.
|
||||||
func (list ListZones) FilterByID(id uint64) ListZones {
|
func (list ListZones) FilterByID(id uint64) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.ID == id
|
return izone.ID == id
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ func (list ListZones) FilterByID(id uint64) ListZones {
|
|||||||
|
|
||||||
// FilterByName returns ListZones with specified Name.
|
// FilterByName returns ListZones with specified Name.
|
||||||
func (list ListZones) FilterByName(name string) ListZones {
|
func (list ListZones) FilterByName(name string) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.Name == name
|
return izone.Name == name
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ func (list ListZones) FilterByName(name string) ListZones {
|
|||||||
|
|
||||||
// FilterByStatus returns ListZones with specified Status.
|
// FilterByStatus returns ListZones with specified Status.
|
||||||
func (list ListZones) FilterByStatus(status string) ListZones {
|
func (list ListZones) FilterByStatus(status string) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.Status == status
|
return izone.Status == status
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func (list ListZones) FilterByStatus(status string) ListZones {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FilterFunc allows filtering ListZones based on a user-specified predicate.
|
// FilterFunc allows filtering ListZones based on a user-specified predicate.
|
||||||
func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
func (list ListZones) FilterFunc(predicate func(ItemZone) bool) ListZones {
|
||||||
var result ListZones
|
var result ListZones
|
||||||
|
|
||||||
for _, item := range list.Data {
|
for _, item := range list.Data {
|
||||||
@@ -42,11 +42,11 @@ func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindOne returns first found RecordZone
|
// FindOne returns first found ItemZone
|
||||||
// If none was found, returns an empty struct.
|
// If none was found, returns an empty struct.
|
||||||
func (list ListZones) FindOne() RecordZone {
|
func (list ListZones) FindOne() ItemZone {
|
||||||
if list.EntryCount == 0 {
|
if list.EntryCount == 0 {
|
||||||
return RecordZone{}
|
return ItemZone{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.Data[0]
|
return list.Data[0]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package zone
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
var zones = ListZones{
|
var zones = ListZones{
|
||||||
Data: []RecordZone{
|
Data: []ItemZone{
|
||||||
|
|
||||||
{
|
{
|
||||||
ID: 2,
|
ID: 2,
|
||||||
@@ -76,7 +76,7 @@ func TestFilterByStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterFunc(t *testing.T) {
|
func TestFilterFunc(t *testing.T) {
|
||||||
actual := zones.FilterFunc(func(ien RecordZone) bool {
|
actual := zones.FilterFunc(func(ien ItemZone) bool {
|
||||||
return ien.Deletable == true
|
return ien.Deletable == true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ type ListZones struct {
|
|||||||
EntryCount uint64 `json:"entryCount"`
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
Data []RecordZone `json:"data"`
|
Data []ItemZone `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detailed information about the zone record
|
// Detailed information about the zone record
|
||||||
@@ -47,7 +47,7 @@ type RecordZone struct {
|
|||||||
K8SIDs []uint64 `json:"k8sIds"`
|
K8SIDs []uint64 `json:"k8sIds"`
|
||||||
|
|
||||||
// List of associated LB IDs
|
// List of associated LB IDs
|
||||||
LBIDs []uint64 `json:"lbIds"`
|
LBIDs []uint64 `json:"lbsIds"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
@@ -63,4 +63,106 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// List of associated VINS IDs
|
// List of associated VINS IDs
|
||||||
VinsIDs []uint64 `json:"vinsIds"`
|
VinsIDs []uint64 `json:"vinsIds"`
|
||||||
|
|
||||||
|
// DRS
|
||||||
|
DRS bool `json:"drs"`
|
||||||
|
|
||||||
|
// DRS UID
|
||||||
|
DRSUID string `json:"drs_uid"`
|
||||||
|
|
||||||
|
// App ID
|
||||||
|
AppID string `json:"app_id"`
|
||||||
|
|
||||||
|
// Decort URL
|
||||||
|
DecortURL string `json:"decort_url"`
|
||||||
|
|
||||||
|
// DRS Name
|
||||||
|
DRSName string `json:"drs_name"`
|
||||||
|
|
||||||
|
// SSO URL
|
||||||
|
SSOURL string `json:"sso_url"`
|
||||||
|
|
||||||
|
// SSO type
|
||||||
|
SSOType string `json:"sso_type"`
|
||||||
|
|
||||||
|
// Ping address
|
||||||
|
PingAddr string `json:"ping_addr"`
|
||||||
|
|
||||||
|
// Broadcast address
|
||||||
|
BroadcastAddr string `json:"broadcast_addr"`
|
||||||
|
|
||||||
|
// Skip ssl verify
|
||||||
|
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
Domain string `json:"domain"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// A zone item from a list
|
||||||
|
type ItemZone struct {
|
||||||
|
// App ID
|
||||||
|
AppID string `json:"app_id"`
|
||||||
|
|
||||||
|
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||||
|
AutoStart bool `json:"autostart"`
|
||||||
|
|
||||||
|
// Created timestamp
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Decort URL
|
||||||
|
DecortURL string `json:"decort_url"`
|
||||||
|
|
||||||
|
// Deletable flag
|
||||||
|
Deletable bool `json:"deletable"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// DRS
|
||||||
|
DRS bool `json:"drs"`
|
||||||
|
|
||||||
|
// DRS Name
|
||||||
|
DRSName string `json:"drs_name"`
|
||||||
|
|
||||||
|
// DRS UID
|
||||||
|
DRSUID string `json:"drs_uid"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// List of associated Node IDs
|
||||||
|
NodeIDs []uint64 `json:"nodeIds"`
|
||||||
|
|
||||||
|
// SSO URL
|
||||||
|
SSOURL string `json:"sso_url"`
|
||||||
|
|
||||||
|
// SSO type
|
||||||
|
SSOType string `json:"sso_type"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Updated timestamp
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// Ping address
|
||||||
|
PingAddr string `json:"ping_addr"`
|
||||||
|
|
||||||
|
// Broadcast address
|
||||||
|
BroadcastAddr string `json:"broadcast_addr"`
|
||||||
|
|
||||||
|
// Skip ssl verify
|
||||||
|
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package compute
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"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 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AbortSharedSnapshotMerge shared snapshots merge abort
|
// AbortSharedSnapshotMerge shared snapshots merge abort
|
||||||
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (bool, error) {
|
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
|
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
return string(res), nil
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -481,6 +481,9 @@ type ItemDisk struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge attempts
|
// Purge attempts
|
||||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
PurgeAttempts uint64 `json:"purgeAttempts"`
|
||||||
|
|
||||||
@@ -1532,4 +1535,4 @@ type CheckComputePlacementItem struct {
|
|||||||
Error CheckComputePlacementError `json:"error,omitempty"`
|
Error CheckComputePlacementError `json:"error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CheckComputePlacementResult map[string]CheckComputePlacementItem
|
type CheckComputePlacementResult map[uint64]CheckComputePlacementItem
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ type NetAttachRequest struct {
|
|||||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||||
|
|
||||||
// Flag indicating whether security groups are enabled for this interface
|
// Flag indicating whether security groups are enabled for this interface
|
||||||
|
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ type SnapshotCreateRequest struct {
|
|||||||
|
|
||||||
// Text label for snapshot.
|
// Text label for snapshot.
|
||||||
// Must be unique among this compute snapshots
|
// Must be unique among this compute snapshots
|
||||||
|
// Allowed characters: a-z, 0-9, spaces, punctuation except '<' and '>'
|
||||||
|
// Maximum length: 36 characters
|
||||||
// Required: true
|
// Required: true
|
||||||
Label string `url:"label" json:"label" validate:"required"`
|
Label string `url:"label" json:"label" validate:"required,max=36,excludesall=<>"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotCreate creates compute snapshot
|
// SnapshotCreate creates compute snapshot
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ type InfoDisk struct {
|
|||||||
// Present to
|
// Present to
|
||||||
PresentTo map[string]uint64 `json:"presentTo"`
|
PresentTo map[string]uint64 `json:"presentTo"`
|
||||||
|
|
||||||
|
// Provision
|
||||||
|
Provision string `json:"provision"`
|
||||||
|
|
||||||
// Purge attempts
|
// Purge attempts
|
||||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
PurgeAttempts uint64 `json:"purgeAttempts"`
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ type CreateRequest struct {
|
|||||||
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
|
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
|
||||||
// Required: false
|
// Required: false
|
||||||
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
|
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for DPDK network
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a DPDK networks
|
// Create creates a DPDK networks
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ type CreateRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
// Default: false
|
// Default: false
|
||||||
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
|
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for external network
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperCreateRequest struct {
|
type wrapperCreateRequest struct {
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
package grid
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AddRequest struct for location code
|
|
||||||
type AddRequest struct {
|
|
||||||
// Grid (platform) ID
|
|
||||||
// Required: true
|
|
||||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
|
||||||
|
|
||||||
// Name of the location
|
|
||||||
// Required: true
|
|
||||||
Name string `url:"name" json:"name" validate:"required"`
|
|
||||||
|
|
||||||
// Location code typicly used in dns names
|
|
||||||
// Required: true
|
|
||||||
LocationCode string `url:"locationcode" json:"locationcode" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add location code (e.g. DNS name of this grid)
|
|
||||||
func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) {
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/cloudbroker/grid/add"
|
|
||||||
|
|
||||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
@@ -96,6 +96,9 @@ type RecordGrid struct {
|
|||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
|
// Is BRO enabled
|
||||||
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Information about grid
|
// Information about grid
|
||||||
@@ -129,6 +132,12 @@ type ItemGridList struct {
|
|||||||
|
|
||||||
// SDN support
|
// SDN support
|
||||||
SDNSupport bool `json:"sdn_support"`
|
SDNSupport bool `json:"sdn_support"`
|
||||||
|
|
||||||
|
// Is Zero Access enabled
|
||||||
|
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
|
||||||
|
|
||||||
|
// Is BRO enabled
|
||||||
|
BROEnabled bool `json:"bro_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List Grids
|
// List Grids
|
||||||
|
|||||||
47
pkg/cloudbroker/image/create_multi_image.go
Normal file
47
pkg/cloudbroker/image/create_multi_image.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package image
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CreateMultiImageRequest struct to create multi image
|
||||||
|
type CreateMultiImageRequest struct {
|
||||||
|
// Name of the multi image
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// IDs of real images
|
||||||
|
// Required: true
|
||||||
|
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
|
||||||
|
|
||||||
|
// Account ID
|
||||||
|
// Required: false
|
||||||
|
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateMultiImage creates multi image
|
||||||
|
func (i Image) CreateMultiImage(ctx context.Context, req CreateMultiImageRequest) (uint64, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/image/create_multi_image"
|
||||||
|
|
||||||
|
res, err := i.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
|
||||||
|
}
|
||||||
@@ -39,11 +39,11 @@ type EditRequest struct {
|
|||||||
|
|
||||||
// Does this machine supports hot resize
|
// Does this machine supports hot resize
|
||||||
// Required: false
|
// Required: false
|
||||||
HotResize bool `url:"hotresize,omitempty" json:"hotresize,omitempty"`
|
HotResize interface{} `url:"hotresize,omitempty" json:"hotresize,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
// Does this image boot OS
|
// Does this image boot OS
|
||||||
// Required: false
|
// Required: false
|
||||||
Bootable bool `url:"bootable,omitempty" json:"bootable,omitempty"`
|
Bootable interface{} `url:"bootable,omitempty" json:"bootable,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit edits an existing image
|
// Edit edits an existing image
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ type RecordImage struct {
|
|||||||
// Link to
|
// Link to
|
||||||
LinkTo uint64 `json:"linkTo"`
|
LinkTo uint64 `json:"linkTo"`
|
||||||
|
|
||||||
|
// Links to
|
||||||
|
LinksTo []uint64 `json:"linksTo"`
|
||||||
|
|
||||||
// Milestones
|
// Milestones
|
||||||
Milestones uint64 `json:"milestones"`
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
@@ -197,6 +200,9 @@ type ItemImage struct {
|
|||||||
// Link to
|
// Link to
|
||||||
LinkTo uint64 `json:"linkTo"`
|
LinkTo uint64 `json:"linkTo"`
|
||||||
|
|
||||||
|
// Links to
|
||||||
|
LinksTo []uint64 `json:"linksTo"`
|
||||||
|
|
||||||
// Milestones
|
// Milestones
|
||||||
Milestones uint64 `json:"milestones"`
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
|||||||
43
pkg/cloudbroker/image/multi_image_add_links.go
Normal file
43
pkg/cloudbroker/image/multi_image_add_links.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package image
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MultiImageAddLinksRequest struct to add links to multi image
|
||||||
|
type MultiImageAddLinksRequest struct {
|
||||||
|
// ID of the multi image
|
||||||
|
// Required: true
|
||||||
|
ImageID uint64 `url:"image_id" json:"image_id" validate:"required"`
|
||||||
|
|
||||||
|
// IDs of real images
|
||||||
|
// Required: true
|
||||||
|
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MultiImageAddLinks adds image links to multi image
|
||||||
|
func (i Image) MultiImageAddLinks(ctx context.Context, req MultiImageAddLinksRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/image/multi_image_add_links"
|
||||||
|
|
||||||
|
res, err := i.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
|
||||||
|
}
|
||||||
43
pkg/cloudbroker/image/multi_image_del_links.go
Normal file
43
pkg/cloudbroker/image/multi_image_del_links.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package image
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MultiImageDelLinksRequest struct to delete links from multi image
|
||||||
|
type MultiImageDelLinksRequest struct {
|
||||||
|
// ID of the multi image
|
||||||
|
// Required: true
|
||||||
|
ImageID uint64 `url:"image_id" json:"image_id" validate:"required"`
|
||||||
|
|
||||||
|
// IDs of real images
|
||||||
|
// Required: true
|
||||||
|
TargetIDs []uint64 `url:"target_ids" json:"target_ids" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MultiImageDelLinks removes image links from multi image
|
||||||
|
func (i Image) MultiImageDelLinks(ctx context.Context, req MultiImageDelLinksRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/image/multi_image_del_links"
|
||||||
|
|
||||||
|
res, err := i.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
|
||||||
|
}
|
||||||
46
pkg/cloudbroker/image/multi_image_export.go
Normal file
46
pkg/cloudbroker/image/multi_image_export.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package image
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MultiImageExportRequest struct to export multi image to a pool
|
||||||
|
type MultiImageExportRequest struct {
|
||||||
|
// ID of the multi image
|
||||||
|
// Required: true
|
||||||
|
MultiImageID uint64 `url:"multi_image_id" json:"multi_image_id" validate:"required"`
|
||||||
|
|
||||||
|
// Name of the target pool
|
||||||
|
// Required: true
|
||||||
|
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
||||||
|
|
||||||
|
// Target SEP ID
|
||||||
|
// Required: true
|
||||||
|
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MultiImageExport copies a physical image from multi image to the specified pool
|
||||||
|
func (i Image) MultiImageExport(ctx context.Context, req MultiImageExportRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/image/multi_image_export"
|
||||||
|
|
||||||
|
res, err := i.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
|
||||||
|
}
|
||||||
@@ -28,8 +28,8 @@ type Interface struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
||||||
|
|
||||||
// Maximum transmission unit, must be 1-9216
|
// Used for EXTNET, TRUNK and DPDK
|
||||||
// Used only to DPDK net type
|
// Must be 1500-9216
|
||||||
// Required: false
|
// Required: false
|
||||||
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
||||||
|
|
||||||
@@ -51,6 +51,7 @@ type Interface struct {
|
|||||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||||
|
|
||||||
// Flag indicating whether security groups are enabled for this interface
|
// Flag indicating whether security groups are enabled for this interface
|
||||||
|
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ type InterfaceMassCreate struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
||||||
|
|
||||||
// Maximum transmission unit, must be 1-9216
|
// Used for EXTNET, TRUNK and DPDK
|
||||||
// Used only to DPDK net type
|
// Must be 1500-9216
|
||||||
// Required: false
|
// Required: false
|
||||||
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`
|
||||||
|
|
||||||
@@ -45,6 +45,7 @@ type InterfaceMassCreate struct {
|
|||||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||||
|
|
||||||
// Flag indicating whether security groups are enabled for this interface
|
// Flag indicating whether security groups are enabled for this interface
|
||||||
|
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||||
// Required: false
|
// Required: false
|
||||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ type GetLogicalCoresCountRequest struct {
|
|||||||
// Node ID
|
// Node ID
|
||||||
// Required: true
|
// Required: true
|
||||||
NodeId uint64 `url:"node_id" json:"node_id" validate:"required"`
|
NodeId uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
|
||||||
|
// Target
|
||||||
|
// Required: false
|
||||||
|
Target string `url:"target,omitempty" json:"target,omitempty" validate:"omitempty,oneof=core node"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLogicalCoresCount get logical cores count by node
|
// GetLogicalCoresCount get logical cores count by node
|
||||||
@@ -24,7 +28,7 @@ func (i Node) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCount
|
|||||||
|
|
||||||
url := "/cloudbroker/node/get_logical_cores_count"
|
url := "/cloudbroker/node/get_logical_cores_count"
|
||||||
|
|
||||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := i.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ type FreeResourcesInfo struct {
|
|||||||
RAM float64 `json:"RAM"`
|
RAM float64 `json:"RAM"`
|
||||||
|
|
||||||
// VCPU
|
// VCPU
|
||||||
VCPU uint64 `json:"vCPUs"`
|
VCPU float64 `json:"vCPUs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resources Info
|
// Resources Info
|
||||||
@@ -155,6 +155,9 @@ type CpuInfo struct {
|
|||||||
// PhysCount
|
// PhysCount
|
||||||
PhysCount uint64 `json:"physCount"`
|
PhysCount uint64 `json:"physCount"`
|
||||||
|
|
||||||
|
// Thread count
|
||||||
|
ThreadCount uint64 `json:"threadCount"`
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
Flags []string `json:"flags"`
|
Flags []string `json:"flags"`
|
||||||
|
|
||||||
|
|||||||
10
pkg/cloudbroker/resource_optimizer.go
Normal file
10
pkg/cloudbroker/resource_optimizer.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
42
pkg/cloudbroker/resource_optimizer/drs_add_nodes.go
Normal file
42
pkg/cloudbroker/resource_optimizer/drs_add_nodes.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
87
pkg/cloudbroker/resource_optimizer/drs_create.go
Normal file
87
pkg/cloudbroker/resource_optimizer/drs_create.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
42
pkg/cloudbroker/resource_optimizer/drs_del_nodes.go
Normal file
42
pkg/cloudbroker/resource_optimizer/drs_del_nodes.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
38
pkg/cloudbroker/resource_optimizer/drs_remove.go
Normal file
38
pkg/cloudbroker/resource_optimizer/drs_remove.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
38
pkg/cloudbroker/resource_optimizer/drs_start.go
Normal file
38
pkg/cloudbroker/resource_optimizer/drs_start.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
38
pkg/cloudbroker/resource_optimizer/drs_stop.go
Normal file
38
pkg/cloudbroker/resource_optimizer/drs_stop.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
87
pkg/cloudbroker/resource_optimizer/drs_update.go
Normal file
87
pkg/cloudbroker/resource_optimizer/drs_update.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
16
pkg/cloudbroker/resource_optimizer/resource_optimizer.go
Normal file
16
pkg/cloudbroker/resource_optimizer/resource_optimizer.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// 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,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -66,7 +66,7 @@ type ItemResourceConsumption struct {
|
|||||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||||
|
|
||||||
// Resource group ID
|
// Resource group ID
|
||||||
RGID uint64 `json:"rgid"`
|
RGID uint64 `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListResourceConsumption struct {
|
type ListResourceConsumption struct {
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ type UpdateRequest struct {
|
|||||||
// Storage policies
|
// Storage policies
|
||||||
// Required: false
|
// Required: false
|
||||||
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
|
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
|
||||||
|
|
||||||
|
// CPU allocation parameter
|
||||||
|
// Required: false
|
||||||
|
CPUAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates resource group
|
// Update updates resource group
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package sep
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
@@ -13,32 +15,66 @@ type AddPoolRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||||
|
|
||||||
// Method Async/Sync
|
|
||||||
// Default: true
|
|
||||||
// Required: false
|
|
||||||
Sync bool `url:"sync" json:"sync"`
|
|
||||||
|
|
||||||
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
|
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
|
||||||
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
|
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
|
||||||
// Required: true
|
// Required: true
|
||||||
Pool string `url:"pool" json:"pool" validate:"required"`
|
Pool string `url:"pool" json:"pool" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddPool adds pool to SEP
|
type wrapperAddPoolRequest struct {
|
||||||
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) {
|
AddPoolRequest
|
||||||
|
AsyncMode bool `url:"asyncMode"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddPool adds pool to SEP in sync mode.
|
||||||
|
// It returns result of operation and error.
|
||||||
|
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
reqWrapped := wrapperAddPoolRequest{
|
||||||
|
AddPoolRequest: req,
|
||||||
|
AsyncMode: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/cloudbroker/sep/addPool"
|
||||||
|
|
||||||
|
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddPoolAsync adds pool to SEP in async mode.
|
||||||
|
// It returns guid of task and error.
|
||||||
|
func (s SEP) AddPoolAsync(ctx context.Context, req AddPoolRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqWrapped := wrapperAddPoolRequest{
|
||||||
|
AddPoolRequest: req,
|
||||||
|
AsyncMode: true,
|
||||||
|
}
|
||||||
|
|
||||||
url := "/cloudbroker/sep/addPool"
|
url := "/cloudbroker/sep/addPool"
|
||||||
|
|
||||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
result := string(res)
|
result := strings.ReplaceAll(string(res), "\"", "")
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
)
|
)
|
||||||
@@ -34,23 +34,25 @@ type ConfigFieldEditRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ConfigFieldEdit edits SEP config field value
|
// ConfigFieldEdit edits SEP config field value
|
||||||
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (bool, error) {
|
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (*RecordConfigFieldEdit, 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/sep/configFieldEdit"
|
url := "/cloudbroker/sep/configFieldEdit"
|
||||||
|
|
||||||
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 false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
info := RecordConfigFieldEdit{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return &info, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
)
|
)
|
||||||
@@ -25,22 +25,24 @@ type DelConsumerNodesRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DelConsumerNodes excludes consumer nodes from SEP parameters
|
// DelConsumerNodes excludes consumer nodes from SEP parameters
|
||||||
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (bool, error) {
|
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (interface{}, 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/sep/delConsumerNodes"
|
url := "/cloudbroker/sep/delConsumerNodes"
|
||||||
|
|
||||||
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 false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
var result interface{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package sep
|
package sep
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
// Total resource information
|
// Total resource information
|
||||||
type Total struct {
|
type Total struct {
|
||||||
// Capacity limit
|
// Capacity limit
|
||||||
@@ -185,3 +187,93 @@ type ListAvailableSEP struct {
|
|||||||
// Data
|
// Data
|
||||||
Data []SEPData `json:"data"`
|
Data []SEPData `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disk clean settings
|
||||||
|
type DiskCleanSettings struct {
|
||||||
|
// Block size
|
||||||
|
BlockSize string `json:"blocksize"`
|
||||||
|
|
||||||
|
// Write bytes per second
|
||||||
|
WBPS uint64 `json:"wbps"`
|
||||||
|
|
||||||
|
// Write I/O operations per second
|
||||||
|
WIOPS uint64 `json:"wiops"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pool configuration
|
||||||
|
type PoolConfig struct {
|
||||||
|
// Disk clean
|
||||||
|
DiskClean *string `json:"disk_clean"`
|
||||||
|
|
||||||
|
// Disk clean settings
|
||||||
|
DiskCleanSettings DiskCleanSettings `json:"disk_clean_settings"`
|
||||||
|
|
||||||
|
// Pool name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Usage limit
|
||||||
|
UsageLimit uint64 `json:"usage_limit"`
|
||||||
|
|
||||||
|
// Additional properties
|
||||||
|
AdditionalProperties map[string]interface{} `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PoolConfig) UnmarshalJSON(data []byte) error {
|
||||||
|
type tmpAlias PoolConfig
|
||||||
|
if err := json.Unmarshal(data, (*tmpAlias)(p)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
all := make(map[string]interface{})
|
||||||
|
if err := json.Unmarshal(data, &all); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(all, "disk_clean")
|
||||||
|
delete(all, "disk_clean_settings")
|
||||||
|
delete(all, "name")
|
||||||
|
delete(all, "usage_limit")
|
||||||
|
|
||||||
|
if len(all) > 0 {
|
||||||
|
p.AdditionalProperties = all
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sep configuration information
|
||||||
|
type RecordConfigFieldEdit struct {
|
||||||
|
// Format
|
||||||
|
Format string `json:"format"`
|
||||||
|
|
||||||
|
// Pools
|
||||||
|
Pools []PoolConfig `json:"pools"`
|
||||||
|
|
||||||
|
// Protocol
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
|
||||||
|
// Additional properties
|
||||||
|
AdditionalProperties map[string]interface{} `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RecordConfigFieldEdit) UnmarshalJSON(data []byte) error {
|
||||||
|
type tmpAlias RecordConfigFieldEdit
|
||||||
|
if err := json.Unmarshal(data, (*tmpAlias)(r)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
all := make(map[string]interface{})
|
||||||
|
if err := json.Unmarshal(data, &all); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(all, "format")
|
||||||
|
delete(all, "pools")
|
||||||
|
delete(all, "protocol")
|
||||||
|
|
||||||
|
if len(all) > 0 {
|
||||||
|
r.AdditionalProperties = all
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for VINS
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperCreateRequestInAcc struct {
|
type wrapperCreateRequestInAcc struct {
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
|
|||||||
// Zone ID
|
// Zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||||
|
|
||||||
|
// Enable security groups for VINS
|
||||||
|
// Required: false
|
||||||
|
// Default: false
|
||||||
|
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wrapperCreateRequestInRG struct {
|
type wrapperCreateRequestInRG struct {
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ type CreateRequest struct {
|
|||||||
// If true, all nodes belonging to the given zone will be marked for autostart
|
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||||
// Required: false
|
// Required: false
|
||||||
AutoStart interface{} `url:"autostart,omitempty" json:"autostart,omitempty" validate:"omitempty,isBool"`
|
AutoStart interface{} `url:"autostart,omitempty" json:"autostart,omitempty" validate:"omitempty,isBool"`
|
||||||
|
|
||||||
|
// Enables Distributed Resource Scheduler (DRS) functionality for the zone
|
||||||
|
// Required: false
|
||||||
|
DRS interface{} `url:"drs,omitempty" json:"drs,omitempty" validate:"omitempty,isBool"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates zone object
|
// Create creates zone object
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package zone
|
|||||||
|
|
||||||
// FilterByID returns ListZones with specified ID.
|
// FilterByID returns ListZones with specified ID.
|
||||||
func (list ListZones) FilterByID(id uint64) ListZones {
|
func (list ListZones) FilterByID(id uint64) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.ID == id
|
return izone.ID == id
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ func (list ListZones) FilterByID(id uint64) ListZones {
|
|||||||
|
|
||||||
// FilterByName returns ListZones with specified Name.
|
// FilterByName returns ListZones with specified Name.
|
||||||
func (list ListZones) FilterByName(name string) ListZones {
|
func (list ListZones) FilterByName(name string) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.Name == name
|
return izone.Name == name
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ func (list ListZones) FilterByName(name string) ListZones {
|
|||||||
|
|
||||||
// FilterByStatus returns ListZones with specified Status.
|
// FilterByStatus returns ListZones with specified Status.
|
||||||
func (list ListZones) FilterByStatus(status string) ListZones {
|
func (list ListZones) FilterByStatus(status string) ListZones {
|
||||||
predicate := func(izone RecordZone) bool {
|
predicate := func(izone ItemZone) bool {
|
||||||
return izone.Status == status
|
return izone.Status == status
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func (list ListZones) FilterByStatus(status string) ListZones {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FilterFunc allows filtering ListZones based on a user-specified predicate.
|
// FilterFunc allows filtering ListZones based on a user-specified predicate.
|
||||||
func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
func (list ListZones) FilterFunc(predicate func(ItemZone) bool) ListZones {
|
||||||
var result ListZones
|
var result ListZones
|
||||||
|
|
||||||
for _, item := range list.Data {
|
for _, item := range list.Data {
|
||||||
@@ -42,11 +42,11 @@ func (list ListZones) FilterFunc(predicate func(RecordZone) bool) ListZones {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindOne returns first found RecordZone
|
// FindOne returns first found ItemZone
|
||||||
// If none was found, returns an empty struct.
|
// If none was found, returns an empty struct.
|
||||||
func (list ListZones) FindOne() RecordZone {
|
func (list ListZones) FindOne() ItemZone {
|
||||||
if list.EntryCount == 0 {
|
if list.EntryCount == 0 {
|
||||||
return RecordZone{}
|
return ItemZone{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.Data[0]
|
return list.Data[0]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package zone
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
var zones = ListZones{
|
var zones = ListZones{
|
||||||
Data: []RecordZone{
|
Data: []ItemZone{
|
||||||
|
|
||||||
{
|
{
|
||||||
ID: 2,
|
ID: 2,
|
||||||
@@ -76,7 +76,7 @@ func TestFilterByStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterFunc(t *testing.T) {
|
func TestFilterFunc(t *testing.T) {
|
||||||
actual := zones.FilterFunc(func(ien RecordZone) bool {
|
actual := zones.FilterFunc(func(ien ItemZone) bool {
|
||||||
return ien.Deletable == true
|
return ien.Deletable == true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ type ListZones struct {
|
|||||||
EntryCount uint64 `json:"entryCount"`
|
EntryCount uint64 `json:"entryCount"`
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
Data []RecordZone `json:"data"`
|
Data []ItemZone `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detailed information about the zone record
|
// Detailed information about the zone record
|
||||||
@@ -63,4 +63,106 @@ type RecordZone struct {
|
|||||||
|
|
||||||
// List of associated VINS IDs
|
// List of associated VINS IDs
|
||||||
VinsIDs []uint64 `json:"vinsIds"`
|
VinsIDs []uint64 `json:"vinsIds"`
|
||||||
|
|
||||||
|
// DRS
|
||||||
|
DRS bool `json:"drs"`
|
||||||
|
|
||||||
|
// DRS UID
|
||||||
|
DRSUID string `json:"drs_uid"`
|
||||||
|
|
||||||
|
// App ID
|
||||||
|
AppID string `json:"app_id"`
|
||||||
|
|
||||||
|
// Decort URL
|
||||||
|
DecortURL string `json:"decort_url"`
|
||||||
|
|
||||||
|
// DRS Name
|
||||||
|
DRSName string `json:"drs_name"`
|
||||||
|
|
||||||
|
// SSO URL
|
||||||
|
SSOURL string `json:"sso_url"`
|
||||||
|
|
||||||
|
// SSO type
|
||||||
|
SSOType string `json:"sso_type"`
|
||||||
|
|
||||||
|
// Ping address
|
||||||
|
PingAddr string `json:"ping_addr"`
|
||||||
|
|
||||||
|
// Broadcast address
|
||||||
|
BroadcastAddr string `json:"broadcast_addr"`
|
||||||
|
|
||||||
|
// Skip ssl verify
|
||||||
|
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
Domain string `json:"domain"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// A zone item from a list
|
||||||
|
type ItemZone struct {
|
||||||
|
// App ID
|
||||||
|
AppID string `json:"app_id"`
|
||||||
|
|
||||||
|
// If true, all nodes belonging to the given zone will be marked for autostart
|
||||||
|
AutoStart bool `json:"autostart"`
|
||||||
|
|
||||||
|
// Created timestamp
|
||||||
|
CreatedTime uint64 `json:"createdTime"`
|
||||||
|
|
||||||
|
// Decort URL
|
||||||
|
DecortURL string `json:"decort_url"`
|
||||||
|
|
||||||
|
// Deletable flag
|
||||||
|
Deletable bool `json:"deletable"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// DRS
|
||||||
|
DRS bool `json:"drs"`
|
||||||
|
|
||||||
|
// DRS Name
|
||||||
|
DRSName string `json:"drs_name"`
|
||||||
|
|
||||||
|
// DRS UID
|
||||||
|
DRSUID string `json:"drs_uid"`
|
||||||
|
|
||||||
|
// GID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// List of associated Node IDs
|
||||||
|
NodeIDs []uint64 `json:"nodeIds"`
|
||||||
|
|
||||||
|
// SSO URL
|
||||||
|
SSOURL string `json:"sso_url"`
|
||||||
|
|
||||||
|
// SSO type
|
||||||
|
SSOType string `json:"sso_type"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Updated timestamp
|
||||||
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
// Ping address
|
||||||
|
PingAddr string `json:"ping_addr"`
|
||||||
|
|
||||||
|
// Broadcast address
|
||||||
|
BroadcastAddr string `json:"broadcast_addr"`
|
||||||
|
|
||||||
|
// Skip ssl verify
|
||||||
|
SSLSkipVerify bool `json:"ssl_skip_verify"`
|
||||||
|
|
||||||
|
// Domain
|
||||||
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package acsgroups
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
@@ -16,24 +15,19 @@ type DeleteRequest struct {
|
|||||||
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a access groups
|
// Delete an access groups
|
||||||
func (i AccessGroups) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
func (i AccessGroups) Delete(ctx context.Context, req DeleteRequest) (string, error) {
|
||||||
err := validators.ValidateRequest(req)
|
err := validators.ValidateRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := "/sdn/access_group/delete"
|
url := "/sdn/access_group/delete"
|
||||||
|
|
||||||
res, err := i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
res, err := i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
return string(res), nil
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ type AccessGroup struct {
|
|||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
Comment string `json:"comment"`
|
Comment string `json:"comment"`
|
||||||
CreatedAt string `json:"created_at"`
|
CreatedAt string `json:"created_at"`
|
||||||
CreatedBy string `json:"created_by"`
|
|
||||||
UpdatedAt string `json:"updated_at"`
|
UpdatedAt string `json:"updated_at"`
|
||||||
UpdatedBy string `json:"updated_by"`
|
|
||||||
NetObjectAccessGroup NetObjectAccessGroup `json:"net_object_access_group"`
|
NetObjectAccessGroup NetObjectAccessGroup `json:"net_object_access_group"`
|
||||||
DefaultSecurityPolicy DefaultSecurityPolicy `json:"default_security_policy"`
|
DefaultSecurityPolicy DefaultSecurityPolicy `json:"default_security_policy"`
|
||||||
}
|
}
|
||||||
|
|||||||
10
pkg/sdn/hypervisors.go
Normal file
10
pkg/sdn/hypervisors.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package sdn
|
||||||
|
|
||||||
|
import (
|
||||||
|
hv "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/hypervisors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the SDN method group
|
||||||
|
func (sdn *SDN) Hypervisors() *hv.Hypervisors {
|
||||||
|
return hv.New(sdn.client)
|
||||||
|
}
|
||||||
30
pkg/sdn/hypervisors/connect_node.go
Normal file
30
pkg/sdn/hypervisors/connect_node.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConnectNodeRequest to connect a node
|
||||||
|
type ConnectNodeRequest struct {
|
||||||
|
// Node to connect
|
||||||
|
// Required: true
|
||||||
|
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hv Hypervisors) ConnectNode(ctx context.Context, req ConnectNodeRequest) (string, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
url := "/sdn/hypervisor/connect_node"
|
||||||
|
result, err := hv.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(result), nil
|
||||||
|
}
|
||||||
43
pkg/sdn/hypervisors/delete.go
Normal file
43
pkg/sdn/hypervisors/delete.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DeleteRequest to delete a hypervisor
|
||||||
|
type DeleteRequest struct {
|
||||||
|
// Name of a hypervisor
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete a hypervisor
|
||||||
|
func (hv Hypervisors) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/hypervisor/delete"
|
||||||
|
|
||||||
|
res, err := hv.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if string(res) == "" {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := strconv.ParseBool(string(res))
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
50
pkg/sdn/hypervisors/get.go
Normal file
50
pkg/sdn/hypervisors/get.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRequest struct to get information about hypervisor
|
||||||
|
type GetRequest struct {
|
||||||
|
// Name
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Port info (available options: detailed, general)
|
||||||
|
// Required: false
|
||||||
|
PortInfo string `url:"port_info,omitempty" json:"port_info,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets current configuration of a hypervisor as a RecordHypervisor
|
||||||
|
func (hv Hypervisors) Get(ctx context.Context, req GetRequest) (*RecordHypervisor, error) {
|
||||||
|
res, err := hv.GetRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordHypervisor{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets information about a hypervisor as an array of bytes
|
||||||
|
func (hv Hypervisors) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/hypervisor/get"
|
||||||
|
|
||||||
|
res, err := hv.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
17
pkg/sdn/hypervisors/hypervisors.go
Normal file
17
pkg/sdn/hypervisors/hypervisors.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to hypervisors
|
||||||
|
type Hypervisors struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for hypervisors endpoints
|
||||||
|
func New(client interfaces.Caller) *Hypervisors {
|
||||||
|
return &Hypervisors{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
90
pkg/sdn/hypervisors/list.go
Normal file
90
pkg/sdn/hypervisors/list.go
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ListRequest struct to get a list of hypervisors
|
||||||
|
type ListRequest struct {
|
||||||
|
// Page
|
||||||
|
// Required: false
|
||||||
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// Per page
|
||||||
|
// Required: false
|
||||||
|
PerPage uint64 `url:"per_page,omitempty" json:"per_page,omitempty"`
|
||||||
|
|
||||||
|
// Sort by (available options: name, hostname, last_sync, display_name, ip, created_at, updated_at)
|
||||||
|
// Required: false
|
||||||
|
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty"`
|
||||||
|
|
||||||
|
// Sort order (available options: asc, desc)
|
||||||
|
// Required: false
|
||||||
|
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
|
||||||
|
|
||||||
|
// Port info (available options: detailed, general)
|
||||||
|
// Required: false
|
||||||
|
PortInfo string `url:"port_info,omitempty" json:"port_info,omitempty"`
|
||||||
|
|
||||||
|
// Hostname
|
||||||
|
// Required: false
|
||||||
|
Hostname string `url:"hostname,omitempty" json:"hostname,omitempty"`
|
||||||
|
|
||||||
|
// Display name
|
||||||
|
// Required: false
|
||||||
|
DisplayName string `url:"display_name,omitempty" json:"display_name,omitempty"`
|
||||||
|
|
||||||
|
// IP
|
||||||
|
// Required: false
|
||||||
|
IP string `url:"ip,omitempty" json:"ip,omitempty"`
|
||||||
|
|
||||||
|
// Created from
|
||||||
|
// Required: false
|
||||||
|
CreatedFrom string `url:"created_from,omitempty" json:"created_from,omitempty"`
|
||||||
|
|
||||||
|
// Created to
|
||||||
|
// Required: false
|
||||||
|
CreatedTo string `url:"created_to,omitempty" json:"created_to,omitempty"`
|
||||||
|
|
||||||
|
// Updated from
|
||||||
|
// Required: false
|
||||||
|
UpdatedFrom string `url:"updated_from,omitempty" json:"updated_from,omitempty"`
|
||||||
|
|
||||||
|
// Updated to
|
||||||
|
// Required: false
|
||||||
|
UpdatedTo string `url:"updated_to,omitempty" json:"updated_to,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of hypervisors
|
||||||
|
func (hv Hypervisors) List(ctx context.Context, req ListRequest) (HypervisorsList, error) {
|
||||||
|
res, err := hv.ListRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
hvs := HypervisorsList{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &hvs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return hvs, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRaw gets a list of all hypervisors as an array of bytes
|
||||||
|
func (hv Hypervisors) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||||
|
|
||||||
|
if err := validators.ValidateRequest(req); err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/hypervisor/list"
|
||||||
|
|
||||||
|
res, err := hv.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
58
pkg/sdn/hypervisors/models.go
Normal file
58
pkg/sdn/hypervisors/models.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
// Main information about hypervisor
|
||||||
|
type RecordHypervisor struct {
|
||||||
|
// Created at
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
|
// Display name
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Hostname
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
|
||||||
|
// IP
|
||||||
|
IP string `json:"ip"`
|
||||||
|
|
||||||
|
// Synced at
|
||||||
|
SyncedAt string `json:"synced_at"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Ports
|
||||||
|
Ports Ports `json:"ports"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of hypervisors
|
||||||
|
type HypervisorsList []RecordHypervisor
|
||||||
|
|
||||||
|
// Hypervisor ports
|
||||||
|
type Ports struct {
|
||||||
|
Data []Port `json:"data"`
|
||||||
|
Info Info `json:"info"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info about a port
|
||||||
|
type Port struct {
|
||||||
|
// ID of a port
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Unique ID of a port
|
||||||
|
UniqueIdentifier string `json:"unique_identifier"`
|
||||||
|
|
||||||
|
// Display name of a port
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Is a port up
|
||||||
|
UP bool `json:"up"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Port counters
|
||||||
|
type Info struct {
|
||||||
|
ActivePorts uint64 `json:"active_ports"`
|
||||||
|
TotalPorts uint64 `json:"total_ports"`
|
||||||
|
}
|
||||||
50
pkg/sdn/hypervisors/update_display_name.go
Normal file
50
pkg/sdn/hypervisors/update_display_name.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package hypervisors
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UpdateDisplayNameRequest struct to update display name for a hypervisor
|
||||||
|
type UpdateDisplayNameRequest struct {
|
||||||
|
// Current name of the hypervisor
|
||||||
|
// Required: true
|
||||||
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// New display name to set
|
||||||
|
// Required: true
|
||||||
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateDisplayName updates display name for a hypervisor
|
||||||
|
func (hv Hypervisors) UpdateDisplayName(ctx context.Context, req UpdateDisplayNameRequest) (*RecordHypervisor, error) {
|
||||||
|
res, err := hv.UpdateDisplayNameRaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordHypervisor{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateDisplayNameRaw update display name for a hypervisor and get its information as an array of bytes
|
||||||
|
func (hv Hypervisors) UpdateDisplayNameRaw(ctx context.Context, req UpdateDisplayNameRequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/hypervisor/update_display_name"
|
||||||
|
|
||||||
|
res, err := hv.client.DecortApiCall(ctx, http.MethodPut, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -9,6 +9,12 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Label struct
|
||||||
|
type CreateLabels struct {
|
||||||
|
VMID string `url:"vm_id,omitempty" json:"vm_id,omitempty"`
|
||||||
|
VMName string `url:"vm_name,omitempty" json:"vm_name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateRequest struct to create logical port
|
// CreateRequest struct to create logical port
|
||||||
type CreateRequest struct {
|
type CreateRequest struct {
|
||||||
// ID of the access group
|
// ID of the access group
|
||||||
@@ -27,10 +33,6 @@ type CreateRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
Enabled interface{} `url:"enabled" json:"enabled" validate:"required,isBool"`
|
Enabled interface{} `url:"enabled" json:"enabled" validate:"required,isBool"`
|
||||||
|
|
||||||
// Is excluded from firewall. True or False
|
|
||||||
// Required: true
|
|
||||||
IsExcludedFromFirewall interface{} `url:"is_excluded_from_firewall" json:"is_excluded_from_firewall" validate:"required,isBool"`
|
|
||||||
|
|
||||||
// Hypervisor
|
// Hypervisor
|
||||||
// Required: true
|
// Required: true
|
||||||
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
|
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
|
||||||
@@ -54,6 +56,10 @@ 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 []LogicalPortAddress `url:"logical_port_addresses,omitempty" json:"logical_port_addresses,omitempty" validate:"dive"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
// Required: false
|
||||||
|
Labels CreateLabels `url:"labels,omitempty" json:"labels,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogicalPortAddressRequest struct representing logical port address
|
// LogicalPortAddressRequest struct representing logical port address
|
||||||
|
|||||||
134
pkg/sdn/logicalports/create_batch.go
Normal file
134
pkg/sdn/logicalports/create_batch.go
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
package logicalports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateBatchLogicalPortAddress struct {
|
||||||
|
// IP
|
||||||
|
// Required: true
|
||||||
|
IP string `url:"ip" json:"ip" validate:"required"`
|
||||||
|
|
||||||
|
// IP Type
|
||||||
|
// Required: true
|
||||||
|
IPType string `url:"ip_type" json:"ip_type" validate:"required"`
|
||||||
|
|
||||||
|
// Is Discovered
|
||||||
|
// Required: true
|
||||||
|
IsDiscovered bool `url:"is_discovered" json:"is_discovered" validate:"required"`
|
||||||
|
|
||||||
|
// Is Primary
|
||||||
|
// Required: true
|
||||||
|
IsPrimary bool `url:"is_primary" json:"is_primary" validate:"required"`
|
||||||
|
|
||||||
|
// MAC
|
||||||
|
// Required: false
|
||||||
|
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateBatchBindings struct {
|
||||||
|
// Address Detection
|
||||||
|
// Required: true
|
||||||
|
AddressDetection bool `url:"address_detection" json:"address_detection" validate:"required"`
|
||||||
|
|
||||||
|
// Logical Port Address
|
||||||
|
// Required: true
|
||||||
|
LogicalPortAddresses []CreateBatchLogicalPortAddress `url:"logical_port_addresses" json:"logical_port_addresses" validate:"required,dive"`
|
||||||
|
|
||||||
|
// Port Security
|
||||||
|
// Required: true
|
||||||
|
PortSecurity bool `url:"port_security" json:"port_security" validate:"required"`
|
||||||
|
|
||||||
|
// Segment ID
|
||||||
|
// Required: true
|
||||||
|
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateBatchLabels struct {
|
||||||
|
// VM ID
|
||||||
|
// Required: false
|
||||||
|
VMID string `url:"vm_id,omitempty" json:"vm_id,omitempty"`
|
||||||
|
|
||||||
|
// VM Name
|
||||||
|
// Required: false
|
||||||
|
VMName string `url:"vm_name,omitempty" json:"vm_name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NetObjectGroups struct {
|
||||||
|
// ID
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ports struct {
|
||||||
|
// Adapter MAC
|
||||||
|
// Required: false
|
||||||
|
AdapterMAC string `url:"adapter_mac,omitempty" json:"adapter_mac,omitempty"`
|
||||||
|
|
||||||
|
// Bindings
|
||||||
|
// Required: true
|
||||||
|
Bindings CreateBatchBindings `url:"bindings" json:"bindings" validate:"required"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
// Required: true
|
||||||
|
Description string `url:"description" json:"description" validate:"required"`
|
||||||
|
|
||||||
|
// Display Name
|
||||||
|
// Required: true
|
||||||
|
DisplayName string `url:"display_name" json:"display_name" validate:"required"`
|
||||||
|
|
||||||
|
// Enabled
|
||||||
|
// Required: true
|
||||||
|
Enabled bool `url:"enabled" json:"enabled" validate:"required"`
|
||||||
|
|
||||||
|
// Hypervisor
|
||||||
|
// Required: true
|
||||||
|
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
|
||||||
|
|
||||||
|
// Net Object Groups
|
||||||
|
// Required: false
|
||||||
|
NetObjectGroups []NetObjectGroups `json:"net_object_groups" validate:"required,dive"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
// Required: false
|
||||||
|
Labels []CreateBatchLabels `url:"labels,omitempty" json:"labels,omitempty" validate:"required,dive"`
|
||||||
|
|
||||||
|
// Unique Identifier
|
||||||
|
// Required: false
|
||||||
|
UniqueIdentifier string `url:"unique_identifier,omitempty" json:"unique_identifier,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBatchRequest struct to create a batch of logical ports
|
||||||
|
type CreateBatchRequest struct {
|
||||||
|
// Access Group ID
|
||||||
|
// Required: true
|
||||||
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
|
// Ports
|
||||||
|
// Required: true
|
||||||
|
Ports []Ports `json:"ports" validate:"required,dive"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBatch creates a batch of logical ports
|
||||||
|
func (lp LogicalPorts) CreateBatch(ctx context.Context, req CreateBatchRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
url := "/sdn/logical_port/create_batch"
|
||||||
|
|
||||||
|
_, err = lp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
50
pkg/sdn/logicalports/delete_batch.go
Normal file
50
pkg/sdn/logicalports/delete_batch.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package logicalports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PortsInfo struct {
|
||||||
|
// Force
|
||||||
|
// Required: true
|
||||||
|
Force bool `url:"force" json:"force" validate:"required"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteBatchRequest struct to delete a batch of logical ports
|
||||||
|
type DeleteBatchRequest struct {
|
||||||
|
// Access Group ID
|
||||||
|
// Required: true
|
||||||
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
|
// Ports Info
|
||||||
|
// Required: true
|
||||||
|
PortsInfo []PortsInfo `json:"ports_info" validate:"required,dive"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteBatch deletes a batch of logical ports
|
||||||
|
func (lp LogicalPorts) DeleteBatch(ctx context.Context, req DeleteBatchRequest) (bool, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
url := "/sdn/logical_port/delete_batch"
|
||||||
|
|
||||||
|
_, err = lp.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
63
pkg/sdn/logicalports/exclude_firewall.go
Normal file
63
pkg/sdn/logicalports/exclude_firewall.go
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
package logicalports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LogicalPortsForExcludeFromFirewall struct {
|
||||||
|
// Exclude IP Addresses
|
||||||
|
// Required: true
|
||||||
|
ExcludeIPAddresses bool `url:"exclude_ip_addresses" json:"exclude_ip_addresses" validate:"required"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExcludeFirewallRequest struct to exclude firewall for logical port
|
||||||
|
type ExcludeFirewallRequest struct {
|
||||||
|
// Access Group ID
|
||||||
|
// Required: true
|
||||||
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
|
// Logical Ports For Exclude From Firewall
|
||||||
|
// Required: true
|
||||||
|
LogicalPortsForExcludeFromFirewall []LogicalPortsForExcludeFromFirewall `json:"logical_ports_for_exclude_from_firewall" validate:"required,dive"`
|
||||||
|
|
||||||
|
// Exclusion Reason
|
||||||
|
// Required: false
|
||||||
|
ExclusionReason string `url:"exclusion_reason,omitempty" json:"exclusion_reason,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExcludeFirewall excludes firewall from a logical port
|
||||||
|
func (lp LogicalPorts) ExcludeFirewall(ctx context.Context, req ExcludeFirewallRequest) (*RecordVersion, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/logical_port/exclude_firewall"
|
||||||
|
|
||||||
|
res, err := lp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
@@ -70,6 +70,14 @@ type ListRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
CreatedTo string `url:"created_to,omitempty" json:"created_to,omitempty"`
|
CreatedTo string `url:"created_to,omitempty" json:"created_to,omitempty"`
|
||||||
|
|
||||||
|
// Filter by operation status
|
||||||
|
// Required: false
|
||||||
|
OperationStatus string `url:"operation_status,omitempty" json:"operation_status,omitempty"`
|
||||||
|
|
||||||
|
// Filter by hypervisor status
|
||||||
|
// Required: false
|
||||||
|
HypervisorStatus string `url:"hypervisor_status,omitempty" json:"hypervisor_status,omitempty"`
|
||||||
|
|
||||||
// Page number for pagination
|
// Page number for pagination
|
||||||
// Required: false
|
// Required: false
|
||||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||||
@@ -87,7 +95,7 @@ type ListRequest struct {
|
|||||||
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
|
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of logical portts
|
// List of logical ports
|
||||||
func (i LogicalPorts) List(ctx context.Context, req ListRequest) (*LogicalPortsList, error) {
|
func (i LogicalPorts) List(ctx context.Context, req ListRequest) (*LogicalPortsList, error) {
|
||||||
res, err := i.ListRaw(ctx, req)
|
res, err := i.ListRaw(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ type LogicalPort struct {
|
|||||||
// Hypervisor display name
|
// Hypervisor display name
|
||||||
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
Labels Labels `json:"labels"`
|
||||||
|
|
||||||
// Live migration target hypervisor
|
// Live migration target hypervisor
|
||||||
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
||||||
|
|
||||||
@@ -64,17 +67,21 @@ type LogicalPort struct {
|
|||||||
|
|
||||||
// Status information
|
// Status information
|
||||||
type Status struct {
|
type Status struct {
|
||||||
// Common status
|
|
||||||
Common string `json:"common"`
|
// Operation status
|
||||||
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Hypervisors status
|
// Hypervisors status
|
||||||
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
||||||
|
|
||||||
|
// Hypervisor status
|
||||||
|
HypervisorStatus string `json:"hypervisor_status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HypervisorStatus information
|
// HypervisorStatus information
|
||||||
type HypervisorStatus struct {
|
type HypervisorStatus struct {
|
||||||
// Status
|
// Operation status
|
||||||
Status string `json:"status"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -106,9 +113,6 @@ type Bindings struct {
|
|||||||
// Address detection
|
// Address detection
|
||||||
AddressDetection bool `json:"address_detection"`
|
AddressDetection bool `json:"address_detection"`
|
||||||
|
|
||||||
// Is excluded from firewall
|
|
||||||
IsExcludedFromFirewall bool `json:"is_excluded_from_firewall"`
|
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
@@ -149,6 +153,7 @@ type LogicalPortAddress struct {
|
|||||||
AssignedAt string `json:"assigned_at"`
|
AssignedAt string `json:"assigned_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Migration status information
|
||||||
type MigrationStatus struct {
|
type MigrationStatus struct {
|
||||||
// ID
|
// ID
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -156,3 +161,18 @@ type MigrationStatus struct {
|
|||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Labels information
|
||||||
|
type Labels struct {
|
||||||
|
// VM ID
|
||||||
|
VMID string `json:"vm_id"`
|
||||||
|
|
||||||
|
// VM name
|
||||||
|
VMName string `json:"vm_name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Information about a version
|
||||||
|
type RecordVersion struct {
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|||||||
55
pkg/sdn/logicalports/unexclude_firewall.go
Normal file
55
pkg/sdn/logicalports/unexclude_firewall.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package logicalports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LogicalPortsForUnexcludeFromFirewall struct {
|
||||||
|
// Exclude IP Addresses
|
||||||
|
// Required: true
|
||||||
|
ID string `url:"id" json:"id" validate:"required"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
// Required: true
|
||||||
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnexcludeFirewallRequest struct to unexclude firewall for logical port
|
||||||
|
type UnexcludeFirewallRequest struct {
|
||||||
|
// Access Group ID
|
||||||
|
// Required: true
|
||||||
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
||||||
|
|
||||||
|
// Logical Ports For Unexclude From Firewall
|
||||||
|
// Required: true
|
||||||
|
LogicalPortsForUnexcludeFromFirewall []LogicalPortsForUnexcludeFromFirewall `json:"logical_ports_for_unexclude_from_firewall" validate:"required,dive"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnexcludeFirewallRequest struct to unexclude firewall for logical port
|
||||||
|
func (lp LogicalPorts) UnexcludeFirewall(ctx context.Context, req UnexcludeFirewallRequest) (*RecordVersion, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/logical_port/unexclude_firewall"
|
||||||
|
|
||||||
|
res, err := lp.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
@@ -9,6 +9,12 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Label struct
|
||||||
|
type UpdateLabels struct {
|
||||||
|
VMID string `url:"vm_id,omitempty" json:"vm_id,omitempty"`
|
||||||
|
VMName string `url:"vm_name,omitempty" json:"vm_name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateRequest struct to update logical port
|
// UpdateRequest struct to update logical port
|
||||||
type UpdateRequest struct {
|
type UpdateRequest struct {
|
||||||
// ID of the logical port
|
// ID of the logical port
|
||||||
@@ -47,10 +53,6 @@ type UpdateRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
PortSecurity interface{} `url:"port_security" json:"port_security" validate:"required,isBool"`
|
PortSecurity interface{} `url:"port_security" json:"port_security" validate:"required,isBool"`
|
||||||
|
|
||||||
// Is excluded from firewall. True or False
|
|
||||||
// Required: true
|
|
||||||
IsExcludedFromFirewall interface{} `url:"is_excluded_from_firewall" json:"is_excluded_from_firewall" validate:"required,isBool"`
|
|
||||||
|
|
||||||
// Segment ID
|
// Segment ID
|
||||||
// Required: true
|
// Required: true
|
||||||
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
||||||
@@ -62,6 +64,10 @@ type UpdateRequest struct {
|
|||||||
// Add addresses
|
// Add addresses
|
||||||
// Required: false
|
// Required: false
|
||||||
AddAddresses []AddAddress `url:"add_addresses,omitempty" json:"add_addresses,omitempty" validate:"dive"`
|
AddAddresses []AddAddress `url:"add_addresses,omitempty" json:"add_addresses,omitempty" validate:"dive"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
// Required: false
|
||||||
|
Labels UpdateLabels `url:"labels,omitempty" json:"labels,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateAddress struct representing update address
|
// UpdateAddress struct representing update address
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package netobjgroups
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
@@ -24,18 +25,25 @@ type AttachExtNetPortsRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AttachExtNetPorts attaches external network ports to a network object group
|
// AttachExtNetPorts attaches external network ports to a network object group
|
||||||
func (nog NetworkObjectGroups) AttachExtNetPorts(ctx context.Context, req AttachExtNetPortsRequest) (bool, error) {
|
func (nog NetworkObjectGroups) AttachExtNetPorts(ctx context.Context, req AttachExtNetPortsRequest) (*RecordVersion, 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 := "/sdn/network_object_group/attach_external_network_ports"
|
url := "/sdn/network_object_group/attach_external_network_ports"
|
||||||
|
|
||||||
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package netobjgroups
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||||||
@@ -26,6 +27,7 @@ type AttachLogicalPortsRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
PortBindings []PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
PortBindings []PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PortBindings struct {
|
type PortBindings struct {
|
||||||
// ID of a logical port
|
// ID of a logical port
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -37,18 +39,25 @@ type PortBindings struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AttachLogicalPorts attaches logical ports to a network object group
|
// AttachLogicalPorts attaches logical ports to a network object group
|
||||||
func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (bool, error) {
|
func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (*RecordVersion, 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 := "/sdn/network_object_group/attach_logical_ports"
|
url := "/sdn/network_object_group/attach_logical_ports"
|
||||||
|
|
||||||
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,14 @@ type CreateRequest struct {
|
|||||||
// Logical ports bindings
|
// Logical ports bindings
|
||||||
// Required: false
|
// Required: false
|
||||||
LogicalPortsBindings []LogicalPortsBindings `url:"logical_ports_binding,omitempty" json:"logical_ports_bindings,omitempty" validate:"omitempty,dive"`
|
LogicalPortsBindings []LogicalPortsBindings `url:"logical_ports_binding,omitempty" json:"logical_ports_bindings,omitempty" validate:"omitempty,dive"`
|
||||||
|
|
||||||
|
// L2 connection ports bindings
|
||||||
|
// Required: false
|
||||||
|
L2ConnectionPortsBindings []LogicalPortsBindings `url:"l2_connection_ports_binding,omitempty" json:"l2_connection_ports_bindings,omitempty" validate:"omitempty,dive"`
|
||||||
|
|
||||||
|
// Addresses
|
||||||
|
// Required: false
|
||||||
|
Addresses []NetAddressRequest `url:"addresses,omitempty" json:"addresses,omitempty" validate:"omitempty,dive"`
|
||||||
}
|
}
|
||||||
type LogicalPortsBindings struct {
|
type LogicalPortsBindings struct {
|
||||||
// Port ID
|
// Port ID
|
||||||
@@ -34,7 +42,7 @@ type LogicalPortsBindings struct {
|
|||||||
|
|
||||||
// Port version
|
// Port version
|
||||||
// Required: true
|
// Required: true
|
||||||
PortVersion int64 `url:"port_version" json:"port_version" validate:"required"`
|
PortVersion uint64 `url:"port_version" json:"port_version" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create creates a network object group
|
// Create creates a network object group
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DetachLogicalPortsRequest struct to detach an logical port from a network object group
|
// DetachLogicalPortsRequest struct to detach logical ports from a network object group
|
||||||
type DetachLogicalPortsRequest struct {
|
type DetachLogicalPortsRequest struct {
|
||||||
// ID of a network object group
|
// ID of a network object group
|
||||||
// Required: true
|
// Required: true
|
||||||
@@ -23,13 +23,19 @@ type DetachLogicalPortsRequest struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
||||||
|
|
||||||
|
// Port bindings
|
||||||
|
// Required: true
|
||||||
|
PortBindings []DetachLogicalPortBinding `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DetachLogicalPortBinding struct {
|
||||||
// ID of a logical port
|
// ID of a logical port
|
||||||
// Required: true
|
// Required: true
|
||||||
LogicalPortID string `url:"logical_port_id" json:"logical_port_id" validate:"required"`
|
PortID string `url:"port_id" json:"port_id" validate:"required"`
|
||||||
|
|
||||||
// Version of a logical port
|
// Version of a logical port
|
||||||
// Required: true
|
// Required: true
|
||||||
LogicalPortVersion uint64 `url:"logical_port_version" json:"logical_port_version" validate:"required"`
|
PortVersion uint64 `url:"port_version" json:"port_version" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetachLogicalPorts detaches logical ports from a network object group
|
// DetachLogicalPorts detaches logical ports from a network object group
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ type RecordNetObjGroup struct {
|
|||||||
// Access group name
|
// Access group name
|
||||||
AccessGroupName string `json:"access_group_name"`
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
|
// Addresses
|
||||||
|
Addresses NetAddresses `json:"addresses"`
|
||||||
|
|
||||||
// Counters
|
// Counters
|
||||||
Counters Counter `json:"counters"`
|
Counters Counter `json:"counters"`
|
||||||
|
|
||||||
@@ -37,21 +40,36 @@ type RecordNetObjGroup struct {
|
|||||||
// ID of a network object group
|
// ID of a network object group
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// L2 connection ports attached to a network object group
|
||||||
|
L2ConnectionPorts L2ConnectionPorts `json:"l2_connection_ports"`
|
||||||
|
|
||||||
// Logical ports attached to a network object group
|
// Logical ports attached to a network object group
|
||||||
LogicalPorts LogicalPorts `json:"logical_ports"`
|
LogicalPorts LogicalPorts `json:"logical_ports"`
|
||||||
|
|
||||||
// Name of a network object group
|
// Name of a network object group
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Purpose of a network object group
|
||||||
|
Purpose string `json:"purpose"`
|
||||||
|
|
||||||
// Security policies of a network object group
|
// Security policies of a network object group
|
||||||
SecurityPolicies SecurityPolicies `json:"security_policies"`
|
SecurityPolicies SecurityPolicies `json:"security_policies"`
|
||||||
|
|
||||||
|
// Type of a network object group
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info about counters
|
// Info about counters
|
||||||
type Counter struct {
|
type Counter struct {
|
||||||
|
// Amount of addresses
|
||||||
|
AddressesCount uint64 `json:"addresses_count"`
|
||||||
|
|
||||||
|
// Amount of L2 connection ports
|
||||||
|
L2ConnectionPortsCount uint64 `json:"l2_connection_ports_count"`
|
||||||
|
|
||||||
// Amount of logical ports
|
// Amount of logical ports
|
||||||
LogicalPortsCount uint64 `json:"logical_ports_count"`
|
LogicalPortsCount uint64 `json:"logical_ports_count"`
|
||||||
|
|
||||||
@@ -62,23 +80,133 @@ type Counter struct {
|
|||||||
SecurityRulesCount uint64 `json:"security_rules_count"`
|
SecurityRulesCount uint64 `json:"security_rules_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of counters
|
// Info about a net address
|
||||||
type Counters []Counter
|
type NetAddress struct {
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
// Info about an external network port
|
// IP address
|
||||||
type ExternalNetworkPort struct {
|
IPAddr string `json:"ip_addr"`
|
||||||
|
|
||||||
|
// IP address range end
|
||||||
|
IPAddrRangeEnd string `json:"ip_addr_range_end"`
|
||||||
|
|
||||||
|
// IP prefix
|
||||||
|
IPPrefix string `json:"ip_prefix"`
|
||||||
|
|
||||||
|
// MAC address
|
||||||
|
MACAddr string `json:"mac_addr"`
|
||||||
|
|
||||||
|
// Net address type
|
||||||
|
NetAddressType string `json:"net_address_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of net addresses
|
||||||
|
type NetAddresses []NetAddress
|
||||||
|
|
||||||
|
// Request info about a net address
|
||||||
|
type NetAddressRequest struct {
|
||||||
|
// IP address
|
||||||
|
// Required: false
|
||||||
|
IPAddr string `url:"ip_addr" json:"ip_addr"`
|
||||||
|
|
||||||
|
// IP address range end
|
||||||
|
// Required: false
|
||||||
|
IPAddrRangeEnd string `url:"ip_addr_range_end" json:"ip_addr_range_end"`
|
||||||
|
|
||||||
|
// IP prefix
|
||||||
|
// Required: false
|
||||||
|
IPPrefix string `url:"ip_prefix" json:"ip_prefix"`
|
||||||
|
|
||||||
|
// MAC address
|
||||||
|
// Required: false
|
||||||
|
MACAddr string `url:"mac_addr" json:"mac_addr"`
|
||||||
|
|
||||||
|
// Net address type
|
||||||
|
// Required: true
|
||||||
|
NetAddressType string `url:"net_address_type" json:"net_address_type" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info about an L2 connection port
|
||||||
|
type L2ConnectionPort struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Created at
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// L2 external network
|
||||||
|
L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`
|
||||||
|
|
||||||
|
// Updated at
|
||||||
|
UpdatedAt string `json:"updated_at"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of L2 connection ports
|
||||||
|
type L2ConnectionPorts []L2ConnectionPort
|
||||||
|
|
||||||
|
// Info about an L2 external network
|
||||||
|
type L2ExternalNetwork struct {
|
||||||
// Bridge network name
|
// Bridge network name
|
||||||
BridgeNetworkName string `json:"bridge_network_name"`
|
BridgeNetworkName string `json:"bridge_network_name"`
|
||||||
|
|
||||||
// Default gateaway for IPv4
|
// Created at
|
||||||
DefaultGateawayIPv4 string `json:"default_gateaway_ipv4"`
|
CreatedAt string `json:"created_at"`
|
||||||
|
|
||||||
// Default gateaway for IPv6
|
|
||||||
DefaultGateawayIPv6 string `json:"default_gateaway_ipv6"`
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Display name
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Hypervisors
|
||||||
|
Hypervisors []string `json:"hypervisors"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Updated at
|
||||||
|
UpdatedAt string `json:"updated_at"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
|
// VLAN Tag
|
||||||
|
VLANTag *int `json:"vlan_tag"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info about an external network port
|
||||||
|
type ExternalNetworkPort struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Access group name
|
||||||
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
|
// Bridge network name
|
||||||
|
BridgeNetworkName string `json:"bridge_network_name"`
|
||||||
|
|
||||||
|
// Comment
|
||||||
|
Comment string `json:"comment"`
|
||||||
|
|
||||||
|
// Default gateway for IPv4
|
||||||
|
DefaultGatewayIPv4 string `json:"default_gateway_ipv4"`
|
||||||
|
|
||||||
|
// Default gateway for IPv6
|
||||||
|
DefaultGatewayIPv6 string `json:"default_gateway_ipv6"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Is a logical port enabled
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
// Details of external network ports
|
// Details of external network ports
|
||||||
ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`
|
ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"`
|
||||||
|
|
||||||
@@ -88,11 +216,14 @@ type ExternalNetworkPort struct {
|
|||||||
// ID of an external network port
|
// ID of an external network port
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// IP v4
|
||||||
|
IPv4 string `json:"ipv4"`
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID string `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
// Subnet for V4
|
// Subnet for V4
|
||||||
SubnetV4 string `json:"subnet_v4"`
|
SubnetV4 string `json:"subnet_v4"`
|
||||||
@@ -107,7 +238,10 @@ type ExternalNetworkPort struct {
|
|||||||
UpdatedAt string `json:"updated_at"`
|
UpdatedAt string `json:"updated_at"`
|
||||||
|
|
||||||
// VLAN Tag
|
// VLAN Tag
|
||||||
VLANTag string `json:"vlan_tag"`
|
VLANTag int `json:"vlan_tag"`
|
||||||
|
|
||||||
|
// MAC
|
||||||
|
MAC string `json:"mac"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of external network ports
|
// List of external network ports
|
||||||
@@ -142,6 +276,9 @@ type LogicalPort struct {
|
|||||||
// Is a logical port enabled
|
// Is a logical port enabled
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Exclude firewall settings
|
||||||
|
ExcludeFirewall ExcludeFirewall `json:"exclude_firewall"`
|
||||||
|
|
||||||
// External network ID
|
// External network ID
|
||||||
ExternalNetworkID string `json:"external_network_id"`
|
ExternalNetworkID string `json:"external_network_id"`
|
||||||
|
|
||||||
@@ -151,6 +288,9 @@ type LogicalPort struct {
|
|||||||
// Hypervisor display name
|
// Hypervisor display name
|
||||||
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
HypervisorDisplayName string `json:"hypervisor_display_name"`
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
Labels Labels `json:"labels"`
|
||||||
|
|
||||||
// Live migration target HV
|
// Live migration target HV
|
||||||
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
|
||||||
|
|
||||||
@@ -170,9 +310,30 @@ type LogicalPort struct {
|
|||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List a logical ports
|
// List of logical ports
|
||||||
type LogicalPorts []LogicalPort
|
type LogicalPorts []LogicalPort
|
||||||
|
|
||||||
|
// Info about exclude firewall settings
|
||||||
|
type ExcludeFirewall struct {
|
||||||
|
// Exclusion reason
|
||||||
|
ExclusionReason string `json:"exclusion_reason"`
|
||||||
|
|
||||||
|
// Is logical port addresses excluded
|
||||||
|
LogicalPortAddressesExcluded bool `json:"logical_port_addresses_excluded"`
|
||||||
|
|
||||||
|
// Is logical port excluded
|
||||||
|
LogicalPortExcluded bool `json:"logical_port_excluded"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Labels for a logical port
|
||||||
|
type Labels struct {
|
||||||
|
// VM ID
|
||||||
|
VMID string `json:"vm_id"`
|
||||||
|
|
||||||
|
// VM name
|
||||||
|
VMName string `json:"vm_name"`
|
||||||
|
}
|
||||||
|
|
||||||
// Info about a security policy
|
// Info about a security policy
|
||||||
type SecurityPolicy struct {
|
type SecurityPolicy struct {
|
||||||
// Access group ID
|
// Access group ID
|
||||||
@@ -181,8 +342,8 @@ type SecurityPolicy struct {
|
|||||||
// Access group name
|
// Access group name
|
||||||
AccessGroupName string `json:"access_group_name"`
|
AccessGroupName string `json:"access_group_name"`
|
||||||
|
|
||||||
// Applied to net object group ID
|
// Applied net object groups
|
||||||
AppliedToNetObjectGroupID string `json:"applied_to_net_object_group_id"`
|
AppliedNetObjectGroups AppliedNetObjectGroups `json:"applied_net_object_groups"`
|
||||||
|
|
||||||
// Created at
|
// Created at
|
||||||
CreatedAt string `json:"created_at"`
|
CreatedAt string `json:"created_at"`
|
||||||
@@ -211,6 +372,9 @@ type SecurityPolicy struct {
|
|||||||
// Status
|
// Status
|
||||||
Status Status `json:"status"`
|
Status Status `json:"status"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
@@ -221,6 +385,21 @@ type SecurityPolicy struct {
|
|||||||
// List of security policies
|
// List of security policies
|
||||||
type SecurityPolicies []SecurityPolicy
|
type SecurityPolicies []SecurityPolicy
|
||||||
|
|
||||||
|
// Info about an applied net object group in a security policy
|
||||||
|
type AppliedNetObjectGroup struct {
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of applied net object groups
|
||||||
|
type AppliedNetObjectGroups []AppliedNetObjectGroup
|
||||||
|
|
||||||
// Details of external network ports field
|
// Details of external network ports field
|
||||||
type ExternalNetworkPortField struct {
|
type ExternalNetworkPortField struct {
|
||||||
// Access group ID
|
// Access group ID
|
||||||
@@ -261,11 +440,14 @@ type ExternalNetworkPortsField []ExternalNetworkPortField
|
|||||||
|
|
||||||
// Info about a status
|
// Info about a status
|
||||||
type Status struct {
|
type Status struct {
|
||||||
// Common
|
// Operation status
|
||||||
Common string `json:"common"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Info about hypervisors
|
// Info about hypervisors
|
||||||
Hypervisors HypervisorsInfo `json:"hypervisors"`
|
Hypervisors HypervisorsInfo `json:"hypervisors"`
|
||||||
|
|
||||||
|
// Hypervisor status
|
||||||
|
HypervisorStatus string `json:"hypervisor_status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config for IP v6
|
// Config for IP v6
|
||||||
@@ -396,9 +578,6 @@ type Bindings struct {
|
|||||||
// Is an address detected
|
// Is an address detected
|
||||||
AddressDetection bool `json:"address_detection"`
|
AddressDetection bool `json:"address_detection"`
|
||||||
|
|
||||||
// Is excluded from firewall
|
|
||||||
IsExcludedFromFirewall bool `json:"is_excluded_from_firewall"`
|
|
||||||
|
|
||||||
// Version ID
|
// Version ID
|
||||||
VersionID uint64 `json:"version_id"`
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
@@ -648,8 +827,8 @@ type RoutersInfo struct {
|
|||||||
|
|
||||||
// Info about a hypervisor
|
// Info about a hypervisor
|
||||||
type HypervisorInfo struct {
|
type HypervisorInfo struct {
|
||||||
// Status
|
// Operation status
|
||||||
Status string `json:"status"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -696,7 +875,128 @@ type LogicalPortAddress struct {
|
|||||||
// List of logical port addresses
|
// List of logical port addresses
|
||||||
type LogicalPortAddresses []LogicalPortAddress
|
type LogicalPortAddresses []LogicalPortAddress
|
||||||
|
|
||||||
// TODO
|
// Info about a security rule
|
||||||
type SecurityRule struct{}
|
type SecurityRule struct {
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// Action
|
||||||
|
Action string `json:"action"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Destination net object
|
||||||
|
DestinationNetObject *SecurityRuleNetObject `json:"destination_net_object"`
|
||||||
|
|
||||||
|
// Direction
|
||||||
|
Direction string `json:"direction"`
|
||||||
|
|
||||||
|
// Display name
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Is enabled
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
|
||||||
|
// Filter
|
||||||
|
Filter *SecurityRuleFilter `json:"filter"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Is log enabled
|
||||||
|
LogEnabled bool `json:"log_enabled"`
|
||||||
|
|
||||||
|
// Log name
|
||||||
|
LogName string `json:"log_name"`
|
||||||
|
|
||||||
|
// Log severity
|
||||||
|
LogSeverity string `json:"log_severity"`
|
||||||
|
|
||||||
|
// Priority
|
||||||
|
Priority int `json:"priority"`
|
||||||
|
|
||||||
|
// Security policy ID
|
||||||
|
SecurityPolicyID string `json:"security_policy_id"`
|
||||||
|
|
||||||
|
// Source net object
|
||||||
|
SourceNetObject *SecurityRuleNetObject `json:"source_net_object"`
|
||||||
|
|
||||||
|
// Is statistics enabled
|
||||||
|
StatisticsEnabled bool `json:"statistics_enabled"`
|
||||||
|
|
||||||
|
// Type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
|
// Version ID
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of security rules
|
||||||
type SecurityRules []SecurityRule
|
type SecurityRules []SecurityRule
|
||||||
|
|
||||||
|
// Info about a security rule net object
|
||||||
|
type SecurityRuleNetObject struct {
|
||||||
|
// Display name
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Net address pool ID
|
||||||
|
NetAddressPoolID string `json:"net_address_pool_id"`
|
||||||
|
|
||||||
|
// Net object group ID
|
||||||
|
NetObjectGroupID string `json:"net_object_group_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info about a security rule filter
|
||||||
|
type SecurityRuleFilter struct {
|
||||||
|
// Filters
|
||||||
|
Filters SecurityRuleFilters `json:"filters"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security rule filters
|
||||||
|
type SecurityRuleFilters struct {
|
||||||
|
// Filter all traffic
|
||||||
|
All bool `json:"all"`
|
||||||
|
|
||||||
|
// Filter ARP traffic
|
||||||
|
ARP bool `json:"arp"`
|
||||||
|
|
||||||
|
// Filter DHCP traffic
|
||||||
|
DHCP bool `json:"dhcp"`
|
||||||
|
|
||||||
|
// Custom filter expression
|
||||||
|
Expression string `json:"expression"`
|
||||||
|
|
||||||
|
// Filter ICMP traffic
|
||||||
|
ICMP bool `json:"icmp"`
|
||||||
|
|
||||||
|
// Filter IP traffic
|
||||||
|
IP bool `json:"ip"`
|
||||||
|
|
||||||
|
// Filter IPv4 traffic
|
||||||
|
IPv4 bool `json:"ip_v4"`
|
||||||
|
|
||||||
|
// Filter IPv6 traffic
|
||||||
|
IPv6 bool `json:"ip_v6"`
|
||||||
|
|
||||||
|
// Keep tracking opened sessions
|
||||||
|
KeepOpenedSessions bool `json:"keep_opened_sessions"`
|
||||||
|
|
||||||
|
// Filter Neighbor Discovery traffic
|
||||||
|
ND bool `json:"nd"`
|
||||||
|
|
||||||
|
// Filter TCP traffic
|
||||||
|
TCP bool `json:"tcp"`
|
||||||
|
|
||||||
|
// List of TCP destination ports to filter
|
||||||
|
TCPDstPorts []string `json:"tcp_dst_ports"`
|
||||||
|
|
||||||
|
// Filter UDP traffic
|
||||||
|
UDP bool `json:"udp"`
|
||||||
|
|
||||||
|
// List of UDP destination ports to filter
|
||||||
|
UDPDstPorts []string `json:"udp_dst_ports"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ type UpdateRequest struct {
|
|||||||
// Name of the network object group
|
// Name of the network object group
|
||||||
// Required: true
|
// Required: true
|
||||||
Name string `url:"name" json:"name" validate:"required"`
|
Name string `url:"name" json:"name" validate:"required"`
|
||||||
|
|
||||||
|
// Addresses
|
||||||
|
// Required: false
|
||||||
|
Addresses []NetAddressRequest `url:"addresses,omitempty" json:"addresses,omitempty" validate:"omitempty,dive"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates a network object group
|
// Update updates a network object group
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ type CreateRequest struct {
|
|||||||
// DHCP IPv6
|
// DHCP IPv6
|
||||||
// Required: false
|
// Required: false
|
||||||
DHCPv6 *DHCPv6ConfigRequest `url:"-" json:"dhcp_v6,omitempty"`
|
DHCPv6 *DHCPv6ConfigRequest `url:"-" json:"dhcp_v6,omitempty"`
|
||||||
|
|
||||||
|
// Segment type
|
||||||
|
// Required: false
|
||||||
|
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DHCPv4ConfigRequest struct {
|
type DHCPv4ConfigRequest struct {
|
||||||
|
|||||||
46
pkg/sdn/segments/get_faa.go
Normal file
46
pkg/sdn/segments/get_faa.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package segments
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetFAARequest struct to get the floating/anycast IP address of a segment
|
||||||
|
type GetFAARequest struct {
|
||||||
|
// ID of segment
|
||||||
|
// Required: true
|
||||||
|
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFAA gets the floating/anycast IP address info for a segment
|
||||||
|
func (s Segments) GetFAA(ctx context.Context, req GetFAARequest) (*GetFAAResponse, error) {
|
||||||
|
res, err := s.GetFAARaw(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := GetFAAResponse{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFAARaw gets the floating/anycast IP address info for a segment as an array of bytes
|
||||||
|
func (s Segments) GetFAARaw(ctx context.Context, req GetFAARequest) ([]byte, error) {
|
||||||
|
err := validators.ValidateRequest(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
url := "/sdn/segment/get_faa"
|
||||||
|
|
||||||
|
res, err := s.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package segments
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetStatusRequest struct to get information about segment status
|
|
||||||
type GetStatusRequest struct {
|
|
||||||
// ID of segment
|
|
||||||
// Required: true
|
|
||||||
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
|
|
||||||
|
|
||||||
// ID of version
|
|
||||||
// Required: false
|
|
||||||
VersionID uint64 `url:"version_id,omitempty" json:"version_id,omitempty"`
|
|
||||||
|
|
||||||
// Get detailed status or not
|
|
||||||
// Required: false
|
|
||||||
Detailed interface{} `url:"enabled,omitempty" json:"enabled,omitempty" validate:"omitempty,isBool"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetStatus gets segment status
|
|
||||||
func (s Segments) GetStatus(ctx context.Context, req GetStatusRequest) (string, error) {
|
|
||||||
type temp struct {
|
|
||||||
Status string `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
err := validators.ValidateRequest(req)
|
|
||||||
if err != nil {
|
|
||||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
url := "/sdn/segment/get_status"
|
|
||||||
|
|
||||||
res, err := s.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := temp{}
|
|
||||||
err = json.Unmarshal(res, &info)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return info.Status, nil
|
|
||||||
}
|
|
||||||
@@ -59,6 +59,10 @@ type ListRequest struct {
|
|||||||
// Sort order (asc/desc)
|
// Sort order (asc/desc)
|
||||||
// Required: false
|
// Required: false
|
||||||
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
|
SortOrder string `url:"sort_order,omitempty" json:"sort_order,omitempty"`
|
||||||
|
|
||||||
|
// Filter by operation status
|
||||||
|
// Required: false
|
||||||
|
OperationStatus string `url:"operation_status,omitempty" json:"operation_status,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets list of all available segments as a ListSegment struct
|
// List gets list of all available segments as a ListSegment struct
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type SegmentResponse struct {
|
|||||||
// Created time
|
// Created time
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
// Detailed description of the router port
|
// Detailed description of the segment
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
|
||||||
// DHCP IPv4
|
// DHCP IPv4
|
||||||
@@ -34,6 +34,9 @@ type SegmentResponse struct {
|
|||||||
// ID of segment
|
// ID of segment
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// L2 connection port info
|
||||||
|
L2ConnectionPort *L2ConnectionPort `json:"l2_connection_port,omitempty"`
|
||||||
|
|
||||||
// Logical ports info
|
// Logical ports info
|
||||||
LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`
|
LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`
|
||||||
|
|
||||||
@@ -49,6 +52,9 @@ type SegmentResponse struct {
|
|||||||
// IPv6 subnet in CIDR notation
|
// IPv6 subnet in CIDR notation
|
||||||
SubnetV6 string `json:"subnet_v6"`
|
SubnetV6 string `json:"subnet_v6"`
|
||||||
|
|
||||||
|
// Segment type
|
||||||
|
Type string `json:"type"`
|
||||||
|
|
||||||
// Update time
|
// Update time
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
@@ -111,16 +117,16 @@ type EntityInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Status struct {
|
type Status struct {
|
||||||
// Common
|
// Operation status
|
||||||
Common string `json:"common"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Hypervisors status
|
// Hypervisors status
|
||||||
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HypervisorStatus struct {
|
type HypervisorStatus struct {
|
||||||
// Status
|
// Operation status of the hypervisor
|
||||||
Status string `json:"status"`
|
OperationStatus string `json:"operation_status"`
|
||||||
|
|
||||||
// Name of hypervisor
|
// Name of hypervisor
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -134,3 +140,75 @@ type HypervisorStatus struct {
|
|||||||
// Synced time
|
// Synced time
|
||||||
SyncedAt time.Time `json:"synced_at"`
|
SyncedAt time.Time `json:"synced_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// L2ConnectionPort holds information about the L2 connection port of a segment
|
||||||
|
type L2ConnectionPort struct {
|
||||||
|
// ID of the L2 connection port
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// Access group ID
|
||||||
|
AccessGroupID string `json:"access_group_id"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
|
// L2 external network details
|
||||||
|
L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
// ID of the user who created the port
|
||||||
|
CreatedBy string `json:"created_by"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the port
|
||||||
|
UpdatedBy string `json:"updated_by"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// L2ExternalNetwork holds information about an L2 external network
|
||||||
|
type L2ExternalNetwork struct {
|
||||||
|
// ID of the network
|
||||||
|
ID string `json:"id"`
|
||||||
|
|
||||||
|
// User-friendly name for the network
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
|
||||||
|
// Detailed description of the network
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Bridge network name
|
||||||
|
BridgeNetworkName string `json:"bridge_network_name"`
|
||||||
|
|
||||||
|
// List of hypervisor IDs attached to the network
|
||||||
|
Hypervisors []string `json:"hypervisors"`
|
||||||
|
|
||||||
|
// VLAN tag
|
||||||
|
VLANTag uint64 `json:"vlan_tag"`
|
||||||
|
|
||||||
|
// ID of version
|
||||||
|
VersionID uint64 `json:"version_id"`
|
||||||
|
|
||||||
|
// Created time
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
// ID of the user who created the network
|
||||||
|
CreatedBy string `json:"created_by"`
|
||||||
|
|
||||||
|
// Updated time
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
|
||||||
|
// ID of the user who last updated the network
|
||||||
|
UpdatedBy string `json:"updated_by"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetFAAResponse holds the floating/anycast IP address info for a segment
|
||||||
|
type GetFAAResponse struct {
|
||||||
|
// IPv4 address
|
||||||
|
IPv4Address string `json:"ipv4_address"`
|
||||||
|
|
||||||
|
// IPv6 address
|
||||||
|
IPv6Address string `json:"ipv6_address"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ type UpdateRequest struct {
|
|||||||
// DHCP IPv6
|
// DHCP IPv6
|
||||||
// Required: false
|
// Required: false
|
||||||
DHCPv6 *DHCPv6ConfigRequest `url:"-" json:"dhcp_v6,omitempty"`
|
DHCPv6 *DHCPv6ConfigRequest `url:"-" json:"dhcp_v6,omitempty"`
|
||||||
|
|
||||||
|
// Segment type
|
||||||
|
// Required: false
|
||||||
|
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates segment
|
// Update updates segment
|
||||||
|
|||||||
10
pkg/sdn/version.go
Normal file
10
pkg/sdn/version.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package sdn
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Accessing the SDN method group
|
||||||
|
func (sdn *SDN) Version() *version.Version {
|
||||||
|
return version.New(sdn.client)
|
||||||
|
}
|
||||||
33
pkg/sdn/version/get.go
Normal file
33
pkg/sdn/version/get.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get gets SDN version info as a RecordVersion struct
|
||||||
|
func (v Version) Get(ctx context.Context) (*RecordVersion, error) {
|
||||||
|
res, err := v.GetRaw(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info := RecordVersion{}
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRaw gets SDN version info as an array of bytes
|
||||||
|
func (v Version) GetRaw(ctx context.Context) ([]byte, error) {
|
||||||
|
|
||||||
|
url := "/sdn/version/get"
|
||||||
|
|
||||||
|
res, err := v.client.DecortApiCall(ctx, http.MethodGet, url, nil)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
25
pkg/sdn/version/models.go
Normal file
25
pkg/sdn/version/models.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
// Version info of the SDN platform
|
||||||
|
type RecordVersion struct {
|
||||||
|
// Core component version info
|
||||||
|
Core ComponentVersion `json:"core"`
|
||||||
|
|
||||||
|
// Director component version info
|
||||||
|
Director ComponentVersion `json:"director"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version info of a single component
|
||||||
|
type ComponentVersion struct {
|
||||||
|
// Branch name
|
||||||
|
Branch string `json:"branch"`
|
||||||
|
|
||||||
|
// Build time
|
||||||
|
BuildTime string `json:"build_time"`
|
||||||
|
|
||||||
|
// Commit hash
|
||||||
|
Commit string `json:"commit"`
|
||||||
|
|
||||||
|
// Version string
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
18
pkg/sdn/version/version.go
Normal file
18
pkg/sdn/version/version.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// API Actor API for managing SDN version
|
||||||
|
package version
|
||||||
|
|
||||||
|
import (
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Structure for creating request to version
|
||||||
|
type Version struct {
|
||||||
|
client interfaces.Caller
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder for version endpoints
|
||||||
|
func New(client interfaces.Caller) *Version {
|
||||||
|
return &Version{
|
||||||
|
client,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,17 +26,17 @@ func NewMigrator(cfg *Config, c decortsdk.ClientInterface) Migrator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, stackID uint64) (bool, error) {
|
func (m *migrator) Migrate(ctxOrigin context.Context, dxVMID, nodeID uint64) (bool, error) {
|
||||||
req := compute.MigrateRequest{
|
req := compute.MigrateRequest{
|
||||||
ComputeID: dxVMID,
|
ComputeID: dxVMID,
|
||||||
TargetStackID: stackID,
|
TargetNodeID: nodeID,
|
||||||
Force: false,
|
Force: false,
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
|
ctx, cancel := context.WithTimeout(ctxOrigin, m.cfg.QueryTimeout)
|
||||||
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
|
ok, err := m.client.CloudBroker().Compute().Migrate(ctx, req)
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, stackID))
|
return false, errors.Join(err, fmt.Errorf("Migrate VM %d to Node %d", dxVMID, nodeID))
|
||||||
}
|
}
|
||||||
return ok, nil
|
return ok, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,17 +60,17 @@ func TestMigrator(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
dxVMID := uint64(100500)
|
dxVMID := uint64(100500)
|
||||||
stackID := uint64(100501)
|
nodeID := uint64(100501)
|
||||||
|
|
||||||
// Записываем поведение клиента
|
// Записываем поведение клиента
|
||||||
mockCaller.EXPECT().DecortApiCall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Eq(compute.AsyncWrapperMigrateRequest{
|
mockCaller.EXPECT().DecortApiCall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Eq(compute.AsyncWrapperMigrateRequest{
|
||||||
MigrateRequest: compute.MigrateRequest{
|
MigrateRequest: compute.MigrateRequest{
|
||||||
ComputeID: dxVMID,
|
ComputeID: dxVMID,
|
||||||
TargetStackID: stackID,
|
TargetNodeID: nodeID,
|
||||||
},
|
},
|
||||||
SyncMode: true})).Return(b, nil).AnyTimes()
|
SyncMode: true})).Return(b, nil).AnyTimes()
|
||||||
|
|
||||||
ok, err := migrator.Migrate(context.Background(), dxVMID, stackID)
|
ok, err := migrator.Migrate(context.Background(), dxVMID, nodeID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.True(t, ok)
|
assert.True(t, ok)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import (
|
|||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/acsgroups"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/acsgroups"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/adrspools"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/adrspools"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/defsecpolicies"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/defsecpolicies"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/hypervisors"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/logicalports"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/logicalports"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/routers"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/routers"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/secpolicies"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/secpolicies"
|
||||||
@@ -59,6 +60,7 @@ import (
|
|||||||
extnet_sdn "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/extnet"
|
extnet_sdn "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/extnet"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/flips"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/flips"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/netobjgroups"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/netobjgroups"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestGetListCloudAPI tests platforms responses vs. json tags of golang structures in cloudapi get/list methods
|
// TestGetListCloudAPI tests platforms responses vs. json tags of golang structures in cloudapi get/list methods
|
||||||
@@ -1025,6 +1027,26 @@ func TestGetListSDNAPI(t *testing.T) {
|
|||||||
t.Errorf("Can not test segments get because list is empty")
|
t.Errorf("Can not test segments get because list is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hypervisors
|
||||||
|
// List
|
||||||
|
bytes, err = client.SDN().Hypervisors().ListRaw(context.Background(), hypervisors.ListRequest{})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
getResult("Hypervisors list", bytes, hypervisors.HypervisorsList{}, t)
|
||||||
|
// Get
|
||||||
|
listHypervisors, _ := client.SDN().Hypervisors().List(context.Background(), hypervisors.ListRequest{})
|
||||||
|
if len(listHypervisors) > 0 {
|
||||||
|
id := listHypervisors[0].Name
|
||||||
|
bytes, err = client.SDN().Hypervisors().GetRaw(context.Background(), hypervisors.GetRequest{Name: id})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
getResult("Hypervisors get", bytes, hypervisors.RecordHypervisor{}, t)
|
||||||
|
} else {
|
||||||
|
t.Errorf("Can not test Hypervisors get because listHypervisors list is empty")
|
||||||
|
}
|
||||||
|
|
||||||
// FloatingIPs
|
// FloatingIPs
|
||||||
// List
|
// List
|
||||||
bytes, err = client.SDN().FloatingIPs().ListRaw(context.Background(), flips.ListRequest{})
|
bytes, err = client.SDN().FloatingIPs().ListRaw(context.Background(), flips.ListRequest{})
|
||||||
@@ -1084,6 +1106,13 @@ func TestGetListSDNAPI(t *testing.T) {
|
|||||||
} else {
|
} else {
|
||||||
t.Errorf("Can not test routers get because routerList list is empty")
|
t.Errorf("Can not test routers get because routerList list is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Version
|
||||||
|
bytes, err = client.SDN().Version().GetRaw(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
getResult("Version get", bytes, version.RecordVersion{}, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestRequestsCloudAPI tests platform requests vs. golang request structures in sdk for cloudapi requests
|
// TestRequestsCloudAPI tests platform requests vs. golang request structures in sdk for cloudapi requests
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ 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"
|
||||||
@@ -71,6 +72,7 @@ import (
|
|||||||
|
|
||||||
extnet_sdn "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/extnet"
|
extnet_sdn "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/extnet"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/flips"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/flips"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/hypervisors"
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/netobjgroups"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/netobjgroups"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -748,7 +750,6 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/flipgroup/list": flipgroup_cb.ListRequest{},
|
"/restmachine/cloudbroker/flipgroup/list": flipgroup_cb.ListRequest{},
|
||||||
|
|
||||||
// grid
|
// grid
|
||||||
"/restmachine/cloudbroker/grid/add": grid_cb.AddRequest{},
|
|
||||||
"/restmachine/cloudbroker/grid/addCustomBackupPath": grid_cb.AddCustomBackupPathRequest{},
|
"/restmachine/cloudbroker/grid/addCustomBackupPath": grid_cb.AddCustomBackupPathRequest{},
|
||||||
"/restmachine/cloudbroker/grid/changeSettings": grid_cb.ChangeSettingsRequest{},
|
"/restmachine/cloudbroker/grid/changeSettings": grid_cb.ChangeSettingsRequest{},
|
||||||
"/restmachine/cloudbroker/grid/executeMaintenanceScript": grid_cb.ExecuteMaintenanceScriptRequest{},
|
"/restmachine/cloudbroker/grid/executeMaintenanceScript": grid_cb.ExecuteMaintenanceScriptRequest{},
|
||||||
@@ -795,6 +796,10 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
|||||||
"/restmachine/cloudbroker/image/rename": image_cb.RenameRequest{},
|
"/restmachine/cloudbroker/image/rename": image_cb.RenameRequest{},
|
||||||
"/restmachine/cloudbroker/image/revokeAccess": image_cb.RevokeAccessRequest{},
|
"/restmachine/cloudbroker/image/revokeAccess": image_cb.RevokeAccessRequest{},
|
||||||
"/restmachine/cloudbroker/image/share": image_cb.ShareRequest{},
|
"/restmachine/cloudbroker/image/share": image_cb.ShareRequest{},
|
||||||
|
"/restmachine/cloudbroker/image/create_multi_image": image_cb.CreateMultiImageRequest{},
|
||||||
|
"/restmachine/cloudbroker/image/multi_image_add_links": image_cb.MultiImageAddLinksRequest{},
|
||||||
|
"/restmachine/cloudbroker/image/multi_image_del_links": image_cb.MultiImageDelLinksRequest{},
|
||||||
|
"/restmachine/cloudbroker/image/multi_image_export": image_cb.MultiImageExportRequest{},
|
||||||
|
|
||||||
// k8ci
|
// k8ci
|
||||||
"/restmachine/cloudbroker/k8ci/accessAdd": k8ci_cb.AccessAddRequest{},
|
"/restmachine/cloudbroker/k8ci/accessAdd": k8ci_cb.AccessAddRequest{},
|
||||||
@@ -919,6 +924,15 @@ 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{},
|
||||||
@@ -1154,6 +1168,13 @@ func getRequestsMapSDN() map[string]interface{} {
|
|||||||
"/restmachine/sdn/floating_ip/list": flips.ListRequest{},
|
"/restmachine/sdn/floating_ip/list": flips.ListRequest{},
|
||||||
"/restmachine/sdn/floating_ip/update": flips.UpdateRequest{},
|
"/restmachine/sdn/floating_ip/update": flips.UpdateRequest{},
|
||||||
|
|
||||||
|
// hypervisors
|
||||||
|
"/restmachine/sdn/hypervisor/connect_node": hypervisors.ConnectNodeRequest{},
|
||||||
|
"/restmachine/sdn/hypervisor/delete": hypervisors.DeleteRequest{},
|
||||||
|
"/restmachine/sdn/hypervisor/get": hypervisors.GetRequest{},
|
||||||
|
"/restmachine/sdn/hypervisor/list": hypervisors.ListRequest{},
|
||||||
|
"/restmachine/sdn/hypervisor/update_display_name": hypervisors.UpdateDisplayNameRequest{},
|
||||||
|
|
||||||
// network object groups
|
// network object groups
|
||||||
"/restmachine/sdn/network_object_group/attach_external_network_ports": netobjgroups.AttachExtNetPortsRequest{},
|
"/restmachine/sdn/network_object_group/attach_external_network_ports": netobjgroups.AttachExtNetPortsRequest{},
|
||||||
"/restmachine/sdn/network_object_group/attach_logical_ports": netobjgroups.AttachLogicalPortsRequest{},
|
"/restmachine/sdn/network_object_group/attach_logical_ports": netobjgroups.AttachLogicalPortsRequest{},
|
||||||
@@ -1168,12 +1189,12 @@ func getRequestsMapSDN() map[string]interface{} {
|
|||||||
"/restmachine/sdn/network_object_group/detach_l2_connection_ports": netobjgroups.DetachL2ConnectionPortsRequest{},
|
"/restmachine/sdn/network_object_group/detach_l2_connection_ports": netobjgroups.DetachL2ConnectionPortsRequest{},
|
||||||
|
|
||||||
// segments
|
// segments
|
||||||
"/restmachine/sdn/segment/create": segments.CreateRequest{},
|
"/restmachine/sdn/segment/create": segments.CreateRequest{},
|
||||||
"/restmachine/sdn/segment/delete": segments.DeleteRequest{},
|
"/restmachine/sdn/segment/delete": segments.DeleteRequest{},
|
||||||
"/restmachine/sdn/segment/get": segments.GetRequest{},
|
"/restmachine/sdn/segment/get": segments.GetRequest{},
|
||||||
"/restmachine/sdn/segment/get_status": segments.GetStatusRequest{},
|
"/restmachine/sdn/segment/get_faa": segments.GetFAARequest{},
|
||||||
"/restmachine/sdn/segment/list": segments.ListRequest{},
|
"/restmachine/sdn/segment/list": segments.ListRequest{},
|
||||||
"/restmachine/sdn/segment/update": segments.UpdateRequest{},
|
"/restmachine/sdn/segment/update": segments.UpdateRequest{},
|
||||||
|
|
||||||
// logical ports
|
// logical ports
|
||||||
"/restmachine/sdn/logical_port/create": logicalports.CreateRequest{},
|
"/restmachine/sdn/logical_port/create": logicalports.CreateRequest{},
|
||||||
@@ -1197,5 +1218,8 @@ func getRequestsMapSDN() map[string]interface{} {
|
|||||||
"/restmachine/sdn/router/list": routers.ListRequest{},
|
"/restmachine/sdn/router/list": routers.ListRequest{},
|
||||||
"/restmachine/sdn/router/policies/list": policies.ListRequest{},
|
"/restmachine/sdn/router/policies/list": policies.ListRequest{},
|
||||||
"/restmachine/sdn/router/update": routers.UpdateRequest{},
|
"/restmachine/sdn/router/update": routers.UpdateRequest{},
|
||||||
|
|
||||||
|
// version
|
||||||
|
"/restmachine/sdn/version/get": nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user