infisical — The official Infisical Rust SDK
The Infisical Rust SDK (docs.rs) provides a convenient and ergonomic way to interact with Infisical programmatically using modern and idiomatic Rust.
Installation
Getting Started
The easiest way to get started is to use the builder pattern for both the client and your requests.
use ;
use GetSecretRequest;
use Error;
async
Core Methods
The SDK methods are organized into the following high-level categories:
Client::builder(): The main entry point for creating a client.client.login(): Allows client to make authenticated requests to the API.client.secrets(): Provides access to all CRUD operations for secrets.
secrets
All secret operations are accessed via client.secrets(). Each operation has a dedicated request builder.
Create Secret
Create a new secret in your project.
Example
use CreateSecretRequest;
let request = builder
.path
.secret_comment
.build;
let created_secret = client.secrets.create.await?;
Parameters
secret_name,secret_value,project_id,environment: Required parameters passed to thebuilder()function..path(path): Optional method to set the secret's path (defaults to/)..secret_comment(comment): Optional method to add a comment..skip_multiline_encoding(bool): Optional method to control multiline encoding (defaults tofalse)..r#type(type): Optional method to set the secret type (sharedorpersonal), defaults toshared.
Get Secret
Retrieve a specific secret by name.
Example
use GetSecretRequest;
let request = builder
.path
.build;
let secret = client.secrets.get.await?;
Parameters
secret_name,project_id,environment: Required parameters passed to thebuilder()function..path(path): Optional method to set the secret's path (defaults to/)..expand_secret_references(bool): Optional method to control secret reference expansion (defaults totrue)..r#type(type): Optional method to set the secret type (sharedorpersonal), defaults toshared.
List Secrets
List all secrets in a project and environment.
Example
use ListSecretsRequest;
let request = builder
.path
.recursive
.build;
let secrets = client.secrets.list.await?;
Parameters
project_id,environment: Required parameters passed to thebuilder()function..path(path): Optional method to set the path from which to list secrets (defaults to/)..expand_secret_references(bool): Optional method to control secret reference expansion (defaults totrue)..recursive(bool): Optional method to recursively list secrets from sub-folders (defaults tofalse)..attach_to_process_env(bool): Optional method to attach fetched secrets to the current process's environment variables (defaults tofalse).
Update Secret
Update an existing secret.
Example
use UpdateSecretRequest;
let request = builder
.secret_value // Set the new value
.build;
let updated_secret = client.secrets.update.await?;
Parameters
secret_name,project_id,environment: Required parameters passed to thebuilder()function..new_secret_name(name): Optional method to rename the secret..secret_value(value): Optional method to set a new value for the secret..path(path): Optional method to set the secret's path..secret_comment(comment): Optional method to add or change the comment..skip_multiline_encoding(bool): Optional method to control multiline encoding..r#type(type): Optional method to set the secret type (sharedorpersonal).
Delete Secret
Delete a secret from your project.
Example
use DeleteSecretRequest;
let request = builder
.path
.build;
let deleted_secret = client.secrets.delete.await?;
Parameters
secret_name,project_id,environment: Required parameters passed to thebuilder()function..path(path): Optional method to set the secret's path (defaults to/)..r#type(type): Optional method to set the secret type (sharedorpersonal), defaults toshared.