routetables

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (err error)

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

func Update

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) error

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

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 table

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"`
}

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.

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"`
	// Specifies the time (UTC) when the route table is created.
	CreatedAt string `json:"created_at"`
	// Specifies the time (UTC) when the route table is updated.
	UpdatedAt string `json:"updated_at"`
}

RouteTable represents a route table

func Action

func Action(client *golangsdk.ServiceClient, id string, opts ActionOpts) (*RouteTable, error)

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

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*RouteTable, error)

func ExtractRouteTables

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

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

func Get

func Get(client *golangsdk.ServiceClient, id string) (*RouteTable, error)

func List

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

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.

type RouteTablePage

type RouteTablePage struct {
	pagination.NewSinglePageBase
}

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

Jump to

Keyboard shortcuts

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