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