Cloudfleet SDK for TypeScript & JavaScript
Official TypeScript/JavaScript SDK for the Cloudfleet API.
Cloudfleet is a managed Kubernetes platform that runs your clusters across any cloud and your own bare-metal servers. This SDK is a fully typed client for automating clusters, fleets, nodes, and billing from Node.js, the browser, or any TypeScript project.
- 🌐 Homepage: cloudfleet.ai
- 📚 Docs: cloudfleet.ai/docs
Installation
npm install @cloudfleet/sdk
Usage
import { client } from "@cloudfleet/sdk";
client.setConfig({
baseUrl: "https://api.cloudfleet.ai/v1",
headers: {
Authorization: "Bearer <your-token>",
},
});
Errors
Failed requests throw (or return as error when throwOnError is false) Error subclasses:
CloudfleetApiError: the API answered with a non-2xx status. Carriesstatus,method,path(the route template, e.g./clusters/{cluster_id}),url,requestId,code,reason(KubernetesStatus.reasonfor cluster proxy calls), and the parsed responsebody.messageis the body'smessage, or the response text when the body is not JSON. Other body fields, such as Kubernetesdetails, are onbody.CloudfleetNetworkError: no response was received. Carriesmethod,path,url, and the originalfetcherror ascause.
Aborted requests and request or response validation errors are thrown unchanged.
message is the server's text and can contain personal data, such as the user's email in Kubernetes RBAC errors. When reporting errors to telemetry, title and group them by method, path and status, which never contain IDs or names.
KubernetesService calls always throw on failure, regardless of the client's throwOnError setting.
import { CloudfleetApiError, ClustersService } from "@cloudfleet/sdk";
try {
await ClustersService.getCluster({
path: { cluster_id: id },
throwOnError: true,
});
} catch (err) {
if (err instanceof CloudfleetApiError && err.status === 404) {
// cluster does not exist
}
}
The default client converts errors automatically. For a client made with createClient, register the conversion with registerCloudfleetErrors(myClient).
The package ships full TypeScript types and an optional @tanstack/react-query integration via @cloudfleet/sdk/@tanstack/react-query. See the Cloudfleet docs for the full API reference and authentication details.
License
MIT