subnets

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: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteURL

func DeleteURL(c *golangsdk.ServiceClient, subnetId string) string

func ExtractSubnets

func ExtractSubnets(r pagination.Page) ([]common.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 GetURL

func GetURL(c *golangsdk.ServiceClient, subnetId string) string

func UpdateURL

func UpdateURL(c *golangsdk.ServiceClient, subnetId string) string

Types

type CreateOpts

type CreateOpts struct {
	// Specifies the subnet name. The value is a string of 1 to 64
	// characters that can contain letters, digits, underscores (_), and hyphens (-).
	Name string `json:"name" required:"true"`

	// Specifies the network segment on which the subnet resides. The
	// value must be in CIDR format. The value must be within the CIDR block of the VPC. The
	// subnet mask cannot be greater than 28.
	Cidr string `json:"cidr" required:"true"`

	// Specifies the gateway of the subnet. The value must be a valid
	// IP address. The value must be an IP address in the subnet segment.
	GatewayIP string `json:"gateway_ip" required:"true"`

	// Specifies whether the DHCP function is enabled for the subnet.
	// The value can be true or false. If this parameter is left blank, it is set to true by
	// default.
	DhcpEnable *bool `json:"dhcp_enable,omitempty"`

	// Specifies the IP address of DNS server 1 on the subnet. The
	// value must be a valid IP address.
	PrimaryDNS string `json:"primary_dns,omitempty"`

	// Specifies the IP address of DNS server 2 on the subnet. The
	// value must be a valid IP address.
	SecondaryDNS string `json:"secondary_dns,omitempty"`

	// Specifies the DNS server address list of a subnet. This field
	// is required if you need to use more than two DNS servers. This parameter value is the
	// superset of both DNS server address 1 and DNS server address 2.
	DNSList []string `json:"dnsList,omitempty"`

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

	SiteID string `json:"site_id,omitempty" required:"true"`
}

func (CreateOpts) ToCreateMap

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

type CreateOptsBuilder

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

type CreateResult

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

func Create

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

func (CreateResult) Extract

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

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

func Delete

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

type GetResult

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

func Get

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

func (GetResult) Extract

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

type ListOpts

type ListOpts struct {
	Limit  int    `q:"limit"`
	Offset int    `q:"offset"`
	VpcID  string `q:"vpc_id"`
	SiteID string `q:"site_id"`
}

ListOpts allows the filtering collections through the API.

func (ListOpts) ToListSubnetsQuery

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

ToListSubnetsQuery converts ListSubnetsOpts structures to query string

type ListResult

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

func List

List returns collection of subnets.

func (ListResult) Extract

func (r ListResult) Extract() (*Subnets, error)

type ListSubnetsOptsBuilder

type ListSubnetsOptsBuilder interface {
	ToListSubnetsQuery() (string, error)
}

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.

type Subnets

type Subnets struct {
	Subnets []common.Subnet `json:"subnets"`
	Count   int             `json:"count"`
}

Subnets vpc列表对象

type UpdateOpts

type UpdateOpts struct {
	// Specifies the subnet name. The value is a string of 1 to 64
	// characters that can contain letters, digits, underscores (_), and hyphens (-).
	Name string `json:"name" required:"true"`

	// Specifies whether the DHCP function is enabled for the subnet.
	// The value can be true or false. If this parameter is left blank, it is set to true by
	// default.
	DhcpEnable *bool `json:"dhcp_enable,omitempty"`

	// Specifies the IP address of DNS server 1 on the subnet. The
	// value must be a valid IP address.
	PrimaryDNS string `json:"primary_dns,omitempty"`

	// Specifies the IP address of DNS server 2 on the subnet. The
	// value must be a valid IP address.
	SecondaryDNS string `json:"secondary_dns,omitempty"`

	// Specifies the DNS server address list of a subnet. This field
	// is required if you need to use more than two DNS servers. This parameter value is the
	// superset of both DNS server address 1 and DNS server address 2.
	DNSList *[]string `json:"dnsList,omitempty"`
}

func (UpdateOpts) ToUpdateMap

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

type UpdateOptsBuilder

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

type UpdateResp

type UpdateResp struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

type UpdateResult

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

func Update

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

func (UpdateResult) Extract

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

type VpcResponse

type VpcResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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