Struct fly_sdk::secrets::SecretsManager
source · pub struct SecretsManager { /* private fields */ }Implementations§
source§impl SecretsManager
impl SecretsManager
pub fn new(client: Client, api_token: String) -> Self
sourcepub async fn list_secrets(
&self,
app_name: &str,
) -> Result<Vec<Secret>, Box<dyn Error>>
pub async fn list_secrets( &self, app_name: &str, ) -> Result<Vec<Secret>, Box<dyn Error>>
Examples found in repository?
examples/secrets.rs (line 35)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let fly = FlyControl::new(api_token.to_string());
let app_name = "rusty-app";
fly.apps.create(app_name, org_slug).await?;
// SECRETS
let secret_label = "test_secret";
let secret_type = "secret";
fly.secrets
.create_secret(
app_name,
secret_label,
secret_type,
secrets::SecretValue::new(vec![123]),
)
.await?;
fly.secrets.list_secrets(app_name).await?;
fly.secrets.destroy_secret(app_name, secret_label).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}sourcepub async fn create_secret(
&self,
app_name: &str,
secret_label: &str,
secret_type: &str,
value_request: SecretValue,
) -> Result<Secret, Box<dyn Error>>
pub async fn create_secret( &self, app_name: &str, secret_label: &str, secret_type: &str, value_request: SecretValue, ) -> Result<Secret, Box<dyn Error>>
Examples found in repository?
examples/secrets.rs (lines 28-33)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let fly = FlyControl::new(api_token.to_string());
let app_name = "rusty-app";
fly.apps.create(app_name, org_slug).await?;
// SECRETS
let secret_label = "test_secret";
let secret_type = "secret";
fly.secrets
.create_secret(
app_name,
secret_label,
secret_type,
secrets::SecretValue::new(vec![123]),
)
.await?;
fly.secrets.list_secrets(app_name).await?;
fly.secrets.destroy_secret(app_name, secret_label).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}pub async fn generate_secret( &self, app_name: &str, secret_label: &str, secret_type: &str, ) -> Result<(), Box<dyn Error>>
sourcepub async fn destroy_secret(
&self,
app_name: &str,
secret_label: &str,
) -> Result<(), Box<dyn Error>>
pub async fn destroy_secret( &self, app_name: &str, secret_label: &str, ) -> Result<(), Box<dyn Error>>
Examples found in repository?
examples/secrets.rs (line 36)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::registry()
.with(fmt::layer().with_writer(std::io::stdout))
.with(EnvFilter::new(
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".into()),
))
.init();
let api_token = std::env::var("FLY_ORG_TOKEN").expect("FLY_ORG_TOKEN must be set");
let args: Vec<String> = std::env::args().collect();
let org_slug = &args
.get(1)
.expect("Usage: cargo run --example apps <org_slug>");
let fly = FlyControl::new(api_token.to_string());
let app_name = "rusty-app";
fly.apps.create(app_name, org_slug).await?;
// SECRETS
let secret_label = "test_secret";
let secret_type = "secret";
fly.secrets
.create_secret(
app_name,
secret_label,
secret_type,
secrets::SecretValue::new(vec![123]),
)
.await?;
fly.secrets.list_secrets(app_name).await?;
fly.secrets.destroy_secret(app_name, secret_label).await?;
fly.apps.delete(app_name, false).await?;
Ok(())
}Auto Trait Implementations§
impl Freeze for SecretsManager
impl !RefUnwindSafe for SecretsManager
impl Send for SecretsManager
impl Sync for SecretsManager
impl Unpin for SecretsManager
impl !UnwindSafe for SecretsManager
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more