google_deploymentmanager2_beta2/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 DeploymentManager 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_deploymentmanager2_beta2 as deploymentmanager2_beta2;
63/// use deploymentmanager2_beta2::api::Deployment;
64/// use deploymentmanager2_beta2::{Result, Error};
65/// # async fn dox() {
66/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67///
68/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
69/// // `client_secret`, among other things.
70/// let secret: yup_oauth2::ApplicationSecret = Default::default();
71/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
72/// // unless you replace `None` with the desired Flow.
73/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
74/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
75/// // retrieve them from storage.
76/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
77/// .with_native_roots()
78/// .unwrap()
79/// .https_only()
80/// .enable_http2()
81/// .build();
82///
83/// let executor = hyper_util::rt::TokioExecutor::new();
84/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
85/// secret,
86/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
87/// yup_oauth2::client::CustomHyperClientBuilder::from(
88/// hyper_util::client::legacy::Client::builder(executor).build(connector),
89/// ),
90/// ).build().await.unwrap();
91///
92/// let client = hyper_util::client::legacy::Client::builder(
93/// hyper_util::rt::TokioExecutor::new()
94/// )
95/// .build(
96/// hyper_rustls::HttpsConnectorBuilder::new()
97/// .with_native_roots()
98/// .unwrap()
99/// .https_or_http()
100/// .enable_http2()
101/// .build()
102/// );
103/// let mut hub = DeploymentManager::new(client, auth);
104/// // As the method needs a request, you would usually fill it with the desired information
105/// // into the respective structure. Some of the parts shown here might not be applicable !
106/// // Values shown here are possibly random and not representative !
107/// let mut req = Deployment::default();
108///
109/// // You can configure optional parameters by calling the respective setters at will, and
110/// // execute the final call using `doit()`.
111/// // Values shown here are possibly random and not representative !
112/// let result = hub.deployments().patch(req, "project", "deployment")
113/// .update_policy("ipsum")
114/// .delete_policy("gubergren")
115/// .create_policy("Lorem")
116/// .doit().await;
117///
118/// match result {
119/// Err(e) => match e {
120/// // The Error enum provides details about what exactly happened.
121/// // You can also just use its `Debug`, `Display` or `Error` traits
122/// Error::HttpError(_)
123/// |Error::Io(_)
124/// |Error::MissingAPIKey
125/// |Error::MissingToken(_)
126/// |Error::Cancelled
127/// |Error::UploadSizeLimitExceeded(_, _)
128/// |Error::Failure(_)
129/// |Error::BadRequest(_)
130/// |Error::FieldClash(_)
131/// |Error::JsonDecodeError(_, _) => println!("{}", e),
132/// },
133/// Ok(res) => println!("Success: {:?}", res),
134/// }
135/// # }
136/// ```
137#[derive(Clone)]
138pub struct DeploymentManager<C> {
139 pub client: common::Client<C>,
140 pub auth: Box<dyn common::GetToken>,
141 _user_agent: String,
142 _base_url: String,
143 _root_url: String,
144}
145
146impl<C> common::Hub for DeploymentManager<C> {}
147
148impl<'a, C> DeploymentManager<C> {
149 pub fn new<A: 'static + common::GetToken>(
150 client: common::Client<C>,
151 auth: A,
152 ) -> DeploymentManager<C> {
153 DeploymentManager {
154 client,
155 auth: Box::new(auth),
156 _user_agent: "google-api-rust-client/7.0.0".to_string(),
157 _base_url: "https://www.googleapis.com/deploymentmanager/v2beta2/projects/".to_string(),
158 _root_url: "https://www.googleapis.com/".to_string(),
159 }
160 }
161
162 pub fn deployments(&'a self) -> DeploymentMethods<'a, C> {
163 DeploymentMethods { hub: self }
164 }
165 pub fn manifests(&'a self) -> ManifestMethods<'a, C> {
166 ManifestMethods { hub: self }
167 }
168 pub fn operations(&'a self) -> OperationMethods<'a, C> {
169 OperationMethods { hub: self }
170 }
171 pub fn resources(&'a self) -> ResourceMethods<'a, C> {
172 ResourceMethods { hub: self }
173 }
174 pub fn types(&'a self) -> TypeMethods<'a, C> {
175 TypeMethods { hub: self }
176 }
177
178 /// Set the user-agent header field to use in all requests to the server.
179 /// It defaults to `google-api-rust-client/7.0.0`.
180 ///
181 /// Returns the previously set user-agent.
182 pub fn user_agent(&mut self, agent_name: String) -> String {
183 std::mem::replace(&mut self._user_agent, agent_name)
184 }
185
186 /// Set the base url to use in all requests to the server.
187 /// It defaults to `https://www.googleapis.com/deploymentmanager/v2beta2/projects/`.
188 ///
189 /// Returns the previously set base url.
190 pub fn base_url(&mut self, new_base_url: String) -> String {
191 std::mem::replace(&mut self._base_url, new_base_url)
192 }
193
194 /// Set the root url to use in all requests to the server.
195 /// It defaults to `https://www.googleapis.com/`.
196 ///
197 /// Returns the previously set root url.
198 pub fn root_url(&mut self, new_root_url: String) -> String {
199 std::mem::replace(&mut self._root_url, new_root_url)
200 }
201}
202
203// ############
204// SCHEMAS ###
205// ##########
206/// # Activities
207///
208/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
209/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
210///
211/// * [delete deployments](DeploymentDeleteCall) (none)
212/// * [get deployments](DeploymentGetCall) (response)
213/// * [insert deployments](DeploymentInsertCall) (request)
214/// * [list deployments](DeploymentListCall) (none)
215/// * [patch deployments](DeploymentPatchCall) (request)
216/// * [update deployments](DeploymentUpdateCall) (request)
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct Deployment {
221 /// An optional user-provided description of the deployment.
222 pub description: Option<String>,
223 /// Specifies a fingerprint for update() requests. A fingerprint is a randomly generated value that must be provided in update() requests to perform optimistic locking. This ensures optimistic concurrency so that only one update can be performed at a time. The fingerprint is initially generated by Deployment Manager and changes after every request to modify data. To get the latest fingerprint value, perform a get() request to a deployment.
224 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
225 pub fingerprint: Option<Vec<u8>>,
226 /// [Output Only] Unique identifier for the resource; defined by the server.
227 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
228 pub id: Option<u64>,
229 /// [Output Only] Timestamp when the deployment was created, in RFC3339 text format .
230 #[serde(rename = "insertTime")]
231 pub insert_time: Option<String>,
232 /// [Input Only] Specifies how Deployment Manager should apply this template. Possible options are PREVIEW, UPDATE, and CANCEL.
233 ///
234 /// PREVIEW creates a deployment and creates "shell" resources but does not actually instantiate these resources. This allows you to preview what your deployment looks like. You can use this intent to preview updates to deployments or preview new deployments. You must provide a target.config with a configuration for this intent. After previewing a deployment, you can deploy your resources by making a request with the UPDATE intent or you can CANCEL the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it.
235 ///
236 /// UPDATE performs an update to the underlying resources in a deployment. If you provide a populated target.config field with this request, Deployment Manager uses that configuration to perform an update. If you had previewed this update beforehand, and do not supply a target.config or provide an empty target.config, Deployment Manager uses the last previewed configuration.
237 ///
238 /// CANCEL cancels an update that is in PREVIEW or UPDATE but does not undo any changes already made.
239 pub intent: Option<String>,
240 /// [Output Only] URL of the manifest representing the last manifest that was successfully deployed.
241 pub manifest: Option<String>,
242 /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and 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.
243 pub name: Option<String>,
244 /// [Output Only] The current state of the deployment. This can be DEPLOYED, DEPLOYMENT_FAILED, PREVIEWING, UPDATING, and CANCELING.
245 pub state: Option<String>,
246 /// [Input Only] The parameters that define your deployment, including the deployment configuration and relevant templates.
247 pub target: Option<TargetConfiguration>,
248 /// [Output Only] If Deployment Manager is currently updating or previewing an update to this deployment, the updated configuration appears here.
249 pub update: Option<DeploymentUpdate>,
250 /// [Output Only] Timestamp when the deployment was updated, in RFC3339 text format .
251 #[serde(rename = "updateTime")]
252 pub update_time: Option<String>,
253}
254
255impl common::RequestValue for Deployment {}
256impl common::Resource for Deployment {}
257impl common::ResponseResult for Deployment {}
258
259///
260///
261/// This type is not used in any activity, and only used as *part* of another schema.
262///
263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
264#[serde_with::serde_as]
265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
266pub struct DeploymentUpdate {
267 /// [Output Only] List of all errors encountered while trying to enact the update.
268 pub errors: Option<Vec<String>>,
269 /// [Output Only] URL of the manifest representing the update configuration of this deployment.
270 pub manifest: Option<String>,
271}
272
273impl common::Part for DeploymentUpdate {}
274
275/// A response containing a partial list of deployments and a page token used to build the next request if the request has been truncated.
276///
277/// # Activities
278///
279/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
280/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
281///
282/// * [list deployments](DeploymentListCall) (response)
283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
284#[serde_with::serde_as]
285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
286pub struct DeploymentsListResponse {
287 /// [Output Only] The deployments contained in this response.
288 pub deployments: Option<Vec<Deployment>>,
289 /// [Output Only] A token used to continue a truncated list request.
290 #[serde(rename = "nextPageToken")]
291 pub next_page_token: Option<String>,
292}
293
294impl common::ResponseResult for DeploymentsListResponse {}
295
296///
297///
298/// This type is not used in any activity, and only used as *part* of another schema.
299///
300#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
301#[serde_with::serde_as]
302#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
303pub struct ImportFile {
304 /// The contents of the file.
305 pub content: Option<String>,
306 /// The name of the file.
307 pub name: Option<String>,
308}
309
310impl common::Part for ImportFile {}
311
312/// # Activities
313///
314/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
315/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
316///
317/// * [get manifests](ManifestGetCall) (response)
318/// * [list manifests](ManifestListCall) (none)
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct Manifest {
323 /// [Output Only] The YAML configuration for this manifest.
324 pub config: Option<String>,
325 /// [Output Only] The fully-expanded configuration file, including any templates and references.
326 #[serde(rename = "evaluatedConfig")]
327 pub evaluated_config: Option<String>,
328 /// [Output Only] Unique identifier for the resource; defined by the server.
329 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
330 pub id: Option<u64>,
331 /// [Output Only] The imported files for this manifest.
332 pub imports: Option<Vec<ImportFile>>,
333 /// [Output Only] Timestamp when the manifest was created, in RFC3339 text format.
334 #[serde(rename = "insertTime")]
335 pub insert_time: Option<String>,
336 /// [Output Only] The YAML layout for this manifest.
337 pub layout: Option<String>,
338 /// [Output Only] The name of the manifest.
339 pub name: Option<String>,
340 /// [Output Only] Self link for the manifest.
341 #[serde(rename = "selfLink")]
342 pub self_link: Option<String>,
343}
344
345impl common::Resource for Manifest {}
346impl common::ResponseResult for Manifest {}
347
348/// A response containing a partial list of manifests and a page token used to build the next request if the request has been truncated.
349///
350/// # Activities
351///
352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
354///
355/// * [list manifests](ManifestListCall) (response)
356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
357#[serde_with::serde_as]
358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
359pub struct ManifestsListResponse {
360 /// [Output Only] Manifests contained in this list response.
361 pub manifests: Option<Vec<Manifest>>,
362 /// [Output Only] A token used to continue a truncated list request.
363 #[serde(rename = "nextPageToken")]
364 pub next_page_token: Option<String>,
365}
366
367impl common::ResponseResult for ManifestsListResponse {}
368
369/// An Operation resource, used to manage asynchronous API requests.
370///
371/// # Activities
372///
373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
375///
376/// * [delete deployments](DeploymentDeleteCall) (response)
377/// * [insert deployments](DeploymentInsertCall) (response)
378/// * [patch deployments](DeploymentPatchCall) (response)
379/// * [update deployments](DeploymentUpdateCall) (response)
380/// * [get operations](OperationGetCall) (response)
381/// * [list operations](OperationListCall) (none)
382#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
383#[serde_with::serde_as]
384#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
385pub struct Operation {
386 /// [Output Only] Reserved for future use.
387 #[serde(rename = "clientOperationId")]
388 pub client_operation_id: Option<String>,
389 /// [Output Only] Creation timestamp in RFC3339 text format.
390 #[serde(rename = "creationTimestamp")]
391 pub creation_timestamp: Option<String>,
392 /// [Output Only] A textual description of the operation, which is set when the operation is created.
393 pub description: Option<String>,
394 /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format.
395 #[serde(rename = "endTime")]
396 pub end_time: Option<String>,
397 /// [Output Only] If errors are generated during processing of the operation, this field will be populated.
398 pub error: Option<OperationError>,
399 /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND.
400 #[serde(rename = "httpErrorMessage")]
401 pub http_error_message: Option<String>,
402 /// [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.
403 #[serde(rename = "httpErrorStatusCode")]
404 pub http_error_status_code: Option<i32>,
405 /// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
406 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
407 pub id: Option<u64>,
408 /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format.
409 #[serde(rename = "insertTime")]
410 pub insert_time: Option<String>,
411 /// [Output Only] Type of the resource. Always compute#operation for Operation resources.
412 pub kind: Option<String>,
413 /// [Output Only] Name of the resource.
414 pub name: Option<String>,
415 /// [Output Only] The type of operation, such as insert, update, or delete, and so on.
416 #[serde(rename = "operationType")]
417 pub operation_type: Option<String>,
418 /// [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.
419 pub progress: Option<i32>,
420 /// [Output Only] The URL of the region where the operation resides. Only available when performing regional operations.
421 pub region: Option<String>,
422 /// [Output Only] Server-defined URL for the resource.
423 #[serde(rename = "selfLink")]
424 pub self_link: Option<String>,
425 /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format.
426 #[serde(rename = "startTime")]
427 pub start_time: Option<String>,
428 /// [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE.
429 pub status: Option<String>,
430 /// [Output Only] An optional textual description of the current status of the operation.
431 #[serde(rename = "statusMessage")]
432 pub status_message: Option<String>,
433 /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource.
434 #[serde(rename = "targetId")]
435 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
436 pub target_id: Option<u64>,
437 /// [Output Only] The URL of the resource that the operation modifies.
438 #[serde(rename = "targetLink")]
439 pub target_link: Option<String>,
440 /// [Output Only] User who requested the operation, for example: user@example.com.
441 pub user: Option<String>,
442 /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
443 pub warnings: Option<Vec<OperationWarnings>>,
444 /// [Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations.
445 pub zone: Option<String>,
446}
447
448impl common::Resource for Operation {}
449impl common::ResponseResult for Operation {}
450
451/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated.
452///
453/// # Activities
454///
455/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
457///
458/// * [list operations](OperationListCall) (response)
459#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
460#[serde_with::serde_as]
461#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
462pub struct OperationsListResponse {
463 /// [Output Only] A token used to continue a truncated list request.
464 #[serde(rename = "nextPageToken")]
465 pub next_page_token: Option<String>,
466 /// [Output Only] Operations contained in this list response.
467 pub operations: Option<Vec<Operation>>,
468}
469
470impl common::ResponseResult for OperationsListResponse {}
471
472/// # Activities
473///
474/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
475/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
476///
477/// * [get resources](ResourceGetCall) (response)
478/// * [list resources](ResourceListCall) (none)
479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
480#[serde_with::serde_as]
481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
482pub struct Resource {
483 /// [Output Only] The evaluated properties of the resource with references expanded. Returned as serialized YAML.
484 #[serde(rename = "finalProperties")]
485 pub final_properties: Option<String>,
486 /// [Output Only] Unique identifier for the resource; defined by the server.
487 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
488 pub id: Option<u64>,
489 /// [Output Only] Timestamp when the resource was created or acquired, in RFC3339 text format .
490 #[serde(rename = "insertTime")]
491 pub insert_time: Option<String>,
492 /// [Output Only] URL of the manifest representing the current configuration of this resource.
493 pub manifest: Option<String>,
494 /// [Output Only] The name of the resource as it appears in the YAML config.
495 pub name: Option<String>,
496 /// [Output Only] The current properties of the resource before any references have been filled in. Returned as serialized YAML.
497 pub properties: Option<String>,
498 /// [Output Only] The type of the resource, for example compute.v1.instance, or replicaPools.v1beta2.instanceGroupManager.
499 #[serde(rename = "type")]
500 pub type_: Option<String>,
501 /// [Output Only] If Deployment Manager is currently updating or previewing an update to this resource, the updated configuration appears here.
502 pub update: Option<ResourceUpdate>,
503 /// [Output Only] Timestamp when the resource was updated, in RFC3339 text format .
504 #[serde(rename = "updateTime")]
505 pub update_time: Option<String>,
506 /// [Output Only] The URL of the actual resource.
507 pub url: Option<String>,
508}
509
510impl common::Resource for Resource {}
511impl common::ResponseResult for Resource {}
512
513///
514///
515/// This type is not used in any activity, and only used as *part* of another schema.
516///
517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
518#[serde_with::serde_as]
519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
520pub struct ResourceUpdate {
521 /// [Output Only] List of all errors encountered while trying to enact update.intent.
522 pub errors: Option<Vec<String>>,
523 /// [Output Only] The expanded properties of the resource with reference values expanded. Returned as serialized YAML.
524 #[serde(rename = "finalProperties")]
525 pub final_properties: Option<String>,
526 /// [Output Only] The intent of the resource: PREVIEW, UPDATE, or CANCEL.
527 pub intent: Option<String>,
528 /// [Output Only] URL of the manifest representing the update configuration of this resource.
529 pub manifest: Option<String>,
530 /// [Output Only] The set of updated properties for this resource, before references are expanded. Returned as serialized YAML.
531 pub properties: Option<String>,
532 /// [Output Only] The state of the resource.
533 pub state: Option<String>,
534}
535
536impl common::Part for ResourceUpdate {}
537
538/// A response containing a partial list of resources and a page token used to build the next request if the request has been truncated.
539///
540/// # Activities
541///
542/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
543/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
544///
545/// * [list resources](ResourceListCall) (response)
546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
547#[serde_with::serde_as]
548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
549pub struct ResourcesListResponse {
550 /// A token used to continue a truncated list request.
551 #[serde(rename = "nextPageToken")]
552 pub next_page_token: Option<String>,
553 /// Resources contained in this list response.
554 pub resources: Option<Vec<Resource>>,
555}
556
557impl common::ResponseResult for ResourcesListResponse {}
558
559///
560///
561/// This type is not used in any activity, and only used as *part* of another schema.
562///
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct TargetConfiguration {
567 /// The configuration to use for this deployment.
568 pub config: Option<String>,
569 /// Specifies any files to import for this configuration. This can be used to import templates or other files. For example, you might import a text file in order to use the file in a template.
570 pub imports: Option<Vec<ImportFile>>,
571}
572
573impl common::Part for TargetConfiguration {}
574
575/// A resource type supported by Deployment Manager.
576///
577/// # Activities
578///
579/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
580/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
581///
582/// * [list types](TypeListCall) (none)
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct Type {
587 /// [Output Only] Unique identifier for the resource; defined by the server.
588 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
589 pub id: Option<u64>,
590 /// [Output Only] Timestamp when the type was created, in RFC3339 text format.
591 #[serde(rename = "insertTime")]
592 pub insert_time: Option<String>,
593 /// Name of the type.
594 pub name: Option<String>,
595 /// [Output Only] Self link for the type.
596 #[serde(rename = "selfLink")]
597 pub self_link: Option<String>,
598}
599
600impl common::Resource for Type {}
601
602/// A response that returns all Types supported by Deployment Manager
603///
604/// # Activities
605///
606/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
607/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
608///
609/// * [list types](TypeListCall) (response)
610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
611#[serde_with::serde_as]
612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
613pub struct TypesListResponse {
614 /// A token used to continue a truncated list request.
615 #[serde(rename = "nextPageToken")]
616 pub next_page_token: Option<String>,
617 /// [Output Only] A list of resource types supported by Deployment Manager.
618 pub types: Option<Vec<Type>>,
619}
620
621impl common::ResponseResult for TypesListResponse {}
622
623/// [Output Only] If errors are generated during processing of the operation, this field will be populated.
624///
625/// This type is not used in any activity, and only used as *part* of another schema.
626///
627#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
628#[serde_with::serde_as]
629#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
630pub struct OperationError {
631 /// [Output Only] The array of errors encountered while processing this operation.
632 pub errors: Option<Vec<OperationErrorErrors>>,
633}
634
635impl common::NestedType for OperationError {}
636impl common::Part for OperationError {}
637
638/// [Output Only] The array of errors encountered while processing this operation.
639///
640/// This type is not used in any activity, and only used as *part* of another schema.
641///
642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
643#[serde_with::serde_as]
644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
645pub struct OperationErrorErrors {
646 /// [Output Only] The error type identifier for this error.
647 pub code: Option<String>,
648 /// [Output Only] Indicates the field in the request which caused the error. This property is optional.
649 pub location: Option<String>,
650 /// [Output Only] An optional, human-readable error message.
651 pub message: Option<String>,
652}
653
654impl common::NestedType for OperationErrorErrors {}
655impl common::Part for OperationErrorErrors {}
656
657/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
658///
659/// This type is not used in any activity, and only used as *part* of another schema.
660///
661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
662#[serde_with::serde_as]
663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
664pub struct OperationWarnings {
665 /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
666 pub code: Option<String>,
667 /// [Output Only] Metadata about this warning in key: value format. For example:
668 /// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
669 pub data: Option<Vec<OperationWarningsData>>,
670 /// [Output Only] A human-readable description of the warning code.
671 pub message: Option<String>,
672}
673
674impl common::NestedType for OperationWarnings {}
675impl common::Part for OperationWarnings {}
676
677/// [Output Only] Metadata about this warning in key: value format. For example:
678/// "data": [ { "key": "scope", "value": "zones/us-east1-d" }
679///
680/// This type is not used in any activity, and only used as *part* of another schema.
681///
682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
683#[serde_with::serde_as]
684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
685pub struct OperationWarningsData {
686 /// [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).
687 pub key: Option<String>,
688 /// [Output Only] A warning data value corresponding to the key.
689 pub value: Option<String>,
690}
691
692impl common::NestedType for OperationWarningsData {}
693impl common::Part for OperationWarningsData {}
694
695// ###################
696// MethodBuilders ###
697// #################
698
699/// A builder providing access to all methods supported on *deployment* resources.
700/// It is not used directly, but through the [`DeploymentManager`] hub.
701///
702/// # Example
703///
704/// Instantiate a resource builder
705///
706/// ```test_harness,no_run
707/// extern crate hyper;
708/// extern crate hyper_rustls;
709/// extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
710///
711/// # async fn dox() {
712/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
713///
714/// let secret: yup_oauth2::ApplicationSecret = Default::default();
715/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
716/// .with_native_roots()
717/// .unwrap()
718/// .https_only()
719/// .enable_http2()
720/// .build();
721///
722/// let executor = hyper_util::rt::TokioExecutor::new();
723/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
724/// secret,
725/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
726/// yup_oauth2::client::CustomHyperClientBuilder::from(
727/// hyper_util::client::legacy::Client::builder(executor).build(connector),
728/// ),
729/// ).build().await.unwrap();
730///
731/// let client = hyper_util::client::legacy::Client::builder(
732/// hyper_util::rt::TokioExecutor::new()
733/// )
734/// .build(
735/// hyper_rustls::HttpsConnectorBuilder::new()
736/// .with_native_roots()
737/// .unwrap()
738/// .https_or_http()
739/// .enable_http2()
740/// .build()
741/// );
742/// let mut hub = DeploymentManager::new(client, auth);
743/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
744/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
745/// // to build up your call.
746/// let rb = hub.deployments();
747/// # }
748/// ```
749pub struct DeploymentMethods<'a, C>
750where
751 C: 'a,
752{
753 hub: &'a DeploymentManager<C>,
754}
755
756impl<'a, C> common::MethodsBuilder for DeploymentMethods<'a, C> {}
757
758impl<'a, C> DeploymentMethods<'a, C> {
759 /// Create a builder to help you perform the following task:
760 ///
761 /// Deletes a deployment and all of the resources in the deployment.
762 ///
763 /// # Arguments
764 ///
765 /// * `project` - The project ID for this request.
766 /// * `deployment` - The name of the deployment for this request.
767 pub fn delete(&self, project: &str, deployment: &str) -> DeploymentDeleteCall<'a, C> {
768 DeploymentDeleteCall {
769 hub: self.hub,
770 _project: project.to_string(),
771 _deployment: deployment.to_string(),
772 _delegate: Default::default(),
773 _additional_params: Default::default(),
774 _scopes: Default::default(),
775 }
776 }
777
778 /// Create a builder to help you perform the following task:
779 ///
780 /// Gets information about a specific deployment.
781 ///
782 /// # Arguments
783 ///
784 /// * `project` - The project ID for this request.
785 /// * `deployment` - The name of the deployment for this request.
786 pub fn get(&self, project: &str, deployment: &str) -> DeploymentGetCall<'a, C> {
787 DeploymentGetCall {
788 hub: self.hub,
789 _project: project.to_string(),
790 _deployment: deployment.to_string(),
791 _delegate: Default::default(),
792 _additional_params: Default::default(),
793 _scopes: Default::default(),
794 }
795 }
796
797 /// Create a builder to help you perform the following task:
798 ///
799 /// Creates a deployment and all of the resources described by the deployment manifest.
800 ///
801 /// # Arguments
802 ///
803 /// * `request` - No description provided.
804 /// * `project` - The project ID for this request.
805 pub fn insert(&self, request: Deployment, project: &str) -> DeploymentInsertCall<'a, C> {
806 DeploymentInsertCall {
807 hub: self.hub,
808 _request: request,
809 _project: project.to_string(),
810 _delegate: Default::default(),
811 _additional_params: Default::default(),
812 _scopes: Default::default(),
813 }
814 }
815
816 /// Create a builder to help you perform the following task:
817 ///
818 /// Lists all deployments for a given project.
819 ///
820 /// # Arguments
821 ///
822 /// * `project` - The project ID for this request.
823 pub fn list(&self, project: &str) -> DeploymentListCall<'a, C> {
824 DeploymentListCall {
825 hub: self.hub,
826 _project: project.to_string(),
827 _page_token: Default::default(),
828 _max_results: Default::default(),
829 _filter: Default::default(),
830 _delegate: Default::default(),
831 _additional_params: Default::default(),
832 _scopes: Default::default(),
833 }
834 }
835
836 /// Create a builder to help you perform the following task:
837 ///
838 /// Updates a deployment and all of the resources described by the deployment manifest. This method supports patch semantics.
839 ///
840 /// # Arguments
841 ///
842 /// * `request` - No description provided.
843 /// * `project` - The project ID for this request.
844 /// * `deployment` - The name of the deployment for this request.
845 pub fn patch(
846 &self,
847 request: Deployment,
848 project: &str,
849 deployment: &str,
850 ) -> DeploymentPatchCall<'a, C> {
851 DeploymentPatchCall {
852 hub: self.hub,
853 _request: request,
854 _project: project.to_string(),
855 _deployment: deployment.to_string(),
856 _update_policy: Default::default(),
857 _delete_policy: Default::default(),
858 _create_policy: Default::default(),
859 _delegate: Default::default(),
860 _additional_params: Default::default(),
861 _scopes: Default::default(),
862 }
863 }
864
865 /// Create a builder to help you perform the following task:
866 ///
867 /// Updates a deployment and all of the resources described by the deployment manifest.
868 ///
869 /// # Arguments
870 ///
871 /// * `request` - No description provided.
872 /// * `project` - The project ID for this request.
873 /// * `deployment` - The name of the deployment for this request.
874 pub fn update(
875 &self,
876 request: Deployment,
877 project: &str,
878 deployment: &str,
879 ) -> DeploymentUpdateCall<'a, C> {
880 DeploymentUpdateCall {
881 hub: self.hub,
882 _request: request,
883 _project: project.to_string(),
884 _deployment: deployment.to_string(),
885 _update_policy: Default::default(),
886 _delete_policy: Default::default(),
887 _create_policy: Default::default(),
888 _delegate: Default::default(),
889 _additional_params: Default::default(),
890 _scopes: Default::default(),
891 }
892 }
893}
894
895/// A builder providing access to all methods supported on *manifest* resources.
896/// It is not used directly, but through the [`DeploymentManager`] hub.
897///
898/// # Example
899///
900/// Instantiate a resource builder
901///
902/// ```test_harness,no_run
903/// extern crate hyper;
904/// extern crate hyper_rustls;
905/// extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
906///
907/// # async fn dox() {
908/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
909///
910/// let secret: yup_oauth2::ApplicationSecret = Default::default();
911/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
912/// .with_native_roots()
913/// .unwrap()
914/// .https_only()
915/// .enable_http2()
916/// .build();
917///
918/// let executor = hyper_util::rt::TokioExecutor::new();
919/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
920/// secret,
921/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
922/// yup_oauth2::client::CustomHyperClientBuilder::from(
923/// hyper_util::client::legacy::Client::builder(executor).build(connector),
924/// ),
925/// ).build().await.unwrap();
926///
927/// let client = hyper_util::client::legacy::Client::builder(
928/// hyper_util::rt::TokioExecutor::new()
929/// )
930/// .build(
931/// hyper_rustls::HttpsConnectorBuilder::new()
932/// .with_native_roots()
933/// .unwrap()
934/// .https_or_http()
935/// .enable_http2()
936/// .build()
937/// );
938/// let mut hub = DeploymentManager::new(client, auth);
939/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
940/// // like `get(...)` and `list(...)`
941/// // to build up your call.
942/// let rb = hub.manifests();
943/// # }
944/// ```
945pub struct ManifestMethods<'a, C>
946where
947 C: 'a,
948{
949 hub: &'a DeploymentManager<C>,
950}
951
952impl<'a, C> common::MethodsBuilder for ManifestMethods<'a, C> {}
953
954impl<'a, C> ManifestMethods<'a, C> {
955 /// Create a builder to help you perform the following task:
956 ///
957 /// Gets information about a specific manifest.
958 ///
959 /// # Arguments
960 ///
961 /// * `project` - The project ID for this request.
962 /// * `deployment` - The name of the deployment for this request.
963 /// * `manifest` - The name of the manifest for this request.
964 pub fn get(&self, project: &str, deployment: &str, manifest: &str) -> ManifestGetCall<'a, C> {
965 ManifestGetCall {
966 hub: self.hub,
967 _project: project.to_string(),
968 _deployment: deployment.to_string(),
969 _manifest: manifest.to_string(),
970 _delegate: Default::default(),
971 _additional_params: Default::default(),
972 _scopes: Default::default(),
973 }
974 }
975
976 /// Create a builder to help you perform the following task:
977 ///
978 /// Lists all manifests for a given deployment.
979 ///
980 /// # Arguments
981 ///
982 /// * `project` - The project ID for this request.
983 /// * `deployment` - The name of the deployment for this request.
984 pub fn list(&self, project: &str, deployment: &str) -> ManifestListCall<'a, C> {
985 ManifestListCall {
986 hub: self.hub,
987 _project: project.to_string(),
988 _deployment: deployment.to_string(),
989 _page_token: Default::default(),
990 _max_results: Default::default(),
991 _filter: Default::default(),
992 _delegate: Default::default(),
993 _additional_params: Default::default(),
994 _scopes: Default::default(),
995 }
996 }
997}
998
999/// A builder providing access to all methods supported on *operation* resources.
1000/// It is not used directly, but through the [`DeploymentManager`] hub.
1001///
1002/// # Example
1003///
1004/// Instantiate a resource builder
1005///
1006/// ```test_harness,no_run
1007/// extern crate hyper;
1008/// extern crate hyper_rustls;
1009/// extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1010///
1011/// # async fn dox() {
1012/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1013///
1014/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1015/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1016/// .with_native_roots()
1017/// .unwrap()
1018/// .https_only()
1019/// .enable_http2()
1020/// .build();
1021///
1022/// let executor = hyper_util::rt::TokioExecutor::new();
1023/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1024/// secret,
1025/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1026/// yup_oauth2::client::CustomHyperClientBuilder::from(
1027/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1028/// ),
1029/// ).build().await.unwrap();
1030///
1031/// let client = hyper_util::client::legacy::Client::builder(
1032/// hyper_util::rt::TokioExecutor::new()
1033/// )
1034/// .build(
1035/// hyper_rustls::HttpsConnectorBuilder::new()
1036/// .with_native_roots()
1037/// .unwrap()
1038/// .https_or_http()
1039/// .enable_http2()
1040/// .build()
1041/// );
1042/// let mut hub = DeploymentManager::new(client, auth);
1043/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1044/// // like `get(...)` and `list(...)`
1045/// // to build up your call.
1046/// let rb = hub.operations();
1047/// # }
1048/// ```
1049pub struct OperationMethods<'a, C>
1050where
1051 C: 'a,
1052{
1053 hub: &'a DeploymentManager<C>,
1054}
1055
1056impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
1057
1058impl<'a, C> OperationMethods<'a, C> {
1059 /// Create a builder to help you perform the following task:
1060 ///
1061 /// Gets information about a specific operation.
1062 ///
1063 /// # Arguments
1064 ///
1065 /// * `project` - The project ID for this request.
1066 /// * `operation` - The name of the operation for this request.
1067 pub fn get(&self, project: &str, operation: &str) -> OperationGetCall<'a, C> {
1068 OperationGetCall {
1069 hub: self.hub,
1070 _project: project.to_string(),
1071 _operation: operation.to_string(),
1072 _delegate: Default::default(),
1073 _additional_params: Default::default(),
1074 _scopes: Default::default(),
1075 }
1076 }
1077
1078 /// Create a builder to help you perform the following task:
1079 ///
1080 /// Lists all operations for a project.
1081 ///
1082 /// # Arguments
1083 ///
1084 /// * `project` - The project ID for this request.
1085 pub fn list(&self, project: &str) -> OperationListCall<'a, C> {
1086 OperationListCall {
1087 hub: self.hub,
1088 _project: project.to_string(),
1089 _page_token: Default::default(),
1090 _max_results: Default::default(),
1091 _filter: Default::default(),
1092 _delegate: Default::default(),
1093 _additional_params: Default::default(),
1094 _scopes: Default::default(),
1095 }
1096 }
1097}
1098
1099/// A builder providing access to all methods supported on *resource* resources.
1100/// It is not used directly, but through the [`DeploymentManager`] hub.
1101///
1102/// # Example
1103///
1104/// Instantiate a resource builder
1105///
1106/// ```test_harness,no_run
1107/// extern crate hyper;
1108/// extern crate hyper_rustls;
1109/// extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1110///
1111/// # async fn dox() {
1112/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1113///
1114/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1115/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1116/// .with_native_roots()
1117/// .unwrap()
1118/// .https_only()
1119/// .enable_http2()
1120/// .build();
1121///
1122/// let executor = hyper_util::rt::TokioExecutor::new();
1123/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1124/// secret,
1125/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1126/// yup_oauth2::client::CustomHyperClientBuilder::from(
1127/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1128/// ),
1129/// ).build().await.unwrap();
1130///
1131/// let client = hyper_util::client::legacy::Client::builder(
1132/// hyper_util::rt::TokioExecutor::new()
1133/// )
1134/// .build(
1135/// hyper_rustls::HttpsConnectorBuilder::new()
1136/// .with_native_roots()
1137/// .unwrap()
1138/// .https_or_http()
1139/// .enable_http2()
1140/// .build()
1141/// );
1142/// let mut hub = DeploymentManager::new(client, auth);
1143/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1144/// // like `get(...)` and `list(...)`
1145/// // to build up your call.
1146/// let rb = hub.resources();
1147/// # }
1148/// ```
1149pub struct ResourceMethods<'a, C>
1150where
1151 C: 'a,
1152{
1153 hub: &'a DeploymentManager<C>,
1154}
1155
1156impl<'a, C> common::MethodsBuilder for ResourceMethods<'a, C> {}
1157
1158impl<'a, C> ResourceMethods<'a, C> {
1159 /// Create a builder to help you perform the following task:
1160 ///
1161 /// Gets information about a single resource.
1162 ///
1163 /// # Arguments
1164 ///
1165 /// * `project` - The project ID for this request.
1166 /// * `deployment` - The name of the deployment for this request.
1167 /// * `resource` - The name of the resource for this request.
1168 pub fn get(&self, project: &str, deployment: &str, resource: &str) -> ResourceGetCall<'a, C> {
1169 ResourceGetCall {
1170 hub: self.hub,
1171 _project: project.to_string(),
1172 _deployment: deployment.to_string(),
1173 _resource: resource.to_string(),
1174 _delegate: Default::default(),
1175 _additional_params: Default::default(),
1176 _scopes: Default::default(),
1177 }
1178 }
1179
1180 /// Create a builder to help you perform the following task:
1181 ///
1182 /// Lists all resources in a given deployment.
1183 ///
1184 /// # Arguments
1185 ///
1186 /// * `project` - The project ID for this request.
1187 /// * `deployment` - The name of the deployment for this request.
1188 pub fn list(&self, project: &str, deployment: &str) -> ResourceListCall<'a, C> {
1189 ResourceListCall {
1190 hub: self.hub,
1191 _project: project.to_string(),
1192 _deployment: deployment.to_string(),
1193 _page_token: Default::default(),
1194 _max_results: Default::default(),
1195 _filter: Default::default(),
1196 _delegate: Default::default(),
1197 _additional_params: Default::default(),
1198 _scopes: Default::default(),
1199 }
1200 }
1201}
1202
1203/// A builder providing access to all methods supported on *type* resources.
1204/// It is not used directly, but through the [`DeploymentManager`] hub.
1205///
1206/// # Example
1207///
1208/// Instantiate a resource builder
1209///
1210/// ```test_harness,no_run
1211/// extern crate hyper;
1212/// extern crate hyper_rustls;
1213/// extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1214///
1215/// # async fn dox() {
1216/// use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1217///
1218/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1219/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1220/// .with_native_roots()
1221/// .unwrap()
1222/// .https_only()
1223/// .enable_http2()
1224/// .build();
1225///
1226/// let executor = hyper_util::rt::TokioExecutor::new();
1227/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1228/// secret,
1229/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1230/// yup_oauth2::client::CustomHyperClientBuilder::from(
1231/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1232/// ),
1233/// ).build().await.unwrap();
1234///
1235/// let client = hyper_util::client::legacy::Client::builder(
1236/// hyper_util::rt::TokioExecutor::new()
1237/// )
1238/// .build(
1239/// hyper_rustls::HttpsConnectorBuilder::new()
1240/// .with_native_roots()
1241/// .unwrap()
1242/// .https_or_http()
1243/// .enable_http2()
1244/// .build()
1245/// );
1246/// let mut hub = DeploymentManager::new(client, auth);
1247/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1248/// // like `list(...)`
1249/// // to build up your call.
1250/// let rb = hub.types();
1251/// # }
1252/// ```
1253pub struct TypeMethods<'a, C>
1254where
1255 C: 'a,
1256{
1257 hub: &'a DeploymentManager<C>,
1258}
1259
1260impl<'a, C> common::MethodsBuilder for TypeMethods<'a, C> {}
1261
1262impl<'a, C> TypeMethods<'a, C> {
1263 /// Create a builder to help you perform the following task:
1264 ///
1265 /// Lists all resource types for Deployment Manager.
1266 ///
1267 /// # Arguments
1268 ///
1269 /// * `project` - The project ID for this request.
1270 pub fn list(&self, project: &str) -> TypeListCall<'a, C> {
1271 TypeListCall {
1272 hub: self.hub,
1273 _project: project.to_string(),
1274 _page_token: Default::default(),
1275 _max_results: Default::default(),
1276 _filter: Default::default(),
1277 _delegate: Default::default(),
1278 _additional_params: Default::default(),
1279 _scopes: Default::default(),
1280 }
1281 }
1282}
1283
1284// ###################
1285// CallBuilders ###
1286// #################
1287
1288/// Deletes a deployment and all of the resources in the deployment.
1289///
1290/// A builder for the *delete* method supported by a *deployment* resource.
1291/// It is not used directly, but through a [`DeploymentMethods`] instance.
1292///
1293/// # Example
1294///
1295/// Instantiate a resource method builder
1296///
1297/// ```test_harness,no_run
1298/// # extern crate hyper;
1299/// # extern crate hyper_rustls;
1300/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1301/// # async fn dox() {
1302/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1303///
1304/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1305/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1306/// # .with_native_roots()
1307/// # .unwrap()
1308/// # .https_only()
1309/// # .enable_http2()
1310/// # .build();
1311///
1312/// # let executor = hyper_util::rt::TokioExecutor::new();
1313/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1314/// # secret,
1315/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1316/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1317/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1318/// # ),
1319/// # ).build().await.unwrap();
1320///
1321/// # let client = hyper_util::client::legacy::Client::builder(
1322/// # hyper_util::rt::TokioExecutor::new()
1323/// # )
1324/// # .build(
1325/// # hyper_rustls::HttpsConnectorBuilder::new()
1326/// # .with_native_roots()
1327/// # .unwrap()
1328/// # .https_or_http()
1329/// # .enable_http2()
1330/// # .build()
1331/// # );
1332/// # let mut hub = DeploymentManager::new(client, auth);
1333/// // You can configure optional parameters by calling the respective setters at will, and
1334/// // execute the final call using `doit()`.
1335/// // Values shown here are possibly random and not representative !
1336/// let result = hub.deployments().delete("project", "deployment")
1337/// .doit().await;
1338/// # }
1339/// ```
1340pub struct DeploymentDeleteCall<'a, C>
1341where
1342 C: 'a,
1343{
1344 hub: &'a DeploymentManager<C>,
1345 _project: String,
1346 _deployment: String,
1347 _delegate: Option<&'a mut dyn common::Delegate>,
1348 _additional_params: HashMap<String, String>,
1349 _scopes: BTreeSet<String>,
1350}
1351
1352impl<'a, C> common::CallBuilder for DeploymentDeleteCall<'a, C> {}
1353
1354impl<'a, C> DeploymentDeleteCall<'a, C>
1355where
1356 C: common::Connector,
1357{
1358 /// Perform the operation you have build so far.
1359 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1360 use std::borrow::Cow;
1361 use std::io::{Read, Seek};
1362
1363 use common::{url::Params, ToParts};
1364 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1365
1366 let mut dd = common::DefaultDelegate;
1367 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1368 dlg.begin(common::MethodInfo {
1369 id: "deploymentmanager.deployments.delete",
1370 http_method: hyper::Method::DELETE,
1371 });
1372
1373 for &field in ["alt", "project", "deployment"].iter() {
1374 if self._additional_params.contains_key(field) {
1375 dlg.finished(false);
1376 return Err(common::Error::FieldClash(field));
1377 }
1378 }
1379
1380 let mut params = Params::with_capacity(4 + self._additional_params.len());
1381 params.push("project", self._project);
1382 params.push("deployment", self._deployment);
1383
1384 params.extend(self._additional_params.iter());
1385
1386 params.push("alt", "json");
1387 let mut url = self.hub._base_url.clone() + "{project}/global/deployments/{deployment}";
1388 if self._scopes.is_empty() {
1389 self._scopes
1390 .insert(Scope::CloudPlatform.as_ref().to_string());
1391 }
1392
1393 #[allow(clippy::single_element_loop)]
1394 for &(find_this, param_name) in
1395 [("{project}", "project"), ("{deployment}", "deployment")].iter()
1396 {
1397 url = params.uri_replacement(url, param_name, find_this, false);
1398 }
1399 {
1400 let to_remove = ["deployment", "project"];
1401 params.remove_params(&to_remove);
1402 }
1403
1404 let url = params.parse_with_url(&url);
1405
1406 loop {
1407 let token = match self
1408 .hub
1409 .auth
1410 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1411 .await
1412 {
1413 Ok(token) => token,
1414 Err(e) => match dlg.token(e) {
1415 Ok(token) => token,
1416 Err(e) => {
1417 dlg.finished(false);
1418 return Err(common::Error::MissingToken(e));
1419 }
1420 },
1421 };
1422 let mut req_result = {
1423 let client = &self.hub.client;
1424 dlg.pre_request();
1425 let mut req_builder = hyper::Request::builder()
1426 .method(hyper::Method::DELETE)
1427 .uri(url.as_str())
1428 .header(USER_AGENT, self.hub._user_agent.clone());
1429
1430 if let Some(token) = token.as_ref() {
1431 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1432 }
1433
1434 let request = req_builder
1435 .header(CONTENT_LENGTH, 0_u64)
1436 .body(common::to_body::<String>(None));
1437
1438 client.request(request.unwrap()).await
1439 };
1440
1441 match req_result {
1442 Err(err) => {
1443 if let common::Retry::After(d) = dlg.http_error(&err) {
1444 sleep(d).await;
1445 continue;
1446 }
1447 dlg.finished(false);
1448 return Err(common::Error::HttpError(err));
1449 }
1450 Ok(res) => {
1451 let (mut parts, body) = res.into_parts();
1452 let mut body = common::Body::new(body);
1453 if !parts.status.is_success() {
1454 let bytes = common::to_bytes(body).await.unwrap_or_default();
1455 let error = serde_json::from_str(&common::to_string(&bytes));
1456 let response = common::to_response(parts, bytes.into());
1457
1458 if let common::Retry::After(d) =
1459 dlg.http_failure(&response, error.as_ref().ok())
1460 {
1461 sleep(d).await;
1462 continue;
1463 }
1464
1465 dlg.finished(false);
1466
1467 return Err(match error {
1468 Ok(value) => common::Error::BadRequest(value),
1469 _ => common::Error::Failure(response),
1470 });
1471 }
1472 let response = {
1473 let bytes = common::to_bytes(body).await.unwrap_or_default();
1474 let encoded = common::to_string(&bytes);
1475 match serde_json::from_str(&encoded) {
1476 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1477 Err(error) => {
1478 dlg.response_json_decode_error(&encoded, &error);
1479 return Err(common::Error::JsonDecodeError(
1480 encoded.to_string(),
1481 error,
1482 ));
1483 }
1484 }
1485 };
1486
1487 dlg.finished(true);
1488 return Ok(response);
1489 }
1490 }
1491 }
1492 }
1493
1494 /// The project ID for this request.
1495 ///
1496 /// Sets the *project* path property to the given value.
1497 ///
1498 /// Even though the property as already been set when instantiating this call,
1499 /// we provide this method for API completeness.
1500 pub fn project(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
1501 self._project = new_value.to_string();
1502 self
1503 }
1504 /// The name of the deployment for this request.
1505 ///
1506 /// Sets the *deployment* path property to the given value.
1507 ///
1508 /// Even though the property as already been set when instantiating this call,
1509 /// we provide this method for API completeness.
1510 pub fn deployment(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
1511 self._deployment = new_value.to_string();
1512 self
1513 }
1514 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1515 /// while executing the actual API request.
1516 ///
1517 /// ````text
1518 /// It should be used to handle progress information, and to implement a certain level of resilience.
1519 /// ````
1520 ///
1521 /// Sets the *delegate* property to the given value.
1522 pub fn delegate(
1523 mut self,
1524 new_value: &'a mut dyn common::Delegate,
1525 ) -> DeploymentDeleteCall<'a, C> {
1526 self._delegate = Some(new_value);
1527 self
1528 }
1529
1530 /// Set any additional parameter of the query string used in the request.
1531 /// It should be used to set parameters which are not yet available through their own
1532 /// setters.
1533 ///
1534 /// Please note that this method must not be used to set any of the known parameters
1535 /// which have their own setter method. If done anyway, the request will fail.
1536 ///
1537 /// # Additional Parameters
1538 ///
1539 /// * *alt* (query-string) - Data format for the response.
1540 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1541 /// * *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.
1542 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1543 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1544 /// * *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.
1545 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1546 pub fn param<T>(mut self, name: T, value: T) -> DeploymentDeleteCall<'a, C>
1547 where
1548 T: AsRef<str>,
1549 {
1550 self._additional_params
1551 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1552 self
1553 }
1554
1555 /// Identifies the authorization scope for the method you are building.
1556 ///
1557 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1558 /// [`Scope::CloudPlatform`].
1559 ///
1560 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1561 /// tokens for more than one scope.
1562 ///
1563 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1564 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1565 /// sufficient, a read-write scope will do as well.
1566 pub fn add_scope<St>(mut self, scope: St) -> DeploymentDeleteCall<'a, C>
1567 where
1568 St: AsRef<str>,
1569 {
1570 self._scopes.insert(String::from(scope.as_ref()));
1571 self
1572 }
1573 /// Identifies the authorization scope(s) for the method you are building.
1574 ///
1575 /// See [`Self::add_scope()`] for details.
1576 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentDeleteCall<'a, C>
1577 where
1578 I: IntoIterator<Item = St>,
1579 St: AsRef<str>,
1580 {
1581 self._scopes
1582 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1583 self
1584 }
1585
1586 /// Removes all scopes, and no default scope will be used either.
1587 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1588 /// for details).
1589 pub fn clear_scopes(mut self) -> DeploymentDeleteCall<'a, C> {
1590 self._scopes.clear();
1591 self
1592 }
1593}
1594
1595/// Gets information about a specific deployment.
1596///
1597/// A builder for the *get* method supported by a *deployment* resource.
1598/// It is not used directly, but through a [`DeploymentMethods`] instance.
1599///
1600/// # Example
1601///
1602/// Instantiate a resource method builder
1603///
1604/// ```test_harness,no_run
1605/// # extern crate hyper;
1606/// # extern crate hyper_rustls;
1607/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1608/// # async fn dox() {
1609/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1610///
1611/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1612/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1613/// # .with_native_roots()
1614/// # .unwrap()
1615/// # .https_only()
1616/// # .enable_http2()
1617/// # .build();
1618///
1619/// # let executor = hyper_util::rt::TokioExecutor::new();
1620/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1621/// # secret,
1622/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1623/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1624/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1625/// # ),
1626/// # ).build().await.unwrap();
1627///
1628/// # let client = hyper_util::client::legacy::Client::builder(
1629/// # hyper_util::rt::TokioExecutor::new()
1630/// # )
1631/// # .build(
1632/// # hyper_rustls::HttpsConnectorBuilder::new()
1633/// # .with_native_roots()
1634/// # .unwrap()
1635/// # .https_or_http()
1636/// # .enable_http2()
1637/// # .build()
1638/// # );
1639/// # let mut hub = DeploymentManager::new(client, auth);
1640/// // You can configure optional parameters by calling the respective setters at will, and
1641/// // execute the final call using `doit()`.
1642/// // Values shown here are possibly random and not representative !
1643/// let result = hub.deployments().get("project", "deployment")
1644/// .doit().await;
1645/// # }
1646/// ```
1647pub struct DeploymentGetCall<'a, C>
1648where
1649 C: 'a,
1650{
1651 hub: &'a DeploymentManager<C>,
1652 _project: String,
1653 _deployment: String,
1654 _delegate: Option<&'a mut dyn common::Delegate>,
1655 _additional_params: HashMap<String, String>,
1656 _scopes: BTreeSet<String>,
1657}
1658
1659impl<'a, C> common::CallBuilder for DeploymentGetCall<'a, C> {}
1660
1661impl<'a, C> DeploymentGetCall<'a, C>
1662where
1663 C: common::Connector,
1664{
1665 /// Perform the operation you have build so far.
1666 pub async fn doit(mut self) -> common::Result<(common::Response, Deployment)> {
1667 use std::borrow::Cow;
1668 use std::io::{Read, Seek};
1669
1670 use common::{url::Params, ToParts};
1671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1672
1673 let mut dd = common::DefaultDelegate;
1674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1675 dlg.begin(common::MethodInfo {
1676 id: "deploymentmanager.deployments.get",
1677 http_method: hyper::Method::GET,
1678 });
1679
1680 for &field in ["alt", "project", "deployment"].iter() {
1681 if self._additional_params.contains_key(field) {
1682 dlg.finished(false);
1683 return Err(common::Error::FieldClash(field));
1684 }
1685 }
1686
1687 let mut params = Params::with_capacity(4 + self._additional_params.len());
1688 params.push("project", self._project);
1689 params.push("deployment", self._deployment);
1690
1691 params.extend(self._additional_params.iter());
1692
1693 params.push("alt", "json");
1694 let mut url = self.hub._base_url.clone() + "{project}/global/deployments/{deployment}";
1695 if self._scopes.is_empty() {
1696 self._scopes
1697 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
1698 }
1699
1700 #[allow(clippy::single_element_loop)]
1701 for &(find_this, param_name) in
1702 [("{project}", "project"), ("{deployment}", "deployment")].iter()
1703 {
1704 url = params.uri_replacement(url, param_name, find_this, false);
1705 }
1706 {
1707 let to_remove = ["deployment", "project"];
1708 params.remove_params(&to_remove);
1709 }
1710
1711 let url = params.parse_with_url(&url);
1712
1713 loop {
1714 let token = match self
1715 .hub
1716 .auth
1717 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1718 .await
1719 {
1720 Ok(token) => token,
1721 Err(e) => match dlg.token(e) {
1722 Ok(token) => token,
1723 Err(e) => {
1724 dlg.finished(false);
1725 return Err(common::Error::MissingToken(e));
1726 }
1727 },
1728 };
1729 let mut req_result = {
1730 let client = &self.hub.client;
1731 dlg.pre_request();
1732 let mut req_builder = hyper::Request::builder()
1733 .method(hyper::Method::GET)
1734 .uri(url.as_str())
1735 .header(USER_AGENT, self.hub._user_agent.clone());
1736
1737 if let Some(token) = token.as_ref() {
1738 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1739 }
1740
1741 let request = req_builder
1742 .header(CONTENT_LENGTH, 0_u64)
1743 .body(common::to_body::<String>(None));
1744
1745 client.request(request.unwrap()).await
1746 };
1747
1748 match req_result {
1749 Err(err) => {
1750 if let common::Retry::After(d) = dlg.http_error(&err) {
1751 sleep(d).await;
1752 continue;
1753 }
1754 dlg.finished(false);
1755 return Err(common::Error::HttpError(err));
1756 }
1757 Ok(res) => {
1758 let (mut parts, body) = res.into_parts();
1759 let mut body = common::Body::new(body);
1760 if !parts.status.is_success() {
1761 let bytes = common::to_bytes(body).await.unwrap_or_default();
1762 let error = serde_json::from_str(&common::to_string(&bytes));
1763 let response = common::to_response(parts, bytes.into());
1764
1765 if let common::Retry::After(d) =
1766 dlg.http_failure(&response, error.as_ref().ok())
1767 {
1768 sleep(d).await;
1769 continue;
1770 }
1771
1772 dlg.finished(false);
1773
1774 return Err(match error {
1775 Ok(value) => common::Error::BadRequest(value),
1776 _ => common::Error::Failure(response),
1777 });
1778 }
1779 let response = {
1780 let bytes = common::to_bytes(body).await.unwrap_or_default();
1781 let encoded = common::to_string(&bytes);
1782 match serde_json::from_str(&encoded) {
1783 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1784 Err(error) => {
1785 dlg.response_json_decode_error(&encoded, &error);
1786 return Err(common::Error::JsonDecodeError(
1787 encoded.to_string(),
1788 error,
1789 ));
1790 }
1791 }
1792 };
1793
1794 dlg.finished(true);
1795 return Ok(response);
1796 }
1797 }
1798 }
1799 }
1800
1801 /// The project ID for this request.
1802 ///
1803 /// Sets the *project* path property to the given value.
1804 ///
1805 /// Even though the property as already been set when instantiating this call,
1806 /// we provide this method for API completeness.
1807 pub fn project(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
1808 self._project = new_value.to_string();
1809 self
1810 }
1811 /// The name of the deployment for this request.
1812 ///
1813 /// Sets the *deployment* path property to the given value.
1814 ///
1815 /// Even though the property as already been set when instantiating this call,
1816 /// we provide this method for API completeness.
1817 pub fn deployment(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
1818 self._deployment = new_value.to_string();
1819 self
1820 }
1821 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1822 /// while executing the actual API request.
1823 ///
1824 /// ````text
1825 /// It should be used to handle progress information, and to implement a certain level of resilience.
1826 /// ````
1827 ///
1828 /// Sets the *delegate* property to the given value.
1829 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeploymentGetCall<'a, C> {
1830 self._delegate = Some(new_value);
1831 self
1832 }
1833
1834 /// Set any additional parameter of the query string used in the request.
1835 /// It should be used to set parameters which are not yet available through their own
1836 /// setters.
1837 ///
1838 /// Please note that this method must not be used to set any of the known parameters
1839 /// which have their own setter method. If done anyway, the request will fail.
1840 ///
1841 /// # Additional Parameters
1842 ///
1843 /// * *alt* (query-string) - Data format for the response.
1844 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1845 /// * *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.
1846 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1847 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1848 /// * *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.
1849 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
1850 pub fn param<T>(mut self, name: T, value: T) -> DeploymentGetCall<'a, C>
1851 where
1852 T: AsRef<str>,
1853 {
1854 self._additional_params
1855 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1856 self
1857 }
1858
1859 /// Identifies the authorization scope for the method you are building.
1860 ///
1861 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1862 /// [`Scope::NdevCloudmanReadonly`].
1863 ///
1864 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1865 /// tokens for more than one scope.
1866 ///
1867 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1868 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1869 /// sufficient, a read-write scope will do as well.
1870 pub fn add_scope<St>(mut self, scope: St) -> DeploymentGetCall<'a, C>
1871 where
1872 St: AsRef<str>,
1873 {
1874 self._scopes.insert(String::from(scope.as_ref()));
1875 self
1876 }
1877 /// Identifies the authorization scope(s) for the method you are building.
1878 ///
1879 /// See [`Self::add_scope()`] for details.
1880 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentGetCall<'a, C>
1881 where
1882 I: IntoIterator<Item = St>,
1883 St: AsRef<str>,
1884 {
1885 self._scopes
1886 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1887 self
1888 }
1889
1890 /// Removes all scopes, and no default scope will be used either.
1891 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1892 /// for details).
1893 pub fn clear_scopes(mut self) -> DeploymentGetCall<'a, C> {
1894 self._scopes.clear();
1895 self
1896 }
1897}
1898
1899/// Creates a deployment and all of the resources described by the deployment manifest.
1900///
1901/// A builder for the *insert* method supported by a *deployment* resource.
1902/// It is not used directly, but through a [`DeploymentMethods`] instance.
1903///
1904/// # Example
1905///
1906/// Instantiate a resource method builder
1907///
1908/// ```test_harness,no_run
1909/// # extern crate hyper;
1910/// # extern crate hyper_rustls;
1911/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
1912/// use deploymentmanager2_beta2::api::Deployment;
1913/// # async fn dox() {
1914/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1915///
1916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1917/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1918/// # .with_native_roots()
1919/// # .unwrap()
1920/// # .https_only()
1921/// # .enable_http2()
1922/// # .build();
1923///
1924/// # let executor = hyper_util::rt::TokioExecutor::new();
1925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1926/// # secret,
1927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1928/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1929/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1930/// # ),
1931/// # ).build().await.unwrap();
1932///
1933/// # let client = hyper_util::client::legacy::Client::builder(
1934/// # hyper_util::rt::TokioExecutor::new()
1935/// # )
1936/// # .build(
1937/// # hyper_rustls::HttpsConnectorBuilder::new()
1938/// # .with_native_roots()
1939/// # .unwrap()
1940/// # .https_or_http()
1941/// # .enable_http2()
1942/// # .build()
1943/// # );
1944/// # let mut hub = DeploymentManager::new(client, auth);
1945/// // As the method needs a request, you would usually fill it with the desired information
1946/// // into the respective structure. Some of the parts shown here might not be applicable !
1947/// // Values shown here are possibly random and not representative !
1948/// let mut req = Deployment::default();
1949///
1950/// // You can configure optional parameters by calling the respective setters at will, and
1951/// // execute the final call using `doit()`.
1952/// // Values shown here are possibly random and not representative !
1953/// let result = hub.deployments().insert(req, "project")
1954/// .doit().await;
1955/// # }
1956/// ```
1957pub struct DeploymentInsertCall<'a, C>
1958where
1959 C: 'a,
1960{
1961 hub: &'a DeploymentManager<C>,
1962 _request: Deployment,
1963 _project: String,
1964 _delegate: Option<&'a mut dyn common::Delegate>,
1965 _additional_params: HashMap<String, String>,
1966 _scopes: BTreeSet<String>,
1967}
1968
1969impl<'a, C> common::CallBuilder for DeploymentInsertCall<'a, C> {}
1970
1971impl<'a, C> DeploymentInsertCall<'a, C>
1972where
1973 C: common::Connector,
1974{
1975 /// Perform the operation you have build so far.
1976 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1977 use std::borrow::Cow;
1978 use std::io::{Read, Seek};
1979
1980 use common::{url::Params, ToParts};
1981 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1982
1983 let mut dd = common::DefaultDelegate;
1984 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1985 dlg.begin(common::MethodInfo {
1986 id: "deploymentmanager.deployments.insert",
1987 http_method: hyper::Method::POST,
1988 });
1989
1990 for &field in ["alt", "project"].iter() {
1991 if self._additional_params.contains_key(field) {
1992 dlg.finished(false);
1993 return Err(common::Error::FieldClash(field));
1994 }
1995 }
1996
1997 let mut params = Params::with_capacity(4 + self._additional_params.len());
1998 params.push("project", self._project);
1999
2000 params.extend(self._additional_params.iter());
2001
2002 params.push("alt", "json");
2003 let mut url = self.hub._base_url.clone() + "{project}/global/deployments";
2004 if self._scopes.is_empty() {
2005 self._scopes
2006 .insert(Scope::CloudPlatform.as_ref().to_string());
2007 }
2008
2009 #[allow(clippy::single_element_loop)]
2010 for &(find_this, param_name) in [("{project}", "project")].iter() {
2011 url = params.uri_replacement(url, param_name, find_this, false);
2012 }
2013 {
2014 let to_remove = ["project"];
2015 params.remove_params(&to_remove);
2016 }
2017
2018 let url = params.parse_with_url(&url);
2019
2020 let mut json_mime_type = mime::APPLICATION_JSON;
2021 let mut request_value_reader = {
2022 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2023 common::remove_json_null_values(&mut value);
2024 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2025 serde_json::to_writer(&mut dst, &value).unwrap();
2026 dst
2027 };
2028 let request_size = request_value_reader
2029 .seek(std::io::SeekFrom::End(0))
2030 .unwrap();
2031 request_value_reader
2032 .seek(std::io::SeekFrom::Start(0))
2033 .unwrap();
2034
2035 loop {
2036 let token = match self
2037 .hub
2038 .auth
2039 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2040 .await
2041 {
2042 Ok(token) => token,
2043 Err(e) => match dlg.token(e) {
2044 Ok(token) => token,
2045 Err(e) => {
2046 dlg.finished(false);
2047 return Err(common::Error::MissingToken(e));
2048 }
2049 },
2050 };
2051 request_value_reader
2052 .seek(std::io::SeekFrom::Start(0))
2053 .unwrap();
2054 let mut req_result = {
2055 let client = &self.hub.client;
2056 dlg.pre_request();
2057 let mut req_builder = hyper::Request::builder()
2058 .method(hyper::Method::POST)
2059 .uri(url.as_str())
2060 .header(USER_AGENT, self.hub._user_agent.clone());
2061
2062 if let Some(token) = token.as_ref() {
2063 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2064 }
2065
2066 let request = req_builder
2067 .header(CONTENT_TYPE, json_mime_type.to_string())
2068 .header(CONTENT_LENGTH, request_size as u64)
2069 .body(common::to_body(
2070 request_value_reader.get_ref().clone().into(),
2071 ));
2072
2073 client.request(request.unwrap()).await
2074 };
2075
2076 match req_result {
2077 Err(err) => {
2078 if let common::Retry::After(d) = dlg.http_error(&err) {
2079 sleep(d).await;
2080 continue;
2081 }
2082 dlg.finished(false);
2083 return Err(common::Error::HttpError(err));
2084 }
2085 Ok(res) => {
2086 let (mut parts, body) = res.into_parts();
2087 let mut body = common::Body::new(body);
2088 if !parts.status.is_success() {
2089 let bytes = common::to_bytes(body).await.unwrap_or_default();
2090 let error = serde_json::from_str(&common::to_string(&bytes));
2091 let response = common::to_response(parts, bytes.into());
2092
2093 if let common::Retry::After(d) =
2094 dlg.http_failure(&response, error.as_ref().ok())
2095 {
2096 sleep(d).await;
2097 continue;
2098 }
2099
2100 dlg.finished(false);
2101
2102 return Err(match error {
2103 Ok(value) => common::Error::BadRequest(value),
2104 _ => common::Error::Failure(response),
2105 });
2106 }
2107 let response = {
2108 let bytes = common::to_bytes(body).await.unwrap_or_default();
2109 let encoded = common::to_string(&bytes);
2110 match serde_json::from_str(&encoded) {
2111 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2112 Err(error) => {
2113 dlg.response_json_decode_error(&encoded, &error);
2114 return Err(common::Error::JsonDecodeError(
2115 encoded.to_string(),
2116 error,
2117 ));
2118 }
2119 }
2120 };
2121
2122 dlg.finished(true);
2123 return Ok(response);
2124 }
2125 }
2126 }
2127 }
2128
2129 ///
2130 /// Sets the *request* property to the given value.
2131 ///
2132 /// Even though the property as already been set when instantiating this call,
2133 /// we provide this method for API completeness.
2134 pub fn request(mut self, new_value: Deployment) -> DeploymentInsertCall<'a, C> {
2135 self._request = new_value;
2136 self
2137 }
2138 /// The project ID for this request.
2139 ///
2140 /// Sets the *project* path property to the given value.
2141 ///
2142 /// Even though the property as already been set when instantiating this call,
2143 /// we provide this method for API completeness.
2144 pub fn project(mut self, new_value: &str) -> DeploymentInsertCall<'a, C> {
2145 self._project = new_value.to_string();
2146 self
2147 }
2148 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2149 /// while executing the actual API request.
2150 ///
2151 /// ````text
2152 /// It should be used to handle progress information, and to implement a certain level of resilience.
2153 /// ````
2154 ///
2155 /// Sets the *delegate* property to the given value.
2156 pub fn delegate(
2157 mut self,
2158 new_value: &'a mut dyn common::Delegate,
2159 ) -> DeploymentInsertCall<'a, C> {
2160 self._delegate = Some(new_value);
2161 self
2162 }
2163
2164 /// Set any additional parameter of the query string used in the request.
2165 /// It should be used to set parameters which are not yet available through their own
2166 /// setters.
2167 ///
2168 /// Please note that this method must not be used to set any of the known parameters
2169 /// which have their own setter method. If done anyway, the request will fail.
2170 ///
2171 /// # Additional Parameters
2172 ///
2173 /// * *alt* (query-string) - Data format for the response.
2174 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2175 /// * *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.
2176 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2177 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2178 /// * *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.
2179 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2180 pub fn param<T>(mut self, name: T, value: T) -> DeploymentInsertCall<'a, C>
2181 where
2182 T: AsRef<str>,
2183 {
2184 self._additional_params
2185 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2186 self
2187 }
2188
2189 /// Identifies the authorization scope for the method you are building.
2190 ///
2191 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2192 /// [`Scope::CloudPlatform`].
2193 ///
2194 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2195 /// tokens for more than one scope.
2196 ///
2197 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2198 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2199 /// sufficient, a read-write scope will do as well.
2200 pub fn add_scope<St>(mut self, scope: St) -> DeploymentInsertCall<'a, C>
2201 where
2202 St: AsRef<str>,
2203 {
2204 self._scopes.insert(String::from(scope.as_ref()));
2205 self
2206 }
2207 /// Identifies the authorization scope(s) for the method you are building.
2208 ///
2209 /// See [`Self::add_scope()`] for details.
2210 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentInsertCall<'a, C>
2211 where
2212 I: IntoIterator<Item = St>,
2213 St: AsRef<str>,
2214 {
2215 self._scopes
2216 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2217 self
2218 }
2219
2220 /// Removes all scopes, and no default scope will be used either.
2221 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2222 /// for details).
2223 pub fn clear_scopes(mut self) -> DeploymentInsertCall<'a, C> {
2224 self._scopes.clear();
2225 self
2226 }
2227}
2228
2229/// Lists all deployments for a given project.
2230///
2231/// A builder for the *list* method supported by a *deployment* resource.
2232/// It is not used directly, but through a [`DeploymentMethods`] instance.
2233///
2234/// # Example
2235///
2236/// Instantiate a resource method builder
2237///
2238/// ```test_harness,no_run
2239/// # extern crate hyper;
2240/// # extern crate hyper_rustls;
2241/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
2242/// # async fn dox() {
2243/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2244///
2245/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2246/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2247/// # .with_native_roots()
2248/// # .unwrap()
2249/// # .https_only()
2250/// # .enable_http2()
2251/// # .build();
2252///
2253/// # let executor = hyper_util::rt::TokioExecutor::new();
2254/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2255/// # secret,
2256/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2257/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2258/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2259/// # ),
2260/// # ).build().await.unwrap();
2261///
2262/// # let client = hyper_util::client::legacy::Client::builder(
2263/// # hyper_util::rt::TokioExecutor::new()
2264/// # )
2265/// # .build(
2266/// # hyper_rustls::HttpsConnectorBuilder::new()
2267/// # .with_native_roots()
2268/// # .unwrap()
2269/// # .https_or_http()
2270/// # .enable_http2()
2271/// # .build()
2272/// # );
2273/// # let mut hub = DeploymentManager::new(client, auth);
2274/// // You can configure optional parameters by calling the respective setters at will, and
2275/// // execute the final call using `doit()`.
2276/// // Values shown here are possibly random and not representative !
2277/// let result = hub.deployments().list("project")
2278/// .page_token("amet")
2279/// .max_results(81)
2280/// .filter("ipsum")
2281/// .doit().await;
2282/// # }
2283/// ```
2284pub struct DeploymentListCall<'a, C>
2285where
2286 C: 'a,
2287{
2288 hub: &'a DeploymentManager<C>,
2289 _project: String,
2290 _page_token: Option<String>,
2291 _max_results: Option<u32>,
2292 _filter: Option<String>,
2293 _delegate: Option<&'a mut dyn common::Delegate>,
2294 _additional_params: HashMap<String, String>,
2295 _scopes: BTreeSet<String>,
2296}
2297
2298impl<'a, C> common::CallBuilder for DeploymentListCall<'a, C> {}
2299
2300impl<'a, C> DeploymentListCall<'a, C>
2301where
2302 C: common::Connector,
2303{
2304 /// Perform the operation you have build so far.
2305 pub async fn doit(mut self) -> common::Result<(common::Response, DeploymentsListResponse)> {
2306 use std::borrow::Cow;
2307 use std::io::{Read, Seek};
2308
2309 use common::{url::Params, ToParts};
2310 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2311
2312 let mut dd = common::DefaultDelegate;
2313 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2314 dlg.begin(common::MethodInfo {
2315 id: "deploymentmanager.deployments.list",
2316 http_method: hyper::Method::GET,
2317 });
2318
2319 for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() {
2320 if self._additional_params.contains_key(field) {
2321 dlg.finished(false);
2322 return Err(common::Error::FieldClash(field));
2323 }
2324 }
2325
2326 let mut params = Params::with_capacity(6 + self._additional_params.len());
2327 params.push("project", self._project);
2328 if let Some(value) = self._page_token.as_ref() {
2329 params.push("pageToken", value);
2330 }
2331 if let Some(value) = self._max_results.as_ref() {
2332 params.push("maxResults", value.to_string());
2333 }
2334 if let Some(value) = self._filter.as_ref() {
2335 params.push("filter", value);
2336 }
2337
2338 params.extend(self._additional_params.iter());
2339
2340 params.push("alt", "json");
2341 let mut url = self.hub._base_url.clone() + "{project}/global/deployments";
2342 if self._scopes.is_empty() {
2343 self._scopes
2344 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
2345 }
2346
2347 #[allow(clippy::single_element_loop)]
2348 for &(find_this, param_name) in [("{project}", "project")].iter() {
2349 url = params.uri_replacement(url, param_name, find_this, false);
2350 }
2351 {
2352 let to_remove = ["project"];
2353 params.remove_params(&to_remove);
2354 }
2355
2356 let url = params.parse_with_url(&url);
2357
2358 loop {
2359 let token = match self
2360 .hub
2361 .auth
2362 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2363 .await
2364 {
2365 Ok(token) => token,
2366 Err(e) => match dlg.token(e) {
2367 Ok(token) => token,
2368 Err(e) => {
2369 dlg.finished(false);
2370 return Err(common::Error::MissingToken(e));
2371 }
2372 },
2373 };
2374 let mut req_result = {
2375 let client = &self.hub.client;
2376 dlg.pre_request();
2377 let mut req_builder = hyper::Request::builder()
2378 .method(hyper::Method::GET)
2379 .uri(url.as_str())
2380 .header(USER_AGENT, self.hub._user_agent.clone());
2381
2382 if let Some(token) = token.as_ref() {
2383 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2384 }
2385
2386 let request = req_builder
2387 .header(CONTENT_LENGTH, 0_u64)
2388 .body(common::to_body::<String>(None));
2389
2390 client.request(request.unwrap()).await
2391 };
2392
2393 match req_result {
2394 Err(err) => {
2395 if let common::Retry::After(d) = dlg.http_error(&err) {
2396 sleep(d).await;
2397 continue;
2398 }
2399 dlg.finished(false);
2400 return Err(common::Error::HttpError(err));
2401 }
2402 Ok(res) => {
2403 let (mut parts, body) = res.into_parts();
2404 let mut body = common::Body::new(body);
2405 if !parts.status.is_success() {
2406 let bytes = common::to_bytes(body).await.unwrap_or_default();
2407 let error = serde_json::from_str(&common::to_string(&bytes));
2408 let response = common::to_response(parts, bytes.into());
2409
2410 if let common::Retry::After(d) =
2411 dlg.http_failure(&response, error.as_ref().ok())
2412 {
2413 sleep(d).await;
2414 continue;
2415 }
2416
2417 dlg.finished(false);
2418
2419 return Err(match error {
2420 Ok(value) => common::Error::BadRequest(value),
2421 _ => common::Error::Failure(response),
2422 });
2423 }
2424 let response = {
2425 let bytes = common::to_bytes(body).await.unwrap_or_default();
2426 let encoded = common::to_string(&bytes);
2427 match serde_json::from_str(&encoded) {
2428 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2429 Err(error) => {
2430 dlg.response_json_decode_error(&encoded, &error);
2431 return Err(common::Error::JsonDecodeError(
2432 encoded.to_string(),
2433 error,
2434 ));
2435 }
2436 }
2437 };
2438
2439 dlg.finished(true);
2440 return Ok(response);
2441 }
2442 }
2443 }
2444 }
2445
2446 /// The project ID for this request.
2447 ///
2448 /// Sets the *project* path property to the given value.
2449 ///
2450 /// Even though the property as already been set when instantiating this call,
2451 /// we provide this method for API completeness.
2452 pub fn project(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2453 self._project = new_value.to_string();
2454 self
2455 }
2456 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
2457 ///
2458 /// Sets the *page token* query property to the given value.
2459 pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2460 self._page_token = Some(new_value.to_string());
2461 self
2462 }
2463 /// 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.
2464 ///
2465 /// Sets the *max results* query property to the given value.
2466 pub fn max_results(mut self, new_value: u32) -> DeploymentListCall<'a, C> {
2467 self._max_results = Some(new_value);
2468 self
2469 }
2470 /// 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.
2471 ///
2472 /// 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.
2473 ///
2474 /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance.
2475 ///
2476 /// Compute Engine Beta API Only: If you use 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. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
2477 ///
2478 /// 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.
2479 ///
2480 /// Sets the *filter* query property to the given value.
2481 pub fn filter(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
2482 self._filter = Some(new_value.to_string());
2483 self
2484 }
2485 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2486 /// while executing the actual API request.
2487 ///
2488 /// ````text
2489 /// It should be used to handle progress information, and to implement a certain level of resilience.
2490 /// ````
2491 ///
2492 /// Sets the *delegate* property to the given value.
2493 pub fn delegate(
2494 mut self,
2495 new_value: &'a mut dyn common::Delegate,
2496 ) -> DeploymentListCall<'a, C> {
2497 self._delegate = Some(new_value);
2498 self
2499 }
2500
2501 /// Set any additional parameter of the query string used in the request.
2502 /// It should be used to set parameters which are not yet available through their own
2503 /// setters.
2504 ///
2505 /// Please note that this method must not be used to set any of the known parameters
2506 /// which have their own setter method. If done anyway, the request will fail.
2507 ///
2508 /// # Additional Parameters
2509 ///
2510 /// * *alt* (query-string) - Data format for the response.
2511 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2512 /// * *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.
2513 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2514 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2515 /// * *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.
2516 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2517 pub fn param<T>(mut self, name: T, value: T) -> DeploymentListCall<'a, C>
2518 where
2519 T: AsRef<str>,
2520 {
2521 self._additional_params
2522 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2523 self
2524 }
2525
2526 /// Identifies the authorization scope for the method you are building.
2527 ///
2528 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2529 /// [`Scope::NdevCloudmanReadonly`].
2530 ///
2531 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2532 /// tokens for more than one scope.
2533 ///
2534 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2535 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2536 /// sufficient, a read-write scope will do as well.
2537 pub fn add_scope<St>(mut self, scope: St) -> DeploymentListCall<'a, C>
2538 where
2539 St: AsRef<str>,
2540 {
2541 self._scopes.insert(String::from(scope.as_ref()));
2542 self
2543 }
2544 /// Identifies the authorization scope(s) for the method you are building.
2545 ///
2546 /// See [`Self::add_scope()`] for details.
2547 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentListCall<'a, C>
2548 where
2549 I: IntoIterator<Item = St>,
2550 St: AsRef<str>,
2551 {
2552 self._scopes
2553 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2554 self
2555 }
2556
2557 /// Removes all scopes, and no default scope will be used either.
2558 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2559 /// for details).
2560 pub fn clear_scopes(mut self) -> DeploymentListCall<'a, C> {
2561 self._scopes.clear();
2562 self
2563 }
2564}
2565
2566/// Updates a deployment and all of the resources described by the deployment manifest. This method supports patch semantics.
2567///
2568/// A builder for the *patch* method supported by a *deployment* resource.
2569/// It is not used directly, but through a [`DeploymentMethods`] instance.
2570///
2571/// # Example
2572///
2573/// Instantiate a resource method builder
2574///
2575/// ```test_harness,no_run
2576/// # extern crate hyper;
2577/// # extern crate hyper_rustls;
2578/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
2579/// use deploymentmanager2_beta2::api::Deployment;
2580/// # async fn dox() {
2581/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2582///
2583/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2584/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2585/// # .with_native_roots()
2586/// # .unwrap()
2587/// # .https_only()
2588/// # .enable_http2()
2589/// # .build();
2590///
2591/// # let executor = hyper_util::rt::TokioExecutor::new();
2592/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2593/// # secret,
2594/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2595/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2596/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2597/// # ),
2598/// # ).build().await.unwrap();
2599///
2600/// # let client = hyper_util::client::legacy::Client::builder(
2601/// # hyper_util::rt::TokioExecutor::new()
2602/// # )
2603/// # .build(
2604/// # hyper_rustls::HttpsConnectorBuilder::new()
2605/// # .with_native_roots()
2606/// # .unwrap()
2607/// # .https_or_http()
2608/// # .enable_http2()
2609/// # .build()
2610/// # );
2611/// # let mut hub = DeploymentManager::new(client, auth);
2612/// // As the method needs a request, you would usually fill it with the desired information
2613/// // into the respective structure. Some of the parts shown here might not be applicable !
2614/// // Values shown here are possibly random and not representative !
2615/// let mut req = Deployment::default();
2616///
2617/// // You can configure optional parameters by calling the respective setters at will, and
2618/// // execute the final call using `doit()`.
2619/// // Values shown here are possibly random and not representative !
2620/// let result = hub.deployments().patch(req, "project", "deployment")
2621/// .update_policy("gubergren")
2622/// .delete_policy("rebum.")
2623/// .create_policy("est")
2624/// .doit().await;
2625/// # }
2626/// ```
2627pub struct DeploymentPatchCall<'a, C>
2628where
2629 C: 'a,
2630{
2631 hub: &'a DeploymentManager<C>,
2632 _request: Deployment,
2633 _project: String,
2634 _deployment: String,
2635 _update_policy: Option<String>,
2636 _delete_policy: Option<String>,
2637 _create_policy: Option<String>,
2638 _delegate: Option<&'a mut dyn common::Delegate>,
2639 _additional_params: HashMap<String, String>,
2640 _scopes: BTreeSet<String>,
2641}
2642
2643impl<'a, C> common::CallBuilder for DeploymentPatchCall<'a, C> {}
2644
2645impl<'a, C> DeploymentPatchCall<'a, C>
2646where
2647 C: common::Connector,
2648{
2649 /// Perform the operation you have build so far.
2650 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2651 use std::borrow::Cow;
2652 use std::io::{Read, Seek};
2653
2654 use common::{url::Params, ToParts};
2655 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2656
2657 let mut dd = common::DefaultDelegate;
2658 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2659 dlg.begin(common::MethodInfo {
2660 id: "deploymentmanager.deployments.patch",
2661 http_method: hyper::Method::PATCH,
2662 });
2663
2664 for &field in [
2665 "alt",
2666 "project",
2667 "deployment",
2668 "updatePolicy",
2669 "deletePolicy",
2670 "createPolicy",
2671 ]
2672 .iter()
2673 {
2674 if self._additional_params.contains_key(field) {
2675 dlg.finished(false);
2676 return Err(common::Error::FieldClash(field));
2677 }
2678 }
2679
2680 let mut params = Params::with_capacity(8 + self._additional_params.len());
2681 params.push("project", self._project);
2682 params.push("deployment", self._deployment);
2683 if let Some(value) = self._update_policy.as_ref() {
2684 params.push("updatePolicy", value);
2685 }
2686 if let Some(value) = self._delete_policy.as_ref() {
2687 params.push("deletePolicy", value);
2688 }
2689 if let Some(value) = self._create_policy.as_ref() {
2690 params.push("createPolicy", value);
2691 }
2692
2693 params.extend(self._additional_params.iter());
2694
2695 params.push("alt", "json");
2696 let mut url = self.hub._base_url.clone() + "{project}/global/deployments/{deployment}";
2697 if self._scopes.is_empty() {
2698 self._scopes
2699 .insert(Scope::CloudPlatform.as_ref().to_string());
2700 }
2701
2702 #[allow(clippy::single_element_loop)]
2703 for &(find_this, param_name) in
2704 [("{project}", "project"), ("{deployment}", "deployment")].iter()
2705 {
2706 url = params.uri_replacement(url, param_name, find_this, false);
2707 }
2708 {
2709 let to_remove = ["deployment", "project"];
2710 params.remove_params(&to_remove);
2711 }
2712
2713 let url = params.parse_with_url(&url);
2714
2715 let mut json_mime_type = mime::APPLICATION_JSON;
2716 let mut request_value_reader = {
2717 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2718 common::remove_json_null_values(&mut value);
2719 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2720 serde_json::to_writer(&mut dst, &value).unwrap();
2721 dst
2722 };
2723 let request_size = request_value_reader
2724 .seek(std::io::SeekFrom::End(0))
2725 .unwrap();
2726 request_value_reader
2727 .seek(std::io::SeekFrom::Start(0))
2728 .unwrap();
2729
2730 loop {
2731 let token = match self
2732 .hub
2733 .auth
2734 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2735 .await
2736 {
2737 Ok(token) => token,
2738 Err(e) => match dlg.token(e) {
2739 Ok(token) => token,
2740 Err(e) => {
2741 dlg.finished(false);
2742 return Err(common::Error::MissingToken(e));
2743 }
2744 },
2745 };
2746 request_value_reader
2747 .seek(std::io::SeekFrom::Start(0))
2748 .unwrap();
2749 let mut req_result = {
2750 let client = &self.hub.client;
2751 dlg.pre_request();
2752 let mut req_builder = hyper::Request::builder()
2753 .method(hyper::Method::PATCH)
2754 .uri(url.as_str())
2755 .header(USER_AGENT, self.hub._user_agent.clone());
2756
2757 if let Some(token) = token.as_ref() {
2758 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2759 }
2760
2761 let request = req_builder
2762 .header(CONTENT_TYPE, json_mime_type.to_string())
2763 .header(CONTENT_LENGTH, request_size as u64)
2764 .body(common::to_body(
2765 request_value_reader.get_ref().clone().into(),
2766 ));
2767
2768 client.request(request.unwrap()).await
2769 };
2770
2771 match req_result {
2772 Err(err) => {
2773 if let common::Retry::After(d) = dlg.http_error(&err) {
2774 sleep(d).await;
2775 continue;
2776 }
2777 dlg.finished(false);
2778 return Err(common::Error::HttpError(err));
2779 }
2780 Ok(res) => {
2781 let (mut parts, body) = res.into_parts();
2782 let mut body = common::Body::new(body);
2783 if !parts.status.is_success() {
2784 let bytes = common::to_bytes(body).await.unwrap_or_default();
2785 let error = serde_json::from_str(&common::to_string(&bytes));
2786 let response = common::to_response(parts, bytes.into());
2787
2788 if let common::Retry::After(d) =
2789 dlg.http_failure(&response, error.as_ref().ok())
2790 {
2791 sleep(d).await;
2792 continue;
2793 }
2794
2795 dlg.finished(false);
2796
2797 return Err(match error {
2798 Ok(value) => common::Error::BadRequest(value),
2799 _ => common::Error::Failure(response),
2800 });
2801 }
2802 let response = {
2803 let bytes = common::to_bytes(body).await.unwrap_or_default();
2804 let encoded = common::to_string(&bytes);
2805 match serde_json::from_str(&encoded) {
2806 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2807 Err(error) => {
2808 dlg.response_json_decode_error(&encoded, &error);
2809 return Err(common::Error::JsonDecodeError(
2810 encoded.to_string(),
2811 error,
2812 ));
2813 }
2814 }
2815 };
2816
2817 dlg.finished(true);
2818 return Ok(response);
2819 }
2820 }
2821 }
2822 }
2823
2824 ///
2825 /// Sets the *request* property to the given value.
2826 ///
2827 /// Even though the property as already been set when instantiating this call,
2828 /// we provide this method for API completeness.
2829 pub fn request(mut self, new_value: Deployment) -> DeploymentPatchCall<'a, C> {
2830 self._request = new_value;
2831 self
2832 }
2833 /// The project ID for this request.
2834 ///
2835 /// Sets the *project* path property to the given value.
2836 ///
2837 /// Even though the property as already been set when instantiating this call,
2838 /// we provide this method for API completeness.
2839 pub fn project(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
2840 self._project = new_value.to_string();
2841 self
2842 }
2843 /// The name of the deployment for this request.
2844 ///
2845 /// Sets the *deployment* path property to the given value.
2846 ///
2847 /// Even though the property as already been set when instantiating this call,
2848 /// we provide this method for API completeness.
2849 pub fn deployment(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
2850 self._deployment = new_value.to_string();
2851 self
2852 }
2853 /// Sets the policy to use for updating resources.
2854 ///
2855 /// Sets the *update policy* query property to the given value.
2856 pub fn update_policy(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
2857 self._update_policy = Some(new_value.to_string());
2858 self
2859 }
2860 /// Sets the policy to use for deleting resources.
2861 ///
2862 /// Sets the *delete policy* query property to the given value.
2863 pub fn delete_policy(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
2864 self._delete_policy = Some(new_value.to_string());
2865 self
2866 }
2867 /// Sets the policy to use for creating new resources.
2868 ///
2869 /// Sets the *create policy* query property to the given value.
2870 pub fn create_policy(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
2871 self._create_policy = Some(new_value.to_string());
2872 self
2873 }
2874 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2875 /// while executing the actual API request.
2876 ///
2877 /// ````text
2878 /// It should be used to handle progress information, and to implement a certain level of resilience.
2879 /// ````
2880 ///
2881 /// Sets the *delegate* property to the given value.
2882 pub fn delegate(
2883 mut self,
2884 new_value: &'a mut dyn common::Delegate,
2885 ) -> DeploymentPatchCall<'a, C> {
2886 self._delegate = Some(new_value);
2887 self
2888 }
2889
2890 /// Set any additional parameter of the query string used in the request.
2891 /// It should be used to set parameters which are not yet available through their own
2892 /// setters.
2893 ///
2894 /// Please note that this method must not be used to set any of the known parameters
2895 /// which have their own setter method. If done anyway, the request will fail.
2896 ///
2897 /// # Additional Parameters
2898 ///
2899 /// * *alt* (query-string) - Data format for the response.
2900 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2901 /// * *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.
2902 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2903 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2904 /// * *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.
2905 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
2906 pub fn param<T>(mut self, name: T, value: T) -> DeploymentPatchCall<'a, C>
2907 where
2908 T: AsRef<str>,
2909 {
2910 self._additional_params
2911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2912 self
2913 }
2914
2915 /// Identifies the authorization scope for the method you are building.
2916 ///
2917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2918 /// [`Scope::CloudPlatform`].
2919 ///
2920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2921 /// tokens for more than one scope.
2922 ///
2923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2925 /// sufficient, a read-write scope will do as well.
2926 pub fn add_scope<St>(mut self, scope: St) -> DeploymentPatchCall<'a, C>
2927 where
2928 St: AsRef<str>,
2929 {
2930 self._scopes.insert(String::from(scope.as_ref()));
2931 self
2932 }
2933 /// Identifies the authorization scope(s) for the method you are building.
2934 ///
2935 /// See [`Self::add_scope()`] for details.
2936 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentPatchCall<'a, C>
2937 where
2938 I: IntoIterator<Item = St>,
2939 St: AsRef<str>,
2940 {
2941 self._scopes
2942 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2943 self
2944 }
2945
2946 /// Removes all scopes, and no default scope will be used either.
2947 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2948 /// for details).
2949 pub fn clear_scopes(mut self) -> DeploymentPatchCall<'a, C> {
2950 self._scopes.clear();
2951 self
2952 }
2953}
2954
2955/// Updates a deployment and all of the resources described by the deployment manifest.
2956///
2957/// A builder for the *update* method supported by a *deployment* resource.
2958/// It is not used directly, but through a [`DeploymentMethods`] instance.
2959///
2960/// # Example
2961///
2962/// Instantiate a resource method builder
2963///
2964/// ```test_harness,no_run
2965/// # extern crate hyper;
2966/// # extern crate hyper_rustls;
2967/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
2968/// use deploymentmanager2_beta2::api::Deployment;
2969/// # async fn dox() {
2970/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2971///
2972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2973/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2974/// # .with_native_roots()
2975/// # .unwrap()
2976/// # .https_only()
2977/// # .enable_http2()
2978/// # .build();
2979///
2980/// # let executor = hyper_util::rt::TokioExecutor::new();
2981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2982/// # secret,
2983/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2984/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2985/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2986/// # ),
2987/// # ).build().await.unwrap();
2988///
2989/// # let client = hyper_util::client::legacy::Client::builder(
2990/// # hyper_util::rt::TokioExecutor::new()
2991/// # )
2992/// # .build(
2993/// # hyper_rustls::HttpsConnectorBuilder::new()
2994/// # .with_native_roots()
2995/// # .unwrap()
2996/// # .https_or_http()
2997/// # .enable_http2()
2998/// # .build()
2999/// # );
3000/// # let mut hub = DeploymentManager::new(client, auth);
3001/// // As the method needs a request, you would usually fill it with the desired information
3002/// // into the respective structure. Some of the parts shown here might not be applicable !
3003/// // Values shown here are possibly random and not representative !
3004/// let mut req = Deployment::default();
3005///
3006/// // You can configure optional parameters by calling the respective setters at will, and
3007/// // execute the final call using `doit()`.
3008/// // Values shown here are possibly random and not representative !
3009/// let result = hub.deployments().update(req, "project", "deployment")
3010/// .update_policy("est")
3011/// .delete_policy("gubergren")
3012/// .create_policy("ea")
3013/// .doit().await;
3014/// # }
3015/// ```
3016pub struct DeploymentUpdateCall<'a, C>
3017where
3018 C: 'a,
3019{
3020 hub: &'a DeploymentManager<C>,
3021 _request: Deployment,
3022 _project: String,
3023 _deployment: String,
3024 _update_policy: Option<String>,
3025 _delete_policy: Option<String>,
3026 _create_policy: Option<String>,
3027 _delegate: Option<&'a mut dyn common::Delegate>,
3028 _additional_params: HashMap<String, String>,
3029 _scopes: BTreeSet<String>,
3030}
3031
3032impl<'a, C> common::CallBuilder for DeploymentUpdateCall<'a, C> {}
3033
3034impl<'a, C> DeploymentUpdateCall<'a, C>
3035where
3036 C: common::Connector,
3037{
3038 /// Perform the operation you have build so far.
3039 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3040 use std::borrow::Cow;
3041 use std::io::{Read, Seek};
3042
3043 use common::{url::Params, ToParts};
3044 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3045
3046 let mut dd = common::DefaultDelegate;
3047 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3048 dlg.begin(common::MethodInfo {
3049 id: "deploymentmanager.deployments.update",
3050 http_method: hyper::Method::PUT,
3051 });
3052
3053 for &field in [
3054 "alt",
3055 "project",
3056 "deployment",
3057 "updatePolicy",
3058 "deletePolicy",
3059 "createPolicy",
3060 ]
3061 .iter()
3062 {
3063 if self._additional_params.contains_key(field) {
3064 dlg.finished(false);
3065 return Err(common::Error::FieldClash(field));
3066 }
3067 }
3068
3069 let mut params = Params::with_capacity(8 + self._additional_params.len());
3070 params.push("project", self._project);
3071 params.push("deployment", self._deployment);
3072 if let Some(value) = self._update_policy.as_ref() {
3073 params.push("updatePolicy", value);
3074 }
3075 if let Some(value) = self._delete_policy.as_ref() {
3076 params.push("deletePolicy", value);
3077 }
3078 if let Some(value) = self._create_policy.as_ref() {
3079 params.push("createPolicy", value);
3080 }
3081
3082 params.extend(self._additional_params.iter());
3083
3084 params.push("alt", "json");
3085 let mut url = self.hub._base_url.clone() + "{project}/global/deployments/{deployment}";
3086 if self._scopes.is_empty() {
3087 self._scopes
3088 .insert(Scope::CloudPlatform.as_ref().to_string());
3089 }
3090
3091 #[allow(clippy::single_element_loop)]
3092 for &(find_this, param_name) in
3093 [("{project}", "project"), ("{deployment}", "deployment")].iter()
3094 {
3095 url = params.uri_replacement(url, param_name, find_this, false);
3096 }
3097 {
3098 let to_remove = ["deployment", "project"];
3099 params.remove_params(&to_remove);
3100 }
3101
3102 let url = params.parse_with_url(&url);
3103
3104 let mut json_mime_type = mime::APPLICATION_JSON;
3105 let mut request_value_reader = {
3106 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3107 common::remove_json_null_values(&mut value);
3108 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3109 serde_json::to_writer(&mut dst, &value).unwrap();
3110 dst
3111 };
3112 let request_size = request_value_reader
3113 .seek(std::io::SeekFrom::End(0))
3114 .unwrap();
3115 request_value_reader
3116 .seek(std::io::SeekFrom::Start(0))
3117 .unwrap();
3118
3119 loop {
3120 let token = match self
3121 .hub
3122 .auth
3123 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3124 .await
3125 {
3126 Ok(token) => token,
3127 Err(e) => match dlg.token(e) {
3128 Ok(token) => token,
3129 Err(e) => {
3130 dlg.finished(false);
3131 return Err(common::Error::MissingToken(e));
3132 }
3133 },
3134 };
3135 request_value_reader
3136 .seek(std::io::SeekFrom::Start(0))
3137 .unwrap();
3138 let mut req_result = {
3139 let client = &self.hub.client;
3140 dlg.pre_request();
3141 let mut req_builder = hyper::Request::builder()
3142 .method(hyper::Method::PUT)
3143 .uri(url.as_str())
3144 .header(USER_AGENT, self.hub._user_agent.clone());
3145
3146 if let Some(token) = token.as_ref() {
3147 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3148 }
3149
3150 let request = req_builder
3151 .header(CONTENT_TYPE, json_mime_type.to_string())
3152 .header(CONTENT_LENGTH, request_size as u64)
3153 .body(common::to_body(
3154 request_value_reader.get_ref().clone().into(),
3155 ));
3156
3157 client.request(request.unwrap()).await
3158 };
3159
3160 match req_result {
3161 Err(err) => {
3162 if let common::Retry::After(d) = dlg.http_error(&err) {
3163 sleep(d).await;
3164 continue;
3165 }
3166 dlg.finished(false);
3167 return Err(common::Error::HttpError(err));
3168 }
3169 Ok(res) => {
3170 let (mut parts, body) = res.into_parts();
3171 let mut body = common::Body::new(body);
3172 if !parts.status.is_success() {
3173 let bytes = common::to_bytes(body).await.unwrap_or_default();
3174 let error = serde_json::from_str(&common::to_string(&bytes));
3175 let response = common::to_response(parts, bytes.into());
3176
3177 if let common::Retry::After(d) =
3178 dlg.http_failure(&response, error.as_ref().ok())
3179 {
3180 sleep(d).await;
3181 continue;
3182 }
3183
3184 dlg.finished(false);
3185
3186 return Err(match error {
3187 Ok(value) => common::Error::BadRequest(value),
3188 _ => common::Error::Failure(response),
3189 });
3190 }
3191 let response = {
3192 let bytes = common::to_bytes(body).await.unwrap_or_default();
3193 let encoded = common::to_string(&bytes);
3194 match serde_json::from_str(&encoded) {
3195 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3196 Err(error) => {
3197 dlg.response_json_decode_error(&encoded, &error);
3198 return Err(common::Error::JsonDecodeError(
3199 encoded.to_string(),
3200 error,
3201 ));
3202 }
3203 }
3204 };
3205
3206 dlg.finished(true);
3207 return Ok(response);
3208 }
3209 }
3210 }
3211 }
3212
3213 ///
3214 /// Sets the *request* property to the given value.
3215 ///
3216 /// Even though the property as already been set when instantiating this call,
3217 /// we provide this method for API completeness.
3218 pub fn request(mut self, new_value: Deployment) -> DeploymentUpdateCall<'a, C> {
3219 self._request = new_value;
3220 self
3221 }
3222 /// The project ID for this request.
3223 ///
3224 /// Sets the *project* path property to the given value.
3225 ///
3226 /// Even though the property as already been set when instantiating this call,
3227 /// we provide this method for API completeness.
3228 pub fn project(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
3229 self._project = new_value.to_string();
3230 self
3231 }
3232 /// The name of the deployment for this request.
3233 ///
3234 /// Sets the *deployment* path property to the given value.
3235 ///
3236 /// Even though the property as already been set when instantiating this call,
3237 /// we provide this method for API completeness.
3238 pub fn deployment(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
3239 self._deployment = new_value.to_string();
3240 self
3241 }
3242 /// Sets the policy to use for updating resources.
3243 ///
3244 /// Sets the *update policy* query property to the given value.
3245 pub fn update_policy(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
3246 self._update_policy = Some(new_value.to_string());
3247 self
3248 }
3249 /// Sets the policy to use for deleting resources.
3250 ///
3251 /// Sets the *delete policy* query property to the given value.
3252 pub fn delete_policy(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
3253 self._delete_policy = Some(new_value.to_string());
3254 self
3255 }
3256 /// Sets the policy to use for creating new resources.
3257 ///
3258 /// Sets the *create policy* query property to the given value.
3259 pub fn create_policy(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
3260 self._create_policy = Some(new_value.to_string());
3261 self
3262 }
3263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3264 /// while executing the actual API request.
3265 ///
3266 /// ````text
3267 /// It should be used to handle progress information, and to implement a certain level of resilience.
3268 /// ````
3269 ///
3270 /// Sets the *delegate* property to the given value.
3271 pub fn delegate(
3272 mut self,
3273 new_value: &'a mut dyn common::Delegate,
3274 ) -> DeploymentUpdateCall<'a, C> {
3275 self._delegate = Some(new_value);
3276 self
3277 }
3278
3279 /// Set any additional parameter of the query string used in the request.
3280 /// It should be used to set parameters which are not yet available through their own
3281 /// setters.
3282 ///
3283 /// Please note that this method must not be used to set any of the known parameters
3284 /// which have their own setter method. If done anyway, the request will fail.
3285 ///
3286 /// # Additional Parameters
3287 ///
3288 /// * *alt* (query-string) - Data format for the response.
3289 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3290 /// * *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.
3291 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3292 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3293 /// * *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.
3294 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3295 pub fn param<T>(mut self, name: T, value: T) -> DeploymentUpdateCall<'a, C>
3296 where
3297 T: AsRef<str>,
3298 {
3299 self._additional_params
3300 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3301 self
3302 }
3303
3304 /// Identifies the authorization scope for the method you are building.
3305 ///
3306 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3307 /// [`Scope::CloudPlatform`].
3308 ///
3309 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3310 /// tokens for more than one scope.
3311 ///
3312 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3313 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3314 /// sufficient, a read-write scope will do as well.
3315 pub fn add_scope<St>(mut self, scope: St) -> DeploymentUpdateCall<'a, C>
3316 where
3317 St: AsRef<str>,
3318 {
3319 self._scopes.insert(String::from(scope.as_ref()));
3320 self
3321 }
3322 /// Identifies the authorization scope(s) for the method you are building.
3323 ///
3324 /// See [`Self::add_scope()`] for details.
3325 pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentUpdateCall<'a, C>
3326 where
3327 I: IntoIterator<Item = St>,
3328 St: AsRef<str>,
3329 {
3330 self._scopes
3331 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3332 self
3333 }
3334
3335 /// Removes all scopes, and no default scope will be used either.
3336 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3337 /// for details).
3338 pub fn clear_scopes(mut self) -> DeploymentUpdateCall<'a, C> {
3339 self._scopes.clear();
3340 self
3341 }
3342}
3343
3344/// Gets information about a specific manifest.
3345///
3346/// A builder for the *get* method supported by a *manifest* resource.
3347/// It is not used directly, but through a [`ManifestMethods`] instance.
3348///
3349/// # Example
3350///
3351/// Instantiate a resource method builder
3352///
3353/// ```test_harness,no_run
3354/// # extern crate hyper;
3355/// # extern crate hyper_rustls;
3356/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
3357/// # async fn dox() {
3358/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3359///
3360/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3361/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3362/// # .with_native_roots()
3363/// # .unwrap()
3364/// # .https_only()
3365/// # .enable_http2()
3366/// # .build();
3367///
3368/// # let executor = hyper_util::rt::TokioExecutor::new();
3369/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3370/// # secret,
3371/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3372/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3373/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3374/// # ),
3375/// # ).build().await.unwrap();
3376///
3377/// # let client = hyper_util::client::legacy::Client::builder(
3378/// # hyper_util::rt::TokioExecutor::new()
3379/// # )
3380/// # .build(
3381/// # hyper_rustls::HttpsConnectorBuilder::new()
3382/// # .with_native_roots()
3383/// # .unwrap()
3384/// # .https_or_http()
3385/// # .enable_http2()
3386/// # .build()
3387/// # );
3388/// # let mut hub = DeploymentManager::new(client, auth);
3389/// // You can configure optional parameters by calling the respective setters at will, and
3390/// // execute the final call using `doit()`.
3391/// // Values shown here are possibly random and not representative !
3392/// let result = hub.manifests().get("project", "deployment", "manifest")
3393/// .doit().await;
3394/// # }
3395/// ```
3396pub struct ManifestGetCall<'a, C>
3397where
3398 C: 'a,
3399{
3400 hub: &'a DeploymentManager<C>,
3401 _project: String,
3402 _deployment: String,
3403 _manifest: String,
3404 _delegate: Option<&'a mut dyn common::Delegate>,
3405 _additional_params: HashMap<String, String>,
3406 _scopes: BTreeSet<String>,
3407}
3408
3409impl<'a, C> common::CallBuilder for ManifestGetCall<'a, C> {}
3410
3411impl<'a, C> ManifestGetCall<'a, C>
3412where
3413 C: common::Connector,
3414{
3415 /// Perform the operation you have build so far.
3416 pub async fn doit(mut self) -> common::Result<(common::Response, Manifest)> {
3417 use std::borrow::Cow;
3418 use std::io::{Read, Seek};
3419
3420 use common::{url::Params, ToParts};
3421 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3422
3423 let mut dd = common::DefaultDelegate;
3424 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3425 dlg.begin(common::MethodInfo {
3426 id: "deploymentmanager.manifests.get",
3427 http_method: hyper::Method::GET,
3428 });
3429
3430 for &field in ["alt", "project", "deployment", "manifest"].iter() {
3431 if self._additional_params.contains_key(field) {
3432 dlg.finished(false);
3433 return Err(common::Error::FieldClash(field));
3434 }
3435 }
3436
3437 let mut params = Params::with_capacity(5 + self._additional_params.len());
3438 params.push("project", self._project);
3439 params.push("deployment", self._deployment);
3440 params.push("manifest", self._manifest);
3441
3442 params.extend(self._additional_params.iter());
3443
3444 params.push("alt", "json");
3445 let mut url = self.hub._base_url.clone()
3446 + "{project}/global/deployments/{deployment}/manifests/{manifest}";
3447 if self._scopes.is_empty() {
3448 self._scopes
3449 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
3450 }
3451
3452 #[allow(clippy::single_element_loop)]
3453 for &(find_this, param_name) in [
3454 ("{project}", "project"),
3455 ("{deployment}", "deployment"),
3456 ("{manifest}", "manifest"),
3457 ]
3458 .iter()
3459 {
3460 url = params.uri_replacement(url, param_name, find_this, false);
3461 }
3462 {
3463 let to_remove = ["manifest", "deployment", "project"];
3464 params.remove_params(&to_remove);
3465 }
3466
3467 let url = params.parse_with_url(&url);
3468
3469 loop {
3470 let token = match self
3471 .hub
3472 .auth
3473 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3474 .await
3475 {
3476 Ok(token) => token,
3477 Err(e) => match dlg.token(e) {
3478 Ok(token) => token,
3479 Err(e) => {
3480 dlg.finished(false);
3481 return Err(common::Error::MissingToken(e));
3482 }
3483 },
3484 };
3485 let mut req_result = {
3486 let client = &self.hub.client;
3487 dlg.pre_request();
3488 let mut req_builder = hyper::Request::builder()
3489 .method(hyper::Method::GET)
3490 .uri(url.as_str())
3491 .header(USER_AGENT, self.hub._user_agent.clone());
3492
3493 if let Some(token) = token.as_ref() {
3494 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3495 }
3496
3497 let request = req_builder
3498 .header(CONTENT_LENGTH, 0_u64)
3499 .body(common::to_body::<String>(None));
3500
3501 client.request(request.unwrap()).await
3502 };
3503
3504 match req_result {
3505 Err(err) => {
3506 if let common::Retry::After(d) = dlg.http_error(&err) {
3507 sleep(d).await;
3508 continue;
3509 }
3510 dlg.finished(false);
3511 return Err(common::Error::HttpError(err));
3512 }
3513 Ok(res) => {
3514 let (mut parts, body) = res.into_parts();
3515 let mut body = common::Body::new(body);
3516 if !parts.status.is_success() {
3517 let bytes = common::to_bytes(body).await.unwrap_or_default();
3518 let error = serde_json::from_str(&common::to_string(&bytes));
3519 let response = common::to_response(parts, bytes.into());
3520
3521 if let common::Retry::After(d) =
3522 dlg.http_failure(&response, error.as_ref().ok())
3523 {
3524 sleep(d).await;
3525 continue;
3526 }
3527
3528 dlg.finished(false);
3529
3530 return Err(match error {
3531 Ok(value) => common::Error::BadRequest(value),
3532 _ => common::Error::Failure(response),
3533 });
3534 }
3535 let response = {
3536 let bytes = common::to_bytes(body).await.unwrap_or_default();
3537 let encoded = common::to_string(&bytes);
3538 match serde_json::from_str(&encoded) {
3539 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3540 Err(error) => {
3541 dlg.response_json_decode_error(&encoded, &error);
3542 return Err(common::Error::JsonDecodeError(
3543 encoded.to_string(),
3544 error,
3545 ));
3546 }
3547 }
3548 };
3549
3550 dlg.finished(true);
3551 return Ok(response);
3552 }
3553 }
3554 }
3555 }
3556
3557 /// The project ID for this request.
3558 ///
3559 /// Sets the *project* path property to the given value.
3560 ///
3561 /// Even though the property as already been set when instantiating this call,
3562 /// we provide this method for API completeness.
3563 pub fn project(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
3564 self._project = new_value.to_string();
3565 self
3566 }
3567 /// The name of the deployment for this request.
3568 ///
3569 /// Sets the *deployment* path property to the given value.
3570 ///
3571 /// Even though the property as already been set when instantiating this call,
3572 /// we provide this method for API completeness.
3573 pub fn deployment(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
3574 self._deployment = new_value.to_string();
3575 self
3576 }
3577 /// The name of the manifest for this request.
3578 ///
3579 /// Sets the *manifest* path property to the given value.
3580 ///
3581 /// Even though the property as already been set when instantiating this call,
3582 /// we provide this method for API completeness.
3583 pub fn manifest(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
3584 self._manifest = new_value.to_string();
3585 self
3586 }
3587 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3588 /// while executing the actual API request.
3589 ///
3590 /// ````text
3591 /// It should be used to handle progress information, and to implement a certain level of resilience.
3592 /// ````
3593 ///
3594 /// Sets the *delegate* property to the given value.
3595 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ManifestGetCall<'a, C> {
3596 self._delegate = Some(new_value);
3597 self
3598 }
3599
3600 /// Set any additional parameter of the query string used in the request.
3601 /// It should be used to set parameters which are not yet available through their own
3602 /// setters.
3603 ///
3604 /// Please note that this method must not be used to set any of the known parameters
3605 /// which have their own setter method. If done anyway, the request will fail.
3606 ///
3607 /// # Additional Parameters
3608 ///
3609 /// * *alt* (query-string) - Data format for the response.
3610 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3611 /// * *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.
3612 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3613 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3614 /// * *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.
3615 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3616 pub fn param<T>(mut self, name: T, value: T) -> ManifestGetCall<'a, C>
3617 where
3618 T: AsRef<str>,
3619 {
3620 self._additional_params
3621 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3622 self
3623 }
3624
3625 /// Identifies the authorization scope for the method you are building.
3626 ///
3627 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3628 /// [`Scope::NdevCloudmanReadonly`].
3629 ///
3630 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3631 /// tokens for more than one scope.
3632 ///
3633 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3634 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3635 /// sufficient, a read-write scope will do as well.
3636 pub fn add_scope<St>(mut self, scope: St) -> ManifestGetCall<'a, C>
3637 where
3638 St: AsRef<str>,
3639 {
3640 self._scopes.insert(String::from(scope.as_ref()));
3641 self
3642 }
3643 /// Identifies the authorization scope(s) for the method you are building.
3644 ///
3645 /// See [`Self::add_scope()`] for details.
3646 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManifestGetCall<'a, C>
3647 where
3648 I: IntoIterator<Item = St>,
3649 St: AsRef<str>,
3650 {
3651 self._scopes
3652 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3653 self
3654 }
3655
3656 /// Removes all scopes, and no default scope will be used either.
3657 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3658 /// for details).
3659 pub fn clear_scopes(mut self) -> ManifestGetCall<'a, C> {
3660 self._scopes.clear();
3661 self
3662 }
3663}
3664
3665/// Lists all manifests for a given deployment.
3666///
3667/// A builder for the *list* method supported by a *manifest* resource.
3668/// It is not used directly, but through a [`ManifestMethods`] instance.
3669///
3670/// # Example
3671///
3672/// Instantiate a resource method builder
3673///
3674/// ```test_harness,no_run
3675/// # extern crate hyper;
3676/// # extern crate hyper_rustls;
3677/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
3678/// # async fn dox() {
3679/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3680///
3681/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3682/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3683/// # .with_native_roots()
3684/// # .unwrap()
3685/// # .https_only()
3686/// # .enable_http2()
3687/// # .build();
3688///
3689/// # let executor = hyper_util::rt::TokioExecutor::new();
3690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3691/// # secret,
3692/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3693/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3694/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3695/// # ),
3696/// # ).build().await.unwrap();
3697///
3698/// # let client = hyper_util::client::legacy::Client::builder(
3699/// # hyper_util::rt::TokioExecutor::new()
3700/// # )
3701/// # .build(
3702/// # hyper_rustls::HttpsConnectorBuilder::new()
3703/// # .with_native_roots()
3704/// # .unwrap()
3705/// # .https_or_http()
3706/// # .enable_http2()
3707/// # .build()
3708/// # );
3709/// # let mut hub = DeploymentManager::new(client, auth);
3710/// // You can configure optional parameters by calling the respective setters at will, and
3711/// // execute the final call using `doit()`.
3712/// // Values shown here are possibly random and not representative !
3713/// let result = hub.manifests().list("project", "deployment")
3714/// .page_token("duo")
3715/// .max_results(21)
3716/// .filter("no")
3717/// .doit().await;
3718/// # }
3719/// ```
3720pub struct ManifestListCall<'a, C>
3721where
3722 C: 'a,
3723{
3724 hub: &'a DeploymentManager<C>,
3725 _project: String,
3726 _deployment: String,
3727 _page_token: Option<String>,
3728 _max_results: Option<u32>,
3729 _filter: Option<String>,
3730 _delegate: Option<&'a mut dyn common::Delegate>,
3731 _additional_params: HashMap<String, String>,
3732 _scopes: BTreeSet<String>,
3733}
3734
3735impl<'a, C> common::CallBuilder for ManifestListCall<'a, C> {}
3736
3737impl<'a, C> ManifestListCall<'a, C>
3738where
3739 C: common::Connector,
3740{
3741 /// Perform the operation you have build so far.
3742 pub async fn doit(mut self) -> common::Result<(common::Response, ManifestsListResponse)> {
3743 use std::borrow::Cow;
3744 use std::io::{Read, Seek};
3745
3746 use common::{url::Params, ToParts};
3747 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3748
3749 let mut dd = common::DefaultDelegate;
3750 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3751 dlg.begin(common::MethodInfo {
3752 id: "deploymentmanager.manifests.list",
3753 http_method: hyper::Method::GET,
3754 });
3755
3756 for &field in [
3757 "alt",
3758 "project",
3759 "deployment",
3760 "pageToken",
3761 "maxResults",
3762 "filter",
3763 ]
3764 .iter()
3765 {
3766 if self._additional_params.contains_key(field) {
3767 dlg.finished(false);
3768 return Err(common::Error::FieldClash(field));
3769 }
3770 }
3771
3772 let mut params = Params::with_capacity(7 + self._additional_params.len());
3773 params.push("project", self._project);
3774 params.push("deployment", self._deployment);
3775 if let Some(value) = self._page_token.as_ref() {
3776 params.push("pageToken", value);
3777 }
3778 if let Some(value) = self._max_results.as_ref() {
3779 params.push("maxResults", value.to_string());
3780 }
3781 if let Some(value) = self._filter.as_ref() {
3782 params.push("filter", value);
3783 }
3784
3785 params.extend(self._additional_params.iter());
3786
3787 params.push("alt", "json");
3788 let mut url =
3789 self.hub._base_url.clone() + "{project}/global/deployments/{deployment}/manifests";
3790 if self._scopes.is_empty() {
3791 self._scopes
3792 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
3793 }
3794
3795 #[allow(clippy::single_element_loop)]
3796 for &(find_this, param_name) in
3797 [("{project}", "project"), ("{deployment}", "deployment")].iter()
3798 {
3799 url = params.uri_replacement(url, param_name, find_this, false);
3800 }
3801 {
3802 let to_remove = ["deployment", "project"];
3803 params.remove_params(&to_remove);
3804 }
3805
3806 let url = params.parse_with_url(&url);
3807
3808 loop {
3809 let token = match self
3810 .hub
3811 .auth
3812 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3813 .await
3814 {
3815 Ok(token) => token,
3816 Err(e) => match dlg.token(e) {
3817 Ok(token) => token,
3818 Err(e) => {
3819 dlg.finished(false);
3820 return Err(common::Error::MissingToken(e));
3821 }
3822 },
3823 };
3824 let mut req_result = {
3825 let client = &self.hub.client;
3826 dlg.pre_request();
3827 let mut req_builder = hyper::Request::builder()
3828 .method(hyper::Method::GET)
3829 .uri(url.as_str())
3830 .header(USER_AGENT, self.hub._user_agent.clone());
3831
3832 if let Some(token) = token.as_ref() {
3833 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3834 }
3835
3836 let request = req_builder
3837 .header(CONTENT_LENGTH, 0_u64)
3838 .body(common::to_body::<String>(None));
3839
3840 client.request(request.unwrap()).await
3841 };
3842
3843 match req_result {
3844 Err(err) => {
3845 if let common::Retry::After(d) = dlg.http_error(&err) {
3846 sleep(d).await;
3847 continue;
3848 }
3849 dlg.finished(false);
3850 return Err(common::Error::HttpError(err));
3851 }
3852 Ok(res) => {
3853 let (mut parts, body) = res.into_parts();
3854 let mut body = common::Body::new(body);
3855 if !parts.status.is_success() {
3856 let bytes = common::to_bytes(body).await.unwrap_or_default();
3857 let error = serde_json::from_str(&common::to_string(&bytes));
3858 let response = common::to_response(parts, bytes.into());
3859
3860 if let common::Retry::After(d) =
3861 dlg.http_failure(&response, error.as_ref().ok())
3862 {
3863 sleep(d).await;
3864 continue;
3865 }
3866
3867 dlg.finished(false);
3868
3869 return Err(match error {
3870 Ok(value) => common::Error::BadRequest(value),
3871 _ => common::Error::Failure(response),
3872 });
3873 }
3874 let response = {
3875 let bytes = common::to_bytes(body).await.unwrap_or_default();
3876 let encoded = common::to_string(&bytes);
3877 match serde_json::from_str(&encoded) {
3878 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3879 Err(error) => {
3880 dlg.response_json_decode_error(&encoded, &error);
3881 return Err(common::Error::JsonDecodeError(
3882 encoded.to_string(),
3883 error,
3884 ));
3885 }
3886 }
3887 };
3888
3889 dlg.finished(true);
3890 return Ok(response);
3891 }
3892 }
3893 }
3894 }
3895
3896 /// The project ID for this request.
3897 ///
3898 /// Sets the *project* path property to the given value.
3899 ///
3900 /// Even though the property as already been set when instantiating this call,
3901 /// we provide this method for API completeness.
3902 pub fn project(mut self, new_value: &str) -> ManifestListCall<'a, C> {
3903 self._project = new_value.to_string();
3904 self
3905 }
3906 /// The name of the deployment for this request.
3907 ///
3908 /// Sets the *deployment* path property to the given value.
3909 ///
3910 /// Even though the property as already been set when instantiating this call,
3911 /// we provide this method for API completeness.
3912 pub fn deployment(mut self, new_value: &str) -> ManifestListCall<'a, C> {
3913 self._deployment = new_value.to_string();
3914 self
3915 }
3916 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
3917 ///
3918 /// Sets the *page token* query property to the given value.
3919 pub fn page_token(mut self, new_value: &str) -> ManifestListCall<'a, C> {
3920 self._page_token = Some(new_value.to_string());
3921 self
3922 }
3923 /// 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.
3924 ///
3925 /// Sets the *max results* query property to the given value.
3926 pub fn max_results(mut self, new_value: u32) -> ManifestListCall<'a, C> {
3927 self._max_results = Some(new_value);
3928 self
3929 }
3930 /// 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.
3931 ///
3932 /// 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.
3933 ///
3934 /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance.
3935 ///
3936 /// Compute Engine Beta API Only: If you use 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. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
3937 ///
3938 /// 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.
3939 ///
3940 /// Sets the *filter* query property to the given value.
3941 pub fn filter(mut self, new_value: &str) -> ManifestListCall<'a, C> {
3942 self._filter = Some(new_value.to_string());
3943 self
3944 }
3945 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3946 /// while executing the actual API request.
3947 ///
3948 /// ````text
3949 /// It should be used to handle progress information, and to implement a certain level of resilience.
3950 /// ````
3951 ///
3952 /// Sets the *delegate* property to the given value.
3953 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ManifestListCall<'a, C> {
3954 self._delegate = Some(new_value);
3955 self
3956 }
3957
3958 /// Set any additional parameter of the query string used in the request.
3959 /// It should be used to set parameters which are not yet available through their own
3960 /// setters.
3961 ///
3962 /// Please note that this method must not be used to set any of the known parameters
3963 /// which have their own setter method. If done anyway, the request will fail.
3964 ///
3965 /// # Additional Parameters
3966 ///
3967 /// * *alt* (query-string) - Data format for the response.
3968 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3969 /// * *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.
3970 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3971 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3972 /// * *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.
3973 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
3974 pub fn param<T>(mut self, name: T, value: T) -> ManifestListCall<'a, C>
3975 where
3976 T: AsRef<str>,
3977 {
3978 self._additional_params
3979 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3980 self
3981 }
3982
3983 /// Identifies the authorization scope for the method you are building.
3984 ///
3985 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3986 /// [`Scope::NdevCloudmanReadonly`].
3987 ///
3988 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3989 /// tokens for more than one scope.
3990 ///
3991 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3992 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3993 /// sufficient, a read-write scope will do as well.
3994 pub fn add_scope<St>(mut self, scope: St) -> ManifestListCall<'a, C>
3995 where
3996 St: AsRef<str>,
3997 {
3998 self._scopes.insert(String::from(scope.as_ref()));
3999 self
4000 }
4001 /// Identifies the authorization scope(s) for the method you are building.
4002 ///
4003 /// See [`Self::add_scope()`] for details.
4004 pub fn add_scopes<I, St>(mut self, scopes: I) -> ManifestListCall<'a, C>
4005 where
4006 I: IntoIterator<Item = St>,
4007 St: AsRef<str>,
4008 {
4009 self._scopes
4010 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4011 self
4012 }
4013
4014 /// Removes all scopes, and no default scope will be used either.
4015 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4016 /// for details).
4017 pub fn clear_scopes(mut self) -> ManifestListCall<'a, C> {
4018 self._scopes.clear();
4019 self
4020 }
4021}
4022
4023/// Gets information about a specific operation.
4024///
4025/// A builder for the *get* method supported by a *operation* resource.
4026/// It is not used directly, but through a [`OperationMethods`] instance.
4027///
4028/// # Example
4029///
4030/// Instantiate a resource method builder
4031///
4032/// ```test_harness,no_run
4033/// # extern crate hyper;
4034/// # extern crate hyper_rustls;
4035/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
4036/// # async fn dox() {
4037/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4038///
4039/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4040/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4041/// # .with_native_roots()
4042/// # .unwrap()
4043/// # .https_only()
4044/// # .enable_http2()
4045/// # .build();
4046///
4047/// # let executor = hyper_util::rt::TokioExecutor::new();
4048/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4049/// # secret,
4050/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4051/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4052/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4053/// # ),
4054/// # ).build().await.unwrap();
4055///
4056/// # let client = hyper_util::client::legacy::Client::builder(
4057/// # hyper_util::rt::TokioExecutor::new()
4058/// # )
4059/// # .build(
4060/// # hyper_rustls::HttpsConnectorBuilder::new()
4061/// # .with_native_roots()
4062/// # .unwrap()
4063/// # .https_or_http()
4064/// # .enable_http2()
4065/// # .build()
4066/// # );
4067/// # let mut hub = DeploymentManager::new(client, auth);
4068/// // You can configure optional parameters by calling the respective setters at will, and
4069/// // execute the final call using `doit()`.
4070/// // Values shown here are possibly random and not representative !
4071/// let result = hub.operations().get("project", "operation")
4072/// .doit().await;
4073/// # }
4074/// ```
4075pub struct OperationGetCall<'a, C>
4076where
4077 C: 'a,
4078{
4079 hub: &'a DeploymentManager<C>,
4080 _project: String,
4081 _operation: String,
4082 _delegate: Option<&'a mut dyn common::Delegate>,
4083 _additional_params: HashMap<String, String>,
4084 _scopes: BTreeSet<String>,
4085}
4086
4087impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
4088
4089impl<'a, C> OperationGetCall<'a, C>
4090where
4091 C: common::Connector,
4092{
4093 /// Perform the operation you have build so far.
4094 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4095 use std::borrow::Cow;
4096 use std::io::{Read, Seek};
4097
4098 use common::{url::Params, ToParts};
4099 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4100
4101 let mut dd = common::DefaultDelegate;
4102 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4103 dlg.begin(common::MethodInfo {
4104 id: "deploymentmanager.operations.get",
4105 http_method: hyper::Method::GET,
4106 });
4107
4108 for &field in ["alt", "project", "operation"].iter() {
4109 if self._additional_params.contains_key(field) {
4110 dlg.finished(false);
4111 return Err(common::Error::FieldClash(field));
4112 }
4113 }
4114
4115 let mut params = Params::with_capacity(4 + self._additional_params.len());
4116 params.push("project", self._project);
4117 params.push("operation", self._operation);
4118
4119 params.extend(self._additional_params.iter());
4120
4121 params.push("alt", "json");
4122 let mut url = self.hub._base_url.clone() + "{project}/global/operations/{operation}";
4123 if self._scopes.is_empty() {
4124 self._scopes
4125 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
4126 }
4127
4128 #[allow(clippy::single_element_loop)]
4129 for &(find_this, param_name) in
4130 [("{project}", "project"), ("{operation}", "operation")].iter()
4131 {
4132 url = params.uri_replacement(url, param_name, find_this, false);
4133 }
4134 {
4135 let to_remove = ["operation", "project"];
4136 params.remove_params(&to_remove);
4137 }
4138
4139 let url = params.parse_with_url(&url);
4140
4141 loop {
4142 let token = match self
4143 .hub
4144 .auth
4145 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4146 .await
4147 {
4148 Ok(token) => token,
4149 Err(e) => match dlg.token(e) {
4150 Ok(token) => token,
4151 Err(e) => {
4152 dlg.finished(false);
4153 return Err(common::Error::MissingToken(e));
4154 }
4155 },
4156 };
4157 let mut req_result = {
4158 let client = &self.hub.client;
4159 dlg.pre_request();
4160 let mut req_builder = hyper::Request::builder()
4161 .method(hyper::Method::GET)
4162 .uri(url.as_str())
4163 .header(USER_AGENT, self.hub._user_agent.clone());
4164
4165 if let Some(token) = token.as_ref() {
4166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4167 }
4168
4169 let request = req_builder
4170 .header(CONTENT_LENGTH, 0_u64)
4171 .body(common::to_body::<String>(None));
4172
4173 client.request(request.unwrap()).await
4174 };
4175
4176 match req_result {
4177 Err(err) => {
4178 if let common::Retry::After(d) = dlg.http_error(&err) {
4179 sleep(d).await;
4180 continue;
4181 }
4182 dlg.finished(false);
4183 return Err(common::Error::HttpError(err));
4184 }
4185 Ok(res) => {
4186 let (mut parts, body) = res.into_parts();
4187 let mut body = common::Body::new(body);
4188 if !parts.status.is_success() {
4189 let bytes = common::to_bytes(body).await.unwrap_or_default();
4190 let error = serde_json::from_str(&common::to_string(&bytes));
4191 let response = common::to_response(parts, bytes.into());
4192
4193 if let common::Retry::After(d) =
4194 dlg.http_failure(&response, error.as_ref().ok())
4195 {
4196 sleep(d).await;
4197 continue;
4198 }
4199
4200 dlg.finished(false);
4201
4202 return Err(match error {
4203 Ok(value) => common::Error::BadRequest(value),
4204 _ => common::Error::Failure(response),
4205 });
4206 }
4207 let response = {
4208 let bytes = common::to_bytes(body).await.unwrap_or_default();
4209 let encoded = common::to_string(&bytes);
4210 match serde_json::from_str(&encoded) {
4211 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4212 Err(error) => {
4213 dlg.response_json_decode_error(&encoded, &error);
4214 return Err(common::Error::JsonDecodeError(
4215 encoded.to_string(),
4216 error,
4217 ));
4218 }
4219 }
4220 };
4221
4222 dlg.finished(true);
4223 return Ok(response);
4224 }
4225 }
4226 }
4227 }
4228
4229 /// The project ID for this request.
4230 ///
4231 /// Sets the *project* path property to the given value.
4232 ///
4233 /// Even though the property as already been set when instantiating this call,
4234 /// we provide this method for API completeness.
4235 pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C> {
4236 self._project = new_value.to_string();
4237 self
4238 }
4239 /// The name of the operation for this request.
4240 ///
4241 /// Sets the *operation* path property to the given value.
4242 ///
4243 /// Even though the property as already been set when instantiating this call,
4244 /// we provide this method for API completeness.
4245 pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C> {
4246 self._operation = new_value.to_string();
4247 self
4248 }
4249 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4250 /// while executing the actual API request.
4251 ///
4252 /// ````text
4253 /// It should be used to handle progress information, and to implement a certain level of resilience.
4254 /// ````
4255 ///
4256 /// Sets the *delegate* property to the given value.
4257 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
4258 self._delegate = Some(new_value);
4259 self
4260 }
4261
4262 /// Set any additional parameter of the query string used in the request.
4263 /// It should be used to set parameters which are not yet available through their own
4264 /// setters.
4265 ///
4266 /// Please note that this method must not be used to set any of the known parameters
4267 /// which have their own setter method. If done anyway, the request will fail.
4268 ///
4269 /// # Additional Parameters
4270 ///
4271 /// * *alt* (query-string) - Data format for the response.
4272 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4273 /// * *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.
4274 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4275 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4276 /// * *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.
4277 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4278 pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
4279 where
4280 T: AsRef<str>,
4281 {
4282 self._additional_params
4283 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4284 self
4285 }
4286
4287 /// Identifies the authorization scope for the method you are building.
4288 ///
4289 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4290 /// [`Scope::NdevCloudmanReadonly`].
4291 ///
4292 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4293 /// tokens for more than one scope.
4294 ///
4295 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4296 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4297 /// sufficient, a read-write scope will do as well.
4298 pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
4299 where
4300 St: AsRef<str>,
4301 {
4302 self._scopes.insert(String::from(scope.as_ref()));
4303 self
4304 }
4305 /// Identifies the authorization scope(s) for the method you are building.
4306 ///
4307 /// See [`Self::add_scope()`] for details.
4308 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
4309 where
4310 I: IntoIterator<Item = St>,
4311 St: AsRef<str>,
4312 {
4313 self._scopes
4314 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4315 self
4316 }
4317
4318 /// Removes all scopes, and no default scope will be used either.
4319 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4320 /// for details).
4321 pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
4322 self._scopes.clear();
4323 self
4324 }
4325}
4326
4327/// Lists all operations for a project.
4328///
4329/// A builder for the *list* method supported by a *operation* resource.
4330/// It is not used directly, but through a [`OperationMethods`] instance.
4331///
4332/// # Example
4333///
4334/// Instantiate a resource method builder
4335///
4336/// ```test_harness,no_run
4337/// # extern crate hyper;
4338/// # extern crate hyper_rustls;
4339/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
4340/// # async fn dox() {
4341/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4342///
4343/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4344/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4345/// # .with_native_roots()
4346/// # .unwrap()
4347/// # .https_only()
4348/// # .enable_http2()
4349/// # .build();
4350///
4351/// # let executor = hyper_util::rt::TokioExecutor::new();
4352/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4353/// # secret,
4354/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4355/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4356/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4357/// # ),
4358/// # ).build().await.unwrap();
4359///
4360/// # let client = hyper_util::client::legacy::Client::builder(
4361/// # hyper_util::rt::TokioExecutor::new()
4362/// # )
4363/// # .build(
4364/// # hyper_rustls::HttpsConnectorBuilder::new()
4365/// # .with_native_roots()
4366/// # .unwrap()
4367/// # .https_or_http()
4368/// # .enable_http2()
4369/// # .build()
4370/// # );
4371/// # let mut hub = DeploymentManager::new(client, auth);
4372/// // You can configure optional parameters by calling the respective setters at will, and
4373/// // execute the final call using `doit()`.
4374/// // Values shown here are possibly random and not representative !
4375/// let result = hub.operations().list("project")
4376/// .page_token("sed")
4377/// .max_results(77)
4378/// .filter("et")
4379/// .doit().await;
4380/// # }
4381/// ```
4382pub struct OperationListCall<'a, C>
4383where
4384 C: 'a,
4385{
4386 hub: &'a DeploymentManager<C>,
4387 _project: String,
4388 _page_token: Option<String>,
4389 _max_results: Option<u32>,
4390 _filter: Option<String>,
4391 _delegate: Option<&'a mut dyn common::Delegate>,
4392 _additional_params: HashMap<String, String>,
4393 _scopes: BTreeSet<String>,
4394}
4395
4396impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
4397
4398impl<'a, C> OperationListCall<'a, C>
4399where
4400 C: common::Connector,
4401{
4402 /// Perform the operation you have build so far.
4403 pub async fn doit(mut self) -> common::Result<(common::Response, OperationsListResponse)> {
4404 use std::borrow::Cow;
4405 use std::io::{Read, Seek};
4406
4407 use common::{url::Params, ToParts};
4408 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4409
4410 let mut dd = common::DefaultDelegate;
4411 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4412 dlg.begin(common::MethodInfo {
4413 id: "deploymentmanager.operations.list",
4414 http_method: hyper::Method::GET,
4415 });
4416
4417 for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() {
4418 if self._additional_params.contains_key(field) {
4419 dlg.finished(false);
4420 return Err(common::Error::FieldClash(field));
4421 }
4422 }
4423
4424 let mut params = Params::with_capacity(6 + self._additional_params.len());
4425 params.push("project", self._project);
4426 if let Some(value) = self._page_token.as_ref() {
4427 params.push("pageToken", value);
4428 }
4429 if let Some(value) = self._max_results.as_ref() {
4430 params.push("maxResults", value.to_string());
4431 }
4432 if let Some(value) = self._filter.as_ref() {
4433 params.push("filter", value);
4434 }
4435
4436 params.extend(self._additional_params.iter());
4437
4438 params.push("alt", "json");
4439 let mut url = self.hub._base_url.clone() + "{project}/global/operations";
4440 if self._scopes.is_empty() {
4441 self._scopes
4442 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
4443 }
4444
4445 #[allow(clippy::single_element_loop)]
4446 for &(find_this, param_name) in [("{project}", "project")].iter() {
4447 url = params.uri_replacement(url, param_name, find_this, false);
4448 }
4449 {
4450 let to_remove = ["project"];
4451 params.remove_params(&to_remove);
4452 }
4453
4454 let url = params.parse_with_url(&url);
4455
4456 loop {
4457 let token = match self
4458 .hub
4459 .auth
4460 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4461 .await
4462 {
4463 Ok(token) => token,
4464 Err(e) => match dlg.token(e) {
4465 Ok(token) => token,
4466 Err(e) => {
4467 dlg.finished(false);
4468 return Err(common::Error::MissingToken(e));
4469 }
4470 },
4471 };
4472 let mut req_result = {
4473 let client = &self.hub.client;
4474 dlg.pre_request();
4475 let mut req_builder = hyper::Request::builder()
4476 .method(hyper::Method::GET)
4477 .uri(url.as_str())
4478 .header(USER_AGENT, self.hub._user_agent.clone());
4479
4480 if let Some(token) = token.as_ref() {
4481 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4482 }
4483
4484 let request = req_builder
4485 .header(CONTENT_LENGTH, 0_u64)
4486 .body(common::to_body::<String>(None));
4487
4488 client.request(request.unwrap()).await
4489 };
4490
4491 match req_result {
4492 Err(err) => {
4493 if let common::Retry::After(d) = dlg.http_error(&err) {
4494 sleep(d).await;
4495 continue;
4496 }
4497 dlg.finished(false);
4498 return Err(common::Error::HttpError(err));
4499 }
4500 Ok(res) => {
4501 let (mut parts, body) = res.into_parts();
4502 let mut body = common::Body::new(body);
4503 if !parts.status.is_success() {
4504 let bytes = common::to_bytes(body).await.unwrap_or_default();
4505 let error = serde_json::from_str(&common::to_string(&bytes));
4506 let response = common::to_response(parts, bytes.into());
4507
4508 if let common::Retry::After(d) =
4509 dlg.http_failure(&response, error.as_ref().ok())
4510 {
4511 sleep(d).await;
4512 continue;
4513 }
4514
4515 dlg.finished(false);
4516
4517 return Err(match error {
4518 Ok(value) => common::Error::BadRequest(value),
4519 _ => common::Error::Failure(response),
4520 });
4521 }
4522 let response = {
4523 let bytes = common::to_bytes(body).await.unwrap_or_default();
4524 let encoded = common::to_string(&bytes);
4525 match serde_json::from_str(&encoded) {
4526 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4527 Err(error) => {
4528 dlg.response_json_decode_error(&encoded, &error);
4529 return Err(common::Error::JsonDecodeError(
4530 encoded.to_string(),
4531 error,
4532 ));
4533 }
4534 }
4535 };
4536
4537 dlg.finished(true);
4538 return Ok(response);
4539 }
4540 }
4541 }
4542 }
4543
4544 /// The project ID for this request.
4545 ///
4546 /// Sets the *project* path property to the given value.
4547 ///
4548 /// Even though the property as already been set when instantiating this call,
4549 /// we provide this method for API completeness.
4550 pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C> {
4551 self._project = new_value.to_string();
4552 self
4553 }
4554 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
4555 ///
4556 /// Sets the *page token* query property to the given value.
4557 pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
4558 self._page_token = Some(new_value.to_string());
4559 self
4560 }
4561 /// 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.
4562 ///
4563 /// Sets the *max results* query property to the given value.
4564 pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C> {
4565 self._max_results = Some(new_value);
4566 self
4567 }
4568 /// 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.
4569 ///
4570 /// 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.
4571 ///
4572 /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance.
4573 ///
4574 /// Compute Engine Beta API Only: If you use 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. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
4575 ///
4576 /// 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.
4577 ///
4578 /// Sets the *filter* query property to the given value.
4579 pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
4580 self._filter = Some(new_value.to_string());
4581 self
4582 }
4583 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4584 /// while executing the actual API request.
4585 ///
4586 /// ````text
4587 /// It should be used to handle progress information, and to implement a certain level of resilience.
4588 /// ````
4589 ///
4590 /// Sets the *delegate* property to the given value.
4591 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
4592 self._delegate = Some(new_value);
4593 self
4594 }
4595
4596 /// Set any additional parameter of the query string used in the request.
4597 /// It should be used to set parameters which are not yet available through their own
4598 /// setters.
4599 ///
4600 /// Please note that this method must not be used to set any of the known parameters
4601 /// which have their own setter method. If done anyway, the request will fail.
4602 ///
4603 /// # Additional Parameters
4604 ///
4605 /// * *alt* (query-string) - Data format for the response.
4606 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4607 /// * *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.
4608 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4609 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4610 /// * *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.
4611 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4612 pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
4613 where
4614 T: AsRef<str>,
4615 {
4616 self._additional_params
4617 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4618 self
4619 }
4620
4621 /// Identifies the authorization scope for the method you are building.
4622 ///
4623 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4624 /// [`Scope::NdevCloudmanReadonly`].
4625 ///
4626 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4627 /// tokens for more than one scope.
4628 ///
4629 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4630 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4631 /// sufficient, a read-write scope will do as well.
4632 pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
4633 where
4634 St: AsRef<str>,
4635 {
4636 self._scopes.insert(String::from(scope.as_ref()));
4637 self
4638 }
4639 /// Identifies the authorization scope(s) for the method you are building.
4640 ///
4641 /// See [`Self::add_scope()`] for details.
4642 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
4643 where
4644 I: IntoIterator<Item = St>,
4645 St: AsRef<str>,
4646 {
4647 self._scopes
4648 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4649 self
4650 }
4651
4652 /// Removes all scopes, and no default scope will be used either.
4653 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4654 /// for details).
4655 pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
4656 self._scopes.clear();
4657 self
4658 }
4659}
4660
4661/// Gets information about a single resource.
4662///
4663/// A builder for the *get* method supported by a *resource* resource.
4664/// It is not used directly, but through a [`ResourceMethods`] instance.
4665///
4666/// # Example
4667///
4668/// Instantiate a resource method builder
4669///
4670/// ```test_harness,no_run
4671/// # extern crate hyper;
4672/// # extern crate hyper_rustls;
4673/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
4674/// # async fn dox() {
4675/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4676///
4677/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4678/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4679/// # .with_native_roots()
4680/// # .unwrap()
4681/// # .https_only()
4682/// # .enable_http2()
4683/// # .build();
4684///
4685/// # let executor = hyper_util::rt::TokioExecutor::new();
4686/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4687/// # secret,
4688/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4689/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4690/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4691/// # ),
4692/// # ).build().await.unwrap();
4693///
4694/// # let client = hyper_util::client::legacy::Client::builder(
4695/// # hyper_util::rt::TokioExecutor::new()
4696/// # )
4697/// # .build(
4698/// # hyper_rustls::HttpsConnectorBuilder::new()
4699/// # .with_native_roots()
4700/// # .unwrap()
4701/// # .https_or_http()
4702/// # .enable_http2()
4703/// # .build()
4704/// # );
4705/// # let mut hub = DeploymentManager::new(client, auth);
4706/// // You can configure optional parameters by calling the respective setters at will, and
4707/// // execute the final call using `doit()`.
4708/// // Values shown here are possibly random and not representative !
4709/// let result = hub.resources().get("project", "deployment", "resource")
4710/// .doit().await;
4711/// # }
4712/// ```
4713pub struct ResourceGetCall<'a, C>
4714where
4715 C: 'a,
4716{
4717 hub: &'a DeploymentManager<C>,
4718 _project: String,
4719 _deployment: String,
4720 _resource: String,
4721 _delegate: Option<&'a mut dyn common::Delegate>,
4722 _additional_params: HashMap<String, String>,
4723 _scopes: BTreeSet<String>,
4724}
4725
4726impl<'a, C> common::CallBuilder for ResourceGetCall<'a, C> {}
4727
4728impl<'a, C> ResourceGetCall<'a, C>
4729where
4730 C: common::Connector,
4731{
4732 /// Perform the operation you have build so far.
4733 pub async fn doit(mut self) -> common::Result<(common::Response, Resource)> {
4734 use std::borrow::Cow;
4735 use std::io::{Read, Seek};
4736
4737 use common::{url::Params, ToParts};
4738 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4739
4740 let mut dd = common::DefaultDelegate;
4741 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4742 dlg.begin(common::MethodInfo {
4743 id: "deploymentmanager.resources.get",
4744 http_method: hyper::Method::GET,
4745 });
4746
4747 for &field in ["alt", "project", "deployment", "resource"].iter() {
4748 if self._additional_params.contains_key(field) {
4749 dlg.finished(false);
4750 return Err(common::Error::FieldClash(field));
4751 }
4752 }
4753
4754 let mut params = Params::with_capacity(5 + self._additional_params.len());
4755 params.push("project", self._project);
4756 params.push("deployment", self._deployment);
4757 params.push("resource", self._resource);
4758
4759 params.extend(self._additional_params.iter());
4760
4761 params.push("alt", "json");
4762 let mut url = self.hub._base_url.clone()
4763 + "{project}/global/deployments/{deployment}/resources/{resource}";
4764 if self._scopes.is_empty() {
4765 self._scopes
4766 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
4767 }
4768
4769 #[allow(clippy::single_element_loop)]
4770 for &(find_this, param_name) in [
4771 ("{project}", "project"),
4772 ("{deployment}", "deployment"),
4773 ("{resource}", "resource"),
4774 ]
4775 .iter()
4776 {
4777 url = params.uri_replacement(url, param_name, find_this, false);
4778 }
4779 {
4780 let to_remove = ["resource", "deployment", "project"];
4781 params.remove_params(&to_remove);
4782 }
4783
4784 let url = params.parse_with_url(&url);
4785
4786 loop {
4787 let token = match self
4788 .hub
4789 .auth
4790 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4791 .await
4792 {
4793 Ok(token) => token,
4794 Err(e) => match dlg.token(e) {
4795 Ok(token) => token,
4796 Err(e) => {
4797 dlg.finished(false);
4798 return Err(common::Error::MissingToken(e));
4799 }
4800 },
4801 };
4802 let mut req_result = {
4803 let client = &self.hub.client;
4804 dlg.pre_request();
4805 let mut req_builder = hyper::Request::builder()
4806 .method(hyper::Method::GET)
4807 .uri(url.as_str())
4808 .header(USER_AGENT, self.hub._user_agent.clone());
4809
4810 if let Some(token) = token.as_ref() {
4811 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4812 }
4813
4814 let request = req_builder
4815 .header(CONTENT_LENGTH, 0_u64)
4816 .body(common::to_body::<String>(None));
4817
4818 client.request(request.unwrap()).await
4819 };
4820
4821 match req_result {
4822 Err(err) => {
4823 if let common::Retry::After(d) = dlg.http_error(&err) {
4824 sleep(d).await;
4825 continue;
4826 }
4827 dlg.finished(false);
4828 return Err(common::Error::HttpError(err));
4829 }
4830 Ok(res) => {
4831 let (mut parts, body) = res.into_parts();
4832 let mut body = common::Body::new(body);
4833 if !parts.status.is_success() {
4834 let bytes = common::to_bytes(body).await.unwrap_or_default();
4835 let error = serde_json::from_str(&common::to_string(&bytes));
4836 let response = common::to_response(parts, bytes.into());
4837
4838 if let common::Retry::After(d) =
4839 dlg.http_failure(&response, error.as_ref().ok())
4840 {
4841 sleep(d).await;
4842 continue;
4843 }
4844
4845 dlg.finished(false);
4846
4847 return Err(match error {
4848 Ok(value) => common::Error::BadRequest(value),
4849 _ => common::Error::Failure(response),
4850 });
4851 }
4852 let response = {
4853 let bytes = common::to_bytes(body).await.unwrap_or_default();
4854 let encoded = common::to_string(&bytes);
4855 match serde_json::from_str(&encoded) {
4856 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4857 Err(error) => {
4858 dlg.response_json_decode_error(&encoded, &error);
4859 return Err(common::Error::JsonDecodeError(
4860 encoded.to_string(),
4861 error,
4862 ));
4863 }
4864 }
4865 };
4866
4867 dlg.finished(true);
4868 return Ok(response);
4869 }
4870 }
4871 }
4872 }
4873
4874 /// The project ID for this request.
4875 ///
4876 /// Sets the *project* path property to the given value.
4877 ///
4878 /// Even though the property as already been set when instantiating this call,
4879 /// we provide this method for API completeness.
4880 pub fn project(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
4881 self._project = new_value.to_string();
4882 self
4883 }
4884 /// The name of the deployment for this request.
4885 ///
4886 /// Sets the *deployment* path property to the given value.
4887 ///
4888 /// Even though the property as already been set when instantiating this call,
4889 /// we provide this method for API completeness.
4890 pub fn deployment(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
4891 self._deployment = new_value.to_string();
4892 self
4893 }
4894 /// The name of the resource for this request.
4895 ///
4896 /// Sets the *resource* path property to the given value.
4897 ///
4898 /// Even though the property as already been set when instantiating this call,
4899 /// we provide this method for API completeness.
4900 pub fn resource(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
4901 self._resource = new_value.to_string();
4902 self
4903 }
4904 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4905 /// while executing the actual API request.
4906 ///
4907 /// ````text
4908 /// It should be used to handle progress information, and to implement a certain level of resilience.
4909 /// ````
4910 ///
4911 /// Sets the *delegate* property to the given value.
4912 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ResourceGetCall<'a, C> {
4913 self._delegate = Some(new_value);
4914 self
4915 }
4916
4917 /// Set any additional parameter of the query string used in the request.
4918 /// It should be used to set parameters which are not yet available through their own
4919 /// setters.
4920 ///
4921 /// Please note that this method must not be used to set any of the known parameters
4922 /// which have their own setter method. If done anyway, the request will fail.
4923 ///
4924 /// # Additional Parameters
4925 ///
4926 /// * *alt* (query-string) - Data format for the response.
4927 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4928 /// * *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.
4929 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4930 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4931 /// * *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.
4932 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
4933 pub fn param<T>(mut self, name: T, value: T) -> ResourceGetCall<'a, C>
4934 where
4935 T: AsRef<str>,
4936 {
4937 self._additional_params
4938 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4939 self
4940 }
4941
4942 /// Identifies the authorization scope for the method you are building.
4943 ///
4944 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4945 /// [`Scope::NdevCloudmanReadonly`].
4946 ///
4947 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4948 /// tokens for more than one scope.
4949 ///
4950 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4951 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4952 /// sufficient, a read-write scope will do as well.
4953 pub fn add_scope<St>(mut self, scope: St) -> ResourceGetCall<'a, C>
4954 where
4955 St: AsRef<str>,
4956 {
4957 self._scopes.insert(String::from(scope.as_ref()));
4958 self
4959 }
4960 /// Identifies the authorization scope(s) for the method you are building.
4961 ///
4962 /// See [`Self::add_scope()`] for details.
4963 pub fn add_scopes<I, St>(mut self, scopes: I) -> ResourceGetCall<'a, C>
4964 where
4965 I: IntoIterator<Item = St>,
4966 St: AsRef<str>,
4967 {
4968 self._scopes
4969 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4970 self
4971 }
4972
4973 /// Removes all scopes, and no default scope will be used either.
4974 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4975 /// for details).
4976 pub fn clear_scopes(mut self) -> ResourceGetCall<'a, C> {
4977 self._scopes.clear();
4978 self
4979 }
4980}
4981
4982/// Lists all resources in a given deployment.
4983///
4984/// A builder for the *list* method supported by a *resource* resource.
4985/// It is not used directly, but through a [`ResourceMethods`] instance.
4986///
4987/// # Example
4988///
4989/// Instantiate a resource method builder
4990///
4991/// ```test_harness,no_run
4992/// # extern crate hyper;
4993/// # extern crate hyper_rustls;
4994/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
4995/// # async fn dox() {
4996/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4997///
4998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4999/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5000/// # .with_native_roots()
5001/// # .unwrap()
5002/// # .https_only()
5003/// # .enable_http2()
5004/// # .build();
5005///
5006/// # let executor = hyper_util::rt::TokioExecutor::new();
5007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5008/// # secret,
5009/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5010/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5011/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5012/// # ),
5013/// # ).build().await.unwrap();
5014///
5015/// # let client = hyper_util::client::legacy::Client::builder(
5016/// # hyper_util::rt::TokioExecutor::new()
5017/// # )
5018/// # .build(
5019/// # hyper_rustls::HttpsConnectorBuilder::new()
5020/// # .with_native_roots()
5021/// # .unwrap()
5022/// # .https_or_http()
5023/// # .enable_http2()
5024/// # .build()
5025/// # );
5026/// # let mut hub = DeploymentManager::new(client, auth);
5027/// // You can configure optional parameters by calling the respective setters at will, and
5028/// // execute the final call using `doit()`.
5029/// // Values shown here are possibly random and not representative !
5030/// let result = hub.resources().list("project", "deployment")
5031/// .page_token("et")
5032/// .max_results(73)
5033/// .filter("amet.")
5034/// .doit().await;
5035/// # }
5036/// ```
5037pub struct ResourceListCall<'a, C>
5038where
5039 C: 'a,
5040{
5041 hub: &'a DeploymentManager<C>,
5042 _project: String,
5043 _deployment: String,
5044 _page_token: Option<String>,
5045 _max_results: Option<u32>,
5046 _filter: Option<String>,
5047 _delegate: Option<&'a mut dyn common::Delegate>,
5048 _additional_params: HashMap<String, String>,
5049 _scopes: BTreeSet<String>,
5050}
5051
5052impl<'a, C> common::CallBuilder for ResourceListCall<'a, C> {}
5053
5054impl<'a, C> ResourceListCall<'a, C>
5055where
5056 C: common::Connector,
5057{
5058 /// Perform the operation you have build so far.
5059 pub async fn doit(mut self) -> common::Result<(common::Response, ResourcesListResponse)> {
5060 use std::borrow::Cow;
5061 use std::io::{Read, Seek};
5062
5063 use common::{url::Params, ToParts};
5064 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5065
5066 let mut dd = common::DefaultDelegate;
5067 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5068 dlg.begin(common::MethodInfo {
5069 id: "deploymentmanager.resources.list",
5070 http_method: hyper::Method::GET,
5071 });
5072
5073 for &field in [
5074 "alt",
5075 "project",
5076 "deployment",
5077 "pageToken",
5078 "maxResults",
5079 "filter",
5080 ]
5081 .iter()
5082 {
5083 if self._additional_params.contains_key(field) {
5084 dlg.finished(false);
5085 return Err(common::Error::FieldClash(field));
5086 }
5087 }
5088
5089 let mut params = Params::with_capacity(7 + self._additional_params.len());
5090 params.push("project", self._project);
5091 params.push("deployment", self._deployment);
5092 if let Some(value) = self._page_token.as_ref() {
5093 params.push("pageToken", value);
5094 }
5095 if let Some(value) = self._max_results.as_ref() {
5096 params.push("maxResults", value.to_string());
5097 }
5098 if let Some(value) = self._filter.as_ref() {
5099 params.push("filter", value);
5100 }
5101
5102 params.extend(self._additional_params.iter());
5103
5104 params.push("alt", "json");
5105 let mut url =
5106 self.hub._base_url.clone() + "{project}/global/deployments/{deployment}/resources";
5107 if self._scopes.is_empty() {
5108 self._scopes
5109 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
5110 }
5111
5112 #[allow(clippy::single_element_loop)]
5113 for &(find_this, param_name) in
5114 [("{project}", "project"), ("{deployment}", "deployment")].iter()
5115 {
5116 url = params.uri_replacement(url, param_name, find_this, false);
5117 }
5118 {
5119 let to_remove = ["deployment", "project"];
5120 params.remove_params(&to_remove);
5121 }
5122
5123 let url = params.parse_with_url(&url);
5124
5125 loop {
5126 let token = match self
5127 .hub
5128 .auth
5129 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5130 .await
5131 {
5132 Ok(token) => token,
5133 Err(e) => match dlg.token(e) {
5134 Ok(token) => token,
5135 Err(e) => {
5136 dlg.finished(false);
5137 return Err(common::Error::MissingToken(e));
5138 }
5139 },
5140 };
5141 let mut req_result = {
5142 let client = &self.hub.client;
5143 dlg.pre_request();
5144 let mut req_builder = hyper::Request::builder()
5145 .method(hyper::Method::GET)
5146 .uri(url.as_str())
5147 .header(USER_AGENT, self.hub._user_agent.clone());
5148
5149 if let Some(token) = token.as_ref() {
5150 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5151 }
5152
5153 let request = req_builder
5154 .header(CONTENT_LENGTH, 0_u64)
5155 .body(common::to_body::<String>(None));
5156
5157 client.request(request.unwrap()).await
5158 };
5159
5160 match req_result {
5161 Err(err) => {
5162 if let common::Retry::After(d) = dlg.http_error(&err) {
5163 sleep(d).await;
5164 continue;
5165 }
5166 dlg.finished(false);
5167 return Err(common::Error::HttpError(err));
5168 }
5169 Ok(res) => {
5170 let (mut parts, body) = res.into_parts();
5171 let mut body = common::Body::new(body);
5172 if !parts.status.is_success() {
5173 let bytes = common::to_bytes(body).await.unwrap_or_default();
5174 let error = serde_json::from_str(&common::to_string(&bytes));
5175 let response = common::to_response(parts, bytes.into());
5176
5177 if let common::Retry::After(d) =
5178 dlg.http_failure(&response, error.as_ref().ok())
5179 {
5180 sleep(d).await;
5181 continue;
5182 }
5183
5184 dlg.finished(false);
5185
5186 return Err(match error {
5187 Ok(value) => common::Error::BadRequest(value),
5188 _ => common::Error::Failure(response),
5189 });
5190 }
5191 let response = {
5192 let bytes = common::to_bytes(body).await.unwrap_or_default();
5193 let encoded = common::to_string(&bytes);
5194 match serde_json::from_str(&encoded) {
5195 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5196 Err(error) => {
5197 dlg.response_json_decode_error(&encoded, &error);
5198 return Err(common::Error::JsonDecodeError(
5199 encoded.to_string(),
5200 error,
5201 ));
5202 }
5203 }
5204 };
5205
5206 dlg.finished(true);
5207 return Ok(response);
5208 }
5209 }
5210 }
5211 }
5212
5213 /// The project ID for this request.
5214 ///
5215 /// Sets the *project* path property to the given value.
5216 ///
5217 /// Even though the property as already been set when instantiating this call,
5218 /// we provide this method for API completeness.
5219 pub fn project(mut self, new_value: &str) -> ResourceListCall<'a, C> {
5220 self._project = new_value.to_string();
5221 self
5222 }
5223 /// The name of the deployment for this request.
5224 ///
5225 /// Sets the *deployment* path property to the given value.
5226 ///
5227 /// Even though the property as already been set when instantiating this call,
5228 /// we provide this method for API completeness.
5229 pub fn deployment(mut self, new_value: &str) -> ResourceListCall<'a, C> {
5230 self._deployment = new_value.to_string();
5231 self
5232 }
5233 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
5234 ///
5235 /// Sets the *page token* query property to the given value.
5236 pub fn page_token(mut self, new_value: &str) -> ResourceListCall<'a, C> {
5237 self._page_token = Some(new_value.to_string());
5238 self
5239 }
5240 /// 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.
5241 ///
5242 /// Sets the *max results* query property to the given value.
5243 pub fn max_results(mut self, new_value: u32) -> ResourceListCall<'a, C> {
5244 self._max_results = Some(new_value);
5245 self
5246 }
5247 /// 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.
5248 ///
5249 /// 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.
5250 ///
5251 /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance.
5252 ///
5253 /// Compute Engine Beta API Only: If you use 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. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
5254 ///
5255 /// 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.
5256 ///
5257 /// Sets the *filter* query property to the given value.
5258 pub fn filter(mut self, new_value: &str) -> ResourceListCall<'a, C> {
5259 self._filter = Some(new_value.to_string());
5260 self
5261 }
5262 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5263 /// while executing the actual API request.
5264 ///
5265 /// ````text
5266 /// It should be used to handle progress information, and to implement a certain level of resilience.
5267 /// ````
5268 ///
5269 /// Sets the *delegate* property to the given value.
5270 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ResourceListCall<'a, C> {
5271 self._delegate = Some(new_value);
5272 self
5273 }
5274
5275 /// Set any additional parameter of the query string used in the request.
5276 /// It should be used to set parameters which are not yet available through their own
5277 /// setters.
5278 ///
5279 /// Please note that this method must not be used to set any of the known parameters
5280 /// which have their own setter method. If done anyway, the request will fail.
5281 ///
5282 /// # Additional Parameters
5283 ///
5284 /// * *alt* (query-string) - Data format for the response.
5285 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5286 /// * *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.
5287 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5288 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5289 /// * *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.
5290 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
5291 pub fn param<T>(mut self, name: T, value: T) -> ResourceListCall<'a, C>
5292 where
5293 T: AsRef<str>,
5294 {
5295 self._additional_params
5296 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5297 self
5298 }
5299
5300 /// Identifies the authorization scope for the method you are building.
5301 ///
5302 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5303 /// [`Scope::NdevCloudmanReadonly`].
5304 ///
5305 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5306 /// tokens for more than one scope.
5307 ///
5308 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5309 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5310 /// sufficient, a read-write scope will do as well.
5311 pub fn add_scope<St>(mut self, scope: St) -> ResourceListCall<'a, C>
5312 where
5313 St: AsRef<str>,
5314 {
5315 self._scopes.insert(String::from(scope.as_ref()));
5316 self
5317 }
5318 /// Identifies the authorization scope(s) for the method you are building.
5319 ///
5320 /// See [`Self::add_scope()`] for details.
5321 pub fn add_scopes<I, St>(mut self, scopes: I) -> ResourceListCall<'a, C>
5322 where
5323 I: IntoIterator<Item = St>,
5324 St: AsRef<str>,
5325 {
5326 self._scopes
5327 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5328 self
5329 }
5330
5331 /// Removes all scopes, and no default scope will be used either.
5332 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5333 /// for details).
5334 pub fn clear_scopes(mut self) -> ResourceListCall<'a, C> {
5335 self._scopes.clear();
5336 self
5337 }
5338}
5339
5340/// Lists all resource types for Deployment Manager.
5341///
5342/// A builder for the *list* method supported by a *type* resource.
5343/// It is not used directly, but through a [`TypeMethods`] instance.
5344///
5345/// # Example
5346///
5347/// Instantiate a resource method builder
5348///
5349/// ```test_harness,no_run
5350/// # extern crate hyper;
5351/// # extern crate hyper_rustls;
5352/// # extern crate google_deploymentmanager2_beta2 as deploymentmanager2_beta2;
5353/// # async fn dox() {
5354/// # use deploymentmanager2_beta2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5355///
5356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5357/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5358/// # .with_native_roots()
5359/// # .unwrap()
5360/// # .https_only()
5361/// # .enable_http2()
5362/// # .build();
5363///
5364/// # let executor = hyper_util::rt::TokioExecutor::new();
5365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5366/// # secret,
5367/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5368/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5369/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5370/// # ),
5371/// # ).build().await.unwrap();
5372///
5373/// # let client = hyper_util::client::legacy::Client::builder(
5374/// # hyper_util::rt::TokioExecutor::new()
5375/// # )
5376/// # .build(
5377/// # hyper_rustls::HttpsConnectorBuilder::new()
5378/// # .with_native_roots()
5379/// # .unwrap()
5380/// # .https_or_http()
5381/// # .enable_http2()
5382/// # .build()
5383/// # );
5384/// # let mut hub = DeploymentManager::new(client, auth);
5385/// // You can configure optional parameters by calling the respective setters at will, and
5386/// // execute the final call using `doit()`.
5387/// // Values shown here are possibly random and not representative !
5388/// let result = hub.types().list("project")
5389/// .page_token("diam")
5390/// .max_results(52)
5391/// .filter("et")
5392/// .doit().await;
5393/// # }
5394/// ```
5395pub struct TypeListCall<'a, C>
5396where
5397 C: 'a,
5398{
5399 hub: &'a DeploymentManager<C>,
5400 _project: String,
5401 _page_token: Option<String>,
5402 _max_results: Option<u32>,
5403 _filter: Option<String>,
5404 _delegate: Option<&'a mut dyn common::Delegate>,
5405 _additional_params: HashMap<String, String>,
5406 _scopes: BTreeSet<String>,
5407}
5408
5409impl<'a, C> common::CallBuilder for TypeListCall<'a, C> {}
5410
5411impl<'a, C> TypeListCall<'a, C>
5412where
5413 C: common::Connector,
5414{
5415 /// Perform the operation you have build so far.
5416 pub async fn doit(mut self) -> common::Result<(common::Response, TypesListResponse)> {
5417 use std::borrow::Cow;
5418 use std::io::{Read, Seek};
5419
5420 use common::{url::Params, ToParts};
5421 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5422
5423 let mut dd = common::DefaultDelegate;
5424 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5425 dlg.begin(common::MethodInfo {
5426 id: "deploymentmanager.types.list",
5427 http_method: hyper::Method::GET,
5428 });
5429
5430 for &field in ["alt", "project", "pageToken", "maxResults", "filter"].iter() {
5431 if self._additional_params.contains_key(field) {
5432 dlg.finished(false);
5433 return Err(common::Error::FieldClash(field));
5434 }
5435 }
5436
5437 let mut params = Params::with_capacity(6 + self._additional_params.len());
5438 params.push("project", self._project);
5439 if let Some(value) = self._page_token.as_ref() {
5440 params.push("pageToken", value);
5441 }
5442 if let Some(value) = self._max_results.as_ref() {
5443 params.push("maxResults", value.to_string());
5444 }
5445 if let Some(value) = self._filter.as_ref() {
5446 params.push("filter", value);
5447 }
5448
5449 params.extend(self._additional_params.iter());
5450
5451 params.push("alt", "json");
5452 let mut url = self.hub._base_url.clone() + "{project}/global/types";
5453 if self._scopes.is_empty() {
5454 self._scopes
5455 .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
5456 }
5457
5458 #[allow(clippy::single_element_loop)]
5459 for &(find_this, param_name) in [("{project}", "project")].iter() {
5460 url = params.uri_replacement(url, param_name, find_this, false);
5461 }
5462 {
5463 let to_remove = ["project"];
5464 params.remove_params(&to_remove);
5465 }
5466
5467 let url = params.parse_with_url(&url);
5468
5469 loop {
5470 let token = match self
5471 .hub
5472 .auth
5473 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5474 .await
5475 {
5476 Ok(token) => token,
5477 Err(e) => match dlg.token(e) {
5478 Ok(token) => token,
5479 Err(e) => {
5480 dlg.finished(false);
5481 return Err(common::Error::MissingToken(e));
5482 }
5483 },
5484 };
5485 let mut req_result = {
5486 let client = &self.hub.client;
5487 dlg.pre_request();
5488 let mut req_builder = hyper::Request::builder()
5489 .method(hyper::Method::GET)
5490 .uri(url.as_str())
5491 .header(USER_AGENT, self.hub._user_agent.clone());
5492
5493 if let Some(token) = token.as_ref() {
5494 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5495 }
5496
5497 let request = req_builder
5498 .header(CONTENT_LENGTH, 0_u64)
5499 .body(common::to_body::<String>(None));
5500
5501 client.request(request.unwrap()).await
5502 };
5503
5504 match req_result {
5505 Err(err) => {
5506 if let common::Retry::After(d) = dlg.http_error(&err) {
5507 sleep(d).await;
5508 continue;
5509 }
5510 dlg.finished(false);
5511 return Err(common::Error::HttpError(err));
5512 }
5513 Ok(res) => {
5514 let (mut parts, body) = res.into_parts();
5515 let mut body = common::Body::new(body);
5516 if !parts.status.is_success() {
5517 let bytes = common::to_bytes(body).await.unwrap_or_default();
5518 let error = serde_json::from_str(&common::to_string(&bytes));
5519 let response = common::to_response(parts, bytes.into());
5520
5521 if let common::Retry::After(d) =
5522 dlg.http_failure(&response, error.as_ref().ok())
5523 {
5524 sleep(d).await;
5525 continue;
5526 }
5527
5528 dlg.finished(false);
5529
5530 return Err(match error {
5531 Ok(value) => common::Error::BadRequest(value),
5532 _ => common::Error::Failure(response),
5533 });
5534 }
5535 let response = {
5536 let bytes = common::to_bytes(body).await.unwrap_or_default();
5537 let encoded = common::to_string(&bytes);
5538 match serde_json::from_str(&encoded) {
5539 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5540 Err(error) => {
5541 dlg.response_json_decode_error(&encoded, &error);
5542 return Err(common::Error::JsonDecodeError(
5543 encoded.to_string(),
5544 error,
5545 ));
5546 }
5547 }
5548 };
5549
5550 dlg.finished(true);
5551 return Ok(response);
5552 }
5553 }
5554 }
5555 }
5556
5557 /// The project ID for this request.
5558 ///
5559 /// Sets the *project* path property to the given value.
5560 ///
5561 /// Even though the property as already been set when instantiating this call,
5562 /// we provide this method for API completeness.
5563 pub fn project(mut self, new_value: &str) -> TypeListCall<'a, C> {
5564 self._project = new_value.to_string();
5565 self
5566 }
5567 /// Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.
5568 ///
5569 /// Sets the *page token* query property to the given value.
5570 pub fn page_token(mut self, new_value: &str) -> TypeListCall<'a, C> {
5571 self._page_token = Some(new_value.to_string());
5572 self
5573 }
5574 /// 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.
5575 ///
5576 /// Sets the *max results* query property to the given value.
5577 pub fn max_results(mut self, new_value: u32) -> TypeListCall<'a, C> {
5578 self._max_results = Some(new_value);
5579 self
5580 }
5581 /// 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.
5582 ///
5583 /// 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.
5584 ///
5585 /// For example, to filter for instances whose name is not equal to example-instance, you would use filter=name ne example-instance.
5586 ///
5587 /// Compute Engine Beta API Only: If you use 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. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.
5588 ///
5589 /// 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.
5590 ///
5591 /// Sets the *filter* query property to the given value.
5592 pub fn filter(mut self, new_value: &str) -> TypeListCall<'a, C> {
5593 self._filter = Some(new_value.to_string());
5594 self
5595 }
5596 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5597 /// while executing the actual API request.
5598 ///
5599 /// ````text
5600 /// It should be used to handle progress information, and to implement a certain level of resilience.
5601 /// ````
5602 ///
5603 /// Sets the *delegate* property to the given value.
5604 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TypeListCall<'a, C> {
5605 self._delegate = Some(new_value);
5606 self
5607 }
5608
5609 /// Set any additional parameter of the query string used in the request.
5610 /// It should be used to set parameters which are not yet available through their own
5611 /// setters.
5612 ///
5613 /// Please note that this method must not be used to set any of the known parameters
5614 /// which have their own setter method. If done anyway, the request will fail.
5615 ///
5616 /// # Additional Parameters
5617 ///
5618 /// * *alt* (query-string) - Data format for the response.
5619 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5620 /// * *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.
5621 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5622 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5623 /// * *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.
5624 /// * *userIp* (query-string) - IP address of the site where the request originates. Use this if you want to enforce per-user limits.
5625 pub fn param<T>(mut self, name: T, value: T) -> TypeListCall<'a, C>
5626 where
5627 T: AsRef<str>,
5628 {
5629 self._additional_params
5630 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5631 self
5632 }
5633
5634 /// Identifies the authorization scope for the method you are building.
5635 ///
5636 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5637 /// [`Scope::NdevCloudmanReadonly`].
5638 ///
5639 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5640 /// tokens for more than one scope.
5641 ///
5642 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5643 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5644 /// sufficient, a read-write scope will do as well.
5645 pub fn add_scope<St>(mut self, scope: St) -> TypeListCall<'a, C>
5646 where
5647 St: AsRef<str>,
5648 {
5649 self._scopes.insert(String::from(scope.as_ref()));
5650 self
5651 }
5652 /// Identifies the authorization scope(s) for the method you are building.
5653 ///
5654 /// See [`Self::add_scope()`] for details.
5655 pub fn add_scopes<I, St>(mut self, scopes: I) -> TypeListCall<'a, C>
5656 where
5657 I: IntoIterator<Item = St>,
5658 St: AsRef<str>,
5659 {
5660 self._scopes
5661 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5662 self
5663 }
5664
5665 /// Removes all scopes, and no default scope will be used either.
5666 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5667 /// for details).
5668 pub fn clear_scopes(mut self) -> TypeListCall<'a, C> {
5669 self._scopes.clear();
5670 self
5671 }
5672}