pub mod trace_service {
use crate::Result;
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::TraceService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = TraceService;
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::TraceService>,
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::TraceService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListTraces(RequestBuilder<crate::model::ListTracesRequest>);
impl ListTraces {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TraceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListTracesRequest>>(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::ListTracesResponse> {
(*self.0.stub)
.list_traces(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::ListTracesResponse, 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::ListTracesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.project_id = v.into();
self
}
pub fn set_view<T: Into<crate::model::list_traces_request::ViewType>>(
mut self,
v: T,
) -> Self {
self.0.request.view = 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_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.end_time = v.map(|x| x.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 ListTraces {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetTrace(RequestBuilder<crate::model::GetTraceRequest>);
impl GetTrace {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TraceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetTraceRequest>>(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::Trace> {
(*self.0.stub)
.get_trace(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.project_id = v.into();
self
}
pub fn set_trace_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.trace_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTrace {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct PatchTraces(RequestBuilder<crate::model::PatchTracesRequest>);
impl PatchTraces {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TraceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::PatchTracesRequest>>(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<()> {
(*self.0.stub)
.patch_traces(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.project_id = v.into();
self
}
pub fn set_traces<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Traces>,
{
self.0.request.traces = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_traces<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Traces>,
{
self.0.request.traces = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PatchTraces {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}