openiap_proto/
agent.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#![warn(missing_docs)]
use super::protos::{
    Envelope, DeletePackageRequest, 
    StartAgentRequest, StopAgentRequest, GetAgentLogRequest, GetAgentPodsRequest, DeleteAgentPodRequest, DeleteAgentRequest
};

impl DeletePackageRequest {
    /// Creates a new `DeletePackageRequest` with the given `packageid`.
    pub fn byid(packageid: &str) -> Self {
        Self {
            packageid: packageid.to_string(),
        }
    }
    /// Converts the `DeletePackageRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.DeletePackageRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "deletepackage".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }
}
impl StartAgentRequest {
    /// Creates a new `StartAgentRequest` with the given `agentid`.
    pub fn byid(agentid: &str) -> Self {
        Self {
            agentid: agentid.to_string(),
        }
    }
    /// Converts the `StartAgentRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.StartAgentRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "startagent".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}
impl StopAgentRequest {
    /// Creates a new `StopAgentRequest` with the given `agentid`.
    pub fn byid(agentid: &str) -> Self {
        Self {
            agentid: agentid.to_string(),
        }
    }
    /// Converts the `StopAgentRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.StopAgentRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "stopagent".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}
impl GetAgentLogRequest {
    /// Creates a new `GetAgentLogRequest` with the given `agentid`.
    pub fn new(agentid: &str, podname: &str) -> Self {
        Self {
            agentid: agentid.to_string(),
            podname: podname.to_string()
        }
    }
    /// Converts the `GetAgentLogRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.GetAgentLogRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "getagentlog".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}
impl GetAgentPodsRequest {
    /// Creates a new `GetAgentPodsRequest` with the given `agentid`. Use include_stats to get memory and cpu usage per pod, this is expensive, avoid misuse.
    pub fn byid(agentid: &str, include_stats: bool) -> Self {
        Self {
            agentid: agentid.to_string(),
            stats: include_stats,
        }
    }
    /// Converts the `GetAgentPodsRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.GetAgentPodsRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "getagentpods".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}
impl DeleteAgentPodRequest {
    /// Creates a new `DeleteAgentPodRequest` with the given `agentid` and `podname`.
    pub fn byid(agentid: &str, podname: &str) -> Self {
        Self {
            agentid: agentid.to_string(),
            podname: podname.to_string(),
        }
    }
    /// Converts the `DeleteAgentPodRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.DeleteAgentPodRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "deleteagentpod".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}
impl DeleteAgentRequest {
    /// Creates a new `DeleteAgentRequest` with the given `agentid`.
    pub fn byid(agentid: &str) -> Self {
        Self {
            agentid: agentid.to_string(),
        }
    }
    /// Converts the `DeleteAgentRequest` to an `Envelope`.
    pub fn to_envelope(&self) -> Envelope {
        let any_message = prost_types::Any {
            type_url: "type.googleapis.com/openiap.DeleteAgentRequest".to_string(),
            value: {
                let mut buf = Vec::new();
                prost::Message::encode(self, &mut buf).unwrap_or(());
                buf
            },
        };
        Envelope {
            command: "deleteagent".into(),
            data: Some(any_message.clone()),
            ..Default::default() 
        }
    }    
}