#![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 google_cloud_iam_v1;
extern crate google_cloud_location;
extern crate google_cloud_rpc;
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 ListQueuesRequest {
pub parent: std::string::String,
pub filter: 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 ListQueuesRequest {
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_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = 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 ListQueuesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.ListQueuesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListQueuesResponse {
pub queues: std::vec::Vec<crate::model::Queue>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListQueuesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_queues<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Queue>,
{
use std::iter::Iterator;
self.queues = 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
}
}
impl wkt::message::Message for ListQueuesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.ListQueuesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListQueuesResponse {
type PageItem = crate::model::Queue;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.queues
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetQueueRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetQueueRequest {
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
}
}
impl wkt::message::Message for GetQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.GetQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateQueueRequest {
pub parent: std::string::String,
pub queue: std::option::Option<crate::model::Queue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateQueueRequest {
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_queue<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Queue>,
{
self.queue = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Queue>,
{
self.queue = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.CreateQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateQueueRequest {
pub queue: std::option::Option<crate::model::Queue>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateQueueRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_queue<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Queue>,
{
self.queue = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_queue<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Queue>,
{
self.queue = 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 UpdateQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.UpdateQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteQueueRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteQueueRequest {
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
}
}
impl wkt::message::Message for DeleteQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.DeleteQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PurgeQueueRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PurgeQueueRequest {
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
}
}
impl wkt::message::Message for PurgeQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.PurgeQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PauseQueueRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PauseQueueRequest {
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
}
}
impl wkt::message::Message for PauseQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.PauseQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResumeQueueRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResumeQueueRequest {
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
}
}
impl wkt::message::Message for ResumeQueueRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.ResumeQueueRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTasksRequest {
pub parent: std::string::String,
pub response_view: crate::model::task::View,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListTasksRequest {
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_response_view<T: std::convert::Into<crate::model::task::View>>(
mut self,
v: T,
) -> Self {
self.response_view = 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 ListTasksRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.ListTasksRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTasksResponse {
pub tasks: std::vec::Vec<crate::model::Task>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListTasksResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_tasks<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Task>,
{
use std::iter::Iterator;
self.tasks = 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
}
}
impl wkt::message::Message for ListTasksResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.ListTasksResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListTasksResponse {
type PageItem = crate::model::Task;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.tasks
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTaskRequest {
pub name: std::string::String,
pub response_view: crate::model::task::View,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetTaskRequest {
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_response_view<T: std::convert::Into<crate::model::task::View>>(
mut self,
v: T,
) -> Self {
self.response_view = v.into();
self
}
}
impl wkt::message::Message for GetTaskRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.GetTaskRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTaskRequest {
pub parent: std::string::String,
pub task: std::option::Option<crate::model::Task>,
pub response_view: crate::model::task::View,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateTaskRequest {
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_task<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Task>,
{
self.task = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_task<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Task>,
{
self.task = v.map(|x| x.into());
self
}
pub fn set_response_view<T: std::convert::Into<crate::model::task::View>>(
mut self,
v: T,
) -> Self {
self.response_view = v.into();
self
}
}
impl wkt::message::Message for CreateTaskRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.CreateTaskRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTaskRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteTaskRequest {
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
}
}
impl wkt::message::Message for DeleteTaskRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.DeleteTaskRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RunTaskRequest {
pub name: std::string::String,
pub response_view: crate::model::task::View,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RunTaskRequest {
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_response_view<T: std::convert::Into<crate::model::task::View>>(
mut self,
v: T,
) -> Self {
self.response_view = v.into();
self
}
}
impl wkt::message::Message for RunTaskRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.RunTaskRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Queue {
pub name: std::string::String,
pub app_engine_routing_override: std::option::Option<crate::model::AppEngineRouting>,
pub rate_limits: std::option::Option<crate::model::RateLimits>,
pub retry_config: std::option::Option<crate::model::RetryConfig>,
pub state: crate::model::queue::State,
pub purge_time: std::option::Option<wkt::Timestamp>,
pub stackdriver_logging_config: std::option::Option<crate::model::StackdriverLoggingConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Queue {
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_app_engine_routing_override<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AppEngineRouting>,
{
self.app_engine_routing_override = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_app_engine_routing_override<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AppEngineRouting>,
{
self.app_engine_routing_override = v.map(|x| x.into());
self
}
pub fn set_rate_limits<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RateLimits>,
{
self.rate_limits = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_rate_limits<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RateLimits>,
{
self.rate_limits = v.map(|x| x.into());
self
}
pub fn set_retry_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RetryConfig>,
{
self.retry_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_retry_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RetryConfig>,
{
self.retry_config = v.map(|x| x.into());
self
}
pub fn set_state<T: std::convert::Into<crate::model::queue::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_purge_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.purge_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.purge_time = v.map(|x| x.into());
self
}
pub fn set_stackdriver_logging_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
{
self.stackdriver_logging_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_stackdriver_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StackdriverLoggingConfig>,
{
self.stackdriver_logging_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Queue {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.Queue"
}
}
pub mod queue {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Running,
Paused,
Disabled,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Running => std::option::Option::Some(1),
Self::Paused => std::option::Option::Some(2),
Self::Disabled => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::Paused => std::option::Option::Some("PAUSED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
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 State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Running,
2 => Self::Paused,
3 => Self::Disabled,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"RUNNING" => Self::Running,
"PAUSED" => Self::Paused,
"DISABLED" => Self::Disabled,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
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::Running => serializer.serialize_i32(1),
Self::Paused => serializer.serialize_i32(2),
Self::Disabled => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.tasks.v2.Queue.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RateLimits {
pub max_dispatches_per_second: f64,
pub max_burst_size: i32,
pub max_concurrent_dispatches: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RateLimits {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_max_dispatches_per_second<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.max_dispatches_per_second = v.into();
self
}
pub fn set_max_burst_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_burst_size = v.into();
self
}
pub fn set_max_concurrent_dispatches<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_concurrent_dispatches = v.into();
self
}
}
impl wkt::message::Message for RateLimits {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.RateLimits"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetryConfig {
pub max_attempts: i32,
pub max_retry_duration: std::option::Option<wkt::Duration>,
pub min_backoff: std::option::Option<wkt::Duration>,
pub max_backoff: std::option::Option<wkt::Duration>,
pub max_doublings: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RetryConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_max_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_attempts = v.into();
self
}
pub fn set_max_retry_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_retry_duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_max_retry_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_retry_duration = v.map(|x| x.into());
self
}
pub fn set_min_backoff<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.min_backoff = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_min_backoff<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.min_backoff = v.map(|x| x.into());
self
}
pub fn set_max_backoff<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_backoff = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_max_backoff<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.max_backoff = v.map(|x| x.into());
self
}
pub fn set_max_doublings<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_doublings = v.into();
self
}
}
impl wkt::message::Message for RetryConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.RetryConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StackdriverLoggingConfig {
pub sampling_ratio: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StackdriverLoggingConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sampling_ratio<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.sampling_ratio = v.into();
self
}
}
impl wkt::message::Message for StackdriverLoggingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.StackdriverLoggingConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpRequest {
pub url: std::string::String,
pub http_method: crate::model::HttpMethod,
pub headers: std::collections::HashMap<std::string::String, std::string::String>,
pub body: ::bytes::Bytes,
pub authorization_header: std::option::Option<crate::model::http_request::AuthorizationHeader>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HttpRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
mut self,
v: T,
) -> Self {
self.http_method = v.into();
self
}
pub fn set_headers<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.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.body = v.into();
self
}
pub fn set_authorization_header<
T: std::convert::Into<std::option::Option<crate::model::http_request::AuthorizationHeader>>,
>(
mut self,
v: T,
) -> Self {
self.authorization_header = v.into();
self
}
pub fn oauth_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OAuthToken>> {
#[allow(unreachable_patterns)]
self.authorization_header.as_ref().and_then(|v| match v {
crate::model::http_request::AuthorizationHeader::OauthToken(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_oauth_token<T: std::convert::Into<std::boxed::Box<crate::model::OAuthToken>>>(
mut self,
v: T,
) -> Self {
self.authorization_header = std::option::Option::Some(
crate::model::http_request::AuthorizationHeader::OauthToken(v.into()),
);
self
}
pub fn oidc_token(&self) -> std::option::Option<&std::boxed::Box<crate::model::OidcToken>> {
#[allow(unreachable_patterns)]
self.authorization_header.as_ref().and_then(|v| match v {
crate::model::http_request::AuthorizationHeader::OidcToken(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_oidc_token<T: std::convert::Into<std::boxed::Box<crate::model::OidcToken>>>(
mut self,
v: T,
) -> Self {
self.authorization_header = std::option::Option::Some(
crate::model::http_request::AuthorizationHeader::OidcToken(v.into()),
);
self
}
}
impl wkt::message::Message for HttpRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.HttpRequest"
}
}
pub mod http_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AuthorizationHeader {
OauthToken(std::boxed::Box<crate::model::OAuthToken>),
OidcToken(std::boxed::Box<crate::model::OidcToken>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AppEngineHttpRequest {
pub http_method: crate::model::HttpMethod,
pub app_engine_routing: std::option::Option<crate::model::AppEngineRouting>,
pub relative_uri: std::string::String,
pub headers: std::collections::HashMap<std::string::String, std::string::String>,
pub body: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AppEngineHttpRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_http_method<T: std::convert::Into<crate::model::HttpMethod>>(
mut self,
v: T,
) -> Self {
self.http_method = v.into();
self
}
pub fn set_app_engine_routing<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AppEngineRouting>,
{
self.app_engine_routing = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_app_engine_routing<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AppEngineRouting>,
{
self.app_engine_routing = v.map(|x| x.into());
self
}
pub fn set_relative_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.relative_uri = v.into();
self
}
pub fn set_headers<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.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.body = v.into();
self
}
}
impl wkt::message::Message for AppEngineHttpRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.AppEngineHttpRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AppEngineRouting {
pub service: std::string::String,
pub version: std::string::String,
pub instance: std::string::String,
pub host: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AppEngineRouting {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.instance = v.into();
self
}
pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.host = v.into();
self
}
}
impl wkt::message::Message for AppEngineRouting {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.AppEngineRouting"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OAuthToken {
pub service_account_email: std::string::String,
pub scope: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OAuthToken {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.service_account_email = v.into();
self
}
pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.scope = v.into();
self
}
}
impl wkt::message::Message for OAuthToken {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.OAuthToken"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OidcToken {
pub service_account_email: std::string::String,
pub audience: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OidcToken {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.service_account_email = v.into();
self
}
pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.audience = v.into();
self
}
}
impl wkt::message::Message for OidcToken {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.OidcToken"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Task {
pub name: std::string::String,
pub schedule_time: std::option::Option<wkt::Timestamp>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub dispatch_deadline: std::option::Option<wkt::Duration>,
pub dispatch_count: i32,
pub response_count: i32,
pub first_attempt: std::option::Option<crate::model::Attempt>,
pub last_attempt: std::option::Option<crate::model::Attempt>,
pub view: crate::model::task::View,
pub message_type: std::option::Option<crate::model::task::MessageType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Task {
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_schedule_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = v.map(|x| x.into());
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_dispatch_deadline<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.dispatch_deadline = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_dispatch_deadline<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.dispatch_deadline = v.map(|x| x.into());
self
}
pub fn set_dispatch_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.dispatch_count = v.into();
self
}
pub fn set_response_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.response_count = v.into();
self
}
pub fn set_first_attempt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Attempt>,
{
self.first_attempt = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_first_attempt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Attempt>,
{
self.first_attempt = v.map(|x| x.into());
self
}
pub fn set_last_attempt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Attempt>,
{
self.last_attempt = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_last_attempt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Attempt>,
{
self.last_attempt = v.map(|x| x.into());
self
}
pub fn set_view<T: std::convert::Into<crate::model::task::View>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
pub fn set_message_type<
T: std::convert::Into<std::option::Option<crate::model::task::MessageType>>,
>(
mut self,
v: T,
) -> Self {
self.message_type = v.into();
self
}
pub fn app_engine_http_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AppEngineHttpRequest>> {
#[allow(unreachable_patterns)]
self.message_type.as_ref().and_then(|v| match v {
crate::model::task::MessageType::AppEngineHttpRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_app_engine_http_request<
T: std::convert::Into<std::boxed::Box<crate::model::AppEngineHttpRequest>>,
>(
mut self,
v: T,
) -> Self {
self.message_type = std::option::Option::Some(
crate::model::task::MessageType::AppEngineHttpRequest(v.into()),
);
self
}
pub fn http_request(&self) -> std::option::Option<&std::boxed::Box<crate::model::HttpRequest>> {
#[allow(unreachable_patterns)]
self.message_type.as_ref().and_then(|v| match v {
crate::model::task::MessageType::HttpRequest(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_http_request<T: std::convert::Into<std::boxed::Box<crate::model::HttpRequest>>>(
mut self,
v: T,
) -> Self {
self.message_type =
std::option::Option::Some(crate::model::task::MessageType::HttpRequest(v.into()));
self
}
}
impl wkt::message::Message for Task {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.Task"
}
}
pub mod task {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum View {
Unspecified,
Basic,
Full,
UnknownValue(view::UnknownValue),
}
#[doc(hidden)]
pub mod view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl View {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Basic => std::option::Option::Some(1),
Self::Full => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
Self::Basic => std::option::Option::Some("BASIC"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for View {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for View {
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 View {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Basic,
2 => Self::Full,
_ => Self::UnknownValue(view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for View {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VIEW_UNSPECIFIED" => Self::Unspecified,
"BASIC" => Self::Basic,
"FULL" => Self::Full,
_ => Self::UnknownValue(view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for View {
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::Basic => serializer.serialize_i32(1),
Self::Full => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for View {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
".google.cloud.tasks.v2.Task.View",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MessageType {
AppEngineHttpRequest(std::boxed::Box<crate::model::AppEngineHttpRequest>),
HttpRequest(std::boxed::Box<crate::model::HttpRequest>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Attempt {
pub schedule_time: std::option::Option<wkt::Timestamp>,
pub dispatch_time: std::option::Option<wkt::Timestamp>,
pub response_time: std::option::Option<wkt::Timestamp>,
pub response_status: std::option::Option<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Attempt {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_schedule_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = v.map(|x| x.into());
self
}
pub fn set_dispatch_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.dispatch_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_dispatch_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.dispatch_time = v.map(|x| x.into());
self
}
pub fn set_response_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.response_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_response_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.response_time = v.map(|x| x.into());
self
}
pub fn set_response_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.response_status = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_response_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.response_status = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Attempt {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.tasks.v2.Attempt"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HttpMethod {
Unspecified,
Post,
Get,
Head,
Put,
Delete,
Patch,
Options,
UnknownValue(http_method::UnknownValue),
}
#[doc(hidden)]
pub mod http_method {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl HttpMethod {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Post => std::option::Option::Some(1),
Self::Get => std::option::Option::Some(2),
Self::Head => std::option::Option::Some(3),
Self::Put => std::option::Option::Some(4),
Self::Delete => std::option::Option::Some(5),
Self::Patch => std::option::Option::Some(6),
Self::Options => 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("HTTP_METHOD_UNSPECIFIED"),
Self::Post => std::option::Option::Some("POST"),
Self::Get => std::option::Option::Some("GET"),
Self::Head => std::option::Option::Some("HEAD"),
Self::Put => std::option::Option::Some("PUT"),
Self::Delete => std::option::Option::Some("DELETE"),
Self::Patch => std::option::Option::Some("PATCH"),
Self::Options => std::option::Option::Some("OPTIONS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for HttpMethod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for HttpMethod {
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 HttpMethod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Post,
2 => Self::Get,
3 => Self::Head,
4 => Self::Put,
5 => Self::Delete,
6 => Self::Patch,
7 => Self::Options,
_ => Self::UnknownValue(http_method::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for HttpMethod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HTTP_METHOD_UNSPECIFIED" => Self::Unspecified,
"POST" => Self::Post,
"GET" => Self::Get,
"HEAD" => Self::Head,
"PUT" => Self::Put,
"DELETE" => Self::Delete,
"PATCH" => Self::Patch,
"OPTIONS" => Self::Options,
_ => Self::UnknownValue(http_method::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for HttpMethod {
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::Post => serializer.serialize_i32(1),
Self::Get => serializer.serialize_i32(2),
Self::Head => serializer.serialize_i32(3),
Self::Put => serializer.serialize_i32(4),
Self::Delete => serializer.serialize_i32(5),
Self::Patch => serializer.serialize_i32(6),
Self::Options => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for HttpMethod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HttpMethod>::new(
".google.cloud.tasks.v2.HttpMethod",
))
}
}