nics

package
v0.5.20 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package nics enables management and retrieval of NICs BMS service.

Example to List Flavors

listOpts := nics.ListOpts{}
allNics, err := nics.List(bmsClient, listOpts)
if err != nil {
	panic(err)
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixedIP

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

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Nic.

func Get

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

Get retrieves a particular nic based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Nic, error)

Extract is a function that accepts a result and extracts a nic.

type ListOpts

type ListOpts struct {
	// ID is the unique identifier for the nic.
	ID string `json:"port_id"`

	// Status indicates whether or not a nic is currently operational.
	Status string `json:"port_state"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

type Nic

type Nic struct {
	// ID is the unique identifier for the nic.
	ID string `json:"port_id"`

	// Specifies the ID of the network to which the NIC port belongs.
	NetworkID string `json:"net_id"`

	// Status indicates whether or not a nic is currently operational.
	Status string `json:"port_state"`

	// Specifies the NIC private IP address.
	FixedIP []FixedIP `json:"fixed_ips"`

	// Specifies the MAC address of the NIC.
	MACAddress string `json:"mac_addr"`
}

Nic Manage and perform other operations on Nic, including querying Nics as well as querying Nic.

func ExtractNics

func ExtractNics(r pagination.Page) ([]Nic, error)

ExtractNics accepts a Page struct, specifically a NicPage struct, and extracts the elements into a slice of Nic structs. In other words, a generic collection is mapped into a relevant slice.

func FilterNICs

func FilterNICs(nics []Nic, opts ListOpts) ([]Nic, error)

FilterNICs used to filter nics using id and status.

func List

func List(c *golangsdk.ServiceClient, serverId string, opts ListOpts) ([]Nic, error)

List returns collection of nics. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type NicPage

type NicPage struct {
	pagination.LinkedPageBase
}

NicPage is the page returned by a pager when traversing over a collection of nics.

func (NicPage) IsEmpty

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

IsEmpty checks whether a NicPage struct is empty.

func (NicPage) NextPageURL

func (r NicPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of nics has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

Jump to

Keyboard shortcuts

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