prefix

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package prefix implements API functions residing under /ipam/prefix. This path contains methods for querying and setting IP prefixes.

Index

Constants

View Source
const (

	// TypePublic means the prefix is globally routable.
	TypePublic int = 0
	// TypePrivate means the prefix is scoped to a private network.
	TypePrivate int = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	List(ctx context.Context, page, limit int) ([]Summary, error)
	Get(ctx context.Context, id string) (Info, error)
	Delete(ctx context.Context, id string) error
	Create(ctx context.Context, create Create) (Summary, error)
	Update(ctx context.Context, id string, update Update) (Summary, error)
}

API contains methods for IP manipulation.

func NewAPI

func NewAPI(c client.Client) API

NewAPI creates a new IP API instance with the given client.

type Create

type Create struct {
	Location    string `json:"location"`
	IPVersion   int    `json:"version"`
	Type        int    `json:"type"`
	NetworkMask int    `json:"netmask"`

	CreateVLAN              bool   `json:"new_vlan,omitempty"`
	CreateEmpty             bool   `json:"create_empty"`
	VLANID                  string `json:"vlan,omitempty"`
	EnableRedundancy        bool   `json:"router_redundancy,omitempty"`
	EnableVMProvisioning    bool   `json:"vm_provisioning,omitempty"`
	CustomerDescription     string `json:"description_customer,omitempty"`
	CustomerVLANDescription string `json:"description_vlan_customer,omitempty"`
	Organization            string `json:"organization,omitempty"`
}

Create defines meta data of a prefix to create.

func NewCreate

func NewCreate(location, vlan string, ipVersion int, prefixType int, networkMask int) Create

NewCreate creates a new prefix definition with required vlaues.

type Info

type Info struct {
	ID                  string     `json:"identifier"`
	Name                string     `json:"name"`
	CustomerDescription string     `json:"description_customer"`
	InternalDescription string     `json:"description_internal"`
	IPVersion           int        `json:"version"`
	NetworkMask         int        `json:"netmask"`
	Role                string     `json:"role_text"`
	Status              string     `json:"status"`
	Locations           []Location `json:"locations"`
	RouterRedundancy    bool       `json:"router_redundancy"`
	Vlans               []Vlan     `json:"vlans"`
	PrefixType          int        `json:"type"`
}

Info contains extended information about a prefix.

type Location

type Location struct {
	ID        string `json:"identifier"`
	Code      string `json:"code"`
	Name      string `json:"name"`
	Country   string `json:"country"`
	Latitude  string `json:"lat"`
	Longitude string `json:"lon"`
	CityCode  string `json:"city_code"`
}

Location is part of info.

type Summary

type Summary struct {
	ID                  string `json:"identifier"`
	Name                string `json:"name"`
	CustomerDescription string `json:"description_customer"`
}

Summary contains a abbreviated information set about a prefix.

type Update

type Update struct {
	Name                string `json:"name,omitempty"`
	CustomerDescription string `json:"description_customer,omitempty"`
}

Update contains fields to change on a prefix.

type Vlan

type Vlan struct {
	ID                  string `json:"identifier"`
	Name                string `json:"name"`
	CustomerDescription string `json:"description_customer"`
}

Vlan reference definition

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL