pub mod executions {
use crate::Result;
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::Executions;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = Executions;
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::Executions>,
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::Executions>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
impl ListExecutions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(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::ListExecutionsResponse> {
(*self.0.stub)
.list_executions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListExecutionsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListExecutionsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_view<T: Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
self.0.request.view = v.into();
self
}
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListExecutions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateExecution(RequestBuilder<crate::model::CreateExecutionRequest>);
impl CreateExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateExecutionRequest>>(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::Execution> {
(*self.0.stub)
.create_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_execution<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_execution<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
impl GetExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(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::Execution> {
(*self.0.stub)
.get_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_view<T: Into<crate::model::ExecutionView>>(mut self, v: T) -> Self {
self.0.request.view = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
impl CancelExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(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::Execution> {
(*self.0.stub)
.cancel_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}