pub mod service_controller {
use crate::Result;
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ServiceController;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ServiceController;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct Check(RequestBuilder<crate::model::CheckRequest>);
impl Check {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CheckRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::CheckResponse> {
(*self.0.stub)
.check(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_name = v.into();
self
}
pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_config_id = v.into();
self
}
pub fn set_attributes<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc_context::model::AttributeContext>,
{
self.0.request.attributes = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc_context::model::AttributeContext>,
{
self.0.request.attributes = v.map(|x| x.into());
self
}
pub fn set_resources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ResourceInfo>,
{
use std::iter::Iterator;
self.0.request.resources = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_flags<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.flags = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Check {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct Report(RequestBuilder<crate::model::ReportRequest>);
impl Report {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ReportRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ReportResponse> {
(*self.0.stub)
.report(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_name = v.into();
self
}
pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_config_id = v.into();
self
}
pub fn set_operations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc_context::model::AttributeContext>,
{
use std::iter::Iterator;
self.0.request.operations = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Report {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}