#![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 google_cloud_type;
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 Instance {
pub name: std::string::String,
pub display_name: std::string::String,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub authorized_network: std::string::String,
pub zones: std::vec::Vec<std::string::String>,
pub node_count: i32,
pub node_config: std::option::Option<crate::model::instance::NodeConfig>,
pub memcache_version: crate::model::MemcacheVersion,
pub parameters: std::option::Option<crate::model::MemcacheParameters>,
pub memcache_nodes: std::vec::Vec<crate::model::instance::Node>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub state: crate::model::instance::State,
pub memcache_full_version: std::string::String,
pub instance_messages: std::vec::Vec<crate::model::instance::InstanceMessage>,
pub discovery_endpoint: std::string::String,
pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Instance {
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_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_authorized_network<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.authorized_network = v.into();
self
}
pub fn set_zones<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.zones = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.node_count = v.into();
self
}
pub fn set_node_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::instance::NodeConfig>,
{
self.node_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_node_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::instance::NodeConfig>,
{
self.node_config = v.map(|x| x.into());
self
}
pub fn set_memcache_version<T: std::convert::Into<crate::model::MemcacheVersion>>(
mut self,
v: T,
) -> Self {
self.memcache_version = v.into();
self
}
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = v.map(|x| x.into());
self
}
pub fn set_memcache_nodes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::instance::Node>,
{
use std::iter::Iterator;
self.memcache_nodes = v.into_iter().map(|i| i.into()).collect();
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_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_memcache_full_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.memcache_full_version = v.into();
self
}
pub fn set_instance_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::instance::InstanceMessage>,
{
use std::iter::Iterator;
self.instance_messages = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_discovery_endpoint<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.discovery_endpoint = v.into();
self
}
pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaintenancePolicy>,
{
self.maintenance_policy = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MaintenancePolicy>,
{
self.maintenance_policy = v.map(|x| x.into());
self
}
pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaintenanceSchedule>,
{
self.maintenance_schedule = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MaintenanceSchedule>,
{
self.maintenance_schedule = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Instance {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.Instance"
}
}
pub mod instance {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NodeConfig {
pub cpu_count: i32,
pub memory_size_mb: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NodeConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_cpu_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.cpu_count = v.into();
self
}
pub fn set_memory_size_mb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.memory_size_mb = v.into();
self
}
}
impl wkt::message::Message for NodeConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.Instance.NodeConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Node {
pub node_id: std::string::String,
pub zone: std::string::String,
pub state: crate::model::instance::node::State,
pub host: std::string::String,
pub port: i32,
pub parameters: std::option::Option<crate::model::MemcacheParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Node {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_node_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.node_id = v.into();
self
}
pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.zone = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::instance::node::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.host = v.into();
self
}
pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.port = v.into();
self
}
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Node {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.Instance.Node"
}
}
pub mod node {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Ready,
Deleting,
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::Ready => std::option::Option::Some(2),
Self::Deleting => std::option::Option::Some(3),
Self::Updating => std::option::Option::Some(4),
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::Ready => std::option::Option::Some("READY"),
Self::Deleting => std::option::Option::Some("DELETING"),
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::Ready,
3 => Self::Deleting,
4 => 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,
"READY" => Self::Ready,
"DELETING" => Self::Deleting,
"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::Ready => serializer.serialize_i32(2),
Self::Deleting => serializer.serialize_i32(3),
Self::Updating => serializer.serialize_i32(4),
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.memcache.v1.Instance.Node.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InstanceMessage {
pub code: crate::model::instance::instance_message::Code,
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InstanceMessage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_code<T: std::convert::Into<crate::model::instance::instance_message::Code>>(
mut self,
v: T,
) -> Self {
self.code = 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 InstanceMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.Instance.InstanceMessage"
}
}
pub mod instance_message {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
Unspecified,
ZoneDistributionUnbalanced,
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ZoneDistributionUnbalanced => 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("CODE_UNSPECIFIED"),
Self::ZoneDistributionUnbalanced => {
std::option::Option::Some("ZONE_DISTRIBUTION_UNBALANCED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
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 Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ZoneDistributionUnbalanced,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CODE_UNSPECIFIED" => Self::Unspecified,
"ZONE_DISTRIBUTION_UNBALANCED" => Self::ZoneDistributionUnbalanced,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Code {
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::ZoneDistributionUnbalanced => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
".google.cloud.memcache.v1.Instance.InstanceMessage.Code",
))
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Creating,
Ready,
Updating,
Deleting,
PerformingMaintenance,
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::Ready => std::option::Option::Some(2),
Self::Updating => std::option::Option::Some(3),
Self::Deleting => std::option::Option::Some(4),
Self::PerformingMaintenance => 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::Ready => std::option::Option::Some("READY"),
Self::Updating => std::option::Option::Some("UPDATING"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::PerformingMaintenance => std::option::Option::Some("PERFORMING_MAINTENANCE"),
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::Ready,
3 => Self::Updating,
4 => Self::Deleting,
5 => Self::PerformingMaintenance,
_ => 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,
"READY" => Self::Ready,
"UPDATING" => Self::Updating,
"DELETING" => Self::Deleting,
"PERFORMING_MAINTENANCE" => Self::PerformingMaintenance,
_ => 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::Ready => serializer.serialize_i32(2),
Self::Updating => serializer.serialize_i32(3),
Self::Deleting => serializer.serialize_i32(4),
Self::PerformingMaintenance => 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.memcache.v1.Instance.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaintenancePolicy {
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub description: std::string::String,
pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaintenancePolicy {
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_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_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
{
use std::iter::Iterator;
self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MaintenancePolicy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.MaintenancePolicy"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WeeklyMaintenanceWindow {
pub day: google_cloud_type::model::DayOfWeek,
pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
pub duration: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl WeeklyMaintenanceWindow {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
mut self,
v: T,
) -> Self {
self.day = v.into();
self
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.duration = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for WeeklyMaintenanceWindow {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.WeeklyMaintenanceWindow"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaintenanceSchedule {
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaintenanceSchedule {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
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_schedule_deadline_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_deadline_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_deadline_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for MaintenanceSchedule {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.MaintenanceSchedule"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RescheduleMaintenanceRequest {
pub instance: std::string::String,
pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
pub schedule_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RescheduleMaintenanceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.instance = v.into();
self
}
pub fn set_reschedule_type<
T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
>(
mut self,
v: T,
) -> Self {
self.reschedule_type = v.into();
self
}
pub fn set_schedule_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.schedule_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RescheduleMaintenanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.RescheduleMaintenanceRequest"
}
}
pub mod reschedule_maintenance_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RescheduleType {
Unspecified,
Immediate,
NextAvailableWindow,
SpecificTime,
UnknownValue(reschedule_type::UnknownValue),
}
#[doc(hidden)]
pub mod reschedule_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RescheduleType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Immediate => std::option::Option::Some(1),
Self::NextAvailableWindow => std::option::Option::Some(2),
Self::SpecificTime => 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("RESCHEDULE_TYPE_UNSPECIFIED"),
Self::Immediate => std::option::Option::Some("IMMEDIATE"),
Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RescheduleType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RescheduleType {
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 RescheduleType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Immediate,
2 => Self::NextAvailableWindow,
3 => Self::SpecificTime,
_ => Self::UnknownValue(reschedule_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RescheduleType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
"IMMEDIATE" => Self::Immediate,
"NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
"SPECIFIC_TIME" => Self::SpecificTime,
_ => Self::UnknownValue(reschedule_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RescheduleType {
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::Immediate => serializer.serialize_i32(1),
Self::NextAvailableWindow => serializer.serialize_i32(2),
Self::SpecificTime => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RescheduleType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
".google.cloud.memcache.v1.RescheduleMaintenanceRequest.RescheduleType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
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 ListInstancesRequest {
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 ListInstancesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.ListInstancesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
pub instances: std::vec::Vec<crate::model::Instance>,
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 ListInstancesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Instance>,
{
use std::iter::Iterator;
self.instances = 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 ListInstancesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.ListInstancesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
type PageItem = crate::model::Instance;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.instances
}
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 GetInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetInstanceRequest {
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 GetInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.GetInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateInstanceRequest {
pub parent: std::string::String,
pub instance_id: std::string::String,
pub instance: std::option::Option<crate::model::Instance>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateInstanceRequest {
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_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.instance_id = v.into();
self
}
pub fn set_instance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.CreateInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateInstanceRequest {
pub update_mask: std::option::Option<wkt::FieldMask>,
pub instance: std::option::Option<crate::model::Instance>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateInstanceRequest {
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_instance<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Instance>,
{
self.instance = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.UpdateInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteInstanceRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteInstanceRequest {
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 DeleteInstanceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.DeleteInstanceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApplyParametersRequest {
pub name: std::string::String,
pub node_ids: std::vec::Vec<std::string::String>,
pub apply_all: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ApplyParametersRequest {
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_node_ids<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.node_ids = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_apply_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.apply_all = v.into();
self
}
}
impl wkt::message::Message for ApplyParametersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.ApplyParametersRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateParametersRequest {
pub name: std::string::String,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub parameters: std::option::Option<crate::model::MemcacheParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateParametersRequest {
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_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_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MemcacheParameters>,
{
self.parameters = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateParametersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.UpdateParametersRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MemcacheParameters {
pub id: std::string::String,
pub params: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MemcacheParameters {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_params<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.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for MemcacheParameters {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.MemcacheParameters"
}
}
#[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(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
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.OperationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocationMetadata {
pub available_zones: std::collections::HashMap<std::string::String, crate::model::ZoneMetadata>,
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_available_zones<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<crate::model::ZoneMetadata>,
{
use std::iter::Iterator;
self.available_zones = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for LocationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.LocationMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ZoneMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ZoneMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for ZoneMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.memcache.v1.ZoneMetadata"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MemcacheVersion {
Unspecified,
Memcache15,
UnknownValue(memcache_version::UnknownValue),
}
#[doc(hidden)]
pub mod memcache_version {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MemcacheVersion {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Memcache15 => 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("MEMCACHE_VERSION_UNSPECIFIED"),
Self::Memcache15 => std::option::Option::Some("MEMCACHE_1_5"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MemcacheVersion {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MemcacheVersion {
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 MemcacheVersion {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Memcache15,
_ => Self::UnknownValue(memcache_version::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MemcacheVersion {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MEMCACHE_VERSION_UNSPECIFIED" => Self::Unspecified,
"MEMCACHE_1_5" => Self::Memcache15,
_ => Self::UnknownValue(memcache_version::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MemcacheVersion {
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::Memcache15 => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MemcacheVersion {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MemcacheVersion>::new(
".google.cloud.memcache.v1.MemcacheVersion",
))
}
}