Documentation
¶
Index ¶
- func AddPool(db *gorm.DB, nsID uint, raw string) (*models.IpamNamespacePrefix, error)
- func Allocate(db *gorm.DB, nsID, vrfID uint, raw, description string) (*models.IpamPrefix, error)
- func CreateVRF(db *gorm.DB, nsID uint, name, description string) (*models.IpamVRF, error)
- func DeleteNamespace(db *gorm.DB, id uint) error
- func DeletePool(db *gorm.DB, nsID, poolID uint) error
- func DeletePrefix(db *gorm.DB, nsID, prefixID uint) error
- func DeleteVRF(db *gorm.DB, nsID, vrfID uint) error
- func Enabled(db *gorm.DB) bool
- func ListPools(db *gorm.DB, nsID uint) ([]models.IpamNamespacePrefix, error)
- func ListPrefixes(db *gorm.DB, nsID uint) ([]models.IpamPrefix, error)
- func ListVRFs(db *gorm.DB, nsID uint) ([]models.IpamVRF, error)
- func ParseNodeKey(s string) (string, uint, error)
- func ParsePrefix(s string) (netip.Prefix, error)
- func UpdatePrefix(db *gorm.DB, nsID, prefixID uint, description string) (*models.IpamPrefix, error)
- func UpdateVRF(db *gorm.DB, nsID, vrfID uint, name, description string) (*models.IpamVRF, error)
- type NamespaceView
- type StatusError
- type TreeNode
- type TreeNodeData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
Enabled reports Settings.IpamEnabled (nil/false = off). Disabling the flag only hides the UI and 404s /api/ipam/* — it does not touch rows.
func ListPrefixes ¶
func ParseNodeKey ¶
ParseNodeKey splits "ns:3" into ("ns", 3).
func ParsePrefix ¶
ParsePrefix accepts a CIDR or a bare address that means "the whole family": 0.0.0.0 and 0.0.0.0/0 are IPv4-any; :: and ::/0 are IPv6-any. The result is always masked (10.1.2.3/24 → 10.1.2.0/24).
func UpdatePrefix ¶
Types ¶
type NamespaceView ¶
type NamespaceView struct {
models.IpamNamespace
Pools []models.IpamNamespacePrefix `json:"pools"`
VRFs []models.IpamVRF `json:"vrfs"`
PrefixCount int64 `json:"prefix_count"`
PoolCount int `json:"pool_count"`
VRFCount int `json:"vrf_count"`
}
NamespaceView is a namespace plus the bits the list/detail pages need without extra round-trips.
func CreateNamespace ¶
func CreateNamespace(db *gorm.DB, name, description string) (*NamespaceView, error)
func GetNamespace ¶
func GetNamespace(db *gorm.DB, id uint) (*NamespaceView, error)
func ListNamespaces ¶
func ListNamespaces(db *gorm.DB) ([]NamespaceView, error)
func UpdateNamespace ¶
type StatusError ¶
StatusError is an application-level failure with an HTTP-ish status so handlers don't have to string-match error text.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
type TreeNode ¶
type TreeNode struct {
Key string `json:"key"`
Title string `json:"title"`
Lazy bool `json:"lazy"`
Expanded bool `json:"expanded,omitempty"`
Type string `json:"type"`
Data TreeNodeData `json:"data"`
Children []TreeNode `json:"children,omitempty"`
}
TreeNode is one row of the prefix tree, shaped for Wunderbaum (key, title, lazy, data). Parent/children are computed from CIDR containment.
type TreeNodeData ¶
type TreeNodeData struct {
Kind string `json:"kind"` // namespace | pool | vrf | allocated
ID uint `json:"id"`
NamespaceID uint `json:"namespace_id,omitempty"`
PoolID uint `json:"pool_id,omitempty"`
PrefixID uint `json:"prefix_id,omitempty"`
VRFID uint `json:"vrf_id,omitempty"`
VRFName string `json:"vrf_name,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
Family int `json:"family"`
Description string `json:"description,omitempty"`
Used string `json:"used"`
UsedFrac float64 `json:"used_frac"`
ChildCount int `json:"child_count"`
}