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 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.