Skip to content

wesleylambda/lambda-cloud-dart-sdk

 
 

Repository files navigation

openapi

The Lambda Cloud API provides a set of REST API endpoints you can use to create and manage your Lambda Cloud resources.

Requests to the API are generally limited to one request per second. Requests to the /instance-operations/launch endpoint are limited to one request per 12 seconds, or five requests per minute.

Response types and formats

The format of each response object depends on whether the request succeeded or failed.

Success responses

When a request succeeds, the API returns a response object in the following format. <PAYLOAD> represents the endpoint-specific data object returned as part of the response object.

{
    \"data\": <PAYLOAD>
}

Error responses

When a request fails, the API returns an error response object in the following format:

{
    \"error\": {
        \"code\": string,
        \"message\": string,
        \"suggestion\": string?
    }
}
  • code: A machine- and human-readable error code specific to a particular failure mode.
  • message: An explanation of the error.
  • suggestion: When present, a suggestion for how to address the error.
Note
When handling errors, avoid relying on the values of message or suggestion, as these values are subject to change. Instead, use the value of code.

Provider errors

In some cases, you might receive errors that come from upstream services/providers rather than directly from Lambda services. You can identify these errors by their error code prefix, provider/.

Common provider errors include:

  • Network outages or connectivity issues
  • Service unavailability
  • Quota limitations or resource exhaustion

An example of a typical service unavailability error:

{
  \"error\": {
    \"code\": \"provider/internal-unavailable\",
    \"message\": \"Provider unavailable\",
    \"suggestion\": \"Try again shortly\",
  }
}

Authentication

The Lambda Cloud API uses API keys to authenticate incoming requests. You can generate a new API key pair or view your existing API keys by visiting the <a href="/api-keys" style="color: var(--highlight-primary); text-decoration: none" target="_blank">API keys page in the Lambda Cloud dashboard.

In general, Lambda recommends passing an HTTP Bearer header that contains your API key:

Authorization: Bearer <YOUR-API-KEY>

Authenticating with curl

The API also supports passing an HTTP Basic header. This option chiefly exists to support curl's -u flag, which allows you to pass your credentials without having to write out the full Authorization: Basic header string. For example:

curl -X GET \"https://cloud.lambda.ai/api/v1/instances\" \\
  -H 'accept: application/json' \\
  -u '<YOUR-API-KEY>:'

If your use case requires it, you can also pass the HTTP Basic header directly. The value you pass must be a Base64-encoded string containing your API key and a trailing colon:

Authorization: Basic <BASE64-ENCODED-API-KEY-WITH-COLON>
Important
If you make a request without including a supported Authorization header, the request will fail.

This Dart package is automatically generated by the OpenAPI Generator project:

  • API version: 1.8.0
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.DartClientCodegen

Requirements

Dart 2.12 or later

Installation & Usage

Github

If this Dart package is published to Github, add the following dependency to your pubspec.yaml

dependencies:
  openapi:
    git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git

Local

To use the package in your local drive, add the following dependency to your pubspec.yaml

dependencies:
  openapi:
    path: /path/to/openapi

Tests

TODO

Getting Started

Please follow the installation procedure and then run the following:

import 'package:openapi/api.dart';

// TODO Configure HTTP basic authorization: basicAuth
//defaultApiClient.getAuthentication<HttpBasicAuth>('basicAuth').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('basicAuth').password = 'YOUR_PASSWORD';
// TODO Configure HTTP Bearer authorization: bearerAuth
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearerAuth').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearerAuth').setAccessToken(yourTokenGeneratorFunction);

final api_instance = FilesystemsApi();
final filesystemCreateRequest = FilesystemCreateRequest(); // FilesystemCreateRequest | 

try {
    final result = api_instance.createFilesystem(filesystemCreateRequest);
    print(result);
} catch (e) {
    print('Exception when calling FilesystemsApi->createFilesystem: $e\n');
}

Documentation for API Endpoints

All URIs are relative to https://cloud.lambda.ai

Class Method HTTP request Description
FilesystemsApi createFilesystem POST /api/v1/filesystems Create filesystem
FilesystemsApi filesystemDelete DELETE /api/v1/filesystems/{id} Delete filesystem
FilesystemsApi listFilesystems GET /api/v1/file-systems List filesystems
FirewallsApi createFirewallRuleset POST /api/v1/firewall-rulesets Create firewall ruleset
FirewallsApi deleteFirewallRuleset DELETE /api/v1/firewall-rulesets/{id} Delete firewall ruleset
FirewallsApi firewallRulesList GET /api/v1/firewall-rules List inbound firewall rules
FirewallsApi firewallRulesSet PUT /api/v1/firewall-rules Replace inbound firewall rules
FirewallsApi firewallRulesetsList GET /api/v1/firewall-rulesets List firewall rulesets
FirewallsApi getFirewallRuleset GET /api/v1/firewall-rulesets/{id} Retrieve firewall ruleset details
FirewallsApi getGlobalFirewallRuleset GET /api/v1/firewall-rulesets/global Retrieve global firewall ruleset details
FirewallsApi updateFirewallRuleset PATCH /api/v1/firewall-rulesets/{id} Update firewall ruleset
FirewallsApi updateGlobalFirewallRuleset PATCH /api/v1/firewall-rulesets/global Update global firewall ruleset
ImagesApi listImages GET /api/v1/images List available images
InstancesApi getInstance GET /api/v1/instances/{id} Retrieve instance details
InstancesApi launchInstance POST /api/v1/instance-operations/launch Launch instances
InstancesApi listInstanceTypes GET /api/v1/instance-types List available instance types
InstancesApi listInstances GET /api/v1/instances List running instances
InstancesApi postInstance POST /api/v1/instances/{id} Update instance details
InstancesApi restartInstance POST /api/v1/instance-operations/restart Restart instances
InstancesApi terminateInstance POST /api/v1/instance-operations/terminate Terminate instances
SSHKeysApi addSSHKey POST /api/v1/ssh-keys Add an SSH key
SSHKeysApi deleteSSHKey DELETE /api/v1/ssh-keys/{id} Delete an SSH key
SSHKeysApi listSSHKeys GET /api/v1/ssh-keys List your SSH keys

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP Basic authentication

bearerAuth

  • Type: HTTP Bearer authentication

Author

About

Generated API client for the Lambda Cloud API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Dart 99.6%
  • Shell 0.4%