vpc

package
v0.0.0-...-4f1c8e6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Endpoint = map[string]string{
	"bj": "bcc.bj.baidubce.com",
	"gz": "bcc.gz.baidubce.com",
	"su": "bcc.su.baidubce.com",
	"bd": "bcc.bd.baidubce.com",
	"hk": "bcc.hkg.baidubce.com",
}

Endpoint contains all endpoints of Baidu Cloud BCC.

Functions

This section is empty.

Types

type Client

type Client struct {
	*bce.Client
}

Client is the VPC client implemention for Baidu Cloud VPC API.

func NewVPCClient

func NewVPCClient(config *bce.Config) *Client

NewVPCClient client for VPC

func (*Client) CreateRouteRule

func (c *Client) CreateRouteRule(args *CreateRouteRuleArgs) (string, error)

CreateRouteRule create a route rule

func (*Client) CreateSubnet

func (c *Client) CreateSubnet(args *CreateSubnetArgs) (string, error)

CreateSubnet 在VPC中创建子网

func (*Client) DeleteRoute

func (c *Client) DeleteRoute(routeID string) error

DeleteRoute delete a route http://gollum.baidu.com/Logical-Network-API#删除路由规则

func (*Client) DescribeSubnet

func (c *Client) DescribeSubnet(subnetId string) (*Subnet, error)

DescribeSubnet 查询指定子网的详细信息

func (*Client) GetURL

func (c *Client) GetURL(objectKey string, params map[string]string) string

GetURL generates the full URL of http request for Baidu Cloud VPC API.

func (*Client) ListRouteTable

func (c *Client) ListRouteTable(args *ListRouteArgs) ([]RouteRule, error)

ListRouteTable list all routes

func (*Client) ListSubnet

func (c *Client) ListSubnet(params map[string]string) ([]*Subnet, error)

ListSubnet 查询指定VPC的所有子网列表信息

type CreateRouteResponse

type CreateRouteResponse struct {
	RouteRuleID string `json:"routeRuleId"`
}

CreateRouteResponse define response of creating route

type CreateRouteRuleArgs

type CreateRouteRuleArgs struct {
	RouteTableID  string `json:"routeTableId"`
	SourceAddress string `json:"sourceAddress"`
	// 源地址,源地址可以是0.0.0.0/0,
	// 否则匹配路由表的流量源必须属于该VPC下某子网,
	// 源地址选择自定义时,自定义网段需在已有子网范围内
	DestinationAddress string `json:"destinationAddress"`
	// 目的地址,目的地址可以是0.0.0.0/0,
	// 否则目的地址不能与本VPC cidr重叠
	// (目的网段或本VPC cidr为0.0.0.0/0时例外)
	NexthopID string `json:"nexthopId,omitempty"`
	// 下一跳id,当nexthopType是本地网关类型时,
	// 该字段可以为空
	NexthopType string `json:"nexthopType"`
	// 路由类型。Bcc类型是"custom";
	// VPN类型是"vpn";NAT类型是"nat";本地网关类型是"defaultGateway"
	Description string `json:"description"`
}

CreateRouteRuleArgs define args create route http://gollum.baidu.com/Logical-Network-API#创建路由规则

type CreateSubnetArgs

type CreateSubnetArgs struct {
	Name        string `json:"name"`
	ZoneName    string `json:"zoneName"`
	Cidr        string `json:"cidr"`
	VpcID       string `json:"vpcId"`
	SubnetType  string `json:"subnetType,omitempty"`
	Description string `json:"description,omitempty"`
}

CreateSubnetArgs define args create a subnet

type CreateSubnetResponse

type CreateSubnetResponse struct {
	SubnetID string `json:"subnetId"`
}

CreateSubnetResponse define response of creating a subnet

type CreateVpcArgs

type CreateVpcArgs struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Cidr        string `json:"cidr"`
}

CreateVpcArgs define args for creating vpc

type CreateVpcResponse

type CreateVpcResponse struct {
	VpcID string `json:"vpcId"`
}

CreateVpcResponse define response

type DescribeSubnetResponse

type DescribeSubnetResponse struct {
	Subnet *Subnet `json:"subnet"`
}

DescribeSubnetResponse json

type ListRouteArgs

type ListRouteArgs struct {
	RouteTableID string `json:"routeTableId"`
	VpcID        string `json:"vpcId"`
}

ListRouteArgs define listroute args

type ListRouteResponse

type ListRouteResponse struct {
	RouteTableID string      `json:"routeTableId"`
	VpcID        string      `json:"vpcId"`
	RouteRules   []RouteRule `json:"routeRules"`
}

ListRouteResponse define response of list route

type ListSubnetResponse

type ListSubnetResponse struct {
	Marker      string    `json:"marker"`
	IsTruncated bool      `json:"isTruncated"`
	NextMarker  string    `json:"nextMarker"`
	MaxKeys     int       `json:"maxKeys"`
	Subnets     []*Subnet `json:"subnets"`
}

ListSubnetResponse json

type ListVpcArgs

type ListVpcArgs struct {
	IsDefault bool `json:"isDefault"`
}

ListVpcArgs args

type ListVpcResponse

type ListVpcResponse struct {
	Vpcs []Vpc `json:"vpcs"`
}

ListVpcResponse define list vpc response

type RouteRule

type RouteRule struct {
	RouteRuleID        string `json:"routeRuleId"`
	RouteTableID       string `json:"routeTableId"`
	SourceAddress      string `json:"sourceAddress"`
	DestinationAddress string `json:"destinationAddress"`
	NexthopID          string `json:"nexthopId"`
	NexthopType        string `json:"nexthopType"`
	Description        string `json:"description"`
}

RouteRule define route

type ShowVpc

type ShowVpc struct {
	VpcID       string   `json:"vpcId"`
	Name        string   `json:"name"`
	CIDR        string   `json:"cidr"`
	Description string   `json:"description"`
	IsDefault   bool     `json:"isDefault"`
	Subnets     []Subnet `json:"subnets"`
}

ShowVpc define ShowVpcModel

type Subnet

type Subnet struct {
	SubnetID    string `json:"subnetId"`
	Name        string `json:"name"`
	ZoneName    string `json:"zoneName"`
	Cidr        string `json:"cidr"`
	VpcID       string `json:"vpcId"`
	SubnetType  string `json:"subnetType"`
	Description string `json:"description"`
}

Subnet define subnet of vpc

type Vpc

type Vpc struct {
	VpcID       string `json:"vpcId"`
	Name        string `json:"name"`
	CIDR        string `json:"cidr"`
	Description string `json:"description"`
	IsDefault   bool   `json:"isDefault"`
}

Vpc type define

Jump to

Keyboard shortcuts

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