attachinterfaces

package
v0.0.0-...-8db8df1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package attachinterfaces provides the ability to retrieve and manage network interfaces through Nova.

Example of Listing a Server's Interfaces

serverID := "b07e7a3b-d951-4efc-a4f9-ac9f001afb7f"
allPages, err := attachinterfaces.List(computeClient, serverID).AllPages()
if err != nil {
	panic(err)
}

allInterfaces, err := attachinterfaces.ExtractInterfaces(allPages)
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *gophercloud.ServiceClient, serverID string) pagination.Pager

List makes a request against the nova API to list the server's interfaces.

Types

type FixedIP

type FixedIP struct {
	SubnetID  string `json:"subnet_id"`
	IPAddress string `json:"ip_address"`
}

FixedIP represents a Fixed IP Address.

type Interface

type Interface struct {
	PortState string    `json:"port_state"`
	FixedIPs  []FixedIP `json:"fixed_ips"`
	PortID    string    `json:"port_id"`
	NetID     string    `json:"net_id"`
	MACAddr   string    `json:"mac_addr"`
}

Interface represents a network interface on a server.

func ExtractInterfaces

func ExtractInterfaces(r pagination.Page) ([]Interface, error)

ExtractInterfaces interprets the results of a single page from a List() call, producing a slice of Interface structs.

type InterfacePage

type InterfacePage struct {
	pagination.SinglePageBase
}

InterfacePage abstracts the raw results of making a List() request against the API.

As OpenStack extensions may freely alter the response bodies of structures returned to the client, you may only safely access the data provided through the ExtractInterfaces call.

func (InterfacePage) IsEmpty

func (r InterfacePage) IsEmpty() (bool, error)

IsEmpty returns true if an InterfacePage contains no interfaces.

Directories

Path Synopsis
attachinterfaces unit tests
attachinterfaces unit tests

Jump to

Keyboard shortcuts

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