This commit is contained in:
asteam
2025-09-27 01:06:15 +03:00
parent 1ccc37a104
commit cf584c8123
1175 changed files with 11022 additions and 1832 deletions

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// AccessAddRequest struct to grant access

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// AccessRemoveRequest struct to remove access

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// AddReserveIPRequest struct to reserved address or address poll

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
type Route struct {
@@ -47,6 +47,11 @@ type CreateRequest struct {
// Required: false
DNS []string `url:"dns,omitempty" json:"dns,omitempty"`
// Maximum transmission unit
// Default: 1500
// Required: false
MTU uint `url:"mtu,omitempty" json:"mtu,omitempty"`
// List of NTP addresses
// Required: false
NTP []string `url:"ntp,omitempty" json:"ntp,omitempty"`
@@ -71,9 +76,13 @@ type CreateRequest struct {
// Required: false
EndIP string `url:"endIP,omitempty" json:"endIP,omitempty"`
// IP to create VNFDev with
// IP to create primary vnfdev with
// Required: false
VNFDevIP string `url:"vnfdevIP,omitempty" json:"vnfdevIP,omitempty"`
PriVNFDevIP string `url:"priVnfdevIP,omitempty" json:"priVnfdevIP,omitempty"`
// IP to create secondary vnfdev with
// Required: false
SecVNFDevIP string `url:"secVnfdevIP,omitempty" json:"secVnfdevIP,omitempty"`
// Number of pre created reservations
// Required: false
@@ -86,6 +95,15 @@ type CreateRequest struct {
// List of static routes, each item must have destination, netmask, and gateway fields
// Required: false
Routes []Route `url:"-" json:"routes,omitempty" validate:"omitempty,dive"`
// Zone ID
// Required: false
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
// High Availability mode is enabled, default False
// Required: false
// Default: false
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
}
type wrapperCreateRequest struct {

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DefaultQOSUpdateRequest struct for update QOS

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DelReserveIPRequest struct to delete reserved address or address poll

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DestroyRequest struct for destroy

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeviceDeployRequest struct to deploy network device

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeviceMigrateRequest struct for migrate VNF
@@ -17,6 +17,11 @@ type DeviceMigrateRequest struct {
// Target stack ID to migrate to
// Required: false
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
// Target device to migrate
// Required: false
// Default: primary
Device string `url:"device,omitempty" json:"device,omitempty" validate:"omitempty,device"`
}
// DeviceMigrate migrates external network VNF device

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeviceRemoveRequest struct to remove network device

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeviceRestartRequest struct for restart VNF device

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DisableRequest struct to disable external network

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DNSApplyRequest struct to set new DNS

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// EnableRequest struct to enable external network

View File

@@ -1,7 +1,7 @@
// API Actor for configure and use external networks
package extnet
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/interfaces"
// Structure for creating request to extnet
type ExtNet struct {

View File

@@ -18,7 +18,7 @@ var extnets = ListExtNet{
IPCIDR: "176.118.164.0/24",
Milestones: 1355466,
Name: "176.118.164.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,
@@ -41,7 +41,7 @@ var extnets = ListExtNet{
IPCIDR: "45.134.255.0/24",
Milestones: 2135543,
Name: "45.134.255.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,
@@ -64,7 +64,7 @@ var extnets = ListExtNet{
IPCIDR: "88.218.249.0/24",
Milestones: 1232134,
Name: "88.218.249.0/24",
NetworkID: 0,
NetworkIDs: NetworkIDs{Primary: 10, Secondary: 0},
OVSBridge: "",
PreReservationsNum: 0,
PriVNFDevID: 0,

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetRequest struct to get information about external network

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetRequest struct to get information about reserved address or address poll

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// IPsExcludeRequest struct to exclude list of IPs

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// IPsExcludeRangeRequest struct to exclude range of IPs

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// IPsIncludeRequest struct to include list of IPs

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// IPsIncludeRangeRequest struct to include range of IPs

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ListRequest struct to get list of external network
@@ -42,6 +42,11 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Sort by zone id
// Default value: 0
// Required: false
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -0,0 +1,42 @@
package extnet
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// MigrateToZone struct to move extnet to another zone
type MigrateToZoneRequest struct {
// ID of external network
// Required: true
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
// ID of the zone to move
// Required: true
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
}
// MoveToZone moves extnet to new zone
func (e ExtNet) MigrateToZone(ctx context.Context, req MigrateToZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/migrateToZone"
res, err := e.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

@@ -58,6 +58,9 @@ type ItemExtNet struct {
// CKey
CKey string `json:"_ckey"`
// Enable Security Groups
EnableSecGroups bool `json:"enable_secgroups"`
// Meta
Meta []interface{} `json:"_meta"`
@@ -91,11 +94,14 @@ type ItemExtNet struct {
// Milestones
Milestones uint64 `json:"milestones"`
// MTU
MTU uint64 `json:"mtu"`
// Name
Name string `json:"name"`
// Network ID
NetworkID uint64 `json:"networkId"`
// Network IDs
NetworkIDs NetworkIDs `json:"networkIds"`
// OVSBridge
OVSBridge string `json:"ovsBridge"`
@@ -106,6 +112,12 @@ type ItemExtNet struct {
// PriVNFDevID
PriVNFDevID uint64 `json:"priVnfDevId"`
// Redundant
Redundant bool `json:"redundant"`
// SecVnfDevId
SecVNFDevID uint64 `json:"secVnfDevId"`
// List of shared with
SharedWith []interface{} `json:"sharedWith"`
@@ -117,6 +129,9 @@ type ItemExtNet struct {
// VNFs
VNFs VNFs `json:"vnfs"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
// List external networks
@@ -154,6 +169,9 @@ type RecordExtNet struct {
// List excludes
Excluded ListReservations `json:"excluded"`
// Enable Security Groups
EnableSecGroups bool `json:"enable_secgroups"`
// Free IPs number
FreeIPs int64 `json:"free_ips"`
@@ -175,14 +193,17 @@ type RecordExtNet struct {
// Milestones
Milestones uint64 `json:"milestones"`
// MTU
MTU uint64 `json:"mtu"`
// Name
Name string `json:"name"`
// Network
Network string `json:"network"`
// Network ID
NetworkID uint64 `json:"networkId"`
// Network IDs
NetworkIDs NetworkIDs `json:"networkIds"`
// NTP
NTP []string `json:"ntp"`
@@ -199,9 +220,18 @@ type RecordExtNet struct {
// PriVNFDevID
PriVNFDevID uint64 `json:"priVnfDevId"`
// Redundant
Redundant bool `json:"redundant"`
// SecVnfDevId
SecVNFDevID uint64 `json:"secVnfDevId"`
// List reservations
Reservations ListReservations `json:"reservations"`
// List pre-reservations
PreReservations ListReservations `json:"pre-reservations"`
// List of shared with
SharedWith []interface{} `json:"sharedWith"`
@@ -213,6 +243,17 @@ type RecordExtNet struct {
// VNFs
VNFs VNFs `json:"vnfs"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
type NetworkIDs struct {
// Primary
Primary uint64 `json:"primary"`
// Secondary
Secondary uint64 `json:"secondary"`
}
// List of static routes

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// NTPApplyRequest struct for set new NTP

View File

@@ -3,7 +3,7 @@ package extnet
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetDefaultRequest struct to set external network as default

View File

@@ -0,0 +1,42 @@
package extnet
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetHAModeRequest struct to set HA mode for external network
type SetHAModeRequest struct {
// ID of external network
// Required: true
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
// HA Mode
// Required: true
HAMode bool `url:"highly_available" json:"highly_available" validate:"required"`
}
// SetHAMode set HA mode for external network
func (e ExtNet) SetHAMode(ctx context.Context, req SetHAModeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/set_highly_available"
res, err := e.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

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// StaticRouteAccessGrantRequest struct to grant access to static route to Compute/ViNS

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// StaticRouteAccessRevokeRequest struct to revoke access to static route to Compute/ViNS

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// StaticRouteAddRequest struct to add static route

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// StaticRouteDelRequest struct to remove static route from ViNS

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// StaticRouteListRequest struct for static route list

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UpdateRequest struct to update external network
@@ -21,6 +21,15 @@ type UpdateRequest struct {
// New external network description
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
// Maximum transmission unit
// Default: 1500
// Required: false
MTU uint64 `url:"mtu,omitempty" json:"mtu,omitempty"`
// Flag indicating whether security groups are enabled for this network
// Required: false
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
}
// Update updates external network parameters