Create load balancer
curl --request POST \
--url https://api.tenbytecloud.com/v1/network/load_balancers \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"display_name": "my LB",
"billing_account_id": 130157,
"network_uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"reserve_public_ip": true,
"rules": [
{
"source_port": 8080,
"target_port": 80
}
],
"targets": [
{
"target_uuid": "145cc106-e067-419a-85fd-333ded30f169",
"target_type": "vm"
},
{
"target_uuid": "e9717243-59df-4847-bd50-dca5b090432b",
"target_type": "vm"
}
]
}
'import requests
url = "https://api.tenbytecloud.com/v1/network/load_balancers"
payload = {
"display_name": "my LB",
"billing_account_id": 130157,
"network_uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"reserve_public_ip": True,
"rules": [
{
"source_port": 8080,
"target_port": 80
}
],
"targets": [
{
"target_uuid": "145cc106-e067-419a-85fd-333ded30f169",
"target_type": "vm"
},
{
"target_uuid": "e9717243-59df-4847-bd50-dca5b090432b",
"target_type": "vm"
}
]
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
display_name: 'my LB',
billing_account_id: 130157,
network_uuid: '438ac62f-e97b-4ef0-8940-507b9e94af43',
reserve_public_ip: true,
rules: [{source_port: 8080, target_port: 80}],
targets: [
{target_uuid: '145cc106-e067-419a-85fd-333ded30f169', target_type: 'vm'},
{target_uuid: 'e9717243-59df-4847-bd50-dca5b090432b', target_type: 'vm'}
]
})
};
fetch('https://api.tenbytecloud.com/v1/network/load_balancers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/network/load_balancers"
payload := strings.NewReader("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/network/load_balancers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/network/load_balancers")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/network/load_balancers");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddJsonBody("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/network/load_balancers",
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([
'display_name' => 'my LB',
'billing_account_id' => 130157,
'network_uuid' => '438ac62f-e97b-4ef0-8940-507b9e94af43',
'reserve_public_ip' => true,
'rules' => [
[
'source_port' => 8080,
'target_port' => 80
]
],
'targets' => [
[
'target_uuid' => '145cc106-e067-419a-85fd-333ded30f169',
'target_type' => 'vm'
],
[
'target_uuid' => 'e9717243-59df-4847-bd50-dca5b090432b',
'target_type' => 'vm'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"display_name": "my LB",
"billing_account_id": 130157,
"private_address": "10.112.231.192"
}Network Load Balancer
Create load balancer
Create new load balancer. Location-specific endpoint.
POST
/
network
/
load_balancers
Create load balancer
curl --request POST \
--url https://api.tenbytecloud.com/v1/network/load_balancers \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"display_name": "my LB",
"billing_account_id": 130157,
"network_uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"reserve_public_ip": true,
"rules": [
{
"source_port": 8080,
"target_port": 80
}
],
"targets": [
{
"target_uuid": "145cc106-e067-419a-85fd-333ded30f169",
"target_type": "vm"
},
{
"target_uuid": "e9717243-59df-4847-bd50-dca5b090432b",
"target_type": "vm"
}
]
}
'import requests
url = "https://api.tenbytecloud.com/v1/network/load_balancers"
payload = {
"display_name": "my LB",
"billing_account_id": 130157,
"network_uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"reserve_public_ip": True,
"rules": [
{
"source_port": 8080,
"target_port": 80
}
],
"targets": [
{
"target_uuid": "145cc106-e067-419a-85fd-333ded30f169",
"target_type": "vm"
},
{
"target_uuid": "e9717243-59df-4847-bd50-dca5b090432b",
"target_type": "vm"
}
]
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
display_name: 'my LB',
billing_account_id: 130157,
network_uuid: '438ac62f-e97b-4ef0-8940-507b9e94af43',
reserve_public_ip: true,
rules: [{source_port: 8080, target_port: 80}],
targets: [
{target_uuid: '145cc106-e067-419a-85fd-333ded30f169', target_type: 'vm'},
{target_uuid: 'e9717243-59df-4847-bd50-dca5b090432b', target_type: 'vm'}
]
})
};
fetch('https://api.tenbytecloud.com/v1/network/load_balancers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tenbytecloud.com/v1/network/load_balancers"
payload := strings.NewReader("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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))
}require 'uri'
require 'net/http'
url = URI("https://api.tenbytecloud.com/v1/network/load_balancers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.tenbytecloud.com/v1/network/load_balancers")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.tenbytecloud.com/v1/network/load_balancers");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("apikey", "<api-key>");
request.AddJsonBody("{\n \"display_name\": \"my LB\",\n \"billing_account_id\": 130157,\n \"network_uuid\": \"438ac62f-e97b-4ef0-8940-507b9e94af43\",\n \"reserve_public_ip\": true,\n \"rules\": [\n {\n \"source_port\": 8080,\n \"target_port\": 80\n }\n ],\n \"targets\": [\n {\n \"target_uuid\": \"145cc106-e067-419a-85fd-333ded30f169\",\n \"target_type\": \"vm\"\n },\n {\n \"target_uuid\": \"e9717243-59df-4847-bd50-dca5b090432b\",\n \"target_type\": \"vm\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tenbytecloud.com/v1/network/load_balancers",
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([
'display_name' => 'my LB',
'billing_account_id' => 130157,
'network_uuid' => '438ac62f-e97b-4ef0-8940-507b9e94af43',
'reserve_public_ip' => true,
'rules' => [
[
'source_port' => 8080,
'target_port' => 80
]
],
'targets' => [
[
'target_uuid' => '145cc106-e067-419a-85fd-333ded30f169',
'target_type' => 'vm'
],
[
'target_uuid' => 'e9717243-59df-4847-bd50-dca5b090432b',
'target_type' => 'vm'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"uuid": "438ac62f-e97b-4ef0-8940-507b9e94af43",
"display_name": "my LB",
"billing_account_id": 130157,
"private_address": "10.112.231.192"
}⌘I