make regen-apis

This commit is contained in:
OMGeeky
2024-05-16 21:23:40 +02:00
parent 52d2e89e51
commit ad85cafeef
5108 changed files with 1615625 additions and 992044 deletions

View File

@@ -1,474 +1,4 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
/// View your data across Google Cloud services and see the email address of your Google Account
CloudPlatformReadOnly,
/// View and administer all your Firebase data and settings
Firebase,
/// View all your Firebase data and settings
FirebaseReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only",
Scope::Firebase => "https://www.googleapis.com/auth/firebase",
Scope::FirebaseReadonly => "https://www.googleapis.com/auth/firebase.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::FirebaseReadonly
}
}
// ########
// HUB ###
// ######
/// Central instance to access all FirebaseRealtimeDatabase related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::DatabaseInstance;
/// use firebasedatabase1_beta::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = DatabaseInstance::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_instances_create(req, "parent")
/// .validate_only(true)
/// .database_id("duo")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct FirebaseRealtimeDatabase<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for FirebaseRealtimeDatabase<S> {}
impl<'a, S> FirebaseRealtimeDatabase<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> FirebaseRealtimeDatabase<S> {
FirebaseRealtimeDatabase {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.4".to_string(),
_base_url: "https://firebasedatabase.googleapis.com/".to_string(),
_root_url: "https://firebasedatabase.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.4`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://firebasedatabase.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://firebasedatabase.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// Representation of a Realtime Database instance. Details on interacting with contents of a DatabaseInstance can be found at: https://firebase.google.com/docs/database/rest/start.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request|response)
/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
/// * [locations instances disable projects](ProjectLocationInstanceDisableCall) (response)
/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
/// * [locations instances reenable projects](ProjectLocationInstanceReenableCall) (response)
/// * [locations instances undelete projects](ProjectLocationInstanceUndeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DatabaseInstance {
/// Output only. Output Only. The globally unique hostname of the database.
#[serde(rename="databaseUrl")]
pub database_url: Option<String>,
/// The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
pub name: Option<String>,
/// Output only. The resource name of the project this instance belongs to. For example: `projects/{project-number}`.
pub project: Option<String>,
/// Output only. The database's lifecycle state. Read-only.
pub state: Option<String>,
/// Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::RequestValue for DatabaseInstance {}
impl client::ResponseResult for DatabaseInstance {}
/// The request sent to the DisableDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances disable projects](ProjectLocationInstanceDisableCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DisableDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for DisableDatabaseInstanceRequest {}
/// The response from the ListDatabaseInstances method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListDatabaseInstancesResponse {
/// List of each DatabaseInstance that is in the parent Firebase project.
pub instances: Option<Vec<DatabaseInstance>>,
/// If the result list is too large to fit in a single response, then a token is returned. If the string is empty, then this response is the last page of results. This token can be used in a subsequent call to `ListDatabaseInstances` to find the next group of database instances. Page tokens are short-lived and should not be persisted.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListDatabaseInstancesResponse {}
/// The request sent to the ReenableDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances reenable projects](ProjectLocationInstanceReenableCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ReenableDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for ReenableDatabaseInstanceRequest {}
/// The request sent to UndeleteDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances undelete projects](ProjectLocationInstanceUndeleteCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UndeleteDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for UndeleteDatabaseInstanceRequest {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`FirebaseRealtimeDatabase`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_disable(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_reenable(...)` and `locations_instances_undelete(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Requests that a new DatabaseInstance be created. The state of a successfully created DatabaseInstance is ACTIVE. Only available for projects on the Blaze plan. Projects can be upgraded using the Cloud Billing API https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it might take a few minutes for billing enablement state to propagate to Firebase systems.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. The parent project for which to create a database instance, in the form: `projects/{project-number}/locations/{location-id}`.
pub fn locations_instances_create(&self, request: DatabaseInstance, parent: &str) -> ProjectLocationInstanceCreateCall<'a, S> {
ProjectLocationInstanceCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_validate_only: Default::default(),
_database_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Marks a DatabaseInstance to be deleted. The DatabaseInstance will be set to the DELETED state for 20 days, and will be purged within 30 days. The default database cannot be deleted. IDs for deleted database instances may never be recovered or re-used. The Database may only be deleted if it is already in a DISABLED state.
///
/// # Arguments
///
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_delete(&self, name: &str) -> ProjectLocationInstanceDeleteCall<'a, S> {
ProjectLocationInstanceDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Disables a DatabaseInstance. The database can be re-enabled later using ReenableDatabaseInstance. When a database is disabled, all reads and writes are denied, including view access in the Firebase console.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_disable(&self, request: DisableDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceDisableCall<'a, S> {
ProjectLocationInstanceDisableCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the DatabaseInstance identified by the specified resource name.
///
/// # Arguments
///
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`. `database-id` is a globally unique identifier across all parent collections. For convenience, this method allows you to supply `-` as a wildcard character in place of specific collections under `projects` and `locations`. The resulting wildcarding form of the method is: `projects/-/locations/-/instances/{database-id}`.
pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, S> {
ProjectLocationInstanceGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists each DatabaseInstance associated with the specified parent project. The list items are returned in no particular order, but will be a consistent view of the database instances when additional requests are made with a `pageToken`. The resulting list contains instances in any STATE. The list results may be stale by a few seconds. Use GetDatabaseInstance for consistent reads.
///
/// # Arguments
///
/// * `parent` - Required. The parent project for which to list database instances, in the form: `projects/{project-number}/locations/{location-id}` To list across all locations, use a parent in the form: `projects/{project-number}/locations/-`
pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, S> {
ProjectLocationInstanceListCall {
hub: self.hub,
_parent: parent.to_string(),
_show_deleted: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables a DatabaseInstance. The database must have been disabled previously using DisableDatabaseInstance. The state of a successfully reenabled DatabaseInstance is ACTIVE.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_reenable(&self, request: ReenableDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceReenableCall<'a, S> {
ProjectLocationInstanceReenableCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Restores a DatabaseInstance that was previously marked to be deleted. After the delete method is used, DatabaseInstances are set to the DELETED state for 20 days, and will be purged within 30 days. Databases in the DELETED state can be undeleted without losing any data. This method may only be used on a DatabaseInstance in the DELETED state. Purged DatabaseInstances may not be recovered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_undelete(&self, request: UndeleteDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceUndeleteCall<'a, S> {
ProjectLocationInstanceUndeleteCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
use super::*;
/// Requests that a new DatabaseInstance be created. The state of a successfully created DatabaseInstance is ACTIVE. Only available for projects on the Blaze plan. Projects can be upgraded using the Cloud Billing API https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it might take a few minutes for billing enablement state to propagate to Firebase systems.
///
/// A builder for the *locations.instances.create* method supported by a *project* resource.
@@ -483,6 +13,7 @@ impl<'a, S> ProjectMethods<'a, S> {
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::DatabaseInstance;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -492,7 +23,7 @@ impl<'a, S> ProjectMethods<'a, S> {
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
@@ -510,14 +41,14 @@ impl<'a, S> ProjectMethods<'a, S> {
pub struct ProjectLocationInstanceCreateCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_request: DatabaseInstance,
_parent: String,
_validate_only: Option<bool>,
_database_id: Option<String>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _request: DatabaseInstance,
pub(super) _parent: String,
pub(super) _validate_only: Option<bool>,
pub(super) _database_id: Option<String>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceCreateCall<'a, S> {}
@@ -551,7 +82,7 @@ where
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("parent", self._parent);
params.push("parent", &self._parent);
if let Some(value) = self._validate_only.as_ref() {
params.push("validateOnly", value.to_string());
}
@@ -798,6 +329,7 @@ where
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -807,7 +339,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -818,11 +350,11 @@ where
pub struct ProjectLocationInstanceDeleteCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceDeleteCall<'a, S> {}
@@ -856,7 +388,7 @@ where
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("name", self._name);
params.push("name", &self._name);
params.extend(self._additional_params.iter());
@@ -905,6 +437,7 @@ where
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
@@ -1061,6 +594,7 @@ where
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::DisableDatabaseInstanceRequest;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -1070,7 +604,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
@@ -1086,12 +620,12 @@ where
pub struct ProjectLocationInstanceDisableCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_request: DisableDatabaseInstanceRequest,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _request: DisableDatabaseInstanceRequest,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceDisableCall<'a, S> {}
@@ -1125,7 +659,7 @@ where
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.push("name", &self._name);
params.extend(self._additional_params.iter());
@@ -1352,6 +886,7 @@ where
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -1361,7 +896,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -1372,11 +907,11 @@ where
pub struct ProjectLocationInstanceGetCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceGetCall<'a, S> {}
@@ -1410,7 +945,7 @@ where
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("name", self._name);
params.push("name", &self._name);
params.extend(self._additional_params.iter());
@@ -1459,6 +994,7 @@ where
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
@@ -1614,6 +1150,7 @@ where
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -1623,7 +1160,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
@@ -1637,14 +1174,14 @@ where
pub struct ProjectLocationInstanceListCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_parent: String,
_show_deleted: Option<bool>,
_page_token: Option<String>,
_page_size: Option<i32>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _parent: String,
pub(super) _show_deleted: Option<bool>,
pub(super) _page_token: Option<String>,
pub(super) _page_size: Option<i32>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceListCall<'a, S> {}
@@ -1678,7 +1215,7 @@ where
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("parent", self._parent);
params.push("parent", &self._parent);
if let Some(value) = self._show_deleted.as_ref() {
params.push("showDeleted", value.to_string());
}
@@ -1736,6 +1273,7 @@ where
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
@@ -1913,6 +1451,7 @@ where
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::ReenableDatabaseInstanceRequest;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -1922,7 +1461,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
@@ -1938,12 +1477,12 @@ where
pub struct ProjectLocationInstanceReenableCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_request: ReenableDatabaseInstanceRequest,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _request: ReenableDatabaseInstanceRequest,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceReenableCall<'a, S> {}
@@ -1977,7 +1516,7 @@ where
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.push("name", &self._name);
params.extend(self._additional_params.iter());
@@ -2205,6 +1744,7 @@ where
/// # extern crate hyper_rustls;
/// # extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::UndeleteDatabaseInstanceRequest;
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// # use std::default::Default;
/// # use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
@@ -2214,7 +1754,7 @@ where
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// # let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
@@ -2230,12 +1770,12 @@ where
pub struct ProjectLocationInstanceUndeleteCall<'a, S>
where S: 'a {
hub: &'a FirebaseRealtimeDatabase<S>,
_request: UndeleteDatabaseInstanceRequest,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
pub(super) _request: UndeleteDatabaseInstanceRequest,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
pub(super) _scopes: BTreeSet<String>
}
impl<'a, S> client::CallBuilder for ProjectLocationInstanceUndeleteCall<'a, S> {}
@@ -2269,7 +1809,7 @@ where
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.push("name", &self._name);
params.extend(self._additional_params.iter());

View File

@@ -0,0 +1,131 @@
use super::*;
// region DatabaseInstanceStateEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// Output only. The database's lifecycle state. Read-only.
pub enum DatabaseInstanceStateEnum {
/// Unspecified state, likely the result of an error on the backend. This is only used for distinguishing unset values.
///
/// "LIFECYCLE_STATE_UNSPECIFIED"
#[serde(rename="LIFECYCLE_STATE_UNSPECIFIED")]
LIFECYCLESTATEUNSPECIFIED,
/// The normal and active state.
///
/// "ACTIVE"
#[serde(rename="ACTIVE")]
ACTIVE,
/// The database is in a disabled state. It can be re-enabled later.
///
/// "DISABLED"
#[serde(rename="DISABLED")]
DISABLED,
/// The database is in a deleted state.
///
/// "DELETED"
#[serde(rename="DELETED")]
DELETED,
}
impl AsRef<str> for DatabaseInstanceStateEnum {
fn as_ref(&self) -> &str {
match *self {
DatabaseInstanceStateEnum::LIFECYCLESTATEUNSPECIFIED => "LIFECYCLE_STATE_UNSPECIFIED",
DatabaseInstanceStateEnum::ACTIVE => "ACTIVE",
DatabaseInstanceStateEnum::DISABLED => "DISABLED",
DatabaseInstanceStateEnum::DELETED => "DELETED",
}
}
}
impl std::convert::TryFrom< &str> for DatabaseInstanceStateEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"LIFECYCLE_STATE_UNSPECIFIED" => Ok(DatabaseInstanceStateEnum::LIFECYCLESTATEUNSPECIFIED),
"ACTIVE" => Ok(DatabaseInstanceStateEnum::ACTIVE),
"DISABLED" => Ok(DatabaseInstanceStateEnum::DISABLED),
"DELETED" => Ok(DatabaseInstanceStateEnum::DELETED),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a DatabaseInstanceStateEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region DatabaseInstanceTypeEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted.
pub enum DatabaseInstanceTypeEnum {
/// Unknown state, likely the result of an error on the backend. This is only used for distinguishing unset values.
///
/// "DATABASE_INSTANCE_TYPE_UNSPECIFIED"
#[serde(rename="DATABASE_INSTANCE_TYPE_UNSPECIFIED")]
DATABASEINSTANCETYPEUNSPECIFIED,
/// The default database that is provisioned when a project is created.
///
/// "DEFAULT_DATABASE"
#[serde(rename="DEFAULT_DATABASE")]
DEFAULTDATABASE,
/// A database that the user created.
///
/// "USER_DATABASE"
#[serde(rename="USER_DATABASE")]
USERDATABASE,
}
impl AsRef<str> for DatabaseInstanceTypeEnum {
fn as_ref(&self) -> &str {
match *self {
DatabaseInstanceTypeEnum::DATABASEINSTANCETYPEUNSPECIFIED => "DATABASE_INSTANCE_TYPE_UNSPECIFIED",
DatabaseInstanceTypeEnum::DEFAULTDATABASE => "DEFAULT_DATABASE",
DatabaseInstanceTypeEnum::USERDATABASE => "USER_DATABASE",
}
}
}
impl std::convert::TryFrom< &str> for DatabaseInstanceTypeEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"DATABASE_INSTANCE_TYPE_UNSPECIFIED" => Ok(DatabaseInstanceTypeEnum::DATABASEINSTANCETYPEUNSPECIFIED),
"DEFAULT_DATABASE" => Ok(DatabaseInstanceTypeEnum::DEFAULTDATABASE),
"USER_DATABASE" => Ok(DatabaseInstanceTypeEnum::USERDATABASE),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a DatabaseInstanceTypeEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion

View File

@@ -0,0 +1,115 @@
use super::*;
/// Central instance to access all FirebaseRealtimeDatabase related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
/// use firebasedatabase1_beta::api::DatabaseInstance;
/// use firebasedatabase1_beta::{Result, Error};
/// use firebasedatabase1_beta::api::enums::*;
/// # async fn dox() {
/// use std::default::Default;
/// use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = DatabaseInstance::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_instances_create(req, "parent")
/// .validate_only(true)
/// .database_id("duo")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct FirebaseRealtimeDatabase<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for FirebaseRealtimeDatabase<S> {}
impl<'a, S> FirebaseRealtimeDatabase<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> FirebaseRealtimeDatabase<S> {
FirebaseRealtimeDatabase {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.5".to_string(),
_base_url: "https://firebasedatabase.googleapis.com/".to_string(),
_root_url: "https://firebasedatabase.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.5`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://firebasedatabase.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://firebasedatabase.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}

View File

@@ -0,0 +1,174 @@
use super::*;
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`FirebaseRealtimeDatabase`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_disable(...)`, `locations_instances_get(...)`, `locations_instances_list(...)`, `locations_instances_reenable(...)` and `locations_instances_undelete(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a FirebaseRealtimeDatabase<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Requests that a new DatabaseInstance be created. The state of a successfully created DatabaseInstance is ACTIVE. Only available for projects on the Blaze plan. Projects can be upgraded using the Cloud Billing API https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it might take a few minutes for billing enablement state to propagate to Firebase systems.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. The parent project for which to create a database instance, in the form: `projects/{project-number}/locations/{location-id}`.
pub fn locations_instances_create(&self, request: DatabaseInstance, parent: &str) -> ProjectLocationInstanceCreateCall<'a, S> {
ProjectLocationInstanceCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_validate_only: Default::default(),
_database_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Marks a DatabaseInstance to be deleted. The DatabaseInstance will be set to the DELETED state for 20 days, and will be purged within 30 days. The default database cannot be deleted. IDs for deleted database instances may never be recovered or re-used. The Database may only be deleted if it is already in a DISABLED state.
///
/// # Arguments
///
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_delete(&self, name: &str) -> ProjectLocationInstanceDeleteCall<'a, S> {
ProjectLocationInstanceDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Disables a DatabaseInstance. The database can be re-enabled later using ReenableDatabaseInstance. When a database is disabled, all reads and writes are denied, including view access in the Firebase console.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_disable(&self, request: DisableDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceDisableCall<'a, S> {
ProjectLocationInstanceDisableCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the DatabaseInstance identified by the specified resource name.
///
/// # Arguments
///
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`. `database-id` is a globally unique identifier across all parent collections. For convenience, this method allows you to supply `-` as a wildcard character in place of specific collections under `projects` and `locations`. The resulting wildcarding form of the method is: `projects/-/locations/-/instances/{database-id}`.
pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, S> {
ProjectLocationInstanceGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists each DatabaseInstance associated with the specified parent project. The list items are returned in no particular order, but will be a consistent view of the database instances when additional requests are made with a `pageToken`. The resulting list contains instances in any STATE. The list results may be stale by a few seconds. Use GetDatabaseInstance for consistent reads.
///
/// # Arguments
///
/// * `parent` - Required. The parent project for which to list database instances, in the form: `projects/{project-number}/locations/{location-id}` To list across all locations, use a parent in the form: `projects/{project-number}/locations/-`
pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, S> {
ProjectLocationInstanceListCall {
hub: self.hub,
_parent: parent.to_string(),
_show_deleted: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables a DatabaseInstance. The database must have been disabled previously using DisableDatabaseInstance. The state of a successfully reenabled DatabaseInstance is ACTIVE.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_reenable(&self, request: ReenableDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceReenableCall<'a, S> {
ProjectLocationInstanceReenableCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Restores a DatabaseInstance that was previously marked to be deleted. After the delete method is used, DatabaseInstances are set to the DELETED state for 20 days, and will be purged within 30 days. Databases in the DELETED state can be undeleted without losing any data. This method may only be used on a DatabaseInstance in the DELETED state. Purged DatabaseInstances may not be recovered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Required. The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`
pub fn locations_instances_undelete(&self, request: UndeleteDatabaseInstanceRequest, name: &str) -> ProjectLocationInstanceUndeleteCall<'a, S> {
ProjectLocationInstanceUndeleteCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,35 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;
pub mod enums;
pub(crate) use enums::*;

View File

@@ -0,0 +1,108 @@
use super::*;
/// Representation of a Realtime Database instance. Details on interacting with contents of a DatabaseInstance can be found at: https://firebase.google.com/docs/database/rest/start.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request|response)
/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
/// * [locations instances disable projects](ProjectLocationInstanceDisableCall) (response)
/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
/// * [locations instances reenable projects](ProjectLocationInstanceReenableCall) (response)
/// * [locations instances undelete projects](ProjectLocationInstanceUndeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DatabaseInstance {
/// Output only. Output Only. The globally unique hostname of the database.
#[serde(rename="databaseUrl")]
pub database_url: Option<String>,
/// The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
pub name: Option<String>,
/// Output only. The resource name of the project this instance belongs to. For example: `projects/{project-number}`.
pub project: Option<String>,
/// Output only. The database's lifecycle state. Read-only.
pub state: Option<DatabaseInstanceStateEnum>,
/// Immutable. The database instance type. On creation only USER_DATABASE is allowed, which is also the default when omitted.
#[serde(rename="type")]
pub type_: Option<DatabaseInstanceTypeEnum>,
}
impl client::RequestValue for DatabaseInstance {}
impl client::ResponseResult for DatabaseInstance {}
/// The request sent to the DisableDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances disable projects](ProjectLocationInstanceDisableCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DisableDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for DisableDatabaseInstanceRequest {}
/// The response from the ListDatabaseInstances method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListDatabaseInstancesResponse {
/// List of each DatabaseInstance that is in the parent Firebase project.
pub instances: Option<Vec<DatabaseInstance>>,
/// If the result list is too large to fit in a single response, then a token is returned. If the string is empty, then this response is the last page of results. This token can be used in a subsequent call to `ListDatabaseInstances` to find the next group of database instances. Page tokens are short-lived and should not be persisted.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListDatabaseInstancesResponse {}
/// The request sent to the ReenableDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances reenable projects](ProjectLocationInstanceReenableCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ReenableDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for ReenableDatabaseInstanceRequest {}
/// The request sent to UndeleteDatabaseInstance method.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations instances undelete projects](ProjectLocationInstanceUndeleteCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UndeleteDatabaseInstanceRequest { _never_set: Option<bool> }
impl client::RequestValue for UndeleteDatabaseInstanceRequest {}

View File

@@ -0,0 +1,36 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
/// View your data across Google Cloud services and see the email address of your Google Account
CloudPlatformReadOnly,
/// View and administer all your Firebase data and settings
Firebase,
/// View all your Firebase data and settings
FirebaseReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only",
Scope::Firebase => "https://www.googleapis.com/auth/firebase",
Scope::FirebaseReadonly => "https://www.googleapis.com/auth/firebase.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::FirebaseReadonly
}
}

View File

@@ -2,14 +2,14 @@
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Firebase Realtime Database* crate version *5.0.4+20240303*, where *20240303* is the exact revision of the *firebasedatabase:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//! This documentation was generated from *Firebase Realtime Database* crate version *5.0.5+20240418*, where *20240418* is the exact revision of the *firebasedatabase:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.5*.
//!
//! Everything else about the *Firebase Realtime Database* *v1_beta* API can be found at the
//! [official documentation site](https://firebase.google.com/docs/reference/rest/database/database-management/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/firebasedatabase1_beta).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](FirebaseRealtimeDatabase) ...
//! Handle the following *Resources* with ease from the central [hub](FirebaseRealtimeDatabase) ...
//!
//! * projects
//! * [*locations instances create*](api::ProjectLocationInstanceCreateCall), [*locations instances delete*](api::ProjectLocationInstanceDeleteCall), [*locations instances disable*](api::ProjectLocationInstanceDisableCall), [*locations instances get*](api::ProjectLocationInstanceGetCall), [*locations instances list*](api::ProjectLocationInstanceListCall), [*locations instances reenable*](api::ProjectLocationInstanceReenableCall) and [*locations instances undelete*](api::ProjectLocationInstanceUndeleteCall)
@@ -55,8 +55,8 @@
//! let r = hub.projects().locations_instances_undelete(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
@@ -81,23 +81,24 @@
//! extern crate google_firebasedatabase1_beta as firebasedatabase1_beta;
//! use firebasedatabase1_beta::api::DatabaseInstance;
//! use firebasedatabase1_beta::{Result, Error};
//! use firebasedatabase1_beta::api::enums::*;
//! # async fn dox() {
//! use std::default::Default;
//! use firebasedatabase1_beta::{FirebaseRealtimeDatabase, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! let mut hub = FirebaseRealtimeDatabase::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
@@ -133,10 +134,10 @@
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
@@ -146,25 +147,25 @@
//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments