1
2
3
4
5
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
42
43
44
45
use tonic::codegen::async_trait;
use crate::api::RuntimeMetadata;
use crate::error::Result;
#[async_trait]
/// Lifecycle and lookup contract for secrets providers.
pub trait SecretsProvider: Send + Sync + 'static {
/// Configures the provider before it starts serving requests.
async fn configure(
&self,
_name: &str,
_config: serde_json::Map<String, serde_json::Value>,
) -> Result<()> {
Ok(())
}
/// Returns runtime metadata that should augment the static manifest.
fn metadata(&self) -> Option<RuntimeMetadata> {
None
}
/// Returns non-fatal warnings the host should surface to users.
fn warnings(&self) -> Vec<String> {
Vec::new()
}
/// Performs an optional health check.
async fn health_check(&self) -> Result<()> {
Ok(())
}
/// Starts provider-owned background work after configuration.
async fn start(&self) -> Result<()> {
Ok(())
}
/// Shuts the provider down before the runtime exits.
async fn close(&self) -> Result<()> {
Ok(())
}
/// Looks up one named secret.
async fn get_secret(&self, name: &str) -> Result<String>;
}