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_listener_list = client.cloud.load_balancers.listeners.list(
project_id=1,
region_id=1,
)
print(load_balancer_listener_list.count)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
loadBalancerListenerList, err := client.Cloud.LoadBalancers.Listeners.List(context.TODO(), cloud.LoadBalancerListenerListParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", loadBalancerListenerList.Count)
}curl --request GET \
--url https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"admin_state_up": true,
"allowed_cidrs": [
"10.0.0.0/8"
],
"connection_limit": 499999,
"creator_task_id": "de105b9c-c095-4f1c-9b76-aaa9bc60e32a",
"id": "43658ea9-54bd-4807-90b1-925921c9a0d1",
"insert_headers": {},
"load_balancer_id": "67149a91-739b-42bf-bbd1-cb64f723dad7",
"name": "lbaas_test_listener",
"pool_count": 1,
"protocol_port": 80,
"secret_id": "e36200c7-114b-44e6-ba1a-043b2bd53879",
"sni_secret_id": [
"e36200c7-114b-44e6-ba1a-043b2bd53879",
"c5d156ce-0925-4aef-b458-cce46bd346f0"
],
"stats": {
"active_connections": 0,
"bytes_in": 34942398609,
"bytes_out": 304777113641,
"request_errors": 4,
"total_connections": 21095970
},
"task_id": "<string>",
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"user_list": [
{
"encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5",
"username": "admin"
}
]
}
]
}Load Balancers
List load balancer listeners
GET
/
cloud
/
v1
/
lblisteners
/
{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
)
load_balancer_listener_list = client.cloud.load_balancers.listeners.list(
project_id=1,
region_id=1,
)
print(load_balancer_listener_list.count)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
loadBalancerListenerList, err := client.Cloud.LoadBalancers.Listeners.List(context.TODO(), cloud.LoadBalancerListenerListParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", loadBalancerListenerList.Count)
}curl --request GET \
--url https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/lblisteners/{project_id}/{region_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"count": 1,
"results": [
{
"admin_state_up": true,
"allowed_cidrs": [
"10.0.0.0/8"
],
"connection_limit": 499999,
"creator_task_id": "de105b9c-c095-4f1c-9b76-aaa9bc60e32a",
"id": "43658ea9-54bd-4807-90b1-925921c9a0d1",
"insert_headers": {},
"load_balancer_id": "67149a91-739b-42bf-bbd1-cb64f723dad7",
"name": "lbaas_test_listener",
"pool_count": 1,
"protocol_port": 80,
"secret_id": "e36200c7-114b-44e6-ba1a-043b2bd53879",
"sni_secret_id": [
"e36200c7-114b-44e6-ba1a-043b2bd53879",
"c5d156ce-0925-4aef-b458-cce46bd346f0"
],
"stats": {
"active_connections": 0,
"bytes_in": 34942398609,
"bytes_out": 304777113641,
"request_errors": 4,
"total_connections": 21095970
},
"task_id": "<string>",
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"user_list": [
{
"encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5",
"username": "admin"
}
]
}
]
}Authorizations
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
Example:
1
Region ID
Example:
1
Query Parameters
Optional. Limit the number of returned items
Required range:
x <= 1000Example:
1000
Load Balancer ID
Example:
"00000000-0000-4000-8000-000000000000"
Filter by name
Example:
"listener-name"
Optional. Offset value is used to exclude the first set of records from the result
Required range:
x >= 0Example:
0
Show stats
Examples:
true
false
Was this page helpful?
⌘I