#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_location;
extern crate google_cloud_longrunning;
extern crate google_cloud_lro;
extern crate lazy_static;
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 Connector {
pub name: std::string::String,
pub network: std::string::String,
pub ip_cidr_range: std::string::String,
pub state: crate::model::connector::State,
pub min_throughput: i32,
pub max_throughput: i32,
pub connected_projects: std::vec::Vec<std::string::String>,
pub subnet: std::option::Option<crate::model::connector::Subnet>,
pub machine_type: std::string::String,
pub min_instances: i32,
pub max_instances: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Connector {
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_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.network = v.into();
self
}
pub fn set_ip_cidr_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ip_cidr_range = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::connector::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_min_throughput<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.min_throughput = v.into();
self
}
pub fn set_max_throughput<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_throughput = v.into();
self
}
pub fn set_connected_projects<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.connected_projects = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_subnet<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::connector::Subnet>,
{
self.subnet = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_subnet<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::connector::Subnet>,
{
self.subnet = v.map(|x| x.into());
self
}
pub fn set_machine_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.machine_type = v.into();
self
}
pub fn set_min_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.min_instances = v.into();
self
}
pub fn set_max_instances<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_instances = v.into();
self
}
}
impl wkt::message::Message for Connector {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.Connector"
}
}
pub mod connector {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Subnet {
pub name: std::string::String,
pub project_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Subnet {
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_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.project_id = v.into();
self
}
}
impl wkt::message::Message for Subnet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.Connector.Subnet"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Ready,
Creating,
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::Ready => std::option::Option::Some(1),
Self::Creating => std::option::Option::Some(2),
Self::Deleting => std::option::Option::Some(3),
Self::Error => std::option::Option::Some(4),
Self::Updating => 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::Ready => std::option::Option::Some("READY"),
Self::Creating => std::option::Option::Some("CREATING"),
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::Ready,
2 => Self::Creating,
3 => Self::Deleting,
4 => Self::Error,
5 => 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,
"READY" => Self::Ready,
"CREATING" => Self::Creating,
"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::Ready => serializer.serialize_i32(1),
Self::Creating => serializer.serialize_i32(2),
Self::Deleting => serializer.serialize_i32(3),
Self::Error => serializer.serialize_i32(4),
Self::Updating => 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.vpcaccess.v1.Connector.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConnectorRequest {
pub parent: std::string::String,
pub connector_id: std::string::String,
pub connector: std::option::Option<crate::model::Connector>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateConnectorRequest {
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_connector_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connector_id = v.into();
self
}
pub fn set_connector<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Connector>,
{
self.connector = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Connector>,
{
self.connector = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateConnectorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.CreateConnectorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConnectorRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetConnectorRequest {
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 GetConnectorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.GetConnectorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConnectorsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListConnectorsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListConnectorsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.ListConnectorsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConnectorsResponse {
pub connectors: std::vec::Vec<crate::model::Connector>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListConnectorsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_connectors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Connector>,
{
use std::iter::Iterator;
self.connectors = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListConnectorsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.ListConnectorsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListConnectorsResponse {
type PageItem = crate::model::Connector;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.connectors
}
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 DeleteConnectorRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteConnectorRequest {
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 DeleteConnectorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.DeleteConnectorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
pub method: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub target: 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_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.method = 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_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
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.vpcaccess.v1.OperationMetadata"
}
}