vpcs

package
v0.0.0-...-38f4f47 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVPCsInto

func ExtractVPCsInto(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 CreateOpts

type CreateOpts struct {
	Name              string `json:"name"`
	CIDRv4            string `json:"cidrv4"`
	TenantID          string `json:"tenant_id,omitempty"`
	ExternalNetworkID string `json:"external_network_id,omitempty"`
}

CreateOpts represents options used to create a network.

func (CreateOpts) ToVPCCreateMap

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

ToVPCCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToVPCCreateMap() (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 VPC.

func Create

func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and creates a new network using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

The tenant ID that is contained in the URI is the tenant that creates the network. An admin user, however, has the option of specifying another tenant ID in the CreateOpts struct.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a network resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteResult

type DeleteResult struct {
	gophercloud.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(c *gophercloud.ServiceClient, networkID string) (r DeleteResult)

Delete accepts a unique ID and deletes the network associated with it.

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

func Get

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

Get retrieves a specific network based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a network resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	TenantID       string `q:"tenant_id"`
	ID             string `q:"id"`
	Name           string `q:"name"`
	RouterExternal bool   `q:"router:external"`
	Shared         bool   `q:"shared"`
	SortDir        string `q:"sort_dir"`
	SortKey        string `q:"sort_key"`
}

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.

func (ListOpts) ToVPCListQuery

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

ToVPCListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type Route

type Route struct {
	SubnetID       string `json:"subnet_id"`
	TenantID       string `json:"tenant_id"`
	Mask           int    `json:"mask"`
	Gateway        string `json:"gateway"`
	GatewayID      string `json:"gateway_id,omitempty"`
	RoutingTableID string `json:"routingtable_id"`
	CIDR           string `json:"cidr"`
	ID             string `json:"id"`
}

type RoutingTable

type RoutingTable struct {
	GatewayID    string    `json:"gateway_id"`
	Subnets      []Subnet  `json:"subnets"`
	Name         string    `json:"name"`
	VPCs         []VPC     `json:"vpcs"`
	TenantID     string    `json:"tenant_id"`
	Distributed  bool      `json:"distributed"`
	State        string    `json:"state"`
	DefaultTable bool      `json:"default_table"`
	CreateTime   time.Time `json:"create_time"`
	Routes       []Route   `json:"routes"`
	ID           string    `json:"id"`
}

type Subnet

type Subnet struct {
	RouterExternal   bool    `json:"router:external"`
	Name             string  `json:"name"`
	EnableDHCP       bool    `json:"enable_dhcp"`
	TenantID         string  `json:"tenant_id"`
	Gateway          string  `json:"gateway"`
	Routes           []Route `json:"routes"`
	State            string  `json:"state"`
	CreateTime       string  `json:"create_time"`
	AvailableIPCount int     `json:"available_ip_count"`
	VPC              VPC     `json:"vpc"`
	Shared           bool    `json:"shared"`
	ID               string  `json:"id"`
	VPCID            string  `json:"vpc_id"`
	Hidden           bool    `json:"hidden"`
	CIDR             string  `json:"cidr"`
}

type UpdateOpts

type UpdateOpts struct {
	AdminStateUp *bool   `json:"admin_state_up,omitempty"`
	Name         *string `json:"name,omitempty"`
	Description  *string `json:"description,omitempty"`
	Shared       *bool   `json:"shared,omitempty"`
}

UpdateOpts represents options used to update a network.

func (UpdateOpts) ToVPCUpdateMap

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

ToVPCUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToVPCUpdateMap() (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 VPC.

func Update

func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing network using the values provided. For more information, see the Create function.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a network resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

type VPC

type VPC struct {
	RouterExternal bool           `json:"router:external"`
	RoutingTables  []RoutingTable `json:"routingtables"`
	Name           string         `json:"name"`
	Subnets        []Subnet       `json:"subnets"`
	TenantID       string         `json:"tenant_id"`
	State          string         `json:"state"`
	CreateTime     string         `json:"create_time"`
	CIDRv4         string         `json:"cidrv4"`
	Shared         bool           `json:"shared"`
	ID             string         `json:"id"`
}

func ExtractVPCs

func ExtractVPCs(r pagination.Page) ([]VPC, error)

ExtractVPCs accepts a Page struct, specifically a VPCPage struct, and extracts the elements into a slice of VPC structs. In other words, a generic collection is mapped into a relevant slice.

func (*VPC) UnmarshalJSON

func (r *VPC) UnmarshalJSON(b []byte) error

type VPCPage

type VPCPage struct {
	pagination.LinkedPageBase
}

VPCPage is the page returned by a pager when traversing over a collection of networks.

func (VPCPage) IsEmpty

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

IsEmpty checks whether a VPCPage struct is empty.

func (VPCPage) NextPageURL

func (r VPCPage) 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.

Jump to

Keyboard shortcuts

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