Close a VM port
curl --request DELETE \
--url https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_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.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"detail": "<string>"
}{
"detail": {
"code": "virtual_machine_port_not_found",
"message": "Ornn could not find that port on this VM."
}
}{
"detail": {
"code": "virtual_machine_ports_not_running",
"message": "Ports can be opened or closed only while the VM is running."
}
}{
"code": "<string>",
"detail": "<string>"
}Close a VM port
Closes one port on a running VM and frees its public port number on the host. A 202 response is acceptance; the host stops forwarding the port shortly after.
DELETE
/
v1
/
orchestrator
/
nodes
/
{node_id}
/
virtual-machines
/
{vm_id}
/
ports
/
{port_id}
Close a VM port
curl --request DELETE \
--url https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_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.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ornn.com/v1/orchestrator/nodes/{node_id}/virtual-machines/{vm_id}/ports/{port_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"detail": "<string>"
}{
"detail": {
"code": "virtual_machine_port_not_found",
"message": "Ornn could not find that port on this VM."
}
}{
"detail": {
"code": "virtual_machine_ports_not_running",
"message": "Ports can be opened or closed only while the VM is running."
}
}{
"code": "<string>",
"detail": "<string>"
}Closing a port frees its public port number on the host. For the full flow, see Open ports on a VM.
Authorizations
Create an organization API key in Account Settings > Developer. Do not send this key to the Kubernetes API server.
Path Parameters
The VM's node_id from the reservation's VM list.
The VM's id from the reservation's VM list.
The port's id from the VM's port list.
Response
Close accepted.
Was this page helpful?