routables

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

Types

type ActionOpts

type ActionOpts struct {
	Subnets ActionSubnetsOpts `json:"subnets" required:"true"`
}

ActionOpts contains the values used when associating or disassociating subnets with a route table

func (ActionOpts) ToRouteTableActionMap

func (opts ActionOpts) ToRouteTableActionMap() (map[string]interface{}, error)

ToRouteTableActionMap builds an update body based on UpdateOpts.

type ActionOptsBuilder

type ActionOptsBuilder interface {
	ToRouteTableActionMap() (map[string]interface{}, error)
}

ActionOptsBuilder allows extensions to add additional parameters to the Action request: associate or disassociate subnets with a route table

type ActionResult

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

ActionResult represents the result of an action operation. Call its Extract method to interpret it as a RouteTable

func Action

Action will associate or disassociate subnets with a particular route table based on its unique ID

func (ActionResult) Extract

func (r ActionResult) Extract() (*RouteTable, error)

Extract is a function that accepts a result and extracts a route table

type ActionSubnetsOpts

type ActionSubnetsOpts struct {
	Associate    []string `json:"associate,omitempty"`
	Disassociate []string `json:"disassociate,omitempty"`
}

ActionSubnetsOpts contains the subnets list that associate or disassociate with a route tabl

type CreateOpts

type CreateOpts struct {
	// The VPC ID that the route table belongs to
	VpcID string `json:"vpc_id" required:"true"`
	// The name of the route table. The name can contain a maximum of 64 characters,
	// which may consist of letters, digits, underscores (_), hyphens (-), and periods (.).
	// The name cannot contain spaces.
	Name string `json:"name" required:"true"`
	// The supplementary information about the route table. The description can contain
	// a maximum of 255 characters and cannot contain angle brackets (< or >).
	Description string `json:"description,omitempty"`
	// The route information
	Routes []RouteOpts `json:"routes,omitempty"`
}

CreateOpts contains all the values needed to create a new route table

func (CreateOpts) ToRouteTableCreateMap

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

ToRouteTableCreateMap builds a create request body from CreateOpts

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToRouteTableCreateMap() (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 RouteTable

func Create

Create accepts a CreateOpts struct and uses the values to create a new route table

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a route table

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(c *golangsdk.ServiceClient, id string) (r DeleteResult)

Delete will permanently delete a particular route table based on its unique ID

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 RouteTable

func Get

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

Get retrieves a particular route table based on its unique ID

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a route table

type ListOpts

type ListOpts struct {
	// ID is the unique identifier for the route table
	ID string `q:"id"`
	// VpcID is the unique identifier for the vpc
	VpcID string `q:"vpc_id"`
	// SubnetID the unique identifier for the subnet
	SubnetID string `q:"subnet_id"`
	// Limit is the number of records returned for each page query, the value range is 0~intmax
	Limit int `q:"limit"`
	// Marker is the starting resource ID of the paging query,
	// which means that the query starts from the next record of the specified resource
	Marker string `q:"marker"`
}

ListOpts allows to query all route tables or filter collections by parameters Marker and Limit are used for pagination.

func (ListOpts) ToRouteTableListQuery

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

ToRouteTableListQuery formats a ListOpts into a query string

type ListOptsBuilder

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

ListOptsBuilder is an interface by which can build the request body of listing route tables

type Route

type Route struct {
	Type            string `json:"type"`
	DestinationCIDR string `json:"destination"`
	NextHop         string `json:"nexthop"`
	Description     string `json:"description"`
}

Route represents a route object in a route table

type RouteOpts

type RouteOpts struct {
	// The destination CIDR block. The destination of each route must be unique.
	// The destination cannot overlap with any subnet CIDR block in the VPC.
	Destination string `json:"destination" required:"true"`
	// the type of the next hop. value range:
	// ecs, eni, vip, nat, peering, vpn, dc, cc, egw
	Type string `json:"type" required:"true"`
	// the instance ID of next hop
	NextHop string `json:"nexthop" required:"true"`
	// The supplementary information about the route. The description can contain
	// a maximum of 255 characters and cannot contain angle brackets (< or >).
	Description *string `json:"description,omitempty"`
}

RouteOpts contains all the values needed to manage a vpc route

type RouteTable

type RouteTable struct {
	// Name is the human readable name for the route table
	Name string `json:"name"`

	// Description is the supplementary information about the route table
	Description string `json:"description"`

	// ID is the unique identifier for the route table
	ID string `json:"id"`

	// the VPC ID that the route table belongs to.
	VpcID string `json:"vpc_id"`

	// project id
	TenantID string `json:"tenant_id"`

	// Default indicates whether it is a default route table
	Default bool `json:"default"`

	// Routes is an array of static routes that the route table will host
	Routes []Route `json:"routes"`

	// Subnets is an array of subnets that associated with the route table
	Subnets []Subnet `json:"subnets"`
}

RouteTable represents a route table

func ExtractRouteTables

func ExtractRouteTables(r pagination.Page) ([]RouteTable, error)

ExtractRouteTables accepts a Page struct, specifically a RouteTablePage struct, and extracts the elements into a slice of RouteTable structs.

type RouteTablePage

type RouteTablePage struct {
	pagination.MarkerPageBase
}

RouteTablePage is the page returned by a pager when traversing over a collection of route tables

func (RouteTablePage) IsEmpty

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

IsEmpty checks whether a RouteTablePage struct is empty.

func (RouteTablePage) LastMarker

func (r RouteTablePage) LastMarker() (string, error)

LastMarker returns the last route table ID in a ListResult

type Subnet

type Subnet struct {
	ID string `json:"id"`
}

Subnet represents a subnet object associated with a route table

type UpdateOpts

type UpdateOpts struct {
	Name        string                 `json:"name,omitempty"`
	Description *string                `json:"description,omitempty"`
	Routes      map[string][]RouteOpts `json:"routes,omitempty"`
}

UpdateOpts contains the values used when updating a route table

func (UpdateOpts) ToRouteTableUpdateMap

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

ToRouteTableUpdateMap builds an update body based on UpdateOpts

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToRouteTableUpdateMap() (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 RouteTable

func Update

Update allows route tables to be updated

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a route table

Jump to

Keyboard shortcuts

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