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