1+ // Copyright 2018 JDCLOUD.COM
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+ //
15+ // NOTE: This class is auto generated by the jdcloud code generator program.
16+
17+ package apis
18+
19+ import (
20+ "github.com/jdcloud-api/jdcloud-sdk-go/core"
21+ starshield "github.com/jdcloud-api/jdcloud-sdk-go/services/starshield/models"
22+ )
23+
24+ type CreateRuleRequest struct {
25+
26+ core.JDCloudRequest
27+
28+ /* */
29+ Zone_id string `json:"zone_id"`
30+
31+ /* */
32+ Ruleset_id string `json:"ruleset_id"`
33+
34+ /* 是否开启规则,有效值true/false。 (Optional) */
35+ Enabled * bool `json:"enabled"`
36+
37+ /* 规则的描述。 (Optional) */
38+ Description * string `json:"description"`
39+
40+ /* 表达式。 (Optional) */
41+ Expression * string `json:"expression"`
42+
43+ /* 当表达式匹配时,采取的措施。有效值block(阻止)/challenge(交互式质询)/js_challenge(JS质询)/managed_challenge(托管质询)/log(记录)/rewrite/skip(跳过)/execute。 (Optional) */
44+ Action * string `json:"action"`
45+
46+ /* (Optional) */
47+ Action_parameters * starshield.Action_parameters `json:"action_parameters"`
48+
49+ /* (Optional) */
50+ Ratelimit * starshield.Ratelimit `json:"ratelimit"`
51+ }
52+
53+ /*
54+ * param zone_id: (Required)
55+ * param ruleset_id: (Required)
56+ *
57+ * @Deprecated, not compatible when mandatory parameters changed
58+ */
59+ func NewCreateRuleRequest (
60+ zone_id string ,
61+ ruleset_id string ,
62+ ) * CreateRuleRequest {
63+
64+ return & CreateRuleRequest {
65+ JDCloudRequest : core.JDCloudRequest {
66+ URL : "/zones/{zone_id}/rulesets/{ruleset_id}/rules" ,
67+ Method : "POST" ,
68+ Header : nil ,
69+ Version : "v1" ,
70+ },
71+ Zone_id : zone_id ,
72+ Ruleset_id : ruleset_id ,
73+ }
74+ }
75+
76+ /*
77+ * param zone_id: (Required)
78+ * param ruleset_id: (Required)
79+ * param enabled: 是否开启规则,有效值true/false。 (Optional)
80+ * param description: 规则的描述。 (Optional)
81+ * param expression: 表达式。 (Optional)
82+ * param action: 当表达式匹配时,采取的措施。有效值block(阻止)/challenge(交互式质询)/js_challenge(JS质询)/managed_challenge(托管质询)/log(记录)/rewrite/skip(跳过)/execute。 (Optional)
83+ * param action_parameters: (Optional)
84+ * param ratelimit: (Optional)
85+ */
86+ func NewCreateRuleRequestWithAllParams (
87+ zone_id string ,
88+ ruleset_id string ,
89+ enabled * bool ,
90+ description * string ,
91+ expression * string ,
92+ action * string ,
93+ action_parameters * starshield.Action_parameters ,
94+ ratelimit * starshield.Ratelimit ,
95+ ) * CreateRuleRequest {
96+
97+ return & CreateRuleRequest {
98+ JDCloudRequest : core.JDCloudRequest {
99+ URL : "/zones/{zone_id}/rulesets/{ruleset_id}/rules" ,
100+ Method : "POST" ,
101+ Header : nil ,
102+ Version : "v1" ,
103+ },
104+ Zone_id : zone_id ,
105+ Ruleset_id : ruleset_id ,
106+ Enabled : enabled ,
107+ Description : description ,
108+ Expression : expression ,
109+ Action : action ,
110+ Action_parameters : action_parameters ,
111+ Ratelimit : ratelimit ,
112+ }
113+ }
114+
115+ /* This constructor has better compatible ability when API parameters changed */
116+ func NewCreateRuleRequestWithoutParam () * CreateRuleRequest {
117+
118+ return & CreateRuleRequest {
119+ JDCloudRequest : core.JDCloudRequest {
120+ URL : "/zones/{zone_id}/rulesets/{ruleset_id}/rules" ,
121+ Method : "POST" ,
122+ Header : nil ,
123+ Version : "v1" ,
124+ },
125+ }
126+ }
127+
128+ /* param zone_id: (Required) */
129+ func (r * CreateRuleRequest ) SetZone_id (zone_id string ) {
130+ r .Zone_id = zone_id
131+ }
132+ /* param ruleset_id: (Required) */
133+ func (r * CreateRuleRequest ) SetRuleset_id (ruleset_id string ) {
134+ r .Ruleset_id = ruleset_id
135+ }
136+ /* param enabled: 是否开启规则,有效值true/false。(Optional) */
137+ func (r * CreateRuleRequest ) SetEnabled (enabled bool ) {
138+ r .Enabled = & enabled
139+ }
140+ /* param description: 规则的描述。(Optional) */
141+ func (r * CreateRuleRequest ) SetDescription (description string ) {
142+ r .Description = & description
143+ }
144+ /* param expression: 表达式。(Optional) */
145+ func (r * CreateRuleRequest ) SetExpression (expression string ) {
146+ r .Expression = & expression
147+ }
148+ /* param action: 当表达式匹配时,采取的措施。有效值block(阻止)/challenge(交互式质询)/js_challenge(JS质询)/managed_challenge(托管质询)/log(记录)/rewrite/skip(跳过)/execute。(Optional) */
149+ func (r * CreateRuleRequest ) SetAction (action string ) {
150+ r .Action = & action
151+ }
152+ /* param action_parameters: (Optional) */
153+ func (r * CreateRuleRequest ) SetAction_parameters (action_parameters * starshield.Action_parameters ) {
154+ r .Action_parameters = action_parameters
155+ }
156+ /* param ratelimit: (Optional) */
157+ func (r * CreateRuleRequest ) SetRatelimit (ratelimit * starshield.Ratelimit ) {
158+ r .Ratelimit = ratelimit
159+ }
160+
161+
162+ // GetRegionId returns path parameter 'regionId' if exist,
163+ // otherwise return empty string
164+ func (r CreateRuleRequest ) GetRegionId () string {
165+ return ""
166+ }
167+
168+ type CreateRuleResponse struct {
169+ RequestID string `json:"requestId"`
170+ Error core.ErrorResponse `json:"error"`
171+ Result CreateRuleResult `json:"result"`
172+ }
173+
174+ type CreateRuleResult struct {
175+ Data starshield.RuleSet `json:"data"`
176+ }
0 commit comments