ya_etcd_rs/auth/
role_delete.rs

1use crate::ResponseHeader;
2use crate::proto::etcdserverpb;
3
4#[derive(Debug, Clone)]
5pub struct AuthRoleDeleteRequest {
6    proto: etcdserverpb::AuthRoleDeleteRequest,
7}
8
9impl AuthRoleDeleteRequest {
10    pub fn new(role: impl Into<String>) -> Self {
11        Self {
12            proto: etcdserverpb::AuthRoleDeleteRequest { role: role.into() },
13        }
14    }
15}
16
17impl<I> From<I> for AuthRoleDeleteRequest
18where
19    I: Into<String>,
20{
21    fn from(role: I) -> Self {
22        Self::new(role)
23    }
24}
25
26impl From<AuthRoleDeleteRequest> for etcdserverpb::AuthRoleDeleteRequest {
27    fn from(req: AuthRoleDeleteRequest) -> Self {
28        req.proto
29    }
30}
31
32#[derive(Debug, Clone)]
33pub struct AuthRoleDeleteResponse {
34    pub header: ResponseHeader,
35}
36
37impl From<etcdserverpb::AuthRoleDeleteResponse> for AuthRoleDeleteResponse {
38    fn from(proto: etcdserverpb::AuthRoleDeleteResponse) -> Self {
39        Self {
40            header: From::from(proto.header.expect("must fetch header")),
41        }
42    }
43}