google_cloud_security_privateca_v1/builder.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
17pub mod certificate_authority_service {
18 use crate::Result;
19
20 /// A builder for [CertificateAuthorityService][crate::client::CertificateAuthorityService].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_security_privateca_v1::*;
25 /// # use builder::certificate_authority_service::ClientBuilder;
26 /// # use client::CertificateAuthorityService;
27 /// let builder : ClientBuilder = CertificateAuthorityService::builder();
28 /// let client = builder
29 /// .with_endpoint("https://privateca.googleapis.com")
30 /// .build().await?;
31 /// # gax::client_builder::Result::<()>::Ok(()) });
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::CertificateAuthorityService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CertificateAuthorityService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::CertificateAuthorityService] request builders.
52 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [CertificateAuthorityService::create_certificate][crate::client::CertificateAuthorityService::create_certificate] calls.
75 ///
76 /// # Example
77 /// ```no_run
78 /// # use google_cloud_security_privateca_v1::builder;
79 /// use builder::certificate_authority_service::CreateCertificate;
80 /// # tokio_test::block_on(async {
81 ///
82 /// let builder = prepare_request_builder();
83 /// let response = builder.send().await?;
84 /// # gax::Result::<()>::Ok(()) });
85 ///
86 /// fn prepare_request_builder() -> CreateCertificate {
87 /// # panic!();
88 /// // ... details omitted ...
89 /// }
90 /// ```
91 #[derive(Clone, Debug)]
92 pub struct CreateCertificate(RequestBuilder<crate::model::CreateCertificateRequest>);
93
94 impl CreateCertificate {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 /// Sets the full request, replacing any prior values.
102 pub fn with_request<V: Into<crate::model::CreateCertificateRequest>>(
103 mut self,
104 v: V,
105 ) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 /// Sets all the options, replacing any prior values.
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 /// Sends the request.
117 pub async fn send(self) -> Result<crate::model::Certificate> {
118 (*self.0.stub)
119 .create_certificate(self.0.request, self.0.options)
120 .await
121 .map(gax::response::Response::into_body)
122 }
123
124 /// Sets the value of [parent][crate::model::CreateCertificateRequest::parent].
125 ///
126 /// This is a **required** field for requests.
127 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.parent = v.into();
129 self
130 }
131
132 /// Sets the value of [certificate_id][crate::model::CreateCertificateRequest::certificate_id].
133 pub fn set_certificate_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.certificate_id = v.into();
135 self
136 }
137
138 /// Sets the value of [certificate][crate::model::CreateCertificateRequest::certificate].
139 ///
140 /// This is a **required** field for requests.
141 pub fn set_certificate<T>(mut self, v: T) -> Self
142 where
143 T: std::convert::Into<crate::model::Certificate>,
144 {
145 self.0.request.certificate = std::option::Option::Some(v.into());
146 self
147 }
148
149 /// Sets or clears the value of [certificate][crate::model::CreateCertificateRequest::certificate].
150 ///
151 /// This is a **required** field for requests.
152 pub fn set_or_clear_certificate<T>(mut self, v: std::option::Option<T>) -> Self
153 where
154 T: std::convert::Into<crate::model::Certificate>,
155 {
156 self.0.request.certificate = v.map(|x| x.into());
157 self
158 }
159
160 /// Sets the value of [request_id][crate::model::CreateCertificateRequest::request_id].
161 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
162 self.0.request.request_id = v.into();
163 self
164 }
165
166 /// Sets the value of [validate_only][crate::model::CreateCertificateRequest::validate_only].
167 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
168 self.0.request.validate_only = v.into();
169 self
170 }
171
172 /// Sets the value of [issuing_certificate_authority_id][crate::model::CreateCertificateRequest::issuing_certificate_authority_id].
173 pub fn set_issuing_certificate_authority_id<T: Into<std::string::String>>(
174 mut self,
175 v: T,
176 ) -> Self {
177 self.0.request.issuing_certificate_authority_id = v.into();
178 self
179 }
180 }
181
182 #[doc(hidden)]
183 impl gax::options::internal::RequestBuilder for CreateCertificate {
184 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
185 &mut self.0.options
186 }
187 }
188
189 /// The request builder for [CertificateAuthorityService::get_certificate][crate::client::CertificateAuthorityService::get_certificate] calls.
190 ///
191 /// # Example
192 /// ```no_run
193 /// # use google_cloud_security_privateca_v1::builder;
194 /// use builder::certificate_authority_service::GetCertificate;
195 /// # tokio_test::block_on(async {
196 ///
197 /// let builder = prepare_request_builder();
198 /// let response = builder.send().await?;
199 /// # gax::Result::<()>::Ok(()) });
200 ///
201 /// fn prepare_request_builder() -> GetCertificate {
202 /// # panic!();
203 /// // ... details omitted ...
204 /// }
205 /// ```
206 #[derive(Clone, Debug)]
207 pub struct GetCertificate(RequestBuilder<crate::model::GetCertificateRequest>);
208
209 impl GetCertificate {
210 pub(crate) fn new(
211 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
212 ) -> Self {
213 Self(RequestBuilder::new(stub))
214 }
215
216 /// Sets the full request, replacing any prior values.
217 pub fn with_request<V: Into<crate::model::GetCertificateRequest>>(mut self, v: V) -> Self {
218 self.0.request = v.into();
219 self
220 }
221
222 /// Sets all the options, replacing any prior values.
223 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
224 self.0.options = v.into();
225 self
226 }
227
228 /// Sends the request.
229 pub async fn send(self) -> Result<crate::model::Certificate> {
230 (*self.0.stub)
231 .get_certificate(self.0.request, self.0.options)
232 .await
233 .map(gax::response::Response::into_body)
234 }
235
236 /// Sets the value of [name][crate::model::GetCertificateRequest::name].
237 ///
238 /// This is a **required** field for requests.
239 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240 self.0.request.name = v.into();
241 self
242 }
243 }
244
245 #[doc(hidden)]
246 impl gax::options::internal::RequestBuilder for GetCertificate {
247 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 /// The request builder for [CertificateAuthorityService::list_certificates][crate::client::CertificateAuthorityService::list_certificates] calls.
253 ///
254 /// # Example
255 /// ```no_run
256 /// # use google_cloud_security_privateca_v1::builder;
257 /// use builder::certificate_authority_service::ListCertificates;
258 /// # tokio_test::block_on(async {
259 /// use gax::paginator::ItemPaginator;
260 ///
261 /// let builder = prepare_request_builder();
262 /// let mut items = builder.by_item();
263 /// while let Some(result) = items.next().await {
264 /// let item = result?;
265 /// }
266 /// # gax::Result::<()>::Ok(()) });
267 ///
268 /// fn prepare_request_builder() -> ListCertificates {
269 /// # panic!();
270 /// // ... details omitted ...
271 /// }
272 /// ```
273 #[derive(Clone, Debug)]
274 pub struct ListCertificates(RequestBuilder<crate::model::ListCertificatesRequest>);
275
276 impl ListCertificates {
277 pub(crate) fn new(
278 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
279 ) -> Self {
280 Self(RequestBuilder::new(stub))
281 }
282
283 /// Sets the full request, replacing any prior values.
284 pub fn with_request<V: Into<crate::model::ListCertificatesRequest>>(
285 mut self,
286 v: V,
287 ) -> Self {
288 self.0.request = v.into();
289 self
290 }
291
292 /// Sets all the options, replacing any prior values.
293 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
294 self.0.options = v.into();
295 self
296 }
297
298 /// Sends the request.
299 pub async fn send(self) -> Result<crate::model::ListCertificatesResponse> {
300 (*self.0.stub)
301 .list_certificates(self.0.request, self.0.options)
302 .await
303 .map(gax::response::Response::into_body)
304 }
305
306 /// Streams each page in the collection.
307 pub fn by_page(
308 self,
309 ) -> impl gax::paginator::Paginator<crate::model::ListCertificatesResponse, gax::error::Error>
310 {
311 use std::clone::Clone;
312 let token = self.0.request.page_token.clone();
313 let execute = move |token: String| {
314 let mut builder = self.clone();
315 builder.0.request = builder.0.request.set_page_token(token);
316 builder.send()
317 };
318 gax::paginator::internal::new_paginator(token, execute)
319 }
320
321 /// Streams each item in the collection.
322 pub fn by_item(
323 self,
324 ) -> impl gax::paginator::ItemPaginator<crate::model::ListCertificatesResponse, gax::error::Error>
325 {
326 use gax::paginator::Paginator;
327 self.by_page().items()
328 }
329
330 /// Sets the value of [parent][crate::model::ListCertificatesRequest::parent].
331 ///
332 /// This is a **required** field for requests.
333 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
334 self.0.request.parent = v.into();
335 self
336 }
337
338 /// Sets the value of [page_size][crate::model::ListCertificatesRequest::page_size].
339 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
340 self.0.request.page_size = v.into();
341 self
342 }
343
344 /// Sets the value of [page_token][crate::model::ListCertificatesRequest::page_token].
345 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
346 self.0.request.page_token = v.into();
347 self
348 }
349
350 /// Sets the value of [filter][crate::model::ListCertificatesRequest::filter].
351 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
352 self.0.request.filter = v.into();
353 self
354 }
355
356 /// Sets the value of [order_by][crate::model::ListCertificatesRequest::order_by].
357 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
358 self.0.request.order_by = v.into();
359 self
360 }
361 }
362
363 #[doc(hidden)]
364 impl gax::options::internal::RequestBuilder for ListCertificates {
365 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
366 &mut self.0.options
367 }
368 }
369
370 /// The request builder for [CertificateAuthorityService::revoke_certificate][crate::client::CertificateAuthorityService::revoke_certificate] calls.
371 ///
372 /// # Example
373 /// ```no_run
374 /// # use google_cloud_security_privateca_v1::builder;
375 /// use builder::certificate_authority_service::RevokeCertificate;
376 /// # tokio_test::block_on(async {
377 ///
378 /// let builder = prepare_request_builder();
379 /// let response = builder.send().await?;
380 /// # gax::Result::<()>::Ok(()) });
381 ///
382 /// fn prepare_request_builder() -> RevokeCertificate {
383 /// # panic!();
384 /// // ... details omitted ...
385 /// }
386 /// ```
387 #[derive(Clone, Debug)]
388 pub struct RevokeCertificate(RequestBuilder<crate::model::RevokeCertificateRequest>);
389
390 impl RevokeCertificate {
391 pub(crate) fn new(
392 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
393 ) -> Self {
394 Self(RequestBuilder::new(stub))
395 }
396
397 /// Sets the full request, replacing any prior values.
398 pub fn with_request<V: Into<crate::model::RevokeCertificateRequest>>(
399 mut self,
400 v: V,
401 ) -> Self {
402 self.0.request = v.into();
403 self
404 }
405
406 /// Sets all the options, replacing any prior values.
407 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
408 self.0.options = v.into();
409 self
410 }
411
412 /// Sends the request.
413 pub async fn send(self) -> Result<crate::model::Certificate> {
414 (*self.0.stub)
415 .revoke_certificate(self.0.request, self.0.options)
416 .await
417 .map(gax::response::Response::into_body)
418 }
419
420 /// Sets the value of [name][crate::model::RevokeCertificateRequest::name].
421 ///
422 /// This is a **required** field for requests.
423 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
424 self.0.request.name = v.into();
425 self
426 }
427
428 /// Sets the value of [reason][crate::model::RevokeCertificateRequest::reason].
429 ///
430 /// This is a **required** field for requests.
431 pub fn set_reason<T: Into<crate::model::RevocationReason>>(mut self, v: T) -> Self {
432 self.0.request.reason = v.into();
433 self
434 }
435
436 /// Sets the value of [request_id][crate::model::RevokeCertificateRequest::request_id].
437 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
438 self.0.request.request_id = v.into();
439 self
440 }
441 }
442
443 #[doc(hidden)]
444 impl gax::options::internal::RequestBuilder for RevokeCertificate {
445 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
446 &mut self.0.options
447 }
448 }
449
450 /// The request builder for [CertificateAuthorityService::update_certificate][crate::client::CertificateAuthorityService::update_certificate] calls.
451 ///
452 /// # Example
453 /// ```no_run
454 /// # use google_cloud_security_privateca_v1::builder;
455 /// use builder::certificate_authority_service::UpdateCertificate;
456 /// # tokio_test::block_on(async {
457 ///
458 /// let builder = prepare_request_builder();
459 /// let response = builder.send().await?;
460 /// # gax::Result::<()>::Ok(()) });
461 ///
462 /// fn prepare_request_builder() -> UpdateCertificate {
463 /// # panic!();
464 /// // ... details omitted ...
465 /// }
466 /// ```
467 #[derive(Clone, Debug)]
468 pub struct UpdateCertificate(RequestBuilder<crate::model::UpdateCertificateRequest>);
469
470 impl UpdateCertificate {
471 pub(crate) fn new(
472 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
473 ) -> Self {
474 Self(RequestBuilder::new(stub))
475 }
476
477 /// Sets the full request, replacing any prior values.
478 pub fn with_request<V: Into<crate::model::UpdateCertificateRequest>>(
479 mut self,
480 v: V,
481 ) -> Self {
482 self.0.request = v.into();
483 self
484 }
485
486 /// Sets all the options, replacing any prior values.
487 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
488 self.0.options = v.into();
489 self
490 }
491
492 /// Sends the request.
493 pub async fn send(self) -> Result<crate::model::Certificate> {
494 (*self.0.stub)
495 .update_certificate(self.0.request, self.0.options)
496 .await
497 .map(gax::response::Response::into_body)
498 }
499
500 /// Sets the value of [certificate][crate::model::UpdateCertificateRequest::certificate].
501 ///
502 /// This is a **required** field for requests.
503 pub fn set_certificate<T>(mut self, v: T) -> Self
504 where
505 T: std::convert::Into<crate::model::Certificate>,
506 {
507 self.0.request.certificate = std::option::Option::Some(v.into());
508 self
509 }
510
511 /// Sets or clears the value of [certificate][crate::model::UpdateCertificateRequest::certificate].
512 ///
513 /// This is a **required** field for requests.
514 pub fn set_or_clear_certificate<T>(mut self, v: std::option::Option<T>) -> Self
515 where
516 T: std::convert::Into<crate::model::Certificate>,
517 {
518 self.0.request.certificate = v.map(|x| x.into());
519 self
520 }
521
522 /// Sets the value of [update_mask][crate::model::UpdateCertificateRequest::update_mask].
523 ///
524 /// This is a **required** field for requests.
525 pub fn set_update_mask<T>(mut self, v: T) -> Self
526 where
527 T: std::convert::Into<wkt::FieldMask>,
528 {
529 self.0.request.update_mask = std::option::Option::Some(v.into());
530 self
531 }
532
533 /// Sets or clears the value of [update_mask][crate::model::UpdateCertificateRequest::update_mask].
534 ///
535 /// This is a **required** field for requests.
536 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
537 where
538 T: std::convert::Into<wkt::FieldMask>,
539 {
540 self.0.request.update_mask = v.map(|x| x.into());
541 self
542 }
543
544 /// Sets the value of [request_id][crate::model::UpdateCertificateRequest::request_id].
545 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
546 self.0.request.request_id = v.into();
547 self
548 }
549 }
550
551 #[doc(hidden)]
552 impl gax::options::internal::RequestBuilder for UpdateCertificate {
553 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
554 &mut self.0.options
555 }
556 }
557
558 /// The request builder for [CertificateAuthorityService::activate_certificate_authority][crate::client::CertificateAuthorityService::activate_certificate_authority] calls.
559 ///
560 /// # Example
561 /// ```no_run
562 /// # use google_cloud_security_privateca_v1::builder;
563 /// use builder::certificate_authority_service::ActivateCertificateAuthority;
564 /// # tokio_test::block_on(async {
565 /// use lro::Poller;
566 ///
567 /// let builder = prepare_request_builder();
568 /// let response = builder.poller().until_done().await?;
569 /// # gax::Result::<()>::Ok(()) });
570 ///
571 /// fn prepare_request_builder() -> ActivateCertificateAuthority {
572 /// # panic!();
573 /// // ... details omitted ...
574 /// }
575 /// ```
576 #[derive(Clone, Debug)]
577 pub struct ActivateCertificateAuthority(
578 RequestBuilder<crate::model::ActivateCertificateAuthorityRequest>,
579 );
580
581 impl ActivateCertificateAuthority {
582 pub(crate) fn new(
583 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
584 ) -> Self {
585 Self(RequestBuilder::new(stub))
586 }
587
588 /// Sets the full request, replacing any prior values.
589 pub fn with_request<V: Into<crate::model::ActivateCertificateAuthorityRequest>>(
590 mut self,
591 v: V,
592 ) -> Self {
593 self.0.request = v.into();
594 self
595 }
596
597 /// Sets all the options, replacing any prior values.
598 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
599 self.0.options = v.into();
600 self
601 }
602
603 /// Sends the request.
604 ///
605 /// # Long running operations
606 ///
607 /// This starts, but does not poll, a longrunning operation. More information
608 /// on [activate_certificate_authority][crate::client::CertificateAuthorityService::activate_certificate_authority].
609 pub async fn send(self) -> Result<longrunning::model::Operation> {
610 (*self.0.stub)
611 .activate_certificate_authority(self.0.request, self.0.options)
612 .await
613 .map(gax::response::Response::into_body)
614 }
615
616 /// Creates a [Poller][lro::Poller] to work with `activate_certificate_authority`.
617 pub fn poller(
618 self,
619 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
620 {
621 type Operation = lro::internal::Operation<
622 crate::model::CertificateAuthority,
623 crate::model::OperationMetadata,
624 >;
625 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
626 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
627
628 let stub = self.0.stub.clone();
629 let mut options = self.0.options.clone();
630 options.set_retry_policy(gax::retry_policy::NeverRetry);
631 let query = move |name| {
632 let stub = stub.clone();
633 let options = options.clone();
634 async {
635 let op = GetOperation::new(stub)
636 .set_name(name)
637 .with_options(options)
638 .send()
639 .await?;
640 Ok(Operation::new(op))
641 }
642 };
643
644 let start = move || async {
645 let op = self.send().await?;
646 Ok(Operation::new(op))
647 };
648
649 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
650 }
651
652 /// Sets the value of [name][crate::model::ActivateCertificateAuthorityRequest::name].
653 ///
654 /// This is a **required** field for requests.
655 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
656 self.0.request.name = v.into();
657 self
658 }
659
660 /// Sets the value of [pem_ca_certificate][crate::model::ActivateCertificateAuthorityRequest::pem_ca_certificate].
661 ///
662 /// This is a **required** field for requests.
663 pub fn set_pem_ca_certificate<T: Into<std::string::String>>(mut self, v: T) -> Self {
664 self.0.request.pem_ca_certificate = v.into();
665 self
666 }
667
668 /// Sets the value of [subordinate_config][crate::model::ActivateCertificateAuthorityRequest::subordinate_config].
669 ///
670 /// This is a **required** field for requests.
671 pub fn set_subordinate_config<T>(mut self, v: T) -> Self
672 where
673 T: std::convert::Into<crate::model::SubordinateConfig>,
674 {
675 self.0.request.subordinate_config = std::option::Option::Some(v.into());
676 self
677 }
678
679 /// Sets or clears the value of [subordinate_config][crate::model::ActivateCertificateAuthorityRequest::subordinate_config].
680 ///
681 /// This is a **required** field for requests.
682 pub fn set_or_clear_subordinate_config<T>(mut self, v: std::option::Option<T>) -> Self
683 where
684 T: std::convert::Into<crate::model::SubordinateConfig>,
685 {
686 self.0.request.subordinate_config = v.map(|x| x.into());
687 self
688 }
689
690 /// Sets the value of [request_id][crate::model::ActivateCertificateAuthorityRequest::request_id].
691 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
692 self.0.request.request_id = v.into();
693 self
694 }
695 }
696
697 #[doc(hidden)]
698 impl gax::options::internal::RequestBuilder for ActivateCertificateAuthority {
699 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
700 &mut self.0.options
701 }
702 }
703
704 /// The request builder for [CertificateAuthorityService::create_certificate_authority][crate::client::CertificateAuthorityService::create_certificate_authority] calls.
705 ///
706 /// # Example
707 /// ```no_run
708 /// # use google_cloud_security_privateca_v1::builder;
709 /// use builder::certificate_authority_service::CreateCertificateAuthority;
710 /// # tokio_test::block_on(async {
711 /// use lro::Poller;
712 ///
713 /// let builder = prepare_request_builder();
714 /// let response = builder.poller().until_done().await?;
715 /// # gax::Result::<()>::Ok(()) });
716 ///
717 /// fn prepare_request_builder() -> CreateCertificateAuthority {
718 /// # panic!();
719 /// // ... details omitted ...
720 /// }
721 /// ```
722 #[derive(Clone, Debug)]
723 pub struct CreateCertificateAuthority(
724 RequestBuilder<crate::model::CreateCertificateAuthorityRequest>,
725 );
726
727 impl CreateCertificateAuthority {
728 pub(crate) fn new(
729 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
730 ) -> Self {
731 Self(RequestBuilder::new(stub))
732 }
733
734 /// Sets the full request, replacing any prior values.
735 pub fn with_request<V: Into<crate::model::CreateCertificateAuthorityRequest>>(
736 mut self,
737 v: V,
738 ) -> Self {
739 self.0.request = v.into();
740 self
741 }
742
743 /// Sets all the options, replacing any prior values.
744 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
745 self.0.options = v.into();
746 self
747 }
748
749 /// Sends the request.
750 ///
751 /// # Long running operations
752 ///
753 /// This starts, but does not poll, a longrunning operation. More information
754 /// on [create_certificate_authority][crate::client::CertificateAuthorityService::create_certificate_authority].
755 pub async fn send(self) -> Result<longrunning::model::Operation> {
756 (*self.0.stub)
757 .create_certificate_authority(self.0.request, self.0.options)
758 .await
759 .map(gax::response::Response::into_body)
760 }
761
762 /// Creates a [Poller][lro::Poller] to work with `create_certificate_authority`.
763 pub fn poller(
764 self,
765 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
766 {
767 type Operation = lro::internal::Operation<
768 crate::model::CertificateAuthority,
769 crate::model::OperationMetadata,
770 >;
771 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
772 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
773
774 let stub = self.0.stub.clone();
775 let mut options = self.0.options.clone();
776 options.set_retry_policy(gax::retry_policy::NeverRetry);
777 let query = move |name| {
778 let stub = stub.clone();
779 let options = options.clone();
780 async {
781 let op = GetOperation::new(stub)
782 .set_name(name)
783 .with_options(options)
784 .send()
785 .await?;
786 Ok(Operation::new(op))
787 }
788 };
789
790 let start = move || async {
791 let op = self.send().await?;
792 Ok(Operation::new(op))
793 };
794
795 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
796 }
797
798 /// Sets the value of [parent][crate::model::CreateCertificateAuthorityRequest::parent].
799 ///
800 /// This is a **required** field for requests.
801 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
802 self.0.request.parent = v.into();
803 self
804 }
805
806 /// Sets the value of [certificate_authority_id][crate::model::CreateCertificateAuthorityRequest::certificate_authority_id].
807 ///
808 /// This is a **required** field for requests.
809 pub fn set_certificate_authority_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
810 self.0.request.certificate_authority_id = v.into();
811 self
812 }
813
814 /// Sets the value of [certificate_authority][crate::model::CreateCertificateAuthorityRequest::certificate_authority].
815 ///
816 /// This is a **required** field for requests.
817 pub fn set_certificate_authority<T>(mut self, v: T) -> Self
818 where
819 T: std::convert::Into<crate::model::CertificateAuthority>,
820 {
821 self.0.request.certificate_authority = std::option::Option::Some(v.into());
822 self
823 }
824
825 /// Sets or clears the value of [certificate_authority][crate::model::CreateCertificateAuthorityRequest::certificate_authority].
826 ///
827 /// This is a **required** field for requests.
828 pub fn set_or_clear_certificate_authority<T>(mut self, v: std::option::Option<T>) -> Self
829 where
830 T: std::convert::Into<crate::model::CertificateAuthority>,
831 {
832 self.0.request.certificate_authority = v.map(|x| x.into());
833 self
834 }
835
836 /// Sets the value of [request_id][crate::model::CreateCertificateAuthorityRequest::request_id].
837 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
838 self.0.request.request_id = v.into();
839 self
840 }
841 }
842
843 #[doc(hidden)]
844 impl gax::options::internal::RequestBuilder for CreateCertificateAuthority {
845 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
846 &mut self.0.options
847 }
848 }
849
850 /// The request builder for [CertificateAuthorityService::disable_certificate_authority][crate::client::CertificateAuthorityService::disable_certificate_authority] calls.
851 ///
852 /// # Example
853 /// ```no_run
854 /// # use google_cloud_security_privateca_v1::builder;
855 /// use builder::certificate_authority_service::DisableCertificateAuthority;
856 /// # tokio_test::block_on(async {
857 /// use lro::Poller;
858 ///
859 /// let builder = prepare_request_builder();
860 /// let response = builder.poller().until_done().await?;
861 /// # gax::Result::<()>::Ok(()) });
862 ///
863 /// fn prepare_request_builder() -> DisableCertificateAuthority {
864 /// # panic!();
865 /// // ... details omitted ...
866 /// }
867 /// ```
868 #[derive(Clone, Debug)]
869 pub struct DisableCertificateAuthority(
870 RequestBuilder<crate::model::DisableCertificateAuthorityRequest>,
871 );
872
873 impl DisableCertificateAuthority {
874 pub(crate) fn new(
875 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
876 ) -> Self {
877 Self(RequestBuilder::new(stub))
878 }
879
880 /// Sets the full request, replacing any prior values.
881 pub fn with_request<V: Into<crate::model::DisableCertificateAuthorityRequest>>(
882 mut self,
883 v: V,
884 ) -> Self {
885 self.0.request = v.into();
886 self
887 }
888
889 /// Sets all the options, replacing any prior values.
890 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
891 self.0.options = v.into();
892 self
893 }
894
895 /// Sends the request.
896 ///
897 /// # Long running operations
898 ///
899 /// This starts, but does not poll, a longrunning operation. More information
900 /// on [disable_certificate_authority][crate::client::CertificateAuthorityService::disable_certificate_authority].
901 pub async fn send(self) -> Result<longrunning::model::Operation> {
902 (*self.0.stub)
903 .disable_certificate_authority(self.0.request, self.0.options)
904 .await
905 .map(gax::response::Response::into_body)
906 }
907
908 /// Creates a [Poller][lro::Poller] to work with `disable_certificate_authority`.
909 pub fn poller(
910 self,
911 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
912 {
913 type Operation = lro::internal::Operation<
914 crate::model::CertificateAuthority,
915 crate::model::OperationMetadata,
916 >;
917 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
918 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
919
920 let stub = self.0.stub.clone();
921 let mut options = self.0.options.clone();
922 options.set_retry_policy(gax::retry_policy::NeverRetry);
923 let query = move |name| {
924 let stub = stub.clone();
925 let options = options.clone();
926 async {
927 let op = GetOperation::new(stub)
928 .set_name(name)
929 .with_options(options)
930 .send()
931 .await?;
932 Ok(Operation::new(op))
933 }
934 };
935
936 let start = move || async {
937 let op = self.send().await?;
938 Ok(Operation::new(op))
939 };
940
941 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
942 }
943
944 /// Sets the value of [name][crate::model::DisableCertificateAuthorityRequest::name].
945 ///
946 /// This is a **required** field for requests.
947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948 self.0.request.name = v.into();
949 self
950 }
951
952 /// Sets the value of [request_id][crate::model::DisableCertificateAuthorityRequest::request_id].
953 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
954 self.0.request.request_id = v.into();
955 self
956 }
957
958 /// Sets the value of [ignore_dependent_resources][crate::model::DisableCertificateAuthorityRequest::ignore_dependent_resources].
959 pub fn set_ignore_dependent_resources<T: Into<bool>>(mut self, v: T) -> Self {
960 self.0.request.ignore_dependent_resources = v.into();
961 self
962 }
963 }
964
965 #[doc(hidden)]
966 impl gax::options::internal::RequestBuilder for DisableCertificateAuthority {
967 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
968 &mut self.0.options
969 }
970 }
971
972 /// The request builder for [CertificateAuthorityService::enable_certificate_authority][crate::client::CertificateAuthorityService::enable_certificate_authority] calls.
973 ///
974 /// # Example
975 /// ```no_run
976 /// # use google_cloud_security_privateca_v1::builder;
977 /// use builder::certificate_authority_service::EnableCertificateAuthority;
978 /// # tokio_test::block_on(async {
979 /// use lro::Poller;
980 ///
981 /// let builder = prepare_request_builder();
982 /// let response = builder.poller().until_done().await?;
983 /// # gax::Result::<()>::Ok(()) });
984 ///
985 /// fn prepare_request_builder() -> EnableCertificateAuthority {
986 /// # panic!();
987 /// // ... details omitted ...
988 /// }
989 /// ```
990 #[derive(Clone, Debug)]
991 pub struct EnableCertificateAuthority(
992 RequestBuilder<crate::model::EnableCertificateAuthorityRequest>,
993 );
994
995 impl EnableCertificateAuthority {
996 pub(crate) fn new(
997 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
998 ) -> Self {
999 Self(RequestBuilder::new(stub))
1000 }
1001
1002 /// Sets the full request, replacing any prior values.
1003 pub fn with_request<V: Into<crate::model::EnableCertificateAuthorityRequest>>(
1004 mut self,
1005 v: V,
1006 ) -> Self {
1007 self.0.request = v.into();
1008 self
1009 }
1010
1011 /// Sets all the options, replacing any prior values.
1012 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1013 self.0.options = v.into();
1014 self
1015 }
1016
1017 /// Sends the request.
1018 ///
1019 /// # Long running operations
1020 ///
1021 /// This starts, but does not poll, a longrunning operation. More information
1022 /// on [enable_certificate_authority][crate::client::CertificateAuthorityService::enable_certificate_authority].
1023 pub async fn send(self) -> Result<longrunning::model::Operation> {
1024 (*self.0.stub)
1025 .enable_certificate_authority(self.0.request, self.0.options)
1026 .await
1027 .map(gax::response::Response::into_body)
1028 }
1029
1030 /// Creates a [Poller][lro::Poller] to work with `enable_certificate_authority`.
1031 pub fn poller(
1032 self,
1033 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
1034 {
1035 type Operation = lro::internal::Operation<
1036 crate::model::CertificateAuthority,
1037 crate::model::OperationMetadata,
1038 >;
1039 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1040 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1041
1042 let stub = self.0.stub.clone();
1043 let mut options = self.0.options.clone();
1044 options.set_retry_policy(gax::retry_policy::NeverRetry);
1045 let query = move |name| {
1046 let stub = stub.clone();
1047 let options = options.clone();
1048 async {
1049 let op = GetOperation::new(stub)
1050 .set_name(name)
1051 .with_options(options)
1052 .send()
1053 .await?;
1054 Ok(Operation::new(op))
1055 }
1056 };
1057
1058 let start = move || async {
1059 let op = self.send().await?;
1060 Ok(Operation::new(op))
1061 };
1062
1063 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1064 }
1065
1066 /// Sets the value of [name][crate::model::EnableCertificateAuthorityRequest::name].
1067 ///
1068 /// This is a **required** field for requests.
1069 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1070 self.0.request.name = v.into();
1071 self
1072 }
1073
1074 /// Sets the value of [request_id][crate::model::EnableCertificateAuthorityRequest::request_id].
1075 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1076 self.0.request.request_id = v.into();
1077 self
1078 }
1079 }
1080
1081 #[doc(hidden)]
1082 impl gax::options::internal::RequestBuilder for EnableCertificateAuthority {
1083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1084 &mut self.0.options
1085 }
1086 }
1087
1088 /// The request builder for [CertificateAuthorityService::fetch_certificate_authority_csr][crate::client::CertificateAuthorityService::fetch_certificate_authority_csr] calls.
1089 ///
1090 /// # Example
1091 /// ```no_run
1092 /// # use google_cloud_security_privateca_v1::builder;
1093 /// use builder::certificate_authority_service::FetchCertificateAuthorityCsr;
1094 /// # tokio_test::block_on(async {
1095 ///
1096 /// let builder = prepare_request_builder();
1097 /// let response = builder.send().await?;
1098 /// # gax::Result::<()>::Ok(()) });
1099 ///
1100 /// fn prepare_request_builder() -> FetchCertificateAuthorityCsr {
1101 /// # panic!();
1102 /// // ... details omitted ...
1103 /// }
1104 /// ```
1105 #[derive(Clone, Debug)]
1106 pub struct FetchCertificateAuthorityCsr(
1107 RequestBuilder<crate::model::FetchCertificateAuthorityCsrRequest>,
1108 );
1109
1110 impl FetchCertificateAuthorityCsr {
1111 pub(crate) fn new(
1112 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1113 ) -> Self {
1114 Self(RequestBuilder::new(stub))
1115 }
1116
1117 /// Sets the full request, replacing any prior values.
1118 pub fn with_request<V: Into<crate::model::FetchCertificateAuthorityCsrRequest>>(
1119 mut self,
1120 v: V,
1121 ) -> Self {
1122 self.0.request = v.into();
1123 self
1124 }
1125
1126 /// Sets all the options, replacing any prior values.
1127 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1128 self.0.options = v.into();
1129 self
1130 }
1131
1132 /// Sends the request.
1133 pub async fn send(self) -> Result<crate::model::FetchCertificateAuthorityCsrResponse> {
1134 (*self.0.stub)
1135 .fetch_certificate_authority_csr(self.0.request, self.0.options)
1136 .await
1137 .map(gax::response::Response::into_body)
1138 }
1139
1140 /// Sets the value of [name][crate::model::FetchCertificateAuthorityCsrRequest::name].
1141 ///
1142 /// This is a **required** field for requests.
1143 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1144 self.0.request.name = v.into();
1145 self
1146 }
1147 }
1148
1149 #[doc(hidden)]
1150 impl gax::options::internal::RequestBuilder for FetchCertificateAuthorityCsr {
1151 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1152 &mut self.0.options
1153 }
1154 }
1155
1156 /// The request builder for [CertificateAuthorityService::get_certificate_authority][crate::client::CertificateAuthorityService::get_certificate_authority] calls.
1157 ///
1158 /// # Example
1159 /// ```no_run
1160 /// # use google_cloud_security_privateca_v1::builder;
1161 /// use builder::certificate_authority_service::GetCertificateAuthority;
1162 /// # tokio_test::block_on(async {
1163 ///
1164 /// let builder = prepare_request_builder();
1165 /// let response = builder.send().await?;
1166 /// # gax::Result::<()>::Ok(()) });
1167 ///
1168 /// fn prepare_request_builder() -> GetCertificateAuthority {
1169 /// # panic!();
1170 /// // ... details omitted ...
1171 /// }
1172 /// ```
1173 #[derive(Clone, Debug)]
1174 pub struct GetCertificateAuthority(
1175 RequestBuilder<crate::model::GetCertificateAuthorityRequest>,
1176 );
1177
1178 impl GetCertificateAuthority {
1179 pub(crate) fn new(
1180 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1181 ) -> Self {
1182 Self(RequestBuilder::new(stub))
1183 }
1184
1185 /// Sets the full request, replacing any prior values.
1186 pub fn with_request<V: Into<crate::model::GetCertificateAuthorityRequest>>(
1187 mut self,
1188 v: V,
1189 ) -> Self {
1190 self.0.request = v.into();
1191 self
1192 }
1193
1194 /// Sets all the options, replacing any prior values.
1195 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1196 self.0.options = v.into();
1197 self
1198 }
1199
1200 /// Sends the request.
1201 pub async fn send(self) -> Result<crate::model::CertificateAuthority> {
1202 (*self.0.stub)
1203 .get_certificate_authority(self.0.request, self.0.options)
1204 .await
1205 .map(gax::response::Response::into_body)
1206 }
1207
1208 /// Sets the value of [name][crate::model::GetCertificateAuthorityRequest::name].
1209 ///
1210 /// This is a **required** field for requests.
1211 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1212 self.0.request.name = v.into();
1213 self
1214 }
1215 }
1216
1217 #[doc(hidden)]
1218 impl gax::options::internal::RequestBuilder for GetCertificateAuthority {
1219 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1220 &mut self.0.options
1221 }
1222 }
1223
1224 /// The request builder for [CertificateAuthorityService::list_certificate_authorities][crate::client::CertificateAuthorityService::list_certificate_authorities] calls.
1225 ///
1226 /// # Example
1227 /// ```no_run
1228 /// # use google_cloud_security_privateca_v1::builder;
1229 /// use builder::certificate_authority_service::ListCertificateAuthorities;
1230 /// # tokio_test::block_on(async {
1231 /// use gax::paginator::ItemPaginator;
1232 ///
1233 /// let builder = prepare_request_builder();
1234 /// let mut items = builder.by_item();
1235 /// while let Some(result) = items.next().await {
1236 /// let item = result?;
1237 /// }
1238 /// # gax::Result::<()>::Ok(()) });
1239 ///
1240 /// fn prepare_request_builder() -> ListCertificateAuthorities {
1241 /// # panic!();
1242 /// // ... details omitted ...
1243 /// }
1244 /// ```
1245 #[derive(Clone, Debug)]
1246 pub struct ListCertificateAuthorities(
1247 RequestBuilder<crate::model::ListCertificateAuthoritiesRequest>,
1248 );
1249
1250 impl ListCertificateAuthorities {
1251 pub(crate) fn new(
1252 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1253 ) -> Self {
1254 Self(RequestBuilder::new(stub))
1255 }
1256
1257 /// Sets the full request, replacing any prior values.
1258 pub fn with_request<V: Into<crate::model::ListCertificateAuthoritiesRequest>>(
1259 mut self,
1260 v: V,
1261 ) -> Self {
1262 self.0.request = v.into();
1263 self
1264 }
1265
1266 /// Sets all the options, replacing any prior values.
1267 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1268 self.0.options = v.into();
1269 self
1270 }
1271
1272 /// Sends the request.
1273 pub async fn send(self) -> Result<crate::model::ListCertificateAuthoritiesResponse> {
1274 (*self.0.stub)
1275 .list_certificate_authorities(self.0.request, self.0.options)
1276 .await
1277 .map(gax::response::Response::into_body)
1278 }
1279
1280 /// Streams each page in the collection.
1281 pub fn by_page(
1282 self,
1283 ) -> impl gax::paginator::Paginator<
1284 crate::model::ListCertificateAuthoritiesResponse,
1285 gax::error::Error,
1286 > {
1287 use std::clone::Clone;
1288 let token = self.0.request.page_token.clone();
1289 let execute = move |token: String| {
1290 let mut builder = self.clone();
1291 builder.0.request = builder.0.request.set_page_token(token);
1292 builder.send()
1293 };
1294 gax::paginator::internal::new_paginator(token, execute)
1295 }
1296
1297 /// Streams each item in the collection.
1298 pub fn by_item(
1299 self,
1300 ) -> impl gax::paginator::ItemPaginator<
1301 crate::model::ListCertificateAuthoritiesResponse,
1302 gax::error::Error,
1303 > {
1304 use gax::paginator::Paginator;
1305 self.by_page().items()
1306 }
1307
1308 /// Sets the value of [parent][crate::model::ListCertificateAuthoritiesRequest::parent].
1309 ///
1310 /// This is a **required** field for requests.
1311 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.0.request.parent = v.into();
1313 self
1314 }
1315
1316 /// Sets the value of [page_size][crate::model::ListCertificateAuthoritiesRequest::page_size].
1317 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1318 self.0.request.page_size = v.into();
1319 self
1320 }
1321
1322 /// Sets the value of [page_token][crate::model::ListCertificateAuthoritiesRequest::page_token].
1323 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1324 self.0.request.page_token = v.into();
1325 self
1326 }
1327
1328 /// Sets the value of [filter][crate::model::ListCertificateAuthoritiesRequest::filter].
1329 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1330 self.0.request.filter = v.into();
1331 self
1332 }
1333
1334 /// Sets the value of [order_by][crate::model::ListCertificateAuthoritiesRequest::order_by].
1335 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1336 self.0.request.order_by = v.into();
1337 self
1338 }
1339 }
1340
1341 #[doc(hidden)]
1342 impl gax::options::internal::RequestBuilder for ListCertificateAuthorities {
1343 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1344 &mut self.0.options
1345 }
1346 }
1347
1348 /// The request builder for [CertificateAuthorityService::undelete_certificate_authority][crate::client::CertificateAuthorityService::undelete_certificate_authority] calls.
1349 ///
1350 /// # Example
1351 /// ```no_run
1352 /// # use google_cloud_security_privateca_v1::builder;
1353 /// use builder::certificate_authority_service::UndeleteCertificateAuthority;
1354 /// # tokio_test::block_on(async {
1355 /// use lro::Poller;
1356 ///
1357 /// let builder = prepare_request_builder();
1358 /// let response = builder.poller().until_done().await?;
1359 /// # gax::Result::<()>::Ok(()) });
1360 ///
1361 /// fn prepare_request_builder() -> UndeleteCertificateAuthority {
1362 /// # panic!();
1363 /// // ... details omitted ...
1364 /// }
1365 /// ```
1366 #[derive(Clone, Debug)]
1367 pub struct UndeleteCertificateAuthority(
1368 RequestBuilder<crate::model::UndeleteCertificateAuthorityRequest>,
1369 );
1370
1371 impl UndeleteCertificateAuthority {
1372 pub(crate) fn new(
1373 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1374 ) -> Self {
1375 Self(RequestBuilder::new(stub))
1376 }
1377
1378 /// Sets the full request, replacing any prior values.
1379 pub fn with_request<V: Into<crate::model::UndeleteCertificateAuthorityRequest>>(
1380 mut self,
1381 v: V,
1382 ) -> Self {
1383 self.0.request = v.into();
1384 self
1385 }
1386
1387 /// Sets all the options, replacing any prior values.
1388 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1389 self.0.options = v.into();
1390 self
1391 }
1392
1393 /// Sends the request.
1394 ///
1395 /// # Long running operations
1396 ///
1397 /// This starts, but does not poll, a longrunning operation. More information
1398 /// on [undelete_certificate_authority][crate::client::CertificateAuthorityService::undelete_certificate_authority].
1399 pub async fn send(self) -> Result<longrunning::model::Operation> {
1400 (*self.0.stub)
1401 .undelete_certificate_authority(self.0.request, self.0.options)
1402 .await
1403 .map(gax::response::Response::into_body)
1404 }
1405
1406 /// Creates a [Poller][lro::Poller] to work with `undelete_certificate_authority`.
1407 pub fn poller(
1408 self,
1409 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
1410 {
1411 type Operation = lro::internal::Operation<
1412 crate::model::CertificateAuthority,
1413 crate::model::OperationMetadata,
1414 >;
1415 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1416 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1417
1418 let stub = self.0.stub.clone();
1419 let mut options = self.0.options.clone();
1420 options.set_retry_policy(gax::retry_policy::NeverRetry);
1421 let query = move |name| {
1422 let stub = stub.clone();
1423 let options = options.clone();
1424 async {
1425 let op = GetOperation::new(stub)
1426 .set_name(name)
1427 .with_options(options)
1428 .send()
1429 .await?;
1430 Ok(Operation::new(op))
1431 }
1432 };
1433
1434 let start = move || async {
1435 let op = self.send().await?;
1436 Ok(Operation::new(op))
1437 };
1438
1439 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1440 }
1441
1442 /// Sets the value of [name][crate::model::UndeleteCertificateAuthorityRequest::name].
1443 ///
1444 /// This is a **required** field for requests.
1445 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1446 self.0.request.name = v.into();
1447 self
1448 }
1449
1450 /// Sets the value of [request_id][crate::model::UndeleteCertificateAuthorityRequest::request_id].
1451 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1452 self.0.request.request_id = v.into();
1453 self
1454 }
1455 }
1456
1457 #[doc(hidden)]
1458 impl gax::options::internal::RequestBuilder for UndeleteCertificateAuthority {
1459 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1460 &mut self.0.options
1461 }
1462 }
1463
1464 /// The request builder for [CertificateAuthorityService::delete_certificate_authority][crate::client::CertificateAuthorityService::delete_certificate_authority] calls.
1465 ///
1466 /// # Example
1467 /// ```no_run
1468 /// # use google_cloud_security_privateca_v1::builder;
1469 /// use builder::certificate_authority_service::DeleteCertificateAuthority;
1470 /// # tokio_test::block_on(async {
1471 /// use lro::Poller;
1472 ///
1473 /// let builder = prepare_request_builder();
1474 /// let response = builder.poller().until_done().await?;
1475 /// # gax::Result::<()>::Ok(()) });
1476 ///
1477 /// fn prepare_request_builder() -> DeleteCertificateAuthority {
1478 /// # panic!();
1479 /// // ... details omitted ...
1480 /// }
1481 /// ```
1482 #[derive(Clone, Debug)]
1483 pub struct DeleteCertificateAuthority(
1484 RequestBuilder<crate::model::DeleteCertificateAuthorityRequest>,
1485 );
1486
1487 impl DeleteCertificateAuthority {
1488 pub(crate) fn new(
1489 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1490 ) -> Self {
1491 Self(RequestBuilder::new(stub))
1492 }
1493
1494 /// Sets the full request, replacing any prior values.
1495 pub fn with_request<V: Into<crate::model::DeleteCertificateAuthorityRequest>>(
1496 mut self,
1497 v: V,
1498 ) -> Self {
1499 self.0.request = v.into();
1500 self
1501 }
1502
1503 /// Sets all the options, replacing any prior values.
1504 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1505 self.0.options = v.into();
1506 self
1507 }
1508
1509 /// Sends the request.
1510 ///
1511 /// # Long running operations
1512 ///
1513 /// This starts, but does not poll, a longrunning operation. More information
1514 /// on [delete_certificate_authority][crate::client::CertificateAuthorityService::delete_certificate_authority].
1515 pub async fn send(self) -> Result<longrunning::model::Operation> {
1516 (*self.0.stub)
1517 .delete_certificate_authority(self.0.request, self.0.options)
1518 .await
1519 .map(gax::response::Response::into_body)
1520 }
1521
1522 /// Creates a [Poller][lro::Poller] to work with `delete_certificate_authority`.
1523 pub fn poller(
1524 self,
1525 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
1526 {
1527 type Operation = lro::internal::Operation<
1528 crate::model::CertificateAuthority,
1529 crate::model::OperationMetadata,
1530 >;
1531 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1532 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1533
1534 let stub = self.0.stub.clone();
1535 let mut options = self.0.options.clone();
1536 options.set_retry_policy(gax::retry_policy::NeverRetry);
1537 let query = move |name| {
1538 let stub = stub.clone();
1539 let options = options.clone();
1540 async {
1541 let op = GetOperation::new(stub)
1542 .set_name(name)
1543 .with_options(options)
1544 .send()
1545 .await?;
1546 Ok(Operation::new(op))
1547 }
1548 };
1549
1550 let start = move || async {
1551 let op = self.send().await?;
1552 Ok(Operation::new(op))
1553 };
1554
1555 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1556 }
1557
1558 /// Sets the value of [name][crate::model::DeleteCertificateAuthorityRequest::name].
1559 ///
1560 /// This is a **required** field for requests.
1561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.0.request.name = v.into();
1563 self
1564 }
1565
1566 /// Sets the value of [request_id][crate::model::DeleteCertificateAuthorityRequest::request_id].
1567 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1568 self.0.request.request_id = v.into();
1569 self
1570 }
1571
1572 /// Sets the value of [ignore_active_certificates][crate::model::DeleteCertificateAuthorityRequest::ignore_active_certificates].
1573 pub fn set_ignore_active_certificates<T: Into<bool>>(mut self, v: T) -> Self {
1574 self.0.request.ignore_active_certificates = v.into();
1575 self
1576 }
1577
1578 /// Sets the value of [skip_grace_period][crate::model::DeleteCertificateAuthorityRequest::skip_grace_period].
1579 pub fn set_skip_grace_period<T: Into<bool>>(mut self, v: T) -> Self {
1580 self.0.request.skip_grace_period = v.into();
1581 self
1582 }
1583
1584 /// Sets the value of [ignore_dependent_resources][crate::model::DeleteCertificateAuthorityRequest::ignore_dependent_resources].
1585 pub fn set_ignore_dependent_resources<T: Into<bool>>(mut self, v: T) -> Self {
1586 self.0.request.ignore_dependent_resources = v.into();
1587 self
1588 }
1589 }
1590
1591 #[doc(hidden)]
1592 impl gax::options::internal::RequestBuilder for DeleteCertificateAuthority {
1593 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1594 &mut self.0.options
1595 }
1596 }
1597
1598 /// The request builder for [CertificateAuthorityService::update_certificate_authority][crate::client::CertificateAuthorityService::update_certificate_authority] calls.
1599 ///
1600 /// # Example
1601 /// ```no_run
1602 /// # use google_cloud_security_privateca_v1::builder;
1603 /// use builder::certificate_authority_service::UpdateCertificateAuthority;
1604 /// # tokio_test::block_on(async {
1605 /// use lro::Poller;
1606 ///
1607 /// let builder = prepare_request_builder();
1608 /// let response = builder.poller().until_done().await?;
1609 /// # gax::Result::<()>::Ok(()) });
1610 ///
1611 /// fn prepare_request_builder() -> UpdateCertificateAuthority {
1612 /// # panic!();
1613 /// // ... details omitted ...
1614 /// }
1615 /// ```
1616 #[derive(Clone, Debug)]
1617 pub struct UpdateCertificateAuthority(
1618 RequestBuilder<crate::model::UpdateCertificateAuthorityRequest>,
1619 );
1620
1621 impl UpdateCertificateAuthority {
1622 pub(crate) fn new(
1623 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1624 ) -> Self {
1625 Self(RequestBuilder::new(stub))
1626 }
1627
1628 /// Sets the full request, replacing any prior values.
1629 pub fn with_request<V: Into<crate::model::UpdateCertificateAuthorityRequest>>(
1630 mut self,
1631 v: V,
1632 ) -> Self {
1633 self.0.request = v.into();
1634 self
1635 }
1636
1637 /// Sets all the options, replacing any prior values.
1638 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1639 self.0.options = v.into();
1640 self
1641 }
1642
1643 /// Sends the request.
1644 ///
1645 /// # Long running operations
1646 ///
1647 /// This starts, but does not poll, a longrunning operation. More information
1648 /// on [update_certificate_authority][crate::client::CertificateAuthorityService::update_certificate_authority].
1649 pub async fn send(self) -> Result<longrunning::model::Operation> {
1650 (*self.0.stub)
1651 .update_certificate_authority(self.0.request, self.0.options)
1652 .await
1653 .map(gax::response::Response::into_body)
1654 }
1655
1656 /// Creates a [Poller][lro::Poller] to work with `update_certificate_authority`.
1657 pub fn poller(
1658 self,
1659 ) -> impl lro::Poller<crate::model::CertificateAuthority, crate::model::OperationMetadata>
1660 {
1661 type Operation = lro::internal::Operation<
1662 crate::model::CertificateAuthority,
1663 crate::model::OperationMetadata,
1664 >;
1665 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1666 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1667
1668 let stub = self.0.stub.clone();
1669 let mut options = self.0.options.clone();
1670 options.set_retry_policy(gax::retry_policy::NeverRetry);
1671 let query = move |name| {
1672 let stub = stub.clone();
1673 let options = options.clone();
1674 async {
1675 let op = GetOperation::new(stub)
1676 .set_name(name)
1677 .with_options(options)
1678 .send()
1679 .await?;
1680 Ok(Operation::new(op))
1681 }
1682 };
1683
1684 let start = move || async {
1685 let op = self.send().await?;
1686 Ok(Operation::new(op))
1687 };
1688
1689 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1690 }
1691
1692 /// Sets the value of [certificate_authority][crate::model::UpdateCertificateAuthorityRequest::certificate_authority].
1693 ///
1694 /// This is a **required** field for requests.
1695 pub fn set_certificate_authority<T>(mut self, v: T) -> Self
1696 where
1697 T: std::convert::Into<crate::model::CertificateAuthority>,
1698 {
1699 self.0.request.certificate_authority = std::option::Option::Some(v.into());
1700 self
1701 }
1702
1703 /// Sets or clears the value of [certificate_authority][crate::model::UpdateCertificateAuthorityRequest::certificate_authority].
1704 ///
1705 /// This is a **required** field for requests.
1706 pub fn set_or_clear_certificate_authority<T>(mut self, v: std::option::Option<T>) -> Self
1707 where
1708 T: std::convert::Into<crate::model::CertificateAuthority>,
1709 {
1710 self.0.request.certificate_authority = v.map(|x| x.into());
1711 self
1712 }
1713
1714 /// Sets the value of [update_mask][crate::model::UpdateCertificateAuthorityRequest::update_mask].
1715 ///
1716 /// This is a **required** field for requests.
1717 pub fn set_update_mask<T>(mut self, v: T) -> Self
1718 where
1719 T: std::convert::Into<wkt::FieldMask>,
1720 {
1721 self.0.request.update_mask = std::option::Option::Some(v.into());
1722 self
1723 }
1724
1725 /// Sets or clears the value of [update_mask][crate::model::UpdateCertificateAuthorityRequest::update_mask].
1726 ///
1727 /// This is a **required** field for requests.
1728 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1729 where
1730 T: std::convert::Into<wkt::FieldMask>,
1731 {
1732 self.0.request.update_mask = v.map(|x| x.into());
1733 self
1734 }
1735
1736 /// Sets the value of [request_id][crate::model::UpdateCertificateAuthorityRequest::request_id].
1737 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1738 self.0.request.request_id = v.into();
1739 self
1740 }
1741 }
1742
1743 #[doc(hidden)]
1744 impl gax::options::internal::RequestBuilder for UpdateCertificateAuthority {
1745 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1746 &mut self.0.options
1747 }
1748 }
1749
1750 /// The request builder for [CertificateAuthorityService::create_ca_pool][crate::client::CertificateAuthorityService::create_ca_pool] calls.
1751 ///
1752 /// # Example
1753 /// ```no_run
1754 /// # use google_cloud_security_privateca_v1::builder;
1755 /// use builder::certificate_authority_service::CreateCaPool;
1756 /// # tokio_test::block_on(async {
1757 /// use lro::Poller;
1758 ///
1759 /// let builder = prepare_request_builder();
1760 /// let response = builder.poller().until_done().await?;
1761 /// # gax::Result::<()>::Ok(()) });
1762 ///
1763 /// fn prepare_request_builder() -> CreateCaPool {
1764 /// # panic!();
1765 /// // ... details omitted ...
1766 /// }
1767 /// ```
1768 #[derive(Clone, Debug)]
1769 pub struct CreateCaPool(RequestBuilder<crate::model::CreateCaPoolRequest>);
1770
1771 impl CreateCaPool {
1772 pub(crate) fn new(
1773 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1774 ) -> Self {
1775 Self(RequestBuilder::new(stub))
1776 }
1777
1778 /// Sets the full request, replacing any prior values.
1779 pub fn with_request<V: Into<crate::model::CreateCaPoolRequest>>(mut self, v: V) -> Self {
1780 self.0.request = v.into();
1781 self
1782 }
1783
1784 /// Sets all the options, replacing any prior values.
1785 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1786 self.0.options = v.into();
1787 self
1788 }
1789
1790 /// Sends the request.
1791 ///
1792 /// # Long running operations
1793 ///
1794 /// This starts, but does not poll, a longrunning operation. More information
1795 /// on [create_ca_pool][crate::client::CertificateAuthorityService::create_ca_pool].
1796 pub async fn send(self) -> Result<longrunning::model::Operation> {
1797 (*self.0.stub)
1798 .create_ca_pool(self.0.request, self.0.options)
1799 .await
1800 .map(gax::response::Response::into_body)
1801 }
1802
1803 /// Creates a [Poller][lro::Poller] to work with `create_ca_pool`.
1804 pub fn poller(
1805 self,
1806 ) -> impl lro::Poller<crate::model::CaPool, crate::model::OperationMetadata> {
1807 type Operation =
1808 lro::internal::Operation<crate::model::CaPool, crate::model::OperationMetadata>;
1809 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1810 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1811
1812 let stub = self.0.stub.clone();
1813 let mut options = self.0.options.clone();
1814 options.set_retry_policy(gax::retry_policy::NeverRetry);
1815 let query = move |name| {
1816 let stub = stub.clone();
1817 let options = options.clone();
1818 async {
1819 let op = GetOperation::new(stub)
1820 .set_name(name)
1821 .with_options(options)
1822 .send()
1823 .await?;
1824 Ok(Operation::new(op))
1825 }
1826 };
1827
1828 let start = move || async {
1829 let op = self.send().await?;
1830 Ok(Operation::new(op))
1831 };
1832
1833 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1834 }
1835
1836 /// Sets the value of [parent][crate::model::CreateCaPoolRequest::parent].
1837 ///
1838 /// This is a **required** field for requests.
1839 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1840 self.0.request.parent = v.into();
1841 self
1842 }
1843
1844 /// Sets the value of [ca_pool_id][crate::model::CreateCaPoolRequest::ca_pool_id].
1845 ///
1846 /// This is a **required** field for requests.
1847 pub fn set_ca_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1848 self.0.request.ca_pool_id = v.into();
1849 self
1850 }
1851
1852 /// Sets the value of [ca_pool][crate::model::CreateCaPoolRequest::ca_pool].
1853 ///
1854 /// This is a **required** field for requests.
1855 pub fn set_ca_pool<T>(mut self, v: T) -> Self
1856 where
1857 T: std::convert::Into<crate::model::CaPool>,
1858 {
1859 self.0.request.ca_pool = std::option::Option::Some(v.into());
1860 self
1861 }
1862
1863 /// Sets or clears the value of [ca_pool][crate::model::CreateCaPoolRequest::ca_pool].
1864 ///
1865 /// This is a **required** field for requests.
1866 pub fn set_or_clear_ca_pool<T>(mut self, v: std::option::Option<T>) -> Self
1867 where
1868 T: std::convert::Into<crate::model::CaPool>,
1869 {
1870 self.0.request.ca_pool = v.map(|x| x.into());
1871 self
1872 }
1873
1874 /// Sets the value of [request_id][crate::model::CreateCaPoolRequest::request_id].
1875 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1876 self.0.request.request_id = v.into();
1877 self
1878 }
1879 }
1880
1881 #[doc(hidden)]
1882 impl gax::options::internal::RequestBuilder for CreateCaPool {
1883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1884 &mut self.0.options
1885 }
1886 }
1887
1888 /// The request builder for [CertificateAuthorityService::update_ca_pool][crate::client::CertificateAuthorityService::update_ca_pool] calls.
1889 ///
1890 /// # Example
1891 /// ```no_run
1892 /// # use google_cloud_security_privateca_v1::builder;
1893 /// use builder::certificate_authority_service::UpdateCaPool;
1894 /// # tokio_test::block_on(async {
1895 /// use lro::Poller;
1896 ///
1897 /// let builder = prepare_request_builder();
1898 /// let response = builder.poller().until_done().await?;
1899 /// # gax::Result::<()>::Ok(()) });
1900 ///
1901 /// fn prepare_request_builder() -> UpdateCaPool {
1902 /// # panic!();
1903 /// // ... details omitted ...
1904 /// }
1905 /// ```
1906 #[derive(Clone, Debug)]
1907 pub struct UpdateCaPool(RequestBuilder<crate::model::UpdateCaPoolRequest>);
1908
1909 impl UpdateCaPool {
1910 pub(crate) fn new(
1911 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
1912 ) -> Self {
1913 Self(RequestBuilder::new(stub))
1914 }
1915
1916 /// Sets the full request, replacing any prior values.
1917 pub fn with_request<V: Into<crate::model::UpdateCaPoolRequest>>(mut self, v: V) -> Self {
1918 self.0.request = v.into();
1919 self
1920 }
1921
1922 /// Sets all the options, replacing any prior values.
1923 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1924 self.0.options = v.into();
1925 self
1926 }
1927
1928 /// Sends the request.
1929 ///
1930 /// # Long running operations
1931 ///
1932 /// This starts, but does not poll, a longrunning operation. More information
1933 /// on [update_ca_pool][crate::client::CertificateAuthorityService::update_ca_pool].
1934 pub async fn send(self) -> Result<longrunning::model::Operation> {
1935 (*self.0.stub)
1936 .update_ca_pool(self.0.request, self.0.options)
1937 .await
1938 .map(gax::response::Response::into_body)
1939 }
1940
1941 /// Creates a [Poller][lro::Poller] to work with `update_ca_pool`.
1942 pub fn poller(
1943 self,
1944 ) -> impl lro::Poller<crate::model::CaPool, crate::model::OperationMetadata> {
1945 type Operation =
1946 lro::internal::Operation<crate::model::CaPool, crate::model::OperationMetadata>;
1947 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1948 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1949
1950 let stub = self.0.stub.clone();
1951 let mut options = self.0.options.clone();
1952 options.set_retry_policy(gax::retry_policy::NeverRetry);
1953 let query = move |name| {
1954 let stub = stub.clone();
1955 let options = options.clone();
1956 async {
1957 let op = GetOperation::new(stub)
1958 .set_name(name)
1959 .with_options(options)
1960 .send()
1961 .await?;
1962 Ok(Operation::new(op))
1963 }
1964 };
1965
1966 let start = move || async {
1967 let op = self.send().await?;
1968 Ok(Operation::new(op))
1969 };
1970
1971 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1972 }
1973
1974 /// Sets the value of [ca_pool][crate::model::UpdateCaPoolRequest::ca_pool].
1975 ///
1976 /// This is a **required** field for requests.
1977 pub fn set_ca_pool<T>(mut self, v: T) -> Self
1978 where
1979 T: std::convert::Into<crate::model::CaPool>,
1980 {
1981 self.0.request.ca_pool = std::option::Option::Some(v.into());
1982 self
1983 }
1984
1985 /// Sets or clears the value of [ca_pool][crate::model::UpdateCaPoolRequest::ca_pool].
1986 ///
1987 /// This is a **required** field for requests.
1988 pub fn set_or_clear_ca_pool<T>(mut self, v: std::option::Option<T>) -> Self
1989 where
1990 T: std::convert::Into<crate::model::CaPool>,
1991 {
1992 self.0.request.ca_pool = v.map(|x| x.into());
1993 self
1994 }
1995
1996 /// Sets the value of [update_mask][crate::model::UpdateCaPoolRequest::update_mask].
1997 ///
1998 /// This is a **required** field for requests.
1999 pub fn set_update_mask<T>(mut self, v: T) -> Self
2000 where
2001 T: std::convert::Into<wkt::FieldMask>,
2002 {
2003 self.0.request.update_mask = std::option::Option::Some(v.into());
2004 self
2005 }
2006
2007 /// Sets or clears the value of [update_mask][crate::model::UpdateCaPoolRequest::update_mask].
2008 ///
2009 /// This is a **required** field for requests.
2010 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2011 where
2012 T: std::convert::Into<wkt::FieldMask>,
2013 {
2014 self.0.request.update_mask = v.map(|x| x.into());
2015 self
2016 }
2017
2018 /// Sets the value of [request_id][crate::model::UpdateCaPoolRequest::request_id].
2019 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2020 self.0.request.request_id = v.into();
2021 self
2022 }
2023 }
2024
2025 #[doc(hidden)]
2026 impl gax::options::internal::RequestBuilder for UpdateCaPool {
2027 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2028 &mut self.0.options
2029 }
2030 }
2031
2032 /// The request builder for [CertificateAuthorityService::get_ca_pool][crate::client::CertificateAuthorityService::get_ca_pool] calls.
2033 ///
2034 /// # Example
2035 /// ```no_run
2036 /// # use google_cloud_security_privateca_v1::builder;
2037 /// use builder::certificate_authority_service::GetCaPool;
2038 /// # tokio_test::block_on(async {
2039 ///
2040 /// let builder = prepare_request_builder();
2041 /// let response = builder.send().await?;
2042 /// # gax::Result::<()>::Ok(()) });
2043 ///
2044 /// fn prepare_request_builder() -> GetCaPool {
2045 /// # panic!();
2046 /// // ... details omitted ...
2047 /// }
2048 /// ```
2049 #[derive(Clone, Debug)]
2050 pub struct GetCaPool(RequestBuilder<crate::model::GetCaPoolRequest>);
2051
2052 impl GetCaPool {
2053 pub(crate) fn new(
2054 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2055 ) -> Self {
2056 Self(RequestBuilder::new(stub))
2057 }
2058
2059 /// Sets the full request, replacing any prior values.
2060 pub fn with_request<V: Into<crate::model::GetCaPoolRequest>>(mut self, v: V) -> Self {
2061 self.0.request = v.into();
2062 self
2063 }
2064
2065 /// Sets all the options, replacing any prior values.
2066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2067 self.0.options = v.into();
2068 self
2069 }
2070
2071 /// Sends the request.
2072 pub async fn send(self) -> Result<crate::model::CaPool> {
2073 (*self.0.stub)
2074 .get_ca_pool(self.0.request, self.0.options)
2075 .await
2076 .map(gax::response::Response::into_body)
2077 }
2078
2079 /// Sets the value of [name][crate::model::GetCaPoolRequest::name].
2080 ///
2081 /// This is a **required** field for requests.
2082 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2083 self.0.request.name = v.into();
2084 self
2085 }
2086 }
2087
2088 #[doc(hidden)]
2089 impl gax::options::internal::RequestBuilder for GetCaPool {
2090 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2091 &mut self.0.options
2092 }
2093 }
2094
2095 /// The request builder for [CertificateAuthorityService::list_ca_pools][crate::client::CertificateAuthorityService::list_ca_pools] calls.
2096 ///
2097 /// # Example
2098 /// ```no_run
2099 /// # use google_cloud_security_privateca_v1::builder;
2100 /// use builder::certificate_authority_service::ListCaPools;
2101 /// # tokio_test::block_on(async {
2102 /// use gax::paginator::ItemPaginator;
2103 ///
2104 /// let builder = prepare_request_builder();
2105 /// let mut items = builder.by_item();
2106 /// while let Some(result) = items.next().await {
2107 /// let item = result?;
2108 /// }
2109 /// # gax::Result::<()>::Ok(()) });
2110 ///
2111 /// fn prepare_request_builder() -> ListCaPools {
2112 /// # panic!();
2113 /// // ... details omitted ...
2114 /// }
2115 /// ```
2116 #[derive(Clone, Debug)]
2117 pub struct ListCaPools(RequestBuilder<crate::model::ListCaPoolsRequest>);
2118
2119 impl ListCaPools {
2120 pub(crate) fn new(
2121 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2122 ) -> Self {
2123 Self(RequestBuilder::new(stub))
2124 }
2125
2126 /// Sets the full request, replacing any prior values.
2127 pub fn with_request<V: Into<crate::model::ListCaPoolsRequest>>(mut self, v: V) -> Self {
2128 self.0.request = v.into();
2129 self
2130 }
2131
2132 /// Sets all the options, replacing any prior values.
2133 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2134 self.0.options = v.into();
2135 self
2136 }
2137
2138 /// Sends the request.
2139 pub async fn send(self) -> Result<crate::model::ListCaPoolsResponse> {
2140 (*self.0.stub)
2141 .list_ca_pools(self.0.request, self.0.options)
2142 .await
2143 .map(gax::response::Response::into_body)
2144 }
2145
2146 /// Streams each page in the collection.
2147 pub fn by_page(
2148 self,
2149 ) -> impl gax::paginator::Paginator<crate::model::ListCaPoolsResponse, gax::error::Error>
2150 {
2151 use std::clone::Clone;
2152 let token = self.0.request.page_token.clone();
2153 let execute = move |token: String| {
2154 let mut builder = self.clone();
2155 builder.0.request = builder.0.request.set_page_token(token);
2156 builder.send()
2157 };
2158 gax::paginator::internal::new_paginator(token, execute)
2159 }
2160
2161 /// Streams each item in the collection.
2162 pub fn by_item(
2163 self,
2164 ) -> impl gax::paginator::ItemPaginator<crate::model::ListCaPoolsResponse, gax::error::Error>
2165 {
2166 use gax::paginator::Paginator;
2167 self.by_page().items()
2168 }
2169
2170 /// Sets the value of [parent][crate::model::ListCaPoolsRequest::parent].
2171 ///
2172 /// This is a **required** field for requests.
2173 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2174 self.0.request.parent = v.into();
2175 self
2176 }
2177
2178 /// Sets the value of [page_size][crate::model::ListCaPoolsRequest::page_size].
2179 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2180 self.0.request.page_size = v.into();
2181 self
2182 }
2183
2184 /// Sets the value of [page_token][crate::model::ListCaPoolsRequest::page_token].
2185 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2186 self.0.request.page_token = v.into();
2187 self
2188 }
2189
2190 /// Sets the value of [filter][crate::model::ListCaPoolsRequest::filter].
2191 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2192 self.0.request.filter = v.into();
2193 self
2194 }
2195
2196 /// Sets the value of [order_by][crate::model::ListCaPoolsRequest::order_by].
2197 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2198 self.0.request.order_by = v.into();
2199 self
2200 }
2201 }
2202
2203 #[doc(hidden)]
2204 impl gax::options::internal::RequestBuilder for ListCaPools {
2205 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2206 &mut self.0.options
2207 }
2208 }
2209
2210 /// The request builder for [CertificateAuthorityService::delete_ca_pool][crate::client::CertificateAuthorityService::delete_ca_pool] calls.
2211 ///
2212 /// # Example
2213 /// ```no_run
2214 /// # use google_cloud_security_privateca_v1::builder;
2215 /// use builder::certificate_authority_service::DeleteCaPool;
2216 /// # tokio_test::block_on(async {
2217 /// use lro::Poller;
2218 ///
2219 /// let builder = prepare_request_builder();
2220 /// let response = builder.poller().until_done().await?;
2221 /// # gax::Result::<()>::Ok(()) });
2222 ///
2223 /// fn prepare_request_builder() -> DeleteCaPool {
2224 /// # panic!();
2225 /// // ... details omitted ...
2226 /// }
2227 /// ```
2228 #[derive(Clone, Debug)]
2229 pub struct DeleteCaPool(RequestBuilder<crate::model::DeleteCaPoolRequest>);
2230
2231 impl DeleteCaPool {
2232 pub(crate) fn new(
2233 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2234 ) -> Self {
2235 Self(RequestBuilder::new(stub))
2236 }
2237
2238 /// Sets the full request, replacing any prior values.
2239 pub fn with_request<V: Into<crate::model::DeleteCaPoolRequest>>(mut self, v: V) -> Self {
2240 self.0.request = v.into();
2241 self
2242 }
2243
2244 /// Sets all the options, replacing any prior values.
2245 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2246 self.0.options = v.into();
2247 self
2248 }
2249
2250 /// Sends the request.
2251 ///
2252 /// # Long running operations
2253 ///
2254 /// This starts, but does not poll, a longrunning operation. More information
2255 /// on [delete_ca_pool][crate::client::CertificateAuthorityService::delete_ca_pool].
2256 pub async fn send(self) -> Result<longrunning::model::Operation> {
2257 (*self.0.stub)
2258 .delete_ca_pool(self.0.request, self.0.options)
2259 .await
2260 .map(gax::response::Response::into_body)
2261 }
2262
2263 /// Creates a [Poller][lro::Poller] to work with `delete_ca_pool`.
2264 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2265 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2266 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2267 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2268
2269 let stub = self.0.stub.clone();
2270 let mut options = self.0.options.clone();
2271 options.set_retry_policy(gax::retry_policy::NeverRetry);
2272 let query = move |name| {
2273 let stub = stub.clone();
2274 let options = options.clone();
2275 async {
2276 let op = GetOperation::new(stub)
2277 .set_name(name)
2278 .with_options(options)
2279 .send()
2280 .await?;
2281 Ok(Operation::new(op))
2282 }
2283 };
2284
2285 let start = move || async {
2286 let op = self.send().await?;
2287 Ok(Operation::new(op))
2288 };
2289
2290 lro::internal::new_unit_response_poller(
2291 polling_error_policy,
2292 polling_backoff_policy,
2293 start,
2294 query,
2295 )
2296 }
2297
2298 /// Sets the value of [name][crate::model::DeleteCaPoolRequest::name].
2299 ///
2300 /// This is a **required** field for requests.
2301 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2302 self.0.request.name = v.into();
2303 self
2304 }
2305
2306 /// Sets the value of [request_id][crate::model::DeleteCaPoolRequest::request_id].
2307 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2308 self.0.request.request_id = v.into();
2309 self
2310 }
2311
2312 /// Sets the value of [ignore_dependent_resources][crate::model::DeleteCaPoolRequest::ignore_dependent_resources].
2313 pub fn set_ignore_dependent_resources<T: Into<bool>>(mut self, v: T) -> Self {
2314 self.0.request.ignore_dependent_resources = v.into();
2315 self
2316 }
2317 }
2318
2319 #[doc(hidden)]
2320 impl gax::options::internal::RequestBuilder for DeleteCaPool {
2321 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2322 &mut self.0.options
2323 }
2324 }
2325
2326 /// The request builder for [CertificateAuthorityService::fetch_ca_certs][crate::client::CertificateAuthorityService::fetch_ca_certs] calls.
2327 ///
2328 /// # Example
2329 /// ```no_run
2330 /// # use google_cloud_security_privateca_v1::builder;
2331 /// use builder::certificate_authority_service::FetchCaCerts;
2332 /// # tokio_test::block_on(async {
2333 ///
2334 /// let builder = prepare_request_builder();
2335 /// let response = builder.send().await?;
2336 /// # gax::Result::<()>::Ok(()) });
2337 ///
2338 /// fn prepare_request_builder() -> FetchCaCerts {
2339 /// # panic!();
2340 /// // ... details omitted ...
2341 /// }
2342 /// ```
2343 #[derive(Clone, Debug)]
2344 pub struct FetchCaCerts(RequestBuilder<crate::model::FetchCaCertsRequest>);
2345
2346 impl FetchCaCerts {
2347 pub(crate) fn new(
2348 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2349 ) -> Self {
2350 Self(RequestBuilder::new(stub))
2351 }
2352
2353 /// Sets the full request, replacing any prior values.
2354 pub fn with_request<V: Into<crate::model::FetchCaCertsRequest>>(mut self, v: V) -> Self {
2355 self.0.request = v.into();
2356 self
2357 }
2358
2359 /// Sets all the options, replacing any prior values.
2360 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2361 self.0.options = v.into();
2362 self
2363 }
2364
2365 /// Sends the request.
2366 pub async fn send(self) -> Result<crate::model::FetchCaCertsResponse> {
2367 (*self.0.stub)
2368 .fetch_ca_certs(self.0.request, self.0.options)
2369 .await
2370 .map(gax::response::Response::into_body)
2371 }
2372
2373 /// Sets the value of [ca_pool][crate::model::FetchCaCertsRequest::ca_pool].
2374 ///
2375 /// This is a **required** field for requests.
2376 pub fn set_ca_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
2377 self.0.request.ca_pool = v.into();
2378 self
2379 }
2380
2381 /// Sets the value of [request_id][crate::model::FetchCaCertsRequest::request_id].
2382 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2383 self.0.request.request_id = v.into();
2384 self
2385 }
2386 }
2387
2388 #[doc(hidden)]
2389 impl gax::options::internal::RequestBuilder for FetchCaCerts {
2390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2391 &mut self.0.options
2392 }
2393 }
2394
2395 /// The request builder for [CertificateAuthorityService::get_certificate_revocation_list][crate::client::CertificateAuthorityService::get_certificate_revocation_list] calls.
2396 ///
2397 /// # Example
2398 /// ```no_run
2399 /// # use google_cloud_security_privateca_v1::builder;
2400 /// use builder::certificate_authority_service::GetCertificateRevocationList;
2401 /// # tokio_test::block_on(async {
2402 ///
2403 /// let builder = prepare_request_builder();
2404 /// let response = builder.send().await?;
2405 /// # gax::Result::<()>::Ok(()) });
2406 ///
2407 /// fn prepare_request_builder() -> GetCertificateRevocationList {
2408 /// # panic!();
2409 /// // ... details omitted ...
2410 /// }
2411 /// ```
2412 #[derive(Clone, Debug)]
2413 pub struct GetCertificateRevocationList(
2414 RequestBuilder<crate::model::GetCertificateRevocationListRequest>,
2415 );
2416
2417 impl GetCertificateRevocationList {
2418 pub(crate) fn new(
2419 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2420 ) -> Self {
2421 Self(RequestBuilder::new(stub))
2422 }
2423
2424 /// Sets the full request, replacing any prior values.
2425 pub fn with_request<V: Into<crate::model::GetCertificateRevocationListRequest>>(
2426 mut self,
2427 v: V,
2428 ) -> Self {
2429 self.0.request = v.into();
2430 self
2431 }
2432
2433 /// Sets all the options, replacing any prior values.
2434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2435 self.0.options = v.into();
2436 self
2437 }
2438
2439 /// Sends the request.
2440 pub async fn send(self) -> Result<crate::model::CertificateRevocationList> {
2441 (*self.0.stub)
2442 .get_certificate_revocation_list(self.0.request, self.0.options)
2443 .await
2444 .map(gax::response::Response::into_body)
2445 }
2446
2447 /// Sets the value of [name][crate::model::GetCertificateRevocationListRequest::name].
2448 ///
2449 /// This is a **required** field for requests.
2450 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2451 self.0.request.name = v.into();
2452 self
2453 }
2454 }
2455
2456 #[doc(hidden)]
2457 impl gax::options::internal::RequestBuilder for GetCertificateRevocationList {
2458 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2459 &mut self.0.options
2460 }
2461 }
2462
2463 /// The request builder for [CertificateAuthorityService::list_certificate_revocation_lists][crate::client::CertificateAuthorityService::list_certificate_revocation_lists] calls.
2464 ///
2465 /// # Example
2466 /// ```no_run
2467 /// # use google_cloud_security_privateca_v1::builder;
2468 /// use builder::certificate_authority_service::ListCertificateRevocationLists;
2469 /// # tokio_test::block_on(async {
2470 /// use gax::paginator::ItemPaginator;
2471 ///
2472 /// let builder = prepare_request_builder();
2473 /// let mut items = builder.by_item();
2474 /// while let Some(result) = items.next().await {
2475 /// let item = result?;
2476 /// }
2477 /// # gax::Result::<()>::Ok(()) });
2478 ///
2479 /// fn prepare_request_builder() -> ListCertificateRevocationLists {
2480 /// # panic!();
2481 /// // ... details omitted ...
2482 /// }
2483 /// ```
2484 #[derive(Clone, Debug)]
2485 pub struct ListCertificateRevocationLists(
2486 RequestBuilder<crate::model::ListCertificateRevocationListsRequest>,
2487 );
2488
2489 impl ListCertificateRevocationLists {
2490 pub(crate) fn new(
2491 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2492 ) -> Self {
2493 Self(RequestBuilder::new(stub))
2494 }
2495
2496 /// Sets the full request, replacing any prior values.
2497 pub fn with_request<V: Into<crate::model::ListCertificateRevocationListsRequest>>(
2498 mut self,
2499 v: V,
2500 ) -> Self {
2501 self.0.request = v.into();
2502 self
2503 }
2504
2505 /// Sets all the options, replacing any prior values.
2506 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2507 self.0.options = v.into();
2508 self
2509 }
2510
2511 /// Sends the request.
2512 pub async fn send(self) -> Result<crate::model::ListCertificateRevocationListsResponse> {
2513 (*self.0.stub)
2514 .list_certificate_revocation_lists(self.0.request, self.0.options)
2515 .await
2516 .map(gax::response::Response::into_body)
2517 }
2518
2519 /// Streams each page in the collection.
2520 pub fn by_page(
2521 self,
2522 ) -> impl gax::paginator::Paginator<
2523 crate::model::ListCertificateRevocationListsResponse,
2524 gax::error::Error,
2525 > {
2526 use std::clone::Clone;
2527 let token = self.0.request.page_token.clone();
2528 let execute = move |token: String| {
2529 let mut builder = self.clone();
2530 builder.0.request = builder.0.request.set_page_token(token);
2531 builder.send()
2532 };
2533 gax::paginator::internal::new_paginator(token, execute)
2534 }
2535
2536 /// Streams each item in the collection.
2537 pub fn by_item(
2538 self,
2539 ) -> impl gax::paginator::ItemPaginator<
2540 crate::model::ListCertificateRevocationListsResponse,
2541 gax::error::Error,
2542 > {
2543 use gax::paginator::Paginator;
2544 self.by_page().items()
2545 }
2546
2547 /// Sets the value of [parent][crate::model::ListCertificateRevocationListsRequest::parent].
2548 ///
2549 /// This is a **required** field for requests.
2550 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2551 self.0.request.parent = v.into();
2552 self
2553 }
2554
2555 /// Sets the value of [page_size][crate::model::ListCertificateRevocationListsRequest::page_size].
2556 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2557 self.0.request.page_size = v.into();
2558 self
2559 }
2560
2561 /// Sets the value of [page_token][crate::model::ListCertificateRevocationListsRequest::page_token].
2562 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2563 self.0.request.page_token = v.into();
2564 self
2565 }
2566
2567 /// Sets the value of [filter][crate::model::ListCertificateRevocationListsRequest::filter].
2568 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2569 self.0.request.filter = v.into();
2570 self
2571 }
2572
2573 /// Sets the value of [order_by][crate::model::ListCertificateRevocationListsRequest::order_by].
2574 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2575 self.0.request.order_by = v.into();
2576 self
2577 }
2578 }
2579
2580 #[doc(hidden)]
2581 impl gax::options::internal::RequestBuilder for ListCertificateRevocationLists {
2582 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2583 &mut self.0.options
2584 }
2585 }
2586
2587 /// The request builder for [CertificateAuthorityService::update_certificate_revocation_list][crate::client::CertificateAuthorityService::update_certificate_revocation_list] calls.
2588 ///
2589 /// # Example
2590 /// ```no_run
2591 /// # use google_cloud_security_privateca_v1::builder;
2592 /// use builder::certificate_authority_service::UpdateCertificateRevocationList;
2593 /// # tokio_test::block_on(async {
2594 /// use lro::Poller;
2595 ///
2596 /// let builder = prepare_request_builder();
2597 /// let response = builder.poller().until_done().await?;
2598 /// # gax::Result::<()>::Ok(()) });
2599 ///
2600 /// fn prepare_request_builder() -> UpdateCertificateRevocationList {
2601 /// # panic!();
2602 /// // ... details omitted ...
2603 /// }
2604 /// ```
2605 #[derive(Clone, Debug)]
2606 pub struct UpdateCertificateRevocationList(
2607 RequestBuilder<crate::model::UpdateCertificateRevocationListRequest>,
2608 );
2609
2610 impl UpdateCertificateRevocationList {
2611 pub(crate) fn new(
2612 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2613 ) -> Self {
2614 Self(RequestBuilder::new(stub))
2615 }
2616
2617 /// Sets the full request, replacing any prior values.
2618 pub fn with_request<V: Into<crate::model::UpdateCertificateRevocationListRequest>>(
2619 mut self,
2620 v: V,
2621 ) -> Self {
2622 self.0.request = v.into();
2623 self
2624 }
2625
2626 /// Sets all the options, replacing any prior values.
2627 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2628 self.0.options = v.into();
2629 self
2630 }
2631
2632 /// Sends the request.
2633 ///
2634 /// # Long running operations
2635 ///
2636 /// This starts, but does not poll, a longrunning operation. More information
2637 /// on [update_certificate_revocation_list][crate::client::CertificateAuthorityService::update_certificate_revocation_list].
2638 pub async fn send(self) -> Result<longrunning::model::Operation> {
2639 (*self.0.stub)
2640 .update_certificate_revocation_list(self.0.request, self.0.options)
2641 .await
2642 .map(gax::response::Response::into_body)
2643 }
2644
2645 /// Creates a [Poller][lro::Poller] to work with `update_certificate_revocation_list`.
2646 pub fn poller(
2647 self,
2648 ) -> impl lro::Poller<crate::model::CertificateRevocationList, crate::model::OperationMetadata>
2649 {
2650 type Operation = lro::internal::Operation<
2651 crate::model::CertificateRevocationList,
2652 crate::model::OperationMetadata,
2653 >;
2654 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2655 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2656
2657 let stub = self.0.stub.clone();
2658 let mut options = self.0.options.clone();
2659 options.set_retry_policy(gax::retry_policy::NeverRetry);
2660 let query = move |name| {
2661 let stub = stub.clone();
2662 let options = options.clone();
2663 async {
2664 let op = GetOperation::new(stub)
2665 .set_name(name)
2666 .with_options(options)
2667 .send()
2668 .await?;
2669 Ok(Operation::new(op))
2670 }
2671 };
2672
2673 let start = move || async {
2674 let op = self.send().await?;
2675 Ok(Operation::new(op))
2676 };
2677
2678 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2679 }
2680
2681 /// Sets the value of [certificate_revocation_list][crate::model::UpdateCertificateRevocationListRequest::certificate_revocation_list].
2682 ///
2683 /// This is a **required** field for requests.
2684 pub fn set_certificate_revocation_list<T>(mut self, v: T) -> Self
2685 where
2686 T: std::convert::Into<crate::model::CertificateRevocationList>,
2687 {
2688 self.0.request.certificate_revocation_list = std::option::Option::Some(v.into());
2689 self
2690 }
2691
2692 /// Sets or clears the value of [certificate_revocation_list][crate::model::UpdateCertificateRevocationListRequest::certificate_revocation_list].
2693 ///
2694 /// This is a **required** field for requests.
2695 pub fn set_or_clear_certificate_revocation_list<T>(
2696 mut self,
2697 v: std::option::Option<T>,
2698 ) -> Self
2699 where
2700 T: std::convert::Into<crate::model::CertificateRevocationList>,
2701 {
2702 self.0.request.certificate_revocation_list = v.map(|x| x.into());
2703 self
2704 }
2705
2706 /// Sets the value of [update_mask][crate::model::UpdateCertificateRevocationListRequest::update_mask].
2707 ///
2708 /// This is a **required** field for requests.
2709 pub fn set_update_mask<T>(mut self, v: T) -> Self
2710 where
2711 T: std::convert::Into<wkt::FieldMask>,
2712 {
2713 self.0.request.update_mask = std::option::Option::Some(v.into());
2714 self
2715 }
2716
2717 /// Sets or clears the value of [update_mask][crate::model::UpdateCertificateRevocationListRequest::update_mask].
2718 ///
2719 /// This is a **required** field for requests.
2720 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2721 where
2722 T: std::convert::Into<wkt::FieldMask>,
2723 {
2724 self.0.request.update_mask = v.map(|x| x.into());
2725 self
2726 }
2727
2728 /// Sets the value of [request_id][crate::model::UpdateCertificateRevocationListRequest::request_id].
2729 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2730 self.0.request.request_id = v.into();
2731 self
2732 }
2733 }
2734
2735 #[doc(hidden)]
2736 impl gax::options::internal::RequestBuilder for UpdateCertificateRevocationList {
2737 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2738 &mut self.0.options
2739 }
2740 }
2741
2742 /// The request builder for [CertificateAuthorityService::create_certificate_template][crate::client::CertificateAuthorityService::create_certificate_template] calls.
2743 ///
2744 /// # Example
2745 /// ```no_run
2746 /// # use google_cloud_security_privateca_v1::builder;
2747 /// use builder::certificate_authority_service::CreateCertificateTemplate;
2748 /// # tokio_test::block_on(async {
2749 /// use lro::Poller;
2750 ///
2751 /// let builder = prepare_request_builder();
2752 /// let response = builder.poller().until_done().await?;
2753 /// # gax::Result::<()>::Ok(()) });
2754 ///
2755 /// fn prepare_request_builder() -> CreateCertificateTemplate {
2756 /// # panic!();
2757 /// // ... details omitted ...
2758 /// }
2759 /// ```
2760 #[derive(Clone, Debug)]
2761 pub struct CreateCertificateTemplate(
2762 RequestBuilder<crate::model::CreateCertificateTemplateRequest>,
2763 );
2764
2765 impl CreateCertificateTemplate {
2766 pub(crate) fn new(
2767 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2768 ) -> Self {
2769 Self(RequestBuilder::new(stub))
2770 }
2771
2772 /// Sets the full request, replacing any prior values.
2773 pub fn with_request<V: Into<crate::model::CreateCertificateTemplateRequest>>(
2774 mut self,
2775 v: V,
2776 ) -> Self {
2777 self.0.request = v.into();
2778 self
2779 }
2780
2781 /// Sets all the options, replacing any prior values.
2782 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2783 self.0.options = v.into();
2784 self
2785 }
2786
2787 /// Sends the request.
2788 ///
2789 /// # Long running operations
2790 ///
2791 /// This starts, but does not poll, a longrunning operation. More information
2792 /// on [create_certificate_template][crate::client::CertificateAuthorityService::create_certificate_template].
2793 pub async fn send(self) -> Result<longrunning::model::Operation> {
2794 (*self.0.stub)
2795 .create_certificate_template(self.0.request, self.0.options)
2796 .await
2797 .map(gax::response::Response::into_body)
2798 }
2799
2800 /// Creates a [Poller][lro::Poller] to work with `create_certificate_template`.
2801 pub fn poller(
2802 self,
2803 ) -> impl lro::Poller<crate::model::CertificateTemplate, crate::model::OperationMetadata>
2804 {
2805 type Operation = lro::internal::Operation<
2806 crate::model::CertificateTemplate,
2807 crate::model::OperationMetadata,
2808 >;
2809 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2810 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2811
2812 let stub = self.0.stub.clone();
2813 let mut options = self.0.options.clone();
2814 options.set_retry_policy(gax::retry_policy::NeverRetry);
2815 let query = move |name| {
2816 let stub = stub.clone();
2817 let options = options.clone();
2818 async {
2819 let op = GetOperation::new(stub)
2820 .set_name(name)
2821 .with_options(options)
2822 .send()
2823 .await?;
2824 Ok(Operation::new(op))
2825 }
2826 };
2827
2828 let start = move || async {
2829 let op = self.send().await?;
2830 Ok(Operation::new(op))
2831 };
2832
2833 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2834 }
2835
2836 /// Sets the value of [parent][crate::model::CreateCertificateTemplateRequest::parent].
2837 ///
2838 /// This is a **required** field for requests.
2839 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2840 self.0.request.parent = v.into();
2841 self
2842 }
2843
2844 /// Sets the value of [certificate_template_id][crate::model::CreateCertificateTemplateRequest::certificate_template_id].
2845 ///
2846 /// This is a **required** field for requests.
2847 pub fn set_certificate_template_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2848 self.0.request.certificate_template_id = v.into();
2849 self
2850 }
2851
2852 /// Sets the value of [certificate_template][crate::model::CreateCertificateTemplateRequest::certificate_template].
2853 ///
2854 /// This is a **required** field for requests.
2855 pub fn set_certificate_template<T>(mut self, v: T) -> Self
2856 where
2857 T: std::convert::Into<crate::model::CertificateTemplate>,
2858 {
2859 self.0.request.certificate_template = std::option::Option::Some(v.into());
2860 self
2861 }
2862
2863 /// Sets or clears the value of [certificate_template][crate::model::CreateCertificateTemplateRequest::certificate_template].
2864 ///
2865 /// This is a **required** field for requests.
2866 pub fn set_or_clear_certificate_template<T>(mut self, v: std::option::Option<T>) -> Self
2867 where
2868 T: std::convert::Into<crate::model::CertificateTemplate>,
2869 {
2870 self.0.request.certificate_template = v.map(|x| x.into());
2871 self
2872 }
2873
2874 /// Sets the value of [request_id][crate::model::CreateCertificateTemplateRequest::request_id].
2875 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2876 self.0.request.request_id = v.into();
2877 self
2878 }
2879 }
2880
2881 #[doc(hidden)]
2882 impl gax::options::internal::RequestBuilder for CreateCertificateTemplate {
2883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2884 &mut self.0.options
2885 }
2886 }
2887
2888 /// The request builder for [CertificateAuthorityService::delete_certificate_template][crate::client::CertificateAuthorityService::delete_certificate_template] calls.
2889 ///
2890 /// # Example
2891 /// ```no_run
2892 /// # use google_cloud_security_privateca_v1::builder;
2893 /// use builder::certificate_authority_service::DeleteCertificateTemplate;
2894 /// # tokio_test::block_on(async {
2895 /// use lro::Poller;
2896 ///
2897 /// let builder = prepare_request_builder();
2898 /// let response = builder.poller().until_done().await?;
2899 /// # gax::Result::<()>::Ok(()) });
2900 ///
2901 /// fn prepare_request_builder() -> DeleteCertificateTemplate {
2902 /// # panic!();
2903 /// // ... details omitted ...
2904 /// }
2905 /// ```
2906 #[derive(Clone, Debug)]
2907 pub struct DeleteCertificateTemplate(
2908 RequestBuilder<crate::model::DeleteCertificateTemplateRequest>,
2909 );
2910
2911 impl DeleteCertificateTemplate {
2912 pub(crate) fn new(
2913 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
2914 ) -> Self {
2915 Self(RequestBuilder::new(stub))
2916 }
2917
2918 /// Sets the full request, replacing any prior values.
2919 pub fn with_request<V: Into<crate::model::DeleteCertificateTemplateRequest>>(
2920 mut self,
2921 v: V,
2922 ) -> Self {
2923 self.0.request = v.into();
2924 self
2925 }
2926
2927 /// Sets all the options, replacing any prior values.
2928 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2929 self.0.options = v.into();
2930 self
2931 }
2932
2933 /// Sends the request.
2934 ///
2935 /// # Long running operations
2936 ///
2937 /// This starts, but does not poll, a longrunning operation. More information
2938 /// on [delete_certificate_template][crate::client::CertificateAuthorityService::delete_certificate_template].
2939 pub async fn send(self) -> Result<longrunning::model::Operation> {
2940 (*self.0.stub)
2941 .delete_certificate_template(self.0.request, self.0.options)
2942 .await
2943 .map(gax::response::Response::into_body)
2944 }
2945
2946 /// Creates a [Poller][lro::Poller] to work with `delete_certificate_template`.
2947 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2948 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2949 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2950 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2951
2952 let stub = self.0.stub.clone();
2953 let mut options = self.0.options.clone();
2954 options.set_retry_policy(gax::retry_policy::NeverRetry);
2955 let query = move |name| {
2956 let stub = stub.clone();
2957 let options = options.clone();
2958 async {
2959 let op = GetOperation::new(stub)
2960 .set_name(name)
2961 .with_options(options)
2962 .send()
2963 .await?;
2964 Ok(Operation::new(op))
2965 }
2966 };
2967
2968 let start = move || async {
2969 let op = self.send().await?;
2970 Ok(Operation::new(op))
2971 };
2972
2973 lro::internal::new_unit_response_poller(
2974 polling_error_policy,
2975 polling_backoff_policy,
2976 start,
2977 query,
2978 )
2979 }
2980
2981 /// Sets the value of [name][crate::model::DeleteCertificateTemplateRequest::name].
2982 ///
2983 /// This is a **required** field for requests.
2984 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2985 self.0.request.name = v.into();
2986 self
2987 }
2988
2989 /// Sets the value of [request_id][crate::model::DeleteCertificateTemplateRequest::request_id].
2990 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2991 self.0.request.request_id = v.into();
2992 self
2993 }
2994 }
2995
2996 #[doc(hidden)]
2997 impl gax::options::internal::RequestBuilder for DeleteCertificateTemplate {
2998 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2999 &mut self.0.options
3000 }
3001 }
3002
3003 /// The request builder for [CertificateAuthorityService::get_certificate_template][crate::client::CertificateAuthorityService::get_certificate_template] calls.
3004 ///
3005 /// # Example
3006 /// ```no_run
3007 /// # use google_cloud_security_privateca_v1::builder;
3008 /// use builder::certificate_authority_service::GetCertificateTemplate;
3009 /// # tokio_test::block_on(async {
3010 ///
3011 /// let builder = prepare_request_builder();
3012 /// let response = builder.send().await?;
3013 /// # gax::Result::<()>::Ok(()) });
3014 ///
3015 /// fn prepare_request_builder() -> GetCertificateTemplate {
3016 /// # panic!();
3017 /// // ... details omitted ...
3018 /// }
3019 /// ```
3020 #[derive(Clone, Debug)]
3021 pub struct GetCertificateTemplate(RequestBuilder<crate::model::GetCertificateTemplateRequest>);
3022
3023 impl GetCertificateTemplate {
3024 pub(crate) fn new(
3025 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3026 ) -> Self {
3027 Self(RequestBuilder::new(stub))
3028 }
3029
3030 /// Sets the full request, replacing any prior values.
3031 pub fn with_request<V: Into<crate::model::GetCertificateTemplateRequest>>(
3032 mut self,
3033 v: V,
3034 ) -> Self {
3035 self.0.request = v.into();
3036 self
3037 }
3038
3039 /// Sets all the options, replacing any prior values.
3040 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3041 self.0.options = v.into();
3042 self
3043 }
3044
3045 /// Sends the request.
3046 pub async fn send(self) -> Result<crate::model::CertificateTemplate> {
3047 (*self.0.stub)
3048 .get_certificate_template(self.0.request, self.0.options)
3049 .await
3050 .map(gax::response::Response::into_body)
3051 }
3052
3053 /// Sets the value of [name][crate::model::GetCertificateTemplateRequest::name].
3054 ///
3055 /// This is a **required** field for requests.
3056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3057 self.0.request.name = v.into();
3058 self
3059 }
3060 }
3061
3062 #[doc(hidden)]
3063 impl gax::options::internal::RequestBuilder for GetCertificateTemplate {
3064 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3065 &mut self.0.options
3066 }
3067 }
3068
3069 /// The request builder for [CertificateAuthorityService::list_certificate_templates][crate::client::CertificateAuthorityService::list_certificate_templates] calls.
3070 ///
3071 /// # Example
3072 /// ```no_run
3073 /// # use google_cloud_security_privateca_v1::builder;
3074 /// use builder::certificate_authority_service::ListCertificateTemplates;
3075 /// # tokio_test::block_on(async {
3076 /// use gax::paginator::ItemPaginator;
3077 ///
3078 /// let builder = prepare_request_builder();
3079 /// let mut items = builder.by_item();
3080 /// while let Some(result) = items.next().await {
3081 /// let item = result?;
3082 /// }
3083 /// # gax::Result::<()>::Ok(()) });
3084 ///
3085 /// fn prepare_request_builder() -> ListCertificateTemplates {
3086 /// # panic!();
3087 /// // ... details omitted ...
3088 /// }
3089 /// ```
3090 #[derive(Clone, Debug)]
3091 pub struct ListCertificateTemplates(
3092 RequestBuilder<crate::model::ListCertificateTemplatesRequest>,
3093 );
3094
3095 impl ListCertificateTemplates {
3096 pub(crate) fn new(
3097 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3098 ) -> Self {
3099 Self(RequestBuilder::new(stub))
3100 }
3101
3102 /// Sets the full request, replacing any prior values.
3103 pub fn with_request<V: Into<crate::model::ListCertificateTemplatesRequest>>(
3104 mut self,
3105 v: V,
3106 ) -> Self {
3107 self.0.request = v.into();
3108 self
3109 }
3110
3111 /// Sets all the options, replacing any prior values.
3112 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3113 self.0.options = v.into();
3114 self
3115 }
3116
3117 /// Sends the request.
3118 pub async fn send(self) -> Result<crate::model::ListCertificateTemplatesResponse> {
3119 (*self.0.stub)
3120 .list_certificate_templates(self.0.request, self.0.options)
3121 .await
3122 .map(gax::response::Response::into_body)
3123 }
3124
3125 /// Streams each page in the collection.
3126 pub fn by_page(
3127 self,
3128 ) -> impl gax::paginator::Paginator<
3129 crate::model::ListCertificateTemplatesResponse,
3130 gax::error::Error,
3131 > {
3132 use std::clone::Clone;
3133 let token = self.0.request.page_token.clone();
3134 let execute = move |token: String| {
3135 let mut builder = self.clone();
3136 builder.0.request = builder.0.request.set_page_token(token);
3137 builder.send()
3138 };
3139 gax::paginator::internal::new_paginator(token, execute)
3140 }
3141
3142 /// Streams each item in the collection.
3143 pub fn by_item(
3144 self,
3145 ) -> impl gax::paginator::ItemPaginator<
3146 crate::model::ListCertificateTemplatesResponse,
3147 gax::error::Error,
3148 > {
3149 use gax::paginator::Paginator;
3150 self.by_page().items()
3151 }
3152
3153 /// Sets the value of [parent][crate::model::ListCertificateTemplatesRequest::parent].
3154 ///
3155 /// This is a **required** field for requests.
3156 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3157 self.0.request.parent = v.into();
3158 self
3159 }
3160
3161 /// Sets the value of [page_size][crate::model::ListCertificateTemplatesRequest::page_size].
3162 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3163 self.0.request.page_size = v.into();
3164 self
3165 }
3166
3167 /// Sets the value of [page_token][crate::model::ListCertificateTemplatesRequest::page_token].
3168 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3169 self.0.request.page_token = v.into();
3170 self
3171 }
3172
3173 /// Sets the value of [filter][crate::model::ListCertificateTemplatesRequest::filter].
3174 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3175 self.0.request.filter = v.into();
3176 self
3177 }
3178
3179 /// Sets the value of [order_by][crate::model::ListCertificateTemplatesRequest::order_by].
3180 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3181 self.0.request.order_by = v.into();
3182 self
3183 }
3184 }
3185
3186 #[doc(hidden)]
3187 impl gax::options::internal::RequestBuilder for ListCertificateTemplates {
3188 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3189 &mut self.0.options
3190 }
3191 }
3192
3193 /// The request builder for [CertificateAuthorityService::update_certificate_template][crate::client::CertificateAuthorityService::update_certificate_template] calls.
3194 ///
3195 /// # Example
3196 /// ```no_run
3197 /// # use google_cloud_security_privateca_v1::builder;
3198 /// use builder::certificate_authority_service::UpdateCertificateTemplate;
3199 /// # tokio_test::block_on(async {
3200 /// use lro::Poller;
3201 ///
3202 /// let builder = prepare_request_builder();
3203 /// let response = builder.poller().until_done().await?;
3204 /// # gax::Result::<()>::Ok(()) });
3205 ///
3206 /// fn prepare_request_builder() -> UpdateCertificateTemplate {
3207 /// # panic!();
3208 /// // ... details omitted ...
3209 /// }
3210 /// ```
3211 #[derive(Clone, Debug)]
3212 pub struct UpdateCertificateTemplate(
3213 RequestBuilder<crate::model::UpdateCertificateTemplateRequest>,
3214 );
3215
3216 impl UpdateCertificateTemplate {
3217 pub(crate) fn new(
3218 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3219 ) -> Self {
3220 Self(RequestBuilder::new(stub))
3221 }
3222
3223 /// Sets the full request, replacing any prior values.
3224 pub fn with_request<V: Into<crate::model::UpdateCertificateTemplateRequest>>(
3225 mut self,
3226 v: V,
3227 ) -> Self {
3228 self.0.request = v.into();
3229 self
3230 }
3231
3232 /// Sets all the options, replacing any prior values.
3233 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3234 self.0.options = v.into();
3235 self
3236 }
3237
3238 /// Sends the request.
3239 ///
3240 /// # Long running operations
3241 ///
3242 /// This starts, but does not poll, a longrunning operation. More information
3243 /// on [update_certificate_template][crate::client::CertificateAuthorityService::update_certificate_template].
3244 pub async fn send(self) -> Result<longrunning::model::Operation> {
3245 (*self.0.stub)
3246 .update_certificate_template(self.0.request, self.0.options)
3247 .await
3248 .map(gax::response::Response::into_body)
3249 }
3250
3251 /// Creates a [Poller][lro::Poller] to work with `update_certificate_template`.
3252 pub fn poller(
3253 self,
3254 ) -> impl lro::Poller<crate::model::CertificateTemplate, crate::model::OperationMetadata>
3255 {
3256 type Operation = lro::internal::Operation<
3257 crate::model::CertificateTemplate,
3258 crate::model::OperationMetadata,
3259 >;
3260 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3261 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3262
3263 let stub = self.0.stub.clone();
3264 let mut options = self.0.options.clone();
3265 options.set_retry_policy(gax::retry_policy::NeverRetry);
3266 let query = move |name| {
3267 let stub = stub.clone();
3268 let options = options.clone();
3269 async {
3270 let op = GetOperation::new(stub)
3271 .set_name(name)
3272 .with_options(options)
3273 .send()
3274 .await?;
3275 Ok(Operation::new(op))
3276 }
3277 };
3278
3279 let start = move || async {
3280 let op = self.send().await?;
3281 Ok(Operation::new(op))
3282 };
3283
3284 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3285 }
3286
3287 /// Sets the value of [certificate_template][crate::model::UpdateCertificateTemplateRequest::certificate_template].
3288 ///
3289 /// This is a **required** field for requests.
3290 pub fn set_certificate_template<T>(mut self, v: T) -> Self
3291 where
3292 T: std::convert::Into<crate::model::CertificateTemplate>,
3293 {
3294 self.0.request.certificate_template = std::option::Option::Some(v.into());
3295 self
3296 }
3297
3298 /// Sets or clears the value of [certificate_template][crate::model::UpdateCertificateTemplateRequest::certificate_template].
3299 ///
3300 /// This is a **required** field for requests.
3301 pub fn set_or_clear_certificate_template<T>(mut self, v: std::option::Option<T>) -> Self
3302 where
3303 T: std::convert::Into<crate::model::CertificateTemplate>,
3304 {
3305 self.0.request.certificate_template = v.map(|x| x.into());
3306 self
3307 }
3308
3309 /// Sets the value of [update_mask][crate::model::UpdateCertificateTemplateRequest::update_mask].
3310 ///
3311 /// This is a **required** field for requests.
3312 pub fn set_update_mask<T>(mut self, v: T) -> Self
3313 where
3314 T: std::convert::Into<wkt::FieldMask>,
3315 {
3316 self.0.request.update_mask = std::option::Option::Some(v.into());
3317 self
3318 }
3319
3320 /// Sets or clears the value of [update_mask][crate::model::UpdateCertificateTemplateRequest::update_mask].
3321 ///
3322 /// This is a **required** field for requests.
3323 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3324 where
3325 T: std::convert::Into<wkt::FieldMask>,
3326 {
3327 self.0.request.update_mask = v.map(|x| x.into());
3328 self
3329 }
3330
3331 /// Sets the value of [request_id][crate::model::UpdateCertificateTemplateRequest::request_id].
3332 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3333 self.0.request.request_id = v.into();
3334 self
3335 }
3336 }
3337
3338 #[doc(hidden)]
3339 impl gax::options::internal::RequestBuilder for UpdateCertificateTemplate {
3340 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3341 &mut self.0.options
3342 }
3343 }
3344
3345 /// The request builder for [CertificateAuthorityService::list_locations][crate::client::CertificateAuthorityService::list_locations] calls.
3346 ///
3347 /// # Example
3348 /// ```no_run
3349 /// # use google_cloud_security_privateca_v1::builder;
3350 /// use builder::certificate_authority_service::ListLocations;
3351 /// # tokio_test::block_on(async {
3352 /// use gax::paginator::ItemPaginator;
3353 ///
3354 /// let builder = prepare_request_builder();
3355 /// let mut items = builder.by_item();
3356 /// while let Some(result) = items.next().await {
3357 /// let item = result?;
3358 /// }
3359 /// # gax::Result::<()>::Ok(()) });
3360 ///
3361 /// fn prepare_request_builder() -> ListLocations {
3362 /// # panic!();
3363 /// // ... details omitted ...
3364 /// }
3365 /// ```
3366 #[derive(Clone, Debug)]
3367 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
3368
3369 impl ListLocations {
3370 pub(crate) fn new(
3371 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3372 ) -> Self {
3373 Self(RequestBuilder::new(stub))
3374 }
3375
3376 /// Sets the full request, replacing any prior values.
3377 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
3378 mut self,
3379 v: V,
3380 ) -> Self {
3381 self.0.request = v.into();
3382 self
3383 }
3384
3385 /// Sets all the options, replacing any prior values.
3386 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3387 self.0.options = v.into();
3388 self
3389 }
3390
3391 /// Sends the request.
3392 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
3393 (*self.0.stub)
3394 .list_locations(self.0.request, self.0.options)
3395 .await
3396 .map(gax::response::Response::into_body)
3397 }
3398
3399 /// Streams each page in the collection.
3400 pub fn by_page(
3401 self,
3402 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
3403 {
3404 use std::clone::Clone;
3405 let token = self.0.request.page_token.clone();
3406 let execute = move |token: String| {
3407 let mut builder = self.clone();
3408 builder.0.request = builder.0.request.set_page_token(token);
3409 builder.send()
3410 };
3411 gax::paginator::internal::new_paginator(token, execute)
3412 }
3413
3414 /// Streams each item in the collection.
3415 pub fn by_item(
3416 self,
3417 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
3418 {
3419 use gax::paginator::Paginator;
3420 self.by_page().items()
3421 }
3422
3423 /// Sets the value of [name][location::model::ListLocationsRequest::name].
3424 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3425 self.0.request.name = v.into();
3426 self
3427 }
3428
3429 /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
3430 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3431 self.0.request.filter = v.into();
3432 self
3433 }
3434
3435 /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
3436 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3437 self.0.request.page_size = v.into();
3438 self
3439 }
3440
3441 /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
3442 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3443 self.0.request.page_token = v.into();
3444 self
3445 }
3446 }
3447
3448 #[doc(hidden)]
3449 impl gax::options::internal::RequestBuilder for ListLocations {
3450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3451 &mut self.0.options
3452 }
3453 }
3454
3455 /// The request builder for [CertificateAuthorityService::get_location][crate::client::CertificateAuthorityService::get_location] calls.
3456 ///
3457 /// # Example
3458 /// ```no_run
3459 /// # use google_cloud_security_privateca_v1::builder;
3460 /// use builder::certificate_authority_service::GetLocation;
3461 /// # tokio_test::block_on(async {
3462 ///
3463 /// let builder = prepare_request_builder();
3464 /// let response = builder.send().await?;
3465 /// # gax::Result::<()>::Ok(()) });
3466 ///
3467 /// fn prepare_request_builder() -> GetLocation {
3468 /// # panic!();
3469 /// // ... details omitted ...
3470 /// }
3471 /// ```
3472 #[derive(Clone, Debug)]
3473 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
3474
3475 impl GetLocation {
3476 pub(crate) fn new(
3477 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3478 ) -> Self {
3479 Self(RequestBuilder::new(stub))
3480 }
3481
3482 /// Sets the full request, replacing any prior values.
3483 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
3484 self.0.request = v.into();
3485 self
3486 }
3487
3488 /// Sets all the options, replacing any prior values.
3489 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3490 self.0.options = v.into();
3491 self
3492 }
3493
3494 /// Sends the request.
3495 pub async fn send(self) -> Result<location::model::Location> {
3496 (*self.0.stub)
3497 .get_location(self.0.request, self.0.options)
3498 .await
3499 .map(gax::response::Response::into_body)
3500 }
3501
3502 /// Sets the value of [name][location::model::GetLocationRequest::name].
3503 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3504 self.0.request.name = v.into();
3505 self
3506 }
3507 }
3508
3509 #[doc(hidden)]
3510 impl gax::options::internal::RequestBuilder for GetLocation {
3511 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3512 &mut self.0.options
3513 }
3514 }
3515
3516 /// The request builder for [CertificateAuthorityService::set_iam_policy][crate::client::CertificateAuthorityService::set_iam_policy] calls.
3517 ///
3518 /// # Example
3519 /// ```no_run
3520 /// # use google_cloud_security_privateca_v1::builder;
3521 /// use builder::certificate_authority_service::SetIamPolicy;
3522 /// # tokio_test::block_on(async {
3523 ///
3524 /// let builder = prepare_request_builder();
3525 /// let response = builder.send().await?;
3526 /// # gax::Result::<()>::Ok(()) });
3527 ///
3528 /// fn prepare_request_builder() -> SetIamPolicy {
3529 /// # panic!();
3530 /// // ... details omitted ...
3531 /// }
3532 /// ```
3533 #[derive(Clone, Debug)]
3534 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3535
3536 impl SetIamPolicy {
3537 pub(crate) fn new(
3538 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3539 ) -> Self {
3540 Self(RequestBuilder::new(stub))
3541 }
3542
3543 /// Sets the full request, replacing any prior values.
3544 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3545 self.0.request = v.into();
3546 self
3547 }
3548
3549 /// Sets all the options, replacing any prior values.
3550 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3551 self.0.options = v.into();
3552 self
3553 }
3554
3555 /// Sends the request.
3556 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3557 (*self.0.stub)
3558 .set_iam_policy(self.0.request, self.0.options)
3559 .await
3560 .map(gax::response::Response::into_body)
3561 }
3562
3563 /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
3564 ///
3565 /// This is a **required** field for requests.
3566 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3567 self.0.request.resource = v.into();
3568 self
3569 }
3570
3571 /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
3572 ///
3573 /// This is a **required** field for requests.
3574 pub fn set_policy<T>(mut self, v: T) -> Self
3575 where
3576 T: std::convert::Into<iam_v1::model::Policy>,
3577 {
3578 self.0.request.policy = std::option::Option::Some(v.into());
3579 self
3580 }
3581
3582 /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
3583 ///
3584 /// This is a **required** field for requests.
3585 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3586 where
3587 T: std::convert::Into<iam_v1::model::Policy>,
3588 {
3589 self.0.request.policy = v.map(|x| x.into());
3590 self
3591 }
3592
3593 /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
3594 pub fn set_update_mask<T>(mut self, v: T) -> Self
3595 where
3596 T: std::convert::Into<wkt::FieldMask>,
3597 {
3598 self.0.request.update_mask = std::option::Option::Some(v.into());
3599 self
3600 }
3601
3602 /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
3603 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3604 where
3605 T: std::convert::Into<wkt::FieldMask>,
3606 {
3607 self.0.request.update_mask = v.map(|x| x.into());
3608 self
3609 }
3610 }
3611
3612 #[doc(hidden)]
3613 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3614 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3615 &mut self.0.options
3616 }
3617 }
3618
3619 /// The request builder for [CertificateAuthorityService::get_iam_policy][crate::client::CertificateAuthorityService::get_iam_policy] calls.
3620 ///
3621 /// # Example
3622 /// ```no_run
3623 /// # use google_cloud_security_privateca_v1::builder;
3624 /// use builder::certificate_authority_service::GetIamPolicy;
3625 /// # tokio_test::block_on(async {
3626 ///
3627 /// let builder = prepare_request_builder();
3628 /// let response = builder.send().await?;
3629 /// # gax::Result::<()>::Ok(()) });
3630 ///
3631 /// fn prepare_request_builder() -> GetIamPolicy {
3632 /// # panic!();
3633 /// // ... details omitted ...
3634 /// }
3635 /// ```
3636 #[derive(Clone, Debug)]
3637 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3638
3639 impl GetIamPolicy {
3640 pub(crate) fn new(
3641 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3642 ) -> Self {
3643 Self(RequestBuilder::new(stub))
3644 }
3645
3646 /// Sets the full request, replacing any prior values.
3647 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3648 self.0.request = v.into();
3649 self
3650 }
3651
3652 /// Sets all the options, replacing any prior values.
3653 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3654 self.0.options = v.into();
3655 self
3656 }
3657
3658 /// Sends the request.
3659 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3660 (*self.0.stub)
3661 .get_iam_policy(self.0.request, self.0.options)
3662 .await
3663 .map(gax::response::Response::into_body)
3664 }
3665
3666 /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
3667 ///
3668 /// This is a **required** field for requests.
3669 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3670 self.0.request.resource = v.into();
3671 self
3672 }
3673
3674 /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3675 pub fn set_options<T>(mut self, v: T) -> Self
3676 where
3677 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3678 {
3679 self.0.request.options = std::option::Option::Some(v.into());
3680 self
3681 }
3682
3683 /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3684 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3685 where
3686 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3687 {
3688 self.0.request.options = v.map(|x| x.into());
3689 self
3690 }
3691 }
3692
3693 #[doc(hidden)]
3694 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3695 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3696 &mut self.0.options
3697 }
3698 }
3699
3700 /// The request builder for [CertificateAuthorityService::test_iam_permissions][crate::client::CertificateAuthorityService::test_iam_permissions] calls.
3701 ///
3702 /// # Example
3703 /// ```no_run
3704 /// # use google_cloud_security_privateca_v1::builder;
3705 /// use builder::certificate_authority_service::TestIamPermissions;
3706 /// # tokio_test::block_on(async {
3707 ///
3708 /// let builder = prepare_request_builder();
3709 /// let response = builder.send().await?;
3710 /// # gax::Result::<()>::Ok(()) });
3711 ///
3712 /// fn prepare_request_builder() -> TestIamPermissions {
3713 /// # panic!();
3714 /// // ... details omitted ...
3715 /// }
3716 /// ```
3717 #[derive(Clone, Debug)]
3718 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3719
3720 impl TestIamPermissions {
3721 pub(crate) fn new(
3722 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3723 ) -> Self {
3724 Self(RequestBuilder::new(stub))
3725 }
3726
3727 /// Sets the full request, replacing any prior values.
3728 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3729 mut self,
3730 v: V,
3731 ) -> Self {
3732 self.0.request = v.into();
3733 self
3734 }
3735
3736 /// Sets all the options, replacing any prior values.
3737 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3738 self.0.options = v.into();
3739 self
3740 }
3741
3742 /// Sends the request.
3743 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3744 (*self.0.stub)
3745 .test_iam_permissions(self.0.request, self.0.options)
3746 .await
3747 .map(gax::response::Response::into_body)
3748 }
3749
3750 /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
3751 ///
3752 /// This is a **required** field for requests.
3753 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3754 self.0.request.resource = v.into();
3755 self
3756 }
3757
3758 /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
3759 ///
3760 /// This is a **required** field for requests.
3761 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3762 where
3763 T: std::iter::IntoIterator<Item = V>,
3764 V: std::convert::Into<std::string::String>,
3765 {
3766 use std::iter::Iterator;
3767 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3768 self
3769 }
3770 }
3771
3772 #[doc(hidden)]
3773 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3774 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3775 &mut self.0.options
3776 }
3777 }
3778
3779 /// The request builder for [CertificateAuthorityService::list_operations][crate::client::CertificateAuthorityService::list_operations] calls.
3780 ///
3781 /// # Example
3782 /// ```no_run
3783 /// # use google_cloud_security_privateca_v1::builder;
3784 /// use builder::certificate_authority_service::ListOperations;
3785 /// # tokio_test::block_on(async {
3786 /// use gax::paginator::ItemPaginator;
3787 ///
3788 /// let builder = prepare_request_builder();
3789 /// let mut items = builder.by_item();
3790 /// while let Some(result) = items.next().await {
3791 /// let item = result?;
3792 /// }
3793 /// # gax::Result::<()>::Ok(()) });
3794 ///
3795 /// fn prepare_request_builder() -> ListOperations {
3796 /// # panic!();
3797 /// // ... details omitted ...
3798 /// }
3799 /// ```
3800 #[derive(Clone, Debug)]
3801 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3802
3803 impl ListOperations {
3804 pub(crate) fn new(
3805 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3806 ) -> Self {
3807 Self(RequestBuilder::new(stub))
3808 }
3809
3810 /// Sets the full request, replacing any prior values.
3811 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3812 mut self,
3813 v: V,
3814 ) -> Self {
3815 self.0.request = v.into();
3816 self
3817 }
3818
3819 /// Sets all the options, replacing any prior values.
3820 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3821 self.0.options = v.into();
3822 self
3823 }
3824
3825 /// Sends the request.
3826 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3827 (*self.0.stub)
3828 .list_operations(self.0.request, self.0.options)
3829 .await
3830 .map(gax::response::Response::into_body)
3831 }
3832
3833 /// Streams each page in the collection.
3834 pub fn by_page(
3835 self,
3836 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3837 {
3838 use std::clone::Clone;
3839 let token = self.0.request.page_token.clone();
3840 let execute = move |token: String| {
3841 let mut builder = self.clone();
3842 builder.0.request = builder.0.request.set_page_token(token);
3843 builder.send()
3844 };
3845 gax::paginator::internal::new_paginator(token, execute)
3846 }
3847
3848 /// Streams each item in the collection.
3849 pub fn by_item(
3850 self,
3851 ) -> impl gax::paginator::ItemPaginator<
3852 longrunning::model::ListOperationsResponse,
3853 gax::error::Error,
3854 > {
3855 use gax::paginator::Paginator;
3856 self.by_page().items()
3857 }
3858
3859 /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3861 self.0.request.name = v.into();
3862 self
3863 }
3864
3865 /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3866 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3867 self.0.request.filter = v.into();
3868 self
3869 }
3870
3871 /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3872 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3873 self.0.request.page_size = v.into();
3874 self
3875 }
3876
3877 /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3878 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3879 self.0.request.page_token = v.into();
3880 self
3881 }
3882
3883 /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
3884 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3885 self.0.request.return_partial_success = v.into();
3886 self
3887 }
3888 }
3889
3890 #[doc(hidden)]
3891 impl gax::options::internal::RequestBuilder for ListOperations {
3892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3893 &mut self.0.options
3894 }
3895 }
3896
3897 /// The request builder for [CertificateAuthorityService::get_operation][crate::client::CertificateAuthorityService::get_operation] calls.
3898 ///
3899 /// # Example
3900 /// ```no_run
3901 /// # use google_cloud_security_privateca_v1::builder;
3902 /// use builder::certificate_authority_service::GetOperation;
3903 /// # tokio_test::block_on(async {
3904 ///
3905 /// let builder = prepare_request_builder();
3906 /// let response = builder.send().await?;
3907 /// # gax::Result::<()>::Ok(()) });
3908 ///
3909 /// fn prepare_request_builder() -> GetOperation {
3910 /// # panic!();
3911 /// // ... details omitted ...
3912 /// }
3913 /// ```
3914 #[derive(Clone, Debug)]
3915 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3916
3917 impl GetOperation {
3918 pub(crate) fn new(
3919 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3920 ) -> Self {
3921 Self(RequestBuilder::new(stub))
3922 }
3923
3924 /// Sets the full request, replacing any prior values.
3925 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3926 mut self,
3927 v: V,
3928 ) -> Self {
3929 self.0.request = v.into();
3930 self
3931 }
3932
3933 /// Sets all the options, replacing any prior values.
3934 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3935 self.0.options = v.into();
3936 self
3937 }
3938
3939 /// Sends the request.
3940 pub async fn send(self) -> Result<longrunning::model::Operation> {
3941 (*self.0.stub)
3942 .get_operation(self.0.request, self.0.options)
3943 .await
3944 .map(gax::response::Response::into_body)
3945 }
3946
3947 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3948 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3949 self.0.request.name = v.into();
3950 self
3951 }
3952 }
3953
3954 #[doc(hidden)]
3955 impl gax::options::internal::RequestBuilder for GetOperation {
3956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3957 &mut self.0.options
3958 }
3959 }
3960
3961 /// The request builder for [CertificateAuthorityService::delete_operation][crate::client::CertificateAuthorityService::delete_operation] calls.
3962 ///
3963 /// # Example
3964 /// ```no_run
3965 /// # use google_cloud_security_privateca_v1::builder;
3966 /// use builder::certificate_authority_service::DeleteOperation;
3967 /// # tokio_test::block_on(async {
3968 ///
3969 /// let builder = prepare_request_builder();
3970 /// let response = builder.send().await?;
3971 /// # gax::Result::<()>::Ok(()) });
3972 ///
3973 /// fn prepare_request_builder() -> DeleteOperation {
3974 /// # panic!();
3975 /// // ... details omitted ...
3976 /// }
3977 /// ```
3978 #[derive(Clone, Debug)]
3979 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3980
3981 impl DeleteOperation {
3982 pub(crate) fn new(
3983 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
3984 ) -> Self {
3985 Self(RequestBuilder::new(stub))
3986 }
3987
3988 /// Sets the full request, replacing any prior values.
3989 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3990 mut self,
3991 v: V,
3992 ) -> Self {
3993 self.0.request = v.into();
3994 self
3995 }
3996
3997 /// Sets all the options, replacing any prior values.
3998 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3999 self.0.options = v.into();
4000 self
4001 }
4002
4003 /// Sends the request.
4004 pub async fn send(self) -> Result<()> {
4005 (*self.0.stub)
4006 .delete_operation(self.0.request, self.0.options)
4007 .await
4008 .map(gax::response::Response::into_body)
4009 }
4010
4011 /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
4012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4013 self.0.request.name = v.into();
4014 self
4015 }
4016 }
4017
4018 #[doc(hidden)]
4019 impl gax::options::internal::RequestBuilder for DeleteOperation {
4020 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4021 &mut self.0.options
4022 }
4023 }
4024
4025 /// The request builder for [CertificateAuthorityService::cancel_operation][crate::client::CertificateAuthorityService::cancel_operation] calls.
4026 ///
4027 /// # Example
4028 /// ```no_run
4029 /// # use google_cloud_security_privateca_v1::builder;
4030 /// use builder::certificate_authority_service::CancelOperation;
4031 /// # tokio_test::block_on(async {
4032 ///
4033 /// let builder = prepare_request_builder();
4034 /// let response = builder.send().await?;
4035 /// # gax::Result::<()>::Ok(()) });
4036 ///
4037 /// fn prepare_request_builder() -> CancelOperation {
4038 /// # panic!();
4039 /// // ... details omitted ...
4040 /// }
4041 /// ```
4042 #[derive(Clone, Debug)]
4043 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4044
4045 impl CancelOperation {
4046 pub(crate) fn new(
4047 stub: std::sync::Arc<dyn super::super::stub::dynamic::CertificateAuthorityService>,
4048 ) -> Self {
4049 Self(RequestBuilder::new(stub))
4050 }
4051
4052 /// Sets the full request, replacing any prior values.
4053 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4054 mut self,
4055 v: V,
4056 ) -> Self {
4057 self.0.request = v.into();
4058 self
4059 }
4060
4061 /// Sets all the options, replacing any prior values.
4062 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4063 self.0.options = v.into();
4064 self
4065 }
4066
4067 /// Sends the request.
4068 pub async fn send(self) -> Result<()> {
4069 (*self.0.stub)
4070 .cancel_operation(self.0.request, self.0.options)
4071 .await
4072 .map(gax::response::Response::into_body)
4073 }
4074
4075 /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4076 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4077 self.0.request.name = v.into();
4078 self
4079 }
4080 }
4081
4082 #[doc(hidden)]
4083 impl gax::options::internal::RequestBuilder for CancelOperation {
4084 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4085 &mut self.0.options
4086 }
4087 }
4088}