Documentation ¶
Overview ¶
Package networks contains functionality for working with Neutron network resources. A network is an isolated virtual layer-2 broadcast domain that is typically reserved for the tenant who created it (unless you configure the network to be shared). Tenants can create multiple networks until the thresholds per-tenant quota is reached.
In the v2.0 Networking API, the network is the main entity. Ports and subnets are always associated with a network.
Example to List Networks
listOpts := networks.ListOpts{ TenantID: "a99e9b4e620e4db09a2dfb6e42a01e66", } allPages, err := networks.List(networkClient, listOpts).AllPages() if err != nil { panic(err) } allNetworks, err := networks.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 *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of networks. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.
Types ¶
type ListOpts ¶
type ListOpts struct { ID string `q:"id"` Name string `q:"name"` ProviderNetworkType string `q:"provider:network_type"` RouterExternal bool `q:"router:external"` TenantID string `q:"tenant_id"` SortDir string `q:"sort_dir"` SortKey string `q:"sort_key"` Fields string `q:"fields"` // Field Name of the network }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the network attributes you want to see returned. SortKey allows you to sort by a particular network attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination. https://docs.nhncloud.com/ko/Network/VPC/ko/public-api-compat/
func (ListOpts) ToNetworkListQuery ¶
ToNetworkListQuery 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 { // Indicates whether network is currently operational. Possible values include // `ACTIVE', `DOWN', `BUILD', or `ERROR'. Plug-ins might define additional // values. Status string `json:"status"` // Subnets associated with this network. Subnets []string `json:"subnets"` // Specifies whether the network is an external network or not. RouterExternal bool `json:"router:external"` // TenantID is the project owner of the network. TenantID string `json:"tenant_id"` // The administrative state of network. If false (down), the network does not // forward packets. AdminStateUp bool `json:"admin_state_up"` // The maximum transmission unit (MTU) value to address fragmentation. // Minimum value is 68 for IPv4, and 1280 for IPv6. MTU int `json:"mtu"` Shared bool `json:"shared"` // PortSecurityEnabled specifies whether port security is enabled or // disabled. PortSecurityEnabled bool `json:"port_security_enabled"` // UUID for the network ID string `json:"id"` // Human-readable name for the network. Might not be unique. Name string `json:"name"` }
https://docs.nhncloud.com/ko/Network/VPC/ko/public-api-compat/#_2 Network represents, well, a network.
func ExtractNetworks ¶
func ExtractNetworks(r pagination.Page) ([]Network, error)
ExtractNetworks 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.
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.