networkipavailabilities

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package networkipavailabilities provides the ability to retrieve and manage networkipavailabilities through the Neutron API.

Example of Listing NetworkIPAvailabilities

allPages, err := networkipavailabilities.List(networkClient, networkipavailabilities.ListOpts{}).AllPages()
if err != nil {
  panic(err)
}

allAvailabilities, err := subnetpools.ExtractSubnetPools(allPages)
if err != nil {
  panic(err)
}

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

Example of Getting a single NetworkIPAvailability

availability, err := networkipavailabilities.Get(networkClient, "cf11ab78-2302-49fa-870f-851a08c7afb8").Extract()
if err != nil {
  panic(err)
}

fmt.Printf("%+v\n", availability)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(c *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns a Pager which allows you to iterate over a collection of networkipavailabilities. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.

Types

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

func Get

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

Get retrieves a specific NetworkIPAvailability based on its ID.

func (GetResult) Extract

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

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

type ListOpts

type ListOpts struct {
	// NetworkName allows to filter on the identifier of a network.
	NetworkID string `q:"network_id"`

	// NetworkName allows to filter on the name of a network.
	NetworkName string `q:"network_name"`

	// IPVersion allows to filter on the version of the IP protocol.
	// You can use the well-known IP versions with the golangsdk.IPVersion type.
	IPVersion string `q:"ip_version"`

	// ProjectID allows to filter on the Identity project field.
	ProjectID string `q:"project_id"`

	// TenantID allows to filter on the Identity project field.
	TenantID string `q:"tenant_id"`
}

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

func (ListOpts) ToNetworkIPAvailabilityListQuery

func (opts ListOpts) ToNetworkIPAvailabilityListQuery() (string, error)

ToNetworkIPAvailabilityListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToNetworkIPAvailabilityListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type NetworkIPAvailability

type NetworkIPAvailability struct {
	// NetworkID contains an unique identifier of the network.
	NetworkID string `json:"network_id"`

	// NetworkName represents human-readable name of the network.
	NetworkName string `json:"network_name"`

	// ProjectID is the ID of the Identity project.
	ProjectID string `json:"project_id"`

	// TenantID is the ID of the Identity project.
	TenantID string `json:"tenant_id"`

	// SubnetIPAvailabilities contains availability details for every subnet
	// that is associated to the network.
	SubnetIPAvailabilities []SubnetIPAvailability `json:"subnet_ip_availability"`

	// TotalIPs represents a number of IP addresses in the network.
	TotalIPs int `json:"total_ips"`

	// UsedIPs represents a number of used IP addresses in the network.
	UsedIPs int `json:"used_ips"`
}

NetworkIPAvailability represents availability details for a single network.

func ExtractNetworkIPAvailabilities

func ExtractNetworkIPAvailabilities(r pagination.Page) ([]NetworkIPAvailability, error)

ExtractNetworkIPAvailabilities interprets the results of a single page from a List() API call, producing a slice of NetworkIPAvailabilities structures.

type NetworkIPAvailabilityPage

type NetworkIPAvailabilityPage struct {
	pagination.SinglePageBase
}

NetworkIPAvailabilityPage stores a single page of NetworkIPAvailabilities from the List call.

func (NetworkIPAvailabilityPage) IsEmpty

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

IsEmpty determines whether or not a NetworkIPAvailability is empty.

type SubnetIPAvailability

type SubnetIPAvailability struct {
	// SubnetID contains an unique identifier of the subnet.
	SubnetID string `json:"subnet_id"`

	// SubnetName represents human-readable name of the subnet.
	SubnetName string `json:"subnet_name"`

	// CIDR represents prefix in the CIDR format.
	CIDR string `json:"cidr"`

	// IPVersion is the IP protocol version.
	IPVersion int `json:"ip_version"`

	// TotalIPs represents a number of IP addresses in the subnet.
	TotalIPs int `json:"total_ips"`

	// UsedIPs represents a number of used IP addresses in the subnet.
	UsedIPs int `json:"used_ips"`
}

SubnetIPAvailability represents availability details for a single subnet.

Directories

Path Synopsis
networkipavailabilities unit tests
networkipavailabilities unit tests

Jump to

Keyboard shortcuts

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