google_cloud_binaryauthorization_v1/
builders.rs1pub mod binauthz_management_service_v_1 {
18 use crate::Result;
19 use std::sync::Arc;
20
21 #[derive(Clone, Debug)]
23 pub struct RequestBuilder<R: std::default::Default> {
24 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
25 request: R,
26 options: gax::options::RequestOptions,
27 }
28
29 impl<R> RequestBuilder<R>
30 where
31 R: std::default::Default,
32 {
33 pub(crate) fn new(
34 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
35 ) -> Self {
36 Self {
37 stub,
38 request: R::default(),
39 options: gax::options::RequestOptions::default(),
40 }
41 }
42 }
43
44 #[derive(Clone, Debug)]
46 pub struct GetPolicy(RequestBuilder<crate::model::GetPolicyRequest>);
47
48 impl GetPolicy {
49 pub(crate) fn new(
50 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
51 ) -> Self {
52 Self(RequestBuilder::new(stub))
53 }
54
55 pub fn with_request<V: Into<crate::model::GetPolicyRequest>>(mut self, v: V) -> Self {
57 self.0.request = v.into();
58 self
59 }
60
61 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
63 self.0.options = v.into();
64 self
65 }
66
67 pub async fn send(self) -> Result<crate::model::Policy> {
69 (*self.0.stub)
70 .get_policy(self.0.request, self.0.options)
71 .await
72 }
73
74 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
76 self.0.request.name = v.into();
77 self
78 }
79 }
80
81 impl gax::options::RequestBuilder for GetPolicy {
82 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
83 &mut self.0.options
84 }
85 }
86
87 #[derive(Clone, Debug)]
89 pub struct UpdatePolicy(RequestBuilder<crate::model::UpdatePolicyRequest>);
90
91 impl UpdatePolicy {
92 pub(crate) fn new(
93 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
94 ) -> Self {
95 Self(RequestBuilder::new(stub))
96 }
97
98 pub fn with_request<V: Into<crate::model::UpdatePolicyRequest>>(mut self, v: V) -> Self {
100 self.0.request = v.into();
101 self
102 }
103
104 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
106 self.0.options = v.into();
107 self
108 }
109
110 pub async fn send(self) -> Result<crate::model::Policy> {
112 (*self.0.stub)
113 .update_policy(self.0.request, self.0.options)
114 .await
115 }
116
117 pub fn set_policy<T: Into<std::option::Option<crate::model::Policy>>>(
119 mut self,
120 v: T,
121 ) -> Self {
122 self.0.request.policy = v.into();
123 self
124 }
125 }
126
127 impl gax::options::RequestBuilder for UpdatePolicy {
128 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
129 &mut self.0.options
130 }
131 }
132
133 #[derive(Clone, Debug)]
135 pub struct CreateAttestor(RequestBuilder<crate::model::CreateAttestorRequest>);
136
137 impl CreateAttestor {
138 pub(crate) fn new(
139 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
140 ) -> Self {
141 Self(RequestBuilder::new(stub))
142 }
143
144 pub fn with_request<V: Into<crate::model::CreateAttestorRequest>>(mut self, v: V) -> Self {
146 self.0.request = v.into();
147 self
148 }
149
150 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
152 self.0.options = v.into();
153 self
154 }
155
156 pub async fn send(self) -> Result<crate::model::Attestor> {
158 (*self.0.stub)
159 .create_attestor(self.0.request, self.0.options)
160 .await
161 }
162
163 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.parent = v.into();
166 self
167 }
168
169 pub fn set_attestor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.attestor_id = v.into();
172 self
173 }
174
175 pub fn set_attestor<T: Into<std::option::Option<crate::model::Attestor>>>(
177 mut self,
178 v: T,
179 ) -> Self {
180 self.0.request.attestor = v.into();
181 self
182 }
183 }
184
185 impl gax::options::RequestBuilder for CreateAttestor {
186 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
187 &mut self.0.options
188 }
189 }
190
191 #[derive(Clone, Debug)]
193 pub struct GetAttestor(RequestBuilder<crate::model::GetAttestorRequest>);
194
195 impl GetAttestor {
196 pub(crate) fn new(
197 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
198 ) -> Self {
199 Self(RequestBuilder::new(stub))
200 }
201
202 pub fn with_request<V: Into<crate::model::GetAttestorRequest>>(mut self, v: V) -> Self {
204 self.0.request = v.into();
205 self
206 }
207
208 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
210 self.0.options = v.into();
211 self
212 }
213
214 pub async fn send(self) -> Result<crate::model::Attestor> {
216 (*self.0.stub)
217 .get_attestor(self.0.request, self.0.options)
218 .await
219 }
220
221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
223 self.0.request.name = v.into();
224 self
225 }
226 }
227
228 impl gax::options::RequestBuilder for GetAttestor {
229 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
230 &mut self.0.options
231 }
232 }
233
234 #[derive(Clone, Debug)]
236 pub struct UpdateAttestor(RequestBuilder<crate::model::UpdateAttestorRequest>);
237
238 impl UpdateAttestor {
239 pub(crate) fn new(
240 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
241 ) -> Self {
242 Self(RequestBuilder::new(stub))
243 }
244
245 pub fn with_request<V: Into<crate::model::UpdateAttestorRequest>>(mut self, v: V) -> Self {
247 self.0.request = v.into();
248 self
249 }
250
251 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
253 self.0.options = v.into();
254 self
255 }
256
257 pub async fn send(self) -> Result<crate::model::Attestor> {
259 (*self.0.stub)
260 .update_attestor(self.0.request, self.0.options)
261 .await
262 }
263
264 pub fn set_attestor<T: Into<std::option::Option<crate::model::Attestor>>>(
266 mut self,
267 v: T,
268 ) -> Self {
269 self.0.request.attestor = v.into();
270 self
271 }
272 }
273
274 impl gax::options::RequestBuilder for UpdateAttestor {
275 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
276 &mut self.0.options
277 }
278 }
279
280 #[derive(Clone, Debug)]
282 pub struct ListAttestors(RequestBuilder<crate::model::ListAttestorsRequest>);
283
284 impl ListAttestors {
285 pub(crate) fn new(
286 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
287 ) -> Self {
288 Self(RequestBuilder::new(stub))
289 }
290
291 pub fn with_request<V: Into<crate::model::ListAttestorsRequest>>(mut self, v: V) -> Self {
293 self.0.request = v.into();
294 self
295 }
296
297 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
299 self.0.options = v.into();
300 self
301 }
302
303 pub async fn send(self) -> Result<crate::model::ListAttestorsResponse> {
305 (*self.0.stub)
306 .list_attestors(self.0.request, self.0.options)
307 .await
308 }
309
310 #[cfg(feature = "unstable-stream")]
312 pub async fn stream(
313 self,
314 ) -> gax::paginator::Paginator<crate::model::ListAttestorsResponse, gax::error::Error>
315 {
316 let token = gax::paginator::extract_token(&self.0.request.page_token);
317 let execute = move |token: String| {
318 let mut builder = self.clone();
319 builder.0.request = builder.0.request.set_page_token(token);
320 builder.send()
321 };
322 gax::paginator::Paginator::new(token, execute)
323 }
324
325 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
327 self.0.request.parent = v.into();
328 self
329 }
330
331 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
333 self.0.request.page_size = v.into();
334 self
335 }
336
337 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
339 self.0.request.page_token = v.into();
340 self
341 }
342 }
343
344 impl gax::options::RequestBuilder for ListAttestors {
345 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
346 &mut self.0.options
347 }
348 }
349
350 #[derive(Clone, Debug)]
352 pub struct DeleteAttestor(RequestBuilder<crate::model::DeleteAttestorRequest>);
353
354 impl DeleteAttestor {
355 pub(crate) fn new(
356 stub: Arc<dyn crate::stubs::dynamic::BinauthzManagementServiceV1>,
357 ) -> Self {
358 Self(RequestBuilder::new(stub))
359 }
360
361 pub fn with_request<V: Into<crate::model::DeleteAttestorRequest>>(mut self, v: V) -> Self {
363 self.0.request = v.into();
364 self
365 }
366
367 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
369 self.0.options = v.into();
370 self
371 }
372
373 pub async fn send(self) -> Result<wkt::Empty> {
375 (*self.0.stub)
376 .delete_attestor(self.0.request, self.0.options)
377 .await
378 }
379
380 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
382 self.0.request.name = v.into();
383 self
384 }
385 }
386
387 impl gax::options::RequestBuilder for DeleteAttestor {
388 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
389 &mut self.0.options
390 }
391 }
392}
393
394pub mod system_policy_v_1 {
395 use crate::Result;
396 use std::sync::Arc;
397
398 #[derive(Clone, Debug)]
400 pub struct RequestBuilder<R: std::default::Default> {
401 stub: Arc<dyn crate::stubs::dynamic::SystemPolicyV1>,
402 request: R,
403 options: gax::options::RequestOptions,
404 }
405
406 impl<R> RequestBuilder<R>
407 where
408 R: std::default::Default,
409 {
410 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::SystemPolicyV1>) -> Self {
411 Self {
412 stub,
413 request: R::default(),
414 options: gax::options::RequestOptions::default(),
415 }
416 }
417 }
418
419 #[derive(Clone, Debug)]
421 pub struct GetSystemPolicy(RequestBuilder<crate::model::GetSystemPolicyRequest>);
422
423 impl GetSystemPolicy {
424 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::SystemPolicyV1>) -> Self {
425 Self(RequestBuilder::new(stub))
426 }
427
428 pub fn with_request<V: Into<crate::model::GetSystemPolicyRequest>>(mut self, v: V) -> Self {
430 self.0.request = v.into();
431 self
432 }
433
434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
436 self.0.options = v.into();
437 self
438 }
439
440 pub async fn send(self) -> Result<crate::model::Policy> {
442 (*self.0.stub)
443 .get_system_policy(self.0.request, self.0.options)
444 .await
445 }
446
447 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
449 self.0.request.name = v.into();
450 self
451 }
452 }
453
454 impl gax::options::RequestBuilder for GetSystemPolicy {
455 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
456 &mut self.0.options
457 }
458 }
459}
460
461pub mod validation_helper_v_1 {
462 use crate::Result;
463 use std::sync::Arc;
464
465 #[derive(Clone, Debug)]
467 pub struct RequestBuilder<R: std::default::Default> {
468 stub: Arc<dyn crate::stubs::dynamic::ValidationHelperV1>,
469 request: R,
470 options: gax::options::RequestOptions,
471 }
472
473 impl<R> RequestBuilder<R>
474 where
475 R: std::default::Default,
476 {
477 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ValidationHelperV1>) -> Self {
478 Self {
479 stub,
480 request: R::default(),
481 options: gax::options::RequestOptions::default(),
482 }
483 }
484 }
485
486 #[derive(Clone, Debug)]
488 pub struct ValidateAttestationOccurrence(
489 RequestBuilder<crate::model::ValidateAttestationOccurrenceRequest>,
490 );
491
492 impl ValidateAttestationOccurrence {
493 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ValidationHelperV1>) -> Self {
494 Self(RequestBuilder::new(stub))
495 }
496
497 pub fn with_request<V: Into<crate::model::ValidateAttestationOccurrenceRequest>>(
499 mut self,
500 v: V,
501 ) -> Self {
502 self.0.request = v.into();
503 self
504 }
505
506 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
508 self.0.options = v.into();
509 self
510 }
511
512 pub async fn send(self) -> Result<crate::model::ValidateAttestationOccurrenceResponse> {
514 (*self.0.stub)
515 .validate_attestation_occurrence(self.0.request, self.0.options)
516 .await
517 }
518
519 pub fn set_attestor<T: Into<std::string::String>>(mut self, v: T) -> Self {
521 self.0.request.attestor = v.into();
522 self
523 }
524
525 pub fn set_attestation<
527 T: Into<std::option::Option<grafeas::model::AttestationOccurrence>>,
528 >(
529 mut self,
530 v: T,
531 ) -> Self {
532 self.0.request.attestation = v.into();
533 self
534 }
535
536 pub fn set_occurrence_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
538 self.0.request.occurrence_note = v.into();
539 self
540 }
541
542 pub fn set_occurrence_resource_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
544 self.0.request.occurrence_resource_uri = v.into();
545 self
546 }
547 }
548
549 impl gax::options::RequestBuilder for ValidateAttestationOccurrence {
550 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
551 &mut self.0.options
552 }
553 }
554}