make regen-apis

This commit is contained in:
OMGeeky
2023-10-21 23:50:27 +02:00
parent b09392b768
commit ec6083f22f
1959 changed files with 911619 additions and 913545 deletions

View File

@@ -1,408 +1,4 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
/// Write Trace data for a project or application
TraceAppend,
/// Read Trace data for a project or application
TraceReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append",
Scope::TraceReadonly => "https://www.googleapis.com/auth/trace.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::TraceReadonly
}
}
// ########
// HUB ###
// ######
/// Central instance to access all CloudTrace related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_cloudtrace1 as cloudtrace1;
/// use cloudtrace1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use cloudtrace1::{CloudTrace, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = CloudTrace::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().traces_get("projectId", "traceId")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct CloudTrace<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for CloudTrace<S> {}
impl<'a, S> CloudTrace<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> CloudTrace<S> {
CloudTrace {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://cloudtrace.googleapis.com/".to_string(),
_root_url: "https://cloudtrace.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://cloudtrace.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://cloudtrace.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [patch traces projects](ProjectPatchTraceCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// The response message for the `ListTraces` method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [traces list projects](ProjectTraceListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListTracesResponse {
/// If defined, indicates that there are more traces that match the request and that this value should be passed to the next request to continue retrieving additional traces.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// List of trace records as specified by the view parameter.
pub traces: Option<Vec<Trace>>,
}
impl client::ResponseResult for ListTracesResponse {}
/// A trace describes how long it takes for an application to perform an operation. It consists of a set of spans, each of which represent a single timed event within the operation.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [traces get projects](ProjectTraceGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Trace {
/// Project ID of the Cloud project where the trace data is stored.
#[serde(rename="projectId")]
pub project_id: Option<String>,
/// Collection of spans in the trace.
pub spans: Option<Vec<TraceSpan>>,
/// Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. For example, `382d4f4c6b7bb2f4a972559d9085001d`. The numeric value should not be zero.
#[serde(rename="traceId")]
pub trace_id: Option<String>,
}
impl client::ResponseResult for Trace {}
/// A span represents a single timed event within a trace. Spans can be nested and form a trace tree. Often, a trace contains a root span that describes the end-to-end latency of an operation and, optionally, one or more subspans for its suboperations. Spans do not need to be contiguous. There may be gaps between spans in a trace.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TraceSpan {
/// End time of the span in nanoseconds from the UNIX epoch.
#[serde(rename="endTime")]
pub end_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `RPC_CLIENT` and `RPC_SERVER` to identify queueing latency associated with the span.
pub kind: Option<String>,
/// Collection of labels associated with the span. Label keys must be less than 128 bytes. Label values must be less than 16 kilobytes (10MB for `/stacktrace` values). Some predefined label keys exist, or you may create your own. When creating your own, we recommend the following formats: * `/category/product/key` for agents of well-known products (e.g. `/db/mongodb/read_size`). * `short_host/path/key` for domain-specific keys (e.g. `foo.com/myproduct/bar`) Predefined labels include: * `/agent` * `/component` * `/error/message` * `/error/name` * `/http/client_city` * `/http/client_country` * `/http/client_protocol` * `/http/client_region` * `/http/host` * `/http/method` * `/http/path` * `/http/redirected_url` * `/http/request/size` * `/http/response/size` * `/http/route` * `/http/status_code` * `/http/url` * `/http/user_agent` * `/pid` * `/stacktrace` * `/tid`
pub labels: Option<HashMap<String, String>>,
/// Name of the span. Must be less than 128 bytes. The span name is sanitized and displayed in the Trace tool in the Google Cloud Platform Console. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans.
pub name: Option<String>,
/// Optional. ID of the parent span, if any.
#[serde(rename="parentSpanId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub parent_span_id: Option<u64>,
/// Identifier for the span. Must be a 64-bit integer other than 0 and unique within a trace. For example, `2205310701640571284`.
#[serde(rename="spanId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub span_id: Option<u64>,
/// Start time of the span in nanoseconds from the UNIX epoch.
#[serde(rename="startTime")]
pub start_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for TraceSpan {}
/// List of new or updated traces.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [patch traces projects](ProjectPatchTraceCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Traces {
/// List of traces.
pub traces: Option<Vec<Trace>>,
}
impl client::RequestValue for Traces {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`CloudTrace`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_cloudtrace1 as cloudtrace1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use cloudtrace1::{CloudTrace, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = CloudTrace::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `patch_traces(...)`, `traces_get(...)` and `traces_list(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
hub: &'a CloudTrace<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets a single trace by its ID.
///
/// # Arguments
///
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
/// * `traceId` - Required. ID of the trace to return.
pub fn traces_get(&self, project_id: &str, trace_id: &str) -> ProjectTraceGetCall<'a, S> {
ProjectTraceGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_trace_id: trace_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns a list of traces that match the specified filter conditions.
///
/// # Arguments
///
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
pub fn traces_list(&self, project_id: &str) -> ProjectTraceListCall<'a, S> {
ProjectTraceListCall {
hub: self.hub,
_project_id: project_id.to_string(),
_view: Default::default(),
_start_time: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_order_by: Default::default(),
_filter: Default::default(),
_end_time: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sends new traces to Cloud Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
pub fn patch_traces(&self, request: Traces, project_id: &str) -> ProjectPatchTraceCall<'a, S> {
ProjectPatchTraceCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
use super::*;
/// Gets a single trace by its ID.
///
/// A builder for the *traces.get* method supported by a *project* resource.
@@ -436,12 +32,12 @@ impl<'a, S> ProjectMethods<'a, S> {
pub struct ProjectTraceGetCall<'a, S>
where S: 'a {
hub: &'a CloudTrace<S>,
_project_id: String,
_trace_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a CloudTrace<S>,
pub(super) _project_id: String,
pub(super) _trace_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectTraceGetCall<'a, S> {}
@@ -717,18 +313,18 @@ where
pub struct ProjectTraceListCall<'a, S>
where S: 'a {
hub: &'a CloudTrace<S>,
_project_id: String,
_view: Option<String>,
_start_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
_page_token: Option<String>,
_page_size: Option<i32>,
_order_by: Option<String>,
_filter: Option<String>,
_end_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a CloudTrace<S>,
pub(super) _project_id: String,
pub(super) _view: Option<String>,
pub(super) _start_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
pub(super) _page_token: Option<String>,
pub(super) _page_size: Option<i32>,
pub(super) _order_by: Option<String>,
pub(super) _filter: Option<String>,
pub(super) _end_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectTraceListCall<'a, S> {}
@@ -1062,12 +658,12 @@ where
pub struct ProjectPatchTraceCall<'a, S>
where S: 'a {
hub: &'a CloudTrace<S>,
_request: Traces,
_project_id: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a CloudTrace<S>,
pub(super) _request: Traces,
pub(super) _project_id: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectPatchTraceCall<'a, S> {}

View File

@@ -0,0 +1,106 @@
use super::*;
/// Central instance to access all CloudTrace related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_cloudtrace1 as cloudtrace1;
/// use cloudtrace1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use cloudtrace1::{CloudTrace, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = CloudTrace::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().traces_get("projectId", "traceId")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct CloudTrace<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for CloudTrace<S> {}
impl<'a, S> CloudTrace<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> CloudTrace<S> {
CloudTrace {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://cloudtrace.googleapis.com/".to_string(),
_root_url: "https://cloudtrace.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.3`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://cloudtrace.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://cloudtrace.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -0,0 +1,104 @@
use super::*;
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`CloudTrace`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_cloudtrace1 as cloudtrace1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use cloudtrace1::{CloudTrace, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = CloudTrace::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `patch_traces(...)`, `traces_get(...)` and `traces_list(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a CloudTrace<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets a single trace by its ID.
///
/// # Arguments
///
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
/// * `traceId` - Required. ID of the trace to return.
pub fn traces_get(&self, project_id: &str, trace_id: &str) -> ProjectTraceGetCall<'a, S> {
ProjectTraceGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_trace_id: trace_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns a list of traces that match the specified filter conditions.
///
/// # Arguments
///
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
pub fn traces_list(&self, project_id: &str) -> ProjectTraceListCall<'a, S> {
ProjectTraceListCall {
hub: self.hub,
_project_id: project_id.to_string(),
_view: Default::default(),
_start_time: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_order_by: Default::default(),
_filter: Default::default(),
_end_time: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sends new traces to Cloud Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. ID of the Cloud project where the trace data is stored.
pub fn patch_traces(&self, request: Traces, project_id: &str) -> ProjectPatchTraceCall<'a, S> {
ProjectPatchTraceCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,124 @@
use super::*;
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [patch traces projects](ProjectPatchTraceCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// The response message for the `ListTraces` method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [traces list projects](ProjectTraceListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListTracesResponse {
/// If defined, indicates that there are more traces that match the request and that this value should be passed to the next request to continue retrieving additional traces.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// List of trace records as specified by the view parameter.
pub traces: Option<Vec<Trace>>,
}
impl client::ResponseResult for ListTracesResponse {}
/// A trace describes how long it takes for an application to perform an operation. It consists of a set of spans, each of which represent a single timed event within the operation.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [traces get projects](ProjectTraceGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Trace {
/// Project ID of the Cloud project where the trace data is stored.
#[serde(rename="projectId")]
pub project_id: Option<String>,
/// Collection of spans in the trace.
pub spans: Option<Vec<TraceSpan>>,
/// Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. For example, `382d4f4c6b7bb2f4a972559d9085001d`. The numeric value should not be zero.
#[serde(rename="traceId")]
pub trace_id: Option<String>,
}
impl client::ResponseResult for Trace {}
/// A span represents a single timed event within a trace. Spans can be nested and form a trace tree. Often, a trace contains a root span that describes the end-to-end latency of an operation and, optionally, one or more subspans for its suboperations. Spans do not need to be contiguous. There may be gaps between spans in a trace.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct TraceSpan {
/// End time of the span in nanoseconds from the UNIX epoch.
#[serde(rename="endTime")]
pub end_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `RPC_CLIENT` and `RPC_SERVER` to identify queueing latency associated with the span.
pub kind: Option<String>,
/// Collection of labels associated with the span. Label keys must be less than 128 bytes. Label values must be less than 16 kilobytes (10MB for `/stacktrace` values). Some predefined label keys exist, or you may create your own. When creating your own, we recommend the following formats: * `/category/product/key` for agents of well-known products (e.g. `/db/mongodb/read_size`). * `short_host/path/key` for domain-specific keys (e.g. `foo.com/myproduct/bar`) Predefined labels include: * `/agent` * `/component` * `/error/message` * `/error/name` * `/http/client_city` * `/http/client_country` * `/http/client_protocol` * `/http/client_region` * `/http/host` * `/http/method` * `/http/path` * `/http/redirected_url` * `/http/request/size` * `/http/response/size` * `/http/route` * `/http/status_code` * `/http/url` * `/http/user_agent` * `/pid` * `/stacktrace` * `/tid`
pub labels: Option<HashMap<String, String>>,
/// Name of the span. Must be less than 128 bytes. The span name is sanitized and displayed in the Trace tool in the Google Cloud Platform Console. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans.
pub name: Option<String>,
/// Optional. ID of the parent span, if any.
#[serde(rename="parentSpanId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub parent_span_id: Option<u64>,
/// Identifier for the span. Must be a 64-bit integer other than 0 and unique within a trace. For example, `2205310701640571284`.
#[serde(rename="spanId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub span_id: Option<u64>,
/// Start time of the span in nanoseconds from the UNIX epoch.
#[serde(rename="startTime")]
pub start_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for TraceSpan {}
/// List of new or updated traces.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [patch traces projects](ProjectPatchTraceCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Traces {
/// List of traces.
pub traces: Option<Vec<Trace>>,
}
impl client::RequestValue for Traces {}

View File

@@ -0,0 +1,32 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
/// Write Trace data for a project or application
TraceAppend,
/// Read Trace data for a project or application
TraceReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::TraceAppend => "https://www.googleapis.com/auth/trace.append",
Scope::TraceReadonly => "https://www.googleapis.com/auth/trace.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::TraceReadonly
}
}