2025-11-14 17:38:59 +03:00
|
|
|
package segments
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
// List segments
|
|
|
|
|
type ListSegment []SegmentResponse
|
|
|
|
|
|
|
|
|
|
// Main information about network segment
|
|
|
|
|
type SegmentResponse struct {
|
|
|
|
|
// Access group ID
|
|
|
|
|
AccessGroupID string `json:"access_group_id"`
|
|
|
|
|
|
|
|
|
|
// Access group name
|
|
|
|
|
AccessGroupName string `json:"access_group_name"`
|
|
|
|
|
|
|
|
|
|
// Created time
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
|
2026-04-17 17:04:11 +03:00
|
|
|
// Detailed description of the segment
|
2025-11-14 17:38:59 +03:00
|
|
|
Description string `json:"description"`
|
|
|
|
|
|
|
|
|
|
// DHCP IPv4
|
|
|
|
|
DHCPv4 DHCPv4Config `json:"dhcp_v4"`
|
|
|
|
|
|
|
|
|
|
// DHCP IPv6
|
|
|
|
|
DHCPv6 DHCPv6Config `json:"dhcp_v6"`
|
|
|
|
|
|
|
|
|
|
// User-friendly name for the segment
|
|
|
|
|
DisplayName string `json:"display_name"`
|
|
|
|
|
|
|
|
|
|
// Whether the segment is enabled
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
|
|
|
|
|
// ID of segment
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
2026-04-17 17:04:11 +03:00
|
|
|
// L2 connection port info
|
|
|
|
|
L2ConnectionPort *L2ConnectionPort `json:"l2_connection_port,omitempty"`
|
|
|
|
|
|
2025-11-14 17:38:59 +03:00
|
|
|
// Logical ports info
|
|
|
|
|
LogicalPortsInfo []EntityInfo `json:"logical_ports_info"`
|
|
|
|
|
|
|
|
|
|
// Routers info
|
|
|
|
|
RoutersInfo []EntityInfo `json:"routers_info"`
|
|
|
|
|
|
|
|
|
|
// Status
|
|
|
|
|
Status Status `json:"status"`
|
|
|
|
|
|
|
|
|
|
// IPv4 subnet in CIDR notation
|
|
|
|
|
SubnetV4 string `json:"subnet_v4"`
|
|
|
|
|
|
|
|
|
|
// IPv6 subnet in CIDR notation
|
|
|
|
|
SubnetV6 string `json:"subnet_v6"`
|
|
|
|
|
|
2026-04-17 17:04:11 +03:00
|
|
|
// Segment type
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
|
2025-11-14 17:38:59 +03:00
|
|
|
// Update time
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
|
|
|
|
|
// ID of version
|
|
|
|
|
VersionID uint64 `json:"version_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DHCPv4Config struct {
|
|
|
|
|
// DNS
|
|
|
|
|
DNS []string `json:"dns"`
|
|
|
|
|
|
|
|
|
|
// Excluded address ranges
|
|
|
|
|
ExcludedAddressRanges []string `json:"excluded_address_ranges"`
|
|
|
|
|
|
|
|
|
|
// Gateway
|
|
|
|
|
Gateway string `json:"gateway"`
|
|
|
|
|
|
|
|
|
|
// ID of config
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
|
|
|
|
// Lease time
|
|
|
|
|
LeaseTime uint64 `json:"lease_time"`
|
|
|
|
|
|
|
|
|
|
// Server IP
|
|
|
|
|
ServerIP string `json:"server_ip"`
|
|
|
|
|
|
|
|
|
|
// Server MAC
|
|
|
|
|
ServerMAC string `json:"server_mac"`
|
|
|
|
|
|
|
|
|
|
// Whether the config is enabled
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DHCPv6Config struct {
|
|
|
|
|
// Address prefix
|
|
|
|
|
AddressPrefix string `json:"address_prefix"`
|
|
|
|
|
|
|
|
|
|
// DNS
|
|
|
|
|
DNS []string `json:"dns"`
|
|
|
|
|
|
|
|
|
|
// ID of config
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
|
|
|
|
// Lease time
|
|
|
|
|
LeaseTime uint64 `json:"lease_time"`
|
|
|
|
|
|
|
|
|
|
// Server MAC
|
|
|
|
|
ServerMAC string `json:"server_mac"`
|
|
|
|
|
|
|
|
|
|
// Whether the config is enabled
|
|
|
|
|
Enabled bool `json:"enabled"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type EntityInfo struct {
|
|
|
|
|
// User-friendly name for entity
|
|
|
|
|
DisplayName string `json:"display_name"`
|
|
|
|
|
|
|
|
|
|
// ID of entity
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Status struct {
|
2026-04-17 17:04:11 +03:00
|
|
|
// Operation status
|
|
|
|
|
OperationStatus string `json:"operation_status"`
|
2025-11-14 17:38:59 +03:00
|
|
|
|
|
|
|
|
// Hypervisors status
|
|
|
|
|
Hypervisors []HypervisorStatus `json:"hypervisors"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type HypervisorStatus struct {
|
2026-04-17 17:04:11 +03:00
|
|
|
// Operation status of the hypervisor
|
|
|
|
|
OperationStatus string `json:"operation_status"`
|
2025-11-14 17:38:59 +03:00
|
|
|
|
|
|
|
|
// Name of hypervisor
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
|
|
|
|
// User-friendly name for the hypervisor
|
|
|
|
|
DisplayName string `json:"display_name"`
|
|
|
|
|
|
|
|
|
|
// Hypervisor status
|
|
|
|
|
HypervisorStatus string `json:"hypervisor_status"`
|
|
|
|
|
|
|
|
|
|
// Synced time
|
|
|
|
|
SyncedAt time.Time `json:"synced_at"`
|
|
|
|
|
}
|
2026-04-17 17:04:11 +03:00
|
|
|
|
|
|
|
|
// L2ConnectionPort holds information about the L2 connection port of a segment
|
|
|
|
|
type L2ConnectionPort struct {
|
|
|
|
|
// ID of the L2 connection port
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
|
|
|
|
// Access group ID
|
|
|
|
|
AccessGroupID string `json:"access_group_id"`
|
|
|
|
|
|
|
|
|
|
// ID of version
|
|
|
|
|
VersionID uint64 `json:"version_id"`
|
|
|
|
|
|
|
|
|
|
// L2 external network details
|
|
|
|
|
L2ExternalNetwork L2ExternalNetwork `json:"l2_external_network"`
|
|
|
|
|
|
|
|
|
|
// Created time
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
|
|
|
|
|
// ID of the user who created the port
|
|
|
|
|
CreatedBy string `json:"created_by"`
|
|
|
|
|
|
|
|
|
|
// Updated time
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
|
|
|
|
|
// ID of the user who last updated the port
|
|
|
|
|
UpdatedBy string `json:"updated_by"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// L2ExternalNetwork holds information about an L2 external network
|
|
|
|
|
type L2ExternalNetwork struct {
|
|
|
|
|
// ID of the network
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
|
|
|
|
// User-friendly name for the network
|
|
|
|
|
DisplayName string `json:"display_name"`
|
|
|
|
|
|
|
|
|
|
// Detailed description of the network
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
|
|
|
|
|
|
// Bridge network name
|
|
|
|
|
BridgeNetworkName string `json:"bridge_network_name"`
|
|
|
|
|
|
|
|
|
|
// List of hypervisor IDs attached to the network
|
|
|
|
|
Hypervisors []string `json:"hypervisors"`
|
|
|
|
|
|
|
|
|
|
// VLAN tag
|
|
|
|
|
VLANTag uint64 `json:"vlan_tag"`
|
|
|
|
|
|
|
|
|
|
// ID of version
|
|
|
|
|
VersionID uint64 `json:"version_id"`
|
|
|
|
|
|
|
|
|
|
// Created time
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
|
|
|
|
|
// ID of the user who created the network
|
|
|
|
|
CreatedBy string `json:"created_by"`
|
|
|
|
|
|
|
|
|
|
// Updated time
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
|
|
|
|
|
// ID of the user who last updated the network
|
|
|
|
|
UpdatedBy string `json:"updated_by"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetFAAResponse holds the floating/anycast IP address info for a segment
|
|
|
|
|
type GetFAAResponse struct {
|
|
|
|
|
// IPv4 address
|
|
|
|
|
IPv4Address string `json:"ipv4_address"`
|
|
|
|
|
|
|
|
|
|
// IPv6 address
|
|
|
|
|
IPv6Address string `json:"ipv6_address"`
|
|
|
|
|
}
|