-
Notifications
You must be signed in to change notification settings - Fork 245
/
rules.go
130 lines (112 loc) · 2.82 KB
/
rules.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package slb
import "github.com/denverdino/aliyungo/common"
type CreateRulesResponse struct {
common.Response
}
type CreateRulesArgs struct {
RegionId common.Region
LoadBalancerId string
ListenerPort int
RuleList string
}
type Rule struct {
RuleId string
RuleName string
Domain string
Url string `json:",omitempty"`
VServerGroupId string
}
type Rules struct {
Rule []Rule
}
// Create forward rules
//
// You can read doc at https://help.aliyun.com/document_detail/35226.html?spm=5176.doc35226.6.671.625Omh
func (client *Client) CreateRules(args *CreateRulesArgs) error {
response := CreateRulesResponse{}
err := client.Invoke("CreateRules", args, &response)
if err != nil {
return err
}
return err
}
type DeleteRulesArgs struct {
RegionId common.Region
RuleIds string
}
type DeleteRulesResponse struct {
common.Response
}
// Delete forward rules
//
// You can read doc at https://help.aliyun.com/document_detail/35227.html?spm=5176.doc35226.6.672.6iNBtR
func (client *Client) DeleteRules(args *DeleteRulesArgs) error {
response := DeleteRulesResponse{}
err := client.Invoke("DeleteRules", args, &response)
if err != nil {
return err
}
return err
}
type SetRuleArgs struct {
RegionId common.Region
RuleId string
VServerGroupId string
}
type SetRuleResponse struct {
common.Response
}
// Modify forward rules
//
// You can read doc at https://help.aliyun.com/document_detail/35228.html?spm=5176.doc35227.6.673.rq40a9
func (client *Client) SetRule(args *SetRuleArgs) error {
response := SetRuleResponse{}
err := client.Invoke("SetRule", args, &response)
if err != nil {
return err
}
return err
}
type DescribeRuleAttributeArgs struct {
RegionId common.Region
RuleId string
}
type DescribeRuleAttributeResponse struct {
common.Response
LoadBalancerId string
ListenerPort int
Rule
}
// Describe rule
//
// You can read doc at https://help.aliyun.com/document_detail/35229.html?spm=5176.doc35226.6.674.DRJeKJ
func (client *Client) DescribeRuleAttribute(args *DescribeRuleAttributeArgs) (*DescribeRuleAttributeResponse, error) {
response := &DescribeRuleAttributeResponse{}
err := client.Invoke("DescribeRuleAttribute", args, response)
if err != nil {
return nil, err
}
return response, nil
}
type DescribeRulesArgs struct {
RegionId common.Region
LoadBalancerId string
ListenerPort int
}
type DescribeRulesResponse struct {
common.Response
Rules struct {
Rule []Rule
}
}
// Describe rule
//
// You can read doc at https://help.aliyun.com/document_detail/35229.html?spm=5176.doc35226.6.674.DRJeKJ
func (client *Client) DescribeRules(args *DescribeRulesArgs) (*DescribeRulesResponse, error) {
response := &DescribeRulesResponse{}
err := client.Invoke("DescribeRules", args, response)
if err != nil {
return nil, err
}
return response, nil
}