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.FilesystemStorage.GetFilesystemAttachment(ctx, "<id>", "<id>")
if err != nil {
log.Fatal(err)
}
if res.Object != 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.filesystemStorage.getFilesystemAttachment({
filesystemId: "<id>",
serverId: "<id>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach"
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/storage/filesystems/{filesystem_id}/attach', 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/storage/filesystems/{filesystem_id}/attach",
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/storage/filesystems/{filesystem_id}/attach")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach")
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": "fs_7vYAZqGBdMQ94_sv_RLYV8DZ2D5QoE",
"type": "filesystem_attachments",
"attributes": {
"filesystem_id": "fs_7vYAZqGBdMQ94",
"server_id": "sv_RLYV8DZ2D5QoE",
"status": "attached",
"failure_reason": null,
"storage_network": {
"vid": 3001,
"host_cidr": "10.248.215.28/24",
"gateway": "10.248.215.1",
"routes": [
"10.248.213.0/24"
]
}
}
},
"meta": {}
}Filesystem Storage
Get filesystem attachment
Returns whether a server is attached to the storage network the filesystem is served on. Poll it after attaching: once the status is “attached”, configure the returned storage network on the server and mount the filesystem.
GET
/
storage
/
filesystems
/
{filesystem_id}
/
attach
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.FilesystemStorage.GetFilesystemAttachment(ctx, "<id>", "<id>")
if err != nil {
log.Fatal(err)
}
if res.Object != 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.filesystemStorage.getFilesystemAttachment({
filesystemId: "<id>",
serverId: "<id>",
});
console.log(result);
}
run();curl --request GET \
--url https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach"
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/storage/filesystems/{filesystem_id}/attach', 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/storage/filesystems/{filesystem_id}/attach",
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/storage/filesystems/{filesystem_id}/attach")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/storage/filesystems/{filesystem_id}/attach")
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": "fs_7vYAZqGBdMQ94_sv_RLYV8DZ2D5QoE",
"type": "filesystem_attachments",
"attributes": {
"filesystem_id": "fs_7vYAZqGBdMQ94",
"server_id": "sv_RLYV8DZ2D5QoE",
"status": "attached",
"failure_reason": null,
"storage_network": {
"vid": 3001,
"host_cidr": "10.248.215.28/24",
"gateway": "10.248.215.1",
"routes": [
"10.248.213.0/24"
]
}
}
},
"meta": {}
}Was this page helpful?