Compare commits

...

2 Commits

Author SHA1 Message Date
dayterr
444a33dc7e v1.14.4
v1.14.4
2026-03-20 17:14:16 +03:00
17017b6d5d v1.14.3 2026-03-13 17:03:28 +03:00
30 changed files with 605 additions and 78 deletions

View File

@@ -1,4 +1,4 @@
## Version 1.14.2
## Version 1.14.4
Методы `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 и в следующих версиях будут удалены
@@ -9,29 +9,17 @@
### Добавлено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-796 | Опциональное поле `CpuAllocationParameter` в структуру запроса `UpdateRequest` в cloudbroker/account |
| BGOS-790 | Вычисляемое поле `UpdatedBy` в структуру ответа `ItemAccount` в cloudapi/account |
#### compute
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-793 | Вычисляемые поля `Aborted` и `BlockcopyAbortJobID` в структуру ответа `RecordCloneAbort` в cloudbroker/compute |
| BGOS-792 | Структуры ответа `RecordCloneAbort` и `ListCloneAbort` в cloudapi/compute |
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `ItemComputeDisk` в cloudapi/compute и в структуру ответа `ItemDisk` в cloudbroker/compute |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-791 | Вычисляемое поле `Independent` в структуры ответа `ItemDisk` и `RecordDisk` в cloudapi/disks и в структуру ответа `RecordDisk` в cloudbroker/disks |
| BGOS-797 | Вычисляемые поля `ToClean` и `StoragePolicyID` в структуру ответа `ItemDiskUnattached` в cloudapi/disks |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-791 | Вычисляемое поле `Independent` в структуру ответа `RecordImage` в cloudapi/image и в структуры ответа `RecordImage` и `ItemImage` в cloudbroker/image |
| BGOS-812 | Методы `CreateMultiImage`, `MultiImageAddLinks`, `MultiImageDelLinks` и `MultiImageExport` в cloudbroker/image |
| BGOS-812 | Структуры запросов `CreateMultiImageRequest`, `MultiImageAddLinksRequest`, `MultiImageDelLinksRequest` и `MultiImageExportRequest` в cloudbroker/image |
| BGOS-813 | Вычисляемое поле `LinksTo` в структуры ответа `RecordImage` и `ItemImage` в cloudbroker/image и в структуру ответа `RecordImage` в cloudapi/image |
### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-811 | Вычисляемое поле `ThreadCount` в структуру ответа `CpuInfo` в cloudbroker/node |
### Изменено
@@ -39,17 +27,9 @@
#### compute
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-799 | Минимальное значение поля `MTU` в структуре запроса `NetAttachRequest` в cloudapi/compute и cloudbroker/compute с 1 на 1500 |
| BGOS-792 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `ListCloneAbort` в cloudapi/compute |
| BGOS-814 | Тип возвращаемого значения метода `CheckComputePlacement` с `map[string]CheckComputePlacementItem` на `map[uint64]CheckComputePlacementItem` в cloudbroker/compute |
#### node
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-789 | Дефолтное значение поля `Force` в структуре запроса `EnableRequest` в cloudbroker/node с `true` на `false` |
### Удалено
#### compute
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BGOS-793 | Вычисляемое поле `Status` из структуры ответа `RecordCloneAbort` в cloudbroker/compute |
| BGOS-815 | JSON-тэг у поля `RGID` в структуре ответа `ItemResourceConsumption` с `rgid` на `id` в cloudbroker/rg |

View File

@@ -3,7 +3,6 @@ package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -20,23 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
}
// 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)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/compute/abort_shared_snapshot_merge"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
return "", err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
return string(res), nil
}

View File

@@ -882,6 +882,9 @@ type ItemComputeDisk struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time
PurgeTime uint64 `json:"purgeTime"`

View File

@@ -89,6 +89,9 @@ type ItemDisk struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time
PurgeTime uint64 `json:"purgeTime"`
@@ -241,6 +244,9 @@ type ItemDiskUnattached struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"`
@@ -471,6 +477,9 @@ type RecordDisk struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge time
PurgeTime uint64 `json:"purgeTime"`

View File

@@ -149,6 +149,9 @@ type RecordImage struct {
// Link to
LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones
Milestones uint64 `json:"milestones"`

View File

@@ -30,8 +30,8 @@ type Interface struct {
// Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216
// Used only to DPDK net type
// Used for EXTNET, TRUNK and DPDK
// Must be 1500-9216
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`

View File

@@ -47,7 +47,7 @@ type RecordZone struct {
K8SIDs []uint64 `json:"k8sIds"`
// List of associated LB IDs
LBIDs []uint64 `json:"lbIds"`
LBIDs []uint64 `json:"lbsIds"`
// Status
Status string `json:"status"`

View File

@@ -3,7 +3,6 @@ package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -20,23 +19,18 @@ type AbortSharedSnapshotMergeRequest struct {
}
// 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)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
return "", err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
return string(res), nil
}

View File

@@ -481,6 +481,9 @@ type ItemDisk struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"`
@@ -1532,4 +1535,4 @@ type CheckComputePlacementItem struct {
Error CheckComputePlacementError `json:"error,omitempty"`
}
type CheckComputePlacementResult map[string]CheckComputePlacementItem
type CheckComputePlacementResult map[uint64]CheckComputePlacementItem

View File

@@ -131,6 +131,9 @@ type InfoDisk struct {
// Present to
PresentTo map[string]uint64 `json:"presentTo"`
// Provision
Provision string `json:"provision"`
// Purge attempts
PurgeAttempts uint64 `json:"purgeAttempts"`

View 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
}

View File

@@ -62,6 +62,9 @@ type RecordImage struct {
// Link to
LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones
Milestones uint64 `json:"milestones"`
@@ -197,6 +200,9 @@ type ItemImage struct {
// Link to
LinkTo uint64 `json:"linkTo"`
// Links to
LinksTo []uint64 `json:"linksTo"`
// Milestones
Milestones uint64 `json:"milestones"`

View 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
}

View 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
}

View File

@@ -0,0 +1,42 @@
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"`
}
// 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
}

