Go (SDK)
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Lks.ListLksAllocatableServers(ctx, "<value>", "<value>")
if err != nil {
log.Fatal(err)
}
if res.LksAllocatableServers != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.lks.listLksAllocatableServers({
filterProject: "<value>",
filterSite: "<value>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.latitude.sh/lks/allocatable_servers \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/lks/allocatable_servers"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/lks/allocatable_servers', 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.latitude.sh/lks/allocatable_servers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.latitude.sh/lks/allocatable_servers")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/allocatable_servers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "sv_9dQKr1pRMLyd",
"type": "lks_allocatable_servers",
"attributes": {
"hostname": "gpu-box-1",
"plan": {
"slug": "g3-large-x86",
"name": "g3.large.x86"
},
"status": "on",
"allocatable": true,
"reasons": [],
"node_pool_id": null,
"cluster_id": null
}
},
{
"id": "sv_pRMLydp0dQKr1",
"type": "lks_allocatable_servers",
"attributes": {
"hostname": "gpu-box-2",
"plan": {
"slug": "g3-large-x86",
"name": "g3.large.x86"
},
"status": "on",
"allocatable": false,
"reasons": [
"SERVER_LOCKED_ERROR"
],
"node_pool_id": null,
"cluster_id": null
}
}
],
"meta": {
"total": 2
}
}LKS
List servers that can join an allocated node pool
Lists a project’s servers at a site, with whether each one can join an allocated node pool right now. Pass the id of an allocatable server in server_ids when creating or updating an allocated node pool.
When allocatable is false, reasons lists why, using the same codes that node pool create and update return per server. node_pool_id and cluster_id identify the pool a server already belongs to.
GET
/
lks
/
allocatable_servers
Go (SDK)
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Lks.ListLksAllocatableServers(ctx, "<value>", "<value>")
if err != nil {
log.Fatal(err)
}
if res.LksAllocatableServers != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.lks.listLksAllocatableServers({
filterProject: "<value>",
filterSite: "<value>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.latitude.sh/lks/allocatable_servers \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/lks/allocatable_servers"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/lks/allocatable_servers', 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.latitude.sh/lks/allocatable_servers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.latitude.sh/lks/allocatable_servers")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/allocatable_servers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "sv_9dQKr1pRMLyd",
"type": "lks_allocatable_servers",
"attributes": {
"hostname": "gpu-box-1",
"plan": {
"slug": "g3-large-x86",
"name": "g3.large.x86"
},
"status": "on",
"allocatable": true,
"reasons": [],
"node_pool_id": null,
"cluster_id": null
}
},
{
"id": "sv_pRMLydp0dQKr1",
"type": "lks_allocatable_servers",
"attributes": {
"hostname": "gpu-box-2",
"plan": {
"slug": "g3-large-x86",
"name": "g3.large.x86"
},
"status": "on",
"allocatable": false,
"reasons": [
"SERVER_LOCKED_ERROR"
],
"node_pool_id": null,
"cluster_id": null
}
}
],
"meta": {
"total": 2
}
}Was this page helpful?