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)]
96 pub struct ListPostures(RequestBuilder<crate::model::ListPosturesRequest>);
97
98 impl ListPostures {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::ListPosturesRequest>>(mut self, v: V) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(self) -> Result<crate::model::ListPosturesResponse> {
119 (*self.0.stub)
120 .list_postures(self.0.request, self.0.options)
121 .await
122 .map(gax::response::Response::into_body)
123 }
124
125 pub fn by_page(
127 self,
128 ) -> impl gax::paginator::Paginator<crate::model::ListPosturesResponse, gax::error::Error>
129 {
130 use std::clone::Clone;
131 let token = self.0.request.page_token.clone();
132 let execute = move |token: String| {
133 let mut builder = self.clone();
134 builder.0.request = builder.0.request.set_page_token(token);
135 builder.send()
136 };
137 gax::paginator::internal::new_paginator(token, execute)
138 }
139
140 pub fn by_item(
142 self,
143 ) -> impl gax::paginator::ItemPaginator<crate::model::ListPosturesResponse, gax::error::Error>
144 {
145 use gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 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 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 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 gax::options::internal::RequestBuilder for ListPostures {
172 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
173 &mut self.0.options
174 }
175 }
176
177 #[derive(Clone, Debug)]
199 pub struct ListPostureRevisions(RequestBuilder<crate::model::ListPostureRevisionsRequest>);
200
201 impl ListPostureRevisions {
202 pub(crate) fn new(
203 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
204 ) -> Self {
205 Self(RequestBuilder::new(stub))
206 }
207
208 pub fn with_request<V: Into<crate::model::ListPostureRevisionsRequest>>(
210 mut self,
211 v: V,
212 ) -> Self {
213 self.0.request = v.into();
214 self
215 }
216
217 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
219 self.0.options = v.into();
220 self
221 }
222
223 pub async fn send(self) -> Result<crate::model::ListPostureRevisionsResponse> {
225 (*self.0.stub)
226 .list_posture_revisions(self.0.request, self.0.options)
227 .await
228 .map(gax::response::Response::into_body)
229 }
230
231 pub fn by_page(
233 self,
234 ) -> impl gax::paginator::Paginator<crate::model::ListPostureRevisionsResponse, gax::error::Error>
235 {
236 use std::clone::Clone;
237 let token = self.0.request.page_token.clone();
238 let execute = move |token: String| {
239 let mut builder = self.clone();
240 builder.0.request = builder.0.request.set_page_token(token);
241 builder.send()
242 };
243 gax::paginator::internal::new_paginator(token, execute)
244 }
245
246 pub fn by_item(
248 self,
249 ) -> impl gax::paginator::ItemPaginator<
250 crate::model::ListPostureRevisionsResponse,
251 gax::error::Error,
252 > {
253 use gax::paginator::Paginator;
254 self.by_page().items()
255 }
256
257 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
261 self.0.request.name = v.into();
262 self
263 }
264
265 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
267 self.0.request.page_size = v.into();
268 self
269 }
270
271 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
273 self.0.request.page_token = v.into();
274 self
275 }
276 }
277
278 #[doc(hidden)]
279 impl gax::options::internal::RequestBuilder for ListPostureRevisions {
280 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
281 &mut self.0.options
282 }
283 }
284
285 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
320 self.0.options = v.into();
321 self
322 }
323
324 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(gax::response::Response::into_body)
330 }
331
332 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 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 gax::options::internal::RequestBuilder for GetPosture {
349 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
350 &mut self.0.options
351 }
352 }
353
354 #[derive(Clone, Debug)]
373 pub struct CreatePosture(RequestBuilder<crate::model::CreatePostureRequest>);
374
375 impl CreatePosture {
376 pub(crate) fn new(
377 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
378 ) -> Self {
379 Self(RequestBuilder::new(stub))
380 }
381
382 pub fn with_request<V: Into<crate::model::CreatePostureRequest>>(mut self, v: V) -> Self {
384 self.0.request = v.into();
385 self
386 }
387
388 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
390 self.0.options = v.into();
391 self
392 }
393
394 pub async fn send(self) -> Result<longrunning::model::Operation> {
401 (*self.0.stub)
402 .create_posture(self.0.request, self.0.options)
403 .await
404 .map(gax::response::Response::into_body)
405 }
406
407 pub fn poller(
409 self,
410 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
411 type Operation =
412 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
413 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
414 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
415
416 let stub = self.0.stub.clone();
417 let mut options = self.0.options.clone();
418 options.set_retry_policy(gax::retry_policy::NeverRetry);
419 let query = move |name| {
420 let stub = stub.clone();
421 let options = options.clone();
422 async {
423 let op = GetOperation::new(stub)
424 .set_name(name)
425 .with_options(options)
426 .send()
427 .await?;
428 Ok(Operation::new(op))
429 }
430 };
431
432 let start = move || async {
433 let op = self.send().await?;
434 Ok(Operation::new(op))
435 };
436
437 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
438 }
439
440 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
444 self.0.request.parent = v.into();
445 self
446 }
447
448 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
452 self.0.request.posture_id = v.into();
453 self
454 }
455
456 pub fn set_posture<T>(mut self, v: T) -> Self
460 where
461 T: std::convert::Into<crate::model::Posture>,
462 {
463 self.0.request.posture = std::option::Option::Some(v.into());
464 self
465 }
466
467 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
471 where
472 T: std::convert::Into<crate::model::Posture>,
473 {
474 self.0.request.posture = v.map(|x| x.into());
475 self
476 }
477 }
478
479 #[doc(hidden)]
480 impl gax::options::internal::RequestBuilder for CreatePosture {
481 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
482 &mut self.0.options
483 }
484 }
485
486 #[derive(Clone, Debug)]
505 pub struct UpdatePosture(RequestBuilder<crate::model::UpdatePostureRequest>);
506
507 impl UpdatePosture {
508 pub(crate) fn new(
509 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
510 ) -> Self {
511 Self(RequestBuilder::new(stub))
512 }
513
514 pub fn with_request<V: Into<crate::model::UpdatePostureRequest>>(mut self, v: V) -> Self {
516 self.0.request = v.into();
517 self
518 }
519
520 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
522 self.0.options = v.into();
523 self
524 }
525
526 pub async fn send(self) -> Result<longrunning::model::Operation> {
533 (*self.0.stub)
534 .update_posture(self.0.request, self.0.options)
535 .await
536 .map(gax::response::Response::into_body)
537 }
538
539 pub fn poller(
541 self,
542 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
543 type Operation =
544 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
545 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
546 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
547
548 let stub = self.0.stub.clone();
549 let mut options = self.0.options.clone();
550 options.set_retry_policy(gax::retry_policy::NeverRetry);
551 let query = move |name| {
552 let stub = stub.clone();
553 let options = options.clone();
554 async {
555 let op = GetOperation::new(stub)
556 .set_name(name)
557 .with_options(options)
558 .send()
559 .await?;
560 Ok(Operation::new(op))
561 }
562 };
563
564 let start = move || async {
565 let op = self.send().await?;
566 Ok(Operation::new(op))
567 };
568
569 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
570 }
571
572 pub fn set_update_mask<T>(mut self, v: T) -> Self
576 where
577 T: std::convert::Into<wkt::FieldMask>,
578 {
579 self.0.request.update_mask = std::option::Option::Some(v.into());
580 self
581 }
582
583 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
587 where
588 T: std::convert::Into<wkt::FieldMask>,
589 {
590 self.0.request.update_mask = v.map(|x| x.into());
591 self
592 }
593
594 pub fn set_posture<T>(mut self, v: T) -> Self
598 where
599 T: std::convert::Into<crate::model::Posture>,
600 {
601 self.0.request.posture = std::option::Option::Some(v.into());
602 self
603 }
604
605 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
609 where
610 T: std::convert::Into<crate::model::Posture>,
611 {
612 self.0.request.posture = v.map(|x| x.into());
613 self
614 }
615
616 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
620 self.0.request.revision_id = v.into();
621 self
622 }
623 }
624
625 #[doc(hidden)]
626 impl gax::options::internal::RequestBuilder for UpdatePosture {
627 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
628 &mut self.0.options
629 }
630 }
631
632 #[derive(Clone, Debug)]
651 pub struct DeletePosture(RequestBuilder<crate::model::DeletePostureRequest>);
652
653 impl DeletePosture {
654 pub(crate) fn new(
655 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
656 ) -> Self {
657 Self(RequestBuilder::new(stub))
658 }
659
660 pub fn with_request<V: Into<crate::model::DeletePostureRequest>>(mut self, v: V) -> Self {
662 self.0.request = v.into();
663 self
664 }
665
666 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
668 self.0.options = v.into();
669 self
670 }
671
672 pub async fn send(self) -> Result<longrunning::model::Operation> {
679 (*self.0.stub)
680 .delete_posture(self.0.request, self.0.options)
681 .await
682 .map(gax::response::Response::into_body)
683 }
684
685 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
687 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
688 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
689 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
690
691 let stub = self.0.stub.clone();
692 let mut options = self.0.options.clone();
693 options.set_retry_policy(gax::retry_policy::NeverRetry);
694 let query = move |name| {
695 let stub = stub.clone();
696 let options = options.clone();
697 async {
698 let op = GetOperation::new(stub)
699 .set_name(name)
700 .with_options(options)
701 .send()
702 .await?;
703 Ok(Operation::new(op))
704 }
705 };
706
707 let start = move || async {
708 let op = self.send().await?;
709 Ok(Operation::new(op))
710 };
711
712 lro::internal::new_unit_response_poller(
713 polling_error_policy,
714 polling_backoff_policy,
715 start,
716 query,
717 )
718 }
719
720 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
724 self.0.request.name = v.into();
725 self
726 }
727
728 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
730 self.0.request.etag = v.into();
731 self
732 }
733 }
734
735 #[doc(hidden)]
736 impl gax::options::internal::RequestBuilder for DeletePosture {
737 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
738 &mut self.0.options
739 }
740 }
741
742 #[derive(Clone, Debug)]
761 pub struct ExtractPosture(RequestBuilder<crate::model::ExtractPostureRequest>);
762
763 impl ExtractPosture {
764 pub(crate) fn new(
765 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
766 ) -> Self {
767 Self(RequestBuilder::new(stub))
768 }
769
770 pub fn with_request<V: Into<crate::model::ExtractPostureRequest>>(mut self, v: V) -> Self {
772 self.0.request = v.into();
773 self
774 }
775
776 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
778 self.0.options = v.into();
779 self
780 }
781
782 pub async fn send(self) -> Result<longrunning::model::Operation> {
789 (*self.0.stub)
790 .extract_posture(self.0.request, self.0.options)
791 .await
792 .map(gax::response::Response::into_body)
793 }
794
795 pub fn poller(
797 self,
798 ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
799 type Operation =
800 lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
801 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
802 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
803
804 let stub = self.0.stub.clone();
805 let mut options = self.0.options.clone();
806 options.set_retry_policy(gax::retry_policy::NeverRetry);
807 let query = move |name| {
808 let stub = stub.clone();
809 let options = options.clone();
810 async {
811 let op = GetOperation::new(stub)
812 .set_name(name)
813 .with_options(options)
814 .send()
815 .await?;
816 Ok(Operation::new(op))
817 }
818 };
819
820 let start = move || async {
821 let op = self.send().await?;
822 Ok(Operation::new(op))
823 };
824
825 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
826 }
827
828 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
832 self.0.request.parent = v.into();
833 self
834 }
835
836 pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
840 self.0.request.posture_id = v.into();
841 self
842 }
843
844 pub fn set_workload<T: Into<std::string::String>>(mut self, v: T) -> Self {
848 self.0.request.workload = v.into();
849 self
850 }
851 }
852
853 #[doc(hidden)]
854 impl gax::options::internal::RequestBuilder for ExtractPosture {
855 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
856 &mut self.0.options
857 }
858 }
859
860 #[derive(Clone, Debug)]
882 pub struct ListPostureDeployments(RequestBuilder<crate::model::ListPostureDeploymentsRequest>);
883
884 impl ListPostureDeployments {
885 pub(crate) fn new(
886 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
887 ) -> Self {
888 Self(RequestBuilder::new(stub))
889 }
890
891 pub fn with_request<V: Into<crate::model::ListPostureDeploymentsRequest>>(
893 mut self,
894 v: V,
895 ) -> Self {
896 self.0.request = v.into();
897 self
898 }
899
900 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
902 self.0.options = v.into();
903 self
904 }
905
906 pub async fn send(self) -> Result<crate::model::ListPostureDeploymentsResponse> {
908 (*self.0.stub)
909 .list_posture_deployments(self.0.request, self.0.options)
910 .await
911 .map(gax::response::Response::into_body)
912 }
913
914 pub fn by_page(
916 self,
917 ) -> impl gax::paginator::Paginator<
918 crate::model::ListPostureDeploymentsResponse,
919 gax::error::Error,
920 > {
921 use std::clone::Clone;
922 let token = self.0.request.page_token.clone();
923 let execute = move |token: String| {
924 let mut builder = self.clone();
925 builder.0.request = builder.0.request.set_page_token(token);
926 builder.send()
927 };
928 gax::paginator::internal::new_paginator(token, execute)
929 }
930
931 pub fn by_item(
933 self,
934 ) -> impl gax::paginator::ItemPaginator<
935 crate::model::ListPostureDeploymentsResponse,
936 gax::error::Error,
937 > {
938 use gax::paginator::Paginator;
939 self.by_page().items()
940 }
941
942 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
946 self.0.request.parent = v.into();
947 self
948 }
949
950 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
952 self.0.request.page_size = v.into();
953 self
954 }
955
956 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
958 self.0.request.page_token = v.into();
959 self
960 }
961
962 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
964 self.0.request.filter = v.into();
965 self
966 }
967 }
968
969 #[doc(hidden)]
970 impl gax::options::internal::RequestBuilder for ListPostureDeployments {
971 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
972 &mut self.0.options
973 }
974 }
975
976 #[derive(Clone, Debug)]
994 pub struct GetPostureDeployment(RequestBuilder<crate::model::GetPostureDeploymentRequest>);
995
996 impl GetPostureDeployment {
997 pub(crate) fn new(
998 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
999 ) -> Self {
1000 Self(RequestBuilder::new(stub))
1001 }
1002
1003 pub fn with_request<V: Into<crate::model::GetPostureDeploymentRequest>>(
1005 mut self,
1006 v: V,
1007 ) -> Self {
1008 self.0.request = v.into();
1009 self
1010 }
1011
1012 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1014 self.0.options = v.into();
1015 self
1016 }
1017
1018 pub async fn send(self) -> Result<crate::model::PostureDeployment> {
1020 (*self.0.stub)
1021 .get_posture_deployment(self.0.request, self.0.options)
1022 .await
1023 .map(gax::response::Response::into_body)
1024 }
1025
1026 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1030 self.0.request.name = v.into();
1031 self
1032 }
1033 }
1034
1035 #[doc(hidden)]
1036 impl gax::options::internal::RequestBuilder for GetPostureDeployment {
1037 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1038 &mut self.0.options
1039 }
1040 }
1041
1042 #[derive(Clone, Debug)]
1061 pub struct CreatePostureDeployment(
1062 RequestBuilder<crate::model::CreatePostureDeploymentRequest>,
1063 );
1064
1065 impl CreatePostureDeployment {
1066 pub(crate) fn new(
1067 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1068 ) -> Self {
1069 Self(RequestBuilder::new(stub))
1070 }
1071
1072 pub fn with_request<V: Into<crate::model::CreatePostureDeploymentRequest>>(
1074 mut self,
1075 v: V,
1076 ) -> Self {
1077 self.0.request = v.into();
1078 self
1079 }
1080
1081 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1083 self.0.options = v.into();
1084 self
1085 }
1086
1087 pub async fn send(self) -> Result<longrunning::model::Operation> {
1094 (*self.0.stub)
1095 .create_posture_deployment(self.0.request, self.0.options)
1096 .await
1097 .map(gax::response::Response::into_body)
1098 }
1099
1100 pub fn poller(
1102 self,
1103 ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1104 {
1105 type Operation = lro::internal::Operation<
1106 crate::model::PostureDeployment,
1107 crate::model::OperationMetadata,
1108 >;
1109 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1110 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1111
1112 let stub = self.0.stub.clone();
1113 let mut options = self.0.options.clone();
1114 options.set_retry_policy(gax::retry_policy::NeverRetry);
1115 let query = move |name| {
1116 let stub = stub.clone();
1117 let options = options.clone();
1118 async {
1119 let op = GetOperation::new(stub)
1120 .set_name(name)
1121 .with_options(options)
1122 .send()
1123 .await?;
1124 Ok(Operation::new(op))
1125 }
1126 };
1127
1128 let start = move || async {
1129 let op = self.send().await?;
1130 Ok(Operation::new(op))
1131 };
1132
1133 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1134 }
1135
1136 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1140 self.0.request.parent = v.into();
1141 self
1142 }
1143
1144 pub fn set_posture_deployment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1148 self.0.request.posture_deployment_id = v.into();
1149 self
1150 }
1151
1152 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1156 where
1157 T: std::convert::Into<crate::model::PostureDeployment>,
1158 {
1159 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1160 self
1161 }
1162
1163 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1167 where
1168 T: std::convert::Into<crate::model::PostureDeployment>,
1169 {
1170 self.0.request.posture_deployment = v.map(|x| x.into());
1171 self
1172 }
1173 }
1174
1175 #[doc(hidden)]
1176 impl gax::options::internal::RequestBuilder for CreatePostureDeployment {
1177 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1178 &mut self.0.options
1179 }
1180 }
1181
1182 #[derive(Clone, Debug)]
1201 pub struct UpdatePostureDeployment(
1202 RequestBuilder<crate::model::UpdatePostureDeploymentRequest>,
1203 );
1204
1205 impl UpdatePostureDeployment {
1206 pub(crate) fn new(
1207 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1208 ) -> Self {
1209 Self(RequestBuilder::new(stub))
1210 }
1211
1212 pub fn with_request<V: Into<crate::model::UpdatePostureDeploymentRequest>>(
1214 mut self,
1215 v: V,
1216 ) -> Self {
1217 self.0.request = v.into();
1218 self
1219 }
1220
1221 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1223 self.0.options = v.into();
1224 self
1225 }
1226
1227 pub async fn send(self) -> Result<longrunning::model::Operation> {
1234 (*self.0.stub)
1235 .update_posture_deployment(self.0.request, self.0.options)
1236 .await
1237 .map(gax::response::Response::into_body)
1238 }
1239
1240 pub fn poller(
1242 self,
1243 ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1244 {
1245 type Operation = lro::internal::Operation<
1246 crate::model::PostureDeployment,
1247 crate::model::OperationMetadata,
1248 >;
1249 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1250 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1251
1252 let stub = self.0.stub.clone();
1253 let mut options = self.0.options.clone();
1254 options.set_retry_policy(gax::retry_policy::NeverRetry);
1255 let query = move |name| {
1256 let stub = stub.clone();
1257 let options = options.clone();
1258 async {
1259 let op = GetOperation::new(stub)
1260 .set_name(name)
1261 .with_options(options)
1262 .send()
1263 .await?;
1264 Ok(Operation::new(op))
1265 }
1266 };
1267
1268 let start = move || async {
1269 let op = self.send().await?;
1270 Ok(Operation::new(op))
1271 };
1272
1273 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1274 }
1275
1276 pub fn set_update_mask<T>(mut self, v: T) -> Self
1280 where
1281 T: std::convert::Into<wkt::FieldMask>,
1282 {
1283 self.0.request.update_mask = std::option::Option::Some(v.into());
1284 self
1285 }
1286
1287 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1291 where
1292 T: std::convert::Into<wkt::FieldMask>,
1293 {
1294 self.0.request.update_mask = v.map(|x| x.into());
1295 self
1296 }
1297
1298 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1302 where
1303 T: std::convert::Into<crate::model::PostureDeployment>,
1304 {
1305 self.0.request.posture_deployment = std::option::Option::Some(v.into());
1306 self
1307 }
1308
1309 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1313 where
1314 T: std::convert::Into<crate::model::PostureDeployment>,
1315 {
1316 self.0.request.posture_deployment = v.map(|x| x.into());
1317 self
1318 }
1319 }
1320
1321 #[doc(hidden)]
1322 impl gax::options::internal::RequestBuilder for UpdatePostureDeployment {
1323 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1324 &mut self.0.options
1325 }
1326 }
1327
1328 #[derive(Clone, Debug)]
1347 pub struct DeletePostureDeployment(
1348 RequestBuilder<crate::model::DeletePostureDeploymentRequest>,
1349 );
1350
1351 impl DeletePostureDeployment {
1352 pub(crate) fn new(
1353 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1354 ) -> Self {
1355 Self(RequestBuilder::new(stub))
1356 }
1357
1358 pub fn with_request<V: Into<crate::model::DeletePostureDeploymentRequest>>(
1360 mut self,
1361 v: V,
1362 ) -> Self {
1363 self.0.request = v.into();
1364 self
1365 }
1366
1367 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1369 self.0.options = v.into();
1370 self
1371 }
1372
1373 pub async fn send(self) -> Result<longrunning::model::Operation> {
1380 (*self.0.stub)
1381 .delete_posture_deployment(self.0.request, self.0.options)
1382 .await
1383 .map(gax::response::Response::into_body)
1384 }
1385
1386 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1388 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1389 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1390 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1391
1392 let stub = self.0.stub.clone();
1393 let mut options = self.0.options.clone();
1394 options.set_retry_policy(gax::retry_policy::NeverRetry);
1395 let query = move |name| {
1396 let stub = stub.clone();
1397 let options = options.clone();
1398 async {
1399 let op = GetOperation::new(stub)
1400 .set_name(name)
1401 .with_options(options)
1402 .send()
1403 .await?;
1404 Ok(Operation::new(op))
1405 }
1406 };
1407
1408 let start = move || async {
1409 let op = self.send().await?;
1410 Ok(Operation::new(op))
1411 };
1412
1413 lro::internal::new_unit_response_poller(
1414 polling_error_policy,
1415 polling_backoff_policy,
1416 start,
1417 query,
1418 )
1419 }
1420
1421 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1425 self.0.request.name = v.into();
1426 self
1427 }
1428
1429 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1431 self.0.request.etag = v.into();
1432 self
1433 }
1434 }
1435
1436 #[doc(hidden)]
1437 impl gax::options::internal::RequestBuilder for DeletePostureDeployment {
1438 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1439 &mut self.0.options
1440 }
1441 }
1442
1443 #[derive(Clone, Debug)]
1465 pub struct ListPostureTemplates(RequestBuilder<crate::model::ListPostureTemplatesRequest>);
1466
1467 impl ListPostureTemplates {
1468 pub(crate) fn new(
1469 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1470 ) -> Self {
1471 Self(RequestBuilder::new(stub))
1472 }
1473
1474 pub fn with_request<V: Into<crate::model::ListPostureTemplatesRequest>>(
1476 mut self,
1477 v: V,
1478 ) -> Self {
1479 self.0.request = v.into();
1480 self
1481 }
1482
1483 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1485 self.0.options = v.into();
1486 self
1487 }
1488
1489 pub async fn send(self) -> Result<crate::model::ListPostureTemplatesResponse> {
1491 (*self.0.stub)
1492 .list_posture_templates(self.0.request, self.0.options)
1493 .await
1494 .map(gax::response::Response::into_body)
1495 }
1496
1497 pub fn by_page(
1499 self,
1500 ) -> impl gax::paginator::Paginator<crate::model::ListPostureTemplatesResponse, gax::error::Error>
1501 {
1502 use std::clone::Clone;
1503 let token = self.0.request.page_token.clone();
1504 let execute = move |token: String| {
1505 let mut builder = self.clone();
1506 builder.0.request = builder.0.request.set_page_token(token);
1507 builder.send()
1508 };
1509 gax::paginator::internal::new_paginator(token, execute)
1510 }
1511
1512 pub fn by_item(
1514 self,
1515 ) -> impl gax::paginator::ItemPaginator<
1516 crate::model::ListPostureTemplatesResponse,
1517 gax::error::Error,
1518 > {
1519 use gax::paginator::Paginator;
1520 self.by_page().items()
1521 }
1522
1523 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1527 self.0.request.parent = v.into();
1528 self
1529 }
1530
1531 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1533 self.0.request.page_size = v.into();
1534 self
1535 }
1536
1537 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1539 self.0.request.page_token = v.into();
1540 self
1541 }
1542
1543 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545 self.0.request.filter = v.into();
1546 self
1547 }
1548 }
1549
1550 #[doc(hidden)]
1551 impl gax::options::internal::RequestBuilder for ListPostureTemplates {
1552 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1553 &mut self.0.options
1554 }
1555 }
1556
1557 #[derive(Clone, Debug)]
1575 pub struct GetPostureTemplate(RequestBuilder<crate::model::GetPostureTemplateRequest>);
1576
1577 impl GetPostureTemplate {
1578 pub(crate) fn new(
1579 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1580 ) -> Self {
1581 Self(RequestBuilder::new(stub))
1582 }
1583
1584 pub fn with_request<V: Into<crate::model::GetPostureTemplateRequest>>(
1586 mut self,
1587 v: V,
1588 ) -> Self {
1589 self.0.request = v.into();
1590 self
1591 }
1592
1593 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1595 self.0.options = v.into();
1596 self
1597 }
1598
1599 pub async fn send(self) -> Result<crate::model::PostureTemplate> {
1601 (*self.0.stub)
1602 .get_posture_template(self.0.request, self.0.options)
1603 .await
1604 .map(gax::response::Response::into_body)
1605 }
1606
1607 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1611 self.0.request.name = v.into();
1612 self
1613 }
1614
1615 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1617 self.0.request.revision_id = v.into();
1618 self
1619 }
1620 }
1621
1622 #[doc(hidden)]
1623 impl gax::options::internal::RequestBuilder for GetPostureTemplate {
1624 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1625 &mut self.0.options
1626 }
1627 }
1628
1629 #[derive(Clone, Debug)]
1651 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1652
1653 impl ListLocations {
1654 pub(crate) fn new(
1655 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1656 ) -> Self {
1657 Self(RequestBuilder::new(stub))
1658 }
1659
1660 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1662 mut self,
1663 v: V,
1664 ) -> Self {
1665 self.0.request = v.into();
1666 self
1667 }
1668
1669 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1671 self.0.options = v.into();
1672 self
1673 }
1674
1675 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1677 (*self.0.stub)
1678 .list_locations(self.0.request, self.0.options)
1679 .await
1680 .map(gax::response::Response::into_body)
1681 }
1682
1683 pub fn by_page(
1685 self,
1686 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1687 {
1688 use std::clone::Clone;
1689 let token = self.0.request.page_token.clone();
1690 let execute = move |token: String| {
1691 let mut builder = self.clone();
1692 builder.0.request = builder.0.request.set_page_token(token);
1693 builder.send()
1694 };
1695 gax::paginator::internal::new_paginator(token, execute)
1696 }
1697
1698 pub fn by_item(
1700 self,
1701 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1702 {
1703 use gax::paginator::Paginator;
1704 self.by_page().items()
1705 }
1706
1707 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709 self.0.request.name = v.into();
1710 self
1711 }
1712
1713 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715 self.0.request.filter = v.into();
1716 self
1717 }
1718
1719 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1721 self.0.request.page_size = v.into();
1722 self
1723 }
1724
1725 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1727 self.0.request.page_token = v.into();
1728 self
1729 }
1730 }
1731
1732 #[doc(hidden)]
1733 impl gax::options::internal::RequestBuilder for ListLocations {
1734 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1735 &mut self.0.options
1736 }
1737 }
1738
1739 #[derive(Clone, Debug)]
1757 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1758
1759 impl GetLocation {
1760 pub(crate) fn new(
1761 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1762 ) -> Self {
1763 Self(RequestBuilder::new(stub))
1764 }
1765
1766 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1768 self.0.request = v.into();
1769 self
1770 }
1771
1772 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1774 self.0.options = v.into();
1775 self
1776 }
1777
1778 pub async fn send(self) -> Result<location::model::Location> {
1780 (*self.0.stub)
1781 .get_location(self.0.request, self.0.options)
1782 .await
1783 .map(gax::response::Response::into_body)
1784 }
1785
1786 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1788 self.0.request.name = v.into();
1789 self
1790 }
1791 }
1792
1793 #[doc(hidden)]
1794 impl gax::options::internal::RequestBuilder for GetLocation {
1795 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1796 &mut self.0.options
1797 }
1798 }
1799
1800 #[derive(Clone, Debug)]
1822 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1823
1824 impl ListOperations {
1825 pub(crate) fn new(
1826 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1827 ) -> Self {
1828 Self(RequestBuilder::new(stub))
1829 }
1830
1831 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1833 mut self,
1834 v: V,
1835 ) -> Self {
1836 self.0.request = v.into();
1837 self
1838 }
1839
1840 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1842 self.0.options = v.into();
1843 self
1844 }
1845
1846 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1848 (*self.0.stub)
1849 .list_operations(self.0.request, self.0.options)
1850 .await
1851 .map(gax::response::Response::into_body)
1852 }
1853
1854 pub fn by_page(
1856 self,
1857 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1858 {
1859 use std::clone::Clone;
1860 let token = self.0.request.page_token.clone();
1861 let execute = move |token: String| {
1862 let mut builder = self.clone();
1863 builder.0.request = builder.0.request.set_page_token(token);
1864 builder.send()
1865 };
1866 gax::paginator::internal::new_paginator(token, execute)
1867 }
1868
1869 pub fn by_item(
1871 self,
1872 ) -> impl gax::paginator::ItemPaginator<
1873 longrunning::model::ListOperationsResponse,
1874 gax::error::Error,
1875 > {
1876 use gax::paginator::Paginator;
1877 self.by_page().items()
1878 }
1879
1880 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1882 self.0.request.name = v.into();
1883 self
1884 }
1885
1886 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1888 self.0.request.filter = v.into();
1889 self
1890 }
1891
1892 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1894 self.0.request.page_size = v.into();
1895 self
1896 }
1897
1898 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1900 self.0.request.page_token = v.into();
1901 self
1902 }
1903
1904 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1906 self.0.request.return_partial_success = v.into();
1907 self
1908 }
1909 }
1910
1911 #[doc(hidden)]
1912 impl gax::options::internal::RequestBuilder for ListOperations {
1913 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1914 &mut self.0.options
1915 }
1916 }
1917
1918 #[derive(Clone, Debug)]
1936 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1937
1938 impl GetOperation {
1939 pub(crate) fn new(
1940 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1941 ) -> Self {
1942 Self(RequestBuilder::new(stub))
1943 }
1944
1945 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1947 mut self,
1948 v: V,
1949 ) -> Self {
1950 self.0.request = v.into();
1951 self
1952 }
1953
1954 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1956 self.0.options = v.into();
1957 self
1958 }
1959
1960 pub async fn send(self) -> Result<longrunning::model::Operation> {
1962 (*self.0.stub)
1963 .get_operation(self.0.request, self.0.options)
1964 .await
1965 .map(gax::response::Response::into_body)
1966 }
1967
1968 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1970 self.0.request.name = v.into();
1971 self
1972 }
1973 }
1974
1975 #[doc(hidden)]
1976 impl gax::options::internal::RequestBuilder for GetOperation {
1977 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1978 &mut self.0.options
1979 }
1980 }
1981
1982 #[derive(Clone, Debug)]
2000 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2001
2002 impl DeleteOperation {
2003 pub(crate) fn new(
2004 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2005 ) -> Self {
2006 Self(RequestBuilder::new(stub))
2007 }
2008
2009 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2011 mut self,
2012 v: V,
2013 ) -> Self {
2014 self.0.request = v.into();
2015 self
2016 }
2017
2018 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2020 self.0.options = v.into();
2021 self
2022 }
2023
2024 pub async fn send(self) -> Result<()> {
2026 (*self.0.stub)
2027 .delete_operation(self.0.request, self.0.options)
2028 .await
2029 .map(gax::response::Response::into_body)
2030 }
2031
2032 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2034 self.0.request.name = v.into();
2035 self
2036 }
2037 }
2038
2039 #[doc(hidden)]
2040 impl gax::options::internal::RequestBuilder for DeleteOperation {
2041 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2042 &mut self.0.options
2043 }
2044 }
2045
2046 #[derive(Clone, Debug)]
2064 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2065
2066 impl CancelOperation {
2067 pub(crate) fn new(
2068 stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2069 ) -> Self {
2070 Self(RequestBuilder::new(stub))
2071 }
2072
2073 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2075 mut self,
2076 v: V,
2077 ) -> Self {
2078 self.0.request = v.into();
2079 self
2080 }
2081
2082 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2084 self.0.options = v.into();
2085 self
2086 }
2087
2088 pub async fn send(self) -> Result<()> {
2090 (*self.0.stub)
2091 .cancel_operation(self.0.request, self.0.options)
2092 .await
2093 .map(gax::response::Response::into_body)
2094 }
2095
2096 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098 self.0.request.name = v.into();
2099 self
2100 }
2101 }
2102
2103 #[doc(hidden)]
2104 impl gax::options::internal::RequestBuilder for CancelOperation {
2105 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2106 &mut self.0.options
2107 }
2108 }
2109}