POST
/
cloud
/
v1
/
l7policies
/
{project_id}
/
{region_id}
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
task_id_list = client.cloud.load_balancers.l7_policies.create(
    project_id=0,
    region_id=0,
    action="REDIRECT_TO_URL",
    listener_id="023f2e34-7806-443b-bfae-16c324569a3d",
)
print(task_id_list.tasks)
{
  "tasks": [
    "d478ae29-dedc-4869-82f0-96104425f565"
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

region_id
integer
required

Region ID

Body

application/json

CreateL7Policy schema

action
enum<string>
required

Action

Available options:
REDIRECT_PREFIX,
REDIRECT_TO_POOL,
REDIRECT_TO_URL,
REJECT
listener_id
string
required

Listener ID

name
string

Human-readable name of the policy

position
integer

The position of this policy on the listener. Positions start at 1.

redirect_http_code
integer

Requests matching this policy will be redirected to the specified URL or Prefix URL with the HTTP response code. Valid if action is REDIRECT_TO_URL or REDIRECT_PREFIX. Valid options are 301, 302, 303, 307, or 308. Default is 302.

redirect_pool_id
string

Requests matching this policy will be redirected to the pool withthis ID. Only valid if action is REDIRECT_TO_POOL.

redirect_prefix
string

Requests matching this policy will be redirected to this Prefix URL. Only valid if action is REDIRECT_PREFIX.

redirect_url
string

Requests matching this policy will be redirected to this URL. Only valid if action is REDIRECT_TO_URL.

tags
string[]

A list of simple strings assigned to the resource.

Response

200 - application/json

List of created tasks

tasks
string[]
required

List of task IDs

Examples:
["d478ae29-dedc-4869-82f0-96104425f565"]