pub struct SecretClient { /* private fields */ }Expand description
Client for managing secrets.
Implementations§
Source§impl SecretClient
impl SecretClient
Sourcepub async fn put_secret(&self, key: &str, value: &str) -> Result<()>
pub async fn put_secret(&self, key: &str, value: &str) -> Result<()>
Store a secret.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn get_secret(&self, key: &str) -> Result<String>
pub async fn get_secret(&self, key: &str) -> Result<String>
Get a secret value
The server returns this as text/plain (the raw secret value, not a
JSON string), so this uses get_text rather than the generic JSON
get – see ApiClient::get_text.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn list_all_secret_names(&self) -> Result<HashSet<String>>
pub async fn list_all_secret_names(&self) -> Result<HashSet<String>>
List all secret names
This is POST /secrets, not GET. Both server families map the two
verbs to different operations: POST is the primary “list all secret
names” endpoint (SecretController.listAllNames on OSS,
SecretResource.listAllSecretNames on Orkes), while GET returns only
the names the caller has access to. On OSS the two happen to agree
because there is no RBAC, which is why the wrong verb went unnoticed.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn list_secrets_that_user_can_grant_access_to(
&self,
) -> Result<Vec<String>>
pub async fn list_secrets_that_user_can_grant_access_to( &self, ) -> Result<Vec<String>>
List secrets the caller has access to
GET /secrets. Orkes filters by the access query parameter (defaulting
to READ, with AND semantics across multiple values); OSS has no RBAC and
returns every name.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn delete_secret(&self, key: &str) -> Result<()>
pub async fn delete_secret(&self, key: &str) -> Result<()>
Delete a secret.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn secret_exists(&self, key: &str) -> Result<bool>
pub async fn secret_exists(&self, key: &str) -> Result<bool>
Check if a secret exists.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Set tags for a secret.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Get tags for a secret.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Delete tags from a secret.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.