#![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_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 CreateKeyRequest {
pub parent: std::string::String,
pub key: std::option::Option<crate::model::Key>,
pub key_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateKeyRequest {
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_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Key>,
{
self.key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Key>,
{
self.key = v.map(|x| x.into());
self
}
pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key_id = v.into();
self
}
}
impl wkt::message::Message for CreateKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.CreateKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListKeysRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub show_deleted: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListKeysRequest {
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_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.show_deleted = v.into();
self
}
}
impl wkt::message::Message for ListKeysRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.ListKeysRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListKeysResponse {
pub keys: std::vec::Vec<crate::model::Key>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListKeysResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Key>,
{
use std::iter::Iterator;
self.keys = 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 ListKeysResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.ListKeysResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListKeysResponse {
type PageItem = crate::model::Key;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.keys
}
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 GetKeyRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetKeyRequest {
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 GetKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.GetKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetKeyStringRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetKeyStringRequest {
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 GetKeyStringRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.GetKeyStringRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetKeyStringResponse {
pub key_string: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetKeyStringResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key_string = v.into();
self
}
}
impl wkt::message::Message for GetKeyStringResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.GetKeyStringResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateKeyRequest {
pub key: std::option::Option<crate::model::Key>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateKeyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Key>,
{
self.key = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Key>,
{
self.key = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.UpdateKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteKeyRequest {
pub name: std::string::String,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteKeyRequest {
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_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for DeleteKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.DeleteKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteKeyRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UndeleteKeyRequest {
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 UndeleteKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.UndeleteKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LookupKeyRequest {
pub key_string: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LookupKeyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key_string = v.into();
self
}
}
impl wkt::message::Message for LookupKeyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.LookupKeyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LookupKeyResponse {
pub parent: std::string::String,
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LookupKeyResponse {
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_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for LookupKeyResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.LookupKeyResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Key {
pub name: std::string::String,
pub uid: std::string::String,
pub display_name: std::string::String,
pub key_string: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub delete_time: std::option::Option<wkt::Timestamp>,
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
pub restrictions: std::option::Option<crate::model::Restrictions>,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Key {
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_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = 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_key_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key_string = 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_delete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = v.map(|x| x.into());
self
}
pub fn set_annotations<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.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_restrictions<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Restrictions>,
{
self.restrictions = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_restrictions<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Restrictions>,
{
self.restrictions = v.map(|x| x.into());
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for Key {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.Key"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Restrictions {
pub api_targets: std::vec::Vec<crate::model::ApiTarget>,
pub client_restrictions: std::option::Option<crate::model::restrictions::ClientRestrictions>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Restrictions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_api_targets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ApiTarget>,
{
use std::iter::Iterator;
self.api_targets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_client_restrictions<
T: std::convert::Into<std::option::Option<crate::model::restrictions::ClientRestrictions>>,
>(
mut self,
v: T,
) -> Self {
self.client_restrictions = v.into();
self
}
pub fn browser_key_restrictions(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BrowserKeyRestrictions>> {
#[allow(unreachable_patterns)]
self.client_restrictions.as_ref().and_then(|v| match v {
crate::model::restrictions::ClientRestrictions::BrowserKeyRestrictions(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_browser_key_restrictions<
T: std::convert::Into<std::boxed::Box<crate::model::BrowserKeyRestrictions>>,
>(
mut self,
v: T,
) -> Self {
self.client_restrictions = std::option::Option::Some(
crate::model::restrictions::ClientRestrictions::BrowserKeyRestrictions(v.into()),
);
self
}
pub fn server_key_restrictions(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ServerKeyRestrictions>> {
#[allow(unreachable_patterns)]
self.client_restrictions.as_ref().and_then(|v| match v {
crate::model::restrictions::ClientRestrictions::ServerKeyRestrictions(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_server_key_restrictions<
T: std::convert::Into<std::boxed::Box<crate::model::ServerKeyRestrictions>>,
>(
mut self,
v: T,
) -> Self {
self.client_restrictions = std::option::Option::Some(
crate::model::restrictions::ClientRestrictions::ServerKeyRestrictions(v.into()),
);
self
}
pub fn android_key_restrictions(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AndroidKeyRestrictions>> {
#[allow(unreachable_patterns)]
self.client_restrictions.as_ref().and_then(|v| match v {
crate::model::restrictions::ClientRestrictions::AndroidKeyRestrictions(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_android_key_restrictions<
T: std::convert::Into<std::boxed::Box<crate::model::AndroidKeyRestrictions>>,
>(
mut self,
v: T,
) -> Self {
self.client_restrictions = std::option::Option::Some(
crate::model::restrictions::ClientRestrictions::AndroidKeyRestrictions(v.into()),
);
self
}
pub fn ios_key_restrictions(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::IosKeyRestrictions>> {
#[allow(unreachable_patterns)]
self.client_restrictions.as_ref().and_then(|v| match v {
crate::model::restrictions::ClientRestrictions::IosKeyRestrictions(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_ios_key_restrictions<
T: std::convert::Into<std::boxed::Box<crate::model::IosKeyRestrictions>>,
>(
mut self,
v: T,
) -> Self {
self.client_restrictions = std::option::Option::Some(
crate::model::restrictions::ClientRestrictions::IosKeyRestrictions(v.into()),
);
self
}
}
impl wkt::message::Message for Restrictions {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.Restrictions"
}
}
pub mod restrictions {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ClientRestrictions {
BrowserKeyRestrictions(std::boxed::Box<crate::model::BrowserKeyRestrictions>),
ServerKeyRestrictions(std::boxed::Box<crate::model::ServerKeyRestrictions>),
AndroidKeyRestrictions(std::boxed::Box<crate::model::AndroidKeyRestrictions>),
IosKeyRestrictions(std::boxed::Box<crate::model::IosKeyRestrictions>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BrowserKeyRestrictions {
pub allowed_referrers: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BrowserKeyRestrictions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_allowed_referrers<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_referrers = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BrowserKeyRestrictions {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.BrowserKeyRestrictions"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServerKeyRestrictions {
pub allowed_ips: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ServerKeyRestrictions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_allowed_ips<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_ips = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServerKeyRestrictions {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.ServerKeyRestrictions"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AndroidKeyRestrictions {
pub allowed_applications: std::vec::Vec<crate::model::AndroidApplication>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AndroidKeyRestrictions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_allowed_applications<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AndroidApplication>,
{
use std::iter::Iterator;
self.allowed_applications = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for AndroidKeyRestrictions {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.AndroidKeyRestrictions"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AndroidApplication {
pub sha1_fingerprint: std::string::String,
pub package_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AndroidApplication {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.sha1_fingerprint = v.into();
self
}
pub fn set_package_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.package_name = v.into();
self
}
}
impl wkt::message::Message for AndroidApplication {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.AndroidApplication"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IosKeyRestrictions {
pub allowed_bundle_ids: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl IosKeyRestrictions {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_allowed_bundle_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.allowed_bundle_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for IosKeyRestrictions {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.IosKeyRestrictions"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApiTarget {
pub service: std::string::String,
pub methods: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ApiTarget {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service = v.into();
self
}
pub fn set_methods<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.methods = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ApiTarget {
fn typename() -> &'static str {
"type.googleapis.com/google.api.apikeys.v2.ApiTarget"
}
}