pub async fn read(&self, key: &str) -> Result<String> {
        let pth = format!("secret/{}", key);
        if self.mode == Mode::Mocked {
            // arbitrary base64 encoded value so it's compatible with everything
            return Ok("aGVsbG8gd29ybGQ=".into());
        }

        let secret = self
            .get_secret(&pth)
            .await
            .chain_err(|| ErrorKind::SecretNotAccessible(pth.clone()))?;

        // NB: Currently assume each path in vault has a single `value`
        // Read the value key (which should exist)
        secret
            .data
            .get("value")
            .ok_or_else(|| ErrorKind::InvalidSecretForm(pth).into())
            .map(|v| v.clone().into())
    }
/// Read secret from a Vault via an authenticated HTTP GET (or memory cache)
Read secret from a Vault via an authenticated HTTP GET (or memory cache)
Read secret from a Vault via an authenticated HTTP GET ( or memory cache )
pub async fn read(&self, key: &str) -> Result<String> {
        let pth = format!("secret/{}", key);
        if self.mode == Mode::Mocked {
            // arbitrary base64 encoded value so it's compatible with everything
            return Ok("aGVsbG8gd29ybGQ=".into());
        }
        let secret = self
            .get_secret(&pth)
            .await
            .chain_err(|| ErrorKind::SecretNotAccessible(pth.clone()))?;
        // NB: Currently assume each path in vault has a single `value`
        // Read the value key (which should exist)
        secret
            .data
            .get("value")
            .ok_or_else(|| ErrorKind::InvalidSecretForm(pth).into())
            .map(|v| v.clone().into())
    }
pub async fn read ( & self , key : & str ) -> Result < String > { let pth = format ! ( " " key ) ; if self . mode == Mode :: Mocked { // arbitrary base64 encoded value so it's compatible with everything return Ok ( " " . into ( ) ) ; } let secret = self . get_secret ( & pth ) . await . chain_err ( | | ErrorKind :: SecretNotAccessible ( pth . clone ( ) ) ) ? ; // NB: Currently assume each path in vault has a single `value` // Read the value key (which should exist) secret . data . get ( " " ) . ok_or_else ( | | ErrorKind :: InvalidSecretForm ( pth ) . into ( ) ) . map ( | v | v . clone ( ) . into ( ) ) }
Read secret from a Vault via an authenticated HTTP GET (or memory cache)
Read secret from a Vault via an authenticated HTTP GET ( or memory cache )
&self
key
&str
&self
key
&str