google_serviceregistryalpha/
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    /// View and manage your data across Google Cloud Platform services
17    CloudPlatform,
18
19    /// View your data across Google Cloud Platform services
20    CloudPlatformReadOnly,
21
22    /// View and manage your Google Cloud Platform management resources and deployment status information
23    NdevCloudman,
24
25    /// View your Google Cloud Platform management resources and deployment status information
26    NdevCloudmanReadonly,
27}
28
29impl AsRef<str> for Scope {
30    fn as_ref(&self) -> &str {
31        match *self {
32            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
33            Scope::CloudPlatformReadOnly => {
34                "https://www.googleapis.com/auth/cloud-platform.read-only"
35            }
36            Scope::NdevCloudman => "https://www.googleapis.com/auth/ndev.cloudman",
37            Scope::NdevCloudmanReadonly => "https://www.googleapis.com/auth/ndev.cloudman.readonly",
38        }
39    }
40}
41
42#[allow(clippy::derivable_impls)]
43impl Default for Scope {
44    fn default() -> Scope {
45        Scope::NdevCloudmanReadonly
46    }
47}
48
49// ########
50// HUB ###
51// ######
52
53/// Central instance to access all ServiceRegistry related resource activities
54///
55/// # Examples
56///
57/// Instantiate a new hub
58///
59/// ```test_harness,no_run
60/// extern crate hyper;
61/// extern crate hyper_rustls;
62/// extern crate google_serviceregistryalpha as serviceregistryalpha;
63/// use serviceregistryalpha::{Result, Error};
64/// # async fn dox() {
65/// use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
66///
67/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
68/// // `client_secret`, among other things.
69/// let secret: yup_oauth2::ApplicationSecret = Default::default();
70/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
71/// // unless you replace  `None` with the desired Flow.
72/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
73/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
74/// // retrieve them from storage.
75/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
76///     secret,
77///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
78/// ).build().await.unwrap();
79///
80/// let client = hyper_util::client::legacy::Client::builder(
81///     hyper_util::rt::TokioExecutor::new()
82/// )
83/// .build(
84///     hyper_rustls::HttpsConnectorBuilder::new()
85///         .with_native_roots()
86///         .unwrap()
87///         .https_or_http()
88///         .enable_http1()
89///         .build()
90/// );
91/// let mut hub = ServiceRegistry::new(client, auth);
92/// // You can configure optional parameters by calling the respective setters at will, and
93/// // execute the final call using `doit()`.
94/// // Values shown here are possibly random and not representative !
95/// let result = hub.operations().list("project")
96///              .page_token("duo")
97///              .order_by("ipsum")
98///              .max_results(39)
99///              .filter("Lorem")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct ServiceRegistry<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for ServiceRegistry<C> {}
131
132impl<'a, C> ServiceRegistry<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> ServiceRegistry<C> {
137        ServiceRegistry {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/6.0.0".to_string(),
141            _base_url: "https://www.googleapis.com/serviceregistry/alpha/projects/".to_string(),
142            _root_url: "https://www.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn endpoints(&'a self) -> EndpointMethods<'a, C> {
147        EndpointMethods { hub: self }
148    }
149    pub fn operations(&'a self) -> OperationMethods<'a, C> {
150        OperationMethods { hub: self }
151    }
152
153    /// Set the user-agent header field to use in all requests to the server.
154    /// It defaults to `google-api-rust-client/6.0.0`.
155    ///
156    /// Returns the previously set user-agent.
157    pub fn user_agent(&mut self, agent_name: String) -> String {
158        std::mem::replace(&mut self._user_agent, agent_name)
159    }
160
161    /// Set the base url to use in all requests to the server.
162    /// It defaults to `https://www.googleapis.com/serviceregistry/alpha/projects/`.
163    ///
164    /// Returns the previously set base url.
165    pub fn base_url(&mut self, new_base_url: String) -> String {
166        std::mem::replace(&mut self._base_url, new_base_url)
167    }
168
169    /// Set the root url to use in all requests to the server.
170    /// It defaults to `https://www.googleapis.com/`.
171    ///
172    /// Returns the previously set root url.
173    pub fn root_url(&mut self, new_root_url: String) -> String {
174        std::mem::replace(&mut self._root_url, new_root_url)
175    }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// There is no detailed description.
182///
183/// # Activities
184///
185/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
186/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
187///
188/// * [delete endpoints](EndpointDeleteCall) (none)
189/// * [get endpoints](EndpointGetCall) (response)
190/// * [insert endpoints](EndpointInsertCall) (request)
191/// * [list endpoints](EndpointListCall) (none)
192/// * [patch endpoints](EndpointPatchCall) (request)
193/// * [update endpoints](EndpointUpdateCall) (request)
194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
195#[serde_with::serde_as]
196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
197pub struct Endpoint {
198    /// A user-provided address of the service represented by this endpoint. This can be an IPv4 or IPv6 address, or a hostname.
199    pub address: Option<String>,
200    /// [Output Only] Creation timestamp in RFC3339 text format.
201    #[serde(rename = "creationTimestamp")]
202    pub creation_timestamp: Option<String>,
203    /// An optional user-provided description of the endpoint.
204    pub description: Option<String>,
205    /// Supply the fingerprint value for update requests. The fingerprint value is generated by the server and ensures optimistic concurrency (so that only one update can be performed at a time). The fingerprint changes after each update.
206    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
207    pub fingerprint: Option<Vec<u8>>,
208    /// [Output Only] Unique identifier for the resource; defined by the server.
209    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
210    pub id: Option<u64>,
211    /// A user-provided name of the endpoint, which must be unique within the project. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
212    pub name: Option<String>,
213    /// An optional user-provided port of the service represented by this endpoint.
214    pub port: Option<i32>,
215    /// [Output Only] Self link for the endpoint.
216    #[serde(rename = "selfLink")]
217    pub self_link: Option<String>,
218    /// [Output Only] The current state of the endpoint, as determined by the system.
219    pub state: Option<String>,
220    /// The DNS Integration configuration for this endpoint. This must be a list of fully-qualified URLs to Compute Engine networks.
221    pub visibility: Option<EndpointEndpointVisibility>,
222}
223
224impl common::RequestValue for Endpoint {}
225impl common::Resource for Endpoint {}
226impl common::ResponseResult for Endpoint {}
227
228/// There is no detailed description.
229///
230/// This type is not used in any activity, and only used as *part* of another schema.
231///
232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
233#[serde_with::serde_as]
234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
235pub struct EndpointEndpointVisibility {
236    /// Google Compute Engine networks for which the name of this endpoint should be resolvable through DNS.
237    pub networks: Option<Vec<String>>,
238}
239
240impl common::Part for EndpointEndpointVisibility {}
241
242/// A response containing a partial list of Endpoints and a page token used to build the next request if the request has been truncated. Next available tag: 6
243///
244/// # Activities
245///
246/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
247/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
248///
249/// * [list endpoints](EndpointListCall) (response)
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct EndpointsListResponse {
254    /// The endpoints contained in this response.
255    pub endpoints: Option<Vec<Endpoint>>,
256    /// [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results.
257    #[serde(rename = "nextPageToken")]
258    pub next_page_token: Option<String>,
259}
260
261impl common::ResponseResult for EndpointsListResponse {}
262
263/// An Operation resource, used to manage asynchronous API requests.
264///
265/// # Activities
266///
267/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
268/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
269///
270/// * [delete endpoints](EndpointDeleteCall) (response)
271/// * [insert endpoints](EndpointInsertCall) (response)
272/// * [patch endpoints](EndpointPatchCall) (response)
273/// * [update endpoints](EndpointUpdateCall) (response)
274/// * [get operations](OperationGetCall) (response)
275/// * [list operations](OperationListCall) (none)
276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
277#[serde_with::serde_as]
278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
279pub struct Operation {
280    /// [Output Only] Reserved for future use.
281    #[serde(rename = "clientOperationId")]
282    pub client_operation_id: Option<String>,
283    /// [Output Only] Creation timestamp in RFC3339 text format.
284    #[serde(rename = "creationTimestamp")]
285    pub creation_timestamp: Option<String>,
286    /// [Output Only] A textual description of the operation, which is set when the operation is created.
287    pub description: Option<String>,
288    /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format.
289    #[serde(rename = "endTime")]
290    pub end_time: Option<String>,
291    /// [Output Only] If errors are generated during processing of the operation, this field will be populated.
292    pub error: Option<OperationError>,
293    /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND.
294    #[serde(rename = "httpErrorMessage")]
295    pub http_error_message: Option<String>,
296    /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found.
297    #[serde(rename = "httpErrorStatusCode")]
298    pub http_error_status_code: Option<i32>,
299    /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
300    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
301    pub id: Option<u64>,
302    /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format.
303    #[serde(rename = "insertTime")]
304    pub insert_time: Option<String>,
305    /// [Output Only] Type of the resource. Always compute#operation for Operation resources.
306    pub kind: Option<String>,
307    /// [Output Only] Name of the resource.
308    pub name: Option<String>,
309    /// [Output Only] The type of operation, such as insert, update, or delete, and so on.
310    #[serde(rename = "operationType")]
311    pub operation_type: Option<String>,
312    /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses.
313    pub progress: Option<i32>,
314    /// [Output Only] The URL of the region where the operation resides. Only available when performing regional operations.
315    pub region: Option<String>,
316    /// [Output Only] Server-defined URL for the resource.
317    #[serde(rename = "selfLink")]
318    pub self_link: Option<String>,
319    /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format.
320    #[serde(rename = "startTime")]
321    pub start_time: Option<String>,
322    /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE.
323    pub status: Option<String>,
324    /// [Output Only] An optional textual description of the current status of the operation.
325    #[serde(rename = "statusMessage")]
326    pub status_message: Option<String>,
327    /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource.
328    #[serde(rename = "targetId")]
329    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
330    pub target_id: Option<u64>,
331    /// [Output Only] The URL of the resource that the operation modifies.
332    #[serde(rename = "targetLink")]
333    pub target_link: Option<String>,
334    /// [Output Only] User who requested the operation, for example: user@example.com.
335    pub user: Option<String>,
336    /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
337    pub warnings: Option<Vec<OperationWarnings>>,
338    /// [Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations.
339    pub zone: Option<String>,
340}
341
342impl common::Resource for Operation {}
343impl common::ResponseResult for Operation {}
344
345/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated.
346///
347/// # Activities
348///
349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
351///
352/// * [list operations](OperationListCall) (response)
353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
354#[serde_with::serde_as]
355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
356pub struct OperationsListResponse {
357    /// [Output Only] A token used to continue a truncated list request.
358    #[serde(rename = "nextPageToken")]
359    pub next_page_token: Option<String>,
360    /// [Output Only] Operations contained in this list response.
361    pub operations: Option<Vec<Operation>>,
362}
363
364impl common::ResponseResult for OperationsListResponse {}
365
366/// [Output Only] If errors are generated during processing of the operation, this field will be populated.
367///
368/// This type is not used in any activity, and only used as *part* of another schema.
369///
370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
371#[serde_with::serde_as]
372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
373pub struct OperationError {
374    /// [Output Only] The array of errors encountered while processing this operation.
375    pub errors: Option<Vec<OperationErrorErrors>>,
376}
377
378impl common::NestedType for OperationError {}
379impl common::Part for OperationError {}
380
381/// [Output Only] The array of errors encountered while processing this operation.
382///
383/// This type is not used in any activity, and only used as *part* of another schema.
384///
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct OperationErrorErrors {
389    /// [Output Only] The error type identifier for this error.
390    pub code: Option<String>,
391    /// [Output Only] Indicates the field in the request that caused the error. This property is optional.
392    pub location: Option<String>,
393    /// [Output Only] An optional, human-readable error message.
394    pub message: Option<String>,
395}
396
397impl common::NestedType for OperationErrorErrors {}
398impl common::Part for OperationErrorErrors {}
399
400/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
401///
402/// This type is not used in any activity, and only used as *part* of another schema.
403///
404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
405#[serde_with::serde_as]
406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
407pub struct OperationWarnings {
408    /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
409    pub code: Option<String>,
410    /// [Output Only] Metadata about this warning in key: value format. For example:
411    /// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
412    pub data: Option<Vec<OperationWarningsData>>,
413    /// [Output Only] A human-readable description of the warning code.
414    pub message: Option<String>,
415}
416
417impl common::NestedType for OperationWarnings {}
418impl common::Part for OperationWarnings {}
419
420/// [Output Only] Metadata about this warning in key: value format. For example:
421/// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
422///
423/// This type is not used in any activity, and only used as *part* of another schema.
424///
425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
426#[serde_with::serde_as]
427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
428pub struct OperationWarningsData {
429    /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
430    pub key: Option<String>,
431    /// [Output Only] A warning data value corresponding to the key.
432    pub value: Option<String>,
433}
434
435impl common::NestedType for OperationWarningsData {}
436impl common::Part for OperationWarningsData {}
437
438// ###################
439// MethodBuilders ###
440// #################
441
442/// A builder providing access to all methods supported on *endpoint* resources.
443/// It is not used directly, but through the [`ServiceRegistry`] hub.
444///
445/// # Example
446///
447/// Instantiate a resource builder
448///
449/// ```test_harness,no_run
450/// extern crate hyper;
451/// extern crate hyper_rustls;
452/// extern crate google_serviceregistryalpha as serviceregistryalpha;
453///
454/// # async fn dox() {
455/// use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
456///
457/// let secret: yup_oauth2::ApplicationSecret = Default::default();
458/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
459///     secret,
460///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
461/// ).build().await.unwrap();
462///
463/// let client = hyper_util::client::legacy::Client::builder(
464///     hyper_util::rt::TokioExecutor::new()
465/// )
466/// .build(
467///     hyper_rustls::HttpsConnectorBuilder::new()
468///         .with_native_roots()
469///         .unwrap()
470///         .https_or_http()
471///         .enable_http1()
472///         .build()
473/// );
474/// let mut hub = ServiceRegistry::new(client, auth);
475/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
476/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
477/// // to build up your call.
478/// let rb = hub.endpoints();
479/// # }
480/// ```
481pub struct EndpointMethods<'a, C>
482where
483    C: 'a,
484{
485    hub: &'a ServiceRegistry<C>,
486}
487
488impl<'a, C> common::MethodsBuilder for EndpointMethods<'a, C> {}
489
490impl<'a, C> EndpointMethods<'a, C> {
491    /// Create a builder to help you perform the following task:
492    ///
493    /// Deletes an endpoint.
494    ///
495    /// # Arguments
496    ///
497    /// * `project` - The project ID for this request.
498    /// * `endpoint` - The name of the endpoint for this request.
499    pub fn delete(&self, project: &str, endpoint: &str) -> EndpointDeleteCall<'a, C> {
500        EndpointDeleteCall {
501            hub: self.hub,
502            _project: project.to_string(),
503            _endpoint: endpoint.to_string(),
504            _delegate: Default::default(),
505            _additional_params: Default::default(),
506            _scopes: Default::default(),
507        }
508    }
509
510    /// Create a builder to help you perform the following task:
511    ///
512    /// Gets an endpoint.
513    ///
514    /// # Arguments
515    ///
516    /// * `project` - The project ID for this request.
517    /// * `endpoint` - The name of the endpoint for this request.
518    pub fn get(&self, project: &str, endpoint: &str) -> EndpointGetCall<'a, C> {
519        EndpointGetCall {
520            hub: self.hub,
521            _project: project.to_string(),
522            _endpoint: endpoint.to_string(),
523            _delegate: Default::default(),
524            _additional_params: Default::default(),
525            _scopes: Default::default(),
526        }
527    }
528
529    /// Create a builder to help you perform the following task:
530    ///
531    /// Creates an endpoint.
532    ///
533    /// # Arguments
534    ///
535    /// * `request` - No description provided.
536    /// * `project` - The project ID for this request.
537    pub fn insert(&self, request: Endpoint, project: &str) -> EndpointInsertCall<'a, C> {
538        EndpointInsertCall {
539            hub: self.hub,
540            _request: request,
541            _project: project.to_string(),
542            _delegate: Default::default(),
543            _additional_params: Default::default(),
544            _scopes: Default::default(),
545        }
546    }
547
548    /// Create a builder to help you perform the following task:
549    ///
550    /// Lists endpoints for a project.
551    ///
552    /// # Arguments
553    ///
554    /// * `project` - The project ID for this request.
555    pub fn list(&self, project: &str) -> EndpointListCall<'a, C> {
556        EndpointListCall {
557            hub: self.hub,
558            _project: project.to_string(),
559            _page_token: Default::default(),
560            _order_by: Default::default(),
561            _max_results: Default::default(),
562            _filter: Default::default(),
563            _delegate: Default::default(),
564            _additional_params: Default::default(),
565            _scopes: Default::default(),
566        }
567    }
568
569    /// Create a builder to help you perform the following task:
570    ///
571    /// Updates an endpoint. This method supports patch semantics.
572    ///
573    /// # Arguments
574    ///
575    /// * `request` - No description provided.
576    /// * `project` - The project ID for this request.
577    /// * `endpoint` - The name of the endpoint for this request.
578    pub fn patch(
579        &self,
580        request: Endpoint,
581        project: &str,
582        endpoint: &str,
583    ) -> EndpointPatchCall<'a, C> {
584        EndpointPatchCall {
585            hub: self.hub,
586            _request: request,
587            _project: project.to_string(),
588            _endpoint: endpoint.to_string(),
589            _delegate: Default::default(),
590            _additional_params: Default::default(),
591            _scopes: Default::default(),
592        }
593    }
594
595    /// Create a builder to help you perform the following task:
596    ///
597    /// Updates an endpoint.
598    ///
599    /// # Arguments
600    ///
601    /// * `request` - No description provided.
602    /// * `project` - The project ID for this request.
603    /// * `endpoint` - The name of the endpoint for this request.
604    pub fn update(
605        &self,
606        request: Endpoint,
607        project: &str,
608        endpoint: &str,
609    ) -> EndpointUpdateCall<'a, C> {
610        EndpointUpdateCall {
611            hub: self.hub,
612            _request: request,
613            _project: project.to_string(),
614            _endpoint: endpoint.to_string(),
615            _delegate: Default::default(),
616            _additional_params: Default::default(),
617            _scopes: Default::default(),
618        }
619    }
620}
621
622/// A builder providing access to all methods supported on *operation* resources.
623/// It is not used directly, but through the [`ServiceRegistry`] hub.
624///
625/// # Example
626///
627/// Instantiate a resource builder
628///
629/// ```test_harness,no_run
630/// extern crate hyper;
631/// extern crate hyper_rustls;
632/// extern crate google_serviceregistryalpha as serviceregistryalpha;
633///
634/// # async fn dox() {
635/// use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
636///
637/// let secret: yup_oauth2::ApplicationSecret = Default::default();
638/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
639///     secret,
640///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
641/// ).build().await.unwrap();
642///
643/// let client = hyper_util::client::legacy::Client::builder(
644///     hyper_util::rt::TokioExecutor::new()
645/// )
646/// .build(
647///     hyper_rustls::HttpsConnectorBuilder::new()
648///         .with_native_roots()
649///         .unwrap()
650///         .https_or_http()
651///         .enable_http1()
652///         .build()
653/// );
654/// let mut hub = ServiceRegistry::new(client, auth);
655/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
656/// // like `get(...)` and `list(...)`
657/// // to build up your call.
658/// let rb = hub.operations();
659/// # }
660/// ```
661pub struct OperationMethods<'a, C>
662where
663    C: 'a,
664{
665    hub: &'a ServiceRegistry<C>,
666}
667
668impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
669
670impl<'a, C> OperationMethods<'a, C> {
671    /// Create a builder to help you perform the following task:
672    ///
673    /// Gets information about a specific operation.
674    ///
675    /// # Arguments
676    ///
677    /// * `project` - The project ID for this request.
678    /// * `operation` - The name of the operation for this request.
679    pub fn get(&self, project: &str, operation: &str) -> OperationGetCall<'a, C> {
680        OperationGetCall {
681            hub: self.hub,
682            _project: project.to_string(),
683            _operation: operation.to_string(),
684            _delegate: Default::default(),
685            _additional_params: Default::default(),
686            _scopes: Default::default(),
687        }
688    }
689
690    /// Create a builder to help you perform the following task:
691    ///
692    /// Lists all operations for a project.
693    ///
694    /// # Arguments
695    ///
696    /// * `project` - The project ID for this request.
697    pub fn list(&self, project: &str) -> OperationListCall<'a, C> {
698        OperationListCall {
699            hub: self.hub,
700            _project: project.to_string(),
701            _page_token: Default::default(),
702            _order_by: Default::default(),
703            _max_results: Default::default(),
704            _filter: Default::default(),
705            _delegate: Default::default(),
706            _additional_params: Default::default(),
707            _scopes: Default::default(),
708        }
709    }
710}
711
712// ###################
713// CallBuilders   ###
714// #################
715
716/// Deletes an endpoint.
717///
718/// A builder for the *delete* method supported by a *endpoint* resource.
719/// It is not used directly, but through a [`EndpointMethods`] instance.
720///
721/// # Example
722///
723/// Instantiate a resource method builder
724///
725/// ```test_harness,no_run
726/// # extern crate hyper;
727/// # extern crate hyper_rustls;
728/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
729/// # async fn dox() {
730/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
731///
732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
734/// #     secret,
735/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
736/// # ).build().await.unwrap();
737///
738/// # let client = hyper_util::client::legacy::Client::builder(
739/// #     hyper_util::rt::TokioExecutor::new()
740/// # )
741/// # .build(
742/// #     hyper_rustls::HttpsConnectorBuilder::new()
743/// #         .with_native_roots()
744/// #         .unwrap()
745/// #         .https_or_http()
746/// #         .enable_http1()
747/// #         .build()
748/// # );
749/// # let mut hub = ServiceRegistry::new(client, auth);
750/// // You can configure optional parameters by calling the respective setters at will, and
751/// // execute the final call using `doit()`.
752/// // Values shown here are possibly random and not representative !
753/// let result = hub.endpoints().delete("project", "endpoint")
754///              .doit().await;
755/// # }
756/// ```
757pub struct EndpointDeleteCall<'a, C>
758where
759    C: 'a,
760{
761    hub: &'a ServiceRegistry<C>,
762    _project: String,
763    _endpoint: String,
764    _delegate: Option<&'a mut dyn common::Delegate>,
765    _additional_params: HashMap<String, String>,
766    _scopes: BTreeSet<String>,
767}
768
769impl<'a, C> common::CallBuilder for EndpointDeleteCall<'a, C> {}
770
771impl<'a, C> EndpointDeleteCall<'a, C>
772where
773    C: common::Connector,
774{
775    /// Perform the operation you have build so far.
776    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
777        use std::borrow::Cow;
778        use std::io::{Read, Seek};
779
780        use common::{url::Params, ToParts};
781        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
782
783        let mut dd = common::DefaultDelegate;
784        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
785        dlg.begin(common::MethodInfo {
786            id: "serviceregistry.endpoints.delete",
787            http_method: hyper::Method::DELETE,
788        });
789
790        for &field in ["alt", "project", "endpoint"].iter() {
791            if self._additional_params.contains_key(field) {
792                dlg.finished(false);
793                return Err(common::Error::FieldClash(field));
794            }
795        }
796
797        let mut params = Params::with_capacity(4 + self._additional_params.len());
798        params.push("project", self._project);
799        params.push("endpoint", self._endpoint);
800
801        params.extend(self._additional_params.iter());
802
803        params.push("alt", "json");
804        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints/{endpoint}";
805        if self._scopes.is_empty() {
806            self._scopes
807                .insert(Scope::CloudPlatform.as_ref().to_string());
808        }
809
810        #[allow(clippy::single_element_loop)]
811        for &(find_this, param_name) in
812            [("{project}", "project"), ("{endpoint}", "endpoint")].iter()
813        {
814            url = params.uri_replacement(url, param_name, find_this, false);
815        }
816        {
817            let to_remove = ["endpoint", "project"];
818            params.remove_params(&to_remove);
819        }
820
821        let url = params.parse_with_url(&url);
822
823        loop {
824            let token = match self
825                .hub
826                .auth
827                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
828                .await
829            {
830                Ok(token) => token,
831                Err(e) => match dlg.token(e) {
832                    Ok(token) => token,
833                    Err(e) => {
834                        dlg.finished(false);
835                        return Err(common::Error::MissingToken(e));
836                    }
837                },
838            };
839            let mut req_result = {
840                let client = &self.hub.client;
841                dlg.pre_request();
842                let mut req_builder = hyper::Request::builder()
843                    .method(hyper::Method::DELETE)
844                    .uri(url.as_str())
845                    .header(USER_AGENT, self.hub._user_agent.clone());
846
847                if let Some(token) = token.as_ref() {
848                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
849                }
850
851                let request = req_builder
852                    .header(CONTENT_LENGTH, 0_u64)
853                    .body(common::to_body::<String>(None));
854
855                client.request(request.unwrap()).await
856            };
857
858            match req_result {
859                Err(err) => {
860                    if let common::Retry::After(d) = dlg.http_error(&err) {
861                        sleep(d).await;
862                        continue;
863                    }
864                    dlg.finished(false);
865                    return Err(common::Error::HttpError(err));
866                }
867                Ok(res) => {
868                    let (mut parts, body) = res.into_parts();
869                    let mut body = common::Body::new(body);
870                    if !parts.status.is_success() {
871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
872                        let error = serde_json::from_str(&common::to_string(&bytes));
873                        let response = common::to_response(parts, bytes.into());
874
875                        if let common::Retry::After(d) =
876                            dlg.http_failure(&response, error.as_ref().ok())
877                        {
878                            sleep(d).await;
879                            continue;
880                        }
881
882                        dlg.finished(false);
883
884                        return Err(match error {
885                            Ok(value) => common::Error::BadRequest(value),
886                            _ => common::Error::Failure(response),
887                        });
888                    }
889                    let response = {
890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
891                        let encoded = common::to_string(&bytes);
892                        match serde_json::from_str(&encoded) {
893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
894                            Err(error) => {
895                                dlg.response_json_decode_error(&encoded, &error);
896                                return Err(common::Error::JsonDecodeError(
897                                    encoded.to_string(),
898                                    error,
899                                ));
900                            }
901                        }
902                    };
903
904                    dlg.finished(true);
905                    return Ok(response);
906                }
907            }
908        }
909    }
910
911    /// The project ID for this request.
912    ///
913    /// Sets the *project* path property to the given value.
914    ///
915    /// Even though the property as already been set when instantiating this call,
916    /// we provide this method for API completeness.
917    pub fn project(mut self, new_value: &str) -> EndpointDeleteCall<'a, C> {
918        self._project = new_value.to_string();
919        self
920    }
921    /// The name of the endpoint for this request.
922    ///
923    /// Sets the *endpoint* path property to the given value.
924    ///
925    /// Even though the property as already been set when instantiating this call,
926    /// we provide this method for API completeness.
927    pub fn endpoint(mut self, new_value: &str) -> EndpointDeleteCall<'a, C> {
928        self._endpoint = new_value.to_string();
929        self
930    }
931    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
932    /// while executing the actual API request.
933    ///
934    /// ````text
935    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
936    /// ````
937    ///
938    /// Sets the *delegate* property to the given value.
939    pub fn delegate(
940        mut self,
941        new_value: &'a mut dyn common::Delegate,
942    ) -> EndpointDeleteCall<'a, C> {
943        self._delegate = Some(new_value);
944        self
945    }
946
947    /// Set any additional parameter of the query string used in the request.
948    /// It should be used to set parameters which are not yet available through their own
949    /// setters.
950    ///
951    /// Please note that this method must not be used to set any of the known parameters
952    /// which have their own setter method. If done anyway, the request will fail.
953    ///
954    /// # Additional Parameters
955    ///
956    /// * *alt* (query-string) - Data format for the response.
957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
958    /// * *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.
959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
961    /// * *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. Overrides userIp if both are provided.
962    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
963    pub fn param<T>(mut self, name: T, value: T) -> EndpointDeleteCall<'a, C>
964    where
965        T: AsRef<str>,
966    {
967        self._additional_params
968            .insert(name.as_ref().to_string(), value.as_ref().to_string());
969        self
970    }
971
972    /// Identifies the authorization scope for the method you are building.
973    ///
974    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
975    /// [`Scope::CloudPlatform`].
976    ///
977    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
978    /// tokens for more than one scope.
979    ///
980    /// Usually there is more than one suitable scope to authorize an operation, some of which may
981    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
982    /// sufficient, a read-write scope will do as well.
983    pub fn add_scope<St>(mut self, scope: St) -> EndpointDeleteCall<'a, C>
984    where
985        St: AsRef<str>,
986    {
987        self._scopes.insert(String::from(scope.as_ref()));
988        self
989    }
990    /// Identifies the authorization scope(s) for the method you are building.
991    ///
992    /// See [`Self::add_scope()`] for details.
993    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointDeleteCall<'a, C>
994    where
995        I: IntoIterator<Item = St>,
996        St: AsRef<str>,
997    {
998        self._scopes
999            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1000        self
1001    }
1002
1003    /// Removes all scopes, and no default scope will be used either.
1004    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1005    /// for details).
1006    pub fn clear_scopes(mut self) -> EndpointDeleteCall<'a, C> {
1007        self._scopes.clear();
1008        self
1009    }
1010}
1011
1012/// Gets an endpoint.
1013///
1014/// A builder for the *get* method supported by a *endpoint* resource.
1015/// It is not used directly, but through a [`EndpointMethods`] instance.
1016///
1017/// # Example
1018///
1019/// Instantiate a resource method builder
1020///
1021/// ```test_harness,no_run
1022/// # extern crate hyper;
1023/// # extern crate hyper_rustls;
1024/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
1025/// # async fn dox() {
1026/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1027///
1028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1030/// #     secret,
1031/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1032/// # ).build().await.unwrap();
1033///
1034/// # let client = hyper_util::client::legacy::Client::builder(
1035/// #     hyper_util::rt::TokioExecutor::new()
1036/// # )
1037/// # .build(
1038/// #     hyper_rustls::HttpsConnectorBuilder::new()
1039/// #         .with_native_roots()
1040/// #         .unwrap()
1041/// #         .https_or_http()
1042/// #         .enable_http1()
1043/// #         .build()
1044/// # );
1045/// # let mut hub = ServiceRegistry::new(client, auth);
1046/// // You can configure optional parameters by calling the respective setters at will, and
1047/// // execute the final call using `doit()`.
1048/// // Values shown here are possibly random and not representative !
1049/// let result = hub.endpoints().get("project", "endpoint")
1050///              .doit().await;
1051/// # }
1052/// ```
1053pub struct EndpointGetCall<'a, C>
1054where
1055    C: 'a,
1056{
1057    hub: &'a ServiceRegistry<C>,
1058    _project: String,
1059    _endpoint: String,
1060    _delegate: Option<&'a mut dyn common::Delegate>,
1061    _additional_params: HashMap<String, String>,
1062    _scopes: BTreeSet<String>,
1063}
1064
1065impl<'a, C> common::CallBuilder for EndpointGetCall<'a, C> {}
1066
1067impl<'a, C> EndpointGetCall<'a, C>
1068where
1069    C: common::Connector,
1070{
1071    /// Perform the operation you have build so far.
1072    pub async fn doit(mut self) -> common::Result<(common::Response, Endpoint)> {
1073        use std::borrow::Cow;
1074        use std::io::{Read, Seek};
1075
1076        use common::{url::Params, ToParts};
1077        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1078
1079        let mut dd = common::DefaultDelegate;
1080        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1081        dlg.begin(common::MethodInfo {
1082            id: "serviceregistry.endpoints.get",
1083            http_method: hyper::Method::GET,
1084        });
1085
1086        for &field in ["alt", "project", "endpoint"].iter() {
1087            if self._additional_params.contains_key(field) {
1088                dlg.finished(false);
1089                return Err(common::Error::FieldClash(field));
1090            }
1091        }
1092
1093        let mut params = Params::with_capacity(4 + self._additional_params.len());
1094        params.push("project", self._project);
1095        params.push("endpoint", self._endpoint);
1096
1097        params.extend(self._additional_params.iter());
1098
1099        params.push("alt", "json");
1100        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints/{endpoint}";
1101        if self._scopes.is_empty() {
1102            self._scopes
1103                .insert(Scope::CloudPlatform.as_ref().to_string());
1104        }
1105
1106        #[allow(clippy::single_element_loop)]
1107        for &(find_this, param_name) in
1108            [("{project}", "project"), ("{endpoint}", "endpoint")].iter()
1109        {
1110            url = params.uri_replacement(url, param_name, find_this, false);
1111        }
1112        {
1113            let to_remove = ["endpoint", "project"];
1114            params.remove_params(&to_remove);
1115        }
1116
1117        let url = params.parse_with_url(&url);
1118
1119        loop {
1120            let token = match self
1121                .hub
1122                .auth
1123                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1124                .await
1125            {
1126                Ok(token) => token,
1127                Err(e) => match dlg.token(e) {
1128                    Ok(token) => token,
1129                    Err(e) => {
1130                        dlg.finished(false);
1131                        return Err(common::Error::MissingToken(e));
1132                    }
1133                },
1134            };
1135            let mut req_result = {
1136                let client = &self.hub.client;
1137                dlg.pre_request();
1138                let mut req_builder = hyper::Request::builder()
1139                    .method(hyper::Method::GET)
1140                    .uri(url.as_str())
1141                    .header(USER_AGENT, self.hub._user_agent.clone());
1142
1143                if let Some(token) = token.as_ref() {
1144                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1145                }
1146
1147                let request = req_builder
1148                    .header(CONTENT_LENGTH, 0_u64)
1149                    .body(common::to_body::<String>(None));
1150
1151                client.request(request.unwrap()).await
1152            };
1153
1154            match req_result {
1155                Err(err) => {
1156                    if let common::Retry::After(d) = dlg.http_error(&err) {
1157                        sleep(d).await;
1158                        continue;
1159                    }
1160                    dlg.finished(false);
1161                    return Err(common::Error::HttpError(err));
1162                }
1163                Ok(res) => {
1164                    let (mut parts, body) = res.into_parts();
1165                    let mut body = common::Body::new(body);
1166                    if !parts.status.is_success() {
1167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1168                        let error = serde_json::from_str(&common::to_string(&bytes));
1169                        let response = common::to_response(parts, bytes.into());
1170
1171                        if let common::Retry::After(d) =
1172                            dlg.http_failure(&response, error.as_ref().ok())
1173                        {
1174                            sleep(d).await;
1175                            continue;
1176                        }
1177
1178                        dlg.finished(false);
1179
1180                        return Err(match error {
1181                            Ok(value) => common::Error::BadRequest(value),
1182                            _ => common::Error::Failure(response),
1183                        });
1184                    }
1185                    let response = {
1186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1187                        let encoded = common::to_string(&bytes);
1188                        match serde_json::from_str(&encoded) {
1189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1190                            Err(error) => {
1191                                dlg.response_json_decode_error(&encoded, &error);
1192                                return Err(common::Error::JsonDecodeError(
1193                                    encoded.to_string(),
1194                                    error,
1195                                ));
1196                            }
1197                        }
1198                    };
1199
1200                    dlg.finished(true);
1201                    return Ok(response);
1202                }
1203            }
1204        }
1205    }
1206
1207    /// The project ID for this request.
1208    ///
1209    /// Sets the *project* path property to the given value.
1210    ///
1211    /// Even though the property as already been set when instantiating this call,
1212    /// we provide this method for API completeness.
1213    pub fn project(mut self, new_value: &str) -> EndpointGetCall<'a, C> {
1214        self._project = new_value.to_string();
1215        self
1216    }
1217    /// The name of the endpoint for this request.
1218    ///
1219    /// Sets the *endpoint* path property to the given value.
1220    ///
1221    /// Even though the property as already been set when instantiating this call,
1222    /// we provide this method for API completeness.
1223    pub fn endpoint(mut self, new_value: &str) -> EndpointGetCall<'a, C> {
1224        self._endpoint = new_value.to_string();
1225        self
1226    }
1227    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1228    /// while executing the actual API request.
1229    ///
1230    /// ````text
1231    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1232    /// ````
1233    ///
1234    /// Sets the *delegate* property to the given value.
1235    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EndpointGetCall<'a, C> {
1236        self._delegate = Some(new_value);
1237        self
1238    }
1239
1240    /// Set any additional parameter of the query string used in the request.
1241    /// It should be used to set parameters which are not yet available through their own
1242    /// setters.
1243    ///
1244    /// Please note that this method must not be used to set any of the known parameters
1245    /// which have their own setter method. If done anyway, the request will fail.
1246    ///
1247    /// # Additional Parameters
1248    ///
1249    /// * *alt* (query-string) - Data format for the response.
1250    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1251    /// * *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.
1252    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1253    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1254    /// * *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. Overrides userIp if both are provided.
1255    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1256    pub fn param<T>(mut self, name: T, value: T) -> EndpointGetCall<'a, C>
1257    where
1258        T: AsRef<str>,
1259    {
1260        self._additional_params
1261            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1262        self
1263    }
1264
1265    /// Identifies the authorization scope for the method you are building.
1266    ///
1267    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1268    /// [`Scope::CloudPlatform`].
1269    ///
1270    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1271    /// tokens for more than one scope.
1272    ///
1273    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1274    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1275    /// sufficient, a read-write scope will do as well.
1276    pub fn add_scope<St>(mut self, scope: St) -> EndpointGetCall<'a, C>
1277    where
1278        St: AsRef<str>,
1279    {
1280        self._scopes.insert(String::from(scope.as_ref()));
1281        self
1282    }
1283    /// Identifies the authorization scope(s) for the method you are building.
1284    ///
1285    /// See [`Self::add_scope()`] for details.
1286    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointGetCall<'a, C>
1287    where
1288        I: IntoIterator<Item = St>,
1289        St: AsRef<str>,
1290    {
1291        self._scopes
1292            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1293        self
1294    }
1295
1296    /// Removes all scopes, and no default scope will be used either.
1297    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1298    /// for details).
1299    pub fn clear_scopes(mut self) -> EndpointGetCall<'a, C> {
1300        self._scopes.clear();
1301        self
1302    }
1303}
1304
1305/// Creates an endpoint.
1306///
1307/// A builder for the *insert* method supported by a *endpoint* resource.
1308/// It is not used directly, but through a [`EndpointMethods`] instance.
1309///
1310/// # Example
1311///
1312/// Instantiate a resource method builder
1313///
1314/// ```test_harness,no_run
1315/// # extern crate hyper;
1316/// # extern crate hyper_rustls;
1317/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
1318/// use serviceregistryalpha::api::Endpoint;
1319/// # async fn dox() {
1320/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1321///
1322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1324/// #     secret,
1325/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1326/// # ).build().await.unwrap();
1327///
1328/// # let client = hyper_util::client::legacy::Client::builder(
1329/// #     hyper_util::rt::TokioExecutor::new()
1330/// # )
1331/// # .build(
1332/// #     hyper_rustls::HttpsConnectorBuilder::new()
1333/// #         .with_native_roots()
1334/// #         .unwrap()
1335/// #         .https_or_http()
1336/// #         .enable_http1()
1337/// #         .build()
1338/// # );
1339/// # let mut hub = ServiceRegistry::new(client, auth);
1340/// // As the method needs a request, you would usually fill it with the desired information
1341/// // into the respective structure. Some of the parts shown here might not be applicable !
1342/// // Values shown here are possibly random and not representative !
1343/// let mut req = Endpoint::default();
1344///
1345/// // You can configure optional parameters by calling the respective setters at will, and
1346/// // execute the final call using `doit()`.
1347/// // Values shown here are possibly random and not representative !
1348/// let result = hub.endpoints().insert(req, "project")
1349///              .doit().await;
1350/// # }
1351/// ```
1352pub struct EndpointInsertCall<'a, C>
1353where
1354    C: 'a,
1355{
1356    hub: &'a ServiceRegistry<C>,
1357    _request: Endpoint,
1358    _project: String,
1359    _delegate: Option<&'a mut dyn common::Delegate>,
1360    _additional_params: HashMap<String, String>,
1361    _scopes: BTreeSet<String>,
1362}
1363
1364impl<'a, C> common::CallBuilder for EndpointInsertCall<'a, C> {}
1365
1366impl<'a, C> EndpointInsertCall<'a, C>
1367where
1368    C: common::Connector,
1369{
1370    /// Perform the operation you have build so far.
1371    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1372        use std::borrow::Cow;
1373        use std::io::{Read, Seek};
1374
1375        use common::{url::Params, ToParts};
1376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1377
1378        let mut dd = common::DefaultDelegate;
1379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1380        dlg.begin(common::MethodInfo {
1381            id: "serviceregistry.endpoints.insert",
1382            http_method: hyper::Method::POST,
1383        });
1384
1385        for &field in ["alt", "project"].iter() {
1386            if self._additional_params.contains_key(field) {
1387                dlg.finished(false);
1388                return Err(common::Error::FieldClash(field));
1389            }
1390        }
1391
1392        let mut params = Params::with_capacity(4 + self._additional_params.len());
1393        params.push("project", self._project);
1394
1395        params.extend(self._additional_params.iter());
1396
1397        params.push("alt", "json");
1398        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints";
1399        if self._scopes.is_empty() {
1400            self._scopes
1401                .insert(Scope::CloudPlatform.as_ref().to_string());
1402        }
1403
1404        #[allow(clippy::single_element_loop)]
1405        for &(find_this, param_name) in [("{project}", "project")].iter() {
1406            url = params.uri_replacement(url, param_name, find_this, false);
1407        }
1408        {
1409            let to_remove = ["project"];
1410            params.remove_params(&to_remove);
1411        }
1412
1413        let url = params.parse_with_url(&url);
1414
1415        let mut json_mime_type = mime::APPLICATION_JSON;
1416        let mut request_value_reader = {
1417            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1418            common::remove_json_null_values(&mut value);
1419            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1420            serde_json::to_writer(&mut dst, &value).unwrap();
1421            dst
1422        };
1423        let request_size = request_value_reader
1424            .seek(std::io::SeekFrom::End(0))
1425            .unwrap();
1426        request_value_reader
1427            .seek(std::io::SeekFrom::Start(0))
1428            .unwrap();
1429
1430        loop {
1431            let token = match self
1432                .hub
1433                .auth
1434                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1435                .await
1436            {
1437                Ok(token) => token,
1438                Err(e) => match dlg.token(e) {
1439                    Ok(token) => token,
1440                    Err(e) => {
1441                        dlg.finished(false);
1442                        return Err(common::Error::MissingToken(e));
1443                    }
1444                },
1445            };
1446            request_value_reader
1447                .seek(std::io::SeekFrom::Start(0))
1448                .unwrap();
1449            let mut req_result = {
1450                let client = &self.hub.client;
1451                dlg.pre_request();
1452                let mut req_builder = hyper::Request::builder()
1453                    .method(hyper::Method::POST)
1454                    .uri(url.as_str())
1455                    .header(USER_AGENT, self.hub._user_agent.clone());
1456
1457                if let Some(token) = token.as_ref() {
1458                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1459                }
1460
1461                let request = req_builder
1462                    .header(CONTENT_TYPE, json_mime_type.to_string())
1463                    .header(CONTENT_LENGTH, request_size as u64)
1464                    .body(common::to_body(
1465                        request_value_reader.get_ref().clone().into(),
1466                    ));
1467
1468                client.request(request.unwrap()).await
1469            };
1470
1471            match req_result {
1472                Err(err) => {
1473                    if let common::Retry::After(d) = dlg.http_error(&err) {
1474                        sleep(d).await;
1475                        continue;
1476                    }
1477                    dlg.finished(false);
1478                    return Err(common::Error::HttpError(err));
1479                }
1480                Ok(res) => {
1481                    let (mut parts, body) = res.into_parts();
1482                    let mut body = common::Body::new(body);
1483                    if !parts.status.is_success() {
1484                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1485                        let error = serde_json::from_str(&common::to_string(&bytes));
1486                        let response = common::to_response(parts, bytes.into());
1487
1488                        if let common::Retry::After(d) =
1489                            dlg.http_failure(&response, error.as_ref().ok())
1490                        {
1491                            sleep(d).await;
1492                            continue;
1493                        }
1494
1495                        dlg.finished(false);
1496
1497                        return Err(match error {
1498                            Ok(value) => common::Error::BadRequest(value),
1499                            _ => common::Error::Failure(response),
1500                        });
1501                    }
1502                    let response = {
1503                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1504                        let encoded = common::to_string(&bytes);
1505                        match serde_json::from_str(&encoded) {
1506                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1507                            Err(error) => {
1508                                dlg.response_json_decode_error(&encoded, &error);
1509                                return Err(common::Error::JsonDecodeError(
1510                                    encoded.to_string(),
1511                                    error,
1512                                ));
1513                            }
1514                        }
1515                    };
1516
1517                    dlg.finished(true);
1518                    return Ok(response);
1519                }
1520            }
1521        }
1522    }
1523
1524    ///
1525    /// Sets the *request* property to the given value.
1526    ///
1527    /// Even though the property as already been set when instantiating this call,
1528    /// we provide this method for API completeness.
1529    pub fn request(mut self, new_value: Endpoint) -> EndpointInsertCall<'a, C> {
1530        self._request = new_value;
1531        self
1532    }
1533    /// The project ID for this request.
1534    ///
1535    /// Sets the *project* path property to the given value.
1536    ///
1537    /// Even though the property as already been set when instantiating this call,
1538    /// we provide this method for API completeness.
1539    pub fn project(mut self, new_value: &str) -> EndpointInsertCall<'a, C> {
1540        self._project = new_value.to_string();
1541        self
1542    }
1543    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1544    /// while executing the actual API request.
1545    ///
1546    /// ````text
1547    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1548    /// ````
1549    ///
1550    /// Sets the *delegate* property to the given value.
1551    pub fn delegate(
1552        mut self,
1553        new_value: &'a mut dyn common::Delegate,
1554    ) -> EndpointInsertCall<'a, C> {
1555        self._delegate = Some(new_value);
1556        self
1557    }
1558
1559    /// Set any additional parameter of the query string used in the request.
1560    /// It should be used to set parameters which are not yet available through their own
1561    /// setters.
1562    ///
1563    /// Please note that this method must not be used to set any of the known parameters
1564    /// which have their own setter method. If done anyway, the request will fail.
1565    ///
1566    /// # Additional Parameters
1567    ///
1568    /// * *alt* (query-string) - Data format for the response.
1569    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1570    /// * *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.
1571    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1572    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1573    /// * *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. Overrides userIp if both are provided.
1574    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1575    pub fn param<T>(mut self, name: T, value: T) -> EndpointInsertCall<'a, C>
1576    where
1577        T: AsRef<str>,
1578    {
1579        self._additional_params
1580            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1581        self
1582    }
1583
1584    /// Identifies the authorization scope for the method you are building.
1585    ///
1586    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1587    /// [`Scope::CloudPlatform`].
1588    ///
1589    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1590    /// tokens for more than one scope.
1591    ///
1592    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1593    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1594    /// sufficient, a read-write scope will do as well.
1595    pub fn add_scope<St>(mut self, scope: St) -> EndpointInsertCall<'a, C>
1596    where
1597        St: AsRef<str>,
1598    {
1599        self._scopes.insert(String::from(scope.as_ref()));
1600        self
1601    }
1602    /// Identifies the authorization scope(s) for the method you are building.
1603    ///
1604    /// See [`Self::add_scope()`] for details.
1605    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointInsertCall<'a, C>
1606    where
1607        I: IntoIterator<Item = St>,
1608        St: AsRef<str>,
1609    {
1610        self._scopes
1611            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1612        self
1613    }
1614
1615    /// Removes all scopes, and no default scope will be used either.
1616    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1617    /// for details).
1618    pub fn clear_scopes(mut self) -> EndpointInsertCall<'a, C> {
1619        self._scopes.clear();
1620        self
1621    }
1622}
1623
1624/// Lists endpoints for a project.
1625///
1626/// A builder for the *list* method supported by a *endpoint* resource.
1627/// It is not used directly, but through a [`EndpointMethods`] instance.
1628///
1629/// # Example
1630///
1631/// Instantiate a resource method builder
1632///
1633/// ```test_harness,no_run
1634/// # extern crate hyper;
1635/// # extern crate hyper_rustls;
1636/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
1637/// # async fn dox() {
1638/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1639///
1640/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1642/// #     secret,
1643/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1644/// # ).build().await.unwrap();
1645///
1646/// # let client = hyper_util::client::legacy::Client::builder(
1647/// #     hyper_util::rt::TokioExecutor::new()
1648/// # )
1649/// # .build(
1650/// #     hyper_rustls::HttpsConnectorBuilder::new()
1651/// #         .with_native_roots()
1652/// #         .unwrap()
1653/// #         .https_or_http()
1654/// #         .enable_http1()
1655/// #         .build()
1656/// # );
1657/// # let mut hub = ServiceRegistry::new(client, auth);
1658/// // You can configure optional parameters by calling the respective setters at will, and
1659/// // execute the final call using `doit()`.
1660/// // Values shown here are possibly random and not representative !
1661/// let result = hub.endpoints().list("project")
1662///              .page_token("amet")
1663///              .order_by("duo")
1664///              .max_results(51)
1665///              .filter("sed")
1666///              .doit().await;
1667/// # }
1668/// ```
1669pub struct EndpointListCall<'a, C>
1670where
1671    C: 'a,
1672{
1673    hub: &'a ServiceRegistry<C>,
1674    _project: String,
1675    _page_token: Option<String>,
1676    _order_by: Option<String>,
1677    _max_results: Option<u32>,
1678    _filter: Option<String>,
1679    _delegate: Option<&'a mut dyn common::Delegate>,
1680    _additional_params: HashMap<String, String>,
1681    _scopes: BTreeSet<String>,
1682}
1683
1684impl<'a, C> common::CallBuilder for EndpointListCall<'a, C> {}
1685
1686impl<'a, C> EndpointListCall<'a, C>
1687where
1688    C: common::Connector,
1689{
1690    /// Perform the operation you have build so far.
1691    pub async fn doit(mut self) -> common::Result<(common::Response, EndpointsListResponse)> {
1692        use std::borrow::Cow;
1693        use std::io::{Read, Seek};
1694
1695        use common::{url::Params, ToParts};
1696        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1697
1698        let mut dd = common::DefaultDelegate;
1699        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1700        dlg.begin(common::MethodInfo {
1701            id: "serviceregistry.endpoints.list",
1702            http_method: hyper::Method::GET,
1703        });
1704
1705        for &field in [
1706            "alt",
1707            "project",
1708            "pageToken",
1709            "orderBy",
1710            "maxResults",
1711            "filter",
1712        ]
1713        .iter()
1714        {
1715            if self._additional_params.contains_key(field) {
1716                dlg.finished(false);
1717                return Err(common::Error::FieldClash(field));
1718            }
1719        }
1720
1721        let mut params = Params::with_capacity(7 + self._additional_params.len());
1722        params.push("project", self._project);
1723        if let Some(value) = self._page_token.as_ref() {
1724            params.push("pageToken", value);
1725        }
1726        if let Some(value) = self._order_by.as_ref() {
1727            params.push("orderBy", value);
1728        }
1729        if let Some(value) = self._max_results.as_ref() {
1730            params.push("maxResults", value.to_string());
1731        }
1732        if let Some(value) = self._filter.as_ref() {
1733            params.push("filter", value);
1734        }
1735
1736        params.extend(self._additional_params.iter());
1737
1738        params.push("alt", "json");
1739        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints";
1740        if self._scopes.is_empty() {
1741            self._scopes
1742                .insert(Scope::CloudPlatform.as_ref().to_string());
1743        }
1744
1745        #[allow(clippy::single_element_loop)]
1746        for &(find_this, param_name) in [("{project}", "project")].iter() {
1747            url = params.uri_replacement(url, param_name, find_this, false);
1748        }
1749        {
1750            let to_remove = ["project"];
1751            params.remove_params(&to_remove);
1752        }
1753
1754        let url = params.parse_with_url(&url);
1755
1756        loop {
1757            let token = match self
1758                .hub
1759                .auth
1760                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1761                .await
1762            {
1763                Ok(token) => token,
1764                Err(e) => match dlg.token(e) {
1765                    Ok(token) => token,
1766                    Err(e) => {
1767                        dlg.finished(false);
1768                        return Err(common::Error::MissingToken(e));
1769                    }
1770                },
1771            };
1772            let mut req_result = {
1773                let client = &self.hub.client;
1774                dlg.pre_request();
1775                let mut req_builder = hyper::Request::builder()
1776                    .method(hyper::Method::GET)
1777                    .uri(url.as_str())
1778                    .header(USER_AGENT, self.hub._user_agent.clone());
1779
1780                if let Some(token) = token.as_ref() {
1781                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1782                }
1783
1784                let request = req_builder
1785                    .header(CONTENT_LENGTH, 0_u64)
1786                    .body(common::to_body::<String>(None));
1787
1788                client.request(request.unwrap()).await
1789            };
1790
1791            match req_result {
1792                Err(err) => {
1793                    if let common::Retry::After(d) = dlg.http_error(&err) {
1794                        sleep(d).await;
1795                        continue;
1796                    }
1797                    dlg.finished(false);
1798                    return Err(common::Error::HttpError(err));
1799                }
1800                Ok(res) => {
1801                    let (mut parts, body) = res.into_parts();
1802                    let mut body = common::Body::new(body);
1803                    if !parts.status.is_success() {
1804                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1805                        let error = serde_json::from_str(&common::to_string(&bytes));
1806                        let response = common::to_response(parts, bytes.into());
1807
1808                        if let common::Retry::After(d) =
1809                            dlg.http_failure(&response, error.as_ref().ok())
1810                        {
1811                            sleep(d).await;
1812                            continue;
1813                        }
1814
1815                        dlg.finished(false);
1816
1817                        return Err(match error {
1818                            Ok(value) => common::Error::BadRequest(value),
1819                            _ => common::Error::Failure(response),
1820                        });
1821                    }
1822                    let response = {
1823                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1824                        let encoded = common::to_string(&bytes);
1825                        match serde_json::from_str(&encoded) {
1826                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1827                            Err(error) => {
1828                                dlg.response_json_decode_error(&encoded, &error);
1829                                return Err(common::Error::JsonDecodeError(
1830                                    encoded.to_string(),
1831                                    error,
1832                                ));
1833                            }
1834                        }
1835                    };
1836
1837                    dlg.finished(true);
1838                    return Ok(response);
1839                }
1840            }
1841        }
1842    }
1843
1844    /// The project ID for this request.
1845    ///
1846    /// Sets the *project* path property to the given value.
1847    ///
1848    /// Even though the property as already been set when instantiating this call,
1849    /// we provide this method for API completeness.
1850    pub fn project(mut self, new_value: &str) -> EndpointListCall<'a, C> {
1851        self._project = new_value.to_string();
1852        self
1853    }
1854    /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
1855    ///
1856    /// Sets the *page token* query property to the given value.
1857    pub fn page_token(mut self, new_value: &str) -> EndpointListCall<'a, C> {
1858        self._page_token = Some(new_value.to_string());
1859        self
1860    }
1861    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
1862    ///
1863    /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
1864    ///
1865    /// Currently, only sorting by name or creationTimestamp desc is supported.
1866    ///
1867    /// Sets the *order by* query property to the given value.
1868    pub fn order_by(mut self, new_value: &str) -> EndpointListCall<'a, C> {
1869        self._order_by = Some(new_value.to_string());
1870        self
1871    }
1872    /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
1873    ///
1874    /// Sets the *max results* query property to the given value.
1875    pub fn max_results(mut self, new_value: u32) -> EndpointListCall<'a, C> {
1876        self._max_results = Some(new_value);
1877        self
1878    }
1879    /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
1880    ///
1881    /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
1882    ///
1883    /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
1884    ///
1885    /// Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.
1886    ///
1887    /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
1888    ///
1889    /// Sets the *filter* query property to the given value.
1890    pub fn filter(mut self, new_value: &str) -> EndpointListCall<'a, C> {
1891        self._filter = Some(new_value.to_string());
1892        self
1893    }
1894    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1895    /// while executing the actual API request.
1896    ///
1897    /// ````text
1898    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1899    /// ````
1900    ///
1901    /// Sets the *delegate* property to the given value.
1902    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EndpointListCall<'a, C> {
1903        self._delegate = Some(new_value);
1904        self
1905    }
1906
1907    /// Set any additional parameter of the query string used in the request.
1908    /// It should be used to set parameters which are not yet available through their own
1909    /// setters.
1910    ///
1911    /// Please note that this method must not be used to set any of the known parameters
1912    /// which have their own setter method. If done anyway, the request will fail.
1913    ///
1914    /// # Additional Parameters
1915    ///
1916    /// * *alt* (query-string) - Data format for the response.
1917    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1918    /// * *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.
1919    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1920    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1921    /// * *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. Overrides userIp if both are provided.
1922    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1923    pub fn param<T>(mut self, name: T, value: T) -> EndpointListCall<'a, C>
1924    where
1925        T: AsRef<str>,
1926    {
1927        self._additional_params
1928            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1929        self
1930    }
1931
1932    /// Identifies the authorization scope for the method you are building.
1933    ///
1934    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1935    /// [`Scope::CloudPlatform`].
1936    ///
1937    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1938    /// tokens for more than one scope.
1939    ///
1940    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1941    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1942    /// sufficient, a read-write scope will do as well.
1943    pub fn add_scope<St>(mut self, scope: St) -> EndpointListCall<'a, C>
1944    where
1945        St: AsRef<str>,
1946    {
1947        self._scopes.insert(String::from(scope.as_ref()));
1948        self
1949    }
1950    /// Identifies the authorization scope(s) for the method you are building.
1951    ///
1952    /// See [`Self::add_scope()`] for details.
1953    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointListCall<'a, C>
1954    where
1955        I: IntoIterator<Item = St>,
1956        St: AsRef<str>,
1957    {
1958        self._scopes
1959            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1960        self
1961    }
1962
1963    /// Removes all scopes, and no default scope will be used either.
1964    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1965    /// for details).
1966    pub fn clear_scopes(mut self) -> EndpointListCall<'a, C> {
1967        self._scopes.clear();
1968        self
1969    }
1970}
1971
1972/// Updates an endpoint. This method supports patch semantics.
1973///
1974/// A builder for the *patch* method supported by a *endpoint* resource.
1975/// It is not used directly, but through a [`EndpointMethods`] instance.
1976///
1977/// # Example
1978///
1979/// Instantiate a resource method builder
1980///
1981/// ```test_harness,no_run
1982/// # extern crate hyper;
1983/// # extern crate hyper_rustls;
1984/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
1985/// use serviceregistryalpha::api::Endpoint;
1986/// # async fn dox() {
1987/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1988///
1989/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1990/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1991/// #     secret,
1992/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1993/// # ).build().await.unwrap();
1994///
1995/// # let client = hyper_util::client::legacy::Client::builder(
1996/// #     hyper_util::rt::TokioExecutor::new()
1997/// # )
1998/// # .build(
1999/// #     hyper_rustls::HttpsConnectorBuilder::new()
2000/// #         .with_native_roots()
2001/// #         .unwrap()
2002/// #         .https_or_http()
2003/// #         .enable_http1()
2004/// #         .build()
2005/// # );
2006/// # let mut hub = ServiceRegistry::new(client, auth);
2007/// // As the method needs a request, you would usually fill it with the desired information
2008/// // into the respective structure. Some of the parts shown here might not be applicable !
2009/// // Values shown here are possibly random and not representative !
2010/// let mut req = Endpoint::default();
2011///
2012/// // You can configure optional parameters by calling the respective setters at will, and
2013/// // execute the final call using `doit()`.
2014/// // Values shown here are possibly random and not representative !
2015/// let result = hub.endpoints().patch(req, "project", "endpoint")
2016///              .doit().await;
2017/// # }
2018/// ```
2019pub struct EndpointPatchCall<'a, C>
2020where
2021    C: 'a,
2022{
2023    hub: &'a ServiceRegistry<C>,
2024    _request: Endpoint,
2025    _project: String,
2026    _endpoint: String,
2027    _delegate: Option<&'a mut dyn common::Delegate>,
2028    _additional_params: HashMap<String, String>,
2029    _scopes: BTreeSet<String>,
2030}
2031
2032impl<'a, C> common::CallBuilder for EndpointPatchCall<'a, C> {}
2033
2034impl<'a, C> EndpointPatchCall<'a, C>
2035where
2036    C: common::Connector,
2037{
2038    /// Perform the operation you have build so far.
2039    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2040        use std::borrow::Cow;
2041        use std::io::{Read, Seek};
2042
2043        use common::{url::Params, ToParts};
2044        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2045
2046        let mut dd = common::DefaultDelegate;
2047        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2048        dlg.begin(common::MethodInfo {
2049            id: "serviceregistry.endpoints.patch",
2050            http_method: hyper::Method::PATCH,
2051        });
2052
2053        for &field in ["alt", "project", "endpoint"].iter() {
2054            if self._additional_params.contains_key(field) {
2055                dlg.finished(false);
2056                return Err(common::Error::FieldClash(field));
2057            }
2058        }
2059
2060        let mut params = Params::with_capacity(5 + self._additional_params.len());
2061        params.push("project", self._project);
2062        params.push("endpoint", self._endpoint);
2063
2064        params.extend(self._additional_params.iter());
2065
2066        params.push("alt", "json");
2067        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints/{endpoint}";
2068        if self._scopes.is_empty() {
2069            self._scopes
2070                .insert(Scope::CloudPlatform.as_ref().to_string());
2071        }
2072
2073        #[allow(clippy::single_element_loop)]
2074        for &(find_this, param_name) in
2075            [("{project}", "project"), ("{endpoint}", "endpoint")].iter()
2076        {
2077            url = params.uri_replacement(url, param_name, find_this, false);
2078        }
2079        {
2080            let to_remove = ["endpoint", "project"];
2081            params.remove_params(&to_remove);
2082        }
2083
2084        let url = params.parse_with_url(&url);
2085
2086        let mut json_mime_type = mime::APPLICATION_JSON;
2087        let mut request_value_reader = {
2088            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2089            common::remove_json_null_values(&mut value);
2090            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2091            serde_json::to_writer(&mut dst, &value).unwrap();
2092            dst
2093        };
2094        let request_size = request_value_reader
2095            .seek(std::io::SeekFrom::End(0))
2096            .unwrap();
2097        request_value_reader
2098            .seek(std::io::SeekFrom::Start(0))
2099            .unwrap();
2100
2101        loop {
2102            let token = match self
2103                .hub
2104                .auth
2105                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2106                .await
2107            {
2108                Ok(token) => token,
2109                Err(e) => match dlg.token(e) {
2110                    Ok(token) => token,
2111                    Err(e) => {
2112                        dlg.finished(false);
2113                        return Err(common::Error::MissingToken(e));
2114                    }
2115                },
2116            };
2117            request_value_reader
2118                .seek(std::io::SeekFrom::Start(0))
2119                .unwrap();
2120            let mut req_result = {
2121                let client = &self.hub.client;
2122                dlg.pre_request();
2123                let mut req_builder = hyper::Request::builder()
2124                    .method(hyper::Method::PATCH)
2125                    .uri(url.as_str())
2126                    .header(USER_AGENT, self.hub._user_agent.clone());
2127
2128                if let Some(token) = token.as_ref() {
2129                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2130                }
2131
2132                let request = req_builder
2133                    .header(CONTENT_TYPE, json_mime_type.to_string())
2134                    .header(CONTENT_LENGTH, request_size as u64)
2135                    .body(common::to_body(
2136                        request_value_reader.get_ref().clone().into(),
2137                    ));
2138
2139                client.request(request.unwrap()).await
2140            };
2141
2142            match req_result {
2143                Err(err) => {
2144                    if let common::Retry::After(d) = dlg.http_error(&err) {
2145                        sleep(d).await;
2146                        continue;
2147                    }
2148                    dlg.finished(false);
2149                    return Err(common::Error::HttpError(err));
2150                }
2151                Ok(res) => {
2152                    let (mut parts, body) = res.into_parts();
2153                    let mut body = common::Body::new(body);
2154                    if !parts.status.is_success() {
2155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2156                        let error = serde_json::from_str(&common::to_string(&bytes));
2157                        let response = common::to_response(parts, bytes.into());
2158
2159                        if let common::Retry::After(d) =
2160                            dlg.http_failure(&response, error.as_ref().ok())
2161                        {
2162                            sleep(d).await;
2163                            continue;
2164                        }
2165
2166                        dlg.finished(false);
2167
2168                        return Err(match error {
2169                            Ok(value) => common::Error::BadRequest(value),
2170                            _ => common::Error::Failure(response),
2171                        });
2172                    }
2173                    let response = {
2174                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2175                        let encoded = common::to_string(&bytes);
2176                        match serde_json::from_str(&encoded) {
2177                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2178                            Err(error) => {
2179                                dlg.response_json_decode_error(&encoded, &error);
2180                                return Err(common::Error::JsonDecodeError(
2181                                    encoded.to_string(),
2182                                    error,
2183                                ));
2184                            }
2185                        }
2186                    };
2187
2188                    dlg.finished(true);
2189                    return Ok(response);
2190                }
2191            }
2192        }
2193    }
2194
2195    ///
2196    /// Sets the *request* property to the given value.
2197    ///
2198    /// Even though the property as already been set when instantiating this call,
2199    /// we provide this method for API completeness.
2200    pub fn request(mut self, new_value: Endpoint) -> EndpointPatchCall<'a, C> {
2201        self._request = new_value;
2202        self
2203    }
2204    /// The project ID for this request.
2205    ///
2206    /// Sets the *project* path property to the given value.
2207    ///
2208    /// Even though the property as already been set when instantiating this call,
2209    /// we provide this method for API completeness.
2210    pub fn project(mut self, new_value: &str) -> EndpointPatchCall<'a, C> {
2211        self._project = new_value.to_string();
2212        self
2213    }
2214    /// The name of the endpoint for this request.
2215    ///
2216    /// Sets the *endpoint* path property to the given value.
2217    ///
2218    /// Even though the property as already been set when instantiating this call,
2219    /// we provide this method for API completeness.
2220    pub fn endpoint(mut self, new_value: &str) -> EndpointPatchCall<'a, C> {
2221        self._endpoint = new_value.to_string();
2222        self
2223    }
2224    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2225    /// while executing the actual API request.
2226    ///
2227    /// ````text
2228    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2229    /// ````
2230    ///
2231    /// Sets the *delegate* property to the given value.
2232    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EndpointPatchCall<'a, C> {
2233        self._delegate = Some(new_value);
2234        self
2235    }
2236
2237    /// Set any additional parameter of the query string used in the request.
2238    /// It should be used to set parameters which are not yet available through their own
2239    /// setters.
2240    ///
2241    /// Please note that this method must not be used to set any of the known parameters
2242    /// which have their own setter method. If done anyway, the request will fail.
2243    ///
2244    /// # Additional Parameters
2245    ///
2246    /// * *alt* (query-string) - Data format for the response.
2247    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2248    /// * *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.
2249    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2250    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2251    /// * *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. Overrides userIp if both are provided.
2252    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2253    pub fn param<T>(mut self, name: T, value: T) -> EndpointPatchCall<'a, C>
2254    where
2255        T: AsRef<str>,
2256    {
2257        self._additional_params
2258            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2259        self
2260    }
2261
2262    /// Identifies the authorization scope for the method you are building.
2263    ///
2264    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2265    /// [`Scope::CloudPlatform`].
2266    ///
2267    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2268    /// tokens for more than one scope.
2269    ///
2270    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2271    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2272    /// sufficient, a read-write scope will do as well.
2273    pub fn add_scope<St>(mut self, scope: St) -> EndpointPatchCall<'a, C>
2274    where
2275        St: AsRef<str>,
2276    {
2277        self._scopes.insert(String::from(scope.as_ref()));
2278        self
2279    }
2280    /// Identifies the authorization scope(s) for the method you are building.
2281    ///
2282    /// See [`Self::add_scope()`] for details.
2283    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointPatchCall<'a, C>
2284    where
2285        I: IntoIterator<Item = St>,
2286        St: AsRef<str>,
2287    {
2288        self._scopes
2289            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2290        self
2291    }
2292
2293    /// Removes all scopes, and no default scope will be used either.
2294    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2295    /// for details).
2296    pub fn clear_scopes(mut self) -> EndpointPatchCall<'a, C> {
2297        self._scopes.clear();
2298        self
2299    }
2300}
2301
2302/// Updates an endpoint.
2303///
2304/// A builder for the *update* method supported by a *endpoint* resource.
2305/// It is not used directly, but through a [`EndpointMethods`] instance.
2306///
2307/// # Example
2308///
2309/// Instantiate a resource method builder
2310///
2311/// ```test_harness,no_run
2312/// # extern crate hyper;
2313/// # extern crate hyper_rustls;
2314/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
2315/// use serviceregistryalpha::api::Endpoint;
2316/// # async fn dox() {
2317/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2318///
2319/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2320/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2321/// #     secret,
2322/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2323/// # ).build().await.unwrap();
2324///
2325/// # let client = hyper_util::client::legacy::Client::builder(
2326/// #     hyper_util::rt::TokioExecutor::new()
2327/// # )
2328/// # .build(
2329/// #     hyper_rustls::HttpsConnectorBuilder::new()
2330/// #         .with_native_roots()
2331/// #         .unwrap()
2332/// #         .https_or_http()
2333/// #         .enable_http1()
2334/// #         .build()
2335/// # );
2336/// # let mut hub = ServiceRegistry::new(client, auth);
2337/// // As the method needs a request, you would usually fill it with the desired information
2338/// // into the respective structure. Some of the parts shown here might not be applicable !
2339/// // Values shown here are possibly random and not representative !
2340/// let mut req = Endpoint::default();
2341///
2342/// // You can configure optional parameters by calling the respective setters at will, and
2343/// // execute the final call using `doit()`.
2344/// // Values shown here are possibly random and not representative !
2345/// let result = hub.endpoints().update(req, "project", "endpoint")
2346///              .doit().await;
2347/// # }
2348/// ```
2349pub struct EndpointUpdateCall<'a, C>
2350where
2351    C: 'a,
2352{
2353    hub: &'a ServiceRegistry<C>,
2354    _request: Endpoint,
2355    _project: String,
2356    _endpoint: String,
2357    _delegate: Option<&'a mut dyn common::Delegate>,
2358    _additional_params: HashMap<String, String>,
2359    _scopes: BTreeSet<String>,
2360}
2361
2362impl<'a, C> common::CallBuilder for EndpointUpdateCall<'a, C> {}
2363
2364impl<'a, C> EndpointUpdateCall<'a, C>
2365where
2366    C: common::Connector,
2367{
2368    /// Perform the operation you have build so far.
2369    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2370        use std::borrow::Cow;
2371        use std::io::{Read, Seek};
2372
2373        use common::{url::Params, ToParts};
2374        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2375
2376        let mut dd = common::DefaultDelegate;
2377        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2378        dlg.begin(common::MethodInfo {
2379            id: "serviceregistry.endpoints.update",
2380            http_method: hyper::Method::PUT,
2381        });
2382
2383        for &field in ["alt", "project", "endpoint"].iter() {
2384            if self._additional_params.contains_key(field) {
2385                dlg.finished(false);
2386                return Err(common::Error::FieldClash(field));
2387            }
2388        }
2389
2390        let mut params = Params::with_capacity(5 + self._additional_params.len());
2391        params.push("project", self._project);
2392        params.push("endpoint", self._endpoint);
2393
2394        params.extend(self._additional_params.iter());
2395
2396        params.push("alt", "json");
2397        let mut url = self.hub._base_url.clone() + "{project}/global/endpoints/{endpoint}";
2398        if self._scopes.is_empty() {
2399            self._scopes
2400                .insert(Scope::CloudPlatform.as_ref().to_string());
2401        }
2402
2403        #[allow(clippy::single_element_loop)]
2404        for &(find_this, param_name) in
2405            [("{project}", "project"), ("{endpoint}", "endpoint")].iter()
2406        {
2407            url = params.uri_replacement(url, param_name, find_this, false);
2408        }
2409        {
2410            let to_remove = ["endpoint", "project"];
2411            params.remove_params(&to_remove);
2412        }
2413
2414        let url = params.parse_with_url(&url);
2415
2416        let mut json_mime_type = mime::APPLICATION_JSON;
2417        let mut request_value_reader = {
2418            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2419            common::remove_json_null_values(&mut value);
2420            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2421            serde_json::to_writer(&mut dst, &value).unwrap();
2422            dst
2423        };
2424        let request_size = request_value_reader
2425            .seek(std::io::SeekFrom::End(0))
2426            .unwrap();
2427        request_value_reader
2428            .seek(std::io::SeekFrom::Start(0))
2429            .unwrap();
2430
2431        loop {
2432            let token = match self
2433                .hub
2434                .auth
2435                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2436                .await
2437            {
2438                Ok(token) => token,
2439                Err(e) => match dlg.token(e) {
2440                    Ok(token) => token,
2441                    Err(e) => {
2442                        dlg.finished(false);
2443                        return Err(common::Error::MissingToken(e));
2444                    }
2445                },
2446            };
2447            request_value_reader
2448                .seek(std::io::SeekFrom::Start(0))
2449                .unwrap();
2450            let mut req_result = {
2451                let client = &self.hub.client;
2452                dlg.pre_request();
2453                let mut req_builder = hyper::Request::builder()
2454                    .method(hyper::Method::PUT)
2455                    .uri(url.as_str())
2456                    .header(USER_AGENT, self.hub._user_agent.clone());
2457
2458                if let Some(token) = token.as_ref() {
2459                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2460                }
2461
2462                let request = req_builder
2463                    .header(CONTENT_TYPE, json_mime_type.to_string())
2464                    .header(CONTENT_LENGTH, request_size as u64)
2465                    .body(common::to_body(
2466                        request_value_reader.get_ref().clone().into(),
2467                    ));
2468
2469                client.request(request.unwrap()).await
2470            };
2471
2472            match req_result {
2473                Err(err) => {
2474                    if let common::Retry::After(d) = dlg.http_error(&err) {
2475                        sleep(d).await;
2476                        continue;
2477                    }
2478                    dlg.finished(false);
2479                    return Err(common::Error::HttpError(err));
2480                }
2481                Ok(res) => {
2482                    let (mut parts, body) = res.into_parts();
2483                    let mut body = common::Body::new(body);
2484                    if !parts.status.is_success() {
2485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2486                        let error = serde_json::from_str(&common::to_string(&bytes));
2487                        let response = common::to_response(parts, bytes.into());
2488
2489                        if let common::Retry::After(d) =
2490                            dlg.http_failure(&response, error.as_ref().ok())
2491                        {
2492                            sleep(d).await;
2493                            continue;
2494                        }
2495
2496                        dlg.finished(false);
2497
2498                        return Err(match error {
2499                            Ok(value) => common::Error::BadRequest(value),
2500                            _ => common::Error::Failure(response),
2501                        });
2502                    }
2503                    let response = {
2504                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2505                        let encoded = common::to_string(&bytes);
2506                        match serde_json::from_str(&encoded) {
2507                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2508                            Err(error) => {
2509                                dlg.response_json_decode_error(&encoded, &error);
2510                                return Err(common::Error::JsonDecodeError(
2511                                    encoded.to_string(),
2512                                    error,
2513                                ));
2514                            }
2515                        }
2516                    };
2517
2518                    dlg.finished(true);
2519                    return Ok(response);
2520                }
2521            }
2522        }
2523    }
2524
2525    ///
2526    /// Sets the *request* property to the given value.
2527    ///
2528    /// Even though the property as already been set when instantiating this call,
2529    /// we provide this method for API completeness.
2530    pub fn request(mut self, new_value: Endpoint) -> EndpointUpdateCall<'a, C> {
2531        self._request = new_value;
2532        self
2533    }
2534    /// The project ID for this request.
2535    ///
2536    /// Sets the *project* path property to the given value.
2537    ///
2538    /// Even though the property as already been set when instantiating this call,
2539    /// we provide this method for API completeness.
2540    pub fn project(mut self, new_value: &str) -> EndpointUpdateCall<'a, C> {
2541        self._project = new_value.to_string();
2542        self
2543    }
2544    /// The name of the endpoint for this request.
2545    ///
2546    /// Sets the *endpoint* path property to the given value.
2547    ///
2548    /// Even though the property as already been set when instantiating this call,
2549    /// we provide this method for API completeness.
2550    pub fn endpoint(mut self, new_value: &str) -> EndpointUpdateCall<'a, C> {
2551        self._endpoint = new_value.to_string();
2552        self
2553    }
2554    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2555    /// while executing the actual API request.
2556    ///
2557    /// ````text
2558    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2559    /// ````
2560    ///
2561    /// Sets the *delegate* property to the given value.
2562    pub fn delegate(
2563        mut self,
2564        new_value: &'a mut dyn common::Delegate,
2565    ) -> EndpointUpdateCall<'a, C> {
2566        self._delegate = Some(new_value);
2567        self
2568    }
2569
2570    /// Set any additional parameter of the query string used in the request.
2571    /// It should be used to set parameters which are not yet available through their own
2572    /// setters.
2573    ///
2574    /// Please note that this method must not be used to set any of the known parameters
2575    /// which have their own setter method. If done anyway, the request will fail.
2576    ///
2577    /// # Additional Parameters
2578    ///
2579    /// * *alt* (query-string) - Data format for the response.
2580    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2581    /// * *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.
2582    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2583    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2584    /// * *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. Overrides userIp if both are provided.
2585    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2586    pub fn param<T>(mut self, name: T, value: T) -> EndpointUpdateCall<'a, C>
2587    where
2588        T: AsRef<str>,
2589    {
2590        self._additional_params
2591            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2592        self
2593    }
2594
2595    /// Identifies the authorization scope for the method you are building.
2596    ///
2597    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2598    /// [`Scope::CloudPlatform`].
2599    ///
2600    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2601    /// tokens for more than one scope.
2602    ///
2603    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2604    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2605    /// sufficient, a read-write scope will do as well.
2606    pub fn add_scope<St>(mut self, scope: St) -> EndpointUpdateCall<'a, C>
2607    where
2608        St: AsRef<str>,
2609    {
2610        self._scopes.insert(String::from(scope.as_ref()));
2611        self
2612    }
2613    /// Identifies the authorization scope(s) for the method you are building.
2614    ///
2615    /// See [`Self::add_scope()`] for details.
2616    pub fn add_scopes<I, St>(mut self, scopes: I) -> EndpointUpdateCall<'a, C>
2617    where
2618        I: IntoIterator<Item = St>,
2619        St: AsRef<str>,
2620    {
2621        self._scopes
2622            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2623        self
2624    }
2625
2626    /// Removes all scopes, and no default scope will be used either.
2627    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2628    /// for details).
2629    pub fn clear_scopes(mut self) -> EndpointUpdateCall<'a, C> {
2630        self._scopes.clear();
2631        self
2632    }
2633}
2634
2635/// Gets information about a specific operation.
2636///
2637/// A builder for the *get* method supported by a *operation* resource.
2638/// It is not used directly, but through a [`OperationMethods`] instance.
2639///
2640/// # Example
2641///
2642/// Instantiate a resource method builder
2643///
2644/// ```test_harness,no_run
2645/// # extern crate hyper;
2646/// # extern crate hyper_rustls;
2647/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
2648/// # async fn dox() {
2649/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2650///
2651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2653/// #     secret,
2654/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2655/// # ).build().await.unwrap();
2656///
2657/// # let client = hyper_util::client::legacy::Client::builder(
2658/// #     hyper_util::rt::TokioExecutor::new()
2659/// # )
2660/// # .build(
2661/// #     hyper_rustls::HttpsConnectorBuilder::new()
2662/// #         .with_native_roots()
2663/// #         .unwrap()
2664/// #         .https_or_http()
2665/// #         .enable_http1()
2666/// #         .build()
2667/// # );
2668/// # let mut hub = ServiceRegistry::new(client, auth);
2669/// // You can configure optional parameters by calling the respective setters at will, and
2670/// // execute the final call using `doit()`.
2671/// // Values shown here are possibly random and not representative !
2672/// let result = hub.operations().get("project", "operation")
2673///              .doit().await;
2674/// # }
2675/// ```
2676pub struct OperationGetCall<'a, C>
2677where
2678    C: 'a,
2679{
2680    hub: &'a ServiceRegistry<C>,
2681    _project: String,
2682    _operation: String,
2683    _delegate: Option<&'a mut dyn common::Delegate>,
2684    _additional_params: HashMap<String, String>,
2685    _scopes: BTreeSet<String>,
2686}
2687
2688impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
2689
2690impl<'a, C> OperationGetCall<'a, C>
2691where
2692    C: common::Connector,
2693{
2694    /// Perform the operation you have build so far.
2695    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2696        use std::borrow::Cow;
2697        use std::io::{Read, Seek};
2698
2699        use common::{url::Params, ToParts};
2700        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2701
2702        let mut dd = common::DefaultDelegate;
2703        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2704        dlg.begin(common::MethodInfo {
2705            id: "serviceregistry.operations.get",
2706            http_method: hyper::Method::GET,
2707        });
2708
2709        for &field in ["alt", "project", "operation"].iter() {
2710            if self._additional_params.contains_key(field) {
2711                dlg.finished(false);
2712                return Err(common::Error::FieldClash(field));
2713            }
2714        }
2715
2716        let mut params = Params::with_capacity(4 + self._additional_params.len());
2717        params.push("project", self._project);
2718        params.push("operation", self._operation);
2719
2720        params.extend(self._additional_params.iter());
2721
2722        params.push("alt", "json");
2723        let mut url = self.hub._base_url.clone() + "{project}/global/operations/{operation}";
2724        if self._scopes.is_empty() {
2725            self._scopes
2726                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
2727        }
2728
2729        #[allow(clippy::single_element_loop)]
2730        for &(find_this, param_name) in
2731            [("{project}", "project"), ("{operation}", "operation")].iter()
2732        {
2733            url = params.uri_replacement(url, param_name, find_this, false);
2734        }
2735        {
2736            let to_remove = ["operation", "project"];
2737            params.remove_params(&to_remove);
2738        }
2739
2740        let url = params.parse_with_url(&url);
2741
2742        loop {
2743            let token = match self
2744                .hub
2745                .auth
2746                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2747                .await
2748            {
2749                Ok(token) => token,
2750                Err(e) => match dlg.token(e) {
2751                    Ok(token) => token,
2752                    Err(e) => {
2753                        dlg.finished(false);
2754                        return Err(common::Error::MissingToken(e));
2755                    }
2756                },
2757            };
2758            let mut req_result = {
2759                let client = &self.hub.client;
2760                dlg.pre_request();
2761                let mut req_builder = hyper::Request::builder()
2762                    .method(hyper::Method::GET)
2763                    .uri(url.as_str())
2764                    .header(USER_AGENT, self.hub._user_agent.clone());
2765
2766                if let Some(token) = token.as_ref() {
2767                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2768                }
2769
2770                let request = req_builder
2771                    .header(CONTENT_LENGTH, 0_u64)
2772                    .body(common::to_body::<String>(None));
2773
2774                client.request(request.unwrap()).await
2775            };
2776
2777            match req_result {
2778                Err(err) => {
2779                    if let common::Retry::After(d) = dlg.http_error(&err) {
2780                        sleep(d).await;
2781                        continue;
2782                    }
2783                    dlg.finished(false);
2784                    return Err(common::Error::HttpError(err));
2785                }
2786                Ok(res) => {
2787                    let (mut parts, body) = res.into_parts();
2788                    let mut body = common::Body::new(body);
2789                    if !parts.status.is_success() {
2790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2791                        let error = serde_json::from_str(&common::to_string(&bytes));
2792                        let response = common::to_response(parts, bytes.into());
2793
2794                        if let common::Retry::After(d) =
2795                            dlg.http_failure(&response, error.as_ref().ok())
2796                        {
2797                            sleep(d).await;
2798                            continue;
2799                        }
2800
2801                        dlg.finished(false);
2802
2803                        return Err(match error {
2804                            Ok(value) => common::Error::BadRequest(value),
2805                            _ => common::Error::Failure(response),
2806                        });
2807                    }
2808                    let response = {
2809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2810                        let encoded = common::to_string(&bytes);
2811                        match serde_json::from_str(&encoded) {
2812                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2813                            Err(error) => {
2814                                dlg.response_json_decode_error(&encoded, &error);
2815                                return Err(common::Error::JsonDecodeError(
2816                                    encoded.to_string(),
2817                                    error,
2818                                ));
2819                            }
2820                        }
2821                    };
2822
2823                    dlg.finished(true);
2824                    return Ok(response);
2825                }
2826            }
2827        }
2828    }
2829
2830    /// The project ID for this request.
2831    ///
2832    /// Sets the *project* path property to the given value.
2833    ///
2834    /// Even though the property as already been set when instantiating this call,
2835    /// we provide this method for API completeness.
2836    pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C> {
2837        self._project = new_value.to_string();
2838        self
2839    }
2840    /// The name of the operation for this request.
2841    ///
2842    /// Sets the *operation* path property to the given value.
2843    ///
2844    /// Even though the property as already been set when instantiating this call,
2845    /// we provide this method for API completeness.
2846    pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C> {
2847        self._operation = new_value.to_string();
2848        self
2849    }
2850    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2851    /// while executing the actual API request.
2852    ///
2853    /// ````text
2854    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2855    /// ````
2856    ///
2857    /// Sets the *delegate* property to the given value.
2858    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
2859        self._delegate = Some(new_value);
2860        self
2861    }
2862
2863    /// Set any additional parameter of the query string used in the request.
2864    /// It should be used to set parameters which are not yet available through their own
2865    /// setters.
2866    ///
2867    /// Please note that this method must not be used to set any of the known parameters
2868    /// which have their own setter method. If done anyway, the request will fail.
2869    ///
2870    /// # Additional Parameters
2871    ///
2872    /// * *alt* (query-string) - Data format for the response.
2873    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2874    /// * *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.
2875    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2876    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2877    /// * *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. Overrides userIp if both are provided.
2878    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2879    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
2880    where
2881        T: AsRef<str>,
2882    {
2883        self._additional_params
2884            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2885        self
2886    }
2887
2888    /// Identifies the authorization scope for the method you are building.
2889    ///
2890    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2891    /// [`Scope::NdevCloudmanReadonly`].
2892    ///
2893    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2894    /// tokens for more than one scope.
2895    ///
2896    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2897    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2898    /// sufficient, a read-write scope will do as well.
2899    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
2900    where
2901        St: AsRef<str>,
2902    {
2903        self._scopes.insert(String::from(scope.as_ref()));
2904        self
2905    }
2906    /// Identifies the authorization scope(s) for the method you are building.
2907    ///
2908    /// See [`Self::add_scope()`] for details.
2909    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
2910    where
2911        I: IntoIterator<Item = St>,
2912        St: AsRef<str>,
2913    {
2914        self._scopes
2915            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2916        self
2917    }
2918
2919    /// Removes all scopes, and no default scope will be used either.
2920    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2921    /// for details).
2922    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
2923        self._scopes.clear();
2924        self
2925    }
2926}
2927
2928/// Lists all operations for a project.
2929///
2930/// A builder for the *list* method supported by a *operation* resource.
2931/// It is not used directly, but through a [`OperationMethods`] instance.
2932///
2933/// # Example
2934///
2935/// Instantiate a resource method builder
2936///
2937/// ```test_harness,no_run
2938/// # extern crate hyper;
2939/// # extern crate hyper_rustls;
2940/// # extern crate google_serviceregistryalpha as serviceregistryalpha;
2941/// # async fn dox() {
2942/// # use serviceregistryalpha::{ServiceRegistry, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2943///
2944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2946/// #     secret,
2947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2948/// # ).build().await.unwrap();
2949///
2950/// # let client = hyper_util::client::legacy::Client::builder(
2951/// #     hyper_util::rt::TokioExecutor::new()
2952/// # )
2953/// # .build(
2954/// #     hyper_rustls::HttpsConnectorBuilder::new()
2955/// #         .with_native_roots()
2956/// #         .unwrap()
2957/// #         .https_or_http()
2958/// #         .enable_http1()
2959/// #         .build()
2960/// # );
2961/// # let mut hub = ServiceRegistry::new(client, auth);
2962/// // You can configure optional parameters by calling the respective setters at will, and
2963/// // execute the final call using `doit()`.
2964/// // Values shown here are possibly random and not representative !
2965/// let result = hub.operations().list("project")
2966///              .page_token("gubergren")
2967///              .order_by("ea")
2968///              .max_results(2)
2969///              .filter("Lorem")
2970///              .doit().await;
2971/// # }
2972/// ```
2973pub struct OperationListCall<'a, C>
2974where
2975    C: 'a,
2976{
2977    hub: &'a ServiceRegistry<C>,
2978    _project: String,
2979    _page_token: Option<String>,
2980    _order_by: Option<String>,
2981    _max_results: Option<u32>,
2982    _filter: Option<String>,
2983    _delegate: Option<&'a mut dyn common::Delegate>,
2984    _additional_params: HashMap<String, String>,
2985    _scopes: BTreeSet<String>,
2986}
2987
2988impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
2989
2990impl<'a, C> OperationListCall<'a, C>
2991where
2992    C: common::Connector,
2993{
2994    /// Perform the operation you have build so far.
2995    pub async fn doit(mut self) -> common::Result<(common::Response, OperationsListResponse)> {
2996        use std::borrow::Cow;
2997        use std::io::{Read, Seek};
2998
2999        use common::{url::Params, ToParts};
3000        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3001
3002        let mut dd = common::DefaultDelegate;
3003        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3004        dlg.begin(common::MethodInfo {
3005            id: "serviceregistry.operations.list",
3006            http_method: hyper::Method::GET,
3007        });
3008
3009        for &field in [
3010            "alt",
3011            "project",
3012            "pageToken",
3013            "orderBy",
3014            "maxResults",
3015            "filter",
3016        ]
3017        .iter()
3018        {
3019            if self._additional_params.contains_key(field) {
3020                dlg.finished(false);
3021                return Err(common::Error::FieldClash(field));
3022            }
3023        }
3024
3025        let mut params = Params::with_capacity(7 + self._additional_params.len());
3026        params.push("project", self._project);
3027        if let Some(value) = self._page_token.as_ref() {
3028            params.push("pageToken", value);
3029        }
3030        if let Some(value) = self._order_by.as_ref() {
3031            params.push("orderBy", value);
3032        }
3033        if let Some(value) = self._max_results.as_ref() {
3034            params.push("maxResults", value.to_string());
3035        }
3036        if let Some(value) = self._filter.as_ref() {
3037            params.push("filter", value);
3038        }
3039
3040        params.extend(self._additional_params.iter());
3041
3042        params.push("alt", "json");
3043        let mut url = self.hub._base_url.clone() + "{project}/global/operations";
3044        if self._scopes.is_empty() {
3045            self._scopes
3046                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
3047        }
3048
3049        #[allow(clippy::single_element_loop)]
3050        for &(find_this, param_name) in [("{project}", "project")].iter() {
3051            url = params.uri_replacement(url, param_name, find_this, false);
3052        }
3053        {
3054            let to_remove = ["project"];
3055            params.remove_params(&to_remove);
3056        }
3057
3058        let url = params.parse_with_url(&url);
3059
3060        loop {
3061            let token = match self
3062                .hub
3063                .auth
3064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3065                .await
3066            {
3067                Ok(token) => token,
3068                Err(e) => match dlg.token(e) {
3069                    Ok(token) => token,
3070                    Err(e) => {
3071                        dlg.finished(false);
3072                        return Err(common::Error::MissingToken(e));
3073                    }
3074                },
3075            };
3076            let mut req_result = {
3077                let client = &self.hub.client;
3078                dlg.pre_request();
3079                let mut req_builder = hyper::Request::builder()
3080                    .method(hyper::Method::GET)
3081                    .uri(url.as_str())
3082                    .header(USER_AGENT, self.hub._user_agent.clone());
3083
3084                if let Some(token) = token.as_ref() {
3085                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3086                }
3087
3088                let request = req_builder
3089                    .header(CONTENT_LENGTH, 0_u64)
3090                    .body(common::to_body::<String>(None));
3091
3092                client.request(request.unwrap()).await
3093            };
3094
3095            match req_result {
3096                Err(err) => {
3097                    if let common::Retry::After(d) = dlg.http_error(&err) {
3098                        sleep(d).await;
3099                        continue;
3100                    }
3101                    dlg.finished(false);
3102                    return Err(common::Error::HttpError(err));
3103                }
3104                Ok(res) => {
3105                    let (mut parts, body) = res.into_parts();
3106                    let mut body = common::Body::new(body);
3107                    if !parts.status.is_success() {
3108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3109                        let error = serde_json::from_str(&common::to_string(&bytes));
3110                        let response = common::to_response(parts, bytes.into());
3111
3112                        if let common::Retry::After(d) =
3113                            dlg.http_failure(&response, error.as_ref().ok())
3114                        {
3115                            sleep(d).await;
3116                            continue;
3117                        }
3118
3119                        dlg.finished(false);
3120
3121                        return Err(match error {
3122                            Ok(value) => common::Error::BadRequest(value),
3123                            _ => common::Error::Failure(response),
3124                        });
3125                    }
3126                    let response = {
3127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3128                        let encoded = common::to_string(&bytes);
3129                        match serde_json::from_str(&encoded) {
3130                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3131                            Err(error) => {
3132                                dlg.response_json_decode_error(&encoded, &error);
3133                                return Err(common::Error::JsonDecodeError(
3134                                    encoded.to_string(),
3135                                    error,
3136                                ));
3137                            }
3138                        }
3139                    };
3140
3141                    dlg.finished(true);
3142                    return Ok(response);
3143                }
3144            }
3145        }
3146    }
3147
3148    /// The project ID for this request.
3149    ///
3150    /// Sets the *project* path property to the given value.
3151    ///
3152    /// Even though the property as already been set when instantiating this call,
3153    /// we provide this method for API completeness.
3154    pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C> {
3155        self._project = new_value.to_string();
3156        self
3157    }
3158    /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
3159    ///
3160    /// Sets the *page token* query property to the given value.
3161    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
3162        self._page_token = Some(new_value.to_string());
3163        self
3164    }
3165    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.
3166    ///
3167    /// You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.
3168    ///
3169    /// Currently, only sorting by name or creationTimestamp desc is supported.
3170    ///
3171    /// Sets the *order by* query property to the given value.
3172    pub fn order_by(mut self, new_value: &str) -> OperationListCall<'a, C> {
3173        self._order_by = Some(new_value.to_string());
3174        self
3175    }
3176    /// The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
3177    ///
3178    /// Sets the *max results* query property to the given value.
3179    pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C> {
3180        self._max_results = Some(new_value);
3181        self
3182    }
3183    /// Sets a filter expression for filtering listed resources, in the form filter={expression}. Your {expression} must be in the format: field_name comparison_string literal_string.
3184    ///
3185    /// The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.
3186    ///
3187    /// For example, to filter for instances that do not have a name of example-instance, you would use filter=name ne example-instance.
3188    ///
3189    /// Compute Engine Beta API Only: When filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. Use filtering on nested fields to take advantage of labels to organize and search for results based on label values.
3190    ///
3191    /// The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
3192    ///
3193    /// Sets the *filter* query property to the given value.
3194    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
3195        self._filter = Some(new_value.to_string());
3196        self
3197    }
3198    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3199    /// while executing the actual API request.
3200    ///
3201    /// ````text
3202    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3203    /// ````
3204    ///
3205    /// Sets the *delegate* property to the given value.
3206    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
3207        self._delegate = Some(new_value);
3208        self
3209    }
3210
3211    /// Set any additional parameter of the query string used in the request.
3212    /// It should be used to set parameters which are not yet available through their own
3213    /// setters.
3214    ///
3215    /// Please note that this method must not be used to set any of the known parameters
3216    /// which have their own setter method. If done anyway, the request will fail.
3217    ///
3218    /// # Additional Parameters
3219    ///
3220    /// * *alt* (query-string) - Data format for the response.
3221    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3222    /// * *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.
3223    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3224    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3225    /// * *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. Overrides userIp if both are provided.
3226    /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3227    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
3228    where
3229        T: AsRef<str>,
3230    {
3231        self._additional_params
3232            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3233        self
3234    }
3235
3236    /// Identifies the authorization scope for the method you are building.
3237    ///
3238    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3239    /// [`Scope::NdevCloudmanReadonly`].
3240    ///
3241    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3242    /// tokens for more than one scope.
3243    ///
3244    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3245    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3246    /// sufficient, a read-write scope will do as well.
3247    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
3248    where
3249        St: AsRef<str>,
3250    {
3251        self._scopes.insert(String::from(scope.as_ref()));
3252        self
3253    }
3254    /// Identifies the authorization scope(s) for the method you are building.
3255    ///
3256    /// See [`Self::add_scope()`] for details.
3257    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
3258    where
3259        I: IntoIterator<Item = St>,
3260        St: AsRef<str>,
3261    {
3262        self._scopes
3263            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3264        self
3265    }
3266
3267    /// Removes all scopes, and no default scope will be used either.
3268    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3269    /// for details).
3270    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
3271        self._scopes.clear();
3272        self
3273    }
3274}