#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
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 Function {
pub name: std::string::String,
pub description: std::string::String,
pub build_config: std::option::Option<crate::model::BuildConfig>,
pub service_config: std::option::Option<crate::model::ServiceConfig>,
pub event_trigger: std::option::Option<crate::model::EventTrigger>,
pub state: crate::model::function::State,
pub update_time: std::option::Option<wkt::Timestamp>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub state_messages: std::vec::Vec<crate::model::StateMessage>,
pub environment: crate::model::Environment,
pub url: std::string::String,
pub kms_key_name: std::string::String,
pub satisfies_pzs: bool,
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Function {
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_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_build_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BuildConfig>,
{
self.build_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BuildConfig>,
{
self.build_config = v.map(|x| x.into());
self
}
pub fn set_service_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServiceConfig>,
{
self.service_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_service_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServiceConfig>,
{
self.service_config = v.map(|x| x.into());
self
}
pub fn set_event_trigger<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EventTrigger>,
{
self.event_trigger = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_event_trigger<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EventTrigger>,
{
self.event_trigger = v.map(|x| x.into());
self
}
pub fn set_state<T: std::convert::Into<crate::model::function::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.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_state_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StateMessage>,
{
use std::iter::Iterator;
self.state_messages = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
mut self,
v: T,
) -> Self {
self.environment = v.into();
self
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.satisfies_pzs = v.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
}
}
impl wkt::message::Message for Function {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.Function"
}
}
pub mod function {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Active,
Failed,
Deploying,
Deleting,
Unknown,
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::Active => std::option::Option::Some(1),
Self::Failed => std::option::Option::Some(2),
Self::Deploying => std::option::Option::Some(3),
Self::Deleting => std::option::Option::Some(4),
Self::Unknown => std::option::Option::Some(5),
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::Active => std::option::Option::Some("ACTIVE"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Deploying => std::option::Option::Some("DEPLOYING"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
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::Active,
2 => Self::Failed,
3 => Self::Deploying,
4 => Self::Deleting,
5 => Self::Unknown,
_ => 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,
"ACTIVE" => Self::Active,
"FAILED" => Self::Failed,
"DEPLOYING" => Self::Deploying,
"DELETING" => Self::Deleting,
"UNKNOWN" => Self::Unknown,
_ => 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::Active => serializer.serialize_i32(1),
Self::Failed => serializer.serialize_i32(2),
Self::Deploying => serializer.serialize_i32(3),
Self::Deleting => serializer.serialize_i32(4),
Self::Unknown => serializer.serialize_i32(5),
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.functions.v2.Function.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StateMessage {
pub severity: crate::model::state_message::Severity,
pub r#type: std::string::String,
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StateMessage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_severity<T: std::convert::Into<crate::model::state_message::Severity>>(
mut self,
v: T,
) -> Self {
self.severity = v.into();
self
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for StateMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.StateMessage"
}
}
pub mod state_message {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Severity {
Unspecified,
Error,
Warning,
Info,
UnknownValue(severity::UnknownValue),
}
#[doc(hidden)]
pub mod severity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Severity {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Error => std::option::Option::Some(1),
Self::Warning => std::option::Option::Some(2),
Self::Info => 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("SEVERITY_UNSPECIFIED"),
Self::Error => std::option::Option::Some("ERROR"),
Self::Warning => std::option::Option::Some("WARNING"),
Self::Info => std::option::Option::Some("INFO"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Severity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Severity {
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 Severity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Error,
2 => Self::Warning,
3 => Self::Info,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Severity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEVERITY_UNSPECIFIED" => Self::Unspecified,
"ERROR" => Self::Error,
"WARNING" => Self::Warning,
"INFO" => Self::Info,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Severity {
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::Error => serializer.serialize_i32(1),
Self::Warning => serializer.serialize_i32(2),
Self::Info => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Severity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
".google.cloud.functions.v2.StateMessage.Severity",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StorageSource {
pub bucket: std::string::String,
pub object: std::string::String,
pub generation: i64,
pub source_upload_url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StorageSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.bucket = v.into();
self
}
pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.object = v.into();
self
}
pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.generation = v.into();
self
}
pub fn set_source_upload_url<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.source_upload_url = v.into();
self
}
}
impl wkt::message::Message for StorageSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.StorageSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RepoSource {
pub project_id: std::string::String,
pub repo_name: std::string::String,
pub dir: std::string::String,
pub invert_regex: bool,
pub revision: std::option::Option<crate::model::repo_source::Revision>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RepoSource {
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_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.repo_name = v.into();
self
}
pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dir = v.into();
self
}
pub fn set_invert_regex<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.invert_regex = v.into();
self
}
pub fn set_revision<
T: std::convert::Into<std::option::Option<crate::model::repo_source::Revision>>,
>(
mut self,
v: T,
) -> Self {
self.revision = v.into();
self
}
pub fn branch_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::repo_source::Revision::BranchName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_branch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision =
std::option::Option::Some(crate::model::repo_source::Revision::BranchName(v.into()));
self
}
pub fn tag_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::repo_source::Revision::TagName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_tag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision =
std::option::Option::Some(crate::model::repo_source::Revision::TagName(v.into()));
self
}
pub fn commit_sha(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.revision.as_ref().and_then(|v| match v {
crate::model::repo_source::Revision::CommitSha(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_commit_sha<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision =
std::option::Option::Some(crate::model::repo_source::Revision::CommitSha(v.into()));
self
}
}
impl wkt::message::Message for RepoSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.RepoSource"
}
}
pub mod repo_source {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Revision {
BranchName(std::string::String),
TagName(std::string::String),
CommitSha(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Source {
pub source: std::option::Option<crate::model::source::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Source {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::source::Source>>>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
pub fn storage_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StorageSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::source::Source::StorageSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_storage_source<
T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
>(
mut self,
v: T,
) -> Self {
self.source =
std::option::Option::Some(crate::model::source::Source::StorageSource(v.into()));
self
}
pub fn repo_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::RepoSource>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::source::Source::RepoSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_repo_source<T: std::convert::Into<std::boxed::Box<crate::model::RepoSource>>>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(crate::model::source::Source::RepoSource(v.into()));
self
}
pub fn git_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::source::Source::GitUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = std::option::Option::Some(crate::model::source::Source::GitUri(v.into()));
self
}
}
impl wkt::message::Message for Source {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.Source"
}
}
pub mod source {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
StorageSource(std::boxed::Box<crate::model::StorageSource>),
RepoSource(std::boxed::Box<crate::model::RepoSource>),
GitUri(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SourceProvenance {
pub resolved_storage_source: std::option::Option<crate::model::StorageSource>,
pub resolved_repo_source: std::option::Option<crate::model::RepoSource>,
pub git_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SourceProvenance {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_resolved_storage_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StorageSource>,
{
self.resolved_storage_source = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_resolved_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StorageSource>,
{
self.resolved_storage_source = v.map(|x| x.into());
self
}
pub fn set_resolved_repo_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RepoSource>,
{
self.resolved_repo_source = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_resolved_repo_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RepoSource>,
{
self.resolved_repo_source = v.map(|x| x.into());
self
}
pub fn set_git_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.git_uri = v.into();
self
}
}
impl wkt::message::Message for SourceProvenance {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.SourceProvenance"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BuildConfig {
pub build: std::string::String,
pub runtime: std::string::String,
pub entry_point: std::string::String,
pub source: std::option::Option<crate::model::Source>,
pub source_provenance: std::option::Option<crate::model::SourceProvenance>,
pub worker_pool: std::string::String,
pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
#[deprecated]
pub docker_registry: crate::model::build_config::DockerRegistry,
pub docker_repository: std::string::String,
pub service_account: std::string::String,
pub runtime_update_policy: std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BuildConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_build<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.build = v.into();
self
}
pub fn set_runtime<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.runtime = v.into();
self
}
pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entry_point = v.into();
self
}
pub fn set_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Source>,
{
self.source = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Source>,
{
self.source = v.map(|x| x.into());
self
}
pub fn set_source_provenance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SourceProvenance>,
{
self.source_provenance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SourceProvenance>,
{
self.source_provenance = v.map(|x| x.into());
self
}
pub fn set_worker_pool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.worker_pool = v.into();
self
}
pub fn set_environment_variables<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.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
#[deprecated]
pub fn set_docker_registry<
T: std::convert::Into<crate::model::build_config::DockerRegistry>,
>(
mut self,
v: T,
) -> Self {
self.docker_registry = v.into();
self
}
pub fn set_docker_repository<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.docker_repository = v.into();
self
}
pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service_account = v.into();
self
}
pub fn set_runtime_update_policy<
T: std::convert::Into<std::option::Option<crate::model::build_config::RuntimeUpdatePolicy>>,
>(
mut self,
v: T,
) -> Self {
self.runtime_update_policy = v.into();
self
}
pub fn automatic_update_policy(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AutomaticUpdatePolicy>> {
#[allow(unreachable_patterns)]
self.runtime_update_policy.as_ref().and_then(|v| match v {
crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_automatic_update_policy<
T: std::convert::Into<std::boxed::Box<crate::model::AutomaticUpdatePolicy>>,
>(
mut self,
v: T,
) -> Self {
self.runtime_update_policy = std::option::Option::Some(
crate::model::build_config::RuntimeUpdatePolicy::AutomaticUpdatePolicy(v.into()),
);
self
}
pub fn on_deploy_update_policy(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::OnDeployUpdatePolicy>> {
#[allow(unreachable_patterns)]
self.runtime_update_policy.as_ref().and_then(|v| match v {
crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_on_deploy_update_policy<
T: std::convert::Into<std::boxed::Box<crate::model::OnDeployUpdatePolicy>>,
>(
mut self,
v: T,
) -> Self {
self.runtime_update_policy = std::option::Option::Some(
crate::model::build_config::RuntimeUpdatePolicy::OnDeployUpdatePolicy(v.into()),
);
self
}
}
impl wkt::message::Message for BuildConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.BuildConfig"
}
}
pub mod build_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DockerRegistry {
Unspecified,
ContainerRegistry,
ArtifactRegistry,
UnknownValue(docker_registry::UnknownValue),
}
#[doc(hidden)]
pub mod docker_registry {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DockerRegistry {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ContainerRegistry => std::option::Option::Some(1),
Self::ArtifactRegistry => 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("DOCKER_REGISTRY_UNSPECIFIED"),
Self::ContainerRegistry => std::option::Option::Some("CONTAINER_REGISTRY"),
Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DockerRegistry {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DockerRegistry {
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 DockerRegistry {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ContainerRegistry,
2 => Self::ArtifactRegistry,
_ => Self::UnknownValue(docker_registry::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DockerRegistry {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DOCKER_REGISTRY_UNSPECIFIED" => Self::Unspecified,
"CONTAINER_REGISTRY" => Self::ContainerRegistry,
"ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
_ => Self::UnknownValue(docker_registry::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DockerRegistry {
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::ContainerRegistry => serializer.serialize_i32(1),
Self::ArtifactRegistry => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DockerRegistry {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DockerRegistry>::new(
".google.cloud.functions.v2.BuildConfig.DockerRegistry",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RuntimeUpdatePolicy {
AutomaticUpdatePolicy(std::boxed::Box<crate::model::AutomaticUpdatePolicy>),
OnDeployUpdatePolicy(std::boxed::Box<crate::model::OnDeployUpdatePolicy>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceConfig {
pub service: std::string::String,
pub timeout_seconds: i32,
pub available_memory: std::string::String,
pub available_cpu: std::string::String,
pub environment_variables: std::collections::HashMap<std::string::String, std::string::String>,
pub max_instance_count: i32,
pub min_instance_count: i32,
pub vpc_connector: std::string::String,
pub vpc_connector_egress_settings: crate::model::service_config::VpcConnectorEgressSettings,
pub ingress_settings: crate::model::service_config::IngressSettings,
pub uri: std::string::String,
pub service_account_email: std::string::String,
pub all_traffic_on_latest_revision: bool,
pub secret_environment_variables: std::vec::Vec<crate::model::SecretEnvVar>,
pub secret_volumes: std::vec::Vec<crate::model::SecretVolume>,
pub revision: std::string::String,
pub max_instance_request_concurrency: i32,
pub security_level: crate::model::service_config::SecurityLevel,
pub binary_authorization_policy: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServiceConfig {
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_timeout_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.timeout_seconds = v.into();
self
}
pub fn set_available_memory<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.available_memory = v.into();
self
}
pub fn set_available_cpu<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.available_cpu = v.into();
self
}
pub fn set_environment_variables<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.environment_variables = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_max_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_instance_count = v.into();
self
}
pub fn set_min_instance_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.min_instance_count = v.into();
self
}
pub fn set_vpc_connector<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vpc_connector = v.into();
self
}
pub fn set_vpc_connector_egress_settings<
T: std::convert::Into<crate::model::service_config::VpcConnectorEgressSettings>,
>(
mut self,
v: T,
) -> Self {
self.vpc_connector_egress_settings = v.into();
self
}
pub fn set_ingress_settings<
T: std::convert::Into<crate::model::service_config::IngressSettings>,
>(
mut self,
v: T,
) -> Self {
self.ingress_settings = v.into();
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
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_all_traffic_on_latest_revision<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.all_traffic_on_latest_revision = v.into();
self
}
pub fn set_secret_environment_variables<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SecretEnvVar>,
{
use std::iter::Iterator;
self.secret_environment_variables = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_secret_volumes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SecretVolume>,
{
use std::iter::Iterator;
self.secret_volumes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision = v.into();
self
}
pub fn set_max_instance_request_concurrency<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.max_instance_request_concurrency = v.into();
self
}
pub fn set_security_level<
T: std::convert::Into<crate::model::service_config::SecurityLevel>,
>(
mut self,
v: T,
) -> Self {
self.security_level = v.into();
self
}
pub fn set_binary_authorization_policy<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.binary_authorization_policy = v.into();
self
}
}
impl wkt::message::Message for ServiceConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ServiceConfig"
}
}
pub mod service_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum VpcConnectorEgressSettings {
Unspecified,
PrivateRangesOnly,
AllTraffic,
UnknownValue(vpc_connector_egress_settings::UnknownValue),
}
#[doc(hidden)]
pub mod vpc_connector_egress_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl VpcConnectorEgressSettings {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PrivateRangesOnly => std::option::Option::Some(1),
Self::AllTraffic => 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("VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED")
}
Self::PrivateRangesOnly => std::option::Option::Some("PRIVATE_RANGES_ONLY"),
Self::AllTraffic => std::option::Option::Some("ALL_TRAFFIC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for VpcConnectorEgressSettings {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for VpcConnectorEgressSettings {
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 VpcConnectorEgressSettings {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PrivateRangesOnly,
2 => Self::AllTraffic,
_ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for VpcConnectorEgressSettings {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
"PRIVATE_RANGES_ONLY" => Self::PrivateRangesOnly,
"ALL_TRAFFIC" => Self::AllTraffic,
_ => Self::UnknownValue(vpc_connector_egress_settings::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for VpcConnectorEgressSettings {
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::PrivateRangesOnly => serializer.serialize_i32(1),
Self::AllTraffic => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for VpcConnectorEgressSettings {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<VpcConnectorEgressSettings>::new(
".google.cloud.functions.v2.ServiceConfig.VpcConnectorEgressSettings",
),
)
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IngressSettings {
Unspecified,
AllowAll,
AllowInternalOnly,
AllowInternalAndGclb,
UnknownValue(ingress_settings::UnknownValue),
}
#[doc(hidden)]
pub mod ingress_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IngressSettings {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AllowAll => std::option::Option::Some(1),
Self::AllowInternalOnly => std::option::Option::Some(2),
Self::AllowInternalAndGclb => 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("INGRESS_SETTINGS_UNSPECIFIED"),
Self::AllowAll => std::option::Option::Some("ALLOW_ALL"),
Self::AllowInternalOnly => std::option::Option::Some("ALLOW_INTERNAL_ONLY"),
Self::AllowInternalAndGclb => std::option::Option::Some("ALLOW_INTERNAL_AND_GCLB"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IngressSettings {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IngressSettings {
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 IngressSettings {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AllowAll,
2 => Self::AllowInternalOnly,
3 => Self::AllowInternalAndGclb,
_ => Self::UnknownValue(ingress_settings::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IngressSettings {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INGRESS_SETTINGS_UNSPECIFIED" => Self::Unspecified,
"ALLOW_ALL" => Self::AllowAll,
"ALLOW_INTERNAL_ONLY" => Self::AllowInternalOnly,
"ALLOW_INTERNAL_AND_GCLB" => Self::AllowInternalAndGclb,
_ => Self::UnknownValue(ingress_settings::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IngressSettings {
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::AllowAll => serializer.serialize_i32(1),
Self::AllowInternalOnly => serializer.serialize_i32(2),
Self::AllowInternalAndGclb => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IngressSettings {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngressSettings>::new(
".google.cloud.functions.v2.ServiceConfig.IngressSettings",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SecurityLevel {
Unspecified,
SecureAlways,
SecureOptional,
UnknownValue(security_level::UnknownValue),
}
#[doc(hidden)]
pub mod security_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SecurityLevel {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SecureAlways => std::option::Option::Some(1),
Self::SecureOptional => 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("SECURITY_LEVEL_UNSPECIFIED"),
Self::SecureAlways => std::option::Option::Some("SECURE_ALWAYS"),
Self::SecureOptional => std::option::Option::Some("SECURE_OPTIONAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SecurityLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SecurityLevel {
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 SecurityLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SecureAlways,
2 => Self::SecureOptional,
_ => Self::UnknownValue(security_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SecurityLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SECURITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
"SECURE_ALWAYS" => Self::SecureAlways,
"SECURE_OPTIONAL" => Self::SecureOptional,
_ => Self::UnknownValue(security_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SecurityLevel {
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::SecureAlways => serializer.serialize_i32(1),
Self::SecureOptional => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SecurityLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecurityLevel>::new(
".google.cloud.functions.v2.ServiceConfig.SecurityLevel",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretEnvVar {
pub key: std::string::String,
pub project_id: std::string::String,
pub secret: std::string::String,
pub version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretEnvVar {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
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_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.secret = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
}
impl wkt::message::Message for SecretEnvVar {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.SecretEnvVar"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretVolume {
pub mount_path: std::string::String,
pub project_id: std::string::String,
pub secret: std::string::String,
pub versions: std::vec::Vec<crate::model::secret_volume::SecretVersion>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretVolume {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_mount_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mount_path = v.into();
self
}
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_secret<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.secret = v.into();
self
}
pub fn set_versions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::secret_volume::SecretVersion>,
{
use std::iter::Iterator;
self.versions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SecretVolume {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.SecretVolume"
}
}
pub mod secret_volume {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SecretVersion {
pub version: std::string::String,
pub path: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SecretVersion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.path = v.into();
self
}
}
impl wkt::message::Message for SecretVersion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.SecretVolume.SecretVersion"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EventTrigger {
pub trigger: std::string::String,
pub trigger_region: std::string::String,
pub event_type: std::string::String,
pub event_filters: std::vec::Vec<crate::model::EventFilter>,
pub pubsub_topic: std::string::String,
pub service_account_email: std::string::String,
pub retry_policy: crate::model::event_trigger::RetryPolicy,
pub channel: std::string::String,
pub service: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EventTrigger {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_trigger<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.trigger = v.into();
self
}
pub fn set_trigger_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.trigger_region = v.into();
self
}
pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.event_type = v.into();
self
}
pub fn set_event_filters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EventFilter>,
{
use std::iter::Iterator;
self.event_filters = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.pubsub_topic = v.into();
self
}
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_retry_policy<T: std::convert::Into<crate::model::event_trigger::RetryPolicy>>(
mut self,
v: T,
) -> Self {
self.retry_policy = v.into();
self
}
pub fn set_channel<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.channel = v.into();
self
}
pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service = v.into();
self
}
}
impl wkt::message::Message for EventTrigger {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.EventTrigger"
}
}
pub mod event_trigger {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RetryPolicy {
Unspecified,
DoNotRetry,
Retry,
UnknownValue(retry_policy::UnknownValue),
}
#[doc(hidden)]
pub mod retry_policy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RetryPolicy {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DoNotRetry => std::option::Option::Some(1),
Self::Retry => 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("RETRY_POLICY_UNSPECIFIED"),
Self::DoNotRetry => std::option::Option::Some("RETRY_POLICY_DO_NOT_RETRY"),
Self::Retry => std::option::Option::Some("RETRY_POLICY_RETRY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RetryPolicy {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RetryPolicy {
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 RetryPolicy {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DoNotRetry,
2 => Self::Retry,
_ => Self::UnknownValue(retry_policy::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RetryPolicy {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RETRY_POLICY_UNSPECIFIED" => Self::Unspecified,
"RETRY_POLICY_DO_NOT_RETRY" => Self::DoNotRetry,
"RETRY_POLICY_RETRY" => Self::Retry,
_ => Self::UnknownValue(retry_policy::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RetryPolicy {
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::DoNotRetry => serializer.serialize_i32(1),
Self::Retry => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RetryPolicy {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetryPolicy>::new(
".google.cloud.functions.v2.EventTrigger.RetryPolicy",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EventFilter {
pub attribute: std::string::String,
pub value: std::string::String,
pub operator: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl EventFilter {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.attribute = v.into();
self
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
pub fn set_operator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.operator = v.into();
self
}
}
impl wkt::message::Message for EventFilter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.EventFilter"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFunctionRequest {
pub name: std::string::String,
pub revision: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetFunctionRequest {
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_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.revision = v.into();
self
}
}
impl wkt::message::Message for GetFunctionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.GetFunctionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFunctionsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub order_by: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFunctionsRequest {
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
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
}
impl wkt::message::Message for ListFunctionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ListFunctionsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListFunctionsResponse {
pub functions: std::vec::Vec<crate::model::Function>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListFunctionsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_functions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Function>,
{
use std::iter::Iterator;
self.functions = 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_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListFunctionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ListFunctionsResponse"
}
}
#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListFunctionsResponse {
type PageItem = crate::model::Function;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.functions
}
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 CreateFunctionRequest {
pub parent: std::string::String,
pub function: std::option::Option<crate::model::Function>,
pub function_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateFunctionRequest {
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_function<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Function>,
{
self.function = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Function>,
{
self.function = v.map(|x| x.into());
self
}
pub fn set_function_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.function_id = v.into();
self
}
}
impl wkt::message::Message for CreateFunctionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.CreateFunctionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFunctionRequest {
pub function: std::option::Option<crate::model::Function>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateFunctionRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_function<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Function>,
{
self.function = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Function>,
{
self.function = 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 UpdateFunctionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.UpdateFunctionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteFunctionRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteFunctionRequest {
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 DeleteFunctionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.DeleteFunctionRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateUploadUrlRequest {
pub parent: std::string::String,
pub kms_key_name: std::string::String,
pub environment: crate::model::Environment,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateUploadUrlRequest {
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_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
mut self,
v: T,
) -> Self {
self.environment = v.into();
self
}
}
impl wkt::message::Message for GenerateUploadUrlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateUploadUrlResponse {
pub upload_url: std::string::String,
pub storage_source: std::option::Option<crate::model::StorageSource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateUploadUrlResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_upload_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.upload_url = v.into();
self
}
pub fn set_storage_source<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StorageSource>,
{
self.storage_source = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_storage_source<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StorageSource>,
{
self.storage_source = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for GenerateUploadUrlResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.GenerateUploadUrlResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateDownloadUrlRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateDownloadUrlRequest {
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 GenerateDownloadUrlRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateDownloadUrlResponse {
pub download_url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GenerateDownloadUrlResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_download_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.download_url = v.into();
self
}
}
impl wkt::message::Message for GenerateDownloadUrlResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.GenerateDownloadUrlResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimesRequest {
pub parent: std::string::String,
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRuntimesRequest {
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
}
}
impl wkt::message::Message for ListRuntimesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ListRuntimesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRuntimesResponse {
pub runtimes: std::vec::Vec<crate::model::list_runtimes_response::Runtime>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRuntimesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_runtimes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::list_runtimes_response::Runtime>,
{
use std::iter::Iterator;
self.runtimes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListRuntimesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse"
}
}
pub mod list_runtimes_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Runtime {
pub name: std::string::String,
pub display_name: std::string::String,
pub stage: crate::model::list_runtimes_response::RuntimeStage,
pub warnings: std::vec::Vec<std::string::String>,
pub environment: crate::model::Environment,
pub deprecation_date: std::option::Option<gtype::model::Date>,
pub decommission_date: std::option::Option<gtype::model::Date>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Runtime {
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_display_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.display_name = v.into();
self
}
pub fn set_stage<
T: std::convert::Into<crate::model::list_runtimes_response::RuntimeStage>,
>(
mut self,
v: T,
) -> Self {
self.stage = v.into();
self
}
pub fn set_warnings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.warnings = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_environment<T: std::convert::Into<crate::model::Environment>>(
mut self,
v: T,
) -> Self {
self.environment = v.into();
self
}
pub fn set_deprecation_date<T>(mut self, v: T) -> Self
where
T: std::convert::Into<gtype::model::Date>,
{
self.deprecation_date = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_deprecation_date<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<gtype::model::Date>,
{
self.deprecation_date = v.map(|x| x.into());
self
}
pub fn set_decommission_date<T>(mut self, v: T) -> Self
where
T: std::convert::Into<gtype::model::Date>,
{
self.decommission_date = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_decommission_date<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<gtype::model::Date>,
{
self.decommission_date = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Runtime {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.ListRuntimesResponse.Runtime"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RuntimeStage {
Unspecified,
Development,
Alpha,
Beta,
Ga,
Deprecated,
Decommissioned,
UnknownValue(runtime_stage::UnknownValue),
}
#[doc(hidden)]
pub mod runtime_stage {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RuntimeStage {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Development => std::option::Option::Some(1),
Self::Alpha => std::option::Option::Some(2),
Self::Beta => std::option::Option::Some(3),
Self::Ga => std::option::Option::Some(4),
Self::Deprecated => std::option::Option::Some(5),
Self::Decommissioned => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RUNTIME_STAGE_UNSPECIFIED"),
Self::Development => std::option::Option::Some("DEVELOPMENT"),
Self::Alpha => std::option::Option::Some("ALPHA"),
Self::Beta => std::option::Option::Some("BETA"),
Self::Ga => std::option::Option::Some("GA"),
Self::Deprecated => std::option::Option::Some("DEPRECATED"),
Self::Decommissioned => std::option::Option::Some("DECOMMISSIONED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RuntimeStage {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RuntimeStage {
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 RuntimeStage {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Development,
2 => Self::Alpha,
3 => Self::Beta,
4 => Self::Ga,
5 => Self::Deprecated,
6 => Self::Decommissioned,
_ => Self::UnknownValue(runtime_stage::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RuntimeStage {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RUNTIME_STAGE_UNSPECIFIED" => Self::Unspecified,
"DEVELOPMENT" => Self::Development,
"ALPHA" => Self::Alpha,
"BETA" => Self::Beta,
"GA" => Self::Ga,
"DEPRECATED" => Self::Deprecated,
"DECOMMISSIONED" => Self::Decommissioned,
_ => Self::UnknownValue(runtime_stage::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RuntimeStage {
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::Development => serializer.serialize_i32(1),
Self::Alpha => serializer.serialize_i32(2),
Self::Beta => serializer.serialize_i32(3),
Self::Ga => serializer.serialize_i32(4),
Self::Deprecated => serializer.serialize_i32(5),
Self::Decommissioned => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RuntimeStage {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuntimeStage>::new(
".google.cloud.functions.v2.ListRuntimesResponse.RuntimeStage",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AutomaticUpdatePolicy {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AutomaticUpdatePolicy {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AutomaticUpdatePolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.AutomaticUpdatePolicy"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OnDeployUpdatePolicy {
pub runtime_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OnDeployUpdatePolicy {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_runtime_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.runtime_version = v.into();
self
}
}
impl wkt::message::Message for OnDeployUpdatePolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.OnDeployUpdatePolicy"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub target: std::string::String,
pub verb: std::string::String,
pub status_detail: std::string::String,
pub cancel_requested: bool,
pub api_version: std::string::String,
pub request_resource: std::option::Option<wkt::Any>,
pub stages: std::vec::Vec<crate::model::Stage>,
pub source_token: std::string::String,
pub build_name: std::string::String,
pub operation_type: crate::model::OperationType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OperationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
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_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.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.end_time = v.map(|x| x.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_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.verb = v.into();
self
}
pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status_detail = v.into();
self
}
pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.cancel_requested = v.into();
self
}
pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.api_version = v.into();
self
}
pub fn set_request_resource<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.request_resource = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_request_resource<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Any>,
{
self.request_resource = v.map(|x| x.into());
self
}
pub fn set_stages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Stage>,
{
use std::iter::Iterator;
self.stages = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_source_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source_token = v.into();
self
}
pub fn set_build_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.build_name = v.into();
self
}
pub fn set_operation_type<T: std::convert::Into<crate::model::OperationType>>(
mut self,
v: T,
) -> Self {
self.operation_type = v.into();
self
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.OperationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocationMetadata {
pub environments: std::vec::Vec<crate::model::Environment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_environments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Environment>,
{
use std::iter::Iterator;
self.environments = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for LocationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.LocationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Stage {
pub name: crate::model::stage::Name,
pub message: std::string::String,
pub state: crate::model::stage::State,
pub resource: std::string::String,
pub resource_uri: std::string::String,
pub state_messages: std::vec::Vec<crate::model::StateMessage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Stage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<crate::model::stage::Name>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::stage::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource = v.into();
self
}
pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource_uri = v.into();
self
}
pub fn set_state_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StateMessage>,
{
use std::iter::Iterator;
self.state_messages = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Stage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.functions.v2.Stage"
}
}
pub mod stage {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Name {
Unspecified,
ArtifactRegistry,
Build,
Service,
Trigger,
ServiceRollback,
TriggerRollback,
UnknownValue(name::UnknownValue),
}
#[doc(hidden)]
pub mod name {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Name {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ArtifactRegistry => std::option::Option::Some(1),
Self::Build => std::option::Option::Some(2),
Self::Service => std::option::Option::Some(3),
Self::Trigger => std::option::Option::Some(4),
Self::ServiceRollback => std::option::Option::Some(5),
Self::TriggerRollback => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("NAME_UNSPECIFIED"),
Self::ArtifactRegistry => std::option::Option::Some("ARTIFACT_REGISTRY"),
Self::Build => std::option::Option::Some("BUILD"),
Self::Service => std::option::Option::Some("SERVICE"),
Self::Trigger => std::option::Option::Some("TRIGGER"),
Self::ServiceRollback => std::option::Option::Some("SERVICE_ROLLBACK"),
Self::TriggerRollback => std::option::Option::Some("TRIGGER_ROLLBACK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Name {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Name {
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 Name {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ArtifactRegistry,
2 => Self::Build,
3 => Self::Service,
4 => Self::Trigger,
5 => Self::ServiceRollback,
6 => Self::TriggerRollback,
_ => Self::UnknownValue(name::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Name {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NAME_UNSPECIFIED" => Self::Unspecified,
"ARTIFACT_REGISTRY" => Self::ArtifactRegistry,
"BUILD" => Self::Build,
"SERVICE" => Self::Service,
"TRIGGER" => Self::Trigger,
"SERVICE_ROLLBACK" => Self::ServiceRollback,
"TRIGGER_ROLLBACK" => Self::TriggerRollback,
_ => Self::UnknownValue(name::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Name {
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::ArtifactRegistry => serializer.serialize_i32(1),
Self::Build => serializer.serialize_i32(2),
Self::Service => serializer.serialize_i32(3),
Self::Trigger => serializer.serialize_i32(4),
Self::ServiceRollback => serializer.serialize_i32(5),
Self::TriggerRollback => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Name {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Name>::new(
".google.cloud.functions.v2.Stage.Name",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
NotStarted,
InProgress,
Complete,
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::NotStarted => std::option::Option::Some(1),
Self::InProgress => std::option::Option::Some(2),
Self::Complete => 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::NotStarted => std::option::Option::Some("NOT_STARTED"),
Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
Self::Complete => std::option::Option::Some("COMPLETE"),
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::NotStarted,
2 => Self::InProgress,
3 => Self::Complete,
_ => 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,
"NOT_STARTED" => Self::NotStarted,
"IN_PROGRESS" => Self::InProgress,
"COMPLETE" => Self::Complete,
_ => 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::NotStarted => serializer.serialize_i32(1),
Self::InProgress => serializer.serialize_i32(2),
Self::Complete => 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.functions.v2.Stage.State",
))
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationType {
OperationtypeUnspecified,
CreateFunction,
UpdateFunction,
DeleteFunction,
UnknownValue(operation_type::UnknownValue),
}
#[doc(hidden)]
pub mod operation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl OperationType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::OperationtypeUnspecified => std::option::Option::Some(0),
Self::CreateFunction => std::option::Option::Some(1),
Self::UpdateFunction => std::option::Option::Some(2),
Self::DeleteFunction => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::OperationtypeUnspecified => {
std::option::Option::Some("OPERATIONTYPE_UNSPECIFIED")
}
Self::CreateFunction => std::option::Option::Some("CREATE_FUNCTION"),
Self::UpdateFunction => std::option::Option::Some("UPDATE_FUNCTION"),
Self::DeleteFunction => std::option::Option::Some("DELETE_FUNCTION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for OperationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for OperationType {
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 OperationType {
fn from(value: i32) -> Self {
match value {
0 => Self::OperationtypeUnspecified,
1 => Self::CreateFunction,
2 => Self::UpdateFunction,
3 => Self::DeleteFunction,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for OperationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OPERATIONTYPE_UNSPECIFIED" => Self::OperationtypeUnspecified,
"CREATE_FUNCTION" => Self::CreateFunction,
"UPDATE_FUNCTION" => Self::UpdateFunction,
"DELETE_FUNCTION" => Self::DeleteFunction,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for OperationType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::OperationtypeUnspecified => serializer.serialize_i32(0),
Self::CreateFunction => serializer.serialize_i32(1),
Self::UpdateFunction => serializer.serialize_i32(2),
Self::DeleteFunction => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for OperationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
".google.cloud.functions.v2.OperationType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Environment {
Unspecified,
Gen1,
Gen2,
UnknownValue(environment::UnknownValue),
}
#[doc(hidden)]
pub mod environment {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Environment {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gen1 => std::option::Option::Some(1),
Self::Gen2 => 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("ENVIRONMENT_UNSPECIFIED"),
Self::Gen1 => std::option::Option::Some("GEN_1"),
Self::Gen2 => std::option::Option::Some("GEN_2"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Environment {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Environment {
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 Environment {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gen1,
2 => Self::Gen2,
_ => Self::UnknownValue(environment::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Environment {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENVIRONMENT_UNSPECIFIED" => Self::Unspecified,
"GEN_1" => Self::Gen1,
"GEN_2" => Self::Gen2,
_ => Self::UnknownValue(environment::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Environment {
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::Gen1 => serializer.serialize_i32(1),
Self::Gen2 => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Environment {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Environment>::new(
".google.cloud.functions.v2.Environment",
))
}
}