Mountain/RPC/CocoonService/GenericRequest/Secrets/
Store.rs1#![allow(unused_variables, dead_code, unused_imports)]
2
3use serde_json::{Value, json};
4use tonic::Response;
5use CommonLibrary::Secret::SecretProvider::SecretProvider;
6
7use crate::{Environment::MountainEnvironment::MountainEnvironment, Vine::Generated::GenericResponse};
8
9pub async fn Fn(RequestId:u64, Params:Value, Env:&MountainEnvironment) -> Response<GenericResponse> {
10 let ExtensionId = Params.get("extensionId").and_then(|V| V.as_str()).unwrap_or("").to_string();
11
12 let Key = Params.get("key").and_then(|V| V.as_str()).unwrap_or("").to_string();
13
14 let V = Params.get("value").and_then(|V| V.as_str()).unwrap_or("").to_string();
15
16 match Env.StoreSecret(ExtensionId, Key, V).await {
17 Ok(()) => super::super::FileSystem::OkResponse(RequestId, &json!({ "success": true })),
18
19 Err(Error) => super::super::FileSystem::ErrResponse(RequestId, -32000, Error.to_string()),
20 }
21}