networks

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package networks provides the ability to create and manage networks in cloud environments using nova-network.

This package can also be used to retrieve network details of Neutron-based networks.

Example to List Networks

allPages, err := networks.List(computeClient).AllPages()
if err != nil {
	panic(err)
}

allNetworks, err := networks.ExtractNetworks(allPages)
if err != nil {
	panic(err)
}

for _, network := range allNetworks {
	fmt.Printf("%+v\n", network)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient) pagination.Pager

List returns a Pager that allows you to iterate over a collection of Network.

Types

type GetResult

type GetResult struct {
	NetworkResult
}

GetResult is the response from a Get operation. Call its Extract method to interpret it as a Network.

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

Get returns data about a previously created Network.

type Network

type Network struct {
	// The Bridge that VIFs on this network are connected to
	Bridge string `json:"bridge"`

	// BridgeInterface is what interface is connected to the Bridge
	BridgeInterface string `json:"bridge_interface"`

	// The Broadcast address of the network.
	Broadcast string `json:"broadcast"`

	// CIDR is the IPv4 subnet.
	CIDR string `json:"cidr"`

	// CIDRv6 is the IPv6 subnet.
	CIDRv6 string `json:"cidr_v6"`

	// CreatedAt is when the network was created..
	CreatedAt golangsdk.JSONRFC3339MilliNoZ `json:"created_at,omitempty"`

	// Deleted shows if the network has been deleted.
	Deleted bool `json:"deleted"`

	// DeletedAt is the time when the network was deleted.
	DeletedAt golangsdk.JSONRFC3339MilliNoZ `json:"deleted_at,omitempty"`

	// DHCPStart is the start of the DHCP address range.
	DHCPStart string `json:"dhcp_start"`

	// DNS1 is the first DNS server to use through DHCP.
	DNS1 string `json:"dns_1"`

	// DNS2 is the first DNS server to use through DHCP.
	DNS2 string `json:"dns_2"`

	// Gateway is the network gateway.
	Gateway string `json:"gateway"`

	// Gatewayv6 is the IPv6 network gateway.
	Gatewayv6 string `json:"gateway_v6"`

	// Host is the host that the network service is running on.
	Host string `json:"host"`

	// ID is the UUID of the network.
	ID string `json:"id"`

	// Injected determines if network information is injected into the host.
	Injected bool `json:"injected"`

	// Label is the common name that the network has..
	Label string `json:"label"`

	// MultiHost is if multi-host networking is enablec..
	MultiHost bool `json:"multi_host"`

	// Netmask is the network netmask.
	Netmask string `json:"netmask"`

	// Netmaskv6 is the IPv6 netmask.
	Netmaskv6 string `json:"netmask_v6"`

	// Priority is the network interface priority.
	Priority int `json:"priority"`

	// ProjectID is the project associated with this network.
	ProjectID string `json:"project_id"`

	// RXTXBase configures bandwidth entitlement.
	RXTXBase int `json:"rxtx_base"`

	// UpdatedAt is the time when the network was last updated.
	UpdatedAt golangsdk.JSONRFC3339MilliNoZ `json:"updated_at,omitempty"`

	// VLAN is the vlan this network runs on.
	VLAN int `json:"vlan"`

	// VPNPrivateAddress is the private address of the CloudPipe VPN.
	VPNPrivateAddress string `json:"vpn_private_address"`

	// VPNPublicAddress is the public address of the CloudPipe VPN.
	VPNPublicAddress string `json:"vpn_public_address"`

	// VPNPublicPort is the port of the CloudPipe VPN.
	VPNPublicPort int `json:"vpn_public_port"`
}

A Network represents a network in an OpenStack cloud.

func ExtractNetworks

func ExtractNetworks(r pagination.Page) ([]Network, error)

ExtractNetworks interprets a page of results as a slice of Networks.

type NetworkPage

type NetworkPage struct {
	pagination.SinglePageBase
}

NetworkPage stores a single page of all Network results from a List call.

func (NetworkPage) IsEmpty

func (page NetworkPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a NetworkPage is empty.

type NetworkResult

type NetworkResult struct {
	golangsdk.Result
}

func (NetworkResult) Extract

func (r NetworkResult) Extract() (*Network, error)

Extract is a method that attempts to interpret any Network resource response as a Network struct.

Directories

Path Synopsis
networks unit tests
networks unit tests

Jump to

Keyboard shortcuts

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