mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
regen all APIs
This commit is contained in:
@@ -20,6 +20,32 @@ 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 and administer all your Firebase data and settings
|
||||
Firebase,
|
||||
}
|
||||
|
||||
impl AsRef<str> for Scope {
|
||||
fn as_ref(&self) -> &str {
|
||||
match *self {
|
||||
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
|
||||
Scope::Firebase => "https://www.googleapis.com/auth/firebase",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Scope {
|
||||
fn default() -> Scope {
|
||||
Scope::Firebase
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +63,7 @@ use crate::{client, client::GetToken, client::serde_with};
|
||||
/// extern crate hyper;
|
||||
/// extern crate hyper_rustls;
|
||||
/// extern crate google_firebasehosting1 as firebasehosting1;
|
||||
/// use firebasehosting1::api::CancelOperationRequest;
|
||||
/// use firebasehosting1::{Result, Error};
|
||||
/// # async fn dox() {
|
||||
/// use std::default::Default;
|
||||
@@ -55,13 +82,15 @@ use crate::{client, client::GetToken, client::serde_with};
|
||||
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
||||
/// ).build().await.unwrap();
|
||||
/// let mut hub = FirebaseHosting::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 = CancelOperationRequest::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.operations().list("name")
|
||||
/// .page_token("takimata")
|
||||
/// .page_size(-52)
|
||||
/// .filter("duo")
|
||||
/// let result = hub.operations().cancel(req, "name")
|
||||
/// .doit().await;
|
||||
///
|
||||
/// match result {
|
||||
@@ -109,6 +138,9 @@ impl<'a, S> FirebaseHosting<S> {
|
||||
pub fn operations(&'a self) -> OperationMethods<'a, S> {
|
||||
OperationMethods { hub: &self }
|
||||
}
|
||||
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.3`.
|
||||
@@ -147,6 +179,7 @@ impl<'a, S> FirebaseHosting<S> {
|
||||
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
|
||||
///
|
||||
/// * [cancel operations](OperationCancelCall) (request)
|
||||
/// * [sites custom domains operations cancel projects](ProjectSiteCustomDomainOperationCancelCall) (request)
|
||||
#[serde_with::serde_as(crate = "::client::serde_with")]
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CancelOperationRequest { _never_set: Option<bool> }
|
||||
@@ -163,6 +196,8 @@ impl client::RequestValue for CancelOperationRequest {}
|
||||
///
|
||||
/// * [cancel operations](OperationCancelCall) (response)
|
||||
/// * [delete operations](OperationDeleteCall) (response)
|
||||
/// * [sites custom domains operations cancel projects](ProjectSiteCustomDomainOperationCancelCall) (response)
|
||||
/// * [sites custom domains operations delete projects](ProjectSiteCustomDomainOperationDeleteCall) (response)
|
||||
#[serde_with::serde_as(crate = "::client::serde_with")]
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Empty { _never_set: Option<bool> }
|
||||
@@ -218,7 +253,7 @@ pub struct Operation {
|
||||
/// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
|
||||
|
||||
pub name: Option<String>,
|
||||
/// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
|
||||
/// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
|
||||
|
||||
pub response: Option<HashMap<String, json::Value>>,
|
||||
}
|
||||
@@ -326,7 +361,7 @@ impl<'a, S> OperationMethods<'a, S> {
|
||||
|
||||
/// Create a builder to help you perform the following task:
|
||||
///
|
||||
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
|
||||
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@@ -346,6 +381,83 @@ impl<'a, S> OperationMethods<'a, S> {
|
||||
|
||||
|
||||
|
||||
/// A builder providing access to all methods supported on *project* resources.
|
||||
/// It is not used directly, but through the [`FirebaseHosting`] hub.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// Instantiate a resource builder
|
||||
///
|
||||
/// ```test_harness,no_run
|
||||
/// extern crate hyper;
|
||||
/// extern crate hyper_rustls;
|
||||
/// extern crate google_firebasehosting1 as firebasehosting1;
|
||||
///
|
||||
/// # async fn dox() {
|
||||
/// use std::default::Default;
|
||||
/// use firebasehosting1::{FirebaseHosting, 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 = FirebaseHosting::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 `sites_custom_domains_operations_cancel(...)` and `sites_custom_domains_operations_delete(...)`
|
||||
/// // to build up your call.
|
||||
/// let rb = hub.projects();
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct ProjectMethods<'a, S>
|
||||
where S: 'a {
|
||||
|
||||
hub: &'a FirebaseHosting<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:
|
||||
///
|
||||
/// CancelOperation is a part of the google.longrunning.Operations interface, but is not implemented for CustomDomain resources.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `request` - No description provided.
|
||||
/// * `name` - The name of the operation resource to be cancelled.
|
||||
pub fn sites_custom_domains_operations_cancel(&self, request: CancelOperationRequest, name: &str) -> ProjectSiteCustomDomainOperationCancelCall<'a, S> {
|
||||
ProjectSiteCustomDomainOperationCancelCall {
|
||||
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:
|
||||
///
|
||||
/// DeleteOperation is a part of the google.longrunning.Operations interface, but is not implemented for CustomDomain resources.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `name` - The name of the operation resource to be deleted.
|
||||
pub fn sites_custom_domains_operations_delete(&self, name: &str) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S> {
|
||||
ProjectSiteCustomDomainOperationDeleteCall {
|
||||
hub: self.hub,
|
||||
_name: name.to_string(),
|
||||
_delegate: Default::default(),
|
||||
_additional_params: Default::default(),
|
||||
_scopes: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ###################
|
||||
@@ -816,7 +928,7 @@ where
|
||||
}
|
||||
|
||||
|
||||
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
|
||||
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
|
||||
///
|
||||
/// A builder for the *list* method supported by a *operation* resource.
|
||||
/// It is not used directly, but through a [`OperationMethods`] instance.
|
||||
@@ -843,9 +955,9 @@ where
|
||||
/// // execute the final call using `doit()`.
|
||||
/// // Values shown here are possibly random and not representative !
|
||||
/// let result = hub.operations().list("name")
|
||||
/// .page_token("gubergren")
|
||||
/// .page_size(-75)
|
||||
/// .filter("dolor")
|
||||
/// .page_token("sanctus")
|
||||
/// .page_size(-80)
|
||||
/// .filter("amet.")
|
||||
/// .doit().await;
|
||||
/// # }
|
||||
/// ```
|
||||
@@ -1069,3 +1181,557 @@ where
|
||||
}
|
||||
|
||||
|
||||
/// CancelOperation is a part of the google.longrunning.Operations interface, but is not implemented for CustomDomain resources.
|
||||
///
|
||||
/// A builder for the *sites.customDomains.operations.cancel* method supported by a *project* resource.
|
||||
/// It is not used directly, but through a [`ProjectMethods`] instance.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// Instantiate a resource method builder
|
||||
///
|
||||
/// ```test_harness,no_run
|
||||
/// # extern crate hyper;
|
||||
/// # extern crate hyper_rustls;
|
||||
/// # extern crate google_firebasehosting1 as firebasehosting1;
|
||||
/// use firebasehosting1::api::CancelOperationRequest;
|
||||
/// # async fn dox() {
|
||||
/// # use std::default::Default;
|
||||
/// # use firebasehosting1::{FirebaseHosting, 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 = FirebaseHosting::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 = CancelOperationRequest::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().sites_custom_domains_operations_cancel(req, "name")
|
||||
/// .doit().await;
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct ProjectSiteCustomDomainOperationCancelCall<'a, S>
|
||||
where S: 'a {
|
||||
|
||||
hub: &'a FirebaseHosting<S>,
|
||||
_request: CancelOperationRequest,
|
||||
_name: String,
|
||||
_delegate: Option<&'a mut dyn client::Delegate>,
|
||||
_additional_params: HashMap<String, String>,
|
||||
_scopes: BTreeSet<String>
|
||||
}
|
||||
|
||||
impl<'a, S> client::CallBuilder for ProjectSiteCustomDomainOperationCancelCall<'a, S> {}
|
||||
|
||||
impl<'a, S> ProjectSiteCustomDomainOperationCancelCall<'a, S>
|
||||
where
|
||||
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
|
||||
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
|
||||
S::Future: Send + Unpin + 'static,
|
||||
S::Error: Into<Box<dyn StdError + Send + Sync>>,
|
||||
{
|
||||
|
||||
|
||||
/// Perform the operation you have build so far.
|
||||
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
|
||||
use std::io::{Read, Seek};
|
||||
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
||||
use client::{ToParts, url::Params};
|
||||
use std::borrow::Cow;
|
||||
|
||||
let mut dd = client::DefaultDelegate;
|
||||
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
|
||||
dlg.begin(client::MethodInfo { id: "firebasehosting.projects.sites.customDomains.operations.cancel",
|
||||
http_method: hyper::Method::POST });
|
||||
|
||||
for &field in ["alt", "name"].iter() {
|
||||
if self._additional_params.contains_key(field) {
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::FieldClash(field));
|
||||
}
|
||||
}
|
||||
|
||||
let mut params = Params::with_capacity(4 + self._additional_params.len());
|
||||
params.push("name", self._name);
|
||||
|
||||
params.extend(self._additional_params.iter());
|
||||
|
||||
params.push("alt", "json");
|
||||
let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
|
||||
if self._scopes.is_empty() {
|
||||
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
|
||||
}
|
||||
|
||||
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
||||
url = params.uri_replacement(url, param_name, find_this, true);
|
||||
}
|
||||
{
|
||||
let to_remove = ["name"];
|
||||
params.remove_params(&to_remove);
|
||||
}
|
||||
|
||||
let url = params.parse_with_url(&url);
|
||||
|
||||
let mut json_mime_type = mime::APPLICATION_JSON;
|
||||
let mut request_value_reader =
|
||||
{
|
||||
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
||||
client::remove_json_null_values(&mut value);
|
||||
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
||||
json::to_writer(&mut dst, &value).unwrap();
|
||||
dst
|
||||
};
|
||||
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||
|
||||
|
||||
loop {
|
||||
let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
|
||||
Ok(token) => token,
|
||||
Err(e) => {
|
||||
match dlg.token(e) {
|
||||
Ok(token) => token,
|
||||
Err(e) => {
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::MissingToken(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||
let mut req_result = {
|
||||
let client = &self.hub.client;
|
||||
dlg.pre_request();
|
||||
let mut req_builder = hyper::Request::builder()
|
||||
.method(hyper::Method::POST)
|
||||
.uri(url.as_str())
|
||||
.header(USER_AGENT, self.hub._user_agent.clone());
|
||||
|
||||
if let Some(token) = token.as_ref() {
|
||||
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
|
||||
}
|
||||
|
||||
|
||||
let request = req_builder
|
||||
.header(CONTENT_TYPE, json_mime_type.to_string())
|
||||
.header(CONTENT_LENGTH, request_size as u64)
|
||||
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
||||
|
||||
client.request(request.unwrap()).await
|
||||
|
||||
};
|
||||
|
||||
match req_result {
|
||||
Err(err) => {
|
||||
if let client::Retry::After(d) = dlg.http_error(&err) {
|
||||
sleep(d).await;
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
let (parts, _) = res.into_parts();
|
||||
let body = hyper::Body::from(res_body_string.clone());
|
||||
let restored_response = hyper::Response::from_parts(parts, body);
|
||||
|
||||
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
||||
sleep(d).await;
|
||||
continue;
|
||||
}
|
||||
|
||||
dlg.finished(false);
|
||||
|
||||
return match server_response {
|
||||
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
||||
None => Err(client::Error::Failure(restored_response)),
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dlg.finished(true);
|
||||
return Ok(result_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Sets the *request* property to the given value.
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn request(mut self, new_value: CancelOperationRequest) -> ProjectSiteCustomDomainOperationCancelCall<'a, S> {
|
||||
self._request = new_value;
|
||||
self
|
||||
}
|
||||
/// The name of the operation resource to be cancelled.
|
||||
///
|
||||
/// Sets the *name* path property to the given value.
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationCancelCall<'a, S> {
|
||||
self._name = new_value.to_string();
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
/// while executing the actual API request.
|
||||
///
|
||||
/// ````text
|
||||
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
||||
/// ````
|
||||
///
|
||||
/// Sets the *delegate* property to the given value.
|
||||
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectSiteCustomDomainOperationCancelCall<'a, S> {
|
||||
self._delegate = Some(new_value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set any additional parameter of the query string used in the request.
|
||||
/// It should be used to set parameters which are not yet available through their own
|
||||
/// setters.
|
||||
///
|
||||
/// Please note that this method must not be used to set any of the known parameters
|
||||
/// which have their own setter method. If done anyway, the request will fail.
|
||||
///
|
||||
/// # Additional Parameters
|
||||
///
|
||||
/// * *$.xgafv* (query-string) - V1 error format.
|
||||
/// * *access_token* (query-string) - OAuth access token.
|
||||
/// * *alt* (query-string) - Data format for response.
|
||||
/// * *callback* (query-string) - JSONP
|
||||
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
||||
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
|
||||
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
||||
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
||||
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
|
||||
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
||||
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
||||
pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationCancelCall<'a, S>
|
||||
where T: AsRef<str> {
|
||||
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
||||
self
|
||||
}
|
||||
|
||||
/// Identifies the authorization scope for the method you are building.
|
||||
///
|
||||
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
|
||||
/// [`Scope::CloudPlatform`].
|
||||
///
|
||||
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
||||
/// tokens for more than one scope.
|
||||
///
|
||||
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
||||
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
||||
/// sufficient, a read-write scope will do as well.
|
||||
pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationCancelCall<'a, S>
|
||||
where St: AsRef<str> {
|
||||
self._scopes.insert(String::from(scope.as_ref()));
|
||||
self
|
||||
}
|
||||
/// Identifies the authorization scope(s) for the method you are building.
|
||||
///
|
||||
/// See [`Self::add_scope()`] for details.
|
||||
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationCancelCall<'a, S>
|
||||
where I: IntoIterator<Item = St>,
|
||||
St: AsRef<str> {
|
||||
self._scopes
|
||||
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
|
||||
self
|
||||
}
|
||||
|
||||
/// Removes all scopes, and no default scope will be used either.
|
||||
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
|
||||
/// for details).
|
||||
pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationCancelCall<'a, S> {
|
||||
self._scopes.clear();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// DeleteOperation is a part of the google.longrunning.Operations interface, but is not implemented for CustomDomain resources.
|
||||
///
|
||||
/// A builder for the *sites.customDomains.operations.delete* method supported by a *project* resource.
|
||||
/// It is not used directly, but through a [`ProjectMethods`] instance.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// Instantiate a resource method builder
|
||||
///
|
||||
/// ```test_harness,no_run
|
||||
/// # extern crate hyper;
|
||||
/// # extern crate hyper_rustls;
|
||||
/// # extern crate google_firebasehosting1 as firebasehosting1;
|
||||
/// # async fn dox() {
|
||||
/// # use std::default::Default;
|
||||
/// # use firebasehosting1::{FirebaseHosting, 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 = FirebaseHosting::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().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 !
|
||||
/// let result = hub.projects().sites_custom_domains_operations_delete("name")
|
||||
/// .doit().await;
|
||||
/// # }
|
||||
/// ```
|
||||
pub struct ProjectSiteCustomDomainOperationDeleteCall<'a, S>
|
||||
where S: 'a {
|
||||
|
||||
hub: &'a FirebaseHosting<S>,
|
||||
_name: String,
|
||||
_delegate: Option<&'a mut dyn client::Delegate>,
|
||||
_additional_params: HashMap<String, String>,
|
||||
_scopes: BTreeSet<String>
|
||||
}
|
||||
|
||||
impl<'a, S> client::CallBuilder for ProjectSiteCustomDomainOperationDeleteCall<'a, S> {}
|
||||
|
||||
impl<'a, S> ProjectSiteCustomDomainOperationDeleteCall<'a, S>
|
||||
where
|
||||
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
|
||||
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
|
||||
S::Future: Send + Unpin + 'static,
|
||||
S::Error: Into<Box<dyn StdError + Send + Sync>>,
|
||||
{
|
||||
|
||||
|
||||
/// Perform the operation you have build so far.
|
||||
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
|
||||
use std::io::{Read, Seek};
|
||||
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
||||
use client::{ToParts, url::Params};
|
||||
use std::borrow::Cow;
|
||||
|
||||
let mut dd = client::DefaultDelegate;
|
||||
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
|
||||
dlg.begin(client::MethodInfo { id: "firebasehosting.projects.sites.customDomains.operations.delete",
|
||||
http_method: hyper::Method::DELETE });
|
||||
|
||||
for &field in ["alt", "name"].iter() {
|
||||
if self._additional_params.contains_key(field) {
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::FieldClash(field));
|
||||
}
|
||||
}
|
||||
|
||||
let mut params = Params::with_capacity(3 + self._additional_params.len());
|
||||
params.push("name", self._name);
|
||||
|
||||
params.extend(self._additional_params.iter());
|
||||
|
||||
params.push("alt", "json");
|
||||
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
||||
if self._scopes.is_empty() {
|
||||
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string());
|
||||
}
|
||||
|
||||
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
||||
url = params.uri_replacement(url, param_name, find_this, true);
|
||||
}
|
||||
{
|
||||
let to_remove = ["name"];
|
||||
params.remove_params(&to_remove);
|
||||
}
|
||||
|
||||
let url = params.parse_with_url(&url);
|
||||
|
||||
|
||||
|
||||
loop {
|
||||
let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..]).await {
|
||||
Ok(token) => token,
|
||||
Err(e) => {
|
||||
match dlg.token(e) {
|
||||
Ok(token) => token,
|
||||
Err(e) => {
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::MissingToken(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let mut req_result = {
|
||||
let client = &self.hub.client;
|
||||
dlg.pre_request();
|
||||
let mut req_builder = hyper::Request::builder()
|
||||
.method(hyper::Method::DELETE)
|
||||
.uri(url.as_str())
|
||||
.header(USER_AGENT, self.hub._user_agent.clone());
|
||||
|
||||
if let Some(token) = token.as_ref() {
|
||||
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
|
||||
}
|
||||
|
||||
|
||||
let request = req_builder
|
||||
.body(hyper::body::Body::empty());
|
||||
|
||||
client.request(request.unwrap()).await
|
||||
|
||||
};
|
||||
|
||||
match req_result {
|
||||
Err(err) => {
|
||||
if let client::Retry::After(d) = dlg.http_error(&err) {
|
||||
sleep(d).await;
|
||||
continue;
|
||||
}
|
||||
dlg.finished(false);
|
||||
return Err(client::Error::HttpError(err))
|
||||
}
|
||||
Ok(mut res) => {
|
||||
if !res.status().is_success() {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
let (parts, _) = res.into_parts();
|
||||
let body = hyper::Body::from(res_body_string.clone());
|
||||
let restored_response = hyper::Response::from_parts(parts, body);
|
||||
|
||||
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
|
||||
|
||||
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
|
||||
sleep(d).await;
|
||||
continue;
|
||||
}
|
||||
|
||||
dlg.finished(false);
|
||||
|
||||
return match server_response {
|
||||
Some(error_value) => Err(client::Error::BadRequest(error_value)),
|
||||
None => Err(client::Error::Failure(restored_response)),
|
||||
}
|
||||
}
|
||||
let result_value = {
|
||||
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
||||
|
||||
match json::from_str(&res_body_string) {
|
||||
Ok(decoded) => (res, decoded),
|
||||
Err(err) => {
|
||||
dlg.response_json_decode_error(&res_body_string, &err);
|
||||
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dlg.finished(true);
|
||||
return Ok(result_value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The name of the operation resource to be deleted.
|
||||
///
|
||||
/// Sets the *name* path property to the given value.
|
||||
///
|
||||
/// Even though the property as already been set when instantiating this call,
|
||||
/// we provide this method for API completeness.
|
||||
pub fn name(mut self, new_value: &str) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S> {
|
||||
self._name = new_value.to_string();
|
||||
self
|
||||
}
|
||||
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
|
||||
/// while executing the actual API request.
|
||||
///
|
||||
/// ````text
|
||||
/// It should be used to handle progress information, and to implement a certain level of resilience.
|
||||
/// ````
|
||||
///
|
||||
/// Sets the *delegate* property to the given value.
|
||||
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S> {
|
||||
self._delegate = Some(new_value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set any additional parameter of the query string used in the request.
|
||||
/// It should be used to set parameters which are not yet available through their own
|
||||
/// setters.
|
||||
///
|
||||
/// Please note that this method must not be used to set any of the known parameters
|
||||
/// which have their own setter method. If done anyway, the request will fail.
|
||||
///
|
||||
/// # Additional Parameters
|
||||
///
|
||||
/// * *$.xgafv* (query-string) - V1 error format.
|
||||
/// * *access_token* (query-string) - OAuth access token.
|
||||
/// * *alt* (query-string) - Data format for response.
|
||||
/// * *callback* (query-string) - JSONP
|
||||
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
||||
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
|
||||
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
|
||||
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
|
||||
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
|
||||
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
|
||||
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
|
||||
pub fn param<T>(mut self, name: T, value: T) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S>
|
||||
where T: AsRef<str> {
|
||||
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
||||
self
|
||||
}
|
||||
|
||||
/// Identifies the authorization scope for the method you are building.
|
||||
///
|
||||
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
|
||||
/// [`Scope::CloudPlatform`].
|
||||
///
|
||||
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
|
||||
/// tokens for more than one scope.
|
||||
///
|
||||
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
||||
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
||||
/// sufficient, a read-write scope will do as well.
|
||||
pub fn add_scope<St>(mut self, scope: St) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S>
|
||||
where St: AsRef<str> {
|
||||
self._scopes.insert(String::from(scope.as_ref()));
|
||||
self
|
||||
}
|
||||
/// Identifies the authorization scope(s) for the method you are building.
|
||||
///
|
||||
/// See [`Self::add_scope()`] for details.
|
||||
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S>
|
||||
where I: IntoIterator<Item = St>,
|
||||
St: AsRef<str> {
|
||||
self._scopes
|
||||
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
|
||||
self
|
||||
}
|
||||
|
||||
/// Removes all scopes, and no default scope will be used either.
|
||||
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
|
||||
/// for details).
|
||||
pub fn clear_scopes(mut self) -> ProjectSiteCustomDomainOperationDeleteCall<'a, S> {
|
||||
self._scopes.clear();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
|
||||
// DO NOT EDIT !
|
||||
|
||||
//! This documentation was generated from *Firebase Hosting* crate version *5.0.3+20230123*, where *20230123* is the exact revision of the *firebasehosting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.3*.
|
||||
//! This documentation was generated from *Firebase Hosting* crate version *5.0.3+20240303*, where *20240303* is the exact revision of the *firebasehosting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.3*.
|
||||
//!
|
||||
//! Everything else about the *Firebase Hosting* *v1* API can be found at the
|
||||
//! [official documentation site](https://firebase.google.com/docs/hosting/).
|
||||
@@ -13,6 +13,8 @@
|
||||
//!
|
||||
//! * [operations](api::Operation)
|
||||
//! * [*cancel*](api::OperationCancelCall), [*delete*](api::OperationDeleteCall) and [*list*](api::OperationListCall)
|
||||
//! * projects
|
||||
//! * [*sites custom domains operations cancel*](api::ProjectSiteCustomDomainOperationCancelCall) and [*sites custom domains operations delete*](api::ProjectSiteCustomDomainOperationDeleteCall)
|
||||
//!
|
||||
//!
|
||||
//!
|
||||
@@ -49,7 +51,8 @@
|
||||
//! ```ignore
|
||||
//! let r = hub.operations().cancel(...).doit().await
|
||||
//! let r = hub.operations().delete(...).doit().await
|
||||
//! let r = hub.operations().list(...).doit().await
|
||||
//! let r = hub.projects().sites_custom_domains_operations_cancel(...).doit().await
|
||||
//! let r = hub.projects().sites_custom_domains_operations_delete(...).doit().await
|
||||
//! ```
|
||||
//!
|
||||
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
||||
@@ -76,6 +79,7 @@
|
||||
//! extern crate hyper;
|
||||
//! extern crate hyper_rustls;
|
||||
//! extern crate google_firebasehosting1 as firebasehosting1;
|
||||
//! use firebasehosting1::api::CancelOperationRequest;
|
||||
//! use firebasehosting1::{Result, Error};
|
||||
//! # async fn dox() {
|
||||
//! use std::default::Default;
|
||||
@@ -94,13 +98,15 @@
|
||||
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
||||
//! ).build().await.unwrap();
|
||||
//! let mut hub = FirebaseHosting::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 = CancelOperationRequest::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.operations().list("name")
|
||||
//! .page_token("At")
|
||||
//! .page_size(-8)
|
||||
//! .filter("sed")
|
||||
//! let result = hub.operations().cancel(req, "name")
|
||||
//! .doit().await;
|
||||
//!
|
||||
//! match result {
|
||||
|
||||
Reference in New Issue
Block a user