osc load-balancer l7policy create
Creates a L7 policy.
This operation provisions a new L7 policy by using the configuration that you define in the request object. After the API validates the request and starts the provisioning process, the API returns a response object that contains a unique ID and the status of provisioning the L7 policy.
In the response, the L7 policy provisioning status is ACTIVE
, PENDING_CREATE
, or ERROR
.
If the status is PENDING_CREATE
, issue GET /v2/lbaas/l7policies/{l7policy_id}
to view the progress of the provisioning operation. When the L7 policy status changes to ACTIVE
, the L7 policy is successfully provisioned and is ready for further configuration.
If the API cannot fulfill the request due to insufficient data or data that is not valid, the service returns the HTTP Bad Request (400)
response code with information about the failure in the response body. Validation errors require that you correct the error and submit the request again.
All the rules associated with a given policy are logically ANDead together. A request must match all the policy’s rules to match the policy.
If you need to express a logical OR operation between rules, then do this by creating multiple policies with the same action.
If a new policy is created with a position that matches that of an existing policy, then the new policy is inserted at the given position.
L7 policies with action
of REDIRECT_TO_URL
will return the default HTTP Found (302)
response code with the redirect_url
. Also, specify redirect_http_code
to configure the needed HTTP response code, such as, 301, 302, 303, 307 and 308.
L7 policies with action
of REJECT
will return a Forbidden (403)
response code to the requester.
Usage: osc load-balancer l7policy create [OPTIONS] --action <ACTION> --listener-id <LISTENER_ID>
Options:
-
--action <ACTION>
— The L7 policy action. One ofREDIRECT_PREFIX
,REDIRECT_TO_POOL
,REDIRECT_TO_URL
, orREJECT
Possible values:
redirect-prefix
,redirect-to-pool
,redirect-to-url
,reject
-
--admin-state-up <ADMIN_STATE_UP>
— The administrative state of the resource, which is up (true
) or down (false
). Default istrue
Possible values:
true
,false
-
--description <DESCRIPTION>
— A human-readable description for the resource -
--listener-id <LISTENER_ID>
— The ID of the listener -
--name <NAME>
— Human-readable name of the resource -
--position <POSITION>
— The position of this policy on the listener. Positions start at 1 -
--project-id <PROJECT_ID>
— The ID of the project owning this resource -
--redirect-http-code <REDIRECT_HTTP_CODE>
— Requests matching this policy will be redirected to the specified URL or Prefix URL with the HTTP response code. Valid ifaction
isREDIRECT_TO_URL
orREDIRECT_PREFIX
. Valid options are: 301, 302, 303, 307, or 308. Default is 302.New in version 2.9
-
--redirect-pool-id <REDIRECT_POOL_ID>
— Requests matching this policy will be redirected to the pool with this ID. Only valid ifaction
isREDIRECT_TO_POOL
. The pool has some restrictions, See Protocol Combinations (Listener/Pool) -
--redirect-prefix <REDIRECT_PREFIX>
— Requests matching this policy will be redirected to this Prefix URL. Only valid ifaction
isREDIRECT_PREFIX
-
--redirect-url <REDIRECT_URL>
— Requests matching this policy will be redirected to this URL. Only valid ifaction
isREDIRECT_TO_URL
-
--rules <JSON>
-
--tags <TAGS>
-
--tenant-id <TENANT_ID>