google_cloud_build_v2/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod repository_manager {
18    use crate::Result;
19
20    /// A builder for [RepositoryManager][super::super::client::RepositoryManager].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_build_v2::*;
25    /// # use builder::repository_manager::ClientBuilder;
26    /// # use client::RepositoryManager;
27    /// let builder : ClientBuilder = RepositoryManager::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://cloudbuild.googleapis.com")
30    ///     .build().await?;
31    /// # gax::Result::<()>::Ok(()) });
32    /// ```
33    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::RepositoryManager;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = RepositoryManager;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
43                Self::Client::new(config).await
44            }
45        }
46    }
47
48    /// Common implementation for [super::super::client::RepositoryManager] request builders.
49    #[derive(Clone, Debug)]
50    pub(crate) struct RequestBuilder<R: std::default::Default> {
51        stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
52        request: R,
53        options: gax::options::RequestOptions,
54    }
55
56    impl<R> RequestBuilder<R>
57    where
58        R: std::default::Default,
59    {
60        pub(crate) fn new(
61            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
62        ) -> Self {
63            Self {
64                stub,
65                request: R::default(),
66                options: gax::options::RequestOptions::default(),
67            }
68        }
69    }
70
71    /// The request builder for [RepositoryManager::create_connection][super::super::client::RepositoryManager::create_connection] calls.
72    ///
73    /// # Example
74    /// ```no_run
75    /// # use google_cloud_build_v2::builder;
76    /// use builder::repository_manager::CreateConnection;
77    /// # tokio_test::block_on(async {
78    /// let builder = prepare_request_builder();
79    /// use google_cloud_build_v2::Poller;
80    /// let response = builder.poller().until_done().await?;
81    /// # gax::Result::<()>::Ok(()) });
82    ///
83    /// fn prepare_request_builder() -> CreateConnection {
84    ///   # panic!();
85    ///   // ... details omitted ...
86    /// }
87    /// ```
88    #[derive(Clone, Debug)]
89    pub struct CreateConnection(RequestBuilder<crate::model::CreateConnectionRequest>);
90
91    impl CreateConnection {
92        pub(crate) fn new(
93            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
94        ) -> Self {
95            Self(RequestBuilder::new(stub))
96        }
97
98        /// Sets the full request, replacing any prior values.
99        pub fn with_request<V: Into<crate::model::CreateConnectionRequest>>(
100            mut self,
101            v: V,
102        ) -> Self {
103            self.0.request = v.into();
104            self
105        }
106
107        /// Sets all the options, replacing any prior values.
108        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109            self.0.options = v.into();
110            self
111        }
112
113        /// Sends the request.
114        ///
115        /// # Long running operations
116        ///
117        /// This starts, but does not poll, a longrunning operation. More information
118        /// on [create_connection][super::super::client::RepositoryManager::create_connection].
119        pub async fn send(self) -> Result<longrunning::model::Operation> {
120            (*self.0.stub)
121                .create_connection(self.0.request, self.0.options)
122                .await
123                .map(gax::response::Response::into_body)
124        }
125
126        /// Creates a [Poller][lro::Poller] to work with `create_connection`.
127        pub fn poller(
128            self,
129        ) -> impl lro::Poller<crate::model::Connection, crate::model::OperationMetadata> {
130            type Operation =
131                lro::internal::Operation<crate::model::Connection, crate::model::OperationMetadata>;
132            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
133            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
134
135            let stub = self.0.stub.clone();
136            let mut options = self.0.options.clone();
137            options.set_retry_policy(gax::retry_policy::NeverRetry);
138            let query = move |name| {
139                let stub = stub.clone();
140                let options = options.clone();
141                async {
142                    let op = GetOperation::new(stub)
143                        .set_name(name)
144                        .with_options(options)
145                        .send()
146                        .await?;
147                    Ok(Operation::new(op))
148                }
149            };
150
151            let start = move || async {
152                let op = self.send().await?;
153                Ok(Operation::new(op))
154            };
155
156            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
157        }
158
159        /// Sets the value of [parent][crate::model::CreateConnectionRequest::parent].
160        ///
161        /// This is a **required** field for requests.
162        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
163            self.0.request.parent = v.into();
164            self
165        }
166
167        /// Sets the value of [connection][crate::model::CreateConnectionRequest::connection].
168        ///
169        /// This is a **required** field for requests.
170        pub fn set_connection<T: Into<std::option::Option<crate::model::Connection>>>(
171            mut self,
172            v: T,
173        ) -> Self {
174            self.0.request.connection = v.into();
175            self
176        }
177
178        /// Sets the value of [connection_id][crate::model::CreateConnectionRequest::connection_id].
179        ///
180        /// This is a **required** field for requests.
181        pub fn set_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
182            self.0.request.connection_id = v.into();
183            self
184        }
185    }
186
187    #[doc(hidden)]
188    impl gax::options::internal::RequestBuilder for CreateConnection {
189        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
190            &mut self.0.options
191        }
192    }
193
194    /// The request builder for [RepositoryManager::get_connection][super::super::client::RepositoryManager::get_connection] calls.
195    ///
196    /// # Example
197    /// ```no_run
198    /// # use google_cloud_build_v2::builder;
199    /// use builder::repository_manager::GetConnection;
200    /// # tokio_test::block_on(async {
201    /// let builder = prepare_request_builder();
202    /// let response = builder.send().await?;
203    /// # gax::Result::<()>::Ok(()) });
204    ///
205    /// fn prepare_request_builder() -> GetConnection {
206    ///   # panic!();
207    ///   // ... details omitted ...
208    /// }
209    /// ```
210    #[derive(Clone, Debug)]
211    pub struct GetConnection(RequestBuilder<crate::model::GetConnectionRequest>);
212
213    impl GetConnection {
214        pub(crate) fn new(
215            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
216        ) -> Self {
217            Self(RequestBuilder::new(stub))
218        }
219
220        /// Sets the full request, replacing any prior values.
221        pub fn with_request<V: Into<crate::model::GetConnectionRequest>>(mut self, v: V) -> Self {
222            self.0.request = v.into();
223            self
224        }
225
226        /// Sets all the options, replacing any prior values.
227        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
228            self.0.options = v.into();
229            self
230        }
231
232        /// Sends the request.
233        pub async fn send(self) -> Result<crate::model::Connection> {
234            (*self.0.stub)
235                .get_connection(self.0.request, self.0.options)
236                .await
237                .map(gax::response::Response::into_body)
238        }
239
240        /// Sets the value of [name][crate::model::GetConnectionRequest::name].
241        ///
242        /// This is a **required** field for requests.
243        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.name = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl gax::options::internal::RequestBuilder for GetConnection {
251        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [RepositoryManager::list_connections][super::super::client::RepositoryManager::list_connections] calls.
257    ///
258    /// # Example
259    /// ```no_run
260    /// # use google_cloud_build_v2::builder;
261    /// use builder::repository_manager::ListConnections;
262    /// # tokio_test::block_on(async {
263    /// let builder = prepare_request_builder();
264    /// use gax::paginator::ItemPaginator;
265    /// let mut items = builder.by_item();
266    /// while let Some(result) = items.next().await {
267    ///   let item = result?;
268    /// }
269    /// # gax::Result::<()>::Ok(()) });
270    ///
271    /// fn prepare_request_builder() -> ListConnections {
272    ///   # panic!();
273    ///   // ... details omitted ...
274    /// }
275    /// ```
276    #[derive(Clone, Debug)]
277    pub struct ListConnections(RequestBuilder<crate::model::ListConnectionsRequest>);
278
279    impl ListConnections {
280        pub(crate) fn new(
281            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
282        ) -> Self {
283            Self(RequestBuilder::new(stub))
284        }
285
286        /// Sets the full request, replacing any prior values.
287        pub fn with_request<V: Into<crate::model::ListConnectionsRequest>>(mut self, v: V) -> Self {
288            self.0.request = v.into();
289            self
290        }
291
292        /// Sets all the options, replacing any prior values.
293        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
294            self.0.options = v.into();
295            self
296        }
297
298        /// Sends the request.
299        pub async fn send(self) -> Result<crate::model::ListConnectionsResponse> {
300            (*self.0.stub)
301                .list_connections(self.0.request, self.0.options)
302                .await
303                .map(gax::response::Response::into_body)
304        }
305
306        /// Streams each page in the collection.
307        pub fn by_page(
308            self,
309        ) -> impl gax::paginator::Paginator<crate::model::ListConnectionsResponse, gax::error::Error>
310        {
311            use std::clone::Clone;
312            let token = self.0.request.page_token.clone();
313            let execute = move |token: String| {
314                let mut builder = self.clone();
315                builder.0.request = builder.0.request.set_page_token(token);
316                builder.send()
317            };
318            gax::paginator::internal::new_paginator(token, execute)
319        }
320
321        /// Streams each item in the collection.
322        pub fn by_item(
323            self,
324        ) -> impl gax::paginator::ItemPaginator<crate::model::ListConnectionsResponse, gax::error::Error>
325        {
326            use gax::paginator::Paginator;
327            self.by_page().items()
328        }
329
330        /// Sets the value of [parent][crate::model::ListConnectionsRequest::parent].
331        ///
332        /// This is a **required** field for requests.
333        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
334            self.0.request.parent = v.into();
335            self
336        }
337
338        /// Sets the value of [page_size][crate::model::ListConnectionsRequest::page_size].
339        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
340            self.0.request.page_size = v.into();
341            self
342        }
343
344        /// Sets the value of [page_token][crate::model::ListConnectionsRequest::page_token].
345        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
346            self.0.request.page_token = v.into();
347            self
348        }
349    }
350
351    #[doc(hidden)]
352    impl gax::options::internal::RequestBuilder for ListConnections {
353        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
354            &mut self.0.options
355        }
356    }
357
358    /// The request builder for [RepositoryManager::update_connection][super::super::client::RepositoryManager::update_connection] calls.
359    ///
360    /// # Example
361    /// ```no_run
362    /// # use google_cloud_build_v2::builder;
363    /// use builder::repository_manager::UpdateConnection;
364    /// # tokio_test::block_on(async {
365    /// let builder = prepare_request_builder();
366    /// use google_cloud_build_v2::Poller;
367    /// let response = builder.poller().until_done().await?;
368    /// # gax::Result::<()>::Ok(()) });
369    ///
370    /// fn prepare_request_builder() -> UpdateConnection {
371    ///   # panic!();
372    ///   // ... details omitted ...
373    /// }
374    /// ```
375    #[derive(Clone, Debug)]
376    pub struct UpdateConnection(RequestBuilder<crate::model::UpdateConnectionRequest>);
377
378    impl UpdateConnection {
379        pub(crate) fn new(
380            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
381        ) -> Self {
382            Self(RequestBuilder::new(stub))
383        }
384
385        /// Sets the full request, replacing any prior values.
386        pub fn with_request<V: Into<crate::model::UpdateConnectionRequest>>(
387            mut self,
388            v: V,
389        ) -> Self {
390            self.0.request = v.into();
391            self
392        }
393
394        /// Sets all the options, replacing any prior values.
395        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
396            self.0.options = v.into();
397            self
398        }
399
400        /// Sends the request.
401        ///
402        /// # Long running operations
403        ///
404        /// This starts, but does not poll, a longrunning operation. More information
405        /// on [update_connection][super::super::client::RepositoryManager::update_connection].
406        pub async fn send(self) -> Result<longrunning::model::Operation> {
407            (*self.0.stub)
408                .update_connection(self.0.request, self.0.options)
409                .await
410                .map(gax::response::Response::into_body)
411        }
412
413        /// Creates a [Poller][lro::Poller] to work with `update_connection`.
414        pub fn poller(
415            self,
416        ) -> impl lro::Poller<crate::model::Connection, crate::model::OperationMetadata> {
417            type Operation =
418                lro::internal::Operation<crate::model::Connection, crate::model::OperationMetadata>;
419            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
420            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
421
422            let stub = self.0.stub.clone();
423            let mut options = self.0.options.clone();
424            options.set_retry_policy(gax::retry_policy::NeverRetry);
425            let query = move |name| {
426                let stub = stub.clone();
427                let options = options.clone();
428                async {
429                    let op = GetOperation::new(stub)
430                        .set_name(name)
431                        .with_options(options)
432                        .send()
433                        .await?;
434                    Ok(Operation::new(op))
435                }
436            };
437
438            let start = move || async {
439                let op = self.send().await?;
440                Ok(Operation::new(op))
441            };
442
443            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
444        }
445
446        /// Sets the value of [connection][crate::model::UpdateConnectionRequest::connection].
447        ///
448        /// This is a **required** field for requests.
449        pub fn set_connection<T: Into<std::option::Option<crate::model::Connection>>>(
450            mut self,
451            v: T,
452        ) -> Self {
453            self.0.request.connection = v.into();
454            self
455        }
456
457        /// Sets the value of [update_mask][crate::model::UpdateConnectionRequest::update_mask].
458        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
459            mut self,
460            v: T,
461        ) -> Self {
462            self.0.request.update_mask = v.into();
463            self
464        }
465
466        /// Sets the value of [allow_missing][crate::model::UpdateConnectionRequest::allow_missing].
467        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
468            self.0.request.allow_missing = v.into();
469            self
470        }
471
472        /// Sets the value of [etag][crate::model::UpdateConnectionRequest::etag].
473        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
474            self.0.request.etag = v.into();
475            self
476        }
477    }
478
479    #[doc(hidden)]
480    impl gax::options::internal::RequestBuilder for UpdateConnection {
481        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
482            &mut self.0.options
483        }
484    }
485
486    /// The request builder for [RepositoryManager::delete_connection][super::super::client::RepositoryManager::delete_connection] calls.
487    ///
488    /// # Example
489    /// ```no_run
490    /// # use google_cloud_build_v2::builder;
491    /// use builder::repository_manager::DeleteConnection;
492    /// # tokio_test::block_on(async {
493    /// let builder = prepare_request_builder();
494    /// use google_cloud_build_v2::Poller;
495    /// let response = builder.poller().until_done().await?;
496    /// # gax::Result::<()>::Ok(()) });
497    ///
498    /// fn prepare_request_builder() -> DeleteConnection {
499    ///   # panic!();
500    ///   // ... details omitted ...
501    /// }
502    /// ```
503    #[derive(Clone, Debug)]
504    pub struct DeleteConnection(RequestBuilder<crate::model::DeleteConnectionRequest>);
505
506    impl DeleteConnection {
507        pub(crate) fn new(
508            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
509        ) -> Self {
510            Self(RequestBuilder::new(stub))
511        }
512
513        /// Sets the full request, replacing any prior values.
514        pub fn with_request<V: Into<crate::model::DeleteConnectionRequest>>(
515            mut self,
516            v: V,
517        ) -> Self {
518            self.0.request = v.into();
519            self
520        }
521
522        /// Sets all the options, replacing any prior values.
523        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
524            self.0.options = v.into();
525            self
526        }
527
528        /// Sends the request.
529        ///
530        /// # Long running operations
531        ///
532        /// This starts, but does not poll, a longrunning operation. More information
533        /// on [delete_connection][super::super::client::RepositoryManager::delete_connection].
534        pub async fn send(self) -> Result<longrunning::model::Operation> {
535            (*self.0.stub)
536                .delete_connection(self.0.request, self.0.options)
537                .await
538                .map(gax::response::Response::into_body)
539        }
540
541        /// Creates a [Poller][lro::Poller] to work with `delete_connection`.
542        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
543            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
544            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
545            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
546
547            let stub = self.0.stub.clone();
548            let mut options = self.0.options.clone();
549            options.set_retry_policy(gax::retry_policy::NeverRetry);
550            let query = move |name| {
551                let stub = stub.clone();
552                let options = options.clone();
553                async {
554                    let op = GetOperation::new(stub)
555                        .set_name(name)
556                        .with_options(options)
557                        .send()
558                        .await?;
559                    Ok(Operation::new(op))
560                }
561            };
562
563            let start = move || async {
564                let op = self.send().await?;
565                Ok(Operation::new(op))
566            };
567
568            lro::internal::new_unit_response_poller(
569                polling_error_policy,
570                polling_backoff_policy,
571                start,
572                query,
573            )
574        }
575
576        /// Sets the value of [name][crate::model::DeleteConnectionRequest::name].
577        ///
578        /// This is a **required** field for requests.
579        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
580            self.0.request.name = v.into();
581            self
582        }
583
584        /// Sets the value of [etag][crate::model::DeleteConnectionRequest::etag].
585        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
586            self.0.request.etag = v.into();
587            self
588        }
589
590        /// Sets the value of [validate_only][crate::model::DeleteConnectionRequest::validate_only].
591        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
592            self.0.request.validate_only = v.into();
593            self
594        }
595    }
596
597    #[doc(hidden)]
598    impl gax::options::internal::RequestBuilder for DeleteConnection {
599        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
600            &mut self.0.options
601        }
602    }
603
604    /// The request builder for [RepositoryManager::create_repository][super::super::client::RepositoryManager::create_repository] calls.
605    ///
606    /// # Example
607    /// ```no_run
608    /// # use google_cloud_build_v2::builder;
609    /// use builder::repository_manager::CreateRepository;
610    /// # tokio_test::block_on(async {
611    /// let builder = prepare_request_builder();
612    /// use google_cloud_build_v2::Poller;
613    /// let response = builder.poller().until_done().await?;
614    /// # gax::Result::<()>::Ok(()) });
615    ///
616    /// fn prepare_request_builder() -> CreateRepository {
617    ///   # panic!();
618    ///   // ... details omitted ...
619    /// }
620    /// ```
621    #[derive(Clone, Debug)]
622    pub struct CreateRepository(RequestBuilder<crate::model::CreateRepositoryRequest>);
623
624    impl CreateRepository {
625        pub(crate) fn new(
626            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
627        ) -> Self {
628            Self(RequestBuilder::new(stub))
629        }
630
631        /// Sets the full request, replacing any prior values.
632        pub fn with_request<V: Into<crate::model::CreateRepositoryRequest>>(
633            mut self,
634            v: V,
635        ) -> Self {
636            self.0.request = v.into();
637            self
638        }
639
640        /// Sets all the options, replacing any prior values.
641        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
642            self.0.options = v.into();
643            self
644        }
645
646        /// Sends the request.
647        ///
648        /// # Long running operations
649        ///
650        /// This starts, but does not poll, a longrunning operation. More information
651        /// on [create_repository][super::super::client::RepositoryManager::create_repository].
652        pub async fn send(self) -> Result<longrunning::model::Operation> {
653            (*self.0.stub)
654                .create_repository(self.0.request, self.0.options)
655                .await
656                .map(gax::response::Response::into_body)
657        }
658
659        /// Creates a [Poller][lro::Poller] to work with `create_repository`.
660        pub fn poller(
661            self,
662        ) -> impl lro::Poller<crate::model::Repository, crate::model::OperationMetadata> {
663            type Operation =
664                lro::internal::Operation<crate::model::Repository, crate::model::OperationMetadata>;
665            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
666            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
667
668            let stub = self.0.stub.clone();
669            let mut options = self.0.options.clone();
670            options.set_retry_policy(gax::retry_policy::NeverRetry);
671            let query = move |name| {
672                let stub = stub.clone();
673                let options = options.clone();
674                async {
675                    let op = GetOperation::new(stub)
676                        .set_name(name)
677                        .with_options(options)
678                        .send()
679                        .await?;
680                    Ok(Operation::new(op))
681                }
682            };
683
684            let start = move || async {
685                let op = self.send().await?;
686                Ok(Operation::new(op))
687            };
688
689            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
690        }
691
692        /// Sets the value of [parent][crate::model::CreateRepositoryRequest::parent].
693        ///
694        /// This is a **required** field for requests.
695        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
696            self.0.request.parent = v.into();
697            self
698        }
699
700        /// Sets the value of [repository][crate::model::CreateRepositoryRequest::repository].
701        ///
702        /// This is a **required** field for requests.
703        pub fn set_repository<T: Into<std::option::Option<crate::model::Repository>>>(
704            mut self,
705            v: T,
706        ) -> Self {
707            self.0.request.repository = v.into();
708            self
709        }
710
711        /// Sets the value of [repository_id][crate::model::CreateRepositoryRequest::repository_id].
712        ///
713        /// This is a **required** field for requests.
714        pub fn set_repository_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
715            self.0.request.repository_id = v.into();
716            self
717        }
718    }
719
720    #[doc(hidden)]
721    impl gax::options::internal::RequestBuilder for CreateRepository {
722        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
723            &mut self.0.options
724        }
725    }
726
727    /// The request builder for [RepositoryManager::batch_create_repositories][super::super::client::RepositoryManager::batch_create_repositories] calls.
728    ///
729    /// # Example
730    /// ```no_run
731    /// # use google_cloud_build_v2::builder;
732    /// use builder::repository_manager::BatchCreateRepositories;
733    /// # tokio_test::block_on(async {
734    /// let builder = prepare_request_builder();
735    /// use google_cloud_build_v2::Poller;
736    /// let response = builder.poller().until_done().await?;
737    /// # gax::Result::<()>::Ok(()) });
738    ///
739    /// fn prepare_request_builder() -> BatchCreateRepositories {
740    ///   # panic!();
741    ///   // ... details omitted ...
742    /// }
743    /// ```
744    #[derive(Clone, Debug)]
745    pub struct BatchCreateRepositories(
746        RequestBuilder<crate::model::BatchCreateRepositoriesRequest>,
747    );
748
749    impl BatchCreateRepositories {
750        pub(crate) fn new(
751            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
752        ) -> Self {
753            Self(RequestBuilder::new(stub))
754        }
755
756        /// Sets the full request, replacing any prior values.
757        pub fn with_request<V: Into<crate::model::BatchCreateRepositoriesRequest>>(
758            mut self,
759            v: V,
760        ) -> Self {
761            self.0.request = v.into();
762            self
763        }
764
765        /// Sets all the options, replacing any prior values.
766        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
767            self.0.options = v.into();
768            self
769        }
770
771        /// Sends the request.
772        ///
773        /// # Long running operations
774        ///
775        /// This starts, but does not poll, a longrunning operation. More information
776        /// on [batch_create_repositories][super::super::client::RepositoryManager::batch_create_repositories].
777        pub async fn send(self) -> Result<longrunning::model::Operation> {
778            (*self.0.stub)
779                .batch_create_repositories(self.0.request, self.0.options)
780                .await
781                .map(gax::response::Response::into_body)
782        }
783
784        /// Creates a [Poller][lro::Poller] to work with `batch_create_repositories`.
785        pub fn poller(
786            self,
787        ) -> impl lro::Poller<
788            crate::model::BatchCreateRepositoriesResponse,
789            crate::model::OperationMetadata,
790        > {
791            type Operation = lro::internal::Operation<
792                crate::model::BatchCreateRepositoriesResponse,
793                crate::model::OperationMetadata,
794            >;
795            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
796            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
797
798            let stub = self.0.stub.clone();
799            let mut options = self.0.options.clone();
800            options.set_retry_policy(gax::retry_policy::NeverRetry);
801            let query = move |name| {
802                let stub = stub.clone();
803                let options = options.clone();
804                async {
805                    let op = GetOperation::new(stub)
806                        .set_name(name)
807                        .with_options(options)
808                        .send()
809                        .await?;
810                    Ok(Operation::new(op))
811                }
812            };
813
814            let start = move || async {
815                let op = self.send().await?;
816                Ok(Operation::new(op))
817            };
818
819            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
820        }
821
822        /// Sets the value of [parent][crate::model::BatchCreateRepositoriesRequest::parent].
823        ///
824        /// This is a **required** field for requests.
825        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
826            self.0.request.parent = v.into();
827            self
828        }
829
830        /// Sets the value of [requests][crate::model::BatchCreateRepositoriesRequest::requests].
831        ///
832        /// This is a **required** field for requests.
833        pub fn set_requests<T, V>(mut self, v: T) -> Self
834        where
835            T: std::iter::IntoIterator<Item = V>,
836            V: std::convert::Into<crate::model::CreateRepositoryRequest>,
837        {
838            use std::iter::Iterator;
839            self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
840            self
841        }
842    }
843
844    #[doc(hidden)]
845    impl gax::options::internal::RequestBuilder for BatchCreateRepositories {
846        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
847            &mut self.0.options
848        }
849    }
850
851    /// The request builder for [RepositoryManager::get_repository][super::super::client::RepositoryManager::get_repository] calls.
852    ///
853    /// # Example
854    /// ```no_run
855    /// # use google_cloud_build_v2::builder;
856    /// use builder::repository_manager::GetRepository;
857    /// # tokio_test::block_on(async {
858    /// let builder = prepare_request_builder();
859    /// let response = builder.send().await?;
860    /// # gax::Result::<()>::Ok(()) });
861    ///
862    /// fn prepare_request_builder() -> GetRepository {
863    ///   # panic!();
864    ///   // ... details omitted ...
865    /// }
866    /// ```
867    #[derive(Clone, Debug)]
868    pub struct GetRepository(RequestBuilder<crate::model::GetRepositoryRequest>);
869
870    impl GetRepository {
871        pub(crate) fn new(
872            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
873        ) -> Self {
874            Self(RequestBuilder::new(stub))
875        }
876
877        /// Sets the full request, replacing any prior values.
878        pub fn with_request<V: Into<crate::model::GetRepositoryRequest>>(mut self, v: V) -> Self {
879            self.0.request = v.into();
880            self
881        }
882
883        /// Sets all the options, replacing any prior values.
884        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
885            self.0.options = v.into();
886            self
887        }
888
889        /// Sends the request.
890        pub async fn send(self) -> Result<crate::model::Repository> {
891            (*self.0.stub)
892                .get_repository(self.0.request, self.0.options)
893                .await
894                .map(gax::response::Response::into_body)
895        }
896
897        /// Sets the value of [name][crate::model::GetRepositoryRequest::name].
898        ///
899        /// This is a **required** field for requests.
900        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
901            self.0.request.name = v.into();
902            self
903        }
904    }
905
906    #[doc(hidden)]
907    impl gax::options::internal::RequestBuilder for GetRepository {
908        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
909            &mut self.0.options
910        }
911    }
912
913    /// The request builder for [RepositoryManager::list_repositories][super::super::client::RepositoryManager::list_repositories] calls.
914    ///
915    /// # Example
916    /// ```no_run
917    /// # use google_cloud_build_v2::builder;
918    /// use builder::repository_manager::ListRepositories;
919    /// # tokio_test::block_on(async {
920    /// let builder = prepare_request_builder();
921    /// use gax::paginator::ItemPaginator;
922    /// let mut items = builder.by_item();
923    /// while let Some(result) = items.next().await {
924    ///   let item = result?;
925    /// }
926    /// # gax::Result::<()>::Ok(()) });
927    ///
928    /// fn prepare_request_builder() -> ListRepositories {
929    ///   # panic!();
930    ///   // ... details omitted ...
931    /// }
932    /// ```
933    #[derive(Clone, Debug)]
934    pub struct ListRepositories(RequestBuilder<crate::model::ListRepositoriesRequest>);
935
936    impl ListRepositories {
937        pub(crate) fn new(
938            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
939        ) -> Self {
940            Self(RequestBuilder::new(stub))
941        }
942
943        /// Sets the full request, replacing any prior values.
944        pub fn with_request<V: Into<crate::model::ListRepositoriesRequest>>(
945            mut self,
946            v: V,
947        ) -> Self {
948            self.0.request = v.into();
949            self
950        }
951
952        /// Sets all the options, replacing any prior values.
953        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
954            self.0.options = v.into();
955            self
956        }
957
958        /// Sends the request.
959        pub async fn send(self) -> Result<crate::model::ListRepositoriesResponse> {
960            (*self.0.stub)
961                .list_repositories(self.0.request, self.0.options)
962                .await
963                .map(gax::response::Response::into_body)
964        }
965
966        /// Streams each page in the collection.
967        pub fn by_page(
968            self,
969        ) -> impl gax::paginator::Paginator<crate::model::ListRepositoriesResponse, gax::error::Error>
970        {
971            use std::clone::Clone;
972            let token = self.0.request.page_token.clone();
973            let execute = move |token: String| {
974                let mut builder = self.clone();
975                builder.0.request = builder.0.request.set_page_token(token);
976                builder.send()
977            };
978            gax::paginator::internal::new_paginator(token, execute)
979        }
980
981        /// Streams each item in the collection.
982        pub fn by_item(
983            self,
984        ) -> impl gax::paginator::ItemPaginator<crate::model::ListRepositoriesResponse, gax::error::Error>
985        {
986            use gax::paginator::Paginator;
987            self.by_page().items()
988        }
989
990        /// Sets the value of [parent][crate::model::ListRepositoriesRequest::parent].
991        ///
992        /// This is a **required** field for requests.
993        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
994            self.0.request.parent = v.into();
995            self
996        }
997
998        /// Sets the value of [page_size][crate::model::ListRepositoriesRequest::page_size].
999        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1000            self.0.request.page_size = v.into();
1001            self
1002        }
1003
1004        /// Sets the value of [page_token][crate::model::ListRepositoriesRequest::page_token].
1005        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1006            self.0.request.page_token = v.into();
1007            self
1008        }
1009
1010        /// Sets the value of [filter][crate::model::ListRepositoriesRequest::filter].
1011        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1012            self.0.request.filter = v.into();
1013            self
1014        }
1015    }
1016
1017    #[doc(hidden)]
1018    impl gax::options::internal::RequestBuilder for ListRepositories {
1019        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1020            &mut self.0.options
1021        }
1022    }
1023
1024    /// The request builder for [RepositoryManager::delete_repository][super::super::client::RepositoryManager::delete_repository] calls.
1025    ///
1026    /// # Example
1027    /// ```no_run
1028    /// # use google_cloud_build_v2::builder;
1029    /// use builder::repository_manager::DeleteRepository;
1030    /// # tokio_test::block_on(async {
1031    /// let builder = prepare_request_builder();
1032    /// use google_cloud_build_v2::Poller;
1033    /// let response = builder.poller().until_done().await?;
1034    /// # gax::Result::<()>::Ok(()) });
1035    ///
1036    /// fn prepare_request_builder() -> DeleteRepository {
1037    ///   # panic!();
1038    ///   // ... details omitted ...
1039    /// }
1040    /// ```
1041    #[derive(Clone, Debug)]
1042    pub struct DeleteRepository(RequestBuilder<crate::model::DeleteRepositoryRequest>);
1043
1044    impl DeleteRepository {
1045        pub(crate) fn new(
1046            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1047        ) -> Self {
1048            Self(RequestBuilder::new(stub))
1049        }
1050
1051        /// Sets the full request, replacing any prior values.
1052        pub fn with_request<V: Into<crate::model::DeleteRepositoryRequest>>(
1053            mut self,
1054            v: V,
1055        ) -> Self {
1056            self.0.request = v.into();
1057            self
1058        }
1059
1060        /// Sets all the options, replacing any prior values.
1061        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1062            self.0.options = v.into();
1063            self
1064        }
1065
1066        /// Sends the request.
1067        ///
1068        /// # Long running operations
1069        ///
1070        /// This starts, but does not poll, a longrunning operation. More information
1071        /// on [delete_repository][super::super::client::RepositoryManager::delete_repository].
1072        pub async fn send(self) -> Result<longrunning::model::Operation> {
1073            (*self.0.stub)
1074                .delete_repository(self.0.request, self.0.options)
1075                .await
1076                .map(gax::response::Response::into_body)
1077        }
1078
1079        /// Creates a [Poller][lro::Poller] to work with `delete_repository`.
1080        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1081            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1082            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1083            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1084
1085            let stub = self.0.stub.clone();
1086            let mut options = self.0.options.clone();
1087            options.set_retry_policy(gax::retry_policy::NeverRetry);
1088            let query = move |name| {
1089                let stub = stub.clone();
1090                let options = options.clone();
1091                async {
1092                    let op = GetOperation::new(stub)
1093                        .set_name(name)
1094                        .with_options(options)
1095                        .send()
1096                        .await?;
1097                    Ok(Operation::new(op))
1098                }
1099            };
1100
1101            let start = move || async {
1102                let op = self.send().await?;
1103                Ok(Operation::new(op))
1104            };
1105
1106            lro::internal::new_unit_response_poller(
1107                polling_error_policy,
1108                polling_backoff_policy,
1109                start,
1110                query,
1111            )
1112        }
1113
1114        /// Sets the value of [name][crate::model::DeleteRepositoryRequest::name].
1115        ///
1116        /// This is a **required** field for requests.
1117        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1118            self.0.request.name = v.into();
1119            self
1120        }
1121
1122        /// Sets the value of [etag][crate::model::DeleteRepositoryRequest::etag].
1123        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1124            self.0.request.etag = v.into();
1125            self
1126        }
1127
1128        /// Sets the value of [validate_only][crate::model::DeleteRepositoryRequest::validate_only].
1129        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1130            self.0.request.validate_only = v.into();
1131            self
1132        }
1133    }
1134
1135    #[doc(hidden)]
1136    impl gax::options::internal::RequestBuilder for DeleteRepository {
1137        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1138            &mut self.0.options
1139        }
1140    }
1141
1142    /// The request builder for [RepositoryManager::fetch_read_write_token][super::super::client::RepositoryManager::fetch_read_write_token] calls.
1143    ///
1144    /// # Example
1145    /// ```no_run
1146    /// # use google_cloud_build_v2::builder;
1147    /// use builder::repository_manager::FetchReadWriteToken;
1148    /// # tokio_test::block_on(async {
1149    /// let builder = prepare_request_builder();
1150    /// let response = builder.send().await?;
1151    /// # gax::Result::<()>::Ok(()) });
1152    ///
1153    /// fn prepare_request_builder() -> FetchReadWriteToken {
1154    ///   # panic!();
1155    ///   // ... details omitted ...
1156    /// }
1157    /// ```
1158    #[derive(Clone, Debug)]
1159    pub struct FetchReadWriteToken(RequestBuilder<crate::model::FetchReadWriteTokenRequest>);
1160
1161    impl FetchReadWriteToken {
1162        pub(crate) fn new(
1163            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1164        ) -> Self {
1165            Self(RequestBuilder::new(stub))
1166        }
1167
1168        /// Sets the full request, replacing any prior values.
1169        pub fn with_request<V: Into<crate::model::FetchReadWriteTokenRequest>>(
1170            mut self,
1171            v: V,
1172        ) -> Self {
1173            self.0.request = v.into();
1174            self
1175        }
1176
1177        /// Sets all the options, replacing any prior values.
1178        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1179            self.0.options = v.into();
1180            self
1181        }
1182
1183        /// Sends the request.
1184        pub async fn send(self) -> Result<crate::model::FetchReadWriteTokenResponse> {
1185            (*self.0.stub)
1186                .fetch_read_write_token(self.0.request, self.0.options)
1187                .await
1188                .map(gax::response::Response::into_body)
1189        }
1190
1191        /// Sets the value of [repository][crate::model::FetchReadWriteTokenRequest::repository].
1192        ///
1193        /// This is a **required** field for requests.
1194        pub fn set_repository<T: Into<std::string::String>>(mut self, v: T) -> Self {
1195            self.0.request.repository = v.into();
1196            self
1197        }
1198    }
1199
1200    #[doc(hidden)]
1201    impl gax::options::internal::RequestBuilder for FetchReadWriteToken {
1202        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1203            &mut self.0.options
1204        }
1205    }
1206
1207    /// The request builder for [RepositoryManager::fetch_read_token][super::super::client::RepositoryManager::fetch_read_token] calls.
1208    ///
1209    /// # Example
1210    /// ```no_run
1211    /// # use google_cloud_build_v2::builder;
1212    /// use builder::repository_manager::FetchReadToken;
1213    /// # tokio_test::block_on(async {
1214    /// let builder = prepare_request_builder();
1215    /// let response = builder.send().await?;
1216    /// # gax::Result::<()>::Ok(()) });
1217    ///
1218    /// fn prepare_request_builder() -> FetchReadToken {
1219    ///   # panic!();
1220    ///   // ... details omitted ...
1221    /// }
1222    /// ```
1223    #[derive(Clone, Debug)]
1224    pub struct FetchReadToken(RequestBuilder<crate::model::FetchReadTokenRequest>);
1225
1226    impl FetchReadToken {
1227        pub(crate) fn new(
1228            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1229        ) -> Self {
1230            Self(RequestBuilder::new(stub))
1231        }
1232
1233        /// Sets the full request, replacing any prior values.
1234        pub fn with_request<V: Into<crate::model::FetchReadTokenRequest>>(mut self, v: V) -> Self {
1235            self.0.request = v.into();
1236            self
1237        }
1238
1239        /// Sets all the options, replacing any prior values.
1240        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1241            self.0.options = v.into();
1242            self
1243        }
1244
1245        /// Sends the request.
1246        pub async fn send(self) -> Result<crate::model::FetchReadTokenResponse> {
1247            (*self.0.stub)
1248                .fetch_read_token(self.0.request, self.0.options)
1249                .await
1250                .map(gax::response::Response::into_body)
1251        }
1252
1253        /// Sets the value of [repository][crate::model::FetchReadTokenRequest::repository].
1254        ///
1255        /// This is a **required** field for requests.
1256        pub fn set_repository<T: Into<std::string::String>>(mut self, v: T) -> Self {
1257            self.0.request.repository = v.into();
1258            self
1259        }
1260    }
1261
1262    #[doc(hidden)]
1263    impl gax::options::internal::RequestBuilder for FetchReadToken {
1264        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1265            &mut self.0.options
1266        }
1267    }
1268
1269    /// The request builder for [RepositoryManager::fetch_linkable_repositories][super::super::client::RepositoryManager::fetch_linkable_repositories] calls.
1270    ///
1271    /// # Example
1272    /// ```no_run
1273    /// # use google_cloud_build_v2::builder;
1274    /// use builder::repository_manager::FetchLinkableRepositories;
1275    /// # tokio_test::block_on(async {
1276    /// let builder = prepare_request_builder();
1277    /// use gax::paginator::ItemPaginator;
1278    /// let mut items = builder.by_item();
1279    /// while let Some(result) = items.next().await {
1280    ///   let item = result?;
1281    /// }
1282    /// # gax::Result::<()>::Ok(()) });
1283    ///
1284    /// fn prepare_request_builder() -> FetchLinkableRepositories {
1285    ///   # panic!();
1286    ///   // ... details omitted ...
1287    /// }
1288    /// ```
1289    #[derive(Clone, Debug)]
1290    pub struct FetchLinkableRepositories(
1291        RequestBuilder<crate::model::FetchLinkableRepositoriesRequest>,
1292    );
1293
1294    impl FetchLinkableRepositories {
1295        pub(crate) fn new(
1296            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1297        ) -> Self {
1298            Self(RequestBuilder::new(stub))
1299        }
1300
1301        /// Sets the full request, replacing any prior values.
1302        pub fn with_request<V: Into<crate::model::FetchLinkableRepositoriesRequest>>(
1303            mut self,
1304            v: V,
1305        ) -> Self {
1306            self.0.request = v.into();
1307            self
1308        }
1309
1310        /// Sets all the options, replacing any prior values.
1311        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1312            self.0.options = v.into();
1313            self
1314        }
1315
1316        /// Sends the request.
1317        pub async fn send(self) -> Result<crate::model::FetchLinkableRepositoriesResponse> {
1318            (*self.0.stub)
1319                .fetch_linkable_repositories(self.0.request, self.0.options)
1320                .await
1321                .map(gax::response::Response::into_body)
1322        }
1323
1324        /// Streams each page in the collection.
1325        pub fn by_page(
1326            self,
1327        ) -> impl gax::paginator::Paginator<
1328            crate::model::FetchLinkableRepositoriesResponse,
1329            gax::error::Error,
1330        > {
1331            use std::clone::Clone;
1332            let token = self.0.request.page_token.clone();
1333            let execute = move |token: String| {
1334                let mut builder = self.clone();
1335                builder.0.request = builder.0.request.set_page_token(token);
1336                builder.send()
1337            };
1338            gax::paginator::internal::new_paginator(token, execute)
1339        }
1340
1341        /// Streams each item in the collection.
1342        pub fn by_item(
1343            self,
1344        ) -> impl gax::paginator::ItemPaginator<
1345            crate::model::FetchLinkableRepositoriesResponse,
1346            gax::error::Error,
1347        > {
1348            use gax::paginator::Paginator;
1349            self.by_page().items()
1350        }
1351
1352        /// Sets the value of [connection][crate::model::FetchLinkableRepositoriesRequest::connection].
1353        ///
1354        /// This is a **required** field for requests.
1355        pub fn set_connection<T: Into<std::string::String>>(mut self, v: T) -> Self {
1356            self.0.request.connection = v.into();
1357            self
1358        }
1359
1360        /// Sets the value of [page_size][crate::model::FetchLinkableRepositoriesRequest::page_size].
1361        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1362            self.0.request.page_size = v.into();
1363            self
1364        }
1365
1366        /// Sets the value of [page_token][crate::model::FetchLinkableRepositoriesRequest::page_token].
1367        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1368            self.0.request.page_token = v.into();
1369            self
1370        }
1371    }
1372
1373    #[doc(hidden)]
1374    impl gax::options::internal::RequestBuilder for FetchLinkableRepositories {
1375        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1376            &mut self.0.options
1377        }
1378    }
1379
1380    /// The request builder for [RepositoryManager::fetch_git_refs][super::super::client::RepositoryManager::fetch_git_refs] calls.
1381    ///
1382    /// # Example
1383    /// ```no_run
1384    /// # use google_cloud_build_v2::builder;
1385    /// use builder::repository_manager::FetchGitRefs;
1386    /// # tokio_test::block_on(async {
1387    /// let builder = prepare_request_builder();
1388    /// let response = builder.send().await?;
1389    /// # gax::Result::<()>::Ok(()) });
1390    ///
1391    /// fn prepare_request_builder() -> FetchGitRefs {
1392    ///   # panic!();
1393    ///   // ... details omitted ...
1394    /// }
1395    /// ```
1396    #[derive(Clone, Debug)]
1397    pub struct FetchGitRefs(RequestBuilder<crate::model::FetchGitRefsRequest>);
1398
1399    impl FetchGitRefs {
1400        pub(crate) fn new(
1401            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1402        ) -> Self {
1403            Self(RequestBuilder::new(stub))
1404        }
1405
1406        /// Sets the full request, replacing any prior values.
1407        pub fn with_request<V: Into<crate::model::FetchGitRefsRequest>>(mut self, v: V) -> Self {
1408            self.0.request = v.into();
1409            self
1410        }
1411
1412        /// Sets all the options, replacing any prior values.
1413        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1414            self.0.options = v.into();
1415            self
1416        }
1417
1418        /// Sends the request.
1419        pub async fn send(self) -> Result<crate::model::FetchGitRefsResponse> {
1420            (*self.0.stub)
1421                .fetch_git_refs(self.0.request, self.0.options)
1422                .await
1423                .map(gax::response::Response::into_body)
1424        }
1425
1426        /// Sets the value of [repository][crate::model::FetchGitRefsRequest::repository].
1427        ///
1428        /// This is a **required** field for requests.
1429        pub fn set_repository<T: Into<std::string::String>>(mut self, v: T) -> Self {
1430            self.0.request.repository = v.into();
1431            self
1432        }
1433
1434        /// Sets the value of [ref_type][crate::model::FetchGitRefsRequest::ref_type].
1435        pub fn set_ref_type<T: Into<crate::model::fetch_git_refs_request::RefType>>(
1436            mut self,
1437            v: T,
1438        ) -> Self {
1439            self.0.request.ref_type = v.into();
1440            self
1441        }
1442    }
1443
1444    #[doc(hidden)]
1445    impl gax::options::internal::RequestBuilder for FetchGitRefs {
1446        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1447            &mut self.0.options
1448        }
1449    }
1450
1451    /// The request builder for [RepositoryManager::set_iam_policy][super::super::client::RepositoryManager::set_iam_policy] calls.
1452    ///
1453    /// # Example
1454    /// ```no_run
1455    /// # use google_cloud_build_v2::builder;
1456    /// use builder::repository_manager::SetIamPolicy;
1457    /// # tokio_test::block_on(async {
1458    /// let builder = prepare_request_builder();
1459    /// let response = builder.send().await?;
1460    /// # gax::Result::<()>::Ok(()) });
1461    ///
1462    /// fn prepare_request_builder() -> SetIamPolicy {
1463    ///   # panic!();
1464    ///   // ... details omitted ...
1465    /// }
1466    /// ```
1467    #[derive(Clone, Debug)]
1468    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1469
1470    impl SetIamPolicy {
1471        pub(crate) fn new(
1472            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1473        ) -> Self {
1474            Self(RequestBuilder::new(stub))
1475        }
1476
1477        /// Sets the full request, replacing any prior values.
1478        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1479            self.0.request = v.into();
1480            self
1481        }
1482
1483        /// Sets all the options, replacing any prior values.
1484        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        /// Sends the request.
1490        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1491            (*self.0.stub)
1492                .set_iam_policy(self.0.request, self.0.options)
1493                .await
1494                .map(gax::response::Response::into_body)
1495        }
1496
1497        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1498        ///
1499        /// This is a **required** field for requests.
1500        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1501            self.0.request.resource = v.into();
1502            self
1503        }
1504
1505        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1506        ///
1507        /// This is a **required** field for requests.
1508        pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
1509            mut self,
1510            v: T,
1511        ) -> Self {
1512            self.0.request.policy = v.into();
1513            self
1514        }
1515
1516        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1517        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1518            mut self,
1519            v: T,
1520        ) -> Self {
1521            self.0.request.update_mask = v.into();
1522            self
1523        }
1524    }
1525
1526    #[doc(hidden)]
1527    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1528        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1529            &mut self.0.options
1530        }
1531    }
1532
1533    /// The request builder for [RepositoryManager::get_iam_policy][super::super::client::RepositoryManager::get_iam_policy] calls.
1534    ///
1535    /// # Example
1536    /// ```no_run
1537    /// # use google_cloud_build_v2::builder;
1538    /// use builder::repository_manager::GetIamPolicy;
1539    /// # tokio_test::block_on(async {
1540    /// let builder = prepare_request_builder();
1541    /// let response = builder.send().await?;
1542    /// # gax::Result::<()>::Ok(()) });
1543    ///
1544    /// fn prepare_request_builder() -> GetIamPolicy {
1545    ///   # panic!();
1546    ///   // ... details omitted ...
1547    /// }
1548    /// ```
1549    #[derive(Clone, Debug)]
1550    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1551
1552    impl GetIamPolicy {
1553        pub(crate) fn new(
1554            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1555        ) -> Self {
1556            Self(RequestBuilder::new(stub))
1557        }
1558
1559        /// Sets the full request, replacing any prior values.
1560        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1561            self.0.request = v.into();
1562            self
1563        }
1564
1565        /// Sets all the options, replacing any prior values.
1566        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1567            self.0.options = v.into();
1568            self
1569        }
1570
1571        /// Sends the request.
1572        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1573            (*self.0.stub)
1574                .get_iam_policy(self.0.request, self.0.options)
1575                .await
1576                .map(gax::response::Response::into_body)
1577        }
1578
1579        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1580        ///
1581        /// This is a **required** field for requests.
1582        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1583            self.0.request.resource = v.into();
1584            self
1585        }
1586
1587        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1588        pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
1589            mut self,
1590            v: T,
1591        ) -> Self {
1592            self.0.request.options = v.into();
1593            self
1594        }
1595    }
1596
1597    #[doc(hidden)]
1598    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1599        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1600            &mut self.0.options
1601        }
1602    }
1603
1604    /// The request builder for [RepositoryManager::test_iam_permissions][super::super::client::RepositoryManager::test_iam_permissions] calls.
1605    ///
1606    /// # Example
1607    /// ```no_run
1608    /// # use google_cloud_build_v2::builder;
1609    /// use builder::repository_manager::TestIamPermissions;
1610    /// # tokio_test::block_on(async {
1611    /// let builder = prepare_request_builder();
1612    /// let response = builder.send().await?;
1613    /// # gax::Result::<()>::Ok(()) });
1614    ///
1615    /// fn prepare_request_builder() -> TestIamPermissions {
1616    ///   # panic!();
1617    ///   // ... details omitted ...
1618    /// }
1619    /// ```
1620    #[derive(Clone, Debug)]
1621    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1622
1623    impl TestIamPermissions {
1624        pub(crate) fn new(
1625            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1626        ) -> Self {
1627            Self(RequestBuilder::new(stub))
1628        }
1629
1630        /// Sets the full request, replacing any prior values.
1631        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1632            mut self,
1633            v: V,
1634        ) -> Self {
1635            self.0.request = v.into();
1636            self
1637        }
1638
1639        /// Sets all the options, replacing any prior values.
1640        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1641            self.0.options = v.into();
1642            self
1643        }
1644
1645        /// Sends the request.
1646        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1647            (*self.0.stub)
1648                .test_iam_permissions(self.0.request, self.0.options)
1649                .await
1650                .map(gax::response::Response::into_body)
1651        }
1652
1653        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1654        ///
1655        /// This is a **required** field for requests.
1656        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1657            self.0.request.resource = v.into();
1658            self
1659        }
1660
1661        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1662        ///
1663        /// This is a **required** field for requests.
1664        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1665        where
1666            T: std::iter::IntoIterator<Item = V>,
1667            V: std::convert::Into<std::string::String>,
1668        {
1669            use std::iter::Iterator;
1670            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1671            self
1672        }
1673    }
1674
1675    #[doc(hidden)]
1676    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1677        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1678            &mut self.0.options
1679        }
1680    }
1681
1682    /// The request builder for [RepositoryManager::get_operation][super::super::client::RepositoryManager::get_operation] calls.
1683    ///
1684    /// # Example
1685    /// ```no_run
1686    /// # use google_cloud_build_v2::builder;
1687    /// use builder::repository_manager::GetOperation;
1688    /// # tokio_test::block_on(async {
1689    /// let builder = prepare_request_builder();
1690    /// let response = builder.send().await?;
1691    /// # gax::Result::<()>::Ok(()) });
1692    ///
1693    /// fn prepare_request_builder() -> GetOperation {
1694    ///   # panic!();
1695    ///   // ... details omitted ...
1696    /// }
1697    /// ```
1698    #[derive(Clone, Debug)]
1699    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1700
1701    impl GetOperation {
1702        pub(crate) fn new(
1703            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1704        ) -> Self {
1705            Self(RequestBuilder::new(stub))
1706        }
1707
1708        /// Sets the full request, replacing any prior values.
1709        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1710            mut self,
1711            v: V,
1712        ) -> Self {
1713            self.0.request = v.into();
1714            self
1715        }
1716
1717        /// Sets all the options, replacing any prior values.
1718        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1719            self.0.options = v.into();
1720            self
1721        }
1722
1723        /// Sends the request.
1724        pub async fn send(self) -> Result<longrunning::model::Operation> {
1725            (*self.0.stub)
1726                .get_operation(self.0.request, self.0.options)
1727                .await
1728                .map(gax::response::Response::into_body)
1729        }
1730
1731        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1732        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1733            self.0.request.name = v.into();
1734            self
1735        }
1736    }
1737
1738    #[doc(hidden)]
1739    impl gax::options::internal::RequestBuilder for GetOperation {
1740        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1741            &mut self.0.options
1742        }
1743    }
1744
1745    /// The request builder for [RepositoryManager::cancel_operation][super::super::client::RepositoryManager::cancel_operation] calls.
1746    ///
1747    /// # Example
1748    /// ```no_run
1749    /// # use google_cloud_build_v2::builder;
1750    /// use builder::repository_manager::CancelOperation;
1751    /// # tokio_test::block_on(async {
1752    /// let builder = prepare_request_builder();
1753    /// let response = builder.send().await?;
1754    /// # gax::Result::<()>::Ok(()) });
1755    ///
1756    /// fn prepare_request_builder() -> CancelOperation {
1757    ///   # panic!();
1758    ///   // ... details omitted ...
1759    /// }
1760    /// ```
1761    #[derive(Clone, Debug)]
1762    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1763
1764    impl CancelOperation {
1765        pub(crate) fn new(
1766            stub: std::sync::Arc<dyn super::super::stub::dynamic::RepositoryManager>,
1767        ) -> Self {
1768            Self(RequestBuilder::new(stub))
1769        }
1770
1771        /// Sets the full request, replacing any prior values.
1772        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1773            mut self,
1774            v: V,
1775        ) -> Self {
1776            self.0.request = v.into();
1777            self
1778        }
1779
1780        /// Sets all the options, replacing any prior values.
1781        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1782            self.0.options = v.into();
1783            self
1784        }
1785
1786        /// Sends the request.
1787        pub async fn send(self) -> Result<()> {
1788            (*self.0.stub)
1789                .cancel_operation(self.0.request, self.0.options)
1790                .await
1791                .map(gax::response::Response::into_body)
1792        }
1793
1794        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1795        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1796            self.0.request.name = v.into();
1797            self
1798        }
1799    }
1800
1801    #[doc(hidden)]
1802    impl gax::options::internal::RequestBuilder for CancelOperation {
1803        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1804            &mut self.0.options
1805        }
1806    }
1807}