Create load balancer
curl --request POST \
--url https://api.example.com/api/v2/loadbalancers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "web-lb",
"description": "Public TCP load balancer",
"tags": [
{
"name": "service",
"value": "ingress"
}
]
},
"spec": {
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"publicIP": true,
"vipAddress": "192.168.10.20",
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": [
"0.0.0.0/0"
],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": false,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
}
}
'import requests
url = "https://api.example.com/api/v2/loadbalancers"
payload = {
"metadata": {
"name": "web-lb",
"description": "Public TCP load balancer",
"tags": [
{
"name": "service",
"value": "ingress"
}
]
},
"spec": {
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"publicIP": True,
"vipAddress": "192.168.10.20",
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": ["0.0.0.0/0"],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": False,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {
name: 'web-lb',
description: 'Public TCP load balancer',
tags: [{name: 'service', value: 'ingress'}]
},
spec: {
networkId: '61f0ad85-3001-41cb-824a-e6a047668dfe',
publicIP: true,
vipAddress: '192.168.10.20',
listeners: [
{
name: 'http',
protocol: 'tcp',
port: 80,
allowedCidrs: ['0.0.0.0/0'],
idleTimeoutSeconds: 30,
pool: {
proxyProtocolV2: false,
members: [{address: '10.0.0.10', port: 8080}],
healthCheck: {
intervalSeconds: 10,
timeoutSeconds: 5,
healthyThreshold: 2,
unhealthyThreshold: 2
}
}
}
]
}
})
};
fetch('https://api.example.com/api/v2/loadbalancers', 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.example.com/api/v2/loadbalancers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'web-lb',
'description' => 'Public TCP load balancer',
'tags' => [
[
'name' => 'service',
'value' => 'ingress'
]
]
],
'spec' => [
'networkId' => '61f0ad85-3001-41cb-824a-e6a047668dfe',
'publicIP' => true,
'vipAddress' => '192.168.10.20',
'listeners' => [
[
'name' => 'http',
'protocol' => 'tcp',
'port' => 80,
'allowedCidrs' => [
'0.0.0.0/0'
],
'idleTimeoutSeconds' => 30,
'pool' => [
'proxyProtocolV2' => false,
'members' => [
[
'address' => '10.0.0.10',
'port' => 8080
]
],
'healthCheck' => [
'intervalSeconds' => 10,
'timeoutSeconds' => 5,
'healthyThreshold' => 2,
'unhealthyThreshold' => 2
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v2/loadbalancers"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v2/loadbalancers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/loadbalancers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "a64f9269-36e0-4312-b8d1-52d93d569b7b",
"name": "web-lb",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "pending",
"healthStatus": "healthy"
},
"spec": {
"publicIP": true,
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": [
"0.0.0.0/0"
],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": false,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
},
"status": {
"regionId": "d891dbf0-0a01-4efc-ae3a-5d77f6d3424b",
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"vipAddress": "192.168.10.20",
"publicIP": "203.0.113.10"
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Load balancers
Create load balancer
Create a new load balancer.
POST
/
api
/
v2
/
loadbalancers
Create load balancer
curl --request POST \
--url https://api.example.com/api/v2/loadbalancers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "web-lb",
"description": "Public TCP load balancer",
"tags": [
{
"name": "service",
"value": "ingress"
}
]
},
"spec": {
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"publicIP": true,
"vipAddress": "192.168.10.20",
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": [
"0.0.0.0/0"
],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": false,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
}
}
'import requests
url = "https://api.example.com/api/v2/loadbalancers"
payload = {
"metadata": {
"name": "web-lb",
"description": "Public TCP load balancer",
"tags": [
{
"name": "service",
"value": "ingress"
}
]
},
"spec": {
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"publicIP": True,
"vipAddress": "192.168.10.20",
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": ["0.0.0.0/0"],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": False,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {
name: 'web-lb',
description: 'Public TCP load balancer',
tags: [{name: 'service', value: 'ingress'}]
},
spec: {
networkId: '61f0ad85-3001-41cb-824a-e6a047668dfe',
publicIP: true,
vipAddress: '192.168.10.20',
listeners: [
{
name: 'http',
protocol: 'tcp',
port: 80,
allowedCidrs: ['0.0.0.0/0'],
idleTimeoutSeconds: 30,
pool: {
proxyProtocolV2: false,
members: [{address: '10.0.0.10', port: 8080}],
healthCheck: {
intervalSeconds: 10,
timeoutSeconds: 5,
healthyThreshold: 2,
unhealthyThreshold: 2
}
}
}
]
}
})
};
fetch('https://api.example.com/api/v2/loadbalancers', 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.example.com/api/v2/loadbalancers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'web-lb',
'description' => 'Public TCP load balancer',
'tags' => [
[
'name' => 'service',
'value' => 'ingress'
]
]
],
'spec' => [
'networkId' => '61f0ad85-3001-41cb-824a-e6a047668dfe',
'publicIP' => true,
'vipAddress' => '192.168.10.20',
'listeners' => [
[
'name' => 'http',
'protocol' => 'tcp',
'port' => 80,
'allowedCidrs' => [
'0.0.0.0/0'
],
'idleTimeoutSeconds' => 30,
'pool' => [
'proxyProtocolV2' => false,
'members' => [
[
'address' => '10.0.0.10',
'port' => 8080
]
],
'healthCheck' => [
'intervalSeconds' => 10,
'timeoutSeconds' => 5,
'healthyThreshold' => 2,
'unhealthyThreshold' => 2
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v2/loadbalancers"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v2/loadbalancers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/loadbalancers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"web-lb\",\n \"description\": \"Public TCP load balancer\",\n \"tags\": [\n {\n \"name\": \"service\",\n \"value\": \"ingress\"\n }\n ]\n },\n \"spec\": {\n \"networkId\": \"61f0ad85-3001-41cb-824a-e6a047668dfe\",\n \"publicIP\": true,\n \"vipAddress\": \"192.168.10.20\",\n \"listeners\": [\n {\n \"name\": \"http\",\n \"protocol\": \"tcp\",\n \"port\": 80,\n \"allowedCidrs\": [\n \"0.0.0.0/0\"\n ],\n \"idleTimeoutSeconds\": 30,\n \"pool\": {\n \"proxyProtocolV2\": false,\n \"members\": [\n {\n \"address\": \"10.0.0.10\",\n \"port\": 8080\n }\n ],\n \"healthCheck\": {\n \"intervalSeconds\": 10,\n \"timeoutSeconds\": 5,\n \"healthyThreshold\": 2,\n \"unhealthyThreshold\": 2\n }\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "a64f9269-36e0-4312-b8d1-52d93d569b7b",
"name": "web-lb",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "pending",
"healthStatus": "healthy"
},
"spec": {
"publicIP": true,
"listeners": [
{
"name": "http",
"protocol": "tcp",
"port": 80,
"allowedCidrs": [
"0.0.0.0/0"
],
"idleTimeoutSeconds": 30,
"pool": {
"proxyProtocolV2": false,
"members": [
{
"address": "10.0.0.10",
"port": 8080
}
],
"healthCheck": {
"intervalSeconds": 10,
"timeoutSeconds": 5,
"healthyThreshold": 2,
"unhealthyThreshold": 2
}
}
}
]
},
"status": {
"regionId": "d891dbf0-0a01-4efc-ae3a-5d77f6d3424b",
"networkId": "61f0ad85-3001-41cb-824a-e6a047668dfe",
"vipAddress": "192.168.10.20",
"publicIP": "203.0.113.10"
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Body
application/json
A request for a load balancer.
Response
A load balancer.
Was this page helpful?
⌘I