1pub mod security_posture {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::SecurityPosture;
38 pub struct Factory;
39 impl gax::client_builder::internal::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 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[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: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 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(gax::response::Response::into_body)
122 }
123
124 pub fn by_page(
126 self,
127 ) -> impl gax::paginator::Paginator<crate::model::ListPosturesResponse, gax::error::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 gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 pub fn by_item(
141 self,
142 ) -> impl gax::paginator::ItemPaginator<crate::model::ListPosturesResponse, gax::error::Error>
143 {
144 use gax::paginator::Paginator;
145 self.by_page().items()
146 }
147
148 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152 self.0.request.parent = v.into();
153 self
154 }
155
156 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
158 self.0.request.page_size = v.into();
159 self
160 }
161
162 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
164 self.0.request.page_token = v.into();
165 self
166 }
167 }
168
169 #[doc(hidden)]
170 impl gax::options::internal::RequestBuilder for ListPostures {
171 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
172 &mut self.0.options
173 }
174 }
175
176 #[derive(Clone, Debug)]
197 pub struct ListPostureRevisions(RequestBuilder<crate::model::ListPostureRevisionsRequest>);
198
199 impl ListPostureRevisions {
200 pub(crate) fn new(
201 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
202 ) -> Self {
203 Self(RequestBuilder::new(stub))
204 }
205
206 pub fn with_request<V: Into<crate::model::ListPostureRevisionsRequest>>(
208 mut self,
209 v: V,
210 ) -> Self {
211 self.0.request = v.into();
212 self
213 }
214
215 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
217 self.0.options = v.into();
218 self
219 }
220
221 pub async fn send(self) -> Result<crate::model::ListPostureRevisionsResponse> {
223 (*self.0.stub)
224 .list_posture_revisions(self.0.request, self.0.options)
225 .await
226 .map(gax::response::Response::into_body)
227 }
228
229 pub fn by_page(
231 self,
232 ) -> impl gax::paginator::Paginator<crate::model::ListPostureRevisionsResponse, gax::error::Error>
233 {
234 use std::clone::Clone;
235 let token = self.0.request.page_token.clone();
236 let execute = move |token: String| {
237 let mut builder = self.clone();
238 builder.0.request = builder.0.request.set_page_token(token);
239 builder.send()
240 };
241 gax::paginator::internal::new_paginator(token, execute)
242 }
243
244 pub fn by_item(
246 self,
247 ) -> impl gax::paginator::ItemPaginator<
248 crate::model::ListPostureRevisionsResponse,
249 gax::error::Error,
250 > {
251 use gax::paginator::Paginator;
252 self.by_page().items()
253 }
254
255 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
259 self.0.request.name = v.into();
260 self
261 }
262
263 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
265 self.0.request.page_size = v.into();
266 self
267 }
268
269 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
271 self.0.request.page_token = v.into();
272 self
273 }
274 }
275
276 #[doc(hidden)]
277 impl gax::options::internal::RequestBuilder for ListPostureRevisions {
278 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
279 &mut self.0.options
280 }
281 }
282
283 #[derive(Clone, Debug)]
300 pub struct GetPosture(RequestBuilder<crate::model::GetPostureRequest>);
301
302 impl GetPosture {
303 pub(crate) fn new(
304 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
305 ) -> Self {
306 Self(RequestBuilder::new(stub))
307 }
308
309 pub fn with_request<V: Into<crate::model::GetPostureRequest>>(mut self, v: V) -> Self {
311 self.0.request = v.into();
312 self
313 }
314
315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
317 self.0.options = v.into();
318 self
319 }
320
321 pub async fn send(self) -> Result<crate::model::Posture> {
323 (*self.0.stub)
324 .get_posture(self.0.request, self.0.options)
325 .await
326 .map(gax::response::Response::into_body)
327 }
328
329 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
333 self.0.request.name = v.into();
334 self
335 }
336
337 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
339 self.0.request.revision_id = v.into();
340 self
341 }
342 }
343
344 #[doc(hidden)]
345 impl gax::options::internal::RequestBuilder for GetPosture {
346 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
347 &mut self.0.options
348 }
349 }
350
351 #[derive(Clone, Debug)]
369 pub struct CreatePosture(RequestBuilder<crate::model::CreatePostureRequest>);
370
371 impl CreatePosture {
372 pub(crate) fn new(
373 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
374 ) -> Self {
375 Self(RequestBuilder::new(stub))
376 }
377
378 pub fn with_request<V: Into<crate::model::CreatePostureRequest>>(mut self, v: V) -> Self {
380 self.0.request = v.into();
381 self
382 }
383
384 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
386 self.0.options = v.into();
387 self
388 }
389
390 pub async fn send(self) -> Result<longrunning::model::Operation> {
397 (*self.0.stub)
398 .create_posture(self.0.request, self.0.options)
399 .await
400 .map(gax::response::Response::into_body)
401 }
402
403 pub fn poller(
405 self,
406 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
407 type Operation =
408 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
409 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
410 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
411
412 let stub = self.0.stub.clone();
413 let mut options = self.0.options.clone();
414 options.set_retry_policy(gax::retry_policy::NeverRetry);
415 let query = move |name| {
416 let stub = stub.clone();
417 let options = options.clone();
418 async {
419 let op = GetOperation::new(stub)
420 .set_name(name)
421 .with_options(options)
422 .send()
423 .await?;
424 Ok(Operation::new(op))
425 }
426 };
427
428 let start = move || async {
429 let op = self.send().await?;
430 Ok(Operation::new(op))
431 };
432
433 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
434 }
435
436 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
440 self.0.request.parent = v.into();
441 self
442 }
443
444 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
448 self.0.request.posture_id = v.into();
449 self
450 }
451
452 pub fn set_posture<T>(mut self, v: T) -> Self
456 where
457 T: std::convert::Into<crate::model::Posture>,
458 {
459 self.0.request.posture = std::option::Option::Some(v.into());
460 self
461 }
462
463 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
467 where
468 T: std::convert::Into<crate::model::Posture>,
469 {
470 self.0.request.posture = v.map(|x| x.into());
471 self
472 }
473 }
474
475 #[doc(hidden)]
476 impl gax::options::internal::RequestBuilder for CreatePosture {
477 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
478 &mut self.0.options
479 }
480 }
481
482 #[derive(Clone, Debug)]
500 pub struct UpdatePosture(RequestBuilder<crate::model::UpdatePostureRequest>);
501
502 impl UpdatePosture {
503 pub(crate) fn new(
504 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
505 ) -> Self {
506 Self(RequestBuilder::new(stub))
507 }
508
509 pub fn with_request<V: Into<crate::model::UpdatePostureRequest>>(mut self, v: V) -> Self {
511 self.0.request = v.into();
512 self
513 }
514
515 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
517 self.0.options = v.into();
518 self
519 }
520
521 pub async fn send(self) -> Result<longrunning::model::Operation> {
528 (*self.0.stub)
529 .update_posture(self.0.request, self.0.options)
530 .await
531 .map(gax::response::Response::into_body)
532 }
533
534 pub fn poller(
536 self,
537 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
538 type Operation =
539 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
540 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
541 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
542
543 let stub = self.0.stub.clone();
544 let mut options = self.0.options.clone();
545 options.set_retry_policy(gax::retry_policy::NeverRetry);
546 let query = move |name| {
547 let stub = stub.clone();
548 let options = options.clone();
549 async {
550 let op = GetOperation::new(stub)
551 .set_name(name)
552 .with_options(options)
553 .send()
554 .await?;
555 Ok(Operation::new(op))
556 }
557 };
558
559 let start = move || async {
560 let op = self.send().await?;
561 Ok(Operation::new(op))
562 };
563
564 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
565 }
566
567 pub fn set_update_mask<T>(mut self, v: T) -> Self
571 where
572 T: std::convert::Into<wkt::FieldMask>,
573 {
574 self.0.request.update_mask = std::option::Option::Some(v.into());
575 self
576 }
577
578 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
582 where
583 T: std::convert::Into<wkt::FieldMask>,
584 {
585 self.0.request.update_mask = v.map(|x| x.into());
586 self
587 }
588
589 pub fn set_posture<T>(mut self, v: T) -> Self
593 where
594 T: std::convert::Into<crate::model::Posture>,
595 {
596 self.0.request.posture = std::option::Option::Some(v.into());
597 self
598 }
599
600 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
604 where
605 T: std::convert::Into<crate::model::Posture>,
606 {
607 self.0.request.posture = v.map(|x| x.into());
608 self
609 }
610
611 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
615 self.0.request.revision_id = v.into();
616 self
617 }
618 }
619
620 #[doc(hidden)]
621 impl gax::options::internal::RequestBuilder for UpdatePosture {
622 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
623 &mut self.0.options
624 }
625 }
626
627 #[derive(Clone, Debug)]
645 pub struct DeletePosture(RequestBuilder<crate::model::DeletePostureRequest>);
646
647 impl DeletePosture {
648 pub(crate) fn new(
649 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
650 ) -> Self {
651 Self(RequestBuilder::new(stub))
652 }
653
654 pub fn with_request<V: Into<crate::model::DeletePostureRequest>>(mut self, v: V) -> Self {
656 self.0.request = v.into();
657 self
658 }
659
660 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
662 self.0.options = v.into();
663 self
664 }
665
666 pub async fn send(self) -> Result<longrunning::model::Operation> {
673 (*self.0.stub)
674 .delete_posture(self.0.request, self.0.options)
675 .await
676 .map(gax::response::Response::into_body)
677 }
678
679 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
681 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
682 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
683 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
684
685 let stub = self.0.stub.clone();
686 let mut options = self.0.options.clone();
687 options.set_retry_policy(gax::retry_policy::NeverRetry);
688 let query = move |name| {
689 let stub = stub.clone();
690 let options = options.clone();
691 async {
692 let op = GetOperation::new(stub)
693 .set_name(name)
694 .with_options(options)
695 .send()
696 .await?;
697 Ok(Operation::new(op))
698 }
699 };
700
701 let start = move || async {
702 let op = self.send().await?;
703 Ok(Operation::new(op))
704 };
705
706 lro::internal::new_unit_response_poller(
707 polling_error_policy,
708 polling_backoff_policy,
709 start,
710 query,
711 )
712 }
713
714 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
718 self.0.request.name = v.into();
719 self
720 }
721
722 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
724 self.0.request.etag = v.into();
725 self
726 }
727 }
728
729 #[doc(hidden)]
730 impl gax::options::internal::RequestBuilder for DeletePosture {
731 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
732 &mut self.0.options
733 }
734 }
735
736 #[derive(Clone, Debug)]
754 pub struct ExtractPosture(RequestBuilder<crate::model::ExtractPostureRequest>);
755
756 impl ExtractPosture {
757 pub(crate) fn new(
758 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
759 ) -> Self {
760 Self(RequestBuilder::new(stub))
761 }
762
763 pub fn with_request<V: Into<crate::model::ExtractPostureRequest>>(mut self, v: V) -> Self {
765 self.0.request = v.into();
766 self
767 }
768
769 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
771 self.0.options = v.into();
772 self
773 }
774
775 pub async fn send(self) -> Result<longrunning::model::Operation> {
782 (*self.0.stub)
783 .extract_posture(self.0.request, self.0.options)
784 .await
785 .map(gax::response::Response::into_body)
786 }
787
788 pub fn poller(
790 self,
791 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
792 type Operation =
793 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
794 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
795 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
796
797 let stub = self.0.stub.clone();
798 let mut options = self.0.options.clone();
799 options.set_retry_policy(gax::retry_policy::NeverRetry);
800 let query = move |name| {
801 let stub = stub.clone();
802 let options = options.clone();
803 async {
804 let op = GetOperation::new(stub)
805 .set_name(name)
806 .with_options(options)
807 .send()
808 .await?;
809 Ok(Operation::new(op))
810 }
811 };
812
813 let start = move || async {
814 let op = self.send().await?;
815 Ok(Operation::new(op))
816 };
817
818 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
819 }
820
821 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
825 self.0.request.parent = v.into();
826 self
827 }
828
829 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
833 self.0.request.posture_id = v.into();
834 self
835 }
836
837 pub fn set_workload<T: Into<std::string::String>>(mut self, v: T) -> Self {
841 self.0.request.workload = v.into();
842 self
843 }
844 }
845
846 #[doc(hidden)]
847 impl gax::options::internal::RequestBuilder for ExtractPosture {
848 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
849 &mut self.0.options
850 }
851 }
852
853 #[derive(Clone, Debug)]
874 pub struct ListPostureDeployments(RequestBuilder<crate::model::ListPostureDeploymentsRequest>);
875
876 impl ListPostureDeployments {
877 pub(crate) fn new(
878 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
879 ) -> Self {
880 Self(RequestBuilder::new(stub))
881 }
882
883 pub fn with_request<V: Into<crate::model::ListPostureDeploymentsRequest>>(
885 mut self,
886 v: V,
887 ) -> Self {
888 self.0.request = v.into();
889 self
890 }
891
892 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
894 self.0.options = v.into();
895 self
896 }
897
898 pub async fn send(self) -> Result<crate::model::ListPostureDeploymentsResponse> {
900 (*self.0.stub)
901 .list_posture_deployments(self.0.request, self.0.options)
902 .await
903 .map(gax::response::Response::into_body)
904 }
905
906 pub fn by_page(
908 self,
909 ) -> impl gax::paginator::Paginator<
910 crate::model::ListPostureDeploymentsResponse,
911 gax::error::Error,
912 > {
913 use std::clone::Clone;
914 let token = self.0.request.page_token.clone();
915 let execute = move |token: String| {
916 let mut builder = self.clone();
917 builder.0.request = builder.0.request.set_page_token(token);
918 builder.send()
919 };
920 gax::paginator::internal::new_paginator(token, execute)
921 }
922
923 pub fn by_item(
925 self,
926 ) -> impl gax::paginator::ItemPaginator<
927 crate::model::ListPostureDeploymentsResponse,
928 gax::error::Error,
929 > {
930 use gax::paginator::Paginator;
931 self.by_page().items()
932 }
933
934 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
938 self.0.request.parent = v.into();
939 self
940 }
941
942 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
944 self.0.request.page_size = v.into();
945 self
946 }
947
948 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
950 self.0.request.page_token = v.into();
951 self
952 }
953
954 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
956 self.0.request.filter = v.into();
957 self
958 }
959 }
960
961 #[doc(hidden)]
962 impl gax::options::internal::RequestBuilder for ListPostureDeployments {
963 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
964 &mut self.0.options
965 }
966 }
967
968 #[derive(Clone, Debug)]
985 pub struct GetPostureDeployment(RequestBuilder<crate::model::GetPostureDeploymentRequest>);
986
987 impl GetPostureDeployment {
988 pub(crate) fn new(
989 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
990 ) -> Self {
991 Self(RequestBuilder::new(stub))
992 }
993
994 pub fn with_request<V: Into<crate::model::GetPostureDeploymentRequest>>(
996 mut self,
997 v: V,
998 ) -> Self {
999 self.0.request = v.into();
1000 self
1001 }
1002
1003 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1005 self.0.options = v.into();
1006 self
1007 }
1008
1009 pub async fn send(self) -> Result<crate::model::PostureDeployment> {
1011 (*self.0.stub)
1012 .get_posture_deployment(self.0.request, self.0.options)
1013 .await
1014 .map(gax::response::Response::into_body)
1015 }
1016
1017 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1021 self.0.request.name = v.into();
1022 self
1023 }
1024 }
1025
1026 #[doc(hidden)]
1027 impl gax::options::internal::RequestBuilder for GetPostureDeployment {
1028 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1029 &mut self.0.options
1030 }
1031 }
1032
1033 #[derive(Clone, Debug)]
1051 pub struct CreatePostureDeployment(
1052 RequestBuilder<crate::model::CreatePostureDeploymentRequest>,
1053 );
1054
1055 impl CreatePostureDeployment {
1056 pub(crate) fn new(
1057 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1058 ) -> Self {
1059 Self(RequestBuilder::new(stub))
1060 }
1061
1062 pub fn with_request<V: Into<crate::model::CreatePostureDeploymentRequest>>(
1064 mut self,
1065 v: V,
1066 ) -> Self {
1067 self.0.request = v.into();
1068 self
1069 }
1070
1071 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1073 self.0.options = v.into();
1074 self
1075 }
1076
1077 pub async fn send(self) -> Result<longrunning::model::Operation> {
1084 (*self.0.stub)
1085 .create_posture_deployment(self.0.request, self.0.options)
1086 .await
1087 .map(gax::response::Response::into_body)
1088 }
1089
1090 pub fn poller(
1092 self,
1093 ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1094 {
1095 type Operation = lro::internal::Operation<
1096 crate::model::PostureDeployment,
1097 crate::model::OperationMetadata,
1098 >;
1099 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1100 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1101
1102 let stub = self.0.stub.clone();
1103 let mut options = self.0.options.clone();
1104 options.set_retry_policy(gax::retry_policy::NeverRetry);
1105 let query = move |name| {
1106 let stub = stub.clone();
1107 let options = options.clone();
1108 async {
1109 let op = GetOperation::new(stub)
1110 .set_name(name)
1111 .with_options(options)
1112 .send()
1113 .await?;
1114 Ok(Operation::new(op))
1115 }
1116 };
1117
1118 let start = move || async {
1119 let op = self.send().await?;
1120 Ok(Operation::new(op))
1121 };
1122
1123 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1124 }
1125
1126 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130 self.0.request.parent = v.into();
1131 self
1132 }
1133
1134 pub fn set_posture_deployment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1138 self.0.request.posture_deployment_id = v.into();
1139 self
1140 }
1141
1142 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1146 where
1147 T: std::convert::Into<crate::model::PostureDeployment>,
1148 {
1149 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1150 self
1151 }
1152
1153 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1157 where
1158 T: std::convert::Into<crate::model::PostureDeployment>,
1159 {
1160 self.0.request.posture_deployment = v.map(|x| x.into());
1161 self
1162 }
1163 }
1164
1165 #[doc(hidden)]
1166 impl gax::options::internal::RequestBuilder for CreatePostureDeployment {
1167 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1168 &mut self.0.options
1169 }
1170 }
1171
1172 #[derive(Clone, Debug)]
1190 pub struct UpdatePostureDeployment(
1191 RequestBuilder<crate::model::UpdatePostureDeploymentRequest>,
1192 );
1193
1194 impl UpdatePostureDeployment {
1195 pub(crate) fn new(
1196 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1197 ) -> Self {
1198 Self(RequestBuilder::new(stub))
1199 }
1200
1201 pub fn with_request<V: Into<crate::model::UpdatePostureDeploymentRequest>>(
1203 mut self,
1204 v: V,
1205 ) -> Self {
1206 self.0.request = v.into();
1207 self
1208 }
1209
1210 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1212 self.0.options = v.into();
1213 self
1214 }
1215
1216 pub async fn send(self) -> Result<longrunning::model::Operation> {
1223 (*self.0.stub)
1224 .update_posture_deployment(self.0.request, self.0.options)
1225 .await
1226 .map(gax::response::Response::into_body)
1227 }
1228
1229 pub fn poller(
1231 self,
1232 ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1233 {
1234 type Operation = lro::internal::Operation<
1235 crate::model::PostureDeployment,
1236 crate::model::OperationMetadata,
1237 >;
1238 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1239 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1240
1241 let stub = self.0.stub.clone();
1242 let mut options = self.0.options.clone();
1243 options.set_retry_policy(gax::retry_policy::NeverRetry);
1244 let query = move |name| {
1245 let stub = stub.clone();
1246 let options = options.clone();
1247 async {
1248 let op = GetOperation::new(stub)
1249 .set_name(name)
1250 .with_options(options)
1251 .send()
1252 .await?;
1253 Ok(Operation::new(op))
1254 }
1255 };
1256
1257 let start = move || async {
1258 let op = self.send().await?;
1259 Ok(Operation::new(op))
1260 };
1261
1262 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1263 }
1264
1265 pub fn set_update_mask<T>(mut self, v: T) -> Self
1269 where
1270 T: std::convert::Into<wkt::FieldMask>,
1271 {
1272 self.0.request.update_mask = std::option::Option::Some(v.into());
1273 self
1274 }
1275
1276 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1280 where
1281 T: std::convert::Into<wkt::FieldMask>,
1282 {
1283 self.0.request.update_mask = v.map(|x| x.into());
1284 self
1285 }
1286
1287 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1291 where
1292 T: std::convert::Into<crate::model::PostureDeployment>,
1293 {
1294 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1295 self
1296 }
1297
1298 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1302 where
1303 T: std::convert::Into<crate::model::PostureDeployment>,
1304 {
1305 self.0.request.posture_deployment = v.map(|x| x.into());
1306 self
1307 }
1308 }
1309
1310 #[doc(hidden)]
1311 impl gax::options::internal::RequestBuilder for UpdatePostureDeployment {
1312 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1313 &mut self.0.options
1314 }
1315 }
1316
1317 #[derive(Clone, Debug)]
1335 pub struct DeletePostureDeployment(
1336 RequestBuilder<crate::model::DeletePostureDeploymentRequest>,
1337 );
1338
1339 impl DeletePostureDeployment {
1340 pub(crate) fn new(
1341 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1342 ) -> Self {
1343 Self(RequestBuilder::new(stub))
1344 }
1345
1346 pub fn with_request<V: Into<crate::model::DeletePostureDeploymentRequest>>(
1348 mut self,
1349 v: V,
1350 ) -> Self {
1351 self.0.request = v.into();
1352 self
1353 }
1354
1355 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1357 self.0.options = v.into();
1358 self
1359 }
1360
1361 pub async fn send(self) -> Result<longrunning::model::Operation> {
1368 (*self.0.stub)
1369 .delete_posture_deployment(self.0.request, self.0.options)
1370 .await
1371 .map(gax::response::Response::into_body)
1372 }
1373
1374 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1376 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1377 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1378 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1379
1380 let stub = self.0.stub.clone();
1381 let mut options = self.0.options.clone();
1382 options.set_retry_policy(gax::retry_policy::NeverRetry);
1383 let query = move |name| {
1384 let stub = stub.clone();
1385 let options = options.clone();
1386 async {
1387 let op = GetOperation::new(stub)
1388 .set_name(name)
1389 .with_options(options)
1390 .send()
1391 .await?;
1392 Ok(Operation::new(op))
1393 }
1394 };
1395
1396 let start = move || async {
1397 let op = self.send().await?;
1398 Ok(Operation::new(op))
1399 };
1400
1401 lro::internal::new_unit_response_poller(
1402 polling_error_policy,
1403 polling_backoff_policy,
1404 start,
1405 query,
1406 )
1407 }
1408
1409 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413 self.0.request.name = v.into();
1414 self
1415 }
1416
1417 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.etag = v.into();
1420 self
1421 }
1422 }
1423
1424 #[doc(hidden)]
1425 impl gax::options::internal::RequestBuilder for DeletePostureDeployment {
1426 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1427 &mut self.0.options
1428 }
1429 }
1430
1431 #[derive(Clone, Debug)]
1452 pub struct ListPostureTemplates(RequestBuilder<crate::model::ListPostureTemplatesRequest>);
1453
1454 impl ListPostureTemplates {
1455 pub(crate) fn new(
1456 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1457 ) -> Self {
1458 Self(RequestBuilder::new(stub))
1459 }
1460
1461 pub fn with_request<V: Into<crate::model::ListPostureTemplatesRequest>>(
1463 mut self,
1464 v: V,
1465 ) -> Self {
1466 self.0.request = v.into();
1467 self
1468 }
1469
1470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1472 self.0.options = v.into();
1473 self
1474 }
1475
1476 pub async fn send(self) -> Result<crate::model::ListPostureTemplatesResponse> {
1478 (*self.0.stub)
1479 .list_posture_templates(self.0.request, self.0.options)
1480 .await
1481 .map(gax::response::Response::into_body)
1482 }
1483
1484 pub fn by_page(
1486 self,
1487 ) -> impl gax::paginator::Paginator<crate::model::ListPostureTemplatesResponse, gax::error::Error>
1488 {
1489 use std::clone::Clone;
1490 let token = self.0.request.page_token.clone();
1491 let execute = move |token: String| {
1492 let mut builder = self.clone();
1493 builder.0.request = builder.0.request.set_page_token(token);
1494 builder.send()
1495 };
1496 gax::paginator::internal::new_paginator(token, execute)
1497 }
1498
1499 pub fn by_item(
1501 self,
1502 ) -> impl gax::paginator::ItemPaginator<
1503 crate::model::ListPostureTemplatesResponse,
1504 gax::error::Error,
1505 > {
1506 use gax::paginator::Paginator;
1507 self.by_page().items()
1508 }
1509
1510 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1514 self.0.request.parent = v.into();
1515 self
1516 }
1517
1518 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1520 self.0.request.page_size = v.into();
1521 self
1522 }
1523
1524 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1526 self.0.request.page_token = v.into();
1527 self
1528 }
1529
1530 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1532 self.0.request.filter = v.into();
1533 self
1534 }
1535 }
1536
1537 #[doc(hidden)]
1538 impl gax::options::internal::RequestBuilder for ListPostureTemplates {
1539 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1540 &mut self.0.options
1541 }
1542 }
1543
1544 #[derive(Clone, Debug)]
1561 pub struct GetPostureTemplate(RequestBuilder<crate::model::GetPostureTemplateRequest>);
1562
1563 impl GetPostureTemplate {
1564 pub(crate) fn new(
1565 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1566 ) -> Self {
1567 Self(RequestBuilder::new(stub))
1568 }
1569
1570 pub fn with_request<V: Into<crate::model::GetPostureTemplateRequest>>(
1572 mut self,
1573 v: V,
1574 ) -> Self {
1575 self.0.request = v.into();
1576 self
1577 }
1578
1579 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1581 self.0.options = v.into();
1582 self
1583 }
1584
1585 pub async fn send(self) -> Result<crate::model::PostureTemplate> {
1587 (*self.0.stub)
1588 .get_posture_template(self.0.request, self.0.options)
1589 .await
1590 .map(gax::response::Response::into_body)
1591 }
1592
1593 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1597 self.0.request.name = v.into();
1598 self
1599 }
1600
1601 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1603 self.0.request.revision_id = v.into();
1604 self
1605 }
1606 }
1607
1608 #[doc(hidden)]
1609 impl gax::options::internal::RequestBuilder for GetPostureTemplate {
1610 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1611 &mut self.0.options
1612 }
1613 }
1614
1615 #[derive(Clone, Debug)]
1636 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1637
1638 impl ListLocations {
1639 pub(crate) fn new(
1640 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1641 ) -> Self {
1642 Self(RequestBuilder::new(stub))
1643 }
1644
1645 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1647 mut self,
1648 v: V,
1649 ) -> Self {
1650 self.0.request = v.into();
1651 self
1652 }
1653
1654 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1656 self.0.options = v.into();
1657 self
1658 }
1659
1660 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1662 (*self.0.stub)
1663 .list_locations(self.0.request, self.0.options)
1664 .await
1665 .map(gax::response::Response::into_body)
1666 }
1667
1668 pub fn by_page(
1670 self,
1671 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1672 {
1673 use std::clone::Clone;
1674 let token = self.0.request.page_token.clone();
1675 let execute = move |token: String| {
1676 let mut builder = self.clone();
1677 builder.0.request = builder.0.request.set_page_token(token);
1678 builder.send()
1679 };
1680 gax::paginator::internal::new_paginator(token, execute)
1681 }
1682
1683 pub fn by_item(
1685 self,
1686 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1687 {
1688 use gax::paginator::Paginator;
1689 self.by_page().items()
1690 }
1691
1692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1694 self.0.request.name = v.into();
1695 self
1696 }
1697
1698 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1700 self.0.request.filter = v.into();
1701 self
1702 }
1703
1704 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1706 self.0.request.page_size = v.into();
1707 self
1708 }
1709
1710 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1712 self.0.request.page_token = v.into();
1713 self
1714 }
1715 }
1716
1717 #[doc(hidden)]
1718 impl gax::options::internal::RequestBuilder for ListLocations {
1719 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1720 &mut self.0.options
1721 }
1722 }
1723
1724 #[derive(Clone, Debug)]
1741 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1742
1743 impl GetLocation {
1744 pub(crate) fn new(
1745 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1746 ) -> Self {
1747 Self(RequestBuilder::new(stub))
1748 }
1749
1750 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1752 self.0.request = v.into();
1753 self
1754 }
1755
1756 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1758 self.0.options = v.into();
1759 self
1760 }
1761
1762 pub async fn send(self) -> Result<location::model::Location> {
1764 (*self.0.stub)
1765 .get_location(self.0.request, self.0.options)
1766 .await
1767 .map(gax::response::Response::into_body)
1768 }
1769
1770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1772 self.0.request.name = v.into();
1773 self
1774 }
1775 }
1776
1777 #[doc(hidden)]
1778 impl gax::options::internal::RequestBuilder for GetLocation {
1779 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1780 &mut self.0.options
1781 }
1782 }
1783
1784 #[derive(Clone, Debug)]
1805 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1806
1807 impl ListOperations {
1808 pub(crate) fn new(
1809 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1810 ) -> Self {
1811 Self(RequestBuilder::new(stub))
1812 }
1813
1814 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1816 mut self,
1817 v: V,
1818 ) -> Self {
1819 self.0.request = v.into();
1820 self
1821 }
1822
1823 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1825 self.0.options = v.into();
1826 self
1827 }
1828
1829 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1831 (*self.0.stub)
1832 .list_operations(self.0.request, self.0.options)
1833 .await
1834 .map(gax::response::Response::into_body)
1835 }
1836
1837 pub fn by_page(
1839 self,
1840 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1841 {
1842 use std::clone::Clone;
1843 let token = self.0.request.page_token.clone();
1844 let execute = move |token: String| {
1845 let mut builder = self.clone();
1846 builder.0.request = builder.0.request.set_page_token(token);
1847 builder.send()
1848 };
1849 gax::paginator::internal::new_paginator(token, execute)
1850 }
1851
1852 pub fn by_item(
1854 self,
1855 ) -> impl gax::paginator::ItemPaginator<
1856 longrunning::model::ListOperationsResponse,
1857 gax::error::Error,
1858 > {
1859 use gax::paginator::Paginator;
1860 self.by_page().items()
1861 }
1862
1863 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1865 self.0.request.name = v.into();
1866 self
1867 }
1868
1869 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1871 self.0.request.filter = v.into();
1872 self
1873 }
1874
1875 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1877 self.0.request.page_size = v.into();
1878 self
1879 }
1880
1881 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1883 self.0.request.page_token = v.into();
1884 self
1885 }
1886
1887 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1889 self.0.request.return_partial_success = v.into();
1890 self
1891 }
1892 }
1893
1894 #[doc(hidden)]
1895 impl gax::options::internal::RequestBuilder for ListOperations {
1896 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1897 &mut self.0.options
1898 }
1899 }
1900
1901 #[derive(Clone, Debug)]
1918 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1919
1920 impl GetOperation {
1921 pub(crate) fn new(
1922 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1923 ) -> Self {
1924 Self(RequestBuilder::new(stub))
1925 }
1926
1927 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1929 mut self,
1930 v: V,
1931 ) -> Self {
1932 self.0.request = v.into();
1933 self
1934 }
1935
1936 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1938 self.0.options = v.into();
1939 self
1940 }
1941
1942 pub async fn send(self) -> Result<longrunning::model::Operation> {
1944 (*self.0.stub)
1945 .get_operation(self.0.request, self.0.options)
1946 .await
1947 .map(gax::response::Response::into_body)
1948 }
1949
1950 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1952 self.0.request.name = v.into();
1953 self
1954 }
1955 }
1956
1957 #[doc(hidden)]
1958 impl gax::options::internal::RequestBuilder for GetOperation {
1959 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1960 &mut self.0.options
1961 }
1962 }
1963
1964 #[derive(Clone, Debug)]
1981 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1982
1983 impl DeleteOperation {
1984 pub(crate) fn new(
1985 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1986 ) -> Self {
1987 Self(RequestBuilder::new(stub))
1988 }
1989
1990 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1992 mut self,
1993 v: V,
1994 ) -> Self {
1995 self.0.request = v.into();
1996 self
1997 }
1998
1999 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2001 self.0.options = v.into();
2002 self
2003 }
2004
2005 pub async fn send(self) -> Result<()> {
2007 (*self.0.stub)
2008 .delete_operation(self.0.request, self.0.options)
2009 .await
2010 .map(gax::response::Response::into_body)
2011 }
2012
2013 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2015 self.0.request.name = v.into();
2016 self
2017 }
2018 }
2019
2020 #[doc(hidden)]
2021 impl gax::options::internal::RequestBuilder for DeleteOperation {
2022 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2023 &mut self.0.options
2024 }
2025 }
2026
2027 #[derive(Clone, Debug)]
2044 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2045
2046 impl CancelOperation {
2047 pub(crate) fn new(
2048 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2049 ) -> Self {
2050 Self(RequestBuilder::new(stub))
2051 }
2052
2053 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2055 mut self,
2056 v: V,
2057 ) -> Self {
2058 self.0.request = v.into();
2059 self
2060 }
2061
2062 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2064 self.0.options = v.into();
2065 self
2066 }
2067
2068 pub async fn send(self) -> Result<()> {
2070 (*self.0.stub)
2071 .cancel_operation(self.0.request, self.0.options)
2072 .await
2073 .map(gax::response::Response::into_body)
2074 }
2075
2076 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2078 self.0.request.name = v.into();
2079 self
2080 }
2081 }
2082
2083 #[doc(hidden)]
2084 impl gax::options::internal::RequestBuilder for CancelOperation {
2085 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2086 &mut self.0.options
2087 }
2088 }
2089}