Skip to main content

google_cloud_modelarmor_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17/// Request and client builders for [ModelArmor][crate::client::ModelArmor].
18pub mod model_armor {
19    use crate::Result;
20
21    /// A builder for [ModelArmor][crate::client::ModelArmor].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_modelarmor_v1::*;
26    /// # use builder::model_armor::ClientBuilder;
27    /// # use client::ModelArmor;
28    /// let builder : ClientBuilder = ModelArmor::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://modelarmor.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::ModelArmor;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = ModelArmor;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::ModelArmor] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
55        request: R,
56        options: crate::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [ModelArmor::list_templates][crate::client::ModelArmor::list_templates] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_modelarmor_v1::builder::model_armor::ListTemplates;
79    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
80    /// use google_cloud_gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListTemplates {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListTemplates(RequestBuilder<crate::model::ListTemplatesRequest>);
96
97    impl ListTemplates {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
100        ) -> Self {
101            Self(RequestBuilder::new(stub))
102        }
103
104        /// Sets the full request, replacing any prior values.
105        pub fn with_request<V: Into<crate::model::ListTemplatesRequest>>(mut self, v: V) -> Self {
106            self.0.request = v.into();
107            self
108        }
109
110        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        pub async fn send(self) -> Result<crate::model::ListTemplatesResponse> {
118            (*self.0.stub)
119                .list_templates(self.0.request, self.0.options)
120                .await
121                .map(crate::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTemplatesResponse, crate::Error>
128        {
129            use std::clone::Clone;
130            let token = self.0.request.page_token.clone();
131            let execute = move |token: String| {
132                let mut builder = self.clone();
133                builder.0.request = builder.0.request.set_page_token(token);
134                builder.send()
135            };
136            google_cloud_gax::paginator::internal::new_paginator(token, execute)
137        }
138
139        /// Streams each item in the collection.
140        pub fn by_item(
141            self,
142        ) -> impl google_cloud_gax::paginator::ItemPaginator<
143            crate::model::ListTemplatesResponse,
144            crate::Error,
145        > {
146            use google_cloud_gax::paginator::Paginator;
147            self.by_page().items()
148        }
149
150        /// Sets the value of [parent][crate::model::ListTemplatesRequest::parent].
151        ///
152        /// This is a **required** field for requests.
153        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
154            self.0.request.parent = v.into();
155            self
156        }
157
158        /// Sets the value of [page_size][crate::model::ListTemplatesRequest::page_size].
159        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
160            self.0.request.page_size = v.into();
161            self
162        }
163
164        /// Sets the value of [page_token][crate::model::ListTemplatesRequest::page_token].
165        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
166            self.0.request.page_token = v.into();
167            self
168        }
169
170        /// Sets the value of [filter][crate::model::ListTemplatesRequest::filter].
171        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
172            self.0.request.filter = v.into();
173            self
174        }
175
176        /// Sets the value of [order_by][crate::model::ListTemplatesRequest::order_by].
177        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
178            self.0.request.order_by = v.into();
179            self
180        }
181    }
182
183    #[doc(hidden)]
184    impl crate::RequestBuilder for ListTemplates {
185        fn request_options(&mut self) -> &mut crate::RequestOptions {
186            &mut self.0.options
187        }
188    }
189
190    /// The request builder for [ModelArmor::get_template][crate::client::ModelArmor::get_template] calls.
191    ///
192    /// # Example
193    /// ```
194    /// # use google_cloud_modelarmor_v1::builder::model_armor::GetTemplate;
195    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
196    ///
197    /// let builder = prepare_request_builder();
198    /// let response = builder.send().await?;
199    /// # Ok(()) }
200    ///
201    /// fn prepare_request_builder() -> GetTemplate {
202    ///   # panic!();
203    ///   // ... details omitted ...
204    /// }
205    /// ```
206    #[derive(Clone, Debug)]
207    pub struct GetTemplate(RequestBuilder<crate::model::GetTemplateRequest>);
208
209    impl GetTemplate {
210        pub(crate) fn new(
211            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
212        ) -> Self {
213            Self(RequestBuilder::new(stub))
214        }
215
216        /// Sets the full request, replacing any prior values.
217        pub fn with_request<V: Into<crate::model::GetTemplateRequest>>(mut self, v: V) -> Self {
218            self.0.request = v.into();
219            self
220        }
221
222        /// Sets all the options, replacing any prior values.
223        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
224            self.0.options = v.into();
225            self
226        }
227
228        /// Sends the request.
229        pub async fn send(self) -> Result<crate::model::Template> {
230            (*self.0.stub)
231                .get_template(self.0.request, self.0.options)
232                .await
233                .map(crate::Response::into_body)
234        }
235
236        /// Sets the value of [name][crate::model::GetTemplateRequest::name].
237        ///
238        /// This is a **required** field for requests.
239        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240            self.0.request.name = v.into();
241            self
242        }
243    }
244
245    #[doc(hidden)]
246    impl crate::RequestBuilder for GetTemplate {
247        fn request_options(&mut self) -> &mut crate::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for [ModelArmor::create_template][crate::client::ModelArmor::create_template] calls.
253    ///
254    /// # Example
255    /// ```
256    /// # use google_cloud_modelarmor_v1::builder::model_armor::CreateTemplate;
257    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
258    ///
259    /// let builder = prepare_request_builder();
260    /// let response = builder.send().await?;
261    /// # Ok(()) }
262    ///
263    /// fn prepare_request_builder() -> CreateTemplate {
264    ///   # panic!();
265    ///   // ... details omitted ...
266    /// }
267    /// ```
268    #[derive(Clone, Debug)]
269    pub struct CreateTemplate(RequestBuilder<crate::model::CreateTemplateRequest>);
270
271    impl CreateTemplate {
272        pub(crate) fn new(
273            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
274        ) -> Self {
275            Self(RequestBuilder::new(stub))
276        }
277
278        /// Sets the full request, replacing any prior values.
279        pub fn with_request<V: Into<crate::model::CreateTemplateRequest>>(mut self, v: V) -> Self {
280            self.0.request = v.into();
281            self
282        }
283
284        /// Sets all the options, replacing any prior values.
285        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286            self.0.options = v.into();
287            self
288        }
289
290        /// Sends the request.
291        pub async fn send(self) -> Result<crate::model::Template> {
292            (*self.0.stub)
293                .create_template(self.0.request, self.0.options)
294                .await
295                .map(crate::Response::into_body)
296        }
297
298        /// Sets the value of [parent][crate::model::CreateTemplateRequest::parent].
299        ///
300        /// This is a **required** field for requests.
301        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
302            self.0.request.parent = v.into();
303            self
304        }
305
306        /// Sets the value of [template_id][crate::model::CreateTemplateRequest::template_id].
307        ///
308        /// This is a **required** field for requests.
309        pub fn set_template_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
310            self.0.request.template_id = v.into();
311            self
312        }
313
314        /// Sets the value of [template][crate::model::CreateTemplateRequest::template].
315        ///
316        /// This is a **required** field for requests.
317        pub fn set_template<T>(mut self, v: T) -> Self
318        where
319            T: std::convert::Into<crate::model::Template>,
320        {
321            self.0.request.template = std::option::Option::Some(v.into());
322            self
323        }
324
325        /// Sets or clears the value of [template][crate::model::CreateTemplateRequest::template].
326        ///
327        /// This is a **required** field for requests.
328        pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
329        where
330            T: std::convert::Into<crate::model::Template>,
331        {
332            self.0.request.template = v.map(|x| x.into());
333            self
334        }
335
336        /// Sets the value of [request_id][crate::model::CreateTemplateRequest::request_id].
337        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
338            self.0.request.request_id = v.into();
339            self
340        }
341    }
342
343    #[doc(hidden)]
344    impl crate::RequestBuilder for CreateTemplate {
345        fn request_options(&mut self) -> &mut crate::RequestOptions {
346            &mut self.0.options
347        }
348    }
349
350    /// The request builder for [ModelArmor::update_template][crate::client::ModelArmor::update_template] calls.
351    ///
352    /// # Example
353    /// ```
354    /// # use google_cloud_modelarmor_v1::builder::model_armor::UpdateTemplate;
355    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
356    ///
357    /// let builder = prepare_request_builder();
358    /// let response = builder.send().await?;
359    /// # Ok(()) }
360    ///
361    /// fn prepare_request_builder() -> UpdateTemplate {
362    ///   # panic!();
363    ///   // ... details omitted ...
364    /// }
365    /// ```
366    #[derive(Clone, Debug)]
367    pub struct UpdateTemplate(RequestBuilder<crate::model::UpdateTemplateRequest>);
368
369    impl UpdateTemplate {
370        pub(crate) fn new(
371            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
372        ) -> Self {
373            Self(RequestBuilder::new(stub))
374        }
375
376        /// Sets the full request, replacing any prior values.
377        pub fn with_request<V: Into<crate::model::UpdateTemplateRequest>>(mut self, v: V) -> Self {
378            self.0.request = v.into();
379            self
380        }
381
382        /// Sets all the options, replacing any prior values.
383        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
384            self.0.options = v.into();
385            self
386        }
387
388        /// Sends the request.
389        pub async fn send(self) -> Result<crate::model::Template> {
390            (*self.0.stub)
391                .update_template(self.0.request, self.0.options)
392                .await
393                .map(crate::Response::into_body)
394        }
395
396        /// Sets the value of [update_mask][crate::model::UpdateTemplateRequest::update_mask].
397        ///
398        /// This is a **required** field for requests.
399        pub fn set_update_mask<T>(mut self, v: T) -> Self
400        where
401            T: std::convert::Into<wkt::FieldMask>,
402        {
403            self.0.request.update_mask = std::option::Option::Some(v.into());
404            self
405        }
406
407        /// Sets or clears the value of [update_mask][crate::model::UpdateTemplateRequest::update_mask].
408        ///
409        /// This is a **required** field for requests.
410        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
411        where
412            T: std::convert::Into<wkt::FieldMask>,
413        {
414            self.0.request.update_mask = v.map(|x| x.into());
415            self
416        }
417
418        /// Sets the value of [template][crate::model::UpdateTemplateRequest::template].
419        ///
420        /// This is a **required** field for requests.
421        pub fn set_template<T>(mut self, v: T) -> Self
422        where
423            T: std::convert::Into<crate::model::Template>,
424        {
425            self.0.request.template = std::option::Option::Some(v.into());
426            self
427        }
428
429        /// Sets or clears the value of [template][crate::model::UpdateTemplateRequest::template].
430        ///
431        /// This is a **required** field for requests.
432        pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
433        where
434            T: std::convert::Into<crate::model::Template>,
435        {
436            self.0.request.template = v.map(|x| x.into());
437            self
438        }
439
440        /// Sets the value of [request_id][crate::model::UpdateTemplateRequest::request_id].
441        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
442            self.0.request.request_id = v.into();
443            self
444        }
445    }
446
447    #[doc(hidden)]
448    impl crate::RequestBuilder for UpdateTemplate {
449        fn request_options(&mut self) -> &mut crate::RequestOptions {
450            &mut self.0.options
451        }
452    }
453
454    /// The request builder for [ModelArmor::delete_template][crate::client::ModelArmor::delete_template] calls.
455    ///
456    /// # Example
457    /// ```
458    /// # use google_cloud_modelarmor_v1::builder::model_armor::DeleteTemplate;
459    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
460    ///
461    /// let builder = prepare_request_builder();
462    /// let response = builder.send().await?;
463    /// # Ok(()) }
464    ///
465    /// fn prepare_request_builder() -> DeleteTemplate {
466    ///   # panic!();
467    ///   // ... details omitted ...
468    /// }
469    /// ```
470    #[derive(Clone, Debug)]
471    pub struct DeleteTemplate(RequestBuilder<crate::model::DeleteTemplateRequest>);
472
473    impl DeleteTemplate {
474        pub(crate) fn new(
475            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
476        ) -> Self {
477            Self(RequestBuilder::new(stub))
478        }
479
480        /// Sets the full request, replacing any prior values.
481        pub fn with_request<V: Into<crate::model::DeleteTemplateRequest>>(mut self, v: V) -> Self {
482            self.0.request = v.into();
483            self
484        }
485
486        /// Sets all the options, replacing any prior values.
487        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
488            self.0.options = v.into();
489            self
490        }
491
492        /// Sends the request.
493        pub async fn send(self) -> Result<()> {
494            (*self.0.stub)
495                .delete_template(self.0.request, self.0.options)
496                .await
497                .map(crate::Response::into_body)
498        }
499
500        /// Sets the value of [name][crate::model::DeleteTemplateRequest::name].
501        ///
502        /// This is a **required** field for requests.
503        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
504            self.0.request.name = v.into();
505            self
506        }
507
508        /// Sets the value of [request_id][crate::model::DeleteTemplateRequest::request_id].
509        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
510            self.0.request.request_id = v.into();
511            self
512        }
513    }
514
515    #[doc(hidden)]
516    impl crate::RequestBuilder for DeleteTemplate {
517        fn request_options(&mut self) -> &mut crate::RequestOptions {
518            &mut self.0.options
519        }
520    }
521
522    /// The request builder for [ModelArmor::get_floor_setting][crate::client::ModelArmor::get_floor_setting] calls.
523    ///
524    /// # Example
525    /// ```
526    /// # use google_cloud_modelarmor_v1::builder::model_armor::GetFloorSetting;
527    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
528    ///
529    /// let builder = prepare_request_builder();
530    /// let response = builder.send().await?;
531    /// # Ok(()) }
532    ///
533    /// fn prepare_request_builder() -> GetFloorSetting {
534    ///   # panic!();
535    ///   // ... details omitted ...
536    /// }
537    /// ```
538    #[derive(Clone, Debug)]
539    pub struct GetFloorSetting(RequestBuilder<crate::model::GetFloorSettingRequest>);
540
541    impl GetFloorSetting {
542        pub(crate) fn new(
543            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
544        ) -> Self {
545            Self(RequestBuilder::new(stub))
546        }
547
548        /// Sets the full request, replacing any prior values.
549        pub fn with_request<V: Into<crate::model::GetFloorSettingRequest>>(mut self, v: V) -> Self {
550            self.0.request = v.into();
551            self
552        }
553
554        /// Sets all the options, replacing any prior values.
555        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
556            self.0.options = v.into();
557            self
558        }
559
560        /// Sends the request.
561        pub async fn send(self) -> Result<crate::model::FloorSetting> {
562            (*self.0.stub)
563                .get_floor_setting(self.0.request, self.0.options)
564                .await
565                .map(crate::Response::into_body)
566        }
567
568        /// Sets the value of [name][crate::model::GetFloorSettingRequest::name].
569        ///
570        /// This is a **required** field for requests.
571        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
572            self.0.request.name = v.into();
573            self
574        }
575    }
576
577    #[doc(hidden)]
578    impl crate::RequestBuilder for GetFloorSetting {
579        fn request_options(&mut self) -> &mut crate::RequestOptions {
580            &mut self.0.options
581        }
582    }
583
584    /// The request builder for [ModelArmor::update_floor_setting][crate::client::ModelArmor::update_floor_setting] calls.
585    ///
586    /// # Example
587    /// ```
588    /// # use google_cloud_modelarmor_v1::builder::model_armor::UpdateFloorSetting;
589    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
590    ///
591    /// let builder = prepare_request_builder();
592    /// let response = builder.send().await?;
593    /// # Ok(()) }
594    ///
595    /// fn prepare_request_builder() -> UpdateFloorSetting {
596    ///   # panic!();
597    ///   // ... details omitted ...
598    /// }
599    /// ```
600    #[derive(Clone, Debug)]
601    pub struct UpdateFloorSetting(RequestBuilder<crate::model::UpdateFloorSettingRequest>);
602
603    impl UpdateFloorSetting {
604        pub(crate) fn new(
605            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
606        ) -> Self {
607            Self(RequestBuilder::new(stub))
608        }
609
610        /// Sets the full request, replacing any prior values.
611        pub fn with_request<V: Into<crate::model::UpdateFloorSettingRequest>>(
612            mut self,
613            v: V,
614        ) -> Self {
615            self.0.request = v.into();
616            self
617        }
618
619        /// Sets all the options, replacing any prior values.
620        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
621            self.0.options = v.into();
622            self
623        }
624
625        /// Sends the request.
626        pub async fn send(self) -> Result<crate::model::FloorSetting> {
627            (*self.0.stub)
628                .update_floor_setting(self.0.request, self.0.options)
629                .await
630                .map(crate::Response::into_body)
631        }
632
633        /// Sets the value of [floor_setting][crate::model::UpdateFloorSettingRequest::floor_setting].
634        ///
635        /// This is a **required** field for requests.
636        pub fn set_floor_setting<T>(mut self, v: T) -> Self
637        where
638            T: std::convert::Into<crate::model::FloorSetting>,
639        {
640            self.0.request.floor_setting = std::option::Option::Some(v.into());
641            self
642        }
643
644        /// Sets or clears the value of [floor_setting][crate::model::UpdateFloorSettingRequest::floor_setting].
645        ///
646        /// This is a **required** field for requests.
647        pub fn set_or_clear_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
648        where
649            T: std::convert::Into<crate::model::FloorSetting>,
650        {
651            self.0.request.floor_setting = v.map(|x| x.into());
652            self
653        }
654
655        /// Sets the value of [update_mask][crate::model::UpdateFloorSettingRequest::update_mask].
656        pub fn set_update_mask<T>(mut self, v: T) -> Self
657        where
658            T: std::convert::Into<wkt::FieldMask>,
659        {
660            self.0.request.update_mask = std::option::Option::Some(v.into());
661            self
662        }
663
664        /// Sets or clears the value of [update_mask][crate::model::UpdateFloorSettingRequest::update_mask].
665        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
666        where
667            T: std::convert::Into<wkt::FieldMask>,
668        {
669            self.0.request.update_mask = v.map(|x| x.into());
670            self
671        }
672    }
673
674    #[doc(hidden)]
675    impl crate::RequestBuilder for UpdateFloorSetting {
676        fn request_options(&mut self) -> &mut crate::RequestOptions {
677            &mut self.0.options
678        }
679    }
680
681    /// The request builder for [ModelArmor::sanitize_user_prompt][crate::client::ModelArmor::sanitize_user_prompt] calls.
682    ///
683    /// # Example
684    /// ```
685    /// # use google_cloud_modelarmor_v1::builder::model_armor::SanitizeUserPrompt;
686    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
687    ///
688    /// let builder = prepare_request_builder();
689    /// let response = builder.send().await?;
690    /// # Ok(()) }
691    ///
692    /// fn prepare_request_builder() -> SanitizeUserPrompt {
693    ///   # panic!();
694    ///   // ... details omitted ...
695    /// }
696    /// ```
697    #[derive(Clone, Debug)]
698    pub struct SanitizeUserPrompt(RequestBuilder<crate::model::SanitizeUserPromptRequest>);
699
700    impl SanitizeUserPrompt {
701        pub(crate) fn new(
702            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
703        ) -> Self {
704            Self(RequestBuilder::new(stub))
705        }
706
707        /// Sets the full request, replacing any prior values.
708        pub fn with_request<V: Into<crate::model::SanitizeUserPromptRequest>>(
709            mut self,
710            v: V,
711        ) -> Self {
712            self.0.request = v.into();
713            self
714        }
715
716        /// Sets all the options, replacing any prior values.
717        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
718            self.0.options = v.into();
719            self
720        }
721
722        /// Sends the request.
723        pub async fn send(self) -> Result<crate::model::SanitizeUserPromptResponse> {
724            (*self.0.stub)
725                .sanitize_user_prompt(self.0.request, self.0.options)
726                .await
727                .map(crate::Response::into_body)
728        }
729
730        /// Sets the value of [name][crate::model::SanitizeUserPromptRequest::name].
731        ///
732        /// This is a **required** field for requests.
733        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
734            self.0.request.name = v.into();
735            self
736        }
737
738        /// Sets the value of [user_prompt_data][crate::model::SanitizeUserPromptRequest::user_prompt_data].
739        ///
740        /// This is a **required** field for requests.
741        pub fn set_user_prompt_data<T>(mut self, v: T) -> Self
742        where
743            T: std::convert::Into<crate::model::DataItem>,
744        {
745            self.0.request.user_prompt_data = std::option::Option::Some(v.into());
746            self
747        }
748
749        /// Sets or clears the value of [user_prompt_data][crate::model::SanitizeUserPromptRequest::user_prompt_data].
750        ///
751        /// This is a **required** field for requests.
752        pub fn set_or_clear_user_prompt_data<T>(mut self, v: std::option::Option<T>) -> Self
753        where
754            T: std::convert::Into<crate::model::DataItem>,
755        {
756            self.0.request.user_prompt_data = v.map(|x| x.into());
757            self
758        }
759
760        /// Sets the value of [multi_language_detection_metadata][crate::model::SanitizeUserPromptRequest::multi_language_detection_metadata].
761        pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
762        where
763            T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
764        {
765            self.0.request.multi_language_detection_metadata = std::option::Option::Some(v.into());
766            self
767        }
768
769        /// Sets or clears the value of [multi_language_detection_metadata][crate::model::SanitizeUserPromptRequest::multi_language_detection_metadata].
770        pub fn set_or_clear_multi_language_detection_metadata<T>(
771            mut self,
772            v: std::option::Option<T>,
773        ) -> Self
774        where
775            T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
776        {
777            self.0.request.multi_language_detection_metadata = v.map(|x| x.into());
778            self
779        }
780
781        /// Sets the value of [streaming_mode][crate::model::SanitizeUserPromptRequest::streaming_mode].
782        pub fn set_streaming_mode<T>(mut self, v: T) -> Self
783        where
784            T: std::convert::Into<crate::model::StreamingMode>,
785        {
786            self.0.request.streaming_mode = std::option::Option::Some(v.into());
787            self
788        }
789
790        /// Sets or clears the value of [streaming_mode][crate::model::SanitizeUserPromptRequest::streaming_mode].
791        pub fn set_or_clear_streaming_mode<T>(mut self, v: std::option::Option<T>) -> Self
792        where
793            T: std::convert::Into<crate::model::StreamingMode>,
794        {
795            self.0.request.streaming_mode = v.map(|x| x.into());
796            self
797        }
798    }
799
800    #[doc(hidden)]
801    impl crate::RequestBuilder for SanitizeUserPrompt {
802        fn request_options(&mut self) -> &mut crate::RequestOptions {
803            &mut self.0.options
804        }
805    }
806
807    /// The request builder for [ModelArmor::sanitize_model_response][crate::client::ModelArmor::sanitize_model_response] calls.
808    ///
809    /// # Example
810    /// ```
811    /// # use google_cloud_modelarmor_v1::builder::model_armor::SanitizeModelResponse;
812    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
813    ///
814    /// let builder = prepare_request_builder();
815    /// let response = builder.send().await?;
816    /// # Ok(()) }
817    ///
818    /// fn prepare_request_builder() -> SanitizeModelResponse {
819    ///   # panic!();
820    ///   // ... details omitted ...
821    /// }
822    /// ```
823    #[derive(Clone, Debug)]
824    pub struct SanitizeModelResponse(RequestBuilder<crate::model::SanitizeModelResponseRequest>);
825
826    impl SanitizeModelResponse {
827        pub(crate) fn new(
828            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
829        ) -> Self {
830            Self(RequestBuilder::new(stub))
831        }
832
833        /// Sets the full request, replacing any prior values.
834        pub fn with_request<V: Into<crate::model::SanitizeModelResponseRequest>>(
835            mut self,
836            v: V,
837        ) -> Self {
838            self.0.request = v.into();
839            self
840        }
841
842        /// Sets all the options, replacing any prior values.
843        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
844            self.0.options = v.into();
845            self
846        }
847
848        /// Sends the request.
849        pub async fn send(self) -> Result<crate::model::SanitizeModelResponseResponse> {
850            (*self.0.stub)
851                .sanitize_model_response(self.0.request, self.0.options)
852                .await
853                .map(crate::Response::into_body)
854        }
855
856        /// Sets the value of [name][crate::model::SanitizeModelResponseRequest::name].
857        ///
858        /// This is a **required** field for requests.
859        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
860            self.0.request.name = v.into();
861            self
862        }
863
864        /// Sets the value of [model_response_data][crate::model::SanitizeModelResponseRequest::model_response_data].
865        ///
866        /// This is a **required** field for requests.
867        pub fn set_model_response_data<T>(mut self, v: T) -> Self
868        where
869            T: std::convert::Into<crate::model::DataItem>,
870        {
871            self.0.request.model_response_data = std::option::Option::Some(v.into());
872            self
873        }
874
875        /// Sets or clears the value of [model_response_data][crate::model::SanitizeModelResponseRequest::model_response_data].
876        ///
877        /// This is a **required** field for requests.
878        pub fn set_or_clear_model_response_data<T>(mut self, v: std::option::Option<T>) -> Self
879        where
880            T: std::convert::Into<crate::model::DataItem>,
881        {
882            self.0.request.model_response_data = v.map(|x| x.into());
883            self
884        }
885
886        /// Sets the value of [user_prompt][crate::model::SanitizeModelResponseRequest::user_prompt].
887        pub fn set_user_prompt<T: Into<std::string::String>>(mut self, v: T) -> Self {
888            self.0.request.user_prompt = v.into();
889            self
890        }
891
892        /// Sets the value of [multi_language_detection_metadata][crate::model::SanitizeModelResponseRequest::multi_language_detection_metadata].
893        pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
894        where
895            T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
896        {
897            self.0.request.multi_language_detection_metadata = std::option::Option::Some(v.into());
898            self
899        }
900
901        /// Sets or clears the value of [multi_language_detection_metadata][crate::model::SanitizeModelResponseRequest::multi_language_detection_metadata].
902        pub fn set_or_clear_multi_language_detection_metadata<T>(
903            mut self,
904            v: std::option::Option<T>,
905        ) -> Self
906        where
907            T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
908        {
909            self.0.request.multi_language_detection_metadata = v.map(|x| x.into());
910            self
911        }
912
913        /// Sets the value of [streaming_mode][crate::model::SanitizeModelResponseRequest::streaming_mode].
914        pub fn set_streaming_mode<T>(mut self, v: T) -> Self
915        where
916            T: std::convert::Into<crate::model::StreamingMode>,
917        {
918            self.0.request.streaming_mode = std::option::Option::Some(v.into());
919            self
920        }
921
922        /// Sets or clears the value of [streaming_mode][crate::model::SanitizeModelResponseRequest::streaming_mode].
923        pub fn set_or_clear_streaming_mode<T>(mut self, v: std::option::Option<T>) -> Self
924        where
925            T: std::convert::Into<crate::model::StreamingMode>,
926        {
927            self.0.request.streaming_mode = v.map(|x| x.into());
928            self
929        }
930    }
931
932    #[doc(hidden)]
933    impl crate::RequestBuilder for SanitizeModelResponse {
934        fn request_options(&mut self) -> &mut crate::RequestOptions {
935            &mut self.0.options
936        }
937    }
938
939    /// The request builder for [ModelArmor::list_locations][crate::client::ModelArmor::list_locations] calls.
940    ///
941    /// # Example
942    /// ```
943    /// # use google_cloud_modelarmor_v1::builder::model_armor::ListLocations;
944    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
945    /// use google_cloud_gax::paginator::ItemPaginator;
946    ///
947    /// let builder = prepare_request_builder();
948    /// let mut items = builder.by_item();
949    /// while let Some(result) = items.next().await {
950    ///   let item = result?;
951    /// }
952    /// # Ok(()) }
953    ///
954    /// fn prepare_request_builder() -> ListLocations {
955    ///   # panic!();
956    ///   // ... details omitted ...
957    /// }
958    /// ```
959    #[derive(Clone, Debug)]
960    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
961
962    impl ListLocations {
963        pub(crate) fn new(
964            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
965        ) -> Self {
966            Self(RequestBuilder::new(stub))
967        }
968
969        /// Sets the full request, replacing any prior values.
970        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
971            mut self,
972            v: V,
973        ) -> Self {
974            self.0.request = v.into();
975            self
976        }
977
978        /// Sets all the options, replacing any prior values.
979        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
980            self.0.options = v.into();
981            self
982        }
983
984        /// Sends the request.
985        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
986            (*self.0.stub)
987                .list_locations(self.0.request, self.0.options)
988                .await
989                .map(crate::Response::into_body)
990        }
991
992        /// Streams each page in the collection.
993        pub fn by_page(
994            self,
995        ) -> impl google_cloud_gax::paginator::Paginator<
996            google_cloud_location::model::ListLocationsResponse,
997            crate::Error,
998        > {
999            use std::clone::Clone;
1000            let token = self.0.request.page_token.clone();
1001            let execute = move |token: String| {
1002                let mut builder = self.clone();
1003                builder.0.request = builder.0.request.set_page_token(token);
1004                builder.send()
1005            };
1006            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1007        }
1008
1009        /// Streams each item in the collection.
1010        pub fn by_item(
1011            self,
1012        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1013            google_cloud_location::model::ListLocationsResponse,
1014            crate::Error,
1015        > {
1016            use google_cloud_gax::paginator::Paginator;
1017            self.by_page().items()
1018        }
1019
1020        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
1021        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1022            self.0.request.name = v.into();
1023            self
1024        }
1025
1026        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
1027        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1028            self.0.request.filter = v.into();
1029            self
1030        }
1031
1032        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
1033        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1034            self.0.request.page_size = v.into();
1035            self
1036        }
1037
1038        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
1039        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1040            self.0.request.page_token = v.into();
1041            self
1042        }
1043    }
1044
1045    #[doc(hidden)]
1046    impl crate::RequestBuilder for ListLocations {
1047        fn request_options(&mut self) -> &mut crate::RequestOptions {
1048            &mut self.0.options
1049        }
1050    }
1051
1052    /// The request builder for [ModelArmor::get_location][crate::client::ModelArmor::get_location] calls.
1053    ///
1054    /// # Example
1055    /// ```
1056    /// # use google_cloud_modelarmor_v1::builder::model_armor::GetLocation;
1057    /// # async fn sample() -> google_cloud_modelarmor_v1::Result<()> {
1058    ///
1059    /// let builder = prepare_request_builder();
1060    /// let response = builder.send().await?;
1061    /// # Ok(()) }
1062    ///
1063    /// fn prepare_request_builder() -> GetLocation {
1064    ///   # panic!();
1065    ///   // ... details omitted ...
1066    /// }
1067    /// ```
1068    #[derive(Clone, Debug)]
1069    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1070
1071    impl GetLocation {
1072        pub(crate) fn new(
1073            stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelArmor>,
1074        ) -> Self {
1075            Self(RequestBuilder::new(stub))
1076        }
1077
1078        /// Sets the full request, replacing any prior values.
1079        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1080            mut self,
1081            v: V,
1082        ) -> Self {
1083            self.0.request = v.into();
1084            self
1085        }
1086
1087        /// Sets all the options, replacing any prior values.
1088        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1089            self.0.options = v.into();
1090            self
1091        }
1092
1093        /// Sends the request.
1094        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1095            (*self.0.stub)
1096                .get_location(self.0.request, self.0.options)
1097                .await
1098                .map(crate::Response::into_body)
1099        }
1100
1101        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
1102        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1103            self.0.request.name = v.into();
1104            self
1105        }
1106    }
1107
1108    #[doc(hidden)]
1109    impl crate::RequestBuilder for GetLocation {
1110        fn request_options(&mut self) -> &mut crate::RequestOptions {
1111            &mut self.0.options
1112        }
1113    }
1114}