Connect private subnet to another private subnet
curl --request POST \
--url https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connected-subnet-id": "<string>"
}
'import requests
url = "https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect"
payload = { "connected-subnet-id": "<string>" }
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({'connected-subnet-id': '<string>'})
};
fetch('https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect', 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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect",
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([
'connected-subnet-id' => '<string>'
]),
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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect"
payload := strings.NewReader("{\n \"connected-subnet-id\": \"<string>\"\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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"connected-subnet-id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect")
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 \"connected-subnet-id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"firewalls": [
{
"description": "<string>",
"firewall_rules": [
{
"cidr": "<string>",
"id": "fraz0q3vbrpa7pkg7zbmah9csn",
"port_range": "<string>",
"description": "<string>"
}
],
"id": "fwfg7td83em22qfw9pq5xyfqb7",
"location": "<string>",
"name": "<string>"
}
],
"id": "ps3dngttwvje2kmr2sn8x12x4r",
"location": "<string>",
"name": "<string>",
"net4": "<string>",
"net6": "<string>",
"nics": [
{
"id": "<string>",
"name": "<string>",
"private_ipv4": "127.0.0.1",
"private_ipv6": "2606:4700:3108::ac42:2835",
"vm_name": "<string>"
}
],
"state": "<string>"
}{
"error": {
"code": 401,
"message": "There was an error logging in",
"type": "InvalidCredentials",
"details": {}
}
}Private Subnet
Connect private subnet to another private subnet
POST
/
project
/
{project_id}
/
location
/
{location}
/
private-subnet
/
{private_subnet_reference}
/
connect
Connect private subnet to another private subnet
curl --request POST \
--url https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connected-subnet-id": "<string>"
}
'import requests
url = "https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect"
payload = { "connected-subnet-id": "<string>" }
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({'connected-subnet-id': '<string>'})
};
fetch('https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect', 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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect",
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([
'connected-subnet-id' => '<string>'
]),
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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect"
payload := strings.NewReader("{\n \"connected-subnet-id\": \"<string>\"\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.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"connected-subnet-id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ubicloud.com/project/{project_id}/location/{location}/private-subnet/{private_subnet_reference}/connect")
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 \"connected-subnet-id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"firewalls": [
{
"description": "<string>",
"firewall_rules": [
{
"cidr": "<string>",
"id": "fraz0q3vbrpa7pkg7zbmah9csn",
"port_range": "<string>",
"description": "<string>"
}
],
"id": "fwfg7td83em22qfw9pq5xyfqb7",
"location": "<string>",
"name": "<string>"
}
],
"id": "ps3dngttwvje2kmr2sn8x12x4r",
"location": "<string>",
"name": "<string>",
"net4": "<string>",
"net6": "<string>",
"nics": [
{
"id": "<string>",
"name": "<string>",
"private_ipv4": "127.0.0.1",
"private_ipv6": "2606:4700:3108::ac42:2835",
"vm_name": "<string>"
}
],
"state": "<string>"
}{
"error": {
"code": 401,
"message": "There was an error logging in",
"type": "InvalidCredentials",
"details": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the project
Pattern:
^pj[0-9a-hj-km-np-tv-z]{24}$Example:
"pjkkmx0f2vke4h36nk9cm8v8q0"
The Ubicloud location/region
Example:
"eu-central-h1"
Private subnet ID or name Resource ID or name
Pattern:
^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$Body
application/json
Response
A Private Subnet
Show child attributes
Show child attributes
ID of the subnet
Pattern:
^ps[0-9a-hj-km-np-tv-z]{24}$Example:
"ps3dngttwvje2kmr2sn8x12x4r"
Location of the subnet
Name of the subnet
IPv4 CIDR of the subnet
IPv6 CIDR of the subnet
List of NICs
Show child attributes
Show child attributes
State of the subnet
⌘I