address

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Overview

Package address implements API functions residing under /ipam/address. This path contains methods for managing IPs.

Index

Constants

This section is empty.

Variables

View Source
var (
	PrefixFilter       = param.ParameterBuilder("prefix")
	VlanFilter         = param.ParameterBuilder("vlan")
	VersionFilter      = param.ParameterBuilder("version")
	RoleTextFilter     = param.ParameterBuilder("role_text")
	StatusFilter       = param.ParameterBuilder("status")
	LocationFilter     = param.ParameterBuilder("location")
	OrganizationFilter = param.ParameterBuilder("organization_identifier")
)

Filters that can be applied to the GetFiltered request

Functions

This section is empty.

Types

type API

type API interface {
	List(ctx context.Context, page, limit int, search string) ([]Summary, error)
	Get(ctx context.Context, id string) (Address, error)
	GetFiltered(ctx context.Context, page, limit int, filters ...param.Parameter) ([]Summary, 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)
	ReserveRandom(ctx context.Context, reserve ReserveRandom) (ReserveRandomSummary, 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 Address

type Address struct {
	ID                  string `json:"identifier"`
	Name                string `json:"name"`
	DescriptionCustomer string `json:"description_customer"`
	DescriptionInternal string `json:"description_internal"`
	Role                string `json:"role_text"`
	Version             int    `json:"version"`
	Status              string `json:"status"`
	VLANID              string `json:"vlan"`
	PrefixID            string `json:"prefix"`
}

Address contains all the information about a specific address.

type Create

type Create struct {
	PrefixID            string `json:"prefix"`
	Address             string `json:"name"`
	DescriptionCustomer string `json:"description_customer"`
	Role                string `json:"role"`
	Organization        string `json:"organization"`
}

Create defines meta data of an address to create.

func NewCreate

func NewCreate(prefixID string, address string) Create

NewCreate creates a new address definition with required vlaues.

type IPReserveVersionLimit added in v0.7.1

type IPReserveVersionLimit int

IPReserveVersionLimit limits the IP version for address reservations

const (
	// IPReserveVersionLimitIPv4 specifies that only IPv4 addresses should be reserved
	IPReserveVersionLimitIPv4 IPReserveVersionLimit = 4

	// IPReserveVersionLimitIPv4 specifies that only IPv6 addresses should be reserved
	IPReserveVersionLimitIPv6 IPReserveVersionLimit = 6
)

type ReserveRandom

type ReserveRandom struct {
	LocationID string `json:"location_identifier"`
	VlanID     string `json:"vlan_identifier"`
	Count      int    `json:"count"`

	// PrefixID limits the potential addresses to a specific prefix
	// within the specified VLAN. Defaults to all prefixes within the VLAN.
	PrefixID string `json:"prefix_identifier,omitempty"`

	// IPVersion limits the potential addresses to a specific IP version.
	// Defaults to v4 or v6, depending on availability.
	IPVersion IPReserveVersionLimit `json:"ip_version,omitempty"`

	// ReservationPeriod specifies how many seconds the addresses should be reserved.
	// If IP addresses haven't been assigned to resources within the period, they are released again.
	// Defaults to 1800 seconds (= 30 minutes).
	ReservationPeriod uint `json:"reservation_period,omitempty"`
}

ReserveRandom defines metadata of addresses to reserve randomly.

type ReserveRandomSummary

type ReserveRandomSummary struct {
	Limit      int          `json:"limit"`
	Page       int          `json:"page"`
	TotalItems int          `json:"total_items"`
	TotalPages int          `json:"total_pages"`
	Data       []ReservedIP `json:"data"`
}

ReserveRandomSummary is the reserved IPs information returned by list request.

type ReservedIP

type ReservedIP struct {
	ID      string `json:"identifier"`
	Address string `json:"text"`
	Prefix  string `json:"prefix"`
}

ReservedIP returns details about reserved ip.

type Summary

type Summary struct {
	ID                  string `json:"identifier"`
	Name                string `json:"name"`
	DescriptionCustomer string `json:"description_customer"`
	Role                string `json:"role_text"`
}

Summary is the address information returned by a listing.

type Update

type Update struct {
	Name                string `json:"name,omitempty"`
	DescriptionCustomer string `json:"description_customer,omitempty"`
	Role                string `json:"role,omitempty"`
}

Update contains fields to change on a prefix.

Jump to

Keyboard shortcuts

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