GET
/
cloud
/
v1
/
l7policies
/
{project_id}
/
{region_id}
/
{l7policy_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
)
load_balancer_l7_policy = client.cloud.load_balancers.l7_policies.get(
    l7policy_id="l7policy_id",
    project_id=0,
    region_id=0,
)
print(load_balancer_l7_policy.id)
{
  "action": "REDIRECT_TO_URL",
  "created_at": "2020-11-16T13:48:20+0000",
  "id": "9b4b9a23-ccac-4945-bcdd-b0e793c12cd9",
  "listener_id": "0388b5e5-3393-4aa8-a88a-dbcdcedf9970",
  "name": "redirect-example.com",
  "operating_status": "ONLINE",
  "position": 1,
  "project_id": 1,
  "provisioning_status": "ACTIVE",
  "redirect_http_code": 301,
  "redirect_pool_id": "00000000-0000-4000-8000-000000000000",
  "redirect_prefix": "prefix",
  "redirect_url": "http://www.example.com",
  "region": "Luxembourg",
  "region_id": 1,
  "rules": [
    {
      "compare_type": "STARTS_WITH",
      "created_at": "2020-11-16T13:48:25+0000",
      "id": "0ca7bebd-7a54-4977-bca7-e4ac1e612ec7",
      "invert": false,
      "key": "key",
      "operating_status": "ONLINE",
      "project_id": 1,
      "provisioning_status": "ACTIVE",
      "region": "Luxembourg",
      "region_id": 1,
      "tags": [
        "test_tag"
      ],
      "type": "PATH",
      "updated_at": "2020-11-16T13:48:26+0000",
      "value": "/images*"
    }
  ],
  "tags": [
    "test_tag"
  ],
  "updated_at": "2020-11-16T13:48:26+0000"
}

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

l7policy_id
string
required

L7 policy ID

Response

Returned L7 policy

L7Policy schema

action
enum<string>

Action

Available options:
REDIRECT_PREFIX,
REDIRECT_TO_POOL,
REDIRECT_TO_URL,
REJECT
id
string

ID

listener_id
string

Listener ID

name
string

Human-readable name of the policy

operating_status
enum<string>

L7 policy operating status

Available options:
DEGRADED,
DRAINING,
ERROR,
NO_MONITOR,
OFFLINE,
ONLINE
position
integer

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

project_id
integer

Project ID

provisioning_status
enum<string>
Available options:
ACTIVE,
DELETED,
ERROR,
PENDING_CREATE,
PENDING_DELETE,
PENDING_UPDATE
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 with this 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.

region
string

Region name

region_id
integer

Region ID

rules
object[]

Rules. All the rules associated with a given policy are logically ANDed 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.

tags
string[]

A list of simple strings assigned to the resource.

task_id
string

The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.