google_runtimeconfig1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18
19 /// Manage your Google Cloud Platform services' runtime configuration
20 Cloudruntimeconfig,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27 Scope::Cloudruntimeconfig => "https://www.googleapis.com/auth/cloudruntimeconfig",
28 }
29 }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34 fn default() -> Scope {
35 Scope::CloudPlatform
36 }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all CloudRuntimeConfig related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_runtimeconfig1 as runtimeconfig1;
53/// use runtimeconfig1::{Result, Error};
54/// # async fn dox() {
55/// use runtimeconfig1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56///
57/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
58/// // `client_secret`, among other things.
59/// let secret: yup_oauth2::ApplicationSecret = Default::default();
60/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
61/// // unless you replace `None` with the desired Flow.
62/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
63/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
64/// // retrieve them from storage.
65/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
66/// secret,
67/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
68/// ).build().await.unwrap();
69///
70/// let client = hyper_util::client::legacy::Client::builder(
71/// hyper_util::rt::TokioExecutor::new()
72/// )
73/// .build(
74/// hyper_rustls::HttpsConnectorBuilder::new()
75/// .with_native_roots()
76/// .unwrap()
77/// .https_or_http()
78/// .enable_http1()
79/// .build()
80/// );
81/// let mut hub = CloudRuntimeConfig::new(client, auth);
82/// // You can configure optional parameters by calling the respective setters at will, and
83/// // execute the final call using `doit()`.
84/// // Values shown here are possibly random and not representative !
85/// let result = hub.operations().list("name")
86/// .page_token("takimata")
87/// .page_size(-52)
88/// .filter("duo")
89/// .doit().await;
90///
91/// match result {
92/// Err(e) => match e {
93/// // The Error enum provides details about what exactly happened.
94/// // You can also just use its `Debug`, `Display` or `Error` traits
95/// Error::HttpError(_)
96/// |Error::Io(_)
97/// |Error::MissingAPIKey
98/// |Error::MissingToken(_)
99/// |Error::Cancelled
100/// |Error::UploadSizeLimitExceeded(_, _)
101/// |Error::Failure(_)
102/// |Error::BadRequest(_)
103/// |Error::FieldClash(_)
104/// |Error::JsonDecodeError(_, _) => println!("{}", e),
105/// },
106/// Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct CloudRuntimeConfig<C> {
112 pub client: common::Client<C>,
113 pub auth: Box<dyn common::GetToken>,
114 _user_agent: String,
115 _base_url: String,
116 _root_url: String,
117}
118
119impl<C> common::Hub for CloudRuntimeConfig<C> {}
120
121impl<'a, C> CloudRuntimeConfig<C> {
122 pub fn new<A: 'static + common::GetToken>(
123 client: common::Client<C>,
124 auth: A,
125 ) -> CloudRuntimeConfig<C> {
126 CloudRuntimeConfig {
127 client,
128 auth: Box::new(auth),
129 _user_agent: "google-api-rust-client/6.0.0".to_string(),
130 _base_url: "https://runtimeconfig.googleapis.com/".to_string(),
131 _root_url: "https://runtimeconfig.googleapis.com/".to_string(),
132 }
133 }
134
135 pub fn operations(&'a self) -> OperationMethods<'a, C> {
136 OperationMethods { hub: self }
137 }
138
139 /// Set the user-agent header field to use in all requests to the server.
140 /// It defaults to `google-api-rust-client/6.0.0`.
141 ///
142 /// Returns the previously set user-agent.
143 pub fn user_agent(&mut self, agent_name: String) -> String {
144 std::mem::replace(&mut self._user_agent, agent_name)
145 }
146
147 /// Set the base url to use in all requests to the server.
148 /// It defaults to `https://runtimeconfig.googleapis.com/`.
149 ///
150 /// Returns the previously set base url.
151 pub fn base_url(&mut self, new_base_url: String) -> String {
152 std::mem::replace(&mut self._base_url, new_base_url)
153 }
154
155 /// Set the root url to use in all requests to the server.
156 /// It defaults to `https://runtimeconfig.googleapis.com/`.
157 ///
158 /// Returns the previously set root url.
159 pub fn root_url(&mut self, new_root_url: String) -> String {
160 std::mem::replace(&mut self._root_url, new_root_url)
161 }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// The request message for Operations.CancelOperation.
168///
169/// # Activities
170///
171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
173///
174/// * [cancel operations](OperationCancelCall) (request)
175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
176#[serde_with::serde_as]
177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
178pub struct CancelOperationRequest {
179 _never_set: Option<bool>,
180}
181
182impl common::RequestValue for CancelOperationRequest {}
183
184/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
185///
186/// # Activities
187///
188/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
189/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
190///
191/// * [cancel operations](OperationCancelCall) (response)
192/// * [delete operations](OperationDeleteCall) (response)
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct Empty {
197 _never_set: Option<bool>,
198}
199
200impl common::ResponseResult for Empty {}
201
202/// The response message for Operations.ListOperations.
203///
204/// # Activities
205///
206/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
207/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
208///
209/// * [list operations](OperationListCall) (response)
210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
211#[serde_with::serde_as]
212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
213pub struct ListOperationsResponse {
214 /// The standard List next-page token.
215 #[serde(rename = "nextPageToken")]
216 pub next_page_token: Option<String>,
217 /// A list of operations that matches the specified filter in the request.
218 pub operations: Option<Vec<Operation>>,
219}
220
221impl common::ResponseResult for ListOperationsResponse {}
222
223/// This resource represents a long-running operation that is the result of a network API call.
224///
225/// # Activities
226///
227/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
228/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
229///
230/// * [cancel operations](OperationCancelCall) (none)
231/// * [delete operations](OperationDeleteCall) (none)
232/// * [list operations](OperationListCall) (none)
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct Operation {
237 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
238 pub done: Option<bool>,
239 /// The error result of the operation in case of failure or cancellation.
240 pub error: Option<Status>,
241 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
242 pub metadata: Option<HashMap<String, serde_json::Value>>,
243 /// 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}`.
244 pub name: Option<String>,
245 /// 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`.
246 pub response: Option<HashMap<String, serde_json::Value>>,
247}
248
249impl common::Resource for Operation {}
250
251/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
252///
253/// This type is not used in any activity, and only used as *part* of another schema.
254///
255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
256#[serde_with::serde_as]
257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
258pub struct Status {
259 /// The status code, which should be an enum value of google.rpc.Code.
260 pub code: Option<i32>,
261 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
262 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
263 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
264 pub message: Option<String>,
265}
266
267impl common::Part for Status {}
268
269// ###################
270// MethodBuilders ###
271// #################
272
273/// A builder providing access to all methods supported on *operation* resources.
274/// It is not used directly, but through the [`CloudRuntimeConfig`] hub.
275///
276/// # Example
277///
278/// Instantiate a resource builder
279///
280/// ```test_harness,no_run
281/// extern crate hyper;
282/// extern crate hyper_rustls;
283/// extern crate google_runtimeconfig1 as runtimeconfig1;
284///
285/// # async fn dox() {
286/// use runtimeconfig1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
287///
288/// let secret: yup_oauth2::ApplicationSecret = Default::default();
289/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
290/// secret,
291/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
292/// ).build().await.unwrap();
293///
294/// let client = hyper_util::client::legacy::Client::builder(
295/// hyper_util::rt::TokioExecutor::new()
296/// )
297/// .build(
298/// hyper_rustls::HttpsConnectorBuilder::new()
299/// .with_native_roots()
300/// .unwrap()
301/// .https_or_http()
302/// .enable_http1()
303/// .build()
304/// );
305/// let mut hub = CloudRuntimeConfig::new(client, auth);
306/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
307/// // like `cancel(...)`, `delete(...)` and `list(...)`
308/// // to build up your call.
309/// let rb = hub.operations();
310/// # }
311/// ```
312pub struct OperationMethods<'a, C>
313where
314 C: 'a,
315{
316 hub: &'a CloudRuntimeConfig<C>,
317}
318
319impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
320
321impl<'a, C> OperationMethods<'a, C> {
322 /// Create a builder to help you perform the following task:
323 ///
324 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
325 ///
326 /// # Arguments
327 ///
328 /// * `request` - No description provided.
329 /// * `name` - The name of the operation resource to be cancelled.
330 pub fn cancel(
331 &self,
332 request: CancelOperationRequest,
333 name: &str,
334 ) -> OperationCancelCall<'a, C> {
335 OperationCancelCall {
336 hub: self.hub,
337 _request: request,
338 _name: name.to_string(),
339 _delegate: Default::default(),
340 _additional_params: Default::default(),
341 _scopes: Default::default(),
342 }
343 }
344
345 /// Create a builder to help you perform the following task:
346 ///
347 /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
348 ///
349 /// # Arguments
350 ///
351 /// * `name` - The name of the operation resource to be deleted.
352 pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, C> {
353 OperationDeleteCall {
354 hub: self.hub,
355 _name: name.to_string(),
356 _delegate: Default::default(),
357 _additional_params: Default::default(),
358 _scopes: Default::default(),
359 }
360 }
361
362 /// Create a builder to help you perform the following task:
363 ///
364 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
365 ///
366 /// # Arguments
367 ///
368 /// * `name` - The name of the operation's parent resource.
369 pub fn list(&self, name: &str) -> OperationListCall<'a, C> {
370 OperationListCall {
371 hub: self.hub,
372 _name: name.to_string(),
373 _page_token: Default::default(),
374 _page_size: Default::default(),
375 _filter: Default::default(),
376 _delegate: Default::default(),
377 _additional_params: Default::default(),
378 _scopes: Default::default(),
379 }
380 }
381}
382
383// ###################
384// CallBuilders ###
385// #################
386
387/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
388///
389/// A builder for the *cancel* method supported by a *operation* resource.
390/// It is not used directly, but through a [`OperationMethods`] instance.
391///
392/// # Example
393///
394/// Instantiate a resource method builder
395///
396/// ```test_harness,no_run
397/// # extern crate hyper;
398/// # extern crate hyper_rustls;
399/// # extern crate google_runtimeconfig1 as runtimeconfig1;
400/// use runtimeconfig1::api::CancelOperationRequest;
401/// # async fn dox() {
402/// # use runtimeconfig1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
403///
404/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
405/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
406/// # secret,
407/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
408/// # ).build().await.unwrap();
409///
410/// # let client = hyper_util::client::legacy::Client::builder(
411/// # hyper_util::rt::TokioExecutor::new()
412/// # )
413/// # .build(
414/// # hyper_rustls::HttpsConnectorBuilder::new()
415/// # .with_native_roots()
416/// # .unwrap()
417/// # .https_or_http()
418/// # .enable_http1()
419/// # .build()
420/// # );
421/// # let mut hub = CloudRuntimeConfig::new(client, auth);
422/// // As the method needs a request, you would usually fill it with the desired information
423/// // into the respective structure. Some of the parts shown here might not be applicable !
424/// // Values shown here are possibly random and not representative !
425/// let mut req = CancelOperationRequest::default();
426///
427/// // You can configure optional parameters by calling the respective setters at will, and
428/// // execute the final call using `doit()`.
429/// // Values shown here are possibly random and not representative !
430/// let result = hub.operations().cancel(req, "name")
431/// .doit().await;
432/// # }
433/// ```
434pub struct OperationCancelCall<'a, C>
435where
436 C: 'a,
437{
438 hub: &'a CloudRuntimeConfig<C>,
439 _request: CancelOperationRequest,
440 _name: String,
441 _delegate: Option<&'a mut dyn common::Delegate>,
442 _additional_params: HashMap<String, String>,
443 _scopes: BTreeSet<String>,
444}
445
446impl<'a, C> common::CallBuilder for OperationCancelCall<'a, C> {}
447
448impl<'a, C> OperationCancelCall<'a, C>
449where
450 C: common::Connector,
451{
452 /// Perform the operation you have build so far.
453 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
454 use std::borrow::Cow;
455 use std::io::{Read, Seek};
456
457 use common::{url::Params, ToParts};
458 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
459
460 let mut dd = common::DefaultDelegate;
461 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
462 dlg.begin(common::MethodInfo {
463 id: "runtimeconfig.operations.cancel",
464 http_method: hyper::Method::POST,
465 });
466
467 for &field in ["alt", "name"].iter() {
468 if self._additional_params.contains_key(field) {
469 dlg.finished(false);
470 return Err(common::Error::FieldClash(field));
471 }
472 }
473
474 let mut params = Params::with_capacity(4 + self._additional_params.len());
475 params.push("name", self._name);
476
477 params.extend(self._additional_params.iter());
478
479 params.push("alt", "json");
480 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
481 if self._scopes.is_empty() {
482 self._scopes
483 .insert(Scope::CloudPlatform.as_ref().to_string());
484 }
485
486 #[allow(clippy::single_element_loop)]
487 for &(find_this, param_name) in [("{+name}", "name")].iter() {
488 url = params.uri_replacement(url, param_name, find_this, true);
489 }
490 {
491 let to_remove = ["name"];
492 params.remove_params(&to_remove);
493 }
494
495 let url = params.parse_with_url(&url);
496
497 let mut json_mime_type = mime::APPLICATION_JSON;
498 let mut request_value_reader = {
499 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
500 common::remove_json_null_values(&mut value);
501 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
502 serde_json::to_writer(&mut dst, &value).unwrap();
503 dst
504 };
505 let request_size = request_value_reader
506 .seek(std::io::SeekFrom::End(0))
507 .unwrap();
508 request_value_reader
509 .seek(std::io::SeekFrom::Start(0))
510 .unwrap();
511
512 loop {
513 let token = match self
514 .hub
515 .auth
516 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
517 .await
518 {
519 Ok(token) => token,
520 Err(e) => match dlg.token(e) {
521 Ok(token) => token,
522 Err(e) => {
523 dlg.finished(false);
524 return Err(common::Error::MissingToken(e));
525 }
526 },
527 };
528 request_value_reader
529 .seek(std::io::SeekFrom::Start(0))
530 .unwrap();
531 let mut req_result = {
532 let client = &self.hub.client;
533 dlg.pre_request();
534 let mut req_builder = hyper::Request::builder()
535 .method(hyper::Method::POST)
536 .uri(url.as_str())
537 .header(USER_AGENT, self.hub._user_agent.clone());
538
539 if let Some(token) = token.as_ref() {
540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
541 }
542
543 let request = req_builder
544 .header(CONTENT_TYPE, json_mime_type.to_string())
545 .header(CONTENT_LENGTH, request_size as u64)
546 .body(common::to_body(
547 request_value_reader.get_ref().clone().into(),
548 ));
549
550 client.request(request.unwrap()).await
551 };
552
553 match req_result {
554 Err(err) => {
555 if let common::Retry::After(d) = dlg.http_error(&err) {
556 sleep(d).await;
557 continue;
558 }
559 dlg.finished(false);
560 return Err(common::Error::HttpError(err));
561 }
562 Ok(res) => {
563 let (mut parts, body) = res.into_parts();
564 let mut body = common::Body::new(body);
565 if !parts.status.is_success() {
566 let bytes = common::to_bytes(body).await.unwrap_or_default();
567 let error = serde_json::from_str(&common::to_string(&bytes));
568 let response = common::to_response(parts, bytes.into());
569
570 if let common::Retry::After(d) =
571 dlg.http_failure(&response, error.as_ref().ok())
572 {
573 sleep(d).await;
574 continue;
575 }
576
577 dlg.finished(false);
578
579 return Err(match error {
580 Ok(value) => common::Error::BadRequest(value),
581 _ => common::Error::Failure(response),
582 });
583 }
584 let response = {
585 let bytes = common::to_bytes(body).await.unwrap_or_default();
586 let encoded = common::to_string(&bytes);
587 match serde_json::from_str(&encoded) {
588 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
589 Err(error) => {
590 dlg.response_json_decode_error(&encoded, &error);
591 return Err(common::Error::JsonDecodeError(
592 encoded.to_string(),
593 error,
594 ));
595 }
596 }
597 };
598
599 dlg.finished(true);
600 return Ok(response);
601 }
602 }
603 }
604 }
605
606 ///
607 /// Sets the *request* property to the given value.
608 ///
609 /// Even though the property as already been set when instantiating this call,
610 /// we provide this method for API completeness.
611 pub fn request(mut self, new_value: CancelOperationRequest) -> OperationCancelCall<'a, C> {
612 self._request = new_value;
613 self
614 }
615 /// The name of the operation resource to be cancelled.
616 ///
617 /// Sets the *name* path property to the given value.
618 ///
619 /// Even though the property as already been set when instantiating this call,
620 /// we provide this method for API completeness.
621 pub fn name(mut self, new_value: &str) -> OperationCancelCall<'a, C> {
622 self._name = new_value.to_string();
623 self
624 }
625 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
626 /// while executing the actual API request.
627 ///
628 /// ````text
629 /// It should be used to handle progress information, and to implement a certain level of resilience.
630 /// ````
631 ///
632 /// Sets the *delegate* property to the given value.
633 pub fn delegate(
634 mut self,
635 new_value: &'a mut dyn common::Delegate,
636 ) -> OperationCancelCall<'a, C> {
637 self._delegate = Some(new_value);
638 self
639 }
640
641 /// Set any additional parameter of the query string used in the request.
642 /// It should be used to set parameters which are not yet available through their own
643 /// setters.
644 ///
645 /// Please note that this method must not be used to set any of the known parameters
646 /// which have their own setter method. If done anyway, the request will fail.
647 ///
648 /// # Additional Parameters
649 ///
650 /// * *$.xgafv* (query-string) - V1 error format.
651 /// * *access_token* (query-string) - OAuth access token.
652 /// * *alt* (query-string) - Data format for response.
653 /// * *callback* (query-string) - JSONP
654 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
655 /// * *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.
656 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
657 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
658 /// * *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.
659 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
660 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
661 pub fn param<T>(mut self, name: T, value: T) -> OperationCancelCall<'a, C>
662 where
663 T: AsRef<str>,
664 {
665 self._additional_params
666 .insert(name.as_ref().to_string(), value.as_ref().to_string());
667 self
668 }
669
670 /// Identifies the authorization scope for the method you are building.
671 ///
672 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
673 /// [`Scope::CloudPlatform`].
674 ///
675 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
676 /// tokens for more than one scope.
677 ///
678 /// Usually there is more than one suitable scope to authorize an operation, some of which may
679 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
680 /// sufficient, a read-write scope will do as well.
681 pub fn add_scope<St>(mut self, scope: St) -> OperationCancelCall<'a, C>
682 where
683 St: AsRef<str>,
684 {
685 self._scopes.insert(String::from(scope.as_ref()));
686 self
687 }
688 /// Identifies the authorization scope(s) for the method you are building.
689 ///
690 /// See [`Self::add_scope()`] for details.
691 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationCancelCall<'a, C>
692 where
693 I: IntoIterator<Item = St>,
694 St: AsRef<str>,
695 {
696 self._scopes
697 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
698 self
699 }
700
701 /// Removes all scopes, and no default scope will be used either.
702 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
703 /// for details).
704 pub fn clear_scopes(mut self) -> OperationCancelCall<'a, C> {
705 self._scopes.clear();
706 self
707 }
708}
709
710/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
711///
712/// A builder for the *delete* method supported by a *operation* resource.
713/// It is not used directly, but through a [`OperationMethods`] instance.
714///
715/// # Example
716///
717/// Instantiate a resource method builder
718///
719/// ```test_harness,no_run
720/// # extern crate hyper;
721/// # extern crate hyper_rustls;
722/// # extern crate google_runtimeconfig1 as runtimeconfig1;
723/// # async fn dox() {
724/// # use runtimeconfig1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
725///
726/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
728/// # secret,
729/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
730/// # ).build().await.unwrap();
731///
732/// # let client = hyper_util::client::legacy::Client::builder(
733/// # hyper_util::rt::TokioExecutor::new()
734/// # )
735/// # .build(
736/// # hyper_rustls::HttpsConnectorBuilder::new()
737/// # .with_native_roots()
738/// # .unwrap()
739/// # .https_or_http()
740/// # .enable_http1()
741/// # .build()
742/// # );
743/// # let mut hub = CloudRuntimeConfig::new(client, auth);
744/// // You can configure optional parameters by calling the respective setters at will, and
745/// // execute the final call using `doit()`.
746/// // Values shown here are possibly random and not representative !
747/// let result = hub.operations().delete("name")
748/// .doit().await;
749/// # }
750/// ```
751pub struct OperationDeleteCall<'a, C>
752where
753 C: 'a,
754{
755 hub: &'a CloudRuntimeConfig<C>,
756 _name: String,
757 _delegate: Option<&'a mut dyn common::Delegate>,
758 _additional_params: HashMap<String, String>,
759 _scopes: BTreeSet<String>,
760}
761
762impl<'a, C> common::CallBuilder for OperationDeleteCall<'a, C> {}
763
764impl<'a, C> OperationDeleteCall<'a, C>
765where
766 C: common::Connector,
767{
768 /// Perform the operation you have build so far.
769 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
770 use std::borrow::Cow;
771 use std::io::{Read, Seek};
772
773 use common::{url::Params, ToParts};
774 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
775
776 let mut dd = common::DefaultDelegate;
777 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
778 dlg.begin(common::MethodInfo {
779 id: "runtimeconfig.operations.delete",
780 http_method: hyper::Method::DELETE,
781 });
782
783 for &field in ["alt", "name"].iter() {
784 if self._additional_params.contains_key(field) {
785 dlg.finished(false);
786 return Err(common::Error::FieldClash(field));
787 }
788 }
789
790 let mut params = Params::with_capacity(3 + self._additional_params.len());
791 params.push("name", self._name);
792
793 params.extend(self._additional_params.iter());
794
795 params.push("alt", "json");
796 let mut url = self.hub._base_url.clone() + "v1/{+name}";
797 if self._scopes.is_empty() {
798 self._scopes
799 .insert(Scope::CloudPlatform.as_ref().to_string());
800 }
801
802 #[allow(clippy::single_element_loop)]
803 for &(find_this, param_name) in [("{+name}", "name")].iter() {
804 url = params.uri_replacement(url, param_name, find_this, true);
805 }
806 {
807 let to_remove = ["name"];
808 params.remove_params(&to_remove);
809 }
810
811 let url = params.parse_with_url(&url);
812
813 loop {
814 let token = match self
815 .hub
816 .auth
817 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
818 .await
819 {
820 Ok(token) => token,
821 Err(e) => match dlg.token(e) {
822 Ok(token) => token,
823 Err(e) => {
824 dlg.finished(false);
825 return Err(common::Error::MissingToken(e));
826 }
827 },
828 };
829 let mut req_result = {
830 let client = &self.hub.client;
831 dlg.pre_request();
832 let mut req_builder = hyper::Request::builder()
833 .method(hyper::Method::DELETE)
834 .uri(url.as_str())
835 .header(USER_AGENT, self.hub._user_agent.clone());
836
837 if let Some(token) = token.as_ref() {
838 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
839 }
840
841 let request = req_builder
842 .header(CONTENT_LENGTH, 0_u64)
843 .body(common::to_body::<String>(None));
844
845 client.request(request.unwrap()).await
846 };
847
848 match req_result {
849 Err(err) => {
850 if let common::Retry::After(d) = dlg.http_error(&err) {
851 sleep(d).await;
852 continue;
853 }
854 dlg.finished(false);
855 return Err(common::Error::HttpError(err));
856 }
857 Ok(res) => {
858 let (mut parts, body) = res.into_parts();
859 let mut body = common::Body::new(body);
860 if !parts.status.is_success() {
861 let bytes = common::to_bytes(body).await.unwrap_or_default();
862 let error = serde_json::from_str(&common::to_string(&bytes));
863 let response = common::to_response(parts, bytes.into());
864
865 if let common::Retry::After(d) =
866 dlg.http_failure(&response, error.as_ref().ok())
867 {
868 sleep(d).await;
869 continue;
870 }
871
872 dlg.finished(false);
873
874 return Err(match error {
875 Ok(value) => common::Error::BadRequest(value),
876 _ => common::Error::Failure(response),
877 });
878 }
879 let response = {
880 let bytes = common::to_bytes(body).await.unwrap_or_default();
881 let encoded = common::to_string(&bytes);
882 match serde_json::from_str(&encoded) {
883 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
884 Err(error) => {
885 dlg.response_json_decode_error(&encoded, &error);
886 return Err(common::Error::JsonDecodeError(
887 encoded.to_string(),
888 error,
889 ));
890 }
891 }
892 };
893
894 dlg.finished(true);
895 return Ok(response);
896 }
897 }
898 }
899 }
900
901 /// The name of the operation resource to be deleted.
902 ///
903 /// Sets the *name* path property to the given value.
904 ///
905 /// Even though the property as already been set when instantiating this call,
906 /// we provide this method for API completeness.
907 pub fn name(mut self, new_value: &str) -> OperationDeleteCall<'a, C> {
908 self._name = new_value.to_string();
909 self
910 }
911 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
912 /// while executing the actual API request.
913 ///
914 /// ````text
915 /// It should be used to handle progress information, and to implement a certain level of resilience.
916 /// ````
917 ///
918 /// Sets the *delegate* property to the given value.
919 pub fn delegate(
920 mut self,
921 new_value: &'a mut dyn common::Delegate,
922 ) -> OperationDeleteCall<'a, C> {
923 self._delegate = Some(new_value);
924 self
925 }
926
927 /// Set any additional parameter of the query string used in the request.
928 /// It should be used to set parameters which are not yet available through their own
929 /// setters.
930 ///
931 /// Please note that this method must not be used to set any of the known parameters
932 /// which have their own setter method. If done anyway, the request will fail.
933 ///
934 /// # Additional Parameters
935 ///
936 /// * *$.xgafv* (query-string) - V1 error format.
937 /// * *access_token* (query-string) - OAuth access token.
938 /// * *alt* (query-string) - Data format for response.
939 /// * *callback* (query-string) - JSONP
940 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
941 /// * *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.
942 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
943 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
944 /// * *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.
945 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
946 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
947 pub fn param<T>(mut self, name: T, value: T) -> OperationDeleteCall<'a, C>
948 where
949 T: AsRef<str>,
950 {
951 self._additional_params
952 .insert(name.as_ref().to_string(), value.as_ref().to_string());
953 self
954 }
955
956 /// Identifies the authorization scope for the method you are building.
957 ///
958 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
959 /// [`Scope::CloudPlatform`].
960 ///
961 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
962 /// tokens for more than one scope.
963 ///
964 /// Usually there is more than one suitable scope to authorize an operation, some of which may
965 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
966 /// sufficient, a read-write scope will do as well.
967 pub fn add_scope<St>(mut self, scope: St) -> OperationDeleteCall<'a, C>
968 where
969 St: AsRef<str>,
970 {
971 self._scopes.insert(String::from(scope.as_ref()));
972 self
973 }
974 /// Identifies the authorization scope(s) for the method you are building.
975 ///
976 /// See [`Self::add_scope()`] for details.
977 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationDeleteCall<'a, C>
978 where
979 I: IntoIterator<Item = St>,
980 St: AsRef<str>,
981 {
982 self._scopes
983 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
984 self
985 }
986
987 /// Removes all scopes, and no default scope will be used either.
988 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
989 /// for details).
990 pub fn clear_scopes(mut self) -> OperationDeleteCall<'a, C> {
991 self._scopes.clear();
992 self
993 }
994}
995
996/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
997///
998/// A builder for the *list* method supported by a *operation* resource.
999/// It is not used directly, but through a [`OperationMethods`] instance.
1000///
1001/// # Example
1002///
1003/// Instantiate a resource method builder
1004///
1005/// ```test_harness,no_run
1006/// # extern crate hyper;
1007/// # extern crate hyper_rustls;
1008/// # extern crate google_runtimeconfig1 as runtimeconfig1;
1009/// # async fn dox() {
1010/// # use runtimeconfig1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1011///
1012/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1013/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1014/// # secret,
1015/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1016/// # ).build().await.unwrap();
1017///
1018/// # let client = hyper_util::client::legacy::Client::builder(
1019/// # hyper_util::rt::TokioExecutor::new()
1020/// # )
1021/// # .build(
1022/// # hyper_rustls::HttpsConnectorBuilder::new()
1023/// # .with_native_roots()
1024/// # .unwrap()
1025/// # .https_or_http()
1026/// # .enable_http1()
1027/// # .build()
1028/// # );
1029/// # let mut hub = CloudRuntimeConfig::new(client, auth);
1030/// // You can configure optional parameters by calling the respective setters at will, and
1031/// // execute the final call using `doit()`.
1032/// // Values shown here are possibly random and not representative !
1033/// let result = hub.operations().list("name")
1034/// .page_token("gubergren")
1035/// .page_size(-75)
1036/// .filter("dolor")
1037/// .doit().await;
1038/// # }
1039/// ```
1040pub struct OperationListCall<'a, C>
1041where
1042 C: 'a,
1043{
1044 hub: &'a CloudRuntimeConfig<C>,
1045 _name: String,
1046 _page_token: Option<String>,
1047 _page_size: Option<i32>,
1048 _filter: Option<String>,
1049 _delegate: Option<&'a mut dyn common::Delegate>,
1050 _additional_params: HashMap<String, String>,
1051 _scopes: BTreeSet<String>,
1052}
1053
1054impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
1055
1056impl<'a, C> OperationListCall<'a, C>
1057where
1058 C: common::Connector,
1059{
1060 /// Perform the operation you have build so far.
1061 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
1062 use std::borrow::Cow;
1063 use std::io::{Read, Seek};
1064
1065 use common::{url::Params, ToParts};
1066 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1067
1068 let mut dd = common::DefaultDelegate;
1069 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1070 dlg.begin(common::MethodInfo {
1071 id: "runtimeconfig.operations.list",
1072 http_method: hyper::Method::GET,
1073 });
1074
1075 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
1076 if self._additional_params.contains_key(field) {
1077 dlg.finished(false);
1078 return Err(common::Error::FieldClash(field));
1079 }
1080 }
1081
1082 let mut params = Params::with_capacity(6 + self._additional_params.len());
1083 params.push("name", self._name);
1084 if let Some(value) = self._page_token.as_ref() {
1085 params.push("pageToken", value);
1086 }
1087 if let Some(value) = self._page_size.as_ref() {
1088 params.push("pageSize", value.to_string());
1089 }
1090 if let Some(value) = self._filter.as_ref() {
1091 params.push("filter", value);
1092 }
1093
1094 params.extend(self._additional_params.iter());
1095
1096 params.push("alt", "json");
1097 let mut url = self.hub._base_url.clone() + "v1/{+name}";
1098 if self._scopes.is_empty() {
1099 self._scopes
1100 .insert(Scope::CloudPlatform.as_ref().to_string());
1101 }
1102
1103 #[allow(clippy::single_element_loop)]
1104 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1105 url = params.uri_replacement(url, param_name, find_this, true);
1106 }
1107 {
1108 let to_remove = ["name"];
1109 params.remove_params(&to_remove);
1110 }
1111
1112 let url = params.parse_with_url(&url);
1113
1114 loop {
1115 let token = match self
1116 .hub
1117 .auth
1118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1119 .await
1120 {
1121 Ok(token) => token,
1122 Err(e) => match dlg.token(e) {
1123 Ok(token) => token,
1124 Err(e) => {
1125 dlg.finished(false);
1126 return Err(common::Error::MissingToken(e));
1127 }
1128 },
1129 };
1130 let mut req_result = {
1131 let client = &self.hub.client;
1132 dlg.pre_request();
1133 let mut req_builder = hyper::Request::builder()
1134 .method(hyper::Method::GET)
1135 .uri(url.as_str())
1136 .header(USER_AGENT, self.hub._user_agent.clone());
1137
1138 if let Some(token) = token.as_ref() {
1139 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1140 }
1141
1142 let request = req_builder
1143 .header(CONTENT_LENGTH, 0_u64)
1144 .body(common::to_body::<String>(None));
1145
1146 client.request(request.unwrap()).await
1147 };
1148
1149 match req_result {
1150 Err(err) => {
1151 if let common::Retry::After(d) = dlg.http_error(&err) {
1152 sleep(d).await;
1153 continue;
1154 }
1155 dlg.finished(false);
1156 return Err(common::Error::HttpError(err));
1157 }
1158 Ok(res) => {
1159 let (mut parts, body) = res.into_parts();
1160 let mut body = common::Body::new(body);
1161 if !parts.status.is_success() {
1162 let bytes = common::to_bytes(body).await.unwrap_or_default();
1163 let error = serde_json::from_str(&common::to_string(&bytes));
1164 let response = common::to_response(parts, bytes.into());
1165
1166 if let common::Retry::After(d) =
1167 dlg.http_failure(&response, error.as_ref().ok())
1168 {
1169 sleep(d).await;
1170 continue;
1171 }
1172
1173 dlg.finished(false);
1174
1175 return Err(match error {
1176 Ok(value) => common::Error::BadRequest(value),
1177 _ => common::Error::Failure(response),
1178 });
1179 }
1180 let response = {
1181 let bytes = common::to_bytes(body).await.unwrap_or_default();
1182 let encoded = common::to_string(&bytes);
1183 match serde_json::from_str(&encoded) {
1184 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1185 Err(error) => {
1186 dlg.response_json_decode_error(&encoded, &error);
1187 return Err(common::Error::JsonDecodeError(
1188 encoded.to_string(),
1189 error,
1190 ));
1191 }
1192 }
1193 };
1194
1195 dlg.finished(true);
1196 return Ok(response);
1197 }
1198 }
1199 }
1200 }
1201
1202 /// The name of the operation's parent resource.
1203 ///
1204 /// Sets the *name* path property to the given value.
1205 ///
1206 /// Even though the property as already been set when instantiating this call,
1207 /// we provide this method for API completeness.
1208 pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
1209 self._name = new_value.to_string();
1210 self
1211 }
1212 /// The standard list page token.
1213 ///
1214 /// Sets the *page token* query property to the given value.
1215 pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
1216 self._page_token = Some(new_value.to_string());
1217 self
1218 }
1219 /// The standard list page size.
1220 ///
1221 /// Sets the *page size* query property to the given value.
1222 pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
1223 self._page_size = Some(new_value);
1224 self
1225 }
1226 /// The standard list filter.
1227 ///
1228 /// Sets the *filter* query property to the given value.
1229 pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
1230 self._filter = Some(new_value.to_string());
1231 self
1232 }
1233 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1234 /// while executing the actual API request.
1235 ///
1236 /// ````text
1237 /// It should be used to handle progress information, and to implement a certain level of resilience.
1238 /// ````
1239 ///
1240 /// Sets the *delegate* property to the given value.
1241 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
1242 self._delegate = Some(new_value);
1243 self
1244 }
1245
1246 /// Set any additional parameter of the query string used in the request.
1247 /// It should be used to set parameters which are not yet available through their own
1248 /// setters.
1249 ///
1250 /// Please note that this method must not be used to set any of the known parameters
1251 /// which have their own setter method. If done anyway, the request will fail.
1252 ///
1253 /// # Additional Parameters
1254 ///
1255 /// * *$.xgafv* (query-string) - V1 error format.
1256 /// * *access_token* (query-string) - OAuth access token.
1257 /// * *alt* (query-string) - Data format for response.
1258 /// * *callback* (query-string) - JSONP
1259 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1260 /// * *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.
1261 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1262 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1263 /// * *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.
1264 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1265 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1266 pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
1267 where
1268 T: AsRef<str>,
1269 {
1270 self._additional_params
1271 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1272 self
1273 }
1274
1275 /// Identifies the authorization scope for the method you are building.
1276 ///
1277 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1278 /// [`Scope::CloudPlatform`].
1279 ///
1280 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1281 /// tokens for more than one scope.
1282 ///
1283 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1284 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1285 /// sufficient, a read-write scope will do as well.
1286 pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
1287 where
1288 St: AsRef<str>,
1289 {
1290 self._scopes.insert(String::from(scope.as_ref()));
1291 self
1292 }
1293 /// Identifies the authorization scope(s) for the method you are building.
1294 ///
1295 /// See [`Self::add_scope()`] for details.
1296 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
1297 where
1298 I: IntoIterator<Item = St>,
1299 St: AsRef<str>,
1300 {
1301 self._scopes
1302 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1303 self
1304 }
1305
1306 /// Removes all scopes, and no default scope will be used either.
1307 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1308 /// for details).
1309 pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
1310 self._scopes.clear();
1311 self
1312 }
1313}