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