Documentation ¶
Overview ¶
Package network contains functionality for working EdgeCloud networks API resources
Example to List Network
allPages, err := availablenetworks.List(networkClient).AllPages() if err != nil { panic(err) } allNetworks, err := availablenetworks.ExtractNetworks(allPages) if err != nil { panic(err) } for _, network := range allNetworks { fmt.Printf("%+v", network) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractNetworksInto ¶
func ExtractNetworksInto(r pagination.Page, v interface{}) error
func List ¶
func List(c *edgecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
Types ¶
type ListOpts ¶
ListOpts allows the filtering and sorting of paginated collections through the API.
func (ListOpts) ToAvailableNetworkListQuery ¶
ToAvailableNetworkListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Network ¶
type Network struct { Name string `json:"name"` ID string `json:"id"` Subnets []subnets.Subnet `json:"subnets"` MTU int `json:"mtu"` Type string `json:"type"` CreatedAt edgecloud.JSONRFC3339Z `json:"created_at"` UpdatedAt *edgecloud.JSONRFC3339Z `json:"updated_at"` External bool `json:"external"` Default bool `json:"default"` TaskID *string `json:"task_id"` ProjectID int `json:"project_id"` RegionID int `json:"region_id"` Region string `json:"region"` }
Network represents a network structure.
func ExtractNetworks ¶
func ExtractNetworks(r pagination.Page) ([]Network, error)
ExtractNetwork accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Network structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(client *edgecloud.ServiceClient, opts ListOptsBuilder) ([]Network, error)
ListAll is a convenience function that returns all networks.
type NetworkPage ¶
type NetworkPage struct {
pagination.LinkedPageBase
}
NetworkPage is the page returned by a pager when traversing over a collection of networks.
func (NetworkPage) IsEmpty ¶
func (r NetworkPage) IsEmpty() (bool, error)
IsEmpty checks whether a NetworkPage struct is empty.
func (NetworkPage) NextPageURL ¶
func (r NetworkPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of networks 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.