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