pub struct Sdk { /* private fields */ }Expand description
The main entry point for the Tensorlake Cloud SDK.
The Sdk struct provides a unified interface to all Tensorlake Cloud services.
It manages authentication and provides access to various service clients.
§Example
use tensorlake::Sdk;
let sdk = Sdk::new("https://api.tensorlake.ai", "your-api-key").unwrap();
// Access different service clients
let apps_client = sdk.applications();
let secrets_client = sdk.secrets();Implementations§
Source§impl Sdk
impl Sdk
Sourcepub fn new(base_url: &str, bearer_token: &str) -> Result<Self, SdkError>
pub fn new(base_url: &str, bearer_token: &str) -> Result<Self, SdkError>
Create a new SDK instance with the specified base URL and bearer token.
§Arguments
base_url- The base URL of the Tensorlake Cloud API (e.g., “https://api.tensorlake.ai”)bearer_token- Your API key for authentication
§Returns
Returns a new Sdk instance configured with the provided credentials.
§Errors
Returns an error if the HTTP client cannot be created or configured.
§Example
use tensorlake::Sdk;
let sdk = Sdk::new("https://api.tensorlake.ai", "your-api-key").unwrap();
Ok(())Sourcepub fn with_client_builder(builder: ClientBuilder) -> Result<Self, SdkError>
pub fn with_client_builder(builder: ClientBuilder) -> Result<Self, SdkError>
Create a new SDK instance using a client builder.
This method allows for more flexible configuration of the SDK client, including custom middleware, bearer tokens, and organization/project scopes.
§Arguments
builder- A configuredClientBuilder
§Returns
Returns a new Sdk instance configured with the builder’s settings.
§Errors
Returns an error if the HTTP client cannot be created or configured.
§Example
use tensorlake::{Sdk, ClientBuilder};
let builder = ClientBuilder::new("https://api.tensorlake.ai")
.bearer_token("your-api-key")
.scope("org-id", "project-id");
let sdk = Sdk::with_client_builder(builder)?;
Ok(())Sourcepub fn applications(&self) -> ApplicationsClient
pub fn applications(&self) -> ApplicationsClient
Get a client for managing applications and requests.
This method returns an ApplicationsClient that provides methods for:
- Listing, creating, updating, and deleting applications
- Invoking applications with data
- Managing execution requests
§Returns
Returns an ApplicationsClient instance configured with the SDK’s authentication.
§Example
use tensorlake::{Sdk, applications::models::ListApplicationsRequest};
async fn example() -> Result<(), Box<dyn std::error::Error>> {
let sdk = Sdk::new("https://api.tensorlake.ai", "your-api-key")?;
let apps_client = sdk.applications();
// Use the applications client
let request = ListApplicationsRequest::builder()
.namespace("default".to_string())
.build()?;
apps_client.list(&request).await?;
Ok(())
}Sourcepub fn images(&self) -> ImagesClient
pub fn images(&self) -> ImagesClient
Get a client for building and managing container images.
This method returns an ImagesClient that provides methods for:
- Building container images from source code and Dockerfiles
- Monitoring build progress and status
§Returns
Returns an ImagesClient instance configured with the SDK’s authentication.
§Example
use tensorlake::Sdk;
let sdk = Sdk::new("https://api.tensorlake.ai", "your-api-key").unwrap();
let images_client = sdk.images();
// Use the images client
// let result = images_client.build_image(request).await?;Sourcepub fn sandbox_templates(
&self,
organization_id: &str,
project_id: &str,
) -> SandboxTemplatesClient
pub fn sandbox_templates( &self, organization_id: &str, project_id: &str, ) -> SandboxTemplatesClient
Get a client for managing snapshot-backed sandbox image registrations.
Sourcepub fn sandboxes(
&self,
namespace: &str,
use_namespaced_endpoints: bool,
) -> SandboxesClient
pub fn sandboxes( &self, namespace: &str, use_namespaced_endpoints: bool, ) -> SandboxesClient
Get a client for managing sandbox lifecycle, pools, and snapshots.
§Arguments
namespace- Namespace used whenuse_namespaced_endpointsis trueuse_namespaced_endpoints- If true, use/v1/namespaces/{namespace}/...paths. If false, use cloud-style top-level paths such as/sandboxes.
Sourcepub fn document_ai(&self) -> DocumentAiClient
pub fn document_ai(&self) -> DocumentAiClient
Get a client for Document AI APIs.
Sourcepub fn secrets(&self) -> SecretsClient
pub fn secrets(&self) -> SecretsClient
Get a client for managing secrets.
This method returns a SecretsClient that provides methods for:
- Creating, updating, and deleting secrets
- Listing secrets in a project
- Retrieving individual secret details
§Returns
Returns a SecretsClient instance configured with the SDK’s authentication.
§Example
use tensorlake::{Sdk, secrets::models::ListSecretsRequest};
async fn example() -> Result<(), Box<dyn std::error::Error>> {
let sdk = Sdk::new("https://api.tensorlake.ai", "your-api-key")?;
let secrets_client = sdk.secrets();
// Use the secrets client
let request = ListSecretsRequest::builder()
.organization_id("org-id".to_string())
.project_id("project-id".to_string())
.build()?;
secrets_client.list(&request).await?;
Ok(())
}Sourcepub fn cron(&self) -> CronClient
pub fn cron(&self) -> CronClient
Get a client for managing cron schedules for applications.