Go (SDK)
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Clusters.UpdateProjectClusterNodeGroup(ctx, "proj_lxWpD699qm6rk", "7", components.UpdateClusterNodeGroup{
Data: components.UpdateClusterNodeGroupData{
Type: components.UpdateClusterNodeGroupTypeClusterNodeGroups,
Attributes: components.UpdateClusterNodeGroupAttributes{
ServerCount: latitudeshgosdk.Pointer[int64](32),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.ClusterNodeGroup != 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.clusters.updateProjectClusterNodeGroup({
projectId: "proj_lxWpD699qm6rk",
id: "7",
updateClusterNodeGroup: {
data: {
type: "cluster_node_groups",
attributes: {
serverCount: 32,
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "cluster_node_groups",
"attributes": {
"server_count": 32
}
}
}
'import requests
url = "https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}"
payload = { "data": {
"type": "cluster_node_groups",
"attributes": { "server_count": 32 }
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: {type: 'cluster_node_groups', attributes: {server_count: 32}}})
};
fetch('https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{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.latitude.sh/projects/{project_id}/cluster/node_groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'cluster_node_groups',
'attributes' => [
'server_count' => 32
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"cluster_node_groups\",\n \"attributes\": {\n \"server_count\": 32\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"cluster_node_groups\",\n \"attributes\": {\n \"server_count\": 32\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "7",
"type": "cluster_node_groups",
"attributes": {
"name": "gpu-b300",
"kind": "gpu",
"plan": "g4-b300-large",
"plan_name": "g4.b300.large",
"server_count": 32,
"os": "ubuntu_24_04_x64_lts"
}
}
}Clusters
Update a cluster node group
Changes the attributes sent of one of your cluster’s node groups. Only available for projects that have a GPU cluster; any other project answers 404 PROJECT_NOT_A_CLUSTER. Signed requirements need to be signed again. Needs an owner, administrator or collaborator.
PATCH
/
projects
/
{project_id}
/
cluster
/
node_groups
/
{id}
Go (SDK)
package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Clusters.UpdateProjectClusterNodeGroup(ctx, "proj_lxWpD699qm6rk", "7", components.UpdateClusterNodeGroup{
Data: components.UpdateClusterNodeGroupData{
Type: components.UpdateClusterNodeGroupTypeClusterNodeGroups,
Attributes: components.UpdateClusterNodeGroupAttributes{
ServerCount: latitudeshgosdk.Pointer[int64](32),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.ClusterNodeGroup != 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.clusters.updateProjectClusterNodeGroup({
projectId: "proj_lxWpD699qm6rk",
id: "7",
updateClusterNodeGroup: {
data: {
type: "cluster_node_groups",
attributes: {
serverCount: 32,
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "cluster_node_groups",
"attributes": {
"server_count": 32
}
}
}
'import requests
url = "https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}"
payload = { "data": {
"type": "cluster_node_groups",
"attributes": { "server_count": 32 }
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: {type: 'cluster_node_groups', attributes: {server_count: 32}}})
};
fetch('https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{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.latitude.sh/projects/{project_id}/cluster/node_groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'cluster_node_groups',
'attributes' => [
'server_count' => 32
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"cluster_node_groups\",\n \"attributes\": {\n \"server_count\": 32\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/projects/{project_id}/cluster/node_groups/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"cluster_node_groups\",\n \"attributes\": {\n \"server_count\": 32\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "7",
"type": "cluster_node_groups",
"attributes": {
"name": "gpu-b300",
"kind": "gpu",
"plan": "g4-b300-large",
"plan_name": "g4.b300.large",
"server_count": 32,
"os": "ubuntu_24_04_x64_lts"
}
}
}Was this page helpful?