View File

@@ -28,8 +28,8 @@ type Interface struct {
// Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216
// Used only to DPDK net type
// Used for EXTNET, TRUNK and DPDK
// Must be 1500-9216
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`

View File

@@ -27,8 +27,8 @@ type InterfaceMassCreate struct {
// Required: false
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
// Maximum transmission unit, must be 1-9216
// Used only to DPDK net type
// Used for EXTNET, TRUNK and DPDK
// Must be 1500-9216
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty" validate:"omitempty,mtu"`

View File

@@ -13,6 +13,10 @@ type GetLogicalCoresCountRequest struct {
// Node ID
// Required: true
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
@@ -24,7 +28,7 @@ func (i Node) GetLogicalCoresCount(ctx context.Context, req GetLogicalCoresCount
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 {
return 0, err
}

View File

@@ -155,6 +155,9 @@ type CpuInfo struct {
// PhysCount
PhysCount uint64 `json:"physCount"`
// Thread count
ThreadCount uint64 `json:"threadCount"`
// Flags
Flags []string `json:"flags"`

View File

@@ -66,7 +66,7 @@ type ItemResourceConsumption struct {
ResourceLimits ResourceLimits `json:"resourceLimits"`
// Resource group ID
RGID uint64 `json:"rgid"`
RGID uint64 `json:"id"`
}
type ListResourceConsumption struct {

View File

@@ -51,6 +51,10 @@ type UpdateRequest struct {
// Storage policies
// Required: false
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

View File

@@ -9,6 +9,12 @@ import (
"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
type CreateRequest struct {
// ID of the access group
@@ -27,10 +33,6 @@ type CreateRequest struct {
// Required: true
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
// Required: true
Hypervisor string `url:"hypervisor" json:"hypervisor" validate:"required"`
@@ -54,6 +56,10 @@ type CreateRequest struct {
// Logical port addresses
// Required: false
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

View 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
}

View 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
}

View 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
}

View File

@@ -70,6 +70,14 @@ type ListRequest struct {
// Required: false
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
// Required: false
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"`
}
// List of logical portts
// List of logical ports
func (i LogicalPorts) List(ctx context.Context, req ListRequest) (*LogicalPortsList, error) {
res, err := i.ListRaw(ctx, req)
if err != nil {

View File

@@ -43,6 +43,9 @@ type LogicalPort struct {
// Hypervisor display name
HypervisorDisplayName string `json:"hypervisor_display_name"`
// Labels
Labels Labels `json:"labels"`
// Live migration target hypervisor
LiveMigrationTargetHV string `json:"live_migration_target_hv"`
@@ -64,17 +67,21 @@ type LogicalPort struct {
// Status information
type Status struct {
// Common status
Common string `json:"common"`
// Operation status
OperationStatus string `json:"operation_status"`
// Hypervisors status
Hypervisors []HypervisorStatus `json:"hypervisors"`
// Hypervisor status
HypervisorStatus string `json:"hypervisor_status"`
}
// HypervisorStatus information
type HypervisorStatus struct {
// Status
Status string `json:"status"`
// Operation status
OperationStatus string `json:"operation_status"`
// Name
Name string `json:"name"`
@@ -106,9 +113,6 @@ type Bindings struct {
// Address detection
AddressDetection bool `json:"address_detection"`
// Is excluded from firewall
IsExcludedFromFirewall bool `json:"is_excluded_from_firewall"`
// Version ID
VersionID uint64 `json:"version_id"`
@@ -149,6 +153,7 @@ type LogicalPortAddress struct {
AssignedAt string `json:"assigned_at"`
}
// Migration status information
type MigrationStatus struct {
// ID
ID string `json:"id"`
@@ -156,3 +161,18 @@ type MigrationStatus struct {
// 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"`
}

View 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
}

View File

@@ -9,6 +9,12 @@ import (
"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
type UpdateRequest struct {
// ID of the logical port
@@ -47,10 +53,6 @@ type UpdateRequest struct {
// Required: true
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
// Required: true
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
@@ -62,6 +64,10 @@ type UpdateRequest struct {
// Add addresses
// Required: false
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

View File

@@ -795,6 +795,10 @@ func getRequestsMapCloudbroker() map[string]interface{} {
"/restmachine/cloudbroker/image/rename": image_cb.RenameRequest{},
"/restmachine/cloudbroker/image/revokeAccess": image_cb.RevokeAccessRequest{},
"/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
"/restmachine/cloudbroker/k8ci/accessAdd": k8ci_cb.AccessAddRequest{},