rules

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Update

func Update(c *golangsdk.ServiceClient, instnaceId, ip, ruleId string, opts UpdateOpts) error

Update is a method to update the configurations of the forward rule using given parameters.

Types

type BatchCreateOpts

type BatchCreateOpts struct {
	// Forwarding rules created in batches.
	Rules []RuleOpts `json:"rules,omitempty"`
}

BatchCreateOpts is the structure required by the BatchCreate method to batch create at least one forward rule.

type BatchDeleteOpts

type BatchDeleteOpts struct {
	RuleIds []string `json:"ids" required:"true"`
}

BatchDeleteOpts is the structure required by the BatchDelete method to batch delete at least one forward rule.

type BatchResp

type BatchResp struct {
	SuccessNum int `json:"successNum"`
}

BatchResp is the structure that represents the API request response for the create and delete methods.

func BatchCreate

func BatchCreate(c *golangsdk.ServiceClient, instnaceId, ip string, opts BatchCreateOpts) (*BatchResp, error)

BatchCreate is a method to to batch create at least one forward rule using given parameters.

func BatchDelete

func BatchDelete(c *golangsdk.ServiceClient, instnaceId, ip string, opts BatchDeleteOpts) (*BatchResp, error)

BatchDelete is a method to to batch delete at least one forward rule using given parameters.

type ListResp

type ListResp struct {
	Count int    `json:"count"`
	Rules []Rule `json:"rules"`
}

ListResp is the structure that represents the API request response for list method.

type Rule

type Rule struct {
	ID              string `json:"rule_id"`
	ForwardProtocol string `json:"forward_protocol"`
	ForwardPort     int    `json:"forward_port"`
	SourcePort      int    `json:"source_port"`
	SourceIp        string `json:"source_ip"`
	LbMethod        string `json:"lb_method"`
	Status          int    `json:"status"`
}

Rule is the structure that represents the details of the forward rule.

func List

func List(c *golangsdk.ServiceClient, instnaceId, ip string) ([]Rule, error)

List is a method to query the list of the forward rule using given opts.

type RuleOpts

type RuleOpts struct {
	// The forward protocol.
	ForwardProtocol string `json:"forward_protocol" required:"true"`
	// The forward port.
	// The valid value is range from 1 to 65535.
	ForwardPort int `json:"forward_port" required:"true"`
	// The source port.
	// The valid value is range from 1 to 65535.
	SourcePort int `json:"source_port" required:"true"`
	// The source IP list, separate the IPs with commas.
	SourceIp string `json:"source_ip" required:"true"`
}

RuleOpts is the object that represents the forwarding rule configuration structure.

type UpdateOpts

type UpdateOpts struct {
	// The forward protocol.
	ForwardProtocol string `json:"forward_protocol" required:"true"`
	// The forward port.
	// The valid value is range from 1 to 65535.
	ForwardPort int `json:"forward_port" required:"true"`
	// The source port.
	// The valid value is range from 1 to 65535.
	SourcePort int `json:"source_port" required:"true"`
	// The source IP list, separate the IPs with commas.
	SourceIp string `json:"source_ip" required:"true"`
}

UpdateOpts is the structure required by the Update method to update the configurations of the forward rule.

Jump to

Keyboard shortcuts

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