google_cloud_securityposture_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
17/// Request and client builders for [SecurityPosture][crate::client::SecurityPosture].
18pub mod security_posture {
19 use crate::Result;
20
21 /// A builder for [SecurityPosture][crate::client::SecurityPosture].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_securityposture_v1::*;
26 /// # use builder::security_posture::ClientBuilder;
27 /// # use client::SecurityPosture;
28 /// let builder : ClientBuilder = SecurityPosture::builder();
29 /// let client = builder
30 /// .with_endpoint("https://securityposture.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::SecurityPosture;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = SecurityPosture;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::SecurityPosture] 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::SecurityPosture>,
55 request: R,
56 options: crate::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::SecurityPosture>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [SecurityPosture::list_postures][crate::client::SecurityPosture::list_postures] calls.
75 ///
76 /// # Example
77 /// ```
78 /// # use google_cloud_securityposture_v1::builder::security_posture::ListPostures;
79 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
80 /// use google_cloud_gax::paginator::ItemPaginator;
81 ///
82 /// let builder = prepare_request_builder();
83 /// let mut items = builder.by_item();
84 /// while let Some(result) = items.next().await {
85 /// let item = result?;
86 /// }
87 /// # Ok(()) }
88 ///
89 /// fn prepare_request_builder() -> ListPostures {
90 /// # panic!();
91 /// // ... details omitted ...
92 /// }
93 /// ```
94 #[derive(Clone, Debug)]
95 pub struct ListPostures(RequestBuilder<crate::model::ListPosturesRequest>);
96
97 impl ListPostures {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 /// Sets the full request, replacing any prior values.
105 pub fn with_request<V: Into<crate::model::ListPosturesRequest>>(mut self, v: V) -> 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<crate::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::ListPosturesResponse> {
118 (*self.0.stub)
119 .list_postures(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 /// Streams each page in the collection.
125 pub fn by_page(
126 self,
127 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListPosturesResponse, crate::Error>
128 {
129 use std::clone::Clone;
130 let token = self.0.request.page_token.clone();
131 let execute = move |token: String| {
132 let mut builder = self.clone();
133 builder.0.request = builder.0.request.set_page_token(token);
134 builder.send()
135 };
136 google_cloud_gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 /// Streams each item in the collection.
140 pub fn by_item(
141 self,
142 ) -> impl google_cloud_gax::paginator::ItemPaginator<
143 crate::model::ListPosturesResponse,
144 crate::Error,
145 > {
146 use google_cloud_gax::paginator::Paginator;
147 self.by_page().items()
148 }
149
150 /// Sets the value of [parent][crate::model::ListPosturesRequest::parent].
151 ///
152 /// This is a **required** field for requests.
153 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
154 self.0.request.parent = v.into();
155 self
156 }
157
158 /// Sets the value of [page_size][crate::model::ListPosturesRequest::page_size].
159 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
160 self.0.request.page_size = v.into();
161 self
162 }
163
164 /// Sets the value of [page_token][crate::model::ListPosturesRequest::page_token].
165 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
166 self.0.request.page_token = v.into();
167 self
168 }
169 }
170
171 #[doc(hidden)]
172 impl crate::RequestBuilder for ListPostures {
173 fn request_options(&mut self) -> &mut crate::RequestOptions {
174 &mut self.0.options
175 }
176 }
177
178 /// The request builder for [SecurityPosture::list_posture_revisions][crate::client::SecurityPosture::list_posture_revisions] calls.
179 ///
180 /// # Example
181 /// ```
182 /// # use google_cloud_securityposture_v1::builder::security_posture::ListPostureRevisions;
183 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
184 /// use google_cloud_gax::paginator::ItemPaginator;
185 ///
186 /// let builder = prepare_request_builder();
187 /// let mut items = builder.by_item();
188 /// while let Some(result) = items.next().await {
189 /// let item = result?;
190 /// }
191 /// # Ok(()) }
192 ///
193 /// fn prepare_request_builder() -> ListPostureRevisions {
194 /// # panic!();
195 /// // ... details omitted ...
196 /// }
197 /// ```
198 #[derive(Clone, Debug)]
199 pub struct ListPostureRevisions(RequestBuilder<crate::model::ListPostureRevisionsRequest>);
200
201 impl ListPostureRevisions {
202 pub(crate) fn new(
203 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
204 ) -> Self {
205 Self(RequestBuilder::new(stub))
206 }
207
208 /// Sets the full request, replacing any prior values.
209 pub fn with_request<V: Into<crate::model::ListPostureRevisionsRequest>>(
210 mut self,
211 v: V,
212 ) -> Self {
213 self.0.request = v.into();
214 self
215 }
216
217 /// Sets all the options, replacing any prior values.
218 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
219 self.0.options = v.into();
220 self
221 }
222
223 /// Sends the request.
224 pub async fn send(self) -> Result<crate::model::ListPostureRevisionsResponse> {
225 (*self.0.stub)
226 .list_posture_revisions(self.0.request, self.0.options)
227 .await
228 .map(crate::Response::into_body)
229 }
230
231 /// Streams each page in the collection.
232 pub fn by_page(
233 self,
234 ) -> impl google_cloud_gax::paginator::Paginator<
235 crate::model::ListPostureRevisionsResponse,
236 crate::Error,
237 > {
238 use std::clone::Clone;
239 let token = self.0.request.page_token.clone();
240 let execute = move |token: String| {
241 let mut builder = self.clone();
242 builder.0.request = builder.0.request.set_page_token(token);
243 builder.send()
244 };
245 google_cloud_gax::paginator::internal::new_paginator(token, execute)
246 }
247
248 /// Streams each item in the collection.
249 pub fn by_item(
250 self,
251 ) -> impl google_cloud_gax::paginator::ItemPaginator<
252 crate::model::ListPostureRevisionsResponse,
253 crate::Error,
254 > {
255 use google_cloud_gax::paginator::Paginator;
256 self.by_page().items()
257 }
258
259 /// Sets the value of [name][crate::model::ListPostureRevisionsRequest::name].
260 ///
261 /// This is a **required** field for requests.
262 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
263 self.0.request.name = v.into();
264 self
265 }
266
267 /// Sets the value of [page_size][crate::model::ListPostureRevisionsRequest::page_size].
268 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
269 self.0.request.page_size = v.into();
270 self
271 }
272
273 /// Sets the value of [page_token][crate::model::ListPostureRevisionsRequest::page_token].
274 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
275 self.0.request.page_token = v.into();
276 self
277 }
278 }
279
280 #[doc(hidden)]
281 impl crate::RequestBuilder for ListPostureRevisions {
282 fn request_options(&mut self) -> &mut crate::RequestOptions {
283 &mut self.0.options
284 }
285 }
286
287 /// The request builder for [SecurityPosture::get_posture][crate::client::SecurityPosture::get_posture] calls.
288 ///
289 /// # Example
290 /// ```
291 /// # use google_cloud_securityposture_v1::builder::security_posture::GetPosture;
292 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
293 ///
294 /// let builder = prepare_request_builder();
295 /// let response = builder.send().await?;
296 /// # Ok(()) }
297 ///
298 /// fn prepare_request_builder() -> GetPosture {
299 /// # panic!();
300 /// // ... details omitted ...
301 /// }
302 /// ```
303 #[derive(Clone, Debug)]
304 pub struct GetPosture(RequestBuilder<crate::model::GetPostureRequest>);
305
306 impl GetPosture {
307 pub(crate) fn new(
308 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
309 ) -> Self {
310 Self(RequestBuilder::new(stub))
311 }
312
313 /// Sets the full request, replacing any prior values.
314 pub fn with_request<V: Into<crate::model::GetPostureRequest>>(mut self, v: V) -> Self {
315 self.0.request = v.into();
316 self
317 }
318
319 /// Sets all the options, replacing any prior values.
320 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
321 self.0.options = v.into();
322 self
323 }
324
325 /// Sends the request.
326 pub async fn send(self) -> Result<crate::model::Posture> {
327 (*self.0.stub)
328 .get_posture(self.0.request, self.0.options)
329 .await
330 .map(crate::Response::into_body)
331 }
332
333 /// Sets the value of [name][crate::model::GetPostureRequest::name].
334 ///
335 /// This is a **required** field for requests.
336 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
337 self.0.request.name = v.into();
338 self
339 }
340
341 /// Sets the value of [revision_id][crate::model::GetPostureRequest::revision_id].
342 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
343 self.0.request.revision_id = v.into();
344 self
345 }
346 }
347
348 #[doc(hidden)]
349 impl crate::RequestBuilder for GetPosture {
350 fn request_options(&mut self) -> &mut crate::RequestOptions {
351 &mut self.0.options
352 }
353 }
354
355 /// The request builder for [SecurityPosture::create_posture][crate::client::SecurityPosture::create_posture] calls.
356 ///
357 /// # Example
358 /// ```
359 /// # use google_cloud_securityposture_v1::builder::security_posture::CreatePosture;
360 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
361 /// use google_cloud_lro::Poller;
362 ///
363 /// let builder = prepare_request_builder();
364 /// let response = builder.poller().until_done().await?;
365 /// # Ok(()) }
366 ///
367 /// fn prepare_request_builder() -> CreatePosture {
368 /// # panic!();
369 /// // ... details omitted ...
370 /// }
371 /// ```
372 #[derive(Clone, Debug)]
373 pub struct CreatePosture(RequestBuilder<crate::model::CreatePostureRequest>);
374
375 impl CreatePosture {
376 pub(crate) fn new(
377 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
378 ) -> Self {
379 Self(RequestBuilder::new(stub))
380 }
381
382 /// Sets the full request, replacing any prior values.
383 pub fn with_request<V: Into<crate::model::CreatePostureRequest>>(mut self, v: V) -> Self {
384 self.0.request = v.into();
385 self
386 }
387
388 /// Sets all the options, replacing any prior values.
389 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
390 self.0.options = v.into();
391 self
392 }
393
394 /// Sends the request.
395 ///
396 /// # Long running operations
397 ///
398 /// This starts, but does not poll, a longrunning operation. More information
399 /// on [create_posture][crate::client::SecurityPosture::create_posture].
400 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
401 (*self.0.stub)
402 .create_posture(self.0.request, self.0.options)
403 .await
404 .map(crate::Response::into_body)
405 }
406
407 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_posture`.
408 pub fn poller(
409 self,
410 ) -> impl google_cloud_lro::Poller<crate::model::Posture, crate::model::OperationMetadata>
411 {
412 type Operation = google_cloud_lro::internal::Operation<
413 crate::model::Posture,
414 crate::model::OperationMetadata,
415 >;
416 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
417 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
418
419 let stub = self.0.stub.clone();
420 let mut options = self.0.options.clone();
421 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
422 let query = move |name| {
423 let stub = stub.clone();
424 let options = options.clone();
425 async {
426 let op = GetOperation::new(stub)
427 .set_name(name)
428 .with_options(options)
429 .send()
430 .await?;
431 Ok(Operation::new(op))
432 }
433 };
434
435 let start = move || async {
436 let op = self.send().await?;
437 Ok(Operation::new(op))
438 };
439
440 google_cloud_lro::internal::new_poller(
441 polling_error_policy,
442 polling_backoff_policy,
443 start,
444 query,
445 )
446 }
447
448 /// Sets the value of [parent][crate::model::CreatePostureRequest::parent].
449 ///
450 /// This is a **required** field for requests.
451 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
452 self.0.request.parent = v.into();
453 self
454 }
455
456 /// Sets the value of [posture_id][crate::model::CreatePostureRequest::posture_id].
457 ///
458 /// This is a **required** field for requests.
459 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
460 self.0.request.posture_id = v.into();
461 self
462 }
463
464 /// Sets the value of [posture][crate::model::CreatePostureRequest::posture].
465 ///
466 /// This is a **required** field for requests.
467 pub fn set_posture<T>(mut self, v: T) -> Self
468 where
469 T: std::convert::Into<crate::model::Posture>,
470 {
471 self.0.request.posture = std::option::Option::Some(v.into());
472 self
473 }
474
475 /// Sets or clears the value of [posture][crate::model::CreatePostureRequest::posture].
476 ///
477 /// This is a **required** field for requests.
478 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
479 where
480 T: std::convert::Into<crate::model::Posture>,
481 {
482 self.0.request.posture = v.map(|x| x.into());
483 self
484 }
485 }
486
487 #[doc(hidden)]
488 impl crate::RequestBuilder for CreatePosture {
489 fn request_options(&mut self) -> &mut crate::RequestOptions {
490 &mut self.0.options
491 }
492 }
493
494 /// The request builder for [SecurityPosture::update_posture][crate::client::SecurityPosture::update_posture] calls.
495 ///
496 /// # Example
497 /// ```
498 /// # use google_cloud_securityposture_v1::builder::security_posture::UpdatePosture;
499 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
500 /// use google_cloud_lro::Poller;
501 ///
502 /// let builder = prepare_request_builder();
503 /// let response = builder.poller().until_done().await?;
504 /// # Ok(()) }
505 ///
506 /// fn prepare_request_builder() -> UpdatePosture {
507 /// # panic!();
508 /// // ... details omitted ...
509 /// }
510 /// ```
511 #[derive(Clone, Debug)]
512 pub struct UpdatePosture(RequestBuilder<crate::model::UpdatePostureRequest>);
513
514 impl UpdatePosture {
515 pub(crate) fn new(
516 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
517 ) -> Self {
518 Self(RequestBuilder::new(stub))
519 }
520
521 /// Sets the full request, replacing any prior values.
522 pub fn with_request<V: Into<crate::model::UpdatePostureRequest>>(mut self, v: V) -> Self {
523 self.0.request = v.into();
524 self
525 }
526
527 /// Sets all the options, replacing any prior values.
528 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
529 self.0.options = v.into();
530 self
531 }
532
533 /// Sends the request.
534 ///
535 /// # Long running operations
536 ///
537 /// This starts, but does not poll, a longrunning operation. More information
538 /// on [update_posture][crate::client::SecurityPosture::update_posture].
539 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
540 (*self.0.stub)
541 .update_posture(self.0.request, self.0.options)
542 .await
543 .map(crate::Response::into_body)
544 }
545
546 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_posture`.
547 pub fn poller(
548 self,
549 ) -> impl google_cloud_lro::Poller<crate::model::Posture, crate::model::OperationMetadata>
550 {
551 type Operation = google_cloud_lro::internal::Operation<
552 crate::model::Posture,
553 crate::model::OperationMetadata,
554 >;
555 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
556 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
557
558 let stub = self.0.stub.clone();
559 let mut options = self.0.options.clone();
560 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
561 let query = move |name| {
562 let stub = stub.clone();
563 let options = options.clone();
564 async {
565 let op = GetOperation::new(stub)
566 .set_name(name)
567 .with_options(options)
568 .send()
569 .await?;
570 Ok(Operation::new(op))
571 }
572 };
573
574 let start = move || async {
575 let op = self.send().await?;
576 Ok(Operation::new(op))
577 };
578
579 google_cloud_lro::internal::new_poller(
580 polling_error_policy,
581 polling_backoff_policy,
582 start,
583 query,
584 )
585 }
586
587 /// Sets the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
588 ///
589 /// This is a **required** field for requests.
590 pub fn set_update_mask<T>(mut self, v: T) -> Self
591 where
592 T: std::convert::Into<wkt::FieldMask>,
593 {
594 self.0.request.update_mask = std::option::Option::Some(v.into());
595 self
596 }
597
598 /// Sets or clears the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
599 ///
600 /// This is a **required** field for requests.
601 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
602 where
603 T: std::convert::Into<wkt::FieldMask>,
604 {
605 self.0.request.update_mask = v.map(|x| x.into());
606 self
607 }
608
609 /// Sets the value of [posture][crate::model::UpdatePostureRequest::posture].
610 ///
611 /// This is a **required** field for requests.
612 pub fn set_posture<T>(mut self, v: T) -> Self
613 where
614 T: std::convert::Into<crate::model::Posture>,
615 {
616 self.0.request.posture = std::option::Option::Some(v.into());
617 self
618 }
619
620 /// Sets or clears the value of [posture][crate::model::UpdatePostureRequest::posture].
621 ///
622 /// This is a **required** field for requests.
623 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
624 where
625 T: std::convert::Into<crate::model::Posture>,
626 {
627 self.0.request.posture = v.map(|x| x.into());
628 self
629 }
630
631 /// Sets the value of [revision_id][crate::model::UpdatePostureRequest::revision_id].
632 ///
633 /// This is a **required** field for requests.
634 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
635 self.0.request.revision_id = v.into();
636 self
637 }
638 }
639
640 #[doc(hidden)]
641 impl crate::RequestBuilder for UpdatePosture {
642 fn request_options(&mut self) -> &mut crate::RequestOptions {
643 &mut self.0.options
644 }
645 }
646
647 /// The request builder for [SecurityPosture::delete_posture][crate::client::SecurityPosture::delete_posture] calls.
648 ///
649 /// # Example
650 /// ```
651 /// # use google_cloud_securityposture_v1::builder::security_posture::DeletePosture;
652 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
653 /// use google_cloud_lro::Poller;
654 ///
655 /// let builder = prepare_request_builder();
656 /// let response = builder.poller().until_done().await?;
657 /// # Ok(()) }
658 ///
659 /// fn prepare_request_builder() -> DeletePosture {
660 /// # panic!();
661 /// // ... details omitted ...
662 /// }
663 /// ```
664 #[derive(Clone, Debug)]
665 pub struct DeletePosture(RequestBuilder<crate::model::DeletePostureRequest>);
666
667 impl DeletePosture {
668 pub(crate) fn new(
669 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
670 ) -> Self {
671 Self(RequestBuilder::new(stub))
672 }
673
674 /// Sets the full request, replacing any prior values.
675 pub fn with_request<V: Into<crate::model::DeletePostureRequest>>(mut self, v: V) -> Self {
676 self.0.request = v.into();
677 self
678 }
679
680 /// Sets all the options, replacing any prior values.
681 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
682 self.0.options = v.into();
683 self
684 }
685
686 /// Sends the request.
687 ///
688 /// # Long running operations
689 ///
690 /// This starts, but does not poll, a longrunning operation. More information
691 /// on [delete_posture][crate::client::SecurityPosture::delete_posture].
692 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
693 (*self.0.stub)
694 .delete_posture(self.0.request, self.0.options)
695 .await
696 .map(crate::Response::into_body)
697 }
698
699 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_posture`.
700 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
701 type Operation =
702 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
703 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
704 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
705
706 let stub = self.0.stub.clone();
707 let mut options = self.0.options.clone();
708 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
709 let query = move |name| {
710 let stub = stub.clone();
711 let options = options.clone();
712 async {
713 let op = GetOperation::new(stub)
714 .set_name(name)
715 .with_options(options)
716 .send()
717 .await?;
718 Ok(Operation::new(op))
719 }
720 };
721
722 let start = move || async {
723 let op = self.send().await?;
724 Ok(Operation::new(op))
725 };
726
727 google_cloud_lro::internal::new_unit_response_poller(
728 polling_error_policy,
729 polling_backoff_policy,
730 start,
731 query,
732 )
733 }
734
735 /// Sets the value of [name][crate::model::DeletePostureRequest::name].
736 ///
737 /// This is a **required** field for requests.
738 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
739 self.0.request.name = v.into();
740 self
741 }
742
743 /// Sets the value of [etag][crate::model::DeletePostureRequest::etag].
744 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
745 self.0.request.etag = v.into();
746 self
747 }
748 }
749
750 #[doc(hidden)]
751 impl crate::RequestBuilder for DeletePosture {
752 fn request_options(&mut self) -> &mut crate::RequestOptions {
753 &mut self.0.options
754 }
755 }
756
757 /// The request builder for [SecurityPosture::extract_posture][crate::client::SecurityPosture::extract_posture] calls.
758 ///
759 /// # Example
760 /// ```
761 /// # use google_cloud_securityposture_v1::builder::security_posture::ExtractPosture;
762 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
763 /// use google_cloud_lro::Poller;
764 ///
765 /// let builder = prepare_request_builder();
766 /// let response = builder.poller().until_done().await?;
767 /// # Ok(()) }
768 ///
769 /// fn prepare_request_builder() -> ExtractPosture {
770 /// # panic!();
771 /// // ... details omitted ...
772 /// }
773 /// ```
774 #[derive(Clone, Debug)]
775 pub struct ExtractPosture(RequestBuilder<crate::model::ExtractPostureRequest>);
776
777 impl ExtractPosture {
778 pub(crate) fn new(
779 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
780 ) -> Self {
781 Self(RequestBuilder::new(stub))
782 }
783
784 /// Sets the full request, replacing any prior values.
785 pub fn with_request<V: Into<crate::model::ExtractPostureRequest>>(mut self, v: V) -> Self {
786 self.0.request = v.into();
787 self
788 }
789
790 /// Sets all the options, replacing any prior values.
791 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
792 self.0.options = v.into();
793 self
794 }
795
796 /// Sends the request.
797 ///
798 /// # Long running operations
799 ///
800 /// This starts, but does not poll, a longrunning operation. More information
801 /// on [extract_posture][crate::client::SecurityPosture::extract_posture].
802 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
803 (*self.0.stub)
804 .extract_posture(self.0.request, self.0.options)
805 .await
806 .map(crate::Response::into_body)
807 }
808
809 /// Creates a [Poller][google_cloud_lro::Poller] to work with `extract_posture`.
810 pub fn poller(
811 self,
812 ) -> impl google_cloud_lro::Poller<crate::model::Posture, crate::model::OperationMetadata>
813 {
814 type Operation = google_cloud_lro::internal::Operation<
815 crate::model::Posture,
816 crate::model::OperationMetadata,
817 >;
818 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
819 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
820
821 let stub = self.0.stub.clone();
822 let mut options = self.0.options.clone();
823 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
824 let query = move |name| {
825 let stub = stub.clone();
826 let options = options.clone();
827 async {
828 let op = GetOperation::new(stub)
829 .set_name(name)
830 .with_options(options)
831 .send()
832 .await?;
833 Ok(Operation::new(op))
834 }
835 };
836
837 let start = move || async {
838 let op = self.send().await?;
839 Ok(Operation::new(op))
840 };
841
842 google_cloud_lro::internal::new_poller(
843 polling_error_policy,
844 polling_backoff_policy,
845 start,
846 query,
847 )
848 }
849
850 /// Sets the value of [parent][crate::model::ExtractPostureRequest::parent].
851 ///
852 /// This is a **required** field for requests.
853 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
854 self.0.request.parent = v.into();
855 self
856 }
857
858 /// Sets the value of [posture_id][crate::model::ExtractPostureRequest::posture_id].
859 ///
860 /// This is a **required** field for requests.
861 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
862 self.0.request.posture_id = v.into();
863 self
864 }
865
866 /// Sets the value of [workload][crate::model::ExtractPostureRequest::workload].
867 ///
868 /// This is a **required** field for requests.
869 pub fn set_workload<T: Into<std::string::String>>(mut self, v: T) -> Self {
870 self.0.request.workload = v.into();
871 self
872 }
873 }
874
875 #[doc(hidden)]
876 impl crate::RequestBuilder for ExtractPosture {
877 fn request_options(&mut self) -> &mut crate::RequestOptions {
878 &mut self.0.options
879 }
880 }
881
882 /// The request builder for [SecurityPosture::list_posture_deployments][crate::client::SecurityPosture::list_posture_deployments] calls.
883 ///
884 /// # Example
885 /// ```
886 /// # use google_cloud_securityposture_v1::builder::security_posture::ListPostureDeployments;
887 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
888 /// use google_cloud_gax::paginator::ItemPaginator;
889 ///
890 /// let builder = prepare_request_builder();
891 /// let mut items = builder.by_item();
892 /// while let Some(result) = items.next().await {
893 /// let item = result?;
894 /// }
895 /// # Ok(()) }
896 ///
897 /// fn prepare_request_builder() -> ListPostureDeployments {
898 /// # panic!();
899 /// // ... details omitted ...
900 /// }
901 /// ```
902 #[derive(Clone, Debug)]
903 pub struct ListPostureDeployments(RequestBuilder<crate::model::ListPostureDeploymentsRequest>);
904
905 impl ListPostureDeployments {
906 pub(crate) fn new(
907 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
908 ) -> Self {
909 Self(RequestBuilder::new(stub))
910 }
911
912 /// Sets the full request, replacing any prior values.
913 pub fn with_request<V: Into<crate::model::ListPostureDeploymentsRequest>>(
914 mut self,
915 v: V,
916 ) -> Self {
917 self.0.request = v.into();
918 self
919 }
920
921 /// Sets all the options, replacing any prior values.
922 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
923 self.0.options = v.into();
924 self
925 }
926
927 /// Sends the request.
928 pub async fn send(self) -> Result<crate::model::ListPostureDeploymentsResponse> {
929 (*self.0.stub)
930 .list_posture_deployments(self.0.request, self.0.options)
931 .await
932 .map(crate::Response::into_body)
933 }
934
935 /// Streams each page in the collection.
936 pub fn by_page(
937 self,
938 ) -> impl google_cloud_gax::paginator::Paginator<
939 crate::model::ListPostureDeploymentsResponse,
940 crate::Error,
941 > {
942 use std::clone::Clone;
943 let token = self.0.request.page_token.clone();
944 let execute = move |token: String| {
945 let mut builder = self.clone();
946 builder.0.request = builder.0.request.set_page_token(token);
947 builder.send()
948 };
949 google_cloud_gax::paginator::internal::new_paginator(token, execute)
950 }
951
952 /// Streams each item in the collection.
953 pub fn by_item(
954 self,
955 ) -> impl google_cloud_gax::paginator::ItemPaginator<
956 crate::model::ListPostureDeploymentsResponse,
957 crate::Error,
958 > {
959 use google_cloud_gax::paginator::Paginator;
960 self.by_page().items()
961 }
962
963 /// Sets the value of [parent][crate::model::ListPostureDeploymentsRequest::parent].
964 ///
965 /// This is a **required** field for requests.
966 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
967 self.0.request.parent = v.into();
968 self
969 }
970
971 /// Sets the value of [page_size][crate::model::ListPostureDeploymentsRequest::page_size].
972 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
973 self.0.request.page_size = v.into();
974 self
975 }
976
977 /// Sets the value of [page_token][crate::model::ListPostureDeploymentsRequest::page_token].
978 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
979 self.0.request.page_token = v.into();
980 self
981 }
982
983 /// Sets the value of [filter][crate::model::ListPostureDeploymentsRequest::filter].
984 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
985 self.0.request.filter = v.into();
986 self
987 }
988 }
989
990 #[doc(hidden)]
991 impl crate::RequestBuilder for ListPostureDeployments {
992 fn request_options(&mut self) -> &mut crate::RequestOptions {
993 &mut self.0.options
994 }
995 }
996
997 /// The request builder for [SecurityPosture::get_posture_deployment][crate::client::SecurityPosture::get_posture_deployment] calls.
998 ///
999 /// # Example
1000 /// ```
1001 /// # use google_cloud_securityposture_v1::builder::security_posture::GetPostureDeployment;
1002 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1003 ///
1004 /// let builder = prepare_request_builder();
1005 /// let response = builder.send().await?;
1006 /// # Ok(()) }
1007 ///
1008 /// fn prepare_request_builder() -> GetPostureDeployment {
1009 /// # panic!();
1010 /// // ... details omitted ...
1011 /// }
1012 /// ```
1013 #[derive(Clone, Debug)]
1014 pub struct GetPostureDeployment(RequestBuilder<crate::model::GetPostureDeploymentRequest>);
1015
1016 impl GetPostureDeployment {
1017 pub(crate) fn new(
1018 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1019 ) -> Self {
1020 Self(RequestBuilder::new(stub))
1021 }
1022
1023 /// Sets the full request, replacing any prior values.
1024 pub fn with_request<V: Into<crate::model::GetPostureDeploymentRequest>>(
1025 mut self,
1026 v: V,
1027 ) -> Self {
1028 self.0.request = v.into();
1029 self
1030 }
1031
1032 /// Sets all the options, replacing any prior values.
1033 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1034 self.0.options = v.into();
1035 self
1036 }
1037
1038 /// Sends the request.
1039 pub async fn send(self) -> Result<crate::model::PostureDeployment> {
1040 (*self.0.stub)
1041 .get_posture_deployment(self.0.request, self.0.options)
1042 .await
1043 .map(crate::Response::into_body)
1044 }
1045
1046 /// Sets the value of [name][crate::model::GetPostureDeploymentRequest::name].
1047 ///
1048 /// This is a **required** field for requests.
1049 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1050 self.0.request.name = v.into();
1051 self
1052 }
1053 }
1054
1055 #[doc(hidden)]
1056 impl crate::RequestBuilder for GetPostureDeployment {
1057 fn request_options(&mut self) -> &mut crate::RequestOptions {
1058 &mut self.0.options
1059 }
1060 }
1061
1062 /// The request builder for [SecurityPosture::create_posture_deployment][crate::client::SecurityPosture::create_posture_deployment] calls.
1063 ///
1064 /// # Example
1065 /// ```
1066 /// # use google_cloud_securityposture_v1::builder::security_posture::CreatePostureDeployment;
1067 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1068 /// use google_cloud_lro::Poller;
1069 ///
1070 /// let builder = prepare_request_builder();
1071 /// let response = builder.poller().until_done().await?;
1072 /// # Ok(()) }
1073 ///
1074 /// fn prepare_request_builder() -> CreatePostureDeployment {
1075 /// # panic!();
1076 /// // ... details omitted ...
1077 /// }
1078 /// ```
1079 #[derive(Clone, Debug)]
1080 pub struct CreatePostureDeployment(
1081 RequestBuilder<crate::model::CreatePostureDeploymentRequest>,
1082 );
1083
1084 impl CreatePostureDeployment {
1085 pub(crate) fn new(
1086 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1087 ) -> Self {
1088 Self(RequestBuilder::new(stub))
1089 }
1090
1091 /// Sets the full request, replacing any prior values.
1092 pub fn with_request<V: Into<crate::model::CreatePostureDeploymentRequest>>(
1093 mut self,
1094 v: V,
1095 ) -> Self {
1096 self.0.request = v.into();
1097 self
1098 }
1099
1100 /// Sets all the options, replacing any prior values.
1101 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1102 self.0.options = v.into();
1103 self
1104 }
1105
1106 /// Sends the request.
1107 ///
1108 /// # Long running operations
1109 ///
1110 /// This starts, but does not poll, a longrunning operation. More information
1111 /// on [create_posture_deployment][crate::client::SecurityPosture::create_posture_deployment].
1112 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1113 (*self.0.stub)
1114 .create_posture_deployment(self.0.request, self.0.options)
1115 .await
1116 .map(crate::Response::into_body)
1117 }
1118
1119 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_posture_deployment`.
1120 pub fn poller(
1121 self,
1122 ) -> impl google_cloud_lro::Poller<
1123 crate::model::PostureDeployment,
1124 crate::model::OperationMetadata,
1125 > {
1126 type Operation = google_cloud_lro::internal::Operation<
1127 crate::model::PostureDeployment,
1128 crate::model::OperationMetadata,
1129 >;
1130 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1131 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1132
1133 let stub = self.0.stub.clone();
1134 let mut options = self.0.options.clone();
1135 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1136 let query = move |name| {
1137 let stub = stub.clone();
1138 let options = options.clone();
1139 async {
1140 let op = GetOperation::new(stub)
1141 .set_name(name)
1142 .with_options(options)
1143 .send()
1144 .await?;
1145 Ok(Operation::new(op))
1146 }
1147 };
1148
1149 let start = move || async {
1150 let op = self.send().await?;
1151 Ok(Operation::new(op))
1152 };
1153
1154 google_cloud_lro::internal::new_poller(
1155 polling_error_policy,
1156 polling_backoff_policy,
1157 start,
1158 query,
1159 )
1160 }
1161
1162 /// Sets the value of [parent][crate::model::CreatePostureDeploymentRequest::parent].
1163 ///
1164 /// This is a **required** field for requests.
1165 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1166 self.0.request.parent = v.into();
1167 self
1168 }
1169
1170 /// Sets the value of [posture_deployment_id][crate::model::CreatePostureDeploymentRequest::posture_deployment_id].
1171 ///
1172 /// This is a **required** field for requests.
1173 pub fn set_posture_deployment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1174 self.0.request.posture_deployment_id = v.into();
1175 self
1176 }
1177
1178 /// Sets the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
1179 ///
1180 /// This is a **required** field for requests.
1181 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1182 where
1183 T: std::convert::Into<crate::model::PostureDeployment>,
1184 {
1185 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1186 self
1187 }
1188
1189 /// Sets or clears the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
1190 ///
1191 /// This is a **required** field for requests.
1192 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1193 where
1194 T: std::convert::Into<crate::model::PostureDeployment>,
1195 {
1196 self.0.request.posture_deployment = v.map(|x| x.into());
1197 self
1198 }
1199 }
1200
1201 #[doc(hidden)]
1202 impl crate::RequestBuilder for CreatePostureDeployment {
1203 fn request_options(&mut self) -> &mut crate::RequestOptions {
1204 &mut self.0.options
1205 }
1206 }
1207
1208 /// The request builder for [SecurityPosture::update_posture_deployment][crate::client::SecurityPosture::update_posture_deployment] calls.
1209 ///
1210 /// # Example
1211 /// ```
1212 /// # use google_cloud_securityposture_v1::builder::security_posture::UpdatePostureDeployment;
1213 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1214 /// use google_cloud_lro::Poller;
1215 ///
1216 /// let builder = prepare_request_builder();
1217 /// let response = builder.poller().until_done().await?;
1218 /// # Ok(()) }
1219 ///
1220 /// fn prepare_request_builder() -> UpdatePostureDeployment {
1221 /// # panic!();
1222 /// // ... details omitted ...
1223 /// }
1224 /// ```
1225 #[derive(Clone, Debug)]
1226 pub struct UpdatePostureDeployment(
1227 RequestBuilder<crate::model::UpdatePostureDeploymentRequest>,
1228 );
1229
1230 impl UpdatePostureDeployment {
1231 pub(crate) fn new(
1232 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1233 ) -> Self {
1234 Self(RequestBuilder::new(stub))
1235 }
1236
1237 /// Sets the full request, replacing any prior values.
1238 pub fn with_request<V: Into<crate::model::UpdatePostureDeploymentRequest>>(
1239 mut self,
1240 v: V,
1241 ) -> Self {
1242 self.0.request = v.into();
1243 self
1244 }
1245
1246 /// Sets all the options, replacing any prior values.
1247 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1248 self.0.options = v.into();
1249 self
1250 }
1251
1252 /// Sends the request.
1253 ///
1254 /// # Long running operations
1255 ///
1256 /// This starts, but does not poll, a longrunning operation. More information
1257 /// on [update_posture_deployment][crate::client::SecurityPosture::update_posture_deployment].
1258 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1259 (*self.0.stub)
1260 .update_posture_deployment(self.0.request, self.0.options)
1261 .await
1262 .map(crate::Response::into_body)
1263 }
1264
1265 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_posture_deployment`.
1266 pub fn poller(
1267 self,
1268 ) -> impl google_cloud_lro::Poller<
1269 crate::model::PostureDeployment,
1270 crate::model::OperationMetadata,
1271 > {
1272 type Operation = google_cloud_lro::internal::Operation<
1273 crate::model::PostureDeployment,
1274 crate::model::OperationMetadata,
1275 >;
1276 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1277 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1278
1279 let stub = self.0.stub.clone();
1280 let mut options = self.0.options.clone();
1281 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1282 let query = move |name| {
1283 let stub = stub.clone();
1284 let options = options.clone();
1285 async {
1286 let op = GetOperation::new(stub)
1287 .set_name(name)
1288 .with_options(options)
1289 .send()
1290 .await?;
1291 Ok(Operation::new(op))
1292 }
1293 };
1294
1295 let start = move || async {
1296 let op = self.send().await?;
1297 Ok(Operation::new(op))
1298 };
1299
1300 google_cloud_lro::internal::new_poller(
1301 polling_error_policy,
1302 polling_backoff_policy,
1303 start,
1304 query,
1305 )
1306 }
1307
1308 /// Sets the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
1309 ///
1310 /// This is a **required** field for requests.
1311 pub fn set_update_mask<T>(mut self, v: T) -> Self
1312 where
1313 T: std::convert::Into<wkt::FieldMask>,
1314 {
1315 self.0.request.update_mask = std::option::Option::Some(v.into());
1316 self
1317 }
1318
1319 /// Sets or clears the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
1320 ///
1321 /// This is a **required** field for requests.
1322 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1323 where
1324 T: std::convert::Into<wkt::FieldMask>,
1325 {
1326 self.0.request.update_mask = v.map(|x| x.into());
1327 self
1328 }
1329
1330 /// Sets the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
1331 ///
1332 /// This is a **required** field for requests.
1333 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1334 where
1335 T: std::convert::Into<crate::model::PostureDeployment>,
1336 {
1337 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1338 self
1339 }
1340
1341 /// Sets or clears the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
1342 ///
1343 /// This is a **required** field for requests.
1344 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1345 where
1346 T: std::convert::Into<crate::model::PostureDeployment>,
1347 {
1348 self.0.request.posture_deployment = v.map(|x| x.into());
1349 self
1350 }
1351 }
1352
1353 #[doc(hidden)]
1354 impl crate::RequestBuilder for UpdatePostureDeployment {
1355 fn request_options(&mut self) -> &mut crate::RequestOptions {
1356 &mut self.0.options
1357 }
1358 }
1359
1360 /// The request builder for [SecurityPosture::delete_posture_deployment][crate::client::SecurityPosture::delete_posture_deployment] calls.
1361 ///
1362 /// # Example
1363 /// ```
1364 /// # use google_cloud_securityposture_v1::builder::security_posture::DeletePostureDeployment;
1365 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1366 /// use google_cloud_lro::Poller;
1367 ///
1368 /// let builder = prepare_request_builder();
1369 /// let response = builder.poller().until_done().await?;
1370 /// # Ok(()) }
1371 ///
1372 /// fn prepare_request_builder() -> DeletePostureDeployment {
1373 /// # panic!();
1374 /// // ... details omitted ...
1375 /// }
1376 /// ```
1377 #[derive(Clone, Debug)]
1378 pub struct DeletePostureDeployment(
1379 RequestBuilder<crate::model::DeletePostureDeploymentRequest>,
1380 );
1381
1382 impl DeletePostureDeployment {
1383 pub(crate) fn new(
1384 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1385 ) -> Self {
1386 Self(RequestBuilder::new(stub))
1387 }
1388
1389 /// Sets the full request, replacing any prior values.
1390 pub fn with_request<V: Into<crate::model::DeletePostureDeploymentRequest>>(
1391 mut self,
1392 v: V,
1393 ) -> Self {
1394 self.0.request = v.into();
1395 self
1396 }
1397
1398 /// Sets all the options, replacing any prior values.
1399 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1400 self.0.options = v.into();
1401 self
1402 }
1403
1404 /// Sends the request.
1405 ///
1406 /// # Long running operations
1407 ///
1408 /// This starts, but does not poll, a longrunning operation. More information
1409 /// on [delete_posture_deployment][crate::client::SecurityPosture::delete_posture_deployment].
1410 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1411 (*self.0.stub)
1412 .delete_posture_deployment(self.0.request, self.0.options)
1413 .await
1414 .map(crate::Response::into_body)
1415 }
1416
1417 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_posture_deployment`.
1418 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
1419 type Operation =
1420 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1421 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1422 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1423
1424 let stub = self.0.stub.clone();
1425 let mut options = self.0.options.clone();
1426 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1427 let query = move |name| {
1428 let stub = stub.clone();
1429 let options = options.clone();
1430 async {
1431 let op = GetOperation::new(stub)
1432 .set_name(name)
1433 .with_options(options)
1434 .send()
1435 .await?;
1436 Ok(Operation::new(op))
1437 }
1438 };
1439
1440 let start = move || async {
1441 let op = self.send().await?;
1442 Ok(Operation::new(op))
1443 };
1444
1445 google_cloud_lro::internal::new_unit_response_poller(
1446 polling_error_policy,
1447 polling_backoff_policy,
1448 start,
1449 query,
1450 )
1451 }
1452
1453 /// Sets the value of [name][crate::model::DeletePostureDeploymentRequest::name].
1454 ///
1455 /// This is a **required** field for requests.
1456 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1457 self.0.request.name = v.into();
1458 self
1459 }
1460
1461 /// Sets the value of [etag][crate::model::DeletePostureDeploymentRequest::etag].
1462 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1463 self.0.request.etag = v.into();
1464 self
1465 }
1466 }
1467
1468 #[doc(hidden)]
1469 impl crate::RequestBuilder for DeletePostureDeployment {
1470 fn request_options(&mut self) -> &mut crate::RequestOptions {
1471 &mut self.0.options
1472 }
1473 }
1474
1475 /// The request builder for [SecurityPosture::list_posture_templates][crate::client::SecurityPosture::list_posture_templates] calls.
1476 ///
1477 /// # Example
1478 /// ```
1479 /// # use google_cloud_securityposture_v1::builder::security_posture::ListPostureTemplates;
1480 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1481 /// use google_cloud_gax::paginator::ItemPaginator;
1482 ///
1483 /// let builder = prepare_request_builder();
1484 /// let mut items = builder.by_item();
1485 /// while let Some(result) = items.next().await {
1486 /// let item = result?;
1487 /// }
1488 /// # Ok(()) }
1489 ///
1490 /// fn prepare_request_builder() -> ListPostureTemplates {
1491 /// # panic!();
1492 /// // ... details omitted ...
1493 /// }
1494 /// ```
1495 #[derive(Clone, Debug)]
1496 pub struct ListPostureTemplates(RequestBuilder<crate::model::ListPostureTemplatesRequest>);
1497
1498 impl ListPostureTemplates {
1499 pub(crate) fn new(
1500 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1501 ) -> Self {
1502 Self(RequestBuilder::new(stub))
1503 }
1504
1505 /// Sets the full request, replacing any prior values.
1506 pub fn with_request<V: Into<crate::model::ListPostureTemplatesRequest>>(
1507 mut self,
1508 v: V,
1509 ) -> Self {
1510 self.0.request = v.into();
1511 self
1512 }
1513
1514 /// Sets all the options, replacing any prior values.
1515 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1516 self.0.options = v.into();
1517 self
1518 }
1519
1520 /// Sends the request.
1521 pub async fn send(self) -> Result<crate::model::ListPostureTemplatesResponse> {
1522 (*self.0.stub)
1523 .list_posture_templates(self.0.request, self.0.options)
1524 .await
1525 .map(crate::Response::into_body)
1526 }
1527
1528 /// Streams each page in the collection.
1529 pub fn by_page(
1530 self,
1531 ) -> impl google_cloud_gax::paginator::Paginator<
1532 crate::model::ListPostureTemplatesResponse,
1533 crate::Error,
1534 > {
1535 use std::clone::Clone;
1536 let token = self.0.request.page_token.clone();
1537 let execute = move |token: String| {
1538 let mut builder = self.clone();
1539 builder.0.request = builder.0.request.set_page_token(token);
1540 builder.send()
1541 };
1542 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1543 }
1544
1545 /// Streams each item in the collection.
1546 pub fn by_item(
1547 self,
1548 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1549 crate::model::ListPostureTemplatesResponse,
1550 crate::Error,
1551 > {
1552 use google_cloud_gax::paginator::Paginator;
1553 self.by_page().items()
1554 }
1555
1556 /// Sets the value of [parent][crate::model::ListPostureTemplatesRequest::parent].
1557 ///
1558 /// This is a **required** field for requests.
1559 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1560 self.0.request.parent = v.into();
1561 self
1562 }
1563
1564 /// Sets the value of [page_size][crate::model::ListPostureTemplatesRequest::page_size].
1565 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1566 self.0.request.page_size = v.into();
1567 self
1568 }
1569
1570 /// Sets the value of [page_token][crate::model::ListPostureTemplatesRequest::page_token].
1571 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1572 self.0.request.page_token = v.into();
1573 self
1574 }
1575
1576 /// Sets the value of [filter][crate::model::ListPostureTemplatesRequest::filter].
1577 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1578 self.0.request.filter = v.into();
1579 self
1580 }
1581 }
1582
1583 #[doc(hidden)]
1584 impl crate::RequestBuilder for ListPostureTemplates {
1585 fn request_options(&mut self) -> &mut crate::RequestOptions {
1586 &mut self.0.options
1587 }
1588 }
1589
1590 /// The request builder for [SecurityPosture::get_posture_template][crate::client::SecurityPosture::get_posture_template] calls.
1591 ///
1592 /// # Example
1593 /// ```
1594 /// # use google_cloud_securityposture_v1::builder::security_posture::GetPostureTemplate;
1595 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1596 ///
1597 /// let builder = prepare_request_builder();
1598 /// let response = builder.send().await?;
1599 /// # Ok(()) }
1600 ///
1601 /// fn prepare_request_builder() -> GetPostureTemplate {
1602 /// # panic!();
1603 /// // ... details omitted ...
1604 /// }
1605 /// ```
1606 #[derive(Clone, Debug)]
1607 pub struct GetPostureTemplate(RequestBuilder<crate::model::GetPostureTemplateRequest>);
1608
1609 impl GetPostureTemplate {
1610 pub(crate) fn new(
1611 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1612 ) -> Self {
1613 Self(RequestBuilder::new(stub))
1614 }
1615
1616 /// Sets the full request, replacing any prior values.
1617 pub fn with_request<V: Into<crate::model::GetPostureTemplateRequest>>(
1618 mut self,
1619 v: V,
1620 ) -> Self {
1621 self.0.request = v.into();
1622 self
1623 }
1624
1625 /// Sets all the options, replacing any prior values.
1626 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1627 self.0.options = v.into();
1628 self
1629 }
1630
1631 /// Sends the request.
1632 pub async fn send(self) -> Result<crate::model::PostureTemplate> {
1633 (*self.0.stub)
1634 .get_posture_template(self.0.request, self.0.options)
1635 .await
1636 .map(crate::Response::into_body)
1637 }
1638
1639 /// Sets the value of [name][crate::model::GetPostureTemplateRequest::name].
1640 ///
1641 /// This is a **required** field for requests.
1642 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1643 self.0.request.name = v.into();
1644 self
1645 }
1646
1647 /// Sets the value of [revision_id][crate::model::GetPostureTemplateRequest::revision_id].
1648 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1649 self.0.request.revision_id = v.into();
1650 self
1651 }
1652 }
1653
1654 #[doc(hidden)]
1655 impl crate::RequestBuilder for GetPostureTemplate {
1656 fn request_options(&mut self) -> &mut crate::RequestOptions {
1657 &mut self.0.options
1658 }
1659 }
1660
1661 /// The request builder for [SecurityPosture::list_locations][crate::client::SecurityPosture::list_locations] calls.
1662 ///
1663 /// # Example
1664 /// ```
1665 /// # use google_cloud_securityposture_v1::builder::security_posture::ListLocations;
1666 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1667 /// use google_cloud_gax::paginator::ItemPaginator;
1668 ///
1669 /// let builder = prepare_request_builder();
1670 /// let mut items = builder.by_item();
1671 /// while let Some(result) = items.next().await {
1672 /// let item = result?;
1673 /// }
1674 /// # Ok(()) }
1675 ///
1676 /// fn prepare_request_builder() -> ListLocations {
1677 /// # panic!();
1678 /// // ... details omitted ...
1679 /// }
1680 /// ```
1681 #[derive(Clone, Debug)]
1682 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1683
1684 impl ListLocations {
1685 pub(crate) fn new(
1686 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1687 ) -> Self {
1688 Self(RequestBuilder::new(stub))
1689 }
1690
1691 /// Sets the full request, replacing any prior values.
1692 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1693 mut self,
1694 v: V,
1695 ) -> Self {
1696 self.0.request = v.into();
1697 self
1698 }
1699
1700 /// Sets all the options, replacing any prior values.
1701 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1702 self.0.options = v.into();
1703 self
1704 }
1705
1706 /// Sends the request.
1707 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1708 (*self.0.stub)
1709 .list_locations(self.0.request, self.0.options)
1710 .await
1711 .map(crate::Response::into_body)
1712 }
1713
1714 /// Streams each page in the collection.
1715 pub fn by_page(
1716 self,
1717 ) -> impl google_cloud_gax::paginator::Paginator<
1718 google_cloud_location::model::ListLocationsResponse,
1719 crate::Error,
1720 > {
1721 use std::clone::Clone;
1722 let token = self.0.request.page_token.clone();
1723 let execute = move |token: String| {
1724 let mut builder = self.clone();
1725 builder.0.request = builder.0.request.set_page_token(token);
1726 builder.send()
1727 };
1728 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1729 }
1730
1731 /// Streams each item in the collection.
1732 pub fn by_item(
1733 self,
1734 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1735 google_cloud_location::model::ListLocationsResponse,
1736 crate::Error,
1737 > {
1738 use google_cloud_gax::paginator::Paginator;
1739 self.by_page().items()
1740 }
1741
1742 /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
1743 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1744 self.0.request.name = v.into();
1745 self
1746 }
1747
1748 /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
1749 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1750 self.0.request.filter = v.into();
1751 self
1752 }
1753
1754 /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
1755 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1756 self.0.request.page_size = v.into();
1757 self
1758 }
1759
1760 /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
1761 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1762 self.0.request.page_token = v.into();
1763 self
1764 }
1765 }
1766
1767 #[doc(hidden)]
1768 impl crate::RequestBuilder for ListLocations {
1769 fn request_options(&mut self) -> &mut crate::RequestOptions {
1770 &mut self.0.options
1771 }
1772 }
1773
1774 /// The request builder for [SecurityPosture::get_location][crate::client::SecurityPosture::get_location] calls.
1775 ///
1776 /// # Example
1777 /// ```
1778 /// # use google_cloud_securityposture_v1::builder::security_posture::GetLocation;
1779 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1780 ///
1781 /// let builder = prepare_request_builder();
1782 /// let response = builder.send().await?;
1783 /// # Ok(()) }
1784 ///
1785 /// fn prepare_request_builder() -> GetLocation {
1786 /// # panic!();
1787 /// // ... details omitted ...
1788 /// }
1789 /// ```
1790 #[derive(Clone, Debug)]
1791 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1792
1793 impl GetLocation {
1794 pub(crate) fn new(
1795 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1796 ) -> Self {
1797 Self(RequestBuilder::new(stub))
1798 }
1799
1800 /// Sets the full request, replacing any prior values.
1801 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1802 mut self,
1803 v: V,
1804 ) -> Self {
1805 self.0.request = v.into();
1806 self
1807 }
1808
1809 /// Sets all the options, replacing any prior values.
1810 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1811 self.0.options = v.into();
1812 self
1813 }
1814
1815 /// Sends the request.
1816 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1817 (*self.0.stub)
1818 .get_location(self.0.request, self.0.options)
1819 .await
1820 .map(crate::Response::into_body)
1821 }
1822
1823 /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
1824 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1825 self.0.request.name = v.into();
1826 self
1827 }
1828 }
1829
1830 #[doc(hidden)]
1831 impl crate::RequestBuilder for GetLocation {
1832 fn request_options(&mut self) -> &mut crate::RequestOptions {
1833 &mut self.0.options
1834 }
1835 }
1836
1837 /// The request builder for [SecurityPosture::list_operations][crate::client::SecurityPosture::list_operations] calls.
1838 ///
1839 /// # Example
1840 /// ```
1841 /// # use google_cloud_securityposture_v1::builder::security_posture::ListOperations;
1842 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1843 /// use google_cloud_gax::paginator::ItemPaginator;
1844 ///
1845 /// let builder = prepare_request_builder();
1846 /// let mut items = builder.by_item();
1847 /// while let Some(result) = items.next().await {
1848 /// let item = result?;
1849 /// }
1850 /// # Ok(()) }
1851 ///
1852 /// fn prepare_request_builder() -> ListOperations {
1853 /// # panic!();
1854 /// // ... details omitted ...
1855 /// }
1856 /// ```
1857 #[derive(Clone, Debug)]
1858 pub struct ListOperations(
1859 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1860 );
1861
1862 impl ListOperations {
1863 pub(crate) fn new(
1864 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1865 ) -> Self {
1866 Self(RequestBuilder::new(stub))
1867 }
1868
1869 /// Sets the full request, replacing any prior values.
1870 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1871 mut self,
1872 v: V,
1873 ) -> Self {
1874 self.0.request = v.into();
1875 self
1876 }
1877
1878 /// Sets all the options, replacing any prior values.
1879 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1880 self.0.options = v.into();
1881 self
1882 }
1883
1884 /// Sends the request.
1885 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1886 (*self.0.stub)
1887 .list_operations(self.0.request, self.0.options)
1888 .await
1889 .map(crate::Response::into_body)
1890 }
1891
1892 /// Streams each page in the collection.
1893 pub fn by_page(
1894 self,
1895 ) -> impl google_cloud_gax::paginator::Paginator<
1896 google_cloud_longrunning::model::ListOperationsResponse,
1897 crate::Error,
1898 > {
1899 use std::clone::Clone;
1900 let token = self.0.request.page_token.clone();
1901 let execute = move |token: String| {
1902 let mut builder = self.clone();
1903 builder.0.request = builder.0.request.set_page_token(token);
1904 builder.send()
1905 };
1906 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1907 }
1908
1909 /// Streams each item in the collection.
1910 pub fn by_item(
1911 self,
1912 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1913 google_cloud_longrunning::model::ListOperationsResponse,
1914 crate::Error,
1915 > {
1916 use google_cloud_gax::paginator::Paginator;
1917 self.by_page().items()
1918 }
1919
1920 /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
1921 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1922 self.0.request.name = v.into();
1923 self
1924 }
1925
1926 /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
1927 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1928 self.0.request.filter = v.into();
1929 self
1930 }
1931
1932 /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1933 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1934 self.0.request.page_size = v.into();
1935 self
1936 }
1937
1938 /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1939 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1940 self.0.request.page_token = v.into();
1941 self
1942 }
1943
1944 /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1945 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1946 self.0.request.return_partial_success = v.into();
1947 self
1948 }
1949 }
1950
1951 #[doc(hidden)]
1952 impl crate::RequestBuilder for ListOperations {
1953 fn request_options(&mut self) -> &mut crate::RequestOptions {
1954 &mut self.0.options
1955 }
1956 }
1957
1958 /// The request builder for [SecurityPosture::get_operation][crate::client::SecurityPosture::get_operation] calls.
1959 ///
1960 /// # Example
1961 /// ```
1962 /// # use google_cloud_securityposture_v1::builder::security_posture::GetOperation;
1963 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
1964 ///
1965 /// let builder = prepare_request_builder();
1966 /// let response = builder.send().await?;
1967 /// # Ok(()) }
1968 ///
1969 /// fn prepare_request_builder() -> GetOperation {
1970 /// # panic!();
1971 /// // ... details omitted ...
1972 /// }
1973 /// ```
1974 #[derive(Clone, Debug)]
1975 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1976
1977 impl GetOperation {
1978 pub(crate) fn new(
1979 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1980 ) -> Self {
1981 Self(RequestBuilder::new(stub))
1982 }
1983
1984 /// Sets the full request, replacing any prior values.
1985 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1986 mut self,
1987 v: V,
1988 ) -> Self {
1989 self.0.request = v.into();
1990 self
1991 }
1992
1993 /// Sets all the options, replacing any prior values.
1994 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1995 self.0.options = v.into();
1996 self
1997 }
1998
1999 /// Sends the request.
2000 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2001 (*self.0.stub)
2002 .get_operation(self.0.request, self.0.options)
2003 .await
2004 .map(crate::Response::into_body)
2005 }
2006
2007 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2008 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2009 self.0.request.name = v.into();
2010 self
2011 }
2012 }
2013
2014 #[doc(hidden)]
2015 impl crate::RequestBuilder for GetOperation {
2016 fn request_options(&mut self) -> &mut crate::RequestOptions {
2017 &mut self.0.options
2018 }
2019 }
2020
2021 /// The request builder for [SecurityPosture::delete_operation][crate::client::SecurityPosture::delete_operation] calls.
2022 ///
2023 /// # Example
2024 /// ```
2025 /// # use google_cloud_securityposture_v1::builder::security_posture::DeleteOperation;
2026 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
2027 ///
2028 /// let builder = prepare_request_builder();
2029 /// let response = builder.send().await?;
2030 /// # Ok(()) }
2031 ///
2032 /// fn prepare_request_builder() -> DeleteOperation {
2033 /// # panic!();
2034 /// // ... details omitted ...
2035 /// }
2036 /// ```
2037 #[derive(Clone, Debug)]
2038 pub struct DeleteOperation(
2039 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2040 );
2041
2042 impl DeleteOperation {
2043 pub(crate) fn new(
2044 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2045 ) -> Self {
2046 Self(RequestBuilder::new(stub))
2047 }
2048
2049 /// Sets the full request, replacing any prior values.
2050 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2051 mut self,
2052 v: V,
2053 ) -> Self {
2054 self.0.request = v.into();
2055 self
2056 }
2057
2058 /// Sets all the options, replacing any prior values.
2059 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2060 self.0.options = v.into();
2061 self
2062 }
2063
2064 /// Sends the request.
2065 pub async fn send(self) -> Result<()> {
2066 (*self.0.stub)
2067 .delete_operation(self.0.request, self.0.options)
2068 .await
2069 .map(crate::Response::into_body)
2070 }
2071
2072 /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
2073 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2074 self.0.request.name = v.into();
2075 self
2076 }
2077 }
2078
2079 #[doc(hidden)]
2080 impl crate::RequestBuilder for DeleteOperation {
2081 fn request_options(&mut self) -> &mut crate::RequestOptions {
2082 &mut self.0.options
2083 }
2084 }
2085
2086 /// The request builder for [SecurityPosture::cancel_operation][crate::client::SecurityPosture::cancel_operation] calls.
2087 ///
2088 /// # Example
2089 /// ```
2090 /// # use google_cloud_securityposture_v1::builder::security_posture::CancelOperation;
2091 /// # async fn sample() -> google_cloud_securityposture_v1::Result<()> {
2092 ///
2093 /// let builder = prepare_request_builder();
2094 /// let response = builder.send().await?;
2095 /// # Ok(()) }
2096 ///
2097 /// fn prepare_request_builder() -> CancelOperation {
2098 /// # panic!();
2099 /// // ... details omitted ...
2100 /// }
2101 /// ```
2102 #[derive(Clone, Debug)]
2103 pub struct CancelOperation(
2104 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2105 );
2106
2107 impl CancelOperation {
2108 pub(crate) fn new(
2109 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2110 ) -> Self {
2111 Self(RequestBuilder::new(stub))
2112 }
2113
2114 /// Sets the full request, replacing any prior values.
2115 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2116 mut self,
2117 v: V,
2118 ) -> Self {
2119 self.0.request = v.into();
2120 self
2121 }
2122
2123 /// Sets all the options, replacing any prior values.
2124 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2125 self.0.options = v.into();
2126 self
2127 }
2128
2129 /// Sends the request.
2130 pub async fn send(self) -> Result<()> {
2131 (*self.0.stub)
2132 .cancel_operation(self.0.request, self.0.options)
2133 .await
2134 .map(crate::Response::into_body)
2135 }
2136
2137 /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2139 self.0.request.name = v.into();
2140 self
2141 }
2142 }
2143
2144 #[doc(hidden)]
2145 impl crate::RequestBuilder for CancelOperation {
2146 fn request_options(&mut self) -> &mut crate::RequestOptions {
2147 &mut self.0.options
2148 }
2149 }
2150}