curl --request POST \
--url https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": {
"sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
]
},
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": true
}
]
},
"status": {
"capacitySource": "<string>",
"failureMessage": "<string>",
"observedGeneration": 123,
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": true,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<string>"
}
]
}
}
'import requests
url = "https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines"
payload = {
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": { "sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
] },
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": True
}
]
},
"status": {
"capacitySource": "<string>",
"failureMessage": "<string>",
"observedGeneration": 123,
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": True,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<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({
apiVersion: 'compute.mountthor.com/v1alpha1',
kind: 'VirtualMachine',
metadata: {
name: '<string>',
annotations: {},
creationTimestamp: '2023-11-07T05:31:56Z',
deletionTimestamp: '2023-11-07T05:31:56Z',
generation: 1,
labels: {},
namespace: '<string>',
resourceVersion: '<string>',
uid: '<string>'
},
spec: {
imageRef: '<string>',
bootstrap: {sshAuthorizedKeys: [{publicKey: '<string>', username: '<string>'}]},
ports: [
{
guestPort: 32768,
name: '<string>',
exposure: 'private-tunnel',
protocol: '<string>',
readinessProbe: true
}
]
},
status: {
capacitySource: '<string>',
failureMessage: '<string>',
observedGeneration: 123,
publishedPorts: [
{
accessCommand: '<string>',
exposure: '<string>',
guestPort: 123,
name: '<string>',
protocol: '<string>',
uriTemplate: '<string>'
}
],
readyForAccess: true,
resolvedImageRef: '<string>',
sshHostKeys: [{algorithm: '<string>', publicKey: '<string>'}]
}
})
};
fetch('https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines', 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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines",
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([
'apiVersion' => 'compute.mountthor.com/v1alpha1',
'kind' => 'VirtualMachine',
'metadata' => [
'name' => '<string>',
'annotations' => [
],
'creationTimestamp' => '2023-11-07T05:31:56Z',
'deletionTimestamp' => '2023-11-07T05:31:56Z',
'generation' => 1,
'labels' => [
],
'namespace' => '<string>',
'resourceVersion' => '<string>',
'uid' => '<string>'
],
'spec' => [
'imageRef' => '<string>',
'bootstrap' => [
'sshAuthorizedKeys' => [
[
'publicKey' => '<string>',
'username' => '<string>'
]
]
],
'ports' => [
[
'guestPort' => 32768,
'name' => '<string>',
'exposure' => 'private-tunnel',
'protocol' => '<string>',
'readinessProbe' => true
]
]
],
'status' => [
'capacitySource' => '<string>',
'failureMessage' => '<string>',
'observedGeneration' => 123,
'publishedPorts' => [
[
'accessCommand' => '<string>',
'exposure' => '<string>',
'guestPort' => 123,
'name' => '<string>',
'protocol' => '<string>',
'uriTemplate' => '<string>'
]
],
'readyForAccess' => true,
'resolvedImageRef' => '<string>',
'sshHostKeys' => [
[
'algorithm' => '<string>',
'publicKey' => '<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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines"
payload := strings.NewReader("{\n \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines")
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 \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": {
"sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
]
},
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": true
}
],
"resources": {
"cpu": 123,
"diskGiB": 123,
"memoryGiB": 123
}
},
"status": {
"capacitySource": "<string>",
"failureCode": "InvalidSpec",
"failureMessage": "<string>",
"observedGeneration": 123,
"phase": "Pending",
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": true,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<string>"
}
]
}
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}Create Virtual Machine
Creates one Virtual Machine in the tenant namespace.
curl --request POST \
--url https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": {
"sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
]
},
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": true
}
]
},
"status": {
"capacitySource": "<string>",
"failureMessage": "<string>",
"observedGeneration": 123,
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": true,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<string>"
}
]
}
}
'import requests
url = "https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines"
payload = {
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": { "sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
] },
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": True
}
]
},
"status": {
"capacitySource": "<string>",
"failureMessage": "<string>",
"observedGeneration": 123,
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": True,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<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({
apiVersion: 'compute.mountthor.com/v1alpha1',
kind: 'VirtualMachine',
metadata: {
name: '<string>',
annotations: {},
creationTimestamp: '2023-11-07T05:31:56Z',
deletionTimestamp: '2023-11-07T05:31:56Z',
generation: 1,
labels: {},
namespace: '<string>',
resourceVersion: '<string>',
uid: '<string>'
},
spec: {
imageRef: '<string>',
bootstrap: {sshAuthorizedKeys: [{publicKey: '<string>', username: '<string>'}]},
ports: [
{
guestPort: 32768,
name: '<string>',
exposure: 'private-tunnel',
protocol: '<string>',
readinessProbe: true
}
]
},
status: {
capacitySource: '<string>',
failureMessage: '<string>',
observedGeneration: 123,
publishedPorts: [
{
accessCommand: '<string>',
exposure: '<string>',
guestPort: 123,
name: '<string>',
protocol: '<string>',
uriTemplate: '<string>'
}
],
readyForAccess: true,
resolvedImageRef: '<string>',
sshHostKeys: [{algorithm: '<string>', publicKey: '<string>'}]
}
})
};
fetch('https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines', 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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines",
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([
'apiVersion' => 'compute.mountthor.com/v1alpha1',
'kind' => 'VirtualMachine',
'metadata' => [
'name' => '<string>',
'annotations' => [
],
'creationTimestamp' => '2023-11-07T05:31:56Z',
'deletionTimestamp' => '2023-11-07T05:31:56Z',
'generation' => 1,
'labels' => [
],
'namespace' => '<string>',
'resourceVersion' => '<string>',
'uid' => '<string>'
],
'spec' => [
'imageRef' => '<string>',
'bootstrap' => [
'sshAuthorizedKeys' => [
[
'publicKey' => '<string>',
'username' => '<string>'
]
]
],
'ports' => [
[
'guestPort' => 32768,
'name' => '<string>',
'exposure' => 'private-tunnel',
'protocol' => '<string>',
'readinessProbe' => true
]
]
],
'status' => [
'capacitySource' => '<string>',
'failureMessage' => '<string>',
'observedGeneration' => 123,
'publishedPorts' => [
[
'accessCommand' => '<string>',
'exposure' => '<string>',
'guestPort' => 123,
'name' => '<string>',
'protocol' => '<string>',
'uriTemplate' => '<string>'
]
],
'readyForAccess' => true,
'resolvedImageRef' => '<string>',
'sshHostKeys' => [
[
'algorithm' => '<string>',
'publicKey' => '<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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines"
payload := strings.NewReader("{\n \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\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.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountthor.com/v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines")
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 \"apiVersion\": \"compute.mountthor.com/v1alpha1\",\n \"kind\": \"VirtualMachine\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"creationTimestamp\": \"2023-11-07T05:31:56Z\",\n \"deletionTimestamp\": \"2023-11-07T05:31:56Z\",\n \"generation\": 1,\n \"labels\": {},\n \"namespace\": \"<string>\",\n \"resourceVersion\": \"<string>\",\n \"uid\": \"<string>\"\n },\n \"spec\": {\n \"imageRef\": \"<string>\",\n \"bootstrap\": {\n \"sshAuthorizedKeys\": [\n {\n \"publicKey\": \"<string>\",\n \"username\": \"<string>\"\n }\n ]\n },\n \"ports\": [\n {\n \"guestPort\": 32768,\n \"name\": \"<string>\",\n \"exposure\": \"private-tunnel\",\n \"protocol\": \"<string>\",\n \"readinessProbe\": true\n }\n ]\n },\n \"status\": {\n \"capacitySource\": \"<string>\",\n \"failureMessage\": \"<string>\",\n \"observedGeneration\": 123,\n \"publishedPorts\": [\n {\n \"accessCommand\": \"<string>\",\n \"exposure\": \"<string>\",\n \"guestPort\": 123,\n \"name\": \"<string>\",\n \"protocol\": \"<string>\",\n \"uriTemplate\": \"<string>\"\n }\n ],\n \"readyForAccess\": true,\n \"resolvedImageRef\": \"<string>\",\n \"sshHostKeys\": [\n {\n \"algorithm\": \"<string>\",\n \"publicKey\": \"<string>\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"apiVersion": "compute.mountthor.com/v1alpha1",
"kind": "VirtualMachine",
"metadata": {
"name": "<string>",
"annotations": {},
"creationTimestamp": "2023-11-07T05:31:56Z",
"deletionTimestamp": "2023-11-07T05:31:56Z",
"generation": 1,
"labels": {},
"namespace": "<string>",
"resourceVersion": "<string>",
"uid": "<string>"
},
"spec": {
"imageRef": "<string>",
"bootstrap": {
"sshAuthorizedKeys": [
{
"publicKey": "<string>",
"username": "<string>"
}
]
},
"ports": [
{
"guestPort": 32768,
"name": "<string>",
"exposure": "private-tunnel",
"protocol": "<string>",
"readinessProbe": true
}
],
"resources": {
"cpu": 123,
"diskGiB": 123,
"memoryGiB": 123
}
},
"status": {
"capacitySource": "<string>",
"failureCode": "InvalidSpec",
"failureMessage": "<string>",
"observedGeneration": 123,
"phase": "Pending",
"publishedPorts": [
{
"accessCommand": "<string>",
"exposure": "<string>",
"guestPort": 123,
"name": "<string>",
"protocol": "<string>",
"uriTemplate": "<string>"
}
],
"readyForAccess": true,
"resolvedImageRef": "<string>",
"sshHostKeys": [
{
"algorithm": "<string>",
"publicKey": "<string>"
}
]
}
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}{
"apiVersion": "v1",
"kind": "Status",
"status": "Success",
"code": 349,
"message": "<string>",
"reason": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Tenant namespace returned by Get Account.
Body
Customer-visible VirtualMachine resource in the Mount Thor Compute API.
Kubernetes API version. Must be compute.mountthor.com/v1alpha1.
compute.mountthor.com/v1alpha1 Kubernetes resource kind. Must be VirtualMachine.
VirtualMachine Customer-safe metadata for the VirtualMachine.
Show child attributes
Show child attributes
VirtualMachine spec is immutable. Delete and recreate the resource to change it.
Show child attributes
Show child attributes
VirtualMachineStatus defines the observed state of a VirtualMachine.
Show child attributes
Show child attributes
Response
Resource created
Customer-visible VirtualMachine resource in the Mount Thor Compute API.
Kubernetes API version. Must be compute.mountthor.com/v1alpha1.
compute.mountthor.com/v1alpha1 Kubernetes resource kind. Must be VirtualMachine.
VirtualMachine Customer-safe metadata for the VirtualMachine.
Show child attributes
Show child attributes
VirtualMachine spec is immutable. Delete and recreate the resource to change it.
Show child attributes
Show child attributes
VirtualMachineStatus defines the observed state of a VirtualMachine.
Show child attributes
Show child attributes