doc-exports/elb/api-ref/UpdateL7Policy.rst

116 KiB
Raw Blame History

Updating a Forwarding Policy

Function

This API is used to update a forwarding policy.

URI

PUT /v3/{project_id}/elb/l7policies/{l7policy_id}

Table 1 Path parameters
Parameter Mandatory Type Description
l7policy_id Yes String Specifies the forwarding policy ID.
project_id Yes String Specifies the project ID.

Request Parameters

Table 2 Request header parameters
Parameter Mandatory Type Description
X-Auth-Token Yes String Specifies the token used for IAM authentication.
Table 3 Request body parameters
Parameter Mandatory Type Description
l7policy Yes UpdateL7PolicyOption <#Updat eL7Policy__request_UpdateL7PolicyOption>__ object Specifies request parameters for updating a forwarding policy.
Table 4 UpdateL7PolicyOption
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.

Default: true

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 that requests are redirected to.

This parameter is valid and mandatory only when action is set to REDIRECT_TO_LISTENER.

Only HTTPS listeners are supported, and the listener cannot be any listener added to other load balancers.

redirect_pool_id No String

Specifies the ID of the backend server group that requests are forwarded to.

This parameter is valid and mandatory only when action is set to REDIRECT_TO_POOL.

The specified backend server group cannot be the default one associated with the listener, or any backend server group associated with the forwarding policies of other listeners.

This parameter cannot be specified when action is set to REDIRECT_TO_LISTENER.

redirect_url_config No UpdateRedirectUrlConfig <#UpdateL7Policy__request_ UpdateRedirectUrlConfig>__ object

Specifies the URL to which requests are forwarded.

For shared load balancers, this parameter is not supported. If it is passed, an error will be returned.

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.

Format: proto col://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.

This parameter is unsupported. Please do not use it.

fixed_response_config No Up dateFixtedResponseConfig <# UpdateL7Policy__request_Upd ateFixtedResponseConfig>__ 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. For shared load balancers, this parameter is not supported. If it is passed, an error will be returned.

This parameter is unsupported. Please do not use it.

rules No Array of UpdateL7RuleO ption <#UpdateL7Policy__req uest_UpdateL7RuleOption>__ 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.

priority No Integer

Specifies the forwarding policy priority. This parameter is available only for dedicated load balancers and 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. For shared load balancers, this parameter is not supported. If it is passed, an error will be returned.

A smaller value indicates a higher priority. The value must be unique for forwarding policies of the same listener.

If action is set to REDIRECT_TO_LISTENER, the value can only be 0, indicating that REDIRECT_TO_LISTENER has the highest priority.

This parameter is unsupported. Please do not use it.

Minimum: 0

Maximum: 10000

Table 5 UpdateRedirectUrlConfig
Parameter Mandatory Type Description
protocol No String

Specifies the protocol for redirection. The default value is ${protocol}, indicating that the protocol of the request will be used.

Value options:

  • HTTP
  • HTTPS
  • ${protocol}

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 _-';@^-%#&$.*+?,=!:|/()[]{} and must start with a slash (/).

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.

For example, in the URL https://www.xxx.com:80 80/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.xxx.com:8080/elb?type=l oadbalancer&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 No String

Specifies the status code returned after the requests are redirected.

Value options:

  • 301
  • 302
  • 303
  • 307
  • 308

Minimum: 1

Maximum: 16

Table 6 UpdateFixtedResponseConfig
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 200299, 400499, or 500599.

Minimum: 1

Maximum: 16

content_type No String

Specifies the format of the response body.

Value options:

  • text/plain
  • text/css
  • text/html
  • application/javascript
  • application/json

Minimum: 1

Maximum: 64

message_body No String

Specifies the content of the response body.

Minimum: 0

Maximum: 1024

Table 7 UpdateL7RuleOption
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 No String

Specifies how requests are matched with the domain name or URL.

  • If type is set to HOST_NAME, this parameter can only be set to EQUAL_TO.
  • If type is set to PATH, this parameter can be set to REGEX, STARTS_WITH, or EQUAL_TO.
invert No Boolean Specifies whether reverse matching is supported. The value is fixed at false. This parameter can be updated but remains invalid.
key No String

Specifies the key of the match item. For example, if an HTTP header is used for matching, key is the name of the HTTP header parameter.

This parameter is unsupported. Please do not use it.

Minimum: 1

Maximum: 255

value No String

Specifies the value of the match item. For example, if a domain name is used for matching, value is the domain name.

  • If type is set to HOST_NAME, the value can contain letters, digits, hyphens (-), and periods (.) and must start with a letter or digit. If you want to use a wildcard domain name, enter an asterisk (*) as the leftmost label of the domain name.
- If type is set to
PATH and compare_type to STARTS_WITH or EQUAL_TO, the value must start with a slash (/) and can contain only letters, digits, and special characters

_~';@^-%#&$.*+?,=!:|/()[]{}

Minimum: 1

Maximum: 128

conditions No Array of UpdateRuleCondi tion <#UpdateL7Policy__requ est_UpdateRuleCondition>__ objects

Specifies the matching conditions of the forwarding rule. This parameter will take effect when enhance_l7policy_enable is set to true.

If conditions is specified, the values of key and value are invalid, and its value contains all conditions configured for the forwarding rule. The keys in the list must be the same, whereas each value must be unique. Only full update is supported.

This parameter is unsupported. Please do not use it.

Table 8 UpdateRuleCondition
Parameter Mandatory Type Description
key No String

Specifies the key of match item. This parameter is left blank.

Minimum: 1

Maximum: 128

value No String

Specifies the value of the match item.

  • If type is set to HOST_NAME, key is left blank, and value indicates the domain name, which can contain 1 to 128 characters, including letters, digits, hyphens (-), periods (.), and asterisks (), and must start with a letter, digit, or asterisk (). If you want to use a wildcard domain name, enter an asterisk (*) as the leftmost label of the domain name.
- If type is set to
PATH, key is left blank, and value indicates the request path, which can contain 1 to 128 characters. If compare_type is set to STARTS_WITH or EQUAL_TO for the forwarding rule, the value must start with a slash (/) and can contain only letters, digits, and special characters

_~';@^-%#&$.*+?,=!:|/()[]{}

Minimum: 1

Maximum: 128

Response Parameters

Status code: 200

Table 9 Response body parameters
Parameter Type Description
request_id String Specifies the request ID. The value is automatically generated.
l7policy L7Policy object Specifies the forwarding policy.
Table 10 L7Policy
Parameter Type Description
action String

Specifies where requests will be forwarded. The value can be one of the following:

  • REDIRECT_TO_POOL: Requests will be forwarded to another backend server group.
  • REDIRECT_TO_LISTENER: Requests will be redirected to an HTTPS listener.

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.

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.

Default: true

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.

  • If action is set to REDIRECT_TO_POOL, the forwarding policy can be added to an HTTP or HTTPS listener.
  • If action is set to REDIRECT_TO_LISTENER, the forwarding policy can be added to an HTTP listener.
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

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 only be ACTIVE.

Default: ACTIVE

redirect_listener_id String

Specifies the ID of the listener that requests are redirected to.

This parameter is valid and mandatory only when action is set to REDIRECT_TO_LISTENER.

Only HTTPS listeners are supported, and the listener cannot be any listener added to other load balancers.

redirect_pool_id String

Specifies the ID of the backend server group that requests are forwarded to.

This parameter is valid and mandatory only when action is set to REDIRECT_TO_POOL.

The specified backend server group cannot be the default one associated with the listener, or any backend server group associated with the forwarding policies of other listeners.

This parameter cannot be specified when action is set to REDIRECT_TO_LISTENER.

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 < #UpdateL7Policy__response_RuleRef>__ objects Lists the forwarding rules in the forwarding policy.
redirect_url_config RedirectUrlConfig <#UpdateL7P olicy__response_RedirectUrlConfig>__ object

Specifies the URL to which requests are forwarded.

For shared load balancers, this parameter is not supported. If it is passed, an error will be returned.

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.

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.

This parameter is unsupported. Please do not use it.

fixed_response_config FixtedResponseConfig <#UpdateL7Poli cy__response_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. For shared load balancers, this parameter is not supported. If it is passed, an error will be returned.

This parameter is unsupported. Please do not use it.

priority Integer

Specifies the forwarding policy priority. This parameter is available only for dedicated load balancers and will take effect when enhance_l7policy_enable is set to true.

A smaller value indicates a higher priority. The value must be unique for each forwarding policy of the same listener.

If action is set to REDIRECT_TO_LISTENER, the value can only be 0, indicating that REDIRECT_TO_LISTENER has the highest priority.

  • If enhance_l7policy_enable is set to false, forwarding policies are automatically prioritized based on the original sorting logic. Forwarding policy priorities are independent of each other regardless of domain names. If forwarding policies use the same domain name, their priorities follow the order of exact match (EQUAL_TO), prefix match (STARTS_WITH), and regular expression match (REGEX). If prefix match is used for matching, the longer the path, the higher the priority. If a forwarding policy contains only a domain name without a path specified, the path is /, and prefix match is used by default.
  • If enhance_l7policy_enable is set to true and this parameter is not passed, the priority will set to a sum of 1 and the highest priority of existing forwarding policy in the same listener by default. There will be two cases: a) If the highest priority of existing forwarding policies is the maximum (10,000), the forwarding policy will fail to create because the final priority for creating the forwarding policy is the sum of 1 and 10,000, which exceeds the maximum. In this case, please specify a value or adjust the priorities of existing forwarding policies. b) If no forwarding policies exist, the highest priority of existing forwarding policies will set to 1 by default.

This parameter is unsupported. Please do not use it.

Minimum: 0

Maximum: 10000

Table 11 RuleRef
Parameter Type Description
id String Specifies the forwarding rule ID.
Table 12 RedirectUrlConfig
Parameter Type Description
protocol String

Specifies the protocol for redirection. The default value is ${protocol}, indicating that the protocol of the request will be used.

Value options:

  • HTTP
  • HTTPS
  • ${protocol}

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 _-';@^- %#&$.*+?,=!:|/()[]{} and must start with a slash (/).

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. xxx.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.xxx.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.

Value options:

  • 301
  • 302
  • 303
  • 307
  • 308

Minimum: 1

Maximum: 16

Table 13 FixtedResponseConfig
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 200299, 400499, or 500599.

Minimum: 1

Maximum: 16

content_type String

Specifies the format of the response body.

Value options:

  • text/plain
  • text/css
  • text/html
  • application/javascript
  • application/json

Minimum: 0

Maximum: 32

message_body String

Specifies the content of the response 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" : {
    "description" : "Update policy.",
    "admin_state_up" : true,
    "rules" : [ ],
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "listener_id" : "e2220d2a-3faf-44f3-8cd6-0c42952bd0ab",
    "redirect_listener_id" : "48a97732-449e-4aab-b561-828d29e45050",
    "action" : "REDIRECT_TO_LISTENER",
    "position" : 100,
    "provisioning_status" : "ACTIVE",
    "id" : "cf4360fd-8631-41ff-a6f5-b72c35da74be",
    "name" : "My policy."
  }
}

Status Codes

Status Code Description
200 Successful request.

Error Codes

See Error Codes.

Parent topic: Forwarding Policy