google_cloud_deploy_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Deploy API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_deploy_v1::client::CloudDeploy;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// project_id: &str,
27/// location_id: &str,
28/// ) -> anyhow::Result<()> {
29/// let client = CloudDeploy::builder().build().await?;
30/// let mut list = client.list_delivery_pipelines()
31/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
32/// .by_item();
33/// while let Some(item) = list.next().await.transpose()? {
34/// println!("{:?}", item);
35/// }
36/// Ok(())
37/// }
38/// ```
39///
40/// # Service Description
41///
42/// CloudDeploy service creates and manages Continuous Delivery operations
43/// on Google Cloud Platform via Skaffold (<https://skaffold.dev>).
44///
45/// # Configuration
46///
47/// To configure `CloudDeploy` use the `with_*` methods in the type returned
48/// by [builder()][CloudDeploy::builder]. The default configuration should
49/// work for most applications. Common configuration changes include
50///
51/// * [with_endpoint()]: by default this client uses the global default endpoint
52/// (`https://clouddeploy.googleapis.com`). Applications using regional
53/// endpoints or running in restricted networks (e.g. a network configured
54// with [Private Google Access with VPC Service Controls]) may want to
55/// override this default.
56/// * [with_credentials()]: by default this client uses
57/// [Application Default Credentials]. Applications using custom
58/// authentication may need to override this default.
59///
60/// [with_endpoint()]: super::builder::cloud_deploy::ClientBuilder::with_endpoint
61/// [with_credentials()]: super::builder::cloud_deploy::ClientBuilder::with_credentials
62/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
63/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
64///
65/// # Pooling and Cloning
66///
67/// `CloudDeploy` holds a connection pool internally, it is advised to
68/// create one and reuse it. You do not need to wrap `CloudDeploy` in
69/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
70/// already uses an `Arc` internally.
71#[derive(Clone, Debug)]
72pub struct CloudDeploy {
73 inner: std::sync::Arc<dyn super::stub::dynamic::CloudDeploy>,
74}
75
76impl CloudDeploy {
77 /// Returns a builder for [CloudDeploy].
78 ///
79 /// ```
80 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81 /// # use google_cloud_deploy_v1::client::CloudDeploy;
82 /// let client = CloudDeploy::builder().build().await?;
83 /// # Ok(()) }
84 /// ```
85 pub fn builder() -> super::builder::cloud_deploy::ClientBuilder {
86 crate::new_client_builder(super::builder::cloud_deploy::client::Factory)
87 }
88
89 /// Creates a new client from the provided stub.
90 ///
91 /// The most common case for calling this function is in tests mocking the
92 /// client's behavior.
93 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
94 where
95 T: super::stub::CloudDeploy + 'static,
96 {
97 Self { inner: stub.into() }
98 }
99
100 pub(crate) async fn new(
101 config: gaxi::options::ClientConfig,
102 ) -> crate::ClientBuilderResult<Self> {
103 let inner = Self::build_inner(config).await?;
104 Ok(Self { inner })
105 }
106
107 async fn build_inner(
108 conf: gaxi::options::ClientConfig,
109 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CloudDeploy>> {
110 if gaxi::options::tracing_enabled(&conf) {
111 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
112 }
113 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
114 }
115
116 async fn build_transport(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::CloudDeploy> {
119 super::transport::CloudDeploy::new(conf).await
120 }
121
122 async fn build_with_tracing(
123 conf: gaxi::options::ClientConfig,
124 ) -> crate::ClientBuilderResult<impl super::stub::CloudDeploy> {
125 Self::build_transport(conf)
126 .await
127 .map(super::tracing::CloudDeploy::new)
128 }
129
130 /// Lists DeliveryPipelines in a given project and location.
131 ///
132 /// # Example
133 /// ```
134 /// # use google_cloud_deploy_v1::client::CloudDeploy;
135 /// use google_cloud_gax::paginator::ItemPaginator as _;
136 /// use google_cloud_deploy_v1::Result;
137 /// async fn sample(
138 /// client: &CloudDeploy, project_id: &str, location_id: &str
139 /// ) -> Result<()> {
140 /// let mut list = client.list_delivery_pipelines()
141 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
142 /// .by_item();
143 /// while let Some(item) = list.next().await.transpose()? {
144 /// println!("{:?}", item);
145 /// }
146 /// Ok(())
147 /// }
148 /// ```
149 pub fn list_delivery_pipelines(&self) -> super::builder::cloud_deploy::ListDeliveryPipelines {
150 super::builder::cloud_deploy::ListDeliveryPipelines::new(self.inner.clone())
151 }
152
153 /// Gets details of a single DeliveryPipeline.
154 ///
155 /// # Example
156 /// ```
157 /// # use google_cloud_deploy_v1::client::CloudDeploy;
158 /// use google_cloud_deploy_v1::Result;
159 /// async fn sample(
160 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
161 /// ) -> Result<()> {
162 /// let response = client.get_delivery_pipeline()
163 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
164 /// .send().await?;
165 /// println!("response {:?}", response);
166 /// Ok(())
167 /// }
168 /// ```
169 pub fn get_delivery_pipeline(&self) -> super::builder::cloud_deploy::GetDeliveryPipeline {
170 super::builder::cloud_deploy::GetDeliveryPipeline::new(self.inner.clone())
171 }
172
173 /// Creates a new DeliveryPipeline in a given project and location.
174 ///
175 /// # Long running operations
176 ///
177 /// This method is used to start, and/or poll a [long-running Operation].
178 /// The [Working with long-running operations] chapter in the [user guide]
179 /// covers these operations in detail.
180 ///
181 /// [long-running operation]: https://google.aip.dev/151
182 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
183 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
184 ///
185 /// # Example
186 /// ```
187 /// # use google_cloud_deploy_v1::client::CloudDeploy;
188 /// use google_cloud_lro::Poller;
189 /// use google_cloud_deploy_v1::model::DeliveryPipeline;
190 /// use google_cloud_deploy_v1::Result;
191 /// async fn sample(
192 /// client: &CloudDeploy, project_id: &str, location_id: &str
193 /// ) -> Result<()> {
194 /// let response = client.create_delivery_pipeline()
195 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
196 /// .set_delivery_pipeline(
197 /// DeliveryPipeline::new()/* set fields */
198 /// )
199 /// .poller().until_done().await?;
200 /// println!("response {:?}", response);
201 /// Ok(())
202 /// }
203 /// ```
204 pub fn create_delivery_pipeline(&self) -> super::builder::cloud_deploy::CreateDeliveryPipeline {
205 super::builder::cloud_deploy::CreateDeliveryPipeline::new(self.inner.clone())
206 }
207
208 /// Updates the parameters of a single DeliveryPipeline.
209 ///
210 /// # Long running operations
211 ///
212 /// This method is used to start, and/or poll a [long-running Operation].
213 /// The [Working with long-running operations] chapter in the [user guide]
214 /// covers these operations in detail.
215 ///
216 /// [long-running operation]: https://google.aip.dev/151
217 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
218 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
219 ///
220 /// # Example
221 /// ```
222 /// # use google_cloud_deploy_v1::client::CloudDeploy;
223 /// use google_cloud_lro::Poller;
224 /// # extern crate wkt as google_cloud_wkt;
225 /// use google_cloud_wkt::FieldMask;
226 /// use google_cloud_deploy_v1::model::DeliveryPipeline;
227 /// use google_cloud_deploy_v1::Result;
228 /// async fn sample(
229 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
230 /// ) -> Result<()> {
231 /// let response = client.update_delivery_pipeline()
232 /// .set_delivery_pipeline(
233 /// DeliveryPipeline::new().set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))/* set fields */
234 /// )
235 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
236 /// .poller().until_done().await?;
237 /// println!("response {:?}", response);
238 /// Ok(())
239 /// }
240 /// ```
241 pub fn update_delivery_pipeline(&self) -> super::builder::cloud_deploy::UpdateDeliveryPipeline {
242 super::builder::cloud_deploy::UpdateDeliveryPipeline::new(self.inner.clone())
243 }
244
245 /// Deletes a single DeliveryPipeline.
246 ///
247 /// # Long running operations
248 ///
249 /// This method is used to start, and/or poll a [long-running Operation].
250 /// The [Working with long-running operations] chapter in the [user guide]
251 /// covers these operations in detail.
252 ///
253 /// [long-running operation]: https://google.aip.dev/151
254 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
255 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
256 ///
257 /// # Example
258 /// ```
259 /// # use google_cloud_deploy_v1::client::CloudDeploy;
260 /// use google_cloud_lro::Poller;
261 /// use google_cloud_deploy_v1::Result;
262 /// async fn sample(
263 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
264 /// ) -> Result<()> {
265 /// client.delete_delivery_pipeline()
266 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
267 /// .poller().until_done().await?;
268 /// Ok(())
269 /// }
270 /// ```
271 pub fn delete_delivery_pipeline(&self) -> super::builder::cloud_deploy::DeleteDeliveryPipeline {
272 super::builder::cloud_deploy::DeleteDeliveryPipeline::new(self.inner.clone())
273 }
274
275 /// Lists Targets in a given project and location.
276 ///
277 /// # Example
278 /// ```
279 /// # use google_cloud_deploy_v1::client::CloudDeploy;
280 /// use google_cloud_gax::paginator::ItemPaginator as _;
281 /// use google_cloud_deploy_v1::Result;
282 /// async fn sample(
283 /// client: &CloudDeploy, project_id: &str, location_id: &str
284 /// ) -> Result<()> {
285 /// let mut list = client.list_targets()
286 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
287 /// .by_item();
288 /// while let Some(item) = list.next().await.transpose()? {
289 /// println!("{:?}", item);
290 /// }
291 /// Ok(())
292 /// }
293 /// ```
294 pub fn list_targets(&self) -> super::builder::cloud_deploy::ListTargets {
295 super::builder::cloud_deploy::ListTargets::new(self.inner.clone())
296 }
297
298 /// Creates a `Rollout` to roll back the specified target.
299 ///
300 /// # Example
301 /// ```
302 /// # use google_cloud_deploy_v1::client::CloudDeploy;
303 /// use google_cloud_deploy_v1::Result;
304 /// async fn sample(
305 /// client: &CloudDeploy
306 /// ) -> Result<()> {
307 /// let response = client.rollback_target()
308 /// /* set fields */
309 /// .send().await?;
310 /// println!("response {:?}", response);
311 /// Ok(())
312 /// }
313 /// ```
314 pub fn rollback_target(&self) -> super::builder::cloud_deploy::RollbackTarget {
315 super::builder::cloud_deploy::RollbackTarget::new(self.inner.clone())
316 }
317
318 /// Gets details of a single Target.
319 ///
320 /// # Example
321 /// ```
322 /// # use google_cloud_deploy_v1::client::CloudDeploy;
323 /// use google_cloud_deploy_v1::Result;
324 /// async fn sample(
325 /// client: &CloudDeploy, project_id: &str, location_id: &str, target_id: &str
326 /// ) -> Result<()> {
327 /// let response = client.get_target()
328 /// .set_name(format!("projects/{project_id}/locations/{location_id}/targets/{target_id}"))
329 /// .send().await?;
330 /// println!("response {:?}", response);
331 /// Ok(())
332 /// }
333 /// ```
334 pub fn get_target(&self) -> super::builder::cloud_deploy::GetTarget {
335 super::builder::cloud_deploy::GetTarget::new(self.inner.clone())
336 }
337
338 /// Creates a new Target in a given project and location.
339 ///
340 /// # Long running operations
341 ///
342 /// This method is used to start, and/or poll a [long-running Operation].
343 /// The [Working with long-running operations] chapter in the [user guide]
344 /// covers these operations in detail.
345 ///
346 /// [long-running operation]: https://google.aip.dev/151
347 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
348 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
349 ///
350 /// # Example
351 /// ```
352 /// # use google_cloud_deploy_v1::client::CloudDeploy;
353 /// use google_cloud_lro::Poller;
354 /// use google_cloud_deploy_v1::model::Target;
355 /// use google_cloud_deploy_v1::Result;
356 /// async fn sample(
357 /// client: &CloudDeploy, project_id: &str, location_id: &str
358 /// ) -> Result<()> {
359 /// let response = client.create_target()
360 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
361 /// .set_target_id("target_id_value")
362 /// .set_target(
363 /// Target::new()/* set fields */
364 /// )
365 /// .poller().until_done().await?;
366 /// println!("response {:?}", response);
367 /// Ok(())
368 /// }
369 /// ```
370 pub fn create_target(&self) -> super::builder::cloud_deploy::CreateTarget {
371 super::builder::cloud_deploy::CreateTarget::new(self.inner.clone())
372 }
373
374 /// Updates the parameters of a single Target.
375 ///
376 /// # Long running operations
377 ///
378 /// This method is used to start, and/or poll a [long-running Operation].
379 /// The [Working with long-running operations] chapter in the [user guide]
380 /// covers these operations in detail.
381 ///
382 /// [long-running operation]: https://google.aip.dev/151
383 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
384 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
385 ///
386 /// # Example
387 /// ```
388 /// # use google_cloud_deploy_v1::client::CloudDeploy;
389 /// use google_cloud_lro::Poller;
390 /// # extern crate wkt as google_cloud_wkt;
391 /// use google_cloud_wkt::FieldMask;
392 /// use google_cloud_deploy_v1::model::Target;
393 /// use google_cloud_deploy_v1::Result;
394 /// async fn sample(
395 /// client: &CloudDeploy, project_id: &str, location_id: &str, target_id: &str
396 /// ) -> Result<()> {
397 /// let response = client.update_target()
398 /// .set_target(
399 /// Target::new().set_name(format!("projects/{project_id}/locations/{location_id}/targets/{target_id}"))/* set fields */
400 /// )
401 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
402 /// .poller().until_done().await?;
403 /// println!("response {:?}", response);
404 /// Ok(())
405 /// }
406 /// ```
407 pub fn update_target(&self) -> super::builder::cloud_deploy::UpdateTarget {
408 super::builder::cloud_deploy::UpdateTarget::new(self.inner.clone())
409 }
410
411 /// Deletes a single Target.
412 ///
413 /// # Long running operations
414 ///
415 /// This method is used to start, and/or poll a [long-running Operation].
416 /// The [Working with long-running operations] chapter in the [user guide]
417 /// covers these operations in detail.
418 ///
419 /// [long-running operation]: https://google.aip.dev/151
420 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
421 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
422 ///
423 /// # Example
424 /// ```
425 /// # use google_cloud_deploy_v1::client::CloudDeploy;
426 /// use google_cloud_lro::Poller;
427 /// use google_cloud_deploy_v1::Result;
428 /// async fn sample(
429 /// client: &CloudDeploy, project_id: &str, location_id: &str, target_id: &str
430 /// ) -> Result<()> {
431 /// client.delete_target()
432 /// .set_name(format!("projects/{project_id}/locations/{location_id}/targets/{target_id}"))
433 /// .poller().until_done().await?;
434 /// Ok(())
435 /// }
436 /// ```
437 pub fn delete_target(&self) -> super::builder::cloud_deploy::DeleteTarget {
438 super::builder::cloud_deploy::DeleteTarget::new(self.inner.clone())
439 }
440
441 /// Lists CustomTargetTypes in a given project and location.
442 ///
443 /// # Example
444 /// ```
445 /// # use google_cloud_deploy_v1::client::CloudDeploy;
446 /// use google_cloud_gax::paginator::ItemPaginator as _;
447 /// use google_cloud_deploy_v1::Result;
448 /// async fn sample(
449 /// client: &CloudDeploy, project_id: &str, location_id: &str
450 /// ) -> Result<()> {
451 /// let mut list = client.list_custom_target_types()
452 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
453 /// .by_item();
454 /// while let Some(item) = list.next().await.transpose()? {
455 /// println!("{:?}", item);
456 /// }
457 /// Ok(())
458 /// }
459 /// ```
460 pub fn list_custom_target_types(&self) -> super::builder::cloud_deploy::ListCustomTargetTypes {
461 super::builder::cloud_deploy::ListCustomTargetTypes::new(self.inner.clone())
462 }
463
464 /// Gets details of a single CustomTargetType.
465 ///
466 /// # Example
467 /// ```
468 /// # use google_cloud_deploy_v1::client::CloudDeploy;
469 /// use google_cloud_deploy_v1::Result;
470 /// async fn sample(
471 /// client: &CloudDeploy, project_id: &str, location_id: &str, custom_target_type_id: &str
472 /// ) -> Result<()> {
473 /// let response = client.get_custom_target_type()
474 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customTargetTypes/{custom_target_type_id}"))
475 /// .send().await?;
476 /// println!("response {:?}", response);
477 /// Ok(())
478 /// }
479 /// ```
480 pub fn get_custom_target_type(&self) -> super::builder::cloud_deploy::GetCustomTargetType {
481 super::builder::cloud_deploy::GetCustomTargetType::new(self.inner.clone())
482 }
483
484 /// Creates a new CustomTargetType in a given project and location.
485 ///
486 /// # Long running operations
487 ///
488 /// This method is used to start, and/or poll a [long-running Operation].
489 /// The [Working with long-running operations] chapter in the [user guide]
490 /// covers these operations in detail.
491 ///
492 /// [long-running operation]: https://google.aip.dev/151
493 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
494 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
495 ///
496 /// # Example
497 /// ```
498 /// # use google_cloud_deploy_v1::client::CloudDeploy;
499 /// use google_cloud_lro::Poller;
500 /// use google_cloud_deploy_v1::model::CustomTargetType;
501 /// use google_cloud_deploy_v1::Result;
502 /// async fn sample(
503 /// client: &CloudDeploy, project_id: &str, location_id: &str
504 /// ) -> Result<()> {
505 /// let response = client.create_custom_target_type()
506 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
507 /// .set_custom_target_type(
508 /// CustomTargetType::new()/* set fields */
509 /// )
510 /// .poller().until_done().await?;
511 /// println!("response {:?}", response);
512 /// Ok(())
513 /// }
514 /// ```
515 pub fn create_custom_target_type(
516 &self,
517 ) -> super::builder::cloud_deploy::CreateCustomTargetType {
518 super::builder::cloud_deploy::CreateCustomTargetType::new(self.inner.clone())
519 }
520
521 /// Updates a single CustomTargetType.
522 ///
523 /// # Long running operations
524 ///
525 /// This method is used to start, and/or poll a [long-running Operation].
526 /// The [Working with long-running operations] chapter in the [user guide]
527 /// covers these operations in detail.
528 ///
529 /// [long-running operation]: https://google.aip.dev/151
530 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
531 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
532 ///
533 /// # Example
534 /// ```
535 /// # use google_cloud_deploy_v1::client::CloudDeploy;
536 /// use google_cloud_lro::Poller;
537 /// # extern crate wkt as google_cloud_wkt;
538 /// use google_cloud_wkt::FieldMask;
539 /// use google_cloud_deploy_v1::model::CustomTargetType;
540 /// use google_cloud_deploy_v1::Result;
541 /// async fn sample(
542 /// client: &CloudDeploy, project_id: &str, location_id: &str, custom_target_type_id: &str
543 /// ) -> Result<()> {
544 /// let response = client.update_custom_target_type()
545 /// .set_custom_target_type(
546 /// CustomTargetType::new().set_name(format!("projects/{project_id}/locations/{location_id}/customTargetTypes/{custom_target_type_id}"))/* set fields */
547 /// )
548 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
549 /// .poller().until_done().await?;
550 /// println!("response {:?}", response);
551 /// Ok(())
552 /// }
553 /// ```
554 pub fn update_custom_target_type(
555 &self,
556 ) -> super::builder::cloud_deploy::UpdateCustomTargetType {
557 super::builder::cloud_deploy::UpdateCustomTargetType::new(self.inner.clone())
558 }
559
560 /// Deletes a single CustomTargetType.
561 ///
562 /// # Long running operations
563 ///
564 /// This method is used to start, and/or poll a [long-running Operation].
565 /// The [Working with long-running operations] chapter in the [user guide]
566 /// covers these operations in detail.
567 ///
568 /// [long-running operation]: https://google.aip.dev/151
569 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
570 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
571 ///
572 /// # Example
573 /// ```
574 /// # use google_cloud_deploy_v1::client::CloudDeploy;
575 /// use google_cloud_lro::Poller;
576 /// use google_cloud_deploy_v1::Result;
577 /// async fn sample(
578 /// client: &CloudDeploy, project_id: &str, location_id: &str, custom_target_type_id: &str
579 /// ) -> Result<()> {
580 /// client.delete_custom_target_type()
581 /// .set_name(format!("projects/{project_id}/locations/{location_id}/customTargetTypes/{custom_target_type_id}"))
582 /// .poller().until_done().await?;
583 /// Ok(())
584 /// }
585 /// ```
586 pub fn delete_custom_target_type(
587 &self,
588 ) -> super::builder::cloud_deploy::DeleteCustomTargetType {
589 super::builder::cloud_deploy::DeleteCustomTargetType::new(self.inner.clone())
590 }
591
592 /// Lists Releases in a given project and location.
593 ///
594 /// # Example
595 /// ```
596 /// # use google_cloud_deploy_v1::client::CloudDeploy;
597 /// use google_cloud_gax::paginator::ItemPaginator as _;
598 /// use google_cloud_deploy_v1::Result;
599 /// async fn sample(
600 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
601 /// ) -> Result<()> {
602 /// let mut list = client.list_releases()
603 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
604 /// .by_item();
605 /// while let Some(item) = list.next().await.transpose()? {
606 /// println!("{:?}", item);
607 /// }
608 /// Ok(())
609 /// }
610 /// ```
611 pub fn list_releases(&self) -> super::builder::cloud_deploy::ListReleases {
612 super::builder::cloud_deploy::ListReleases::new(self.inner.clone())
613 }
614
615 /// Gets details of a single Release.
616 ///
617 /// # Example
618 /// ```
619 /// # use google_cloud_deploy_v1::client::CloudDeploy;
620 /// use google_cloud_deploy_v1::Result;
621 /// async fn sample(
622 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str
623 /// ) -> Result<()> {
624 /// let response = client.get_release()
625 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}"))
626 /// .send().await?;
627 /// println!("response {:?}", response);
628 /// Ok(())
629 /// }
630 /// ```
631 pub fn get_release(&self) -> super::builder::cloud_deploy::GetRelease {
632 super::builder::cloud_deploy::GetRelease::new(self.inner.clone())
633 }
634
635 /// Creates a new Release in a given project and location.
636 ///
637 /// # Long running operations
638 ///
639 /// This method is used to start, and/or poll a [long-running Operation].
640 /// The [Working with long-running operations] chapter in the [user guide]
641 /// covers these operations in detail.
642 ///
643 /// [long-running operation]: https://google.aip.dev/151
644 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
645 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
646 ///
647 /// # Example
648 /// ```
649 /// # use google_cloud_deploy_v1::client::CloudDeploy;
650 /// use google_cloud_lro::Poller;
651 /// use google_cloud_deploy_v1::model::Release;
652 /// use google_cloud_deploy_v1::Result;
653 /// async fn sample(
654 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
655 /// ) -> Result<()> {
656 /// let response = client.create_release()
657 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
658 /// .set_release_id("release_id_value")
659 /// .set_release(
660 /// Release::new()/* set fields */
661 /// )
662 /// .poller().until_done().await?;
663 /// println!("response {:?}", response);
664 /// Ok(())
665 /// }
666 /// ```
667 pub fn create_release(&self) -> super::builder::cloud_deploy::CreateRelease {
668 super::builder::cloud_deploy::CreateRelease::new(self.inner.clone())
669 }
670
671 /// Abandons a Release in the Delivery Pipeline.
672 ///
673 /// # Example
674 /// ```
675 /// # use google_cloud_deploy_v1::client::CloudDeploy;
676 /// use google_cloud_deploy_v1::Result;
677 /// async fn sample(
678 /// client: &CloudDeploy
679 /// ) -> Result<()> {
680 /// let response = client.abandon_release()
681 /// /* set fields */
682 /// .send().await?;
683 /// println!("response {:?}", response);
684 /// Ok(())
685 /// }
686 /// ```
687 pub fn abandon_release(&self) -> super::builder::cloud_deploy::AbandonRelease {
688 super::builder::cloud_deploy::AbandonRelease::new(self.inner.clone())
689 }
690
691 /// Creates a new DeployPolicy in a given project and location.
692 ///
693 /// # Long running operations
694 ///
695 /// This method is used to start, and/or poll a [long-running Operation].
696 /// The [Working with long-running operations] chapter in the [user guide]
697 /// covers these operations in detail.
698 ///
699 /// [long-running operation]: https://google.aip.dev/151
700 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
701 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
702 ///
703 /// # Example
704 /// ```
705 /// # use google_cloud_deploy_v1::client::CloudDeploy;
706 /// use google_cloud_lro::Poller;
707 /// use google_cloud_deploy_v1::model::DeployPolicy;
708 /// use google_cloud_deploy_v1::Result;
709 /// async fn sample(
710 /// client: &CloudDeploy, project_id: &str, location_id: &str
711 /// ) -> Result<()> {
712 /// let response = client.create_deploy_policy()
713 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
714 /// .set_deploy_policy(
715 /// DeployPolicy::new()/* set fields */
716 /// )
717 /// .poller().until_done().await?;
718 /// println!("response {:?}", response);
719 /// Ok(())
720 /// }
721 /// ```
722 pub fn create_deploy_policy(&self) -> super::builder::cloud_deploy::CreateDeployPolicy {
723 super::builder::cloud_deploy::CreateDeployPolicy::new(self.inner.clone())
724 }
725
726 /// Updates the parameters of a single DeployPolicy.
727 ///
728 /// # Long running operations
729 ///
730 /// This method is used to start, and/or poll a [long-running Operation].
731 /// The [Working with long-running operations] chapter in the [user guide]
732 /// covers these operations in detail.
733 ///
734 /// [long-running operation]: https://google.aip.dev/151
735 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
736 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
737 ///
738 /// # Example
739 /// ```
740 /// # use google_cloud_deploy_v1::client::CloudDeploy;
741 /// use google_cloud_lro::Poller;
742 /// # extern crate wkt as google_cloud_wkt;
743 /// use google_cloud_wkt::FieldMask;
744 /// use google_cloud_deploy_v1::model::DeployPolicy;
745 /// use google_cloud_deploy_v1::Result;
746 /// async fn sample(
747 /// client: &CloudDeploy, project_id: &str, location_id: &str, deploy_policy_id: &str
748 /// ) -> Result<()> {
749 /// let response = client.update_deploy_policy()
750 /// .set_deploy_policy(
751 /// DeployPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/deployPolicies/{deploy_policy_id}"))/* set fields */
752 /// )
753 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
754 /// .poller().until_done().await?;
755 /// println!("response {:?}", response);
756 /// Ok(())
757 /// }
758 /// ```
759 pub fn update_deploy_policy(&self) -> super::builder::cloud_deploy::UpdateDeployPolicy {
760 super::builder::cloud_deploy::UpdateDeployPolicy::new(self.inner.clone())
761 }
762
763 /// Deletes a single DeployPolicy.
764 ///
765 /// # Long running operations
766 ///
767 /// This method is used to start, and/or poll a [long-running Operation].
768 /// The [Working with long-running operations] chapter in the [user guide]
769 /// covers these operations in detail.
770 ///
771 /// [long-running operation]: https://google.aip.dev/151
772 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
773 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
774 ///
775 /// # Example
776 /// ```
777 /// # use google_cloud_deploy_v1::client::CloudDeploy;
778 /// use google_cloud_lro::Poller;
779 /// use google_cloud_deploy_v1::Result;
780 /// async fn sample(
781 /// client: &CloudDeploy, project_id: &str, location_id: &str, deploy_policy_id: &str
782 /// ) -> Result<()> {
783 /// client.delete_deploy_policy()
784 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deployPolicies/{deploy_policy_id}"))
785 /// .poller().until_done().await?;
786 /// Ok(())
787 /// }
788 /// ```
789 pub fn delete_deploy_policy(&self) -> super::builder::cloud_deploy::DeleteDeployPolicy {
790 super::builder::cloud_deploy::DeleteDeployPolicy::new(self.inner.clone())
791 }
792
793 /// Lists DeployPolicies in a given project and location.
794 ///
795 /// # Example
796 /// ```
797 /// # use google_cloud_deploy_v1::client::CloudDeploy;
798 /// use google_cloud_gax::paginator::ItemPaginator as _;
799 /// use google_cloud_deploy_v1::Result;
800 /// async fn sample(
801 /// client: &CloudDeploy, project_id: &str, location_id: &str
802 /// ) -> Result<()> {
803 /// let mut list = client.list_deploy_policies()
804 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
805 /// .by_item();
806 /// while let Some(item) = list.next().await.transpose()? {
807 /// println!("{:?}", item);
808 /// }
809 /// Ok(())
810 /// }
811 /// ```
812 pub fn list_deploy_policies(&self) -> super::builder::cloud_deploy::ListDeployPolicies {
813 super::builder::cloud_deploy::ListDeployPolicies::new(self.inner.clone())
814 }
815
816 /// Gets details of a single DeployPolicy.
817 ///
818 /// # Example
819 /// ```
820 /// # use google_cloud_deploy_v1::client::CloudDeploy;
821 /// use google_cloud_deploy_v1::Result;
822 /// async fn sample(
823 /// client: &CloudDeploy, project_id: &str, location_id: &str, deploy_policy_id: &str
824 /// ) -> Result<()> {
825 /// let response = client.get_deploy_policy()
826 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deployPolicies/{deploy_policy_id}"))
827 /// .send().await?;
828 /// println!("response {:?}", response);
829 /// Ok(())
830 /// }
831 /// ```
832 pub fn get_deploy_policy(&self) -> super::builder::cloud_deploy::GetDeployPolicy {
833 super::builder::cloud_deploy::GetDeployPolicy::new(self.inner.clone())
834 }
835
836 /// Approves a Rollout.
837 ///
838 /// # Example
839 /// ```
840 /// # use google_cloud_deploy_v1::client::CloudDeploy;
841 /// use google_cloud_deploy_v1::Result;
842 /// async fn sample(
843 /// client: &CloudDeploy
844 /// ) -> Result<()> {
845 /// let response = client.approve_rollout()
846 /// /* set fields */
847 /// .send().await?;
848 /// println!("response {:?}", response);
849 /// Ok(())
850 /// }
851 /// ```
852 pub fn approve_rollout(&self) -> super::builder::cloud_deploy::ApproveRollout {
853 super::builder::cloud_deploy::ApproveRollout::new(self.inner.clone())
854 }
855
856 /// Advances a Rollout in a given project and location.
857 ///
858 /// # Example
859 /// ```
860 /// # use google_cloud_deploy_v1::client::CloudDeploy;
861 /// use google_cloud_deploy_v1::Result;
862 /// async fn sample(
863 /// client: &CloudDeploy
864 /// ) -> Result<()> {
865 /// let response = client.advance_rollout()
866 /// /* set fields */
867 /// .send().await?;
868 /// println!("response {:?}", response);
869 /// Ok(())
870 /// }
871 /// ```
872 pub fn advance_rollout(&self) -> super::builder::cloud_deploy::AdvanceRollout {
873 super::builder::cloud_deploy::AdvanceRollout::new(self.inner.clone())
874 }
875
876 /// Cancels a Rollout in a given project and location.
877 ///
878 /// # Example
879 /// ```
880 /// # use google_cloud_deploy_v1::client::CloudDeploy;
881 /// use google_cloud_deploy_v1::Result;
882 /// async fn sample(
883 /// client: &CloudDeploy
884 /// ) -> Result<()> {
885 /// let response = client.cancel_rollout()
886 /// /* set fields */
887 /// .send().await?;
888 /// println!("response {:?}", response);
889 /// Ok(())
890 /// }
891 /// ```
892 pub fn cancel_rollout(&self) -> super::builder::cloud_deploy::CancelRollout {
893 super::builder::cloud_deploy::CancelRollout::new(self.inner.clone())
894 }
895
896 /// Lists Rollouts in a given project and location.
897 ///
898 /// # Example
899 /// ```
900 /// # use google_cloud_deploy_v1::client::CloudDeploy;
901 /// use google_cloud_gax::paginator::ItemPaginator as _;
902 /// use google_cloud_deploy_v1::Result;
903 /// async fn sample(
904 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str
905 /// ) -> Result<()> {
906 /// let mut list = client.list_rollouts()
907 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}"))
908 /// .by_item();
909 /// while let Some(item) = list.next().await.transpose()? {
910 /// println!("{:?}", item);
911 /// }
912 /// Ok(())
913 /// }
914 /// ```
915 pub fn list_rollouts(&self) -> super::builder::cloud_deploy::ListRollouts {
916 super::builder::cloud_deploy::ListRollouts::new(self.inner.clone())
917 }
918
919 /// Gets details of a single Rollout.
920 ///
921 /// # Example
922 /// ```
923 /// # use google_cloud_deploy_v1::client::CloudDeploy;
924 /// use google_cloud_deploy_v1::Result;
925 /// async fn sample(
926 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str, rollout_id: &str
927 /// ) -> Result<()> {
928 /// let response = client.get_rollout()
929 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}/rollouts/{rollout_id}"))
930 /// .send().await?;
931 /// println!("response {:?}", response);
932 /// Ok(())
933 /// }
934 /// ```
935 pub fn get_rollout(&self) -> super::builder::cloud_deploy::GetRollout {
936 super::builder::cloud_deploy::GetRollout::new(self.inner.clone())
937 }
938
939 /// Creates a new Rollout in a given project and location.
940 ///
941 /// # Long running operations
942 ///
943 /// This method is used to start, and/or poll a [long-running Operation].
944 /// The [Working with long-running operations] chapter in the [user guide]
945 /// covers these operations in detail.
946 ///
947 /// [long-running operation]: https://google.aip.dev/151
948 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
949 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
950 ///
951 /// # Example
952 /// ```
953 /// # use google_cloud_deploy_v1::client::CloudDeploy;
954 /// use google_cloud_lro::Poller;
955 /// use google_cloud_deploy_v1::model::Rollout;
956 /// use google_cloud_deploy_v1::Result;
957 /// async fn sample(
958 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str
959 /// ) -> Result<()> {
960 /// let response = client.create_rollout()
961 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}"))
962 /// .set_rollout_id("rollout_id_value")
963 /// .set_rollout(
964 /// Rollout::new()/* set fields */
965 /// )
966 /// .poller().until_done().await?;
967 /// println!("response {:?}", response);
968 /// Ok(())
969 /// }
970 /// ```
971 pub fn create_rollout(&self) -> super::builder::cloud_deploy::CreateRollout {
972 super::builder::cloud_deploy::CreateRollout::new(self.inner.clone())
973 }
974
975 /// Ignores the specified Job in a Rollout.
976 ///
977 /// # Example
978 /// ```
979 /// # use google_cloud_deploy_v1::client::CloudDeploy;
980 /// use google_cloud_deploy_v1::Result;
981 /// async fn sample(
982 /// client: &CloudDeploy
983 /// ) -> Result<()> {
984 /// let response = client.ignore_job()
985 /// /* set fields */
986 /// .send().await?;
987 /// println!("response {:?}", response);
988 /// Ok(())
989 /// }
990 /// ```
991 pub fn ignore_job(&self) -> super::builder::cloud_deploy::IgnoreJob {
992 super::builder::cloud_deploy::IgnoreJob::new(self.inner.clone())
993 }
994
995 /// Retries the specified Job in a Rollout.
996 ///
997 /// # Example
998 /// ```
999 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1000 /// use google_cloud_deploy_v1::Result;
1001 /// async fn sample(
1002 /// client: &CloudDeploy
1003 /// ) -> Result<()> {
1004 /// let response = client.retry_job()
1005 /// /* set fields */
1006 /// .send().await?;
1007 /// println!("response {:?}", response);
1008 /// Ok(())
1009 /// }
1010 /// ```
1011 pub fn retry_job(&self) -> super::builder::cloud_deploy::RetryJob {
1012 super::builder::cloud_deploy::RetryJob::new(self.inner.clone())
1013 }
1014
1015 /// Lists JobRuns in a given project and location.
1016 ///
1017 /// # Example
1018 /// ```
1019 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1020 /// use google_cloud_gax::paginator::ItemPaginator as _;
1021 /// use google_cloud_deploy_v1::Result;
1022 /// async fn sample(
1023 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str, rollout_id: &str
1024 /// ) -> Result<()> {
1025 /// let mut list = client.list_job_runs()
1026 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}/rollouts/{rollout_id}"))
1027 /// .by_item();
1028 /// while let Some(item) = list.next().await.transpose()? {
1029 /// println!("{:?}", item);
1030 /// }
1031 /// Ok(())
1032 /// }
1033 /// ```
1034 pub fn list_job_runs(&self) -> super::builder::cloud_deploy::ListJobRuns {
1035 super::builder::cloud_deploy::ListJobRuns::new(self.inner.clone())
1036 }
1037
1038 /// Gets details of a single JobRun.
1039 ///
1040 /// # Example
1041 /// ```
1042 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1043 /// use google_cloud_deploy_v1::Result;
1044 /// async fn sample(
1045 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, release_id: &str, rollout_id: &str, job_run_id: &str
1046 /// ) -> Result<()> {
1047 /// let response = client.get_job_run()
1048 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/releases/{release_id}/rollouts/{rollout_id}/jobRuns/{job_run_id}"))
1049 /// .send().await?;
1050 /// println!("response {:?}", response);
1051 /// Ok(())
1052 /// }
1053 /// ```
1054 pub fn get_job_run(&self) -> super::builder::cloud_deploy::GetJobRun {
1055 super::builder::cloud_deploy::GetJobRun::new(self.inner.clone())
1056 }
1057
1058 /// Terminates a Job Run in a given project and location.
1059 ///
1060 /// # Example
1061 /// ```
1062 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1063 /// use google_cloud_deploy_v1::Result;
1064 /// async fn sample(
1065 /// client: &CloudDeploy
1066 /// ) -> Result<()> {
1067 /// let response = client.terminate_job_run()
1068 /// /* set fields */
1069 /// .send().await?;
1070 /// println!("response {:?}", response);
1071 /// Ok(())
1072 /// }
1073 /// ```
1074 pub fn terminate_job_run(&self) -> super::builder::cloud_deploy::TerminateJobRun {
1075 super::builder::cloud_deploy::TerminateJobRun::new(self.inner.clone())
1076 }
1077
1078 /// Gets the configuration for a location.
1079 ///
1080 /// # Example
1081 /// ```
1082 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1083 /// use google_cloud_deploy_v1::Result;
1084 /// async fn sample(
1085 /// client: &CloudDeploy, project_id: &str, location_id: &str
1086 /// ) -> Result<()> {
1087 /// let response = client.get_config()
1088 /// .set_name(format!("projects/{project_id}/locations/{location_id}/config"))
1089 /// .send().await?;
1090 /// println!("response {:?}", response);
1091 /// Ok(())
1092 /// }
1093 /// ```
1094 pub fn get_config(&self) -> super::builder::cloud_deploy::GetConfig {
1095 super::builder::cloud_deploy::GetConfig::new(self.inner.clone())
1096 }
1097
1098 /// Creates a new Automation in a given project and location.
1099 ///
1100 /// # Long running operations
1101 ///
1102 /// This method is used to start, and/or poll a [long-running Operation].
1103 /// The [Working with long-running operations] chapter in the [user guide]
1104 /// covers these operations in detail.
1105 ///
1106 /// [long-running operation]: https://google.aip.dev/151
1107 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1108 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1109 ///
1110 /// # Example
1111 /// ```
1112 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1113 /// use google_cloud_lro::Poller;
1114 /// use google_cloud_deploy_v1::model::Automation;
1115 /// use google_cloud_deploy_v1::Result;
1116 /// async fn sample(
1117 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
1118 /// ) -> Result<()> {
1119 /// let response = client.create_automation()
1120 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
1121 /// .set_automation_id("automation_id_value")
1122 /// .set_automation(
1123 /// Automation::new()/* set fields */
1124 /// )
1125 /// .poller().until_done().await?;
1126 /// println!("response {:?}", response);
1127 /// Ok(())
1128 /// }
1129 /// ```
1130 pub fn create_automation(&self) -> super::builder::cloud_deploy::CreateAutomation {
1131 super::builder::cloud_deploy::CreateAutomation::new(self.inner.clone())
1132 }
1133
1134 /// Updates the parameters of a single Automation resource.
1135 ///
1136 /// # Long running operations
1137 ///
1138 /// This method is used to start, and/or poll a [long-running Operation].
1139 /// The [Working with long-running operations] chapter in the [user guide]
1140 /// covers these operations in detail.
1141 ///
1142 /// [long-running operation]: https://google.aip.dev/151
1143 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1144 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1145 ///
1146 /// # Example
1147 /// ```
1148 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1149 /// use google_cloud_lro::Poller;
1150 /// # extern crate wkt as google_cloud_wkt;
1151 /// use google_cloud_wkt::FieldMask;
1152 /// use google_cloud_deploy_v1::model::Automation;
1153 /// use google_cloud_deploy_v1::Result;
1154 /// async fn sample(
1155 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, automation_id: &str
1156 /// ) -> Result<()> {
1157 /// let response = client.update_automation()
1158 /// .set_automation(
1159 /// Automation::new().set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/automations/{automation_id}"))/* set fields */
1160 /// )
1161 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1162 /// .poller().until_done().await?;
1163 /// println!("response {:?}", response);
1164 /// Ok(())
1165 /// }
1166 /// ```
1167 pub fn update_automation(&self) -> super::builder::cloud_deploy::UpdateAutomation {
1168 super::builder::cloud_deploy::UpdateAutomation::new(self.inner.clone())
1169 }
1170
1171 /// Deletes a single Automation resource.
1172 ///
1173 /// # Long running operations
1174 ///
1175 /// This method is used to start, and/or poll a [long-running Operation].
1176 /// The [Working with long-running operations] chapter in the [user guide]
1177 /// covers these operations in detail.
1178 ///
1179 /// [long-running operation]: https://google.aip.dev/151
1180 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1181 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1182 ///
1183 /// # Example
1184 /// ```
1185 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1186 /// use google_cloud_lro::Poller;
1187 /// use google_cloud_deploy_v1::Result;
1188 /// async fn sample(
1189 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, automation_id: &str
1190 /// ) -> Result<()> {
1191 /// client.delete_automation()
1192 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/automations/{automation_id}"))
1193 /// .poller().until_done().await?;
1194 /// Ok(())
1195 /// }
1196 /// ```
1197 pub fn delete_automation(&self) -> super::builder::cloud_deploy::DeleteAutomation {
1198 super::builder::cloud_deploy::DeleteAutomation::new(self.inner.clone())
1199 }
1200
1201 /// Gets details of a single Automation.
1202 ///
1203 /// # Example
1204 /// ```
1205 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1206 /// use google_cloud_deploy_v1::Result;
1207 /// async fn sample(
1208 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, automation_id: &str
1209 /// ) -> Result<()> {
1210 /// let response = client.get_automation()
1211 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/automations/{automation_id}"))
1212 /// .send().await?;
1213 /// println!("response {:?}", response);
1214 /// Ok(())
1215 /// }
1216 /// ```
1217 pub fn get_automation(&self) -> super::builder::cloud_deploy::GetAutomation {
1218 super::builder::cloud_deploy::GetAutomation::new(self.inner.clone())
1219 }
1220
1221 /// Lists Automations in a given project and location.
1222 ///
1223 /// # Example
1224 /// ```
1225 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1226 /// use google_cloud_gax::paginator::ItemPaginator as _;
1227 /// use google_cloud_deploy_v1::Result;
1228 /// async fn sample(
1229 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
1230 /// ) -> Result<()> {
1231 /// let mut list = client.list_automations()
1232 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
1233 /// .by_item();
1234 /// while let Some(item) = list.next().await.transpose()? {
1235 /// println!("{:?}", item);
1236 /// }
1237 /// Ok(())
1238 /// }
1239 /// ```
1240 pub fn list_automations(&self) -> super::builder::cloud_deploy::ListAutomations {
1241 super::builder::cloud_deploy::ListAutomations::new(self.inner.clone())
1242 }
1243
1244 /// Gets details of a single AutomationRun.
1245 ///
1246 /// # Example
1247 /// ```
1248 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1249 /// use google_cloud_deploy_v1::Result;
1250 /// async fn sample(
1251 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str, automation_run_id: &str
1252 /// ) -> Result<()> {
1253 /// let response = client.get_automation_run()
1254 /// .set_name(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}/automationRuns/{automation_run_id}"))
1255 /// .send().await?;
1256 /// println!("response {:?}", response);
1257 /// Ok(())
1258 /// }
1259 /// ```
1260 pub fn get_automation_run(&self) -> super::builder::cloud_deploy::GetAutomationRun {
1261 super::builder::cloud_deploy::GetAutomationRun::new(self.inner.clone())
1262 }
1263
1264 /// Lists AutomationRuns in a given project and location.
1265 ///
1266 /// # Example
1267 /// ```
1268 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1269 /// use google_cloud_gax::paginator::ItemPaginator as _;
1270 /// use google_cloud_deploy_v1::Result;
1271 /// async fn sample(
1272 /// client: &CloudDeploy, project_id: &str, location_id: &str, delivery_pipeline_id: &str
1273 /// ) -> Result<()> {
1274 /// let mut list = client.list_automation_runs()
1275 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/deliveryPipelines/{delivery_pipeline_id}"))
1276 /// .by_item();
1277 /// while let Some(item) = list.next().await.transpose()? {
1278 /// println!("{:?}", item);
1279 /// }
1280 /// Ok(())
1281 /// }
1282 /// ```
1283 pub fn list_automation_runs(&self) -> super::builder::cloud_deploy::ListAutomationRuns {
1284 super::builder::cloud_deploy::ListAutomationRuns::new(self.inner.clone())
1285 }
1286
1287 /// Cancels an AutomationRun. The `state` of the `AutomationRun` after
1288 /// cancelling is `CANCELLED`. `CancelAutomationRun` can be called on
1289 /// AutomationRun in the state `IN_PROGRESS` and `PENDING`; AutomationRun
1290 /// in a different state returns an `FAILED_PRECONDITION` error.
1291 ///
1292 /// # Example
1293 /// ```
1294 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1295 /// use google_cloud_deploy_v1::Result;
1296 /// async fn sample(
1297 /// client: &CloudDeploy
1298 /// ) -> Result<()> {
1299 /// let response = client.cancel_automation_run()
1300 /// /* set fields */
1301 /// .send().await?;
1302 /// println!("response {:?}", response);
1303 /// Ok(())
1304 /// }
1305 /// ```
1306 pub fn cancel_automation_run(&self) -> super::builder::cloud_deploy::CancelAutomationRun {
1307 super::builder::cloud_deploy::CancelAutomationRun::new(self.inner.clone())
1308 }
1309
1310 /// Lists information about the supported locations for this service.
1311 ///
1312 /// # Example
1313 /// ```
1314 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1315 /// use google_cloud_gax::paginator::ItemPaginator as _;
1316 /// use google_cloud_deploy_v1::Result;
1317 /// async fn sample(
1318 /// client: &CloudDeploy
1319 /// ) -> Result<()> {
1320 /// let mut list = client.list_locations()
1321 /// /* set fields */
1322 /// .by_item();
1323 /// while let Some(item) = list.next().await.transpose()? {
1324 /// println!("{:?}", item);
1325 /// }
1326 /// Ok(())
1327 /// }
1328 /// ```
1329 pub fn list_locations(&self) -> super::builder::cloud_deploy::ListLocations {
1330 super::builder::cloud_deploy::ListLocations::new(self.inner.clone())
1331 }
1332
1333 /// Gets information about a location.
1334 ///
1335 /// # Example
1336 /// ```
1337 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1338 /// use google_cloud_deploy_v1::Result;
1339 /// async fn sample(
1340 /// client: &CloudDeploy
1341 /// ) -> Result<()> {
1342 /// let response = client.get_location()
1343 /// /* set fields */
1344 /// .send().await?;
1345 /// println!("response {:?}", response);
1346 /// Ok(())
1347 /// }
1348 /// ```
1349 pub fn get_location(&self) -> super::builder::cloud_deploy::GetLocation {
1350 super::builder::cloud_deploy::GetLocation::new(self.inner.clone())
1351 }
1352
1353 /// Sets the access control policy on the specified resource. Replaces
1354 /// any existing policy.
1355 ///
1356 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1357 /// errors.
1358 ///
1359 /// # Example
1360 /// ```
1361 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1362 /// use google_cloud_deploy_v1::Result;
1363 /// async fn sample(
1364 /// client: &CloudDeploy
1365 /// ) -> Result<()> {
1366 /// let response = client.set_iam_policy()
1367 /// /* set fields */
1368 /// .send().await?;
1369 /// println!("response {:?}", response);
1370 /// Ok(())
1371 /// }
1372 /// ```
1373 pub fn set_iam_policy(&self) -> super::builder::cloud_deploy::SetIamPolicy {
1374 super::builder::cloud_deploy::SetIamPolicy::new(self.inner.clone())
1375 }
1376
1377 /// Gets the access control policy for a resource. Returns an empty policy
1378 /// if the resource exists and does not have a policy set.
1379 ///
1380 /// # Example
1381 /// ```
1382 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1383 /// use google_cloud_deploy_v1::Result;
1384 /// async fn sample(
1385 /// client: &CloudDeploy
1386 /// ) -> Result<()> {
1387 /// let response = client.get_iam_policy()
1388 /// /* set fields */
1389 /// .send().await?;
1390 /// println!("response {:?}", response);
1391 /// Ok(())
1392 /// }
1393 /// ```
1394 pub fn get_iam_policy(&self) -> super::builder::cloud_deploy::GetIamPolicy {
1395 super::builder::cloud_deploy::GetIamPolicy::new(self.inner.clone())
1396 }
1397
1398 /// Returns permissions that a caller has on the specified resource. If the
1399 /// resource does not exist, this will return an empty set of
1400 /// permissions, not a `NOT_FOUND` error.
1401 ///
1402 /// Note: This operation is designed to be used for building
1403 /// permission-aware UIs and command-line tools, not for authorization
1404 /// checking. This operation may "fail open" without warning.
1405 ///
1406 /// # Example
1407 /// ```
1408 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1409 /// use google_cloud_deploy_v1::Result;
1410 /// async fn sample(
1411 /// client: &CloudDeploy
1412 /// ) -> Result<()> {
1413 /// let response = client.test_iam_permissions()
1414 /// /* set fields */
1415 /// .send().await?;
1416 /// println!("response {:?}", response);
1417 /// Ok(())
1418 /// }
1419 /// ```
1420 pub fn test_iam_permissions(&self) -> super::builder::cloud_deploy::TestIamPermissions {
1421 super::builder::cloud_deploy::TestIamPermissions::new(self.inner.clone())
1422 }
1423
1424 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1425 ///
1426 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1427 ///
1428 /// # Example
1429 /// ```
1430 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1431 /// use google_cloud_gax::paginator::ItemPaginator as _;
1432 /// use google_cloud_deploy_v1::Result;
1433 /// async fn sample(
1434 /// client: &CloudDeploy
1435 /// ) -> Result<()> {
1436 /// let mut list = client.list_operations()
1437 /// /* set fields */
1438 /// .by_item();
1439 /// while let Some(item) = list.next().await.transpose()? {
1440 /// println!("{:?}", item);
1441 /// }
1442 /// Ok(())
1443 /// }
1444 /// ```
1445 pub fn list_operations(&self) -> super::builder::cloud_deploy::ListOperations {
1446 super::builder::cloud_deploy::ListOperations::new(self.inner.clone())
1447 }
1448
1449 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1450 ///
1451 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1452 ///
1453 /// # Example
1454 /// ```
1455 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1456 /// use google_cloud_deploy_v1::Result;
1457 /// async fn sample(
1458 /// client: &CloudDeploy
1459 /// ) -> Result<()> {
1460 /// let response = client.get_operation()
1461 /// /* set fields */
1462 /// .send().await?;
1463 /// println!("response {:?}", response);
1464 /// Ok(())
1465 /// }
1466 /// ```
1467 pub fn get_operation(&self) -> super::builder::cloud_deploy::GetOperation {
1468 super::builder::cloud_deploy::GetOperation::new(self.inner.clone())
1469 }
1470
1471 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1472 ///
1473 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1474 ///
1475 /// # Example
1476 /// ```
1477 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1478 /// use google_cloud_deploy_v1::Result;
1479 /// async fn sample(
1480 /// client: &CloudDeploy
1481 /// ) -> Result<()> {
1482 /// client.delete_operation()
1483 /// /* set fields */
1484 /// .send().await?;
1485 /// Ok(())
1486 /// }
1487 /// ```
1488 pub fn delete_operation(&self) -> super::builder::cloud_deploy::DeleteOperation {
1489 super::builder::cloud_deploy::DeleteOperation::new(self.inner.clone())
1490 }
1491
1492 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1493 ///
1494 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1495 ///
1496 /// # Example
1497 /// ```
1498 /// # use google_cloud_deploy_v1::client::CloudDeploy;
1499 /// use google_cloud_deploy_v1::Result;
1500 /// async fn sample(
1501 /// client: &CloudDeploy
1502 /// ) -> Result<()> {
1503 /// client.cancel_operation()
1504 /// /* set fields */
1505 /// .send().await?;
1506 /// Ok(())
1507 /// }
1508 /// ```
1509 pub fn cancel_operation(&self) -> super::builder::cloud_deploy::CancelOperation {
1510 super::builder::cloud_deploy::CancelOperation::new(self.inner.clone())
1511 }
1512}