#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate api;
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Service {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub config: std::option::Option<crate::model::ServiceConfig>,
pub state: crate::model::State,
}
impl Service {
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_config<T: std::convert::Into<std::option::Option<crate::model::ServiceConfig>>>(
mut self,
v: T,
) -> Self {
self.config = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
}
impl wkt::message::Message for Service {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.Service"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ServiceConfig {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub title: std::string::String,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub apis: std::vec::Vec<wkt::Api>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub documentation: std::option::Option<api::model::Documentation>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub quota: std::option::Option<api::model::Quota>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub authentication: std::option::Option<api::model::Authentication>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub usage: std::option::Option<api::model::Usage>,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub endpoints: std::vec::Vec<api::model::Endpoint>,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub monitored_resources: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub monitoring: std::option::Option<api::model::Monitoring>,
}
impl ServiceConfig {
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
pub fn set_documentation<
T: std::convert::Into<std::option::Option<api::model::Documentation>>,
>(
mut self,
v: T,
) -> Self {
self.documentation = v.into();
self
}
pub fn set_quota<T: std::convert::Into<std::option::Option<api::model::Quota>>>(
mut self,
v: T,
) -> Self {
self.quota = v.into();
self
}
pub fn set_authentication<
T: std::convert::Into<std::option::Option<api::model::Authentication>>,
>(
mut self,
v: T,
) -> Self {
self.authentication = v.into();
self
}
pub fn set_usage<T: std::convert::Into<std::option::Option<api::model::Usage>>>(
mut self,
v: T,
) -> Self {
self.usage = v.into();
self
}
pub fn set_monitoring<T: std::convert::Into<std::option::Option<api::model::Monitoring>>>(
mut self,
v: T,
) -> Self {
self.monitoring = v.into();
self
}
pub fn set_apis<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Api>,
{
use std::iter::Iterator;
self.apis = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_endpoints<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<api::model::Endpoint>,
{
use std::iter::Iterator;
self.endpoints = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
{
use std::iter::Iterator;
self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ServiceConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.ServiceConfig"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OperationMetadata {
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub resource_names: std::vec::Vec<std::string::String>,
}
impl OperationMetadata {
pub fn set_resource_names<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.resource_names = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.OperationMetadata"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct EnableServiceRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
}
impl EnableServiceRequest {
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 EnableServiceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.EnableServiceRequest"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct EnableServiceResponse {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub service: std::option::Option<crate::model::Service>,
}
impl EnableServiceResponse {
pub fn set_service<T: std::convert::Into<std::option::Option<crate::model::Service>>>(
mut self,
v: T,
) -> Self {
self.service = v.into();
self
}
}
impl wkt::message::Message for EnableServiceResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.EnableServiceResponse"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DisableServiceRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
pub disable_dependent_services: bool,
pub check_if_service_has_usage: crate::model::disable_service_request::CheckIfServiceHasUsage,
}
impl DisableServiceRequest {
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_disable_dependent_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.disable_dependent_services = v.into();
self
}
pub fn set_check_if_service_has_usage<
T: std::convert::Into<crate::model::disable_service_request::CheckIfServiceHasUsage>,
>(
mut self,
v: T,
) -> Self {
self.check_if_service_has_usage = v.into();
self
}
}
impl wkt::message::Message for DisableServiceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.DisableServiceRequest"
}
}
pub mod disable_service_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CheckIfServiceHasUsage(std::borrow::Cow<'static, str>);
impl CheckIfServiceHasUsage {
pub const fn new(v: &'static str) -> Self {
Self(std::borrow::Cow::Borrowed(v))
}
pub fn value(&self) -> &str {
&self.0
}
}
pub mod check_if_service_has_usage {
use super::CheckIfServiceHasUsage;
pub const CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED: CheckIfServiceHasUsage =
CheckIfServiceHasUsage::new("CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED");
pub const SKIP: CheckIfServiceHasUsage = CheckIfServiceHasUsage::new("SKIP");
pub const CHECK: CheckIfServiceHasUsage = CheckIfServiceHasUsage::new("CHECK");
}
impl std::convert::From<std::string::String> for CheckIfServiceHasUsage {
fn from(value: std::string::String) -> Self {
Self(std::borrow::Cow::Owned(value))
}
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DisableServiceResponse {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub service: std::option::Option<crate::model::Service>,
}
impl DisableServiceResponse {
pub fn set_service<T: std::convert::Into<std::option::Option<crate::model::Service>>>(
mut self,
v: T,
) -> Self {
self.service = v.into();
self
}
}
impl wkt::message::Message for DisableServiceResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.DisableServiceResponse"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GetServiceRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
}
impl GetServiceRequest {
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 GetServiceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.GetServiceRequest"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ListServicesRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
pub page_size: i32,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub page_token: std::string::String,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub filter: std::string::String,
}
impl ListServicesRequest {
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
}
}
impl wkt::message::Message for ListServicesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.ListServicesRequest"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ListServicesResponse {
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub services: std::vec::Vec<crate::model::Service>,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub next_page_token: std::string::String,
}
impl ListServicesResponse {
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_services<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Service>,
{
use std::iter::Iterator;
self.services = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListServicesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.ListServicesResponse"
}
}
#[cfg(feature = "unstable-stream")]
impl gax::paginator::PageableResponse for ListServicesResponse {
type PageItem = crate::model::Service;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.services
}
fn next_page_token(&self) -> std::string::String {
gax::paginator::extract_token(&self.next_page_token)
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BatchEnableServicesRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub service_ids: std::vec::Vec<std::string::String>,
}
impl BatchEnableServicesRequest {
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_service_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.service_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchEnableServicesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesRequest"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BatchEnableServicesResponse {
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub services: std::vec::Vec<crate::model::Service>,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub failures: std::vec::Vec<crate::model::batch_enable_services_response::EnableFailure>,
}
impl BatchEnableServicesResponse {
pub fn set_services<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Service>,
{
use std::iter::Iterator;
self.services = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_failures<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::batch_enable_services_response::EnableFailure>,
{
use std::iter::Iterator;
self.failures = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchEnableServicesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse"
}
}
pub mod batch_enable_services_response {
#[allow(unused_imports)]
use super::*;
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct EnableFailure {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub service_id: std::string::String,
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub error_message: std::string::String,
}
impl EnableFailure {
pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service_id = v.into();
self
}
pub fn set_error_message<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.error_message = v.into();
self
}
}
impl wkt::message::Message for EnableFailure {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse.EnableFailure"
}
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BatchGetServicesRequest {
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub names: std::vec::Vec<std::string::String>,
}
impl BatchGetServicesRequest {
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_names<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.names = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchGetServicesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesRequest"
}
}
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BatchGetServicesResponse {
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub services: std::vec::Vec<crate::model::Service>,
}
impl BatchGetServicesResponse {
pub fn set_services<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Service>,
{
use std::iter::Iterator;
self.services = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BatchGetServicesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesResponse"
}
}
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct State(std::borrow::Cow<'static, str>);
impl State {
pub const fn new(v: &'static str) -> Self {
Self(std::borrow::Cow::Borrowed(v))
}
pub fn value(&self) -> &str {
&self.0
}
}
pub mod state {
use super::State;
pub const STATE_UNSPECIFIED: State = State::new("STATE_UNSPECIFIED");
pub const DISABLED: State = State::new("DISABLED");
pub const ENABLED: State = State::new("ENABLED");
}
impl std::convert::From<std::string::String> for State {
fn from(value: std::string::String) -> Self {
Self(std::borrow::Cow::Owned(value))
}
}