pub async fn new(client: Client) -> Result<SecretStore> {
        // This API route is "internal", but the Vault CLI tool uses it
        // to find mount points, and we do too, because /sys/mounts requires
        // more permissions:
        let mut sys_auth: Value = client.get("/sys/internal/ui/mounts")
            .await
            .with_context(|| format!("Failed to get secret store information from Vault"))?;

        #[derive(Deserialize)]
        struct SysMountsData {
            r#type: String
        }
        let secret_mounts: HashMap<String,SysMountsData> = serde_json::from_value(sys_auth["data"]["secret"].take())
            .with_context(|| format!("Failed to get secret store information from Vault (unexpected response)"))?;

        let mount_points = secret_mounts
            .into_iter()
            .filter_map(|(mount,props)| {
                let ty = StorageType::from_str(&props.r#type).ok()?;
                let mount = mount.trim_matches('/').to_owned();
                Some((ty, mount))
            })
            .collect();

        Ok(SecretStore { client, mount_points })
    }
/// Create a new SecretStore instance that knows about the
/// available secret mount points
Create a new SecretStore instance that knows about the
available secret mount points
Create a new SecretStore instance that knows about the available secret mount points
pub async fn new(client: Client) -> Result<SecretStore> {
        // This API route is "internal", but the Vault CLI tool uses it
        // to find mount points, and we do too, because /sys/mounts requires
        // more permissions:
        let mut sys_auth: Value = client.get("/sys/internal/ui/mounts")
            .await
            .with_context(|| format!("Failed to get secret store information from Vault"))?;
        #[derive(Deserialize)]
        struct SysMountsData {
            r#type: String
        }
        let secret_mounts: HashMap<String,SysMountsData> = serde_json::from_value(sys_auth["data"]["secret"].take())
            .with_context(|| format!("Failed to get secret store information from Vault (unexpected response)"))?;
        let mount_points = secret_mounts
            .into_iter()
            .filter_map(|(mount,props)| {
                let ty = StorageType::from_str(&props.r#type).ok()?;
                let mount = mount.trim_matches('/').to_owned();
                Some((ty, mount))
            })
            .collect();
        Ok(SecretStore { client, mount_points })
    }
pub async fn new ( client : Client ) -> Result < SecretStore > { // This API route is "internal", but the Vault CLI tool uses it // to find mount points, and we do too, because /sys/mounts requires // more permissions: let mut sys_auth : Value = client . get ( " " ) . await . with_context ( | | format ! ( " " ) ) ? ; # [ derive ( Deserialize ) ] struct SysMountsData { r#type : String } let secret_mounts : HashMap < String , SysMountsData > = serde_json :: from_value ( sys_auth [ " " ] [ " " ] . take ( ) ) . with_context ( | | format ! ( " " ) ) ? ; let mount_points = secret_mounts . into_iter ( ) . filter_map ( | ( mount , props ) | { let ty = StorageType :: from_str ( & props . r#type ) . ok ( ) ? ; let mount = mount . trim_matches ( '/' ) . to_owned ( ) ; Some ( ( ty , mount ) ) } ) . collect ( ) ; Ok ( SecretStore { client , mount_points } ) }
Create a new SecretStore instance that knows about the
available secret mount points
Create a new SecretStore instance that knows about the available secret mount points
client
Client
client
Client