curl --request GET \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/portsimport requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports', 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://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": "pm_0123abcd",
"host_port": 123,
"vm_port": 123,
"protocol": "<string>",
"host_address": "<string>",
"nic_index": 0,
"source_cidrs": [
"<string>"
],
"description": "<string>",
"public_host": "<string>",
"forwarding_backend": "vmm_hostfwd",
"restart_required": false,
"guest_ip": "<string>"
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Get port mappings
Returns persisted port mappings for this CVM.
curl --request GET \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/portsimport requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports', 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://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/ports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": "pm_0123abcd",
"host_port": 123,
"vm_port": 123,
"protocol": "<string>",
"host_address": "<string>",
"nic_index": 0,
"source_cidrs": [
"<string>"
],
"description": "<string>",
"public_host": "<string>",
"forwarding_backend": "vmm_hostfwd",
"restart_required": false,
"guest_ip": "<string>"
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Path Parameters
Response
Port mappings
A hashed identifier that maps to an internal database ID
^pm_.+"pm_0123abcd"
Node-level public DNS/IP; None when the node is not publicly reachable.
"vmm_hostfwd" when QEMU forwards the port on a user-mode NIC, "netd_forward" when teescope-netd DNATs it to a bridge-mode NIC, "unknown" when the node has not reported its default network mode.
Whether adding or removing this rule needs a CVM restart. Always false for netd_forward rules: netd installs them on the live host.
Guest address a netd_forward rule currently resolves to, read back from the node. None for vmm_hostfwd rules and when the node was not reachable. Empty string means the NIC's DHCP reservation is gone and the rule is inert.
Was this page helpful?

