Updating a Forwarding Policy¶
Function¶
This API is used to update a forwarding policy.
URI¶
PUT /v3/{project_id}/elb/l7policies/{l7policy_id}
Parameter | Mandatory | Type | Description |
---|---|---|---|
l7policy_id | Yes | String | Specifies the forwarding policy ID. |
project_id | Yes | String | Specifies the project ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | Specifies the token used for IAM authentication. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
l7policy | Yes | UpdateL7PolicyOption object | Specifies the forwarding policy. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
admin_state_up | No | Boolean | Specifies the administrative status of the forwarding policy. The default value is true. This parameter is unsupported. Please do not use it. |
description | No | String | Provides supplementary information about the forwarding policy. Minimum: 0 Maximum: 255 |
name | No | String | Specifies the forwarding policy name. Minimum: 0 Maximum: 255 |
redirect_listener_id | No | String | Specifies the ID of the listener to which requests are redirected. Note:
|
redirect_pool_id | No | String | Specifies the ID of the backend server group that requests will be forwarded to.
|
redirect_url_config | No | UpdateRedirectUrlConfig object | Specifies the URL to which requests are forwarded. For dedicated load balancers, this parameter will take effect only when advanced forwarding is enabled (enhance_l7policy_enable is set to true). If it is passed when enhance_l7policy_enable is set to false, an error will be returned. This parameter is mandatory when action is set to REDIRECT_TO_URL. It cannot be specified if the value of action is not REDIRECT_TO_URL. Format: protocol://host:port/path?query At least one of the four parameters (protocol, host, port, and path) must be passed, or their values cannot be set to ${xxx} at the same time. (${xxx} indicates that the value in the request will be inherited. For example, ${host} indicates the host in the URL to be redirected.) The values of protocol and port cannot be the same as those of the associated listener, and either host or path must be passed or their values cannot be ${xxx} at the same time. For shared load balancers, this parameter is unsupported. If it is passed, an error will be returned. |
fixed_response_config | No | UpdateFixtedResponseConfig object | Specifies the configuration of the page that will be returned. This parameter will take effect when enhance_l7policy_enable is set to true. If this parameter is passed and enhance_l7policy_enable is set to false, an error will be returned. This parameter is mandatory when action is set to FIXED_RESPONSE. It cannot be specified if the value of action is not FIXED_RESPONSE. For shared load balancers, this parameter is unsupported. If it is passed, an error will be returned. |
rules | No | Array of CreateRuleOption objects | Lists the forwarding rules in the forwarding policy. The list can contain a maximum of 10 forwarding rules (if conditions is specified, a condition is considered as a rule). If type is set to HOST_NAME, PATH, METHOD, or SOURCE_IP, only one forwarding rule can be created for each type. For details, see the description of l7rule. |
priority | No | Integer | Specifies the forwarding policy priority. A smaller value indicates a higher priority. The value must be unique for forwarding policies of the same listener. This parameter will take effect only when enhance_l7policy_enable is set to true. If this parameter is passed and enhance_l7policy_enable is set to false, an error will be returned. This parameter is unsupported for shared load balancers.
This parameter is invalid for shared load balancers. Minimum: 0 Maximum: 10000 |
redirect_pools_config | No | Array of CreateRedirectPoolsConfig objects | Specifies the configuration of the backend server group that the requests are forwarded to. This parameter is valid only when action is set to REDIRECT_TO_POOL. Note:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
protocol | No | String | Specifies the protocol for redirection. The value can be HTTP, HTTPS, or ${protocol}. The default value is ${protocol}, indicating that the protocol of the request will be used. Minimum: 1 Maximum: 36 |
host | No | String | Specifies the host name that requests are redirected to. The value can contain only letters, digits, hyphens (-), and periods (.) and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. Default: ${host} Minimum: 1 Maximum: 128 |
port | No | String | Specifies the port that requests are redirected to. The default value is ${port}, indicating that the port of the request will be used. Default: ${port} Minimum: 1 Maximum: 16 |
path | No | String | Specifies the path that requests are redirected to. The default value is ${path}, indicating that the path of the request will be used. The value can contain only letters, digits, and special characters _-';@^- Default: ${path} Minimum: 1 Maximum: 128 |
query | No | String | Specifies the query string set in the URL for redirection. The default value is ${query}, indicating that the query string of the request will be used. The value is case-sensitive and can contain only letters, digits, and special characters For example, in the URL https://www.example.com:8080/elb?type=loadbalancer, ${query} indicates type=loadbalancer. If this parameter is set to ${query}&name=my_name, the URL will be redirected to https://www.example.com:8080/elb?type=loadbalancer&name=my_name. Default: ${query} Minimum: 0 Maximum: 128 |
status_code | No | String | Specifies the status code returned after the requests are redirected. The value can be 301, 302, 303, 307, or 308. Minimum: 1 Maximum: 16 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
status_code | No | String | Specifies the HTTP status code configured in the forwarding rule. The value can be any integer in the range of 200-299, 400-499, or 500-599. Minimum: 1 Maximum: 16 |
content_type | No | String | Specifies the format of the response body. The value can be text/plain, text/css, text/html, application/javascript, or application/json. Minimum: 1 Maximum: 64 |
message_body | No | String | Specifies the content of the response message body. Minimum: 0 Maximum: 1024 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
admin_state_up | No | Boolean | Specifies the administrative status of the forwarding rule. The default value is true. This parameter is unsupported. Please do not use it. |
compare_type | Yes | String | Specifies how requests are matched with the forwarding rule. Values:
Note:
|
key | No | String | Specifies the key of match content. For example, if the request header is used for forwarding, key is the request header. This parameter is unsupported. Please do not use it. Minimum: 0 Maximum: 255 |
value | Yes | String | Specifies the value of the match content. For example, if a domain name is used for matching, value is the domain name. This parameter is valid only when conditions is left blank.
Minimum: 1 Maximum: 128 |
project_id | No | String | Specifies the project ID. Minimum: 32 Maximum: 32 |
type | Yes | String | Specifies the match content. The value can be one of the following:
|
invert | No | Boolean | Specifies whether reverse matching is supported. The value can be true or false (default). This parameter is unsupported. Please do not use it. |
conditions | No | Array of CreateRuleCondition objects | Specifies the matching conditions of the forwarding rule. This parameter is available only when enhance_l7policy_enable is set to true. If conditions is specified, parameters key and value will not take effect, and the conditions value will contain all conditions configured for the forwarding rule. The keys in the list must be the same, whereas each value must be unique. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | No | String | Specifies the key of match item.
All keys in the conditions list in the same rule must be the same. Minimum: 1 Maximum: 128 |
value | Yes | String | Specifies the value of the match item.
All keys in the conditions list in the same rule must be the same. Minimum: 1 Maximum: 128 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
pool_id | Yes | String | Specifies the ID of the backend server group. |
weight | Yes | Integer | Specifies the weight of the backend server group. The value ranges from 0 to 100. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID. The value is automatically generated. |
l7policy | L7Policy object | Specifies the forwarding policy. |
Parameter | Type | Description |
---|---|---|
action | String | Specifies where requests will be forwarded. The value can be one of the following:
REDIRECT_TO_LISTENER has the highest priority. If requests are to be redirected to an HTTPS listener, other forwarding policies of the listener will become invalid. Note:
|
admin_state_up | Boolean | Specifies the administrative status of the forwarding policy. The default value is true. This parameter is unsupported. Please do not use it. |
description | String | Provides supplementary information about the forwarding policy. |
id | String | Specifies the forwarding policy ID. |
listener_id | String | Specifies the ID of the listener to which the forwarding policy is added. |
name | String | Specifies the forwarding policy name. Minimum: 1 Maximum: 255 |
position | Integer | Specifies the forwarding policy priority. This parameter cannot be updated. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 100 |
priority | Integer | Specifies the forwarding policy priority. A smaller value indicates a higher priority. The value must be unique for forwarding policies of the same listener. This parameter will take effect only when enhance_l7policy_enable is set to true. If this parameter is passed and enhance_l7policy_enable is set to false, an error will be returned. This parameter is unsupported for shared load balancers.
This parameter is invalid for shared load balancers. |
project_id | String | Specifies the project ID of the forwarding policy. |
provisioning_status | String | Specifies the provisioning status of the forwarding policy. The value can be ACTIVE or ERROR.
|
redirect_pool_id | String | Specifies the ID of the backend server group that requests will be forwarded to.
|
redirect_pools_config | Array of CreateRedirectPoolsConfig objects | Specifies the configuration of the backend server group that the requests are forwarded to. This parameter is valid only when action is set to REDIRECT_TO_POOL. |
redirect_listener_id | String | Specifies the ID of the listener to which requests are redirected. This parameter is mandatory when action is set to REDIRECT_TO_LISTENER. Note:
|
redirect_url | String | Specifies the URL to which requests are forwarded. Format: protocol://host:port/path?query This parameter is unsupported. Please do not use it. |
rules | Array of RuleRef objects | Lists the forwarding rules in the forwarding policy. |
redirect_url_config | RedirectUrlConfig object | Specifies the URL to which requests are forwarded. For dedicated load balancers, this parameter will take effect only when advanced forwarding is enabled (enhance_l7policy_enable is set to true). If it is passed when enhance_l7policy_enable is set to false, an error will be returned. This parameter is mandatory when action is set to REDIRECT_TO_URL. It cannot be specified if the value of action is not REDIRECT_TO_URL. Format: protocol://host:port/path?query At least one of the four parameters (protocol, host, port, and path) must be passed, or their values cannot be set to ${xxx} at the same time. (${xxx} indicates that the value in the request will be inherited. For example, ${host} indicates the host in the URL to be redirected.) The values of protocol and port cannot be the same as those of the associated listener, and either host or path must be passed or their values cannot be ${xxx} at the same time. For shared load balancers, this parameter is unsupported. If it is passed, an error will be returned. |
fixed_response_config | FixtedResponseConfig object | Specifies the configuration of the page that will be returned. This parameter will take effect when enhance_l7policy_enable is set to true. If this parameter is passed and enhance_l7policy_enable is set to false, an error will be returned. This parameter is mandatory when action is set to FIXED_RESPONSE. It cannot be specified if the value of action is not FIXED_RESPONSE. For shared load balancers, this parameter is unsupported. If it is passed, an error will be returned. |
created_at | String | Specifies the time when the forwarding policy was added. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). This is a new field in this version, and it will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers. |
updated_at | String | Specifies the time when the forwarding policy was updated. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time). This is a new field in this version, and it will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers. |
Parameter | Type | Description |
---|---|---|
pool_id | String | Specifies the ID of the backend server group. |
weight | Integer | Specifies the weight of the backend server group. The value ranges from 0 to 100. |
Parameter | Type | Description |
---|---|---|
id | String | Specifies the forwarding rule ID. |
Parameter | Type | Description |
---|---|---|
protocol | String | Specifies the protocol for redirection. The value can be HTTP, HTTPS, or ${protocol}. The default value is ${protocol}, indicating that the protocol of the request will be used. Minimum: 1 Maximum: 36 |
host | String | Specifies the host name that requests are redirected to. The value can contain only letters, digits, hyphens (-), and periods (.) and must start with a letter or digit. The default value is ${host}, indicating that the host of the request will be used. Default: ${host} Minimum: 1 Maximum: 128 |
port | String | Specifies the port that requests are redirected to. The default value is ${port}, indicating that the port of the request will be used. Default: ${port} Minimum: 1 Maximum: 16 |
path | String | Specifies the path that requests are redirected to. The default value is ${path}, indicating that the path of the request will be used. The value can contain only letters, digits, and special characters _-';@^- Default: ${path} Minimum: 1 Maximum: 128 |
query | String | Specifies the query string set in the URL for redirection. The default value is ${query}, indicating that the query string of the request will be used. For example, in the URL https://www.example.com:8080/elb?type=loadbalancer, ${query} indicates type=loadbalancer. If this parameter is set to ${query}&name=my_name, the URL will be redirected to https://www.example.com:8080/elb?type=loadbalancer&name=my_name. The value is case-sensitive and can contain only letters, digits, and special characters Default: ${query} Minimum: 0 Maximum: 128 |
status_code | String | Specifies the status code returned after the requests are redirected. The value can be 301, 302, 303, 307, or 308. Minimum: 1 Maximum: 16 |
Parameter | Type | Description |
---|---|---|
status_code | String | Specifies the HTTP status code configured in the forwarding policy. The value can be any integer in the range of 200-299, 400-499, or 500-599. Minimum: 1 Maximum: 16 |
content_type | String | Specifies the format of the response body. The value can be text/plain, text/css, text/html, application/javascript, or application/json. Minimum: 0 Maximum: 32 |
message_body | String | Specifies the content of the response message body. Minimum: 0 Maximum: 1024 |
Example Requests¶
PUT https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/l7policies/cf4360fd-8631-41ff-a6f5-b72c35da74be
{
"l7policy" : {
"name" : "My policy.",
"description" : "Update policy.",
"redirect_listener_id" : "48a97732-449e-4aab-b561-828d29e45050"
}
}
Example Responses¶
Status code: 200
Successful request.
{
"request_id" : "e5c07525-1470-47b6-9b0c-567527a036aa",
"l7policy" : {
"redirect_pool_id" : "768e9e8c-e7cb-4fef-b24b-af9399dbb240",
"description" : "",
"admin_state_up" : true,
"rules" : [ {
"id" : "c5c2d625-676b-431e-a4c7-c59cc2664881"
} ],
"project_id" : "7a9941d34fc1497d8d0797429ecfd354",
"listener_id" : "cdb03a19-16b7-4e6b-bfec-047aeec74f56",
"redirect_url" : null,
"redirect_url_config" : null,
"fixed_response_config" : null,
"redirect_listener_id" : null,
"action" : "REDIRECT_TO_POOL",
"position" : 100,
"priority" : null,
"provisioning_status" : "ACTIVE",
"id" : "01832d99-bbd8-4340-9d0c-6ff8f7a37307",
"name" : "l7policy-67"
}
}
Status Codes¶
Status Code | Description |
---|---|
200 | Successful request. |
Error Codes¶
See Error Codes.