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