#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateProfileRequest {
pub parent: std::string::String,
pub deployment: std::option::Option<crate::model::Deployment>,
pub profile_type: std::vec::Vec<crate::model::ProfileType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateProfileRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_deployment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Deployment>,
{
self.deployment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Deployment>,
{
self.deployment = v.map(|x| x.into());
self
}
pub fn set_profile_type<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ProfileType>,
{
use std::iter::Iterator;
self.profile_type = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for CreateProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.CreateProfileRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateOfflineProfileRequest {
pub parent: std::string::String,
pub profile: std::option::Option<crate::model::Profile>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateOfflineProfileRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Profile>,
{
self.profile = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Profile>,
{
self.profile = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateOfflineProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.CreateOfflineProfileRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateProfileRequest {
pub profile: std::option::Option<crate::model::Profile>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateProfileRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Profile>,
{
self.profile = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Profile>,
{
self.profile = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.UpdateProfileRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Profile {
pub name: std::string::String,
pub profile_type: crate::model::ProfileType,
pub deployment: std::option::Option<crate::model::Deployment>,
pub duration: std::option::Option<wkt::Duration>,
pub profile_bytes: ::bytes::Bytes,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub start_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Profile {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_profile_type<T: std::convert::Into<crate::model::ProfileType>>(
mut self,
v: T,
) -> Self {
self.profile_type = v.into();
self
}
pub fn set_deployment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Deployment>,
{
self.deployment = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Deployment>,
{
self.deployment = v.map(|x| x.into());
self
}
pub fn set_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.duration = v.map(|x| x.into());
self
}
pub fn set_profile_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.profile_bytes = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.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.start_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Profile {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.Profile"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Deployment {
pub project_id: std::string::String,
pub target: std::string::String,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Deployment {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target = v.into();
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Deployment {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.Deployment"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProfilesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListProfilesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListProfilesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.ListProfilesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProfilesResponse {
pub profiles: std::vec::Vec<crate::model::Profile>,
pub next_page_token: std::string::String,
pub skipped_profiles: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListProfilesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_profiles<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Profile>,
{
use std::iter::Iterator;
self.profiles = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_skipped_profiles<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.skipped_profiles = v.into();
self
}
}
impl wkt::message::Message for ListProfilesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.devtools.cloudprofiler.v2.ListProfilesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListProfilesResponse {
type PageItem = crate::model::Profile;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.profiles
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ProfileType {
Unspecified,
Cpu,
Wall,
Heap,
Threads,
Contention,
PeakHeap,
HeapAlloc,
UnknownValue(profile_type::UnknownValue),
}
#[doc(hidden)]
pub mod profile_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ProfileType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Cpu => std::option::Option::Some(1),
Self::Wall => std::option::Option::Some(2),
Self::Heap => std::option::Option::Some(3),
Self::Threads => std::option::Option::Some(4),
Self::Contention => std::option::Option::Some(5),
Self::PeakHeap => std::option::Option::Some(6),
Self::HeapAlloc => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PROFILE_TYPE_UNSPECIFIED"),
Self::Cpu => std::option::Option::Some("CPU"),
Self::Wall => std::option::Option::Some("WALL"),
Self::Heap => std::option::Option::Some("HEAP"),
Self::Threads => std::option::Option::Some("THREADS"),
Self::Contention => std::option::Option::Some("CONTENTION"),
Self::PeakHeap => std::option::Option::Some("PEAK_HEAP"),
Self::HeapAlloc => std::option::Option::Some("HEAP_ALLOC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ProfileType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ProfileType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ProfileType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Cpu,
2 => Self::Wall,
3 => Self::Heap,
4 => Self::Threads,
5 => Self::Contention,
6 => Self::PeakHeap,
7 => Self::HeapAlloc,
_ => Self::UnknownValue(profile_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ProfileType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PROFILE_TYPE_UNSPECIFIED" => Self::Unspecified,
"CPU" => Self::Cpu,
"WALL" => Self::Wall,
"HEAP" => Self::Heap,
"THREADS" => Self::Threads,
"CONTENTION" => Self::Contention,
"PEAK_HEAP" => Self::PeakHeap,
"HEAP_ALLOC" => Self::HeapAlloc,
_ => Self::UnknownValue(profile_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ProfileType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Cpu => serializer.serialize_i32(1),
Self::Wall => serializer.serialize_i32(2),
Self::Heap => serializer.serialize_i32(3),
Self::Threads => serializer.serialize_i32(4),
Self::Contention => serializer.serialize_i32(5),
Self::PeakHeap => serializer.serialize_i32(6),
Self::HeapAlloc => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ProfileType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProfileType>::new(
".google.devtools.cloudprofiler.v2.ProfileType",
))
}
}