@@ -16,6 +16,7 @@ type RuleType string
1616type CompareType string
1717
1818const (
19+ ActionRedirectPrefix Action = "REDIRECT_PREFIX"
1920 ActionRedirectToPool Action = "REDIRECT_TO_POOL"
2021 ActionRedirectToURL Action = "REDIRECT_TO_URL"
2122 ActionReject Action = "REJECT"
@@ -42,7 +43,7 @@ type CreateOpts struct {
4243 // The ID of the listener.
4344 ListenerID string `json:"listener_id,omitempty"`
4445
45- // The L7 policy action. One of REDIRECT_TO_POOL, REDIRECT_TO_URL, or REJECT.
46+ // The L7 policy action. One of REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, or REJECT.
4647 Action Action `json:"action" required:"true"`
4748
4849 // The position of this policy on the listener.
@@ -55,6 +56,10 @@ type CreateOpts struct {
5556 // Only administrative users can specify a project UUID other than their own.
5657 ProjectID string `json:"project_id,omitempty"`
5758
59+ // Requests matching this policy will be redirected to this Prefix URL.
60+ // Only valid if action is REDIRECT_PREFIX.
61+ RedirectPrefix string `json:"redirect_prefix,omitempty"`
62+
5863 // Requests matching this policy will be redirected to the pool with this ID.
5964 // Only valid if action is REDIRECT_TO_POOL.
6065 RedirectPoolID string `json:"redirect_pool_id,omitempty"`
@@ -63,6 +68,11 @@ type CreateOpts struct {
6368 // Only valid if action is REDIRECT_TO_URL.
6469 RedirectURL string `json:"redirect_url,omitempty"`
6570
71+ // Requests matching this policy will be redirected to the specified URL or Prefix URL
72+ // with the HTTP response code. Valid if action is REDIRECT_TO_URL or REDIRECT_PREFIX.
73+ // Valid options are: 301, 302, 303, 307, or 308. Default is 302. Requires version 2.9
74+ RedirectHttpCode int32 `json:"redirect_http_code,omitempty"`
75+
6676 // The administrative state of the Loadbalancer. A valid value is true (UP)
6777 // or false (DOWN).
6878 AdminStateUp * bool `json:"admin_state_up,omitempty"`
@@ -169,7 +179,7 @@ type UpdateOpts struct {
169179 // Name of the L7 policy, empty string is allowed.
170180 Name * string `json:"name,omitempty"`
171181
172- // The L7 policy action. One of REDIRECT_TO_POOL, REDIRECT_TO_URL, or REJECT.
182+ // The L7 policy action. One of REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, or REJECT.
173183 Action Action `json:"action,omitempty"`
174184
175185 // The position of this policy on the listener.
@@ -178,6 +188,10 @@ type UpdateOpts struct {
178188 // A human-readable description for the resource, empty string is allowed.
179189 Description * string `json:"description,omitempty"`
180190
191+ // Requests matching this policy will be redirected to this Prefix URL.
192+ // Only valid if action is REDIRECT_PREFIX.
193+ RedirectPrefix * string `json:"redirect_prefix,omitempty"`
194+
181195 // Requests matching this policy will be redirected to the pool with this ID.
182196 // Only valid if action is REDIRECT_TO_POOL.
183197 RedirectPoolID * string `json:"redirect_pool_id,omitempty"`
@@ -186,6 +200,11 @@ type UpdateOpts struct {
186200 // Only valid if action is REDIRECT_TO_URL.
187201 RedirectURL * string `json:"redirect_url,omitempty"`
188202
203+ // Requests matching this policy will be redirected to the specified URL or Prefix URL
204+ // with the HTTP response code. Valid if action is REDIRECT_TO_URL or REDIRECT_PREFIX.
205+ // Valid options are: 301, 302, 303, 307, or 308. Default is 302. Requires version 2.9
206+ RedirectHttpCode int32 `json:"redirect_http_code,omitempty"`
207+
189208 // The administrative state of the Loadbalancer. A valid value is true (UP)
190209 // or false (DOWN).
191210 AdminStateUp * bool `json:"admin_state_up,omitempty"`
@@ -208,6 +227,14 @@ func (opts UpdateOpts) ToL7PolicyUpdateMap() (map[string]interface{}, error) {
208227 m ["redirect_url" ] = nil
209228 }
210229
230+ if m ["redirect_prefix" ] == "" {
231+ m ["redirect_prefix" ] = nil
232+ }
233+
234+ if m ["redirect_http_code" ] == 0 {
235+ m ["redirect_http_code" ] = nil
236+ }
237+
211238 return b , nil
212239}
213240
0 commit comments