#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_location;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
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 ExternalServerConfig {
pub ip_address: std::string::String,
pub allowed_cidr_blocks: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExternalServerConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ip_address = v.into();
self
}
pub fn set_allowed_cidr_blocks<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.allowed_cidr_blocks = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ExternalServerConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ExternalServerConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InternalServerConfig {
pub service_attachment: std::string::String,
pub consumer_accept_list: std::vec::Vec<crate::model::internal_server_config::AllowedConsumer>,
pub consumer_reject_list: std::vec::Vec<crate::model::internal_server_config::DeniedConsumer>,
pub psc_endpoints: std::vec::Vec<crate::model::internal_server_config::PscEndpoint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InternalServerConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.service_attachment = v.into();
self
}
pub fn set_consumer_accept_list<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::internal_server_config::AllowedConsumer>,
{
use std::iter::Iterator;
self.consumer_accept_list = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_consumer_reject_list<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::internal_server_config::DeniedConsumer>,
{
use std::iter::Iterator;
self.consumer_reject_list = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_psc_endpoints<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::internal_server_config::PscEndpoint>,
{
use std::iter::Iterator;
self.psc_endpoints = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for InternalServerConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.InternalServerConfig"
}
}
pub mod internal_server_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AllowedConsumer {
pub connection_limit: i64,
pub consumer_type: std::option::Option<
crate::model::internal_server_config::allowed_consumer::ConsumerType,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AllowedConsumer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_connection_limit<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.connection_limit = v.into();
self
}
pub fn set_consumer_type<
T: std::convert::Into<
std::option::Option<
crate::model::internal_server_config::allowed_consumer::ConsumerType,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.consumer_type = v.into();
self
}
pub fn project(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.consumer_type.as_ref().and_then(|v| match v {
crate::model::internal_server_config::allowed_consumer::ConsumerType::Project(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.consumer_type = std::option::Option::Some(
crate::model::internal_server_config::allowed_consumer::ConsumerType::Project(
v.into(),
),
);
self
}
}
impl wkt::message::Message for AllowedConsumer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.InternalServerConfig.AllowedConsumer"
}
}
pub mod allowed_consumer {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConsumerType {
Project(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeniedConsumer {
pub consumer_type: std::option::Option<
crate::model::internal_server_config::denied_consumer::ConsumerType,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeniedConsumer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_consumer_type<
T: std::convert::Into<
std::option::Option<
crate::model::internal_server_config::denied_consumer::ConsumerType,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.consumer_type = v.into();
self
}
pub fn project(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.consumer_type.as_ref().and_then(|v| match v {
crate::model::internal_server_config::denied_consumer::ConsumerType::Project(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.consumer_type = std::option::Option::Some(
crate::model::internal_server_config::denied_consumer::ConsumerType::Project(
v.into(),
),
);
self
}
}
impl wkt::message::Message for DeniedConsumer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.InternalServerConfig.DeniedConsumer"
}
}
pub mod denied_consumer {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConsumerType {
Project(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PscEndpoint {
pub endpoint: std::string::String,
pub network: std::string::String,
pub status: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PscEndpoint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.endpoint = v.into();
self
}
pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.network = v.into();
self
}
pub fn set_status<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status = v.into();
self
}
}
impl wkt::message::Message for PscEndpoint {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.InternalServerConfig.PscEndpoint"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServerCredential {
pub fingerprint: std::string::String,
pub asymmetric_algorithm: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServerCredential {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_fingerprint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.fingerprint = v.into();
self
}
pub fn set_asymmetric_algorithm<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.asymmetric_algorithm = v.into();
self
}
}
impl wkt::message::Message for ServerCredential {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ServerCredential"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Server {
pub name: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub display_name: std::string::String,
pub access_type: crate::model::server::AccessType,
pub state: crate::model::server::State,
pub google_managed_server_credential: std::option::Option<crate::model::ServerCredential>,
pub service_agent: std::string::String,
pub access_config: std::option::Option<crate::model::server::AccessConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Server {
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_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_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_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_access_type<T: std::convert::Into<crate::model::server::AccessType>>(
mut self,
v: T,
) -> Self {
self.access_type = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::server::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_google_managed_server_credential<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServerCredential>,
{
self.google_managed_server_credential = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_google_managed_server_credential<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ServerCredential>,
{
self.google_managed_server_credential = v.map(|x| x.into());
self
}
pub fn set_service_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service_agent = v.into();
self
}
pub fn set_access_config<
T: std::convert::Into<std::option::Option<crate::model::server::AccessConfig>>,
>(
mut self,
v: T,
) -> Self {
self.access_config = v.into();
self
}
pub fn external_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ExternalServerConfig>> {
#[allow(unreachable_patterns)]
self.access_config.as_ref().and_then(|v| match v {
crate::model::server::AccessConfig::ExternalConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_external_config<
T: std::convert::Into<std::boxed::Box<crate::model::ExternalServerConfig>>,
>(
mut self,
v: T,
) -> Self {
self.access_config =
std::option::Option::Some(crate::model::server::AccessConfig::ExternalConfig(v.into()));
self
}
pub fn internal_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InternalServerConfig>> {
#[allow(unreachable_patterns)]
self.access_config.as_ref().and_then(|v| match v {
crate::model::server::AccessConfig::InternalConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_internal_config<
T: std::convert::Into<std::boxed::Box<crate::model::InternalServerConfig>>,
>(
mut self,
v: T,
) -> Self {
self.access_config =
std::option::Option::Some(crate::model::server::AccessConfig::InternalConfig(v.into()));
self
}
}
impl wkt::message::Message for Server {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.Server"
}
}
pub mod server {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AccessType {
Unspecified,
External,
Internal,
UnknownValue(access_type::UnknownValue),
}
#[doc(hidden)]
pub mod access_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AccessType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::External => std::option::Option::Some(1),
Self::Internal => 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("ACCESS_TYPE_UNSPECIFIED"),
Self::External => std::option::Option::Some("EXTERNAL"),
Self::Internal => std::option::Option::Some("INTERNAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AccessType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for AccessType {
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 AccessType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::External,
2 => Self::Internal,
_ => Self::UnknownValue(access_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AccessType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ACCESS_TYPE_UNSPECIFIED" => Self::Unspecified,
"EXTERNAL" => Self::External,
"INTERNAL" => Self::Internal,
_ => Self::UnknownValue(access_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for AccessType {
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::External => serializer.serialize_i32(1),
Self::Internal => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for AccessType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessType>::new(
".google.cloud.ftp.v1.Server.AccessType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Starting,
Active,
Stopping,
Stopped,
Deleting,
Error,
Updating,
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::Creating => std::option::Option::Some(1),
Self::Starting => std::option::Option::Some(2),
Self::Active => std::option::Option::Some(3),
Self::Stopping => std::option::Option::Some(4),
Self::Stopped => std::option::Option::Some(5),
Self::Deleting => std::option::Option::Some(6),
Self::Error => std::option::Option::Some(7),
Self::Updating => std::option::Option::Some(8),
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::Creating => std::option::Option::Some("CREATING"),
Self::Starting => std::option::Option::Some("STARTING"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Stopping => std::option::Option::Some("STOPPING"),
Self::Stopped => std::option::Option::Some("STOPPED"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Error => std::option::Option::Some("ERROR"),
Self::Updating => std::option::Option::Some("UPDATING"),
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::Creating,
2 => Self::Starting,
3 => Self::Active,
4 => Self::Stopping,
5 => Self::Stopped,
6 => Self::Deleting,
7 => Self::Error,
8 => Self::Updating,
_ => 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,
"CREATING" => Self::Creating,
"STARTING" => Self::Starting,
"ACTIVE" => Self::Active,
"STOPPING" => Self::Stopping,
"STOPPED" => Self::Stopped,
"DELETING" => Self::Deleting,
"ERROR" => Self::Error,
"UPDATING" => Self::Updating,
_ => 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::Creating => serializer.serialize_i32(1),
Self::Starting => serializer.serialize_i32(2),
Self::Active => serializer.serialize_i32(3),
Self::Stopping => serializer.serialize_i32(4),
Self::Stopped => serializer.serialize_i32(5),
Self::Deleting => serializer.serialize_i32(6),
Self::Error => serializer.serialize_i32(7),
Self::Updating => serializer.serialize_i32(8),
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.ftp.v1.Server.State",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AccessConfig {
ExternalConfig(std::boxed::Box<crate::model::ExternalServerConfig>),
InternalConfig(std::boxed::Box<crate::model::InternalServerConfig>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServersRequest {
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 view: crate::model::ServerView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListServersRequest {
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
}
pub fn set_view<T: std::convert::Into<crate::model::ServerView>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
}
impl wkt::message::Message for ListServersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ListServersRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServersResponse {
pub servers: std::vec::Vec<crate::model::Server>,
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 ListServersResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_servers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Server>,
{
use std::iter::Iterator;
self.servers = 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 ListServersResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ListServersResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListServersResponse {
type PageItem = crate::model::Server;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.servers
}
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 GetServerRequest {
pub name: std::string::String,
pub view: crate::model::ServerView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetServerRequest {
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_view<T: std::convert::Into<crate::model::ServerView>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
}
impl wkt::message::Message for GetServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.GetServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServerRequest {
pub parent: std::string::String,
pub server_id: std::string::String,
pub server: std::option::Option<crate::model::Server>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateServerRequest {
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_server_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.server_id = v.into();
self
}
pub fn set_server<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Server>,
{
self.server = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_server<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Server>,
{
self.server = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for CreateServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.CreateServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateServerRequest {
pub update_mask: std::option::Option<wkt::FieldMask>,
pub server: std::option::Option<crate::model::Server>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateServerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
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
}
pub fn set_server<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Server>,
{
self.server = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_server<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Server>,
{
self.server = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for UpdateServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.UpdateServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServerRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteServerRequest {
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 DeleteServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.DeleteServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StorageDirectoryMapping {
pub bucket: std::string::String,
pub bucket_prefix: std::string::String,
pub directory: std::string::String,
pub permission: crate::model::storage_directory_mapping::Permission,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StorageDirectoryMapping {
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_bucket_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.bucket_prefix = v.into();
self
}
pub fn set_directory<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.directory = v.into();
self
}
pub fn set_permission<
T: std::convert::Into<crate::model::storage_directory_mapping::Permission>,
>(
mut self,
v: T,
) -> Self {
self.permission = v.into();
self
}
}
impl wkt::message::Message for StorageDirectoryMapping {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.StorageDirectoryMapping"
}
}
pub mod storage_directory_mapping {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Permission {
Unspecified,
ReadOnly,
ReadWrite,
UnknownValue(permission::UnknownValue),
}
#[doc(hidden)]
pub mod permission {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Permission {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ReadOnly => std::option::Option::Some(1),
Self::ReadWrite => 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("PERMISSION_UNSPECIFIED"),
Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Permission {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Permission {
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 Permission {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ReadOnly,
2 => Self::ReadWrite,
_ => Self::UnknownValue(permission::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Permission {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PERMISSION_UNSPECIFIED" => Self::Unspecified,
"READ_ONLY" => Self::ReadOnly,
"READ_WRITE" => Self::ReadWrite,
_ => Self::UnknownValue(permission::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Permission {
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::ReadOnly => serializer.serialize_i32(1),
Self::ReadWrite => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Permission {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Permission>::new(
".google.cloud.ftp.v1.StorageDirectoryMapping.Permission",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct User {
pub name: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub username: std::string::String,
pub customer_service_account: std::string::String,
pub state: crate::model::user::State,
pub user_credentials: std::vec::Vec<crate::model::UserCredential>,
pub storage_directory_mappings: std::vec::Vec<crate::model::StorageDirectoryMapping>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl User {
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_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_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_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.username = v.into();
self
}
pub fn set_customer_service_account<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.customer_service_account = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::user::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_user_credentials<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::UserCredential>,
{
use std::iter::Iterator;
self.user_credentials = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_storage_directory_mappings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StorageDirectoryMapping>,
{
use std::iter::Iterator;
self.storage_directory_mappings = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for User {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.User"
}
}
pub mod user {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Active,
Error,
Updating,
Deleting,
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::Creating => std::option::Option::Some(1),
Self::Active => std::option::Option::Some(2),
Self::Error => std::option::Option::Some(3),
Self::Updating => std::option::Option::Some(4),
Self::Deleting => 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::Creating => std::option::Option::Some("CREATING"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Error => std::option::Option::Some("ERROR"),
Self::Updating => std::option::Option::Some("UPDATING"),
Self::Deleting => std::option::Option::Some("DELETING"),
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::Creating,
2 => Self::Active,
3 => Self::Error,
4 => Self::Updating,
5 => Self::Deleting,
_ => 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,
"CREATING" => Self::Creating,
"ACTIVE" => Self::Active,
"ERROR" => Self::Error,
"UPDATING" => Self::Updating,
"DELETING" => Self::Deleting,
_ => 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::Creating => serializer.serialize_i32(1),
Self::Active => serializer.serialize_i32(2),
Self::Error => serializer.serialize_i32(3),
Self::Updating => serializer.serialize_i32(4),
Self::Deleting => 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.ftp.v1.User.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListUsersRequest {
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 view: crate::model::UserView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListUsersRequest {
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
}
pub fn set_view<T: std::convert::Into<crate::model::UserView>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
}
impl wkt::message::Message for ListUsersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ListUsersRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListUsersResponse {
pub users: std::vec::Vec<crate::model::User>,
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 ListUsersResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_users<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::User>,
{
use std::iter::Iterator;
self.users = 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 ListUsersResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.ListUsersResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListUsersResponse {
type PageItem = crate::model::User;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.users
}
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 GetUserRequest {
pub name: std::string::String,
pub view: crate::model::UserView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetUserRequest {
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_view<T: std::convert::Into<crate::model::UserView>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
}
impl wkt::message::Message for GetUserRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.GetUserRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateUserRequest {
pub parent: std::string::String,
pub user_id: std::string::String,
pub user: std::option::Option<crate::model::User>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateUserRequest {
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_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_id = v.into();
self
}
pub fn set_user<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::User>,
{
self.user = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::User>,
{
self.user = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for CreateUserRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.CreateUserRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateUserRequest {
pub update_mask: std::option::Option<wkt::FieldMask>,
pub user: std::option::Option<crate::model::User>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateUserRequest {
pub fn new() -> Self {
std::default::Default::default()
}
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
}
pub fn set_user<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::User>,
{
self.user = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::User>,
{
self.user = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateUserRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.UpdateUserRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteUserRequest {
pub name: std::string::String,
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteUserRequest {
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_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
impl wkt::message::Message for DeleteUserRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.DeleteUserRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StartServerRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StartServerRequest {
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 StartServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.StartServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StopServerRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StopServerRequest {
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 StopServerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.StopServerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserCredential {
pub credential_name: std::string::String,
pub credential_type: crate::model::user_credential::Type,
pub ssh_public_key_body: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserCredential {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_credential_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.credential_name = v.into();
self
}
pub fn set_credential_type<T: std::convert::Into<crate::model::user_credential::Type>>(
mut self,
v: T,
) -> Self {
self.credential_type = v.into();
self
}
pub fn set_ssh_public_key_body<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.ssh_public_key_body = v.into();
self
}
}
impl wkt::message::Message for UserCredential {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.UserCredential"
}
}
pub mod user_credential {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
Unspecified,
PublicKey,
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Type {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PublicKey => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::PublicKey => std::option::Option::Some("PUBLIC_KEY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Type {
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 Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PublicKey,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"PUBLIC_KEY" => Self::PublicKey,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Type {
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::PublicKey => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Type {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
".google.cloud.ftp.v1.UserCredential.Type",
))
}
}
}
#[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_message: std::string::String,
pub requested_cancellation: bool,
pub api_version: std::string::String,
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_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.status_message = v.into();
self
}
pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.requested_cancellation = 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
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.ftp.v1.OperationMetadata"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServerView {
Unspecified,
Basic,
Full,
UnknownValue(server_view::UnknownValue),
}
#[doc(hidden)]
pub mod server_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ServerView {
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("SERVER_VIEW_UNSPECIFIED"),
Self::Basic => std::option::Option::Some("SERVER_VIEW_BASIC"),
Self::Full => std::option::Option::Some("SERVER_VIEW_FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ServerView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ServerView {
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 ServerView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Basic,
2 => Self::Full,
_ => Self::UnknownValue(server_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ServerView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SERVER_VIEW_UNSPECIFIED" => Self::Unspecified,
"SERVER_VIEW_BASIC" => Self::Basic,
"SERVER_VIEW_FULL" => Self::Full,
_ => Self::UnknownValue(server_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ServerView {
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 ServerView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServerView>::new(
".google.cloud.ftp.v1.ServerView",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UserView {
Unspecified,
Basic,
Full,
UnknownValue(user_view::UnknownValue),
}
#[doc(hidden)]
pub mod user_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl UserView {
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("USER_VIEW_UNSPECIFIED"),
Self::Basic => std::option::Option::Some("USER_VIEW_BASIC"),
Self::Full => std::option::Option::Some("USER_VIEW_FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for UserView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for UserView {
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 UserView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Basic,
2 => Self::Full,
_ => Self::UnknownValue(user_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for UserView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"USER_VIEW_UNSPECIFIED" => Self::Unspecified,
"USER_VIEW_BASIC" => Self::Basic,
"USER_VIEW_FULL" => Self::Full,
_ => Self::UnknownValue(user_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for UserView {
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 UserView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserView>::new(
".google.cloud.ftp.v1.UserView",
))
}
}