subnets

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	Name             string         `json:"name" required:"true"`
	Description      string         `json:"description,omitempty"`
	CIDR             string         `json:"cidr" required:"true"`
	DNSList          []string       `json:"dnsList,omitempty"`
	GatewayIP        string         `json:"gateway_ip" required:"true"`
	EnableDHCP       *bool          `json:"dhcp_enable,omitempty"`
	PrimaryDNS       string         `json:"primary_dns,omitempty"`
	SecondaryDNS     string         `json:"secondary_dns,omitempty"`
	AvailabilityZone string         `json:"availability_zone,omitempty"`
	VpcID            string         `json:"vpc_id" required:"true"`
	ExtraDHCPOpts    []ExtraDHCPOpt `json:"extra_dhcp_opts,omitempty"`
}

CreateOpts contains all the values needed to create a new subnets. There are no required values.

func (CreateOpts) ToSubnetCreateMap

func (opts CreateOpts) ToSubnetCreateMap() (map[string]interface{}, error)

ToSubnetCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToSubnetCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Subnet.

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and uses the values to create a new logical subnets. When it is created, the subnets does not have an internal interface - it is not associated to any subnet.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Subnet, error)

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

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(client *golangsdk.ServiceClient, vpcID string, id string) (r DeleteResult)

Delete will permanently delete a particular subnets based on its unique ID.

type ExtraDHCP added in v0.3.1

type ExtraDHCP struct {
	OptName  string `json:"opt_name"`
	OptValue string `json:"opt_value"`
}

type ExtraDHCPOpt added in v0.3.1

type ExtraDHCPOpt struct {
	OptName  string `json:"opt_name" required:"true"`
	OptValue string `json:"opt_value,omitempty"`
}

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

func Get

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

Get retrieves a particular subnets based on its unique ID.

func (GetResult) Extract

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

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

type ListOpts

type ListOpts struct {
	// ID is the unique identifier for the subnet.
	ID string `json:",omitempty"`

	// Name is the human readable name for the subnet. It does not have to be
	// unique.
	Name string `json:",omitempty"`

	// Specifies the network segment on which the subnet resides.
	CIDR string `json:",omitempty"`

	// Status indicates whether or not a subnet is currently operational.
	Status string `json:",omitempty"`

	// Specifies the gateway of the subnet.
	GatewayIP string `json:",omitempty"`

	// Specifies the IP address of DNS server 1 on the subnet.
	PrimaryDNS string `json:",omitempty"`

	// Specifies the IP address of DNS server 2 on the subnet.
	SecondaryDNS string `json:",omitempty"`

	// Identifies the availability zone (AZ) to which the subnet belongs.
	AvailabilityZone string `json:",omitempty"`

	// Specifies the ID of the VPC to which the subnet belongs.
	VpcID string `json:",omitempty"`
}

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

type Subnet

type Subnet struct {
	// ID is the unique identifier for the subnet.
	ID string `json:"id"`

	// Name is the human-readable name for the subnet. It does not have to be
	// unique.
	Name string `json:"name"`

	// Provides supplementary information about the subnet.
	Description string `json:"description"`

	// Specifies the network segment on which the subnet resides.
	CIDR string `json:"cidr"`

	// Specifies the IP address list of DNS servers on the subnet.
	DNSList []string `json:"dnsList"`

	// Status indicates whether a subnet is currently operational.
	Status string `json:"status"`

	// Specifies the gateway of the subnet.
	GatewayIP string `json:"gateway_ip"`

	// Specifies whether the DHCP function is enabled for the subnet.
	EnableDHCP bool `json:"dhcp_enable"`

	// Specifies the IP address of DNS server 1 on the subnet.
	PrimaryDNS string `json:"primary_dns"`

	// Specifies the IP address of DNS server 2 on the subnet.
	SecondaryDNS string `json:"secondary_dns"`

	// Identifies the availability zone (AZ) to which the subnet belongs.
	AvailabilityZone string `json:"availability_zone"`

	// Specifies the ID of the VPC to which the subnet belongs.
	VpcID string `json:"vpc_id"`

	// Specifies the subnet ID.
	SubnetID string `json:"neutron_subnet_id"`

	// Specifies the network ID.
	NetworkID string `json:"neutron_network_id"`

	// Specifies the extra dhcp opts.
	ExtraDHCPOpts []ExtraDHCP `json:"extra_dhcp_opts"`
}

func ExtractSubnets

func ExtractSubnets(r pagination.Page) ([]Subnet, error)

ExtractSubnets accepts a Page struct, specifically a SubnetPage struct, and extracts the elements into a slice of Subnet structs. In other words, a generic collection is mapped into a relevant slice.

func FilterSubnets

func FilterSubnets(subnets []Subnet, opts ListOpts) ([]Subnet, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Subnet, error)

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

Default policy settings return only those subnets that are owned by the tenant who submits the request, unless an admin user submits the request.

type SubnetPage

type SubnetPage struct {
	pagination.LinkedPageBase
}

SubnetPage is the page returned by a pager when traversing over a collection of subnets.

func (SubnetPage) IsEmpty

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

IsEmpty checks whether a SubnetPage struct is empty.

func (SubnetPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of subnets 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.

type UpdateOpts

type UpdateOpts struct {
	Name          string         `json:"name,omitempty"`
	Description   *string        `json:"description,omitempty"`
	EnableDHCP    *bool          `json:"dhcp_enable,omitempty"`
	PrimaryDNS    string         `json:"primary_dns,omitempty"`
	SecondaryDNS  string         `json:"secondary_dns,omitempty"`
	DNSList       []string       `json:"dnsList,omitempty"`
	ExtraDhcpOpts []ExtraDHCPOpt `json:"extra_dhcp_opts,omitempty"`
}

UpdateOpts contains the values used when updating a subnets.

func (UpdateOpts) ToSubnetUpdateMap

func (opts UpdateOpts) ToSubnetUpdateMap() (map[string]interface{}, error)

ToSubnetUpdateMap builds an update body based on UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToSubnetUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Subnet.

func Update

func Update(client *golangsdk.ServiceClient, vpcID string, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update allows subnets to be updated. You can update the name, administrative state, and the external gateway.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Subnet, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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