#![warn(missing_docs)]
use super::protos::{
Envelope, DeletePackageRequest,
StartAgentRequest, StopAgentRequest, GetAgentLogRequest, GetAgentPodsRequest, DeleteAgentPodRequest, DeleteAgentRequest
};
impl DeletePackageRequest {
pub fn byid(packageid: &str) -> Self {
Self {
packageid: packageid.to_string(),
}
}
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 {
pub fn byid(agentid: &str) -> Self {
Self {
agentid: agentid.to_string(),
}
}
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 {
pub fn byid(agentid: &str) -> Self {
Self {
agentid: agentid.to_string(),
}
}
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 {
pub fn new(agentid: &str, podname: &str) -> Self {
Self {
agentid: agentid.to_string(),
podname: podname.to_string()
}
}
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 {
pub fn byid(agentid: &str, include_stats: bool) -> Self {
Self {
agentid: agentid.to_string(),
stats: include_stats,
}
}
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 {
pub fn byid(agentid: &str, podname: &str) -> Self {
Self {
agentid: agentid.to_string(),
podname: podname.to_string(),
}
}
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 {
pub fn byid(agentid: &str) -> Self {
Self {
agentid: agentid.to_string(),
}
}
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()
}
}
}