Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17017b6d5d | |||
|
|
c701001bb6 |
68
CHANGELOG.md
68
CHANGELOG.md
@@ -1,4 +1,4 @@
|
|||||||
## Version 1.14.1
|
## Version 1.14.3
|
||||||
|
|
||||||
Методы `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,62 +9,62 @@
|
|||||||
|
|
||||||
### Добавлено
|
### Добавлено
|
||||||
|
|
||||||
#### account
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-780 | Вычисляемое поле `DeletedBy` в структуру ответа `ItemAccount` в cloudapi/account |
|
|
||||||
|
|
||||||
#### compute
|
#### compute
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-777 | Структура ответа `RecordCloneAbort` в cloudbroker/compute |
|
| BGOS-805 | Вычисляемое поле `Provision` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
|
||||||
| BGOS-774 | Опциональное поле `Weight` в структуру запроса `UpdateRequest` в cloudbroker/compute |
|
|
||||||
| BGOS-774 | Вычисляемое поле `Weight` в структуры ответа `InfoCompute` и `RecordCompute` в cloudbroker/compute и в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute |
|
|
||||||
|
|
||||||
#### kvmx86
|
#### disks
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-775 | Опциональное поле `Weight` в структуры запроса `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 |
|
| BGOS-806 | Вычисляемое поле `Provision` в структуры ответа `ItemDisk`, `ItemDiskUnattached` и `RecordDisk` в cloudapi/disks и в структуру ответа `InfoDisk` в cloudbroker/disks |
|
||||||
|
|
||||||
|
### node
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-802 | Опциональное поле `Target` в структуру запроса `GetLogicalCoresCountRequest` в cloudbroker/node |
|
||||||
|
|
||||||
#### rg
|
#### rg
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-776 | Вычисляемое поле `Email` в структуры ответа `ItemACL` в cloudapi/rg и в `ACL` в cloudbroker/rg |
|
| BGOS-803 | Опциональное поле `CPUAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/rg |
|
||||||
| BGOS-779 | Опциональные поля `RGID` и `ComputeID` в структуру запроса `ListRequest` в cloudapi/rg и в cloudbroker/rg |
|
|
||||||
|
|
||||||
#### stpolicy
|
#### SDN Logical Ports
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-784 | Вычисляемое поле `Usage` в структуру ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy |
|
| BGOS-695 | Опциональное поле `Labels` в структуры запроса `CreateRequest` и `UpdateRequest` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Вычисляемое поле `Labels` в структуру ответа `LogicalPort` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Опциональные поля `OperationStatus` и `HypervisorStatus` в структуру запроса `ListRequest` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Вычисляемые поля `OperationStatus` и `HypervisorStatus` в структуре `Status` в структуру ответа `LogicalPort` в sdn/logical_ports |
|
||||||
|
|
||||||
### Изменено
|
### Изменено
|
||||||
|
|
||||||
#### compute
|
#### compute
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-777 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `[]RecordCloneAbort` в cloudbroker/compute |
|
| BGOS-794 | Тип возвращаемого значения метода `AbortSharedSnapshotMerge` с `bool` на `string` в cloudapi/compute и в cloudbroker/compute |
|
||||||
|
|
||||||
### Удалено
|
|
||||||
|
|
||||||
#### compute
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-781 | Опциональное поле `DiskType` из структур `DiskAddRequest` и `DiskAttachRequest` в cloudapi/compute и в cloudbroker/compute |
|
|
||||||
| BGOS-785 | Вычисляемое поле `Type` из структур `ItemDisk`, `RecordDisk` и `ItemDiskUnattached` в cloudapi/compute и из структуры `InfoDisk` в cloudbroker/compute |
|
|
||||||
|
|
||||||
#### disks
|
|
||||||
| Идентификатор<br>задачи | Описание |
|
|
||||||
| --- | --- |
|
|
||||||
| BGOS-781 | Структура запросов `ListTypesRequest`, структура ответов `ListTypes`, метод `ListTypes` в cloudapi/disks и в cloudbroker/disks |
|
|
||||||
| BGOS-781 | Опциональное поле `Type` из структур `ListRequest`, `ListDeletedRequest` и `ListUnattachedRequest` в cloudapi/disks и в cloudbroker/disks |
|
|
||||||
|
|
||||||
#### kvmx86
|
#### kvmx86
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-773 | Опциональные поля `IS` и `IPAType` из структур запроса `CreateRequest` в cloudapi/kvmx86 и в cloudbroker/kvmx86 |
|
| BGOS-808 | Минимальное значение поля `MTU` в структуре `Interface` в cloudapi/kvmx86 и cloudbroker/kvmx86 и в структуре `InterfaceMassCreate` в cloudbroker/kvmx86 с 1 на 1500 |
|
||||||
|
|
||||||
#### stpolicy
|
#### zone
|
||||||
| Идентификатор<br>задачи | Описание |
|
| Идентификатор<br>задачи | Описание |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| BGOS-784 | Вычисляемое поле `StoragePolicyID` из структуры ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy |
|
| BGOS-807 | JSON-тег у вычисляемого поля `LBIDs` в структуре ответа `RecordZone` с `lbIds` на `lbsIds` в cloudapi/zone |
|
||||||
|
|
||||||
|
#### SDN Logical Ports
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-695 | Имя вычисляемого поля со `Status` на `OperationStatus` в sdn/logical_ports |
|
||||||
|
|
||||||
|
### Удалено
|
||||||
|
|
||||||
|
#### SDN Logical Ports
|
||||||
|
| Идентификатор<br>задачи | Описание |
|
||||||
|
| --- | --- |
|
||||||
|
| BGOS-695 | Обязательное поле `IsExcludedFromFirewall` в структурах запроса `CreateRequest` и `UpdateRequest` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Вычисляемое поле `IsExcludedFromFirewall` в структуре `Bindings` в структуре ответа `LogicalPort` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Вычисляемое поле `Common` в структуре `Status` в структуре ответа `LogicalPort` в sdn/logical_ports |
|
||||||
|
| BGOS-695 | Структуры запроса `ExcludeFirewallRequest`, `UnexcludeFirewallRequest`, `CreateBatchRequest` и `DeleteBatchRequest` и методы `ExcludeFirewall`, `UnexcludeFirewall`, `CreateBatch` и `DeleteBatch` в sdn/logical_ports |
|
||||||
@@ -83,7 +83,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
mtuMin = 1
|
mtuMin = 1500
|
||||||
mtuMax = 9216
|
mtuMax = 9216
|
||||||
|
|
||||||
trunkTagsMin = 1
|
trunkTagsMin = 1
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ type ItemAccount struct {
|
|||||||
// Status
|
// Status
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Updated by
|
||||||
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
// Updated time
|
// Updated time
|
||||||
UpdatedTime uint64 `json:"updatedTime"`
|
UpdatedTime uint64 `json:"updatedTime"`
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package compute
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"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"
|
||||||
@@ -17,22 +17,24 @@ type CloneAbortRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CloneAbort aborts a compute clone
|
// CloneAbort aborts a compute clone
|
||||||
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) {
|
func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (ListCloneAbort, 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 := "/cloudapi/compute/clone_abort"
|
url := "/cloudapi/compute/clone_abort"
|
||||||
|
|
||||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := strconv.ParseBool(string(res))
|
var result ListCloneAbort
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
|
|||||||
@@ -843,6 +843,9 @@ type ItemComputeDisk struct {
|
|||||||
// Image ID
|
// Image ID
|
||||||
ImageID uint64 `json:"imageId"`
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// List image IDs
|
// List image IDs
|
||||||
Images []uint64 `json:"images"`
|
Images []uint64 `json:"images"`
|
||||||
|
|
||||||
@@ -879,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"`
|
||||||
|
|
||||||
@@ -1382,6 +1388,21 @@ type RecordCloneStatus struct {
|
|||||||
Status CloneStatus `json:"status"`
|
Status CloneStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Information about aborted clone disk
|
||||||
|
type RecordCloneAbort struct {
|
||||||
|
// Disk ID
|
||||||
|
DiskID uint64 `json:"disk_id"`
|
||||||
|
|
||||||
|
// Aborted
|
||||||
|
Aborted bool `json:"aborted"`
|
||||||
|
|
||||||
|
// Blockcopy abort job ID
|
||||||
|
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of aborted clone disks
|
||||||
|
type ListCloneAbort []RecordCloneAbort
|
||||||
|
|
||||||
type CloneStatus struct {
|
type CloneStatus struct {
|
||||||
// Type
|
// Type
|
||||||
Type int `json:"type"`
|
Type int `json:"type"`
|
||||||
|
|||||||
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
||||||
|
|
||||||
// Used only for EXTNET and DPDK
|
// Used for EXTNET, TRUNK and DPDK
|
||||||
// For DPDK must be 1-9216
|
// Must be 1500-9216
|
||||||
// For EXTNET 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"`
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,6 @@ var unattachedDisks = ListDisksUnattached{
|
|||||||
Snapshots: nil,
|
Snapshots: nil,
|
||||||
Status: "CREATED",
|
Status: "CREATED",
|
||||||
TechStatus: techStatusAllocated,
|
TechStatus: techStatusAllocated,
|
||||||
Type: "D",
|
|
||||||
VMID: 0,
|
VMID: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -457,7 +456,6 @@ var unattachedDisks = ListDisksUnattached{
|
|||||||
Snapshots: nil,
|
Snapshots: nil,
|
||||||
Status: "CREATED",
|
Status: "CREATED",
|
||||||
TechStatus: techStatusAllocated,
|
TechStatus: techStatusAllocated,
|
||||||
Type: "B",
|
|
||||||
VMID: 0,
|
VMID: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ type ItemDisk struct {
|
|||||||
// Image ID
|
// Image ID
|
||||||
ImageID uint64 `json:"imageId"`
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// List of image IDs
|
// List of image IDs
|
||||||
Images []uint64 `json:"images"`
|
Images []uint64 `json:"images"`
|
||||||
|
|
||||||
@@ -86,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"`
|
||||||
|
|
||||||
@@ -238,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"`
|
||||||
|
|
||||||
@@ -280,6 +289,12 @@ type ItemDiskUnattached struct {
|
|||||||
// Tech status
|
// Tech status
|
||||||
TechStatus string `json:"techStatus"`
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// Need to clean before destroy
|
||||||
|
ToClean bool `json:"to_clean"`
|
||||||
|
|
||||||
|
// ID of the Storage Policy
|
||||||
|
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||||
|
|
||||||
// Virtual machine ID
|
// Virtual machine ID
|
||||||
VMID uint64 `json:"vmid"`
|
VMID uint64 `json:"vmid"`
|
||||||
}
|
}
|
||||||
@@ -423,6 +438,9 @@ type RecordDisk struct {
|
|||||||
// Image ID
|
// Image ID
|
||||||
ImageID uint64 `json:"imageId"`
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// List of image IDs
|
// List of image IDs
|
||||||
Images []uint64 `json:"images"`
|
Images []uint64 `json:"images"`
|
||||||
|
|
||||||
@@ -459,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"`
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ type RecordImage struct {
|
|||||||
// ID
|
// ID
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// Last modified
|
// Last modified
|
||||||
LastModified uint64 `json:"lastModified"`
|
LastModified uint64 `json:"lastModified"`
|
||||||
|
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ type UpdateRequest struct {
|
|||||||
// Default zone ID
|
// Default zone ID
|
||||||
// Required: false
|
// Required: false
|
||||||
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
|
DefaultZoneID uint64 `url:"defaultZoneId,omitempty" json:"defaultZoneId,omitempty"`
|
||||||
|
|
||||||
|
// CPU allocation parameter
|
||||||
|
// Required: false
|
||||||
|
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an account name and resource types and limits
|
// Update updates an account name and resource types and limits
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -442,6 +442,9 @@ type ItemDisk struct {
|
|||||||
// Image ID
|
// Image ID
|
||||||
ImageID uint64 `json:"imageId"`
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// List image IDs
|
// List image IDs
|
||||||
Images []uint64 `json:"images"`
|
Images []uint64 `json:"images"`
|
||||||
|
|
||||||
@@ -478,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"`
|
||||||
|
|
||||||
@@ -1479,8 +1485,11 @@ type RecordCloneAbort struct {
|
|||||||
// Disk ID
|
// Disk ID
|
||||||
DiskID uint64 `json:"disk_id"`
|
DiskID uint64 `json:"disk_id"`
|
||||||
|
|
||||||
// Abort status
|
// Aborted
|
||||||
Status bool `json:"status"`
|
Aborted bool `json:"aborted"`
|
||||||
|
|
||||||
|
// Blockcopy abort job ID
|
||||||
|
BlockcopyAbortJobID string `json:"blockcopy_abort_job_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RecordCloneStatus struct {
|
type RecordCloneStatus struct {
|
||||||
|
|||||||
@@ -39,9 +39,8 @@ type NetAttachRequest struct {
|
|||||||
// Required: false
|
// Required: false
|
||||||
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
MACAddr string `url:"mac_addr,omitempty" json:"mac_addr,omitempty"`
|
||||||
|
|
||||||
// Used only for EXTNET and DPDK
|
// Used for EXTNET, TRUNK and DPDK
|
||||||
// For DPDK must be 1-9216
|
// Must be 1500-9216
|
||||||
// For EXTNET 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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
@@ -242,6 +245,9 @@ type RecordDisk struct {
|
|||||||
// Main information about disk
|
// Main information about disk
|
||||||
InfoDisk
|
InfoDisk
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
//Updated by
|
//Updated by
|
||||||
UpdatedBy string `json:"updatedBy"`
|
UpdatedBy string `json:"updatedBy"`
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ type RecordImage struct {
|
|||||||
// ID
|
// ID
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// Last modified
|
// Last modified
|
||||||
LastModified uint64 `json:"lastModified"`
|
LastModified uint64 `json:"lastModified"`
|
||||||
|
|
||||||
@@ -185,6 +188,9 @@ type ItemImage struct {
|
|||||||
// ID
|
// ID
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Independent
|
||||||
|
Independent bool `json:"independent"`
|
||||||
|
|
||||||
// Last modified
|
// Last modified
|
||||||
LastModified uint64 `json:"lastModified"`
|
LastModified uint64 `json:"lastModified"`
|
||||||
|
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
@@ -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"`
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ type EnableRequest struct {
|
|||||||
Message string `url:"message,omitempty" json:"message,omitempty"`
|
Message string `url:"message,omitempty" json:"message,omitempty"`
|
||||||
|
|
||||||
// Do not check locks, iscsi-sessions or disk-present
|
// Do not check locks, iscsi-sessions or disk-present
|
||||||
// Default: true
|
// Default: false
|
||||||
// Required: false
|
// Required: false
|
||||||
Force interface{} `url:"force" json:"force" validate:"isBool" `
|
Force interface{} `url:"force" json:"force" validate:"isBool"`
|
||||||
|
|
||||||
// Reason
|
// Reason
|
||||||
// Required: false
|
// Required: false
|
||||||
@@ -41,7 +41,7 @@ func (n Node) Enable(ctx context.Context, req EnableRequest) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if req.Force == nil {
|
if req.Force == nil {
|
||||||
req.Force = true
|
req.Force = false
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped := wrapperEnableRequest{
|
reqWrapped := wrapperEnableRequest{
|
||||||
@@ -67,7 +67,7 @@ func (n Node) EnableAsync(ctx context.Context, req EnableRequest) (string, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if req.Force == nil {
|
if req.Force == nil {
|
||||||
req.Force = true
|
req.Force = false
|
||||||
}
|
}
|
||||||
|
|
||||||
reqWrapped := wrapperEnableRequest{
|
reqWrapped := wrapperEnableRequest{
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user