pub struct GoutAdminClient { /* private fields */ }Expand description
管理客户端。
使用 admin-api-key(非普通隧道 key)进行认证。
用于创建/删除普通隧道 key。
§示例
use gout_api::admin::GoutAdminClient;
let admin = GoutAdminClient::new("server.example.com:8080", "admin-key");
let key = admin.create_key("my laptop").await.unwrap();
println!("new key: {}", key.key);Implementations§
Source§impl GoutAdminClient
impl GoutAdminClient
Sourcepub fn new(server_addr: &str, admin_key: &str) -> Self
pub fn new(server_addr: &str, admin_key: &str) -> Self
创建一个新的 GoutAdminClient。
§参数
server_addr— 服务端地址,host:port格式admin_key— 服务端首次启动时打印到 stdout 的 admin API key
Sourcepub async fn create_key(&self, name: &str) -> Result<CreateKeyResponse>
pub async fn create_key(&self, name: &str) -> Result<CreateKeyResponse>
Sourcepub async fn delete_key(&self, key: &str) -> Result<bool>
pub async fn delete_key(&self, key: &str) -> Result<bool>
删除一个 API key。
返回 true 表示删除成功,false 表示 key 不存在。
不允许删除 admin key。
Auto Trait Implementations§
impl !RefUnwindSafe for GoutAdminClient
impl !UnwindSafe for GoutAdminClient
impl Freeze for GoutAdminClient
impl Send for GoutAdminClient
impl Sync for GoutAdminClient
impl Unpin for GoutAdminClient
impl UnsafeUnpin for GoutAdminClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more