google_cloud_build_v2/model.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#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Represents the metadata of the long-running operation.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct OperationMetadata {
45 /// Output only. The time the operation was created.
46 pub create_time: std::option::Option<wkt::Timestamp>,
47
48 /// Output only. The time the operation finished running.
49 pub end_time: std::option::Option<wkt::Timestamp>,
50
51 /// Output only. Server-defined resource path for the target of the operation.
52 pub target: std::string::String,
53
54 /// Output only. Name of the verb executed by the operation.
55 pub verb: std::string::String,
56
57 /// Output only. Human-readable status of the operation, if any.
58 pub status_message: std::string::String,
59
60 /// Output only. Identifies whether the user has requested cancellation
61 /// of the operation. Operations that have successfully been cancelled
62 /// have [Operation.error][] value with a
63 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
64 /// `Code.CANCELLED`.
65 ///
66 /// [google.rpc.Status.code]: rpc::model::Status::code
67 pub requested_cancellation: bool,
68
69 /// Output only. API version used to start the operation.
70 pub api_version: std::string::String,
71
72 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
73}
74
75impl OperationMetadata {
76 pub fn new() -> Self {
77 std::default::Default::default()
78 }
79
80 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
81 ///
82 /// # Example
83 /// ```ignore,no_run
84 /// # use google_cloud_build_v2::model::OperationMetadata;
85 /// use wkt::Timestamp;
86 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
87 /// ```
88 pub fn set_create_time<T>(mut self, v: T) -> Self
89 where
90 T: std::convert::Into<wkt::Timestamp>,
91 {
92 self.create_time = std::option::Option::Some(v.into());
93 self
94 }
95
96 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_build_v2::model::OperationMetadata;
101 /// use wkt::Timestamp;
102 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
103 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
104 /// ```
105 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
106 where
107 T: std::convert::Into<wkt::Timestamp>,
108 {
109 self.create_time = v.map(|x| x.into());
110 self
111 }
112
113 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
114 ///
115 /// # Example
116 /// ```ignore,no_run
117 /// # use google_cloud_build_v2::model::OperationMetadata;
118 /// use wkt::Timestamp;
119 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
120 /// ```
121 pub fn set_end_time<T>(mut self, v: T) -> Self
122 where
123 T: std::convert::Into<wkt::Timestamp>,
124 {
125 self.end_time = std::option::Option::Some(v.into());
126 self
127 }
128
129 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
130 ///
131 /// # Example
132 /// ```ignore,no_run
133 /// # use google_cloud_build_v2::model::OperationMetadata;
134 /// use wkt::Timestamp;
135 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
136 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
137 /// ```
138 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
139 where
140 T: std::convert::Into<wkt::Timestamp>,
141 {
142 self.end_time = v.map(|x| x.into());
143 self
144 }
145
146 /// Sets the value of [target][crate::model::OperationMetadata::target].
147 ///
148 /// # Example
149 /// ```ignore,no_run
150 /// # use google_cloud_build_v2::model::OperationMetadata;
151 /// let x = OperationMetadata::new().set_target("example");
152 /// ```
153 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
154 self.target = v.into();
155 self
156 }
157
158 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
159 ///
160 /// # Example
161 /// ```ignore,no_run
162 /// # use google_cloud_build_v2::model::OperationMetadata;
163 /// let x = OperationMetadata::new().set_verb("example");
164 /// ```
165 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
166 self.verb = v.into();
167 self
168 }
169
170 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
171 ///
172 /// # Example
173 /// ```ignore,no_run
174 /// # use google_cloud_build_v2::model::OperationMetadata;
175 /// let x = OperationMetadata::new().set_status_message("example");
176 /// ```
177 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
178 self.status_message = v.into();
179 self
180 }
181
182 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
183 ///
184 /// # Example
185 /// ```ignore,no_run
186 /// # use google_cloud_build_v2::model::OperationMetadata;
187 /// let x = OperationMetadata::new().set_requested_cancellation(true);
188 /// ```
189 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
190 self.requested_cancellation = v.into();
191 self
192 }
193
194 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
195 ///
196 /// # Example
197 /// ```ignore,no_run
198 /// # use google_cloud_build_v2::model::OperationMetadata;
199 /// let x = OperationMetadata::new().set_api_version("example");
200 /// ```
201 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
202 self.api_version = v.into();
203 self
204 }
205}
206
207impl wkt::message::Message for OperationMetadata {
208 fn typename() -> &'static str {
209 "type.googleapis.com/google.devtools.cloudbuild.v2.OperationMetadata"
210 }
211}
212
213/// Represents the custom metadata of the RunWorkflow long-running operation.
214#[derive(Clone, Default, PartialEq)]
215#[non_exhaustive]
216pub struct RunWorkflowCustomOperationMetadata {
217 /// Output only. The time the operation was created.
218 pub create_time: std::option::Option<wkt::Timestamp>,
219
220 /// Output only. The time the operation finished running.
221 pub end_time: std::option::Option<wkt::Timestamp>,
222
223 /// Output only. Name of the verb executed by the operation.
224 pub verb: std::string::String,
225
226 /// Output only. Identifies whether the user has requested cancellation
227 /// of the operation. Operations that have successfully been cancelled
228 /// have [Operation.error][] value with a
229 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
230 /// `Code.CANCELLED`.
231 ///
232 /// [google.rpc.Status.code]: rpc::model::Status::code
233 pub requested_cancellation: bool,
234
235 /// Output only. API version used to start the operation.
236 pub api_version: std::string::String,
237
238 /// Output only. Server-defined resource path for the target of the operation.
239 pub target: std::string::String,
240
241 /// Output only. ID of the pipeline run created by RunWorkflow.
242 pub pipeline_run_id: std::string::String,
243
244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
245}
246
247impl RunWorkflowCustomOperationMetadata {
248 pub fn new() -> Self {
249 std::default::Default::default()
250 }
251
252 /// Sets the value of [create_time][crate::model::RunWorkflowCustomOperationMetadata::create_time].
253 ///
254 /// # Example
255 /// ```ignore,no_run
256 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
257 /// use wkt::Timestamp;
258 /// let x = RunWorkflowCustomOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
259 /// ```
260 pub fn set_create_time<T>(mut self, v: T) -> Self
261 where
262 T: std::convert::Into<wkt::Timestamp>,
263 {
264 self.create_time = std::option::Option::Some(v.into());
265 self
266 }
267
268 /// Sets or clears the value of [create_time][crate::model::RunWorkflowCustomOperationMetadata::create_time].
269 ///
270 /// # Example
271 /// ```ignore,no_run
272 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
273 /// use wkt::Timestamp;
274 /// let x = RunWorkflowCustomOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
275 /// let x = RunWorkflowCustomOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
276 /// ```
277 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
278 where
279 T: std::convert::Into<wkt::Timestamp>,
280 {
281 self.create_time = v.map(|x| x.into());
282 self
283 }
284
285 /// Sets the value of [end_time][crate::model::RunWorkflowCustomOperationMetadata::end_time].
286 ///
287 /// # Example
288 /// ```ignore,no_run
289 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
290 /// use wkt::Timestamp;
291 /// let x = RunWorkflowCustomOperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
292 /// ```
293 pub fn set_end_time<T>(mut self, v: T) -> Self
294 where
295 T: std::convert::Into<wkt::Timestamp>,
296 {
297 self.end_time = std::option::Option::Some(v.into());
298 self
299 }
300
301 /// Sets or clears the value of [end_time][crate::model::RunWorkflowCustomOperationMetadata::end_time].
302 ///
303 /// # Example
304 /// ```ignore,no_run
305 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
306 /// use wkt::Timestamp;
307 /// let x = RunWorkflowCustomOperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
308 /// let x = RunWorkflowCustomOperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
309 /// ```
310 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
311 where
312 T: std::convert::Into<wkt::Timestamp>,
313 {
314 self.end_time = v.map(|x| x.into());
315 self
316 }
317
318 /// Sets the value of [verb][crate::model::RunWorkflowCustomOperationMetadata::verb].
319 ///
320 /// # Example
321 /// ```ignore,no_run
322 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
323 /// let x = RunWorkflowCustomOperationMetadata::new().set_verb("example");
324 /// ```
325 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
326 self.verb = v.into();
327 self
328 }
329
330 /// Sets the value of [requested_cancellation][crate::model::RunWorkflowCustomOperationMetadata::requested_cancellation].
331 ///
332 /// # Example
333 /// ```ignore,no_run
334 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
335 /// let x = RunWorkflowCustomOperationMetadata::new().set_requested_cancellation(true);
336 /// ```
337 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
338 self.requested_cancellation = v.into();
339 self
340 }
341
342 /// Sets the value of [api_version][crate::model::RunWorkflowCustomOperationMetadata::api_version].
343 ///
344 /// # Example
345 /// ```ignore,no_run
346 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
347 /// let x = RunWorkflowCustomOperationMetadata::new().set_api_version("example");
348 /// ```
349 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
350 self.api_version = v.into();
351 self
352 }
353
354 /// Sets the value of [target][crate::model::RunWorkflowCustomOperationMetadata::target].
355 ///
356 /// # Example
357 /// ```ignore,no_run
358 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
359 /// let x = RunWorkflowCustomOperationMetadata::new().set_target("example");
360 /// ```
361 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
362 self.target = v.into();
363 self
364 }
365
366 /// Sets the value of [pipeline_run_id][crate::model::RunWorkflowCustomOperationMetadata::pipeline_run_id].
367 ///
368 /// # Example
369 /// ```ignore,no_run
370 /// # use google_cloud_build_v2::model::RunWorkflowCustomOperationMetadata;
371 /// let x = RunWorkflowCustomOperationMetadata::new().set_pipeline_run_id("example");
372 /// ```
373 pub fn set_pipeline_run_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
374 self.pipeline_run_id = v.into();
375 self
376 }
377}
378
379impl wkt::message::Message for RunWorkflowCustomOperationMetadata {
380 fn typename() -> &'static str {
381 "type.googleapis.com/google.devtools.cloudbuild.v2.RunWorkflowCustomOperationMetadata"
382 }
383}
384
385/// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center,
386/// Bitbucket Cloud or GitLab.
387#[derive(Clone, Default, PartialEq)]
388#[non_exhaustive]
389pub struct Connection {
390 /// Immutable. The resource name of the connection, in the format
391 /// `projects/{project}/locations/{location}/connections/{connection_id}`.
392 pub name: std::string::String,
393
394 /// Output only. Server assigned timestamp for when the connection was created.
395 pub create_time: std::option::Option<wkt::Timestamp>,
396
397 /// Output only. Server assigned timestamp for when the connection was updated.
398 pub update_time: std::option::Option<wkt::Timestamp>,
399
400 /// Output only. Installation state of the Connection.
401 pub installation_state: std::option::Option<crate::model::InstallationState>,
402
403 /// If disabled is set to true, functionality is disabled for this connection.
404 /// Repository based API methods and webhooks processing for repositories in
405 /// this connection will be disabled.
406 pub disabled: bool,
407
408 /// Output only. Set to true when the connection is being set up or updated in
409 /// the background.
410 pub reconciling: bool,
411
412 /// Allows clients to store small amounts of arbitrary data.
413 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
414
415 /// This checksum is computed by the server based on the value of other
416 /// fields, and may be sent on update and delete requests to ensure the
417 /// client has an up-to-date value before proceeding.
418 pub etag: std::string::String,
419
420 /// Configuration for the connection depending on the type of provider.
421 pub connection_config: std::option::Option<crate::model::connection::ConnectionConfig>,
422
423 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
424}
425
426impl Connection {
427 pub fn new() -> Self {
428 std::default::Default::default()
429 }
430
431 /// Sets the value of [name][crate::model::Connection::name].
432 ///
433 /// # Example
434 /// ```ignore,no_run
435 /// # use google_cloud_build_v2::model::Connection;
436 /// let x = Connection::new().set_name("example");
437 /// ```
438 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
439 self.name = v.into();
440 self
441 }
442
443 /// Sets the value of [create_time][crate::model::Connection::create_time].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_build_v2::model::Connection;
448 /// use wkt::Timestamp;
449 /// let x = Connection::new().set_create_time(Timestamp::default()/* use setters */);
450 /// ```
451 pub fn set_create_time<T>(mut self, v: T) -> Self
452 where
453 T: std::convert::Into<wkt::Timestamp>,
454 {
455 self.create_time = std::option::Option::Some(v.into());
456 self
457 }
458
459 /// Sets or clears the value of [create_time][crate::model::Connection::create_time].
460 ///
461 /// # Example
462 /// ```ignore,no_run
463 /// # use google_cloud_build_v2::model::Connection;
464 /// use wkt::Timestamp;
465 /// let x = Connection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
466 /// let x = Connection::new().set_or_clear_create_time(None::<Timestamp>);
467 /// ```
468 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
469 where
470 T: std::convert::Into<wkt::Timestamp>,
471 {
472 self.create_time = v.map(|x| x.into());
473 self
474 }
475
476 /// Sets the value of [update_time][crate::model::Connection::update_time].
477 ///
478 /// # Example
479 /// ```ignore,no_run
480 /// # use google_cloud_build_v2::model::Connection;
481 /// use wkt::Timestamp;
482 /// let x = Connection::new().set_update_time(Timestamp::default()/* use setters */);
483 /// ```
484 pub fn set_update_time<T>(mut self, v: T) -> Self
485 where
486 T: std::convert::Into<wkt::Timestamp>,
487 {
488 self.update_time = std::option::Option::Some(v.into());
489 self
490 }
491
492 /// Sets or clears the value of [update_time][crate::model::Connection::update_time].
493 ///
494 /// # Example
495 /// ```ignore,no_run
496 /// # use google_cloud_build_v2::model::Connection;
497 /// use wkt::Timestamp;
498 /// let x = Connection::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
499 /// let x = Connection::new().set_or_clear_update_time(None::<Timestamp>);
500 /// ```
501 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
502 where
503 T: std::convert::Into<wkt::Timestamp>,
504 {
505 self.update_time = v.map(|x| x.into());
506 self
507 }
508
509 /// Sets the value of [installation_state][crate::model::Connection::installation_state].
510 ///
511 /// # Example
512 /// ```ignore,no_run
513 /// # use google_cloud_build_v2::model::Connection;
514 /// use google_cloud_build_v2::model::InstallationState;
515 /// let x = Connection::new().set_installation_state(InstallationState::default()/* use setters */);
516 /// ```
517 pub fn set_installation_state<T>(mut self, v: T) -> Self
518 where
519 T: std::convert::Into<crate::model::InstallationState>,
520 {
521 self.installation_state = std::option::Option::Some(v.into());
522 self
523 }
524
525 /// Sets or clears the value of [installation_state][crate::model::Connection::installation_state].
526 ///
527 /// # Example
528 /// ```ignore,no_run
529 /// # use google_cloud_build_v2::model::Connection;
530 /// use google_cloud_build_v2::model::InstallationState;
531 /// let x = Connection::new().set_or_clear_installation_state(Some(InstallationState::default()/* use setters */));
532 /// let x = Connection::new().set_or_clear_installation_state(None::<InstallationState>);
533 /// ```
534 pub fn set_or_clear_installation_state<T>(mut self, v: std::option::Option<T>) -> Self
535 where
536 T: std::convert::Into<crate::model::InstallationState>,
537 {
538 self.installation_state = v.map(|x| x.into());
539 self
540 }
541
542 /// Sets the value of [disabled][crate::model::Connection::disabled].
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_build_v2::model::Connection;
547 /// let x = Connection::new().set_disabled(true);
548 /// ```
549 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
550 self.disabled = v.into();
551 self
552 }
553
554 /// Sets the value of [reconciling][crate::model::Connection::reconciling].
555 ///
556 /// # Example
557 /// ```ignore,no_run
558 /// # use google_cloud_build_v2::model::Connection;
559 /// let x = Connection::new().set_reconciling(true);
560 /// ```
561 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
562 self.reconciling = v.into();
563 self
564 }
565
566 /// Sets the value of [annotations][crate::model::Connection::annotations].
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_build_v2::model::Connection;
571 /// let x = Connection::new().set_annotations([
572 /// ("key0", "abc"),
573 /// ("key1", "xyz"),
574 /// ]);
575 /// ```
576 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
577 where
578 T: std::iter::IntoIterator<Item = (K, V)>,
579 K: std::convert::Into<std::string::String>,
580 V: std::convert::Into<std::string::String>,
581 {
582 use std::iter::Iterator;
583 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
584 self
585 }
586
587 /// Sets the value of [etag][crate::model::Connection::etag].
588 ///
589 /// # Example
590 /// ```ignore,no_run
591 /// # use google_cloud_build_v2::model::Connection;
592 /// let x = Connection::new().set_etag("example");
593 /// ```
594 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
595 self.etag = v.into();
596 self
597 }
598
599 /// Sets the value of [connection_config][crate::model::Connection::connection_config].
600 ///
601 /// Note that all the setters affecting `connection_config` are mutually
602 /// exclusive.
603 ///
604 /// # Example
605 /// ```ignore,no_run
606 /// # use google_cloud_build_v2::model::Connection;
607 /// use google_cloud_build_v2::model::GitHubConfig;
608 /// let x = Connection::new().set_connection_config(Some(
609 /// google_cloud_build_v2::model::connection::ConnectionConfig::GithubConfig(GitHubConfig::default().into())));
610 /// ```
611 pub fn set_connection_config<
612 T: std::convert::Into<std::option::Option<crate::model::connection::ConnectionConfig>>,
613 >(
614 mut self,
615 v: T,
616 ) -> Self {
617 self.connection_config = v.into();
618 self
619 }
620
621 /// The value of [connection_config][crate::model::Connection::connection_config]
622 /// if it holds a `GithubConfig`, `None` if the field is not set or
623 /// holds a different branch.
624 pub fn github_config(
625 &self,
626 ) -> std::option::Option<&std::boxed::Box<crate::model::GitHubConfig>> {
627 #[allow(unreachable_patterns)]
628 self.connection_config.as_ref().and_then(|v| match v {
629 crate::model::connection::ConnectionConfig::GithubConfig(v) => {
630 std::option::Option::Some(v)
631 }
632 _ => std::option::Option::None,
633 })
634 }
635
636 /// Sets the value of [connection_config][crate::model::Connection::connection_config]
637 /// to hold a `GithubConfig`.
638 ///
639 /// Note that all the setters affecting `connection_config` are
640 /// mutually exclusive.
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_build_v2::model::Connection;
645 /// use google_cloud_build_v2::model::GitHubConfig;
646 /// let x = Connection::new().set_github_config(GitHubConfig::default()/* use setters */);
647 /// assert!(x.github_config().is_some());
648 /// assert!(x.github_enterprise_config().is_none());
649 /// assert!(x.gitlab_config().is_none());
650 /// assert!(x.bitbucket_data_center_config().is_none());
651 /// assert!(x.bitbucket_cloud_config().is_none());
652 /// ```
653 pub fn set_github_config<T: std::convert::Into<std::boxed::Box<crate::model::GitHubConfig>>>(
654 mut self,
655 v: T,
656 ) -> Self {
657 self.connection_config = std::option::Option::Some(
658 crate::model::connection::ConnectionConfig::GithubConfig(v.into()),
659 );
660 self
661 }
662
663 /// The value of [connection_config][crate::model::Connection::connection_config]
664 /// if it holds a `GithubEnterpriseConfig`, `None` if the field is not set or
665 /// holds a different branch.
666 pub fn github_enterprise_config(
667 &self,
668 ) -> std::option::Option<&std::boxed::Box<crate::model::GitHubEnterpriseConfig>> {
669 #[allow(unreachable_patterns)]
670 self.connection_config.as_ref().and_then(|v| match v {
671 crate::model::connection::ConnectionConfig::GithubEnterpriseConfig(v) => {
672 std::option::Option::Some(v)
673 }
674 _ => std::option::Option::None,
675 })
676 }
677
678 /// Sets the value of [connection_config][crate::model::Connection::connection_config]
679 /// to hold a `GithubEnterpriseConfig`.
680 ///
681 /// Note that all the setters affecting `connection_config` are
682 /// mutually exclusive.
683 ///
684 /// # Example
685 /// ```ignore,no_run
686 /// # use google_cloud_build_v2::model::Connection;
687 /// use google_cloud_build_v2::model::GitHubEnterpriseConfig;
688 /// let x = Connection::new().set_github_enterprise_config(GitHubEnterpriseConfig::default()/* use setters */);
689 /// assert!(x.github_enterprise_config().is_some());
690 /// assert!(x.github_config().is_none());
691 /// assert!(x.gitlab_config().is_none());
692 /// assert!(x.bitbucket_data_center_config().is_none());
693 /// assert!(x.bitbucket_cloud_config().is_none());
694 /// ```
695 pub fn set_github_enterprise_config<
696 T: std::convert::Into<std::boxed::Box<crate::model::GitHubEnterpriseConfig>>,
697 >(
698 mut self,
699 v: T,
700 ) -> Self {
701 self.connection_config = std::option::Option::Some(
702 crate::model::connection::ConnectionConfig::GithubEnterpriseConfig(v.into()),
703 );
704 self
705 }
706
707 /// The value of [connection_config][crate::model::Connection::connection_config]
708 /// if it holds a `GitlabConfig`, `None` if the field is not set or
709 /// holds a different branch.
710 pub fn gitlab_config(
711 &self,
712 ) -> std::option::Option<&std::boxed::Box<crate::model::GitLabConfig>> {
713 #[allow(unreachable_patterns)]
714 self.connection_config.as_ref().and_then(|v| match v {
715 crate::model::connection::ConnectionConfig::GitlabConfig(v) => {
716 std::option::Option::Some(v)
717 }
718 _ => std::option::Option::None,
719 })
720 }
721
722 /// Sets the value of [connection_config][crate::model::Connection::connection_config]
723 /// to hold a `GitlabConfig`.
724 ///
725 /// Note that all the setters affecting `connection_config` are
726 /// mutually exclusive.
727 ///
728 /// # Example
729 /// ```ignore,no_run
730 /// # use google_cloud_build_v2::model::Connection;
731 /// use google_cloud_build_v2::model::GitLabConfig;
732 /// let x = Connection::new().set_gitlab_config(GitLabConfig::default()/* use setters */);
733 /// assert!(x.gitlab_config().is_some());
734 /// assert!(x.github_config().is_none());
735 /// assert!(x.github_enterprise_config().is_none());
736 /// assert!(x.bitbucket_data_center_config().is_none());
737 /// assert!(x.bitbucket_cloud_config().is_none());
738 /// ```
739 pub fn set_gitlab_config<T: std::convert::Into<std::boxed::Box<crate::model::GitLabConfig>>>(
740 mut self,
741 v: T,
742 ) -> Self {
743 self.connection_config = std::option::Option::Some(
744 crate::model::connection::ConnectionConfig::GitlabConfig(v.into()),
745 );
746 self
747 }
748
749 /// The value of [connection_config][crate::model::Connection::connection_config]
750 /// if it holds a `BitbucketDataCenterConfig`, `None` if the field is not set or
751 /// holds a different branch.
752 pub fn bitbucket_data_center_config(
753 &self,
754 ) -> std::option::Option<&std::boxed::Box<crate::model::BitbucketDataCenterConfig>> {
755 #[allow(unreachable_patterns)]
756 self.connection_config.as_ref().and_then(|v| match v {
757 crate::model::connection::ConnectionConfig::BitbucketDataCenterConfig(v) => {
758 std::option::Option::Some(v)
759 }
760 _ => std::option::Option::None,
761 })
762 }
763
764 /// Sets the value of [connection_config][crate::model::Connection::connection_config]
765 /// to hold a `BitbucketDataCenterConfig`.
766 ///
767 /// Note that all the setters affecting `connection_config` are
768 /// mutually exclusive.
769 ///
770 /// # Example
771 /// ```ignore,no_run
772 /// # use google_cloud_build_v2::model::Connection;
773 /// use google_cloud_build_v2::model::BitbucketDataCenterConfig;
774 /// let x = Connection::new().set_bitbucket_data_center_config(BitbucketDataCenterConfig::default()/* use setters */);
775 /// assert!(x.bitbucket_data_center_config().is_some());
776 /// assert!(x.github_config().is_none());
777 /// assert!(x.github_enterprise_config().is_none());
778 /// assert!(x.gitlab_config().is_none());
779 /// assert!(x.bitbucket_cloud_config().is_none());
780 /// ```
781 pub fn set_bitbucket_data_center_config<
782 T: std::convert::Into<std::boxed::Box<crate::model::BitbucketDataCenterConfig>>,
783 >(
784 mut self,
785 v: T,
786 ) -> Self {
787 self.connection_config = std::option::Option::Some(
788 crate::model::connection::ConnectionConfig::BitbucketDataCenterConfig(v.into()),
789 );
790 self
791 }
792
793 /// The value of [connection_config][crate::model::Connection::connection_config]
794 /// if it holds a `BitbucketCloudConfig`, `None` if the field is not set or
795 /// holds a different branch.
796 pub fn bitbucket_cloud_config(
797 &self,
798 ) -> std::option::Option<&std::boxed::Box<crate::model::BitbucketCloudConfig>> {
799 #[allow(unreachable_patterns)]
800 self.connection_config.as_ref().and_then(|v| match v {
801 crate::model::connection::ConnectionConfig::BitbucketCloudConfig(v) => {
802 std::option::Option::Some(v)
803 }
804 _ => std::option::Option::None,
805 })
806 }
807
808 /// Sets the value of [connection_config][crate::model::Connection::connection_config]
809 /// to hold a `BitbucketCloudConfig`.
810 ///
811 /// Note that all the setters affecting `connection_config` are
812 /// mutually exclusive.
813 ///
814 /// # Example
815 /// ```ignore,no_run
816 /// # use google_cloud_build_v2::model::Connection;
817 /// use google_cloud_build_v2::model::BitbucketCloudConfig;
818 /// let x = Connection::new().set_bitbucket_cloud_config(BitbucketCloudConfig::default()/* use setters */);
819 /// assert!(x.bitbucket_cloud_config().is_some());
820 /// assert!(x.github_config().is_none());
821 /// assert!(x.github_enterprise_config().is_none());
822 /// assert!(x.gitlab_config().is_none());
823 /// assert!(x.bitbucket_data_center_config().is_none());
824 /// ```
825 pub fn set_bitbucket_cloud_config<
826 T: std::convert::Into<std::boxed::Box<crate::model::BitbucketCloudConfig>>,
827 >(
828 mut self,
829 v: T,
830 ) -> Self {
831 self.connection_config = std::option::Option::Some(
832 crate::model::connection::ConnectionConfig::BitbucketCloudConfig(v.into()),
833 );
834 self
835 }
836}
837
838impl wkt::message::Message for Connection {
839 fn typename() -> &'static str {
840 "type.googleapis.com/google.devtools.cloudbuild.v2.Connection"
841 }
842}
843
844/// Defines additional types related to [Connection].
845pub mod connection {
846 #[allow(unused_imports)]
847 use super::*;
848
849 /// Configuration for the connection depending on the type of provider.
850 #[derive(Clone, Debug, PartialEq)]
851 #[non_exhaustive]
852 pub enum ConnectionConfig {
853 /// Configuration for connections to github.com.
854 GithubConfig(std::boxed::Box<crate::model::GitHubConfig>),
855 /// Configuration for connections to an instance of GitHub Enterprise.
856 GithubEnterpriseConfig(std::boxed::Box<crate::model::GitHubEnterpriseConfig>),
857 /// Configuration for connections to gitlab.com or an instance of GitLab
858 /// Enterprise.
859 GitlabConfig(std::boxed::Box<crate::model::GitLabConfig>),
860 /// Configuration for connections to Bitbucket Data Center.
861 BitbucketDataCenterConfig(std::boxed::Box<crate::model::BitbucketDataCenterConfig>),
862 /// Configuration for connections to Bitbucket Cloud.
863 BitbucketCloudConfig(std::boxed::Box<crate::model::BitbucketCloudConfig>),
864 }
865}
866
867/// Describes stage and necessary actions to be taken by the
868/// user to complete the installation. Used for GitHub and GitHub Enterprise
869/// based connections.
870#[derive(Clone, Default, PartialEq)]
871#[non_exhaustive]
872pub struct InstallationState {
873 /// Output only. Current step of the installation process.
874 pub stage: crate::model::installation_state::Stage,
875
876 /// Output only. Message of what the user should do next to continue the
877 /// installation. Empty string if the installation is already complete.
878 pub message: std::string::String,
879
880 /// Output only. Link to follow for next action. Empty string if the
881 /// installation is already complete.
882 pub action_uri: std::string::String,
883
884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
885}
886
887impl InstallationState {
888 pub fn new() -> Self {
889 std::default::Default::default()
890 }
891
892 /// Sets the value of [stage][crate::model::InstallationState::stage].
893 ///
894 /// # Example
895 /// ```ignore,no_run
896 /// # use google_cloud_build_v2::model::InstallationState;
897 /// use google_cloud_build_v2::model::installation_state::Stage;
898 /// let x0 = InstallationState::new().set_stage(Stage::PendingCreateApp);
899 /// let x1 = InstallationState::new().set_stage(Stage::PendingUserOauth);
900 /// let x2 = InstallationState::new().set_stage(Stage::PendingInstallApp);
901 /// ```
902 pub fn set_stage<T: std::convert::Into<crate::model::installation_state::Stage>>(
903 mut self,
904 v: T,
905 ) -> Self {
906 self.stage = v.into();
907 self
908 }
909
910 /// Sets the value of [message][crate::model::InstallationState::message].
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_build_v2::model::InstallationState;
915 /// let x = InstallationState::new().set_message("example");
916 /// ```
917 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
918 self.message = v.into();
919 self
920 }
921
922 /// Sets the value of [action_uri][crate::model::InstallationState::action_uri].
923 ///
924 /// # Example
925 /// ```ignore,no_run
926 /// # use google_cloud_build_v2::model::InstallationState;
927 /// let x = InstallationState::new().set_action_uri("example");
928 /// ```
929 pub fn set_action_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
930 self.action_uri = v.into();
931 self
932 }
933}
934
935impl wkt::message::Message for InstallationState {
936 fn typename() -> &'static str {
937 "type.googleapis.com/google.devtools.cloudbuild.v2.InstallationState"
938 }
939}
940
941/// Defines additional types related to [InstallationState].
942pub mod installation_state {
943 #[allow(unused_imports)]
944 use super::*;
945
946 /// Stage of the installation process.
947 ///
948 /// # Working with unknown values
949 ///
950 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
951 /// additional enum variants at any time. Adding new variants is not considered
952 /// a breaking change. Applications should write their code in anticipation of:
953 ///
954 /// - New values appearing in future releases of the client library, **and**
955 /// - New values received dynamically, without application changes.
956 ///
957 /// Please consult the [Working with enums] section in the user guide for some
958 /// guidelines.
959 ///
960 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
961 #[derive(Clone, Debug, PartialEq)]
962 #[non_exhaustive]
963 pub enum Stage {
964 /// No stage specified.
965 Unspecified,
966 /// Only for GitHub Enterprise. An App creation has been requested.
967 /// The user needs to confirm the creation in their GitHub enterprise host.
968 PendingCreateApp,
969 /// User needs to authorize the GitHub (or Enterprise) App via OAuth.
970 PendingUserOauth,
971 /// User needs to follow the link to install the GitHub (or Enterprise) App.
972 PendingInstallApp,
973 /// Installation process has been completed.
974 Complete,
975 /// If set, the enum was initialized with an unknown value.
976 ///
977 /// Applications can examine the value using [Stage::value] or
978 /// [Stage::name].
979 UnknownValue(stage::UnknownValue),
980 }
981
982 #[doc(hidden)]
983 pub mod stage {
984 #[allow(unused_imports)]
985 use super::*;
986 #[derive(Clone, Debug, PartialEq)]
987 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
988 }
989
990 impl Stage {
991 /// Gets the enum value.
992 ///
993 /// Returns `None` if the enum contains an unknown value deserialized from
994 /// the string representation of enums.
995 pub fn value(&self) -> std::option::Option<i32> {
996 match self {
997 Self::Unspecified => std::option::Option::Some(0),
998 Self::PendingCreateApp => std::option::Option::Some(1),
999 Self::PendingUserOauth => std::option::Option::Some(2),
1000 Self::PendingInstallApp => std::option::Option::Some(3),
1001 Self::Complete => std::option::Option::Some(10),
1002 Self::UnknownValue(u) => u.0.value(),
1003 }
1004 }
1005
1006 /// Gets the enum value as a string.
1007 ///
1008 /// Returns `None` if the enum contains an unknown value deserialized from
1009 /// the integer representation of enums.
1010 pub fn name(&self) -> std::option::Option<&str> {
1011 match self {
1012 Self::Unspecified => std::option::Option::Some("STAGE_UNSPECIFIED"),
1013 Self::PendingCreateApp => std::option::Option::Some("PENDING_CREATE_APP"),
1014 Self::PendingUserOauth => std::option::Option::Some("PENDING_USER_OAUTH"),
1015 Self::PendingInstallApp => std::option::Option::Some("PENDING_INSTALL_APP"),
1016 Self::Complete => std::option::Option::Some("COMPLETE"),
1017 Self::UnknownValue(u) => u.0.name(),
1018 }
1019 }
1020 }
1021
1022 impl std::default::Default for Stage {
1023 fn default() -> Self {
1024 use std::convert::From;
1025 Self::from(0)
1026 }
1027 }
1028
1029 impl std::fmt::Display for Stage {
1030 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1031 wkt::internal::display_enum(f, self.name(), self.value())
1032 }
1033 }
1034
1035 impl std::convert::From<i32> for Stage {
1036 fn from(value: i32) -> Self {
1037 match value {
1038 0 => Self::Unspecified,
1039 1 => Self::PendingCreateApp,
1040 2 => Self::PendingUserOauth,
1041 3 => Self::PendingInstallApp,
1042 10 => Self::Complete,
1043 _ => Self::UnknownValue(stage::UnknownValue(
1044 wkt::internal::UnknownEnumValue::Integer(value),
1045 )),
1046 }
1047 }
1048 }
1049
1050 impl std::convert::From<&str> for Stage {
1051 fn from(value: &str) -> Self {
1052 use std::string::ToString;
1053 match value {
1054 "STAGE_UNSPECIFIED" => Self::Unspecified,
1055 "PENDING_CREATE_APP" => Self::PendingCreateApp,
1056 "PENDING_USER_OAUTH" => Self::PendingUserOauth,
1057 "PENDING_INSTALL_APP" => Self::PendingInstallApp,
1058 "COMPLETE" => Self::Complete,
1059 _ => Self::UnknownValue(stage::UnknownValue(
1060 wkt::internal::UnknownEnumValue::String(value.to_string()),
1061 )),
1062 }
1063 }
1064 }
1065
1066 impl serde::ser::Serialize for Stage {
1067 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1068 where
1069 S: serde::Serializer,
1070 {
1071 match self {
1072 Self::Unspecified => serializer.serialize_i32(0),
1073 Self::PendingCreateApp => serializer.serialize_i32(1),
1074 Self::PendingUserOauth => serializer.serialize_i32(2),
1075 Self::PendingInstallApp => serializer.serialize_i32(3),
1076 Self::Complete => serializer.serialize_i32(10),
1077 Self::UnknownValue(u) => u.0.serialize(serializer),
1078 }
1079 }
1080 }
1081
1082 impl<'de> serde::de::Deserialize<'de> for Stage {
1083 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1084 where
1085 D: serde::Deserializer<'de>,
1086 {
1087 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Stage>::new(
1088 ".google.devtools.cloudbuild.v2.InstallationState.Stage",
1089 ))
1090 }
1091 }
1092}
1093
1094/// Request message for FetchLinkableRepositories.
1095#[derive(Clone, Default, PartialEq)]
1096#[non_exhaustive]
1097pub struct FetchLinkableRepositoriesRequest {
1098 /// Required. The name of the Connection.
1099 /// Format: `projects/*/locations/*/connections/*`.
1100 pub connection: std::string::String,
1101
1102 /// Number of results to return in the list. Default to 20.
1103 pub page_size: i32,
1104
1105 /// Page start.
1106 pub page_token: std::string::String,
1107
1108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1109}
1110
1111impl FetchLinkableRepositoriesRequest {
1112 pub fn new() -> Self {
1113 std::default::Default::default()
1114 }
1115
1116 /// Sets the value of [connection][crate::model::FetchLinkableRepositoriesRequest::connection].
1117 ///
1118 /// # Example
1119 /// ```ignore,no_run
1120 /// # use google_cloud_build_v2::model::FetchLinkableRepositoriesRequest;
1121 /// let x = FetchLinkableRepositoriesRequest::new().set_connection("example");
1122 /// ```
1123 pub fn set_connection<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1124 self.connection = v.into();
1125 self
1126 }
1127
1128 /// Sets the value of [page_size][crate::model::FetchLinkableRepositoriesRequest::page_size].
1129 ///
1130 /// # Example
1131 /// ```ignore,no_run
1132 /// # use google_cloud_build_v2::model::FetchLinkableRepositoriesRequest;
1133 /// let x = FetchLinkableRepositoriesRequest::new().set_page_size(42);
1134 /// ```
1135 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1136 self.page_size = v.into();
1137 self
1138 }
1139
1140 /// Sets the value of [page_token][crate::model::FetchLinkableRepositoriesRequest::page_token].
1141 ///
1142 /// # Example
1143 /// ```ignore,no_run
1144 /// # use google_cloud_build_v2::model::FetchLinkableRepositoriesRequest;
1145 /// let x = FetchLinkableRepositoriesRequest::new().set_page_token("example");
1146 /// ```
1147 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1148 self.page_token = v.into();
1149 self
1150 }
1151}
1152
1153impl wkt::message::Message for FetchLinkableRepositoriesRequest {
1154 fn typename() -> &'static str {
1155 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchLinkableRepositoriesRequest"
1156 }
1157}
1158
1159/// Response message for FetchLinkableRepositories.
1160#[derive(Clone, Default, PartialEq)]
1161#[non_exhaustive]
1162pub struct FetchLinkableRepositoriesResponse {
1163 /// repositories ready to be created.
1164 pub repositories: std::vec::Vec<crate::model::Repository>,
1165
1166 /// A token identifying a page of results the server should return.
1167 pub next_page_token: std::string::String,
1168
1169 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1170}
1171
1172impl FetchLinkableRepositoriesResponse {
1173 pub fn new() -> Self {
1174 std::default::Default::default()
1175 }
1176
1177 /// Sets the value of [repositories][crate::model::FetchLinkableRepositoriesResponse::repositories].
1178 ///
1179 /// # Example
1180 /// ```ignore,no_run
1181 /// # use google_cloud_build_v2::model::FetchLinkableRepositoriesResponse;
1182 /// use google_cloud_build_v2::model::Repository;
1183 /// let x = FetchLinkableRepositoriesResponse::new()
1184 /// .set_repositories([
1185 /// Repository::default()/* use setters */,
1186 /// Repository::default()/* use (different) setters */,
1187 /// ]);
1188 /// ```
1189 pub fn set_repositories<T, V>(mut self, v: T) -> Self
1190 where
1191 T: std::iter::IntoIterator<Item = V>,
1192 V: std::convert::Into<crate::model::Repository>,
1193 {
1194 use std::iter::Iterator;
1195 self.repositories = v.into_iter().map(|i| i.into()).collect();
1196 self
1197 }
1198
1199 /// Sets the value of [next_page_token][crate::model::FetchLinkableRepositoriesResponse::next_page_token].
1200 ///
1201 /// # Example
1202 /// ```ignore,no_run
1203 /// # use google_cloud_build_v2::model::FetchLinkableRepositoriesResponse;
1204 /// let x = FetchLinkableRepositoriesResponse::new().set_next_page_token("example");
1205 /// ```
1206 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1207 self.next_page_token = v.into();
1208 self
1209 }
1210}
1211
1212impl wkt::message::Message for FetchLinkableRepositoriesResponse {
1213 fn typename() -> &'static str {
1214 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchLinkableRepositoriesResponse"
1215 }
1216}
1217
1218#[doc(hidden)]
1219impl gax::paginator::internal::PageableResponse for FetchLinkableRepositoriesResponse {
1220 type PageItem = crate::model::Repository;
1221
1222 fn items(self) -> std::vec::Vec<Self::PageItem> {
1223 self.repositories
1224 }
1225
1226 fn next_page_token(&self) -> std::string::String {
1227 use std::clone::Clone;
1228 self.next_page_token.clone()
1229 }
1230}
1231
1232/// Configuration for connections to github.com.
1233#[derive(Clone, Default, PartialEq)]
1234#[non_exhaustive]
1235pub struct GitHubConfig {
1236 /// OAuth credential of the account that authorized the Cloud Build GitHub App.
1237 /// It is recommended to use a robot account instead of a human user account.
1238 /// The OAuth token must be tied to the Cloud Build GitHub App.
1239 pub authorizer_credential: std::option::Option<crate::model::OAuthCredential>,
1240
1241 /// GitHub App installation id.
1242 pub app_installation_id: i64,
1243
1244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1245}
1246
1247impl GitHubConfig {
1248 pub fn new() -> Self {
1249 std::default::Default::default()
1250 }
1251
1252 /// Sets the value of [authorizer_credential][crate::model::GitHubConfig::authorizer_credential].
1253 ///
1254 /// # Example
1255 /// ```ignore,no_run
1256 /// # use google_cloud_build_v2::model::GitHubConfig;
1257 /// use google_cloud_build_v2::model::OAuthCredential;
1258 /// let x = GitHubConfig::new().set_authorizer_credential(OAuthCredential::default()/* use setters */);
1259 /// ```
1260 pub fn set_authorizer_credential<T>(mut self, v: T) -> Self
1261 where
1262 T: std::convert::Into<crate::model::OAuthCredential>,
1263 {
1264 self.authorizer_credential = std::option::Option::Some(v.into());
1265 self
1266 }
1267
1268 /// Sets or clears the value of [authorizer_credential][crate::model::GitHubConfig::authorizer_credential].
1269 ///
1270 /// # Example
1271 /// ```ignore,no_run
1272 /// # use google_cloud_build_v2::model::GitHubConfig;
1273 /// use google_cloud_build_v2::model::OAuthCredential;
1274 /// let x = GitHubConfig::new().set_or_clear_authorizer_credential(Some(OAuthCredential::default()/* use setters */));
1275 /// let x = GitHubConfig::new().set_or_clear_authorizer_credential(None::<OAuthCredential>);
1276 /// ```
1277 pub fn set_or_clear_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1278 where
1279 T: std::convert::Into<crate::model::OAuthCredential>,
1280 {
1281 self.authorizer_credential = v.map(|x| x.into());
1282 self
1283 }
1284
1285 /// Sets the value of [app_installation_id][crate::model::GitHubConfig::app_installation_id].
1286 ///
1287 /// # Example
1288 /// ```ignore,no_run
1289 /// # use google_cloud_build_v2::model::GitHubConfig;
1290 /// let x = GitHubConfig::new().set_app_installation_id(42);
1291 /// ```
1292 pub fn set_app_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1293 self.app_installation_id = v.into();
1294 self
1295 }
1296}
1297
1298impl wkt::message::Message for GitHubConfig {
1299 fn typename() -> &'static str {
1300 "type.googleapis.com/google.devtools.cloudbuild.v2.GitHubConfig"
1301 }
1302}
1303
1304/// Configuration for connections to an instance of GitHub Enterprise.
1305#[derive(Clone, Default, PartialEq)]
1306#[non_exhaustive]
1307pub struct GitHubEnterpriseConfig {
1308 /// Required. The URI of the GitHub Enterprise host this connection is for.
1309 pub host_uri: std::string::String,
1310
1311 /// Required. API Key used for authentication of webhook events.
1312 pub api_key: std::string::String,
1313
1314 /// Id of the GitHub App created from the manifest.
1315 pub app_id: i64,
1316
1317 /// The URL-friendly name of the GitHub App.
1318 pub app_slug: std::string::String,
1319
1320 /// SecretManager resource containing the private key of the GitHub App,
1321 /// formatted as `projects/*/secrets/*/versions/*`.
1322 pub private_key_secret_version: std::string::String,
1323
1324 /// SecretManager resource containing the webhook secret of the GitHub App,
1325 /// formatted as `projects/*/secrets/*/versions/*`.
1326 pub webhook_secret_secret_version: std::string::String,
1327
1328 /// ID of the installation of the GitHub App.
1329 pub app_installation_id: i64,
1330
1331 /// Configuration for using Service Directory to privately connect to a GitHub
1332 /// Enterprise server. This should only be set if the GitHub Enterprise server
1333 /// is hosted on-premises and not reachable by public internet. If this field
1334 /// is left empty, calls to the GitHub Enterprise server will be made over the
1335 /// public internet.
1336 pub service_directory_config: std::option::Option<crate::model::ServiceDirectoryConfig>,
1337
1338 /// SSL certificate to use for requests to GitHub Enterprise.
1339 pub ssl_ca: std::string::String,
1340
1341 /// Output only. GitHub Enterprise version installed at the host_uri.
1342 pub server_version: std::string::String,
1343
1344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1345}
1346
1347impl GitHubEnterpriseConfig {
1348 pub fn new() -> Self {
1349 std::default::Default::default()
1350 }
1351
1352 /// Sets the value of [host_uri][crate::model::GitHubEnterpriseConfig::host_uri].
1353 ///
1354 /// # Example
1355 /// ```ignore,no_run
1356 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1357 /// let x = GitHubEnterpriseConfig::new().set_host_uri("example");
1358 /// ```
1359 pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1360 self.host_uri = v.into();
1361 self
1362 }
1363
1364 /// Sets the value of [api_key][crate::model::GitHubEnterpriseConfig::api_key].
1365 ///
1366 /// # Example
1367 /// ```ignore,no_run
1368 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1369 /// let x = GitHubEnterpriseConfig::new().set_api_key("example");
1370 /// ```
1371 pub fn set_api_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1372 self.api_key = v.into();
1373 self
1374 }
1375
1376 /// Sets the value of [app_id][crate::model::GitHubEnterpriseConfig::app_id].
1377 ///
1378 /// # Example
1379 /// ```ignore,no_run
1380 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1381 /// let x = GitHubEnterpriseConfig::new().set_app_id(42);
1382 /// ```
1383 pub fn set_app_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1384 self.app_id = v.into();
1385 self
1386 }
1387
1388 /// Sets the value of [app_slug][crate::model::GitHubEnterpriseConfig::app_slug].
1389 ///
1390 /// # Example
1391 /// ```ignore,no_run
1392 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1393 /// let x = GitHubEnterpriseConfig::new().set_app_slug("example");
1394 /// ```
1395 pub fn set_app_slug<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1396 self.app_slug = v.into();
1397 self
1398 }
1399
1400 /// Sets the value of [private_key_secret_version][crate::model::GitHubEnterpriseConfig::private_key_secret_version].
1401 ///
1402 /// # Example
1403 /// ```ignore,no_run
1404 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1405 /// let x = GitHubEnterpriseConfig::new().set_private_key_secret_version("example");
1406 /// ```
1407 pub fn set_private_key_secret_version<T: std::convert::Into<std::string::String>>(
1408 mut self,
1409 v: T,
1410 ) -> Self {
1411 self.private_key_secret_version = v.into();
1412 self
1413 }
1414
1415 /// Sets the value of [webhook_secret_secret_version][crate::model::GitHubEnterpriseConfig::webhook_secret_secret_version].
1416 ///
1417 /// # Example
1418 /// ```ignore,no_run
1419 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1420 /// let x = GitHubEnterpriseConfig::new().set_webhook_secret_secret_version("example");
1421 /// ```
1422 pub fn set_webhook_secret_secret_version<T: std::convert::Into<std::string::String>>(
1423 mut self,
1424 v: T,
1425 ) -> Self {
1426 self.webhook_secret_secret_version = v.into();
1427 self
1428 }
1429
1430 /// Sets the value of [app_installation_id][crate::model::GitHubEnterpriseConfig::app_installation_id].
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1435 /// let x = GitHubEnterpriseConfig::new().set_app_installation_id(42);
1436 /// ```
1437 pub fn set_app_installation_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1438 self.app_installation_id = v.into();
1439 self
1440 }
1441
1442 /// Sets the value of [service_directory_config][crate::model::GitHubEnterpriseConfig::service_directory_config].
1443 ///
1444 /// # Example
1445 /// ```ignore,no_run
1446 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1447 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1448 /// let x = GitHubEnterpriseConfig::new().set_service_directory_config(ServiceDirectoryConfig::default()/* use setters */);
1449 /// ```
1450 pub fn set_service_directory_config<T>(mut self, v: T) -> Self
1451 where
1452 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1453 {
1454 self.service_directory_config = std::option::Option::Some(v.into());
1455 self
1456 }
1457
1458 /// Sets or clears the value of [service_directory_config][crate::model::GitHubEnterpriseConfig::service_directory_config].
1459 ///
1460 /// # Example
1461 /// ```ignore,no_run
1462 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1463 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1464 /// let x = GitHubEnterpriseConfig::new().set_or_clear_service_directory_config(Some(ServiceDirectoryConfig::default()/* use setters */));
1465 /// let x = GitHubEnterpriseConfig::new().set_or_clear_service_directory_config(None::<ServiceDirectoryConfig>);
1466 /// ```
1467 pub fn set_or_clear_service_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
1468 where
1469 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1470 {
1471 self.service_directory_config = v.map(|x| x.into());
1472 self
1473 }
1474
1475 /// Sets the value of [ssl_ca][crate::model::GitHubEnterpriseConfig::ssl_ca].
1476 ///
1477 /// # Example
1478 /// ```ignore,no_run
1479 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1480 /// let x = GitHubEnterpriseConfig::new().set_ssl_ca("example");
1481 /// ```
1482 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1483 self.ssl_ca = v.into();
1484 self
1485 }
1486
1487 /// Sets the value of [server_version][crate::model::GitHubEnterpriseConfig::server_version].
1488 ///
1489 /// # Example
1490 /// ```ignore,no_run
1491 /// # use google_cloud_build_v2::model::GitHubEnterpriseConfig;
1492 /// let x = GitHubEnterpriseConfig::new().set_server_version("example");
1493 /// ```
1494 pub fn set_server_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1495 self.server_version = v.into();
1496 self
1497 }
1498}
1499
1500impl wkt::message::Message for GitHubEnterpriseConfig {
1501 fn typename() -> &'static str {
1502 "type.googleapis.com/google.devtools.cloudbuild.v2.GitHubEnterpriseConfig"
1503 }
1504}
1505
1506/// Configuration for connections to gitlab.com or an instance of GitLab
1507/// Enterprise.
1508#[derive(Clone, Default, PartialEq)]
1509#[non_exhaustive]
1510pub struct GitLabConfig {
1511 /// The URI of the GitLab Enterprise host this connection is for.
1512 /// If not specified, the default value is <https://gitlab.com>.
1513 pub host_uri: std::string::String,
1514
1515 /// Required. Immutable. SecretManager resource containing the webhook secret
1516 /// of a GitLab Enterprise project, formatted as
1517 /// `projects/*/secrets/*/versions/*`.
1518 pub webhook_secret_secret_version: std::string::String,
1519
1520 /// Required. A GitLab personal access token with the minimum `read_api` scope
1521 /// access.
1522 pub read_authorizer_credential: std::option::Option<crate::model::UserCredential>,
1523
1524 /// Required. A GitLab personal access token with the `api` scope access.
1525 pub authorizer_credential: std::option::Option<crate::model::UserCredential>,
1526
1527 /// Configuration for using Service Directory to privately connect to a GitLab
1528 /// Enterprise server. This should only be set if the GitLab Enterprise server
1529 /// is hosted on-premises and not reachable by public internet. If this field
1530 /// is left empty, calls to the GitLab Enterprise server will be made over the
1531 /// public internet.
1532 pub service_directory_config: std::option::Option<crate::model::ServiceDirectoryConfig>,
1533
1534 /// SSL certificate to use for requests to GitLab Enterprise.
1535 pub ssl_ca: std::string::String,
1536
1537 /// Output only. Version of the GitLab Enterprise server running on the
1538 /// `host_uri`.
1539 pub server_version: std::string::String,
1540
1541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1542}
1543
1544impl GitLabConfig {
1545 pub fn new() -> Self {
1546 std::default::Default::default()
1547 }
1548
1549 /// Sets the value of [host_uri][crate::model::GitLabConfig::host_uri].
1550 ///
1551 /// # Example
1552 /// ```ignore,no_run
1553 /// # use google_cloud_build_v2::model::GitLabConfig;
1554 /// let x = GitLabConfig::new().set_host_uri("example");
1555 /// ```
1556 pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1557 self.host_uri = v.into();
1558 self
1559 }
1560
1561 /// Sets the value of [webhook_secret_secret_version][crate::model::GitLabConfig::webhook_secret_secret_version].
1562 ///
1563 /// # Example
1564 /// ```ignore,no_run
1565 /// # use google_cloud_build_v2::model::GitLabConfig;
1566 /// let x = GitLabConfig::new().set_webhook_secret_secret_version("example");
1567 /// ```
1568 pub fn set_webhook_secret_secret_version<T: std::convert::Into<std::string::String>>(
1569 mut self,
1570 v: T,
1571 ) -> Self {
1572 self.webhook_secret_secret_version = v.into();
1573 self
1574 }
1575
1576 /// Sets the value of [read_authorizer_credential][crate::model::GitLabConfig::read_authorizer_credential].
1577 ///
1578 /// # Example
1579 /// ```ignore,no_run
1580 /// # use google_cloud_build_v2::model::GitLabConfig;
1581 /// use google_cloud_build_v2::model::UserCredential;
1582 /// let x = GitLabConfig::new().set_read_authorizer_credential(UserCredential::default()/* use setters */);
1583 /// ```
1584 pub fn set_read_authorizer_credential<T>(mut self, v: T) -> Self
1585 where
1586 T: std::convert::Into<crate::model::UserCredential>,
1587 {
1588 self.read_authorizer_credential = std::option::Option::Some(v.into());
1589 self
1590 }
1591
1592 /// Sets or clears the value of [read_authorizer_credential][crate::model::GitLabConfig::read_authorizer_credential].
1593 ///
1594 /// # Example
1595 /// ```ignore,no_run
1596 /// # use google_cloud_build_v2::model::GitLabConfig;
1597 /// use google_cloud_build_v2::model::UserCredential;
1598 /// let x = GitLabConfig::new().set_or_clear_read_authorizer_credential(Some(UserCredential::default()/* use setters */));
1599 /// let x = GitLabConfig::new().set_or_clear_read_authorizer_credential(None::<UserCredential>);
1600 /// ```
1601 pub fn set_or_clear_read_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1602 where
1603 T: std::convert::Into<crate::model::UserCredential>,
1604 {
1605 self.read_authorizer_credential = v.map(|x| x.into());
1606 self
1607 }
1608
1609 /// Sets the value of [authorizer_credential][crate::model::GitLabConfig::authorizer_credential].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_build_v2::model::GitLabConfig;
1614 /// use google_cloud_build_v2::model::UserCredential;
1615 /// let x = GitLabConfig::new().set_authorizer_credential(UserCredential::default()/* use setters */);
1616 /// ```
1617 pub fn set_authorizer_credential<T>(mut self, v: T) -> Self
1618 where
1619 T: std::convert::Into<crate::model::UserCredential>,
1620 {
1621 self.authorizer_credential = std::option::Option::Some(v.into());
1622 self
1623 }
1624
1625 /// Sets or clears the value of [authorizer_credential][crate::model::GitLabConfig::authorizer_credential].
1626 ///
1627 /// # Example
1628 /// ```ignore,no_run
1629 /// # use google_cloud_build_v2::model::GitLabConfig;
1630 /// use google_cloud_build_v2::model::UserCredential;
1631 /// let x = GitLabConfig::new().set_or_clear_authorizer_credential(Some(UserCredential::default()/* use setters */));
1632 /// let x = GitLabConfig::new().set_or_clear_authorizer_credential(None::<UserCredential>);
1633 /// ```
1634 pub fn set_or_clear_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1635 where
1636 T: std::convert::Into<crate::model::UserCredential>,
1637 {
1638 self.authorizer_credential = v.map(|x| x.into());
1639 self
1640 }
1641
1642 /// Sets the value of [service_directory_config][crate::model::GitLabConfig::service_directory_config].
1643 ///
1644 /// # Example
1645 /// ```ignore,no_run
1646 /// # use google_cloud_build_v2::model::GitLabConfig;
1647 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1648 /// let x = GitLabConfig::new().set_service_directory_config(ServiceDirectoryConfig::default()/* use setters */);
1649 /// ```
1650 pub fn set_service_directory_config<T>(mut self, v: T) -> Self
1651 where
1652 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1653 {
1654 self.service_directory_config = std::option::Option::Some(v.into());
1655 self
1656 }
1657
1658 /// Sets or clears the value of [service_directory_config][crate::model::GitLabConfig::service_directory_config].
1659 ///
1660 /// # Example
1661 /// ```ignore,no_run
1662 /// # use google_cloud_build_v2::model::GitLabConfig;
1663 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1664 /// let x = GitLabConfig::new().set_or_clear_service_directory_config(Some(ServiceDirectoryConfig::default()/* use setters */));
1665 /// let x = GitLabConfig::new().set_or_clear_service_directory_config(None::<ServiceDirectoryConfig>);
1666 /// ```
1667 pub fn set_or_clear_service_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
1668 where
1669 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1670 {
1671 self.service_directory_config = v.map(|x| x.into());
1672 self
1673 }
1674
1675 /// Sets the value of [ssl_ca][crate::model::GitLabConfig::ssl_ca].
1676 ///
1677 /// # Example
1678 /// ```ignore,no_run
1679 /// # use google_cloud_build_v2::model::GitLabConfig;
1680 /// let x = GitLabConfig::new().set_ssl_ca("example");
1681 /// ```
1682 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1683 self.ssl_ca = v.into();
1684 self
1685 }
1686
1687 /// Sets the value of [server_version][crate::model::GitLabConfig::server_version].
1688 ///
1689 /// # Example
1690 /// ```ignore,no_run
1691 /// # use google_cloud_build_v2::model::GitLabConfig;
1692 /// let x = GitLabConfig::new().set_server_version("example");
1693 /// ```
1694 pub fn set_server_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1695 self.server_version = v.into();
1696 self
1697 }
1698}
1699
1700impl wkt::message::Message for GitLabConfig {
1701 fn typename() -> &'static str {
1702 "type.googleapis.com/google.devtools.cloudbuild.v2.GitLabConfig"
1703 }
1704}
1705
1706/// Configuration for connections to Bitbucket Data Center.
1707#[derive(Clone, Default, PartialEq)]
1708#[non_exhaustive]
1709pub struct BitbucketDataCenterConfig {
1710 /// Required. The URI of the Bitbucket Data Center instance or cluster this
1711 /// connection is for.
1712 pub host_uri: std::string::String,
1713
1714 /// Required. Immutable. SecretManager resource containing the webhook secret
1715 /// used to verify webhook events, formatted as
1716 /// `projects/*/secrets/*/versions/*`.
1717 pub webhook_secret_secret_version: std::string::String,
1718
1719 /// Required. A http access token with the `REPO_READ` access.
1720 pub read_authorizer_credential: std::option::Option<crate::model::UserCredential>,
1721
1722 /// Required. A http access token with the `REPO_ADMIN` scope access.
1723 pub authorizer_credential: std::option::Option<crate::model::UserCredential>,
1724
1725 /// Optional. Configuration for using Service Directory to privately connect to
1726 /// a Bitbucket Data Center. This should only be set if the Bitbucket Data
1727 /// Center is hosted on-premises and not reachable by public internet. If this
1728 /// field is left empty, calls to the Bitbucket Data Center will be made over
1729 /// the public internet.
1730 pub service_directory_config: std::option::Option<crate::model::ServiceDirectoryConfig>,
1731
1732 /// Optional. SSL certificate to use for requests to the Bitbucket Data Center.
1733 pub ssl_ca: std::string::String,
1734
1735 /// Output only. Version of the Bitbucket Data Center running on the
1736 /// `host_uri`.
1737 pub server_version: std::string::String,
1738
1739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1740}
1741
1742impl BitbucketDataCenterConfig {
1743 pub fn new() -> Self {
1744 std::default::Default::default()
1745 }
1746
1747 /// Sets the value of [host_uri][crate::model::BitbucketDataCenterConfig::host_uri].
1748 ///
1749 /// # Example
1750 /// ```ignore,no_run
1751 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1752 /// let x = BitbucketDataCenterConfig::new().set_host_uri("example");
1753 /// ```
1754 pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1755 self.host_uri = v.into();
1756 self
1757 }
1758
1759 /// Sets the value of [webhook_secret_secret_version][crate::model::BitbucketDataCenterConfig::webhook_secret_secret_version].
1760 ///
1761 /// # Example
1762 /// ```ignore,no_run
1763 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1764 /// let x = BitbucketDataCenterConfig::new().set_webhook_secret_secret_version("example");
1765 /// ```
1766 pub fn set_webhook_secret_secret_version<T: std::convert::Into<std::string::String>>(
1767 mut self,
1768 v: T,
1769 ) -> Self {
1770 self.webhook_secret_secret_version = v.into();
1771 self
1772 }
1773
1774 /// Sets the value of [read_authorizer_credential][crate::model::BitbucketDataCenterConfig::read_authorizer_credential].
1775 ///
1776 /// # Example
1777 /// ```ignore,no_run
1778 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1779 /// use google_cloud_build_v2::model::UserCredential;
1780 /// let x = BitbucketDataCenterConfig::new().set_read_authorizer_credential(UserCredential::default()/* use setters */);
1781 /// ```
1782 pub fn set_read_authorizer_credential<T>(mut self, v: T) -> Self
1783 where
1784 T: std::convert::Into<crate::model::UserCredential>,
1785 {
1786 self.read_authorizer_credential = std::option::Option::Some(v.into());
1787 self
1788 }
1789
1790 /// Sets or clears the value of [read_authorizer_credential][crate::model::BitbucketDataCenterConfig::read_authorizer_credential].
1791 ///
1792 /// # Example
1793 /// ```ignore,no_run
1794 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1795 /// use google_cloud_build_v2::model::UserCredential;
1796 /// let x = BitbucketDataCenterConfig::new().set_or_clear_read_authorizer_credential(Some(UserCredential::default()/* use setters */));
1797 /// let x = BitbucketDataCenterConfig::new().set_or_clear_read_authorizer_credential(None::<UserCredential>);
1798 /// ```
1799 pub fn set_or_clear_read_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1800 where
1801 T: std::convert::Into<crate::model::UserCredential>,
1802 {
1803 self.read_authorizer_credential = v.map(|x| x.into());
1804 self
1805 }
1806
1807 /// Sets the value of [authorizer_credential][crate::model::BitbucketDataCenterConfig::authorizer_credential].
1808 ///
1809 /// # Example
1810 /// ```ignore,no_run
1811 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1812 /// use google_cloud_build_v2::model::UserCredential;
1813 /// let x = BitbucketDataCenterConfig::new().set_authorizer_credential(UserCredential::default()/* use setters */);
1814 /// ```
1815 pub fn set_authorizer_credential<T>(mut self, v: T) -> Self
1816 where
1817 T: std::convert::Into<crate::model::UserCredential>,
1818 {
1819 self.authorizer_credential = std::option::Option::Some(v.into());
1820 self
1821 }
1822
1823 /// Sets or clears the value of [authorizer_credential][crate::model::BitbucketDataCenterConfig::authorizer_credential].
1824 ///
1825 /// # Example
1826 /// ```ignore,no_run
1827 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1828 /// use google_cloud_build_v2::model::UserCredential;
1829 /// let x = BitbucketDataCenterConfig::new().set_or_clear_authorizer_credential(Some(UserCredential::default()/* use setters */));
1830 /// let x = BitbucketDataCenterConfig::new().set_or_clear_authorizer_credential(None::<UserCredential>);
1831 /// ```
1832 pub fn set_or_clear_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1833 where
1834 T: std::convert::Into<crate::model::UserCredential>,
1835 {
1836 self.authorizer_credential = v.map(|x| x.into());
1837 self
1838 }
1839
1840 /// Sets the value of [service_directory_config][crate::model::BitbucketDataCenterConfig::service_directory_config].
1841 ///
1842 /// # Example
1843 /// ```ignore,no_run
1844 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1845 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1846 /// let x = BitbucketDataCenterConfig::new().set_service_directory_config(ServiceDirectoryConfig::default()/* use setters */);
1847 /// ```
1848 pub fn set_service_directory_config<T>(mut self, v: T) -> Self
1849 where
1850 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1851 {
1852 self.service_directory_config = std::option::Option::Some(v.into());
1853 self
1854 }
1855
1856 /// Sets or clears the value of [service_directory_config][crate::model::BitbucketDataCenterConfig::service_directory_config].
1857 ///
1858 /// # Example
1859 /// ```ignore,no_run
1860 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1861 /// use google_cloud_build_v2::model::ServiceDirectoryConfig;
1862 /// let x = BitbucketDataCenterConfig::new().set_or_clear_service_directory_config(Some(ServiceDirectoryConfig::default()/* use setters */));
1863 /// let x = BitbucketDataCenterConfig::new().set_or_clear_service_directory_config(None::<ServiceDirectoryConfig>);
1864 /// ```
1865 pub fn set_or_clear_service_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
1866 where
1867 T: std::convert::Into<crate::model::ServiceDirectoryConfig>,
1868 {
1869 self.service_directory_config = v.map(|x| x.into());
1870 self
1871 }
1872
1873 /// Sets the value of [ssl_ca][crate::model::BitbucketDataCenterConfig::ssl_ca].
1874 ///
1875 /// # Example
1876 /// ```ignore,no_run
1877 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1878 /// let x = BitbucketDataCenterConfig::new().set_ssl_ca("example");
1879 /// ```
1880 pub fn set_ssl_ca<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1881 self.ssl_ca = v.into();
1882 self
1883 }
1884
1885 /// Sets the value of [server_version][crate::model::BitbucketDataCenterConfig::server_version].
1886 ///
1887 /// # Example
1888 /// ```ignore,no_run
1889 /// # use google_cloud_build_v2::model::BitbucketDataCenterConfig;
1890 /// let x = BitbucketDataCenterConfig::new().set_server_version("example");
1891 /// ```
1892 pub fn set_server_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1893 self.server_version = v.into();
1894 self
1895 }
1896}
1897
1898impl wkt::message::Message for BitbucketDataCenterConfig {
1899 fn typename() -> &'static str {
1900 "type.googleapis.com/google.devtools.cloudbuild.v2.BitbucketDataCenterConfig"
1901 }
1902}
1903
1904/// Configuration for connections to Bitbucket Cloud.
1905#[derive(Clone, Default, PartialEq)]
1906#[non_exhaustive]
1907pub struct BitbucketCloudConfig {
1908 /// Required. The Bitbucket Cloud Workspace ID to be connected to Google Cloud
1909 /// Platform.
1910 pub workspace: std::string::String,
1911
1912 /// Required. SecretManager resource containing the webhook secret used to
1913 /// verify webhook events, formatted as `projects/*/secrets/*/versions/*`.
1914 pub webhook_secret_secret_version: std::string::String,
1915
1916 /// Required. An access token with the `repository` access. It can be either a
1917 /// workspace, project or repository access token. It's recommended to use a
1918 /// system account to generate the credentials.
1919 pub read_authorizer_credential: std::option::Option<crate::model::UserCredential>,
1920
1921 /// Required. An access token with the `webhook`, `repository`,
1922 /// `repository:admin` and `pullrequest` scope access. It can be either a
1923 /// workspace, project or repository access token. It's recommended to use a
1924 /// system account to generate these credentials.
1925 pub authorizer_credential: std::option::Option<crate::model::UserCredential>,
1926
1927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1928}
1929
1930impl BitbucketCloudConfig {
1931 pub fn new() -> Self {
1932 std::default::Default::default()
1933 }
1934
1935 /// Sets the value of [workspace][crate::model::BitbucketCloudConfig::workspace].
1936 ///
1937 /// # Example
1938 /// ```ignore,no_run
1939 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
1940 /// let x = BitbucketCloudConfig::new().set_workspace("example");
1941 /// ```
1942 pub fn set_workspace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1943 self.workspace = v.into();
1944 self
1945 }
1946
1947 /// Sets the value of [webhook_secret_secret_version][crate::model::BitbucketCloudConfig::webhook_secret_secret_version].
1948 ///
1949 /// # Example
1950 /// ```ignore,no_run
1951 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
1952 /// let x = BitbucketCloudConfig::new().set_webhook_secret_secret_version("example");
1953 /// ```
1954 pub fn set_webhook_secret_secret_version<T: std::convert::Into<std::string::String>>(
1955 mut self,
1956 v: T,
1957 ) -> Self {
1958 self.webhook_secret_secret_version = v.into();
1959 self
1960 }
1961
1962 /// Sets the value of [read_authorizer_credential][crate::model::BitbucketCloudConfig::read_authorizer_credential].
1963 ///
1964 /// # Example
1965 /// ```ignore,no_run
1966 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
1967 /// use google_cloud_build_v2::model::UserCredential;
1968 /// let x = BitbucketCloudConfig::new().set_read_authorizer_credential(UserCredential::default()/* use setters */);
1969 /// ```
1970 pub fn set_read_authorizer_credential<T>(mut self, v: T) -> Self
1971 where
1972 T: std::convert::Into<crate::model::UserCredential>,
1973 {
1974 self.read_authorizer_credential = std::option::Option::Some(v.into());
1975 self
1976 }
1977
1978 /// Sets or clears the value of [read_authorizer_credential][crate::model::BitbucketCloudConfig::read_authorizer_credential].
1979 ///
1980 /// # Example
1981 /// ```ignore,no_run
1982 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
1983 /// use google_cloud_build_v2::model::UserCredential;
1984 /// let x = BitbucketCloudConfig::new().set_or_clear_read_authorizer_credential(Some(UserCredential::default()/* use setters */));
1985 /// let x = BitbucketCloudConfig::new().set_or_clear_read_authorizer_credential(None::<UserCredential>);
1986 /// ```
1987 pub fn set_or_clear_read_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
1988 where
1989 T: std::convert::Into<crate::model::UserCredential>,
1990 {
1991 self.read_authorizer_credential = v.map(|x| x.into());
1992 self
1993 }
1994
1995 /// Sets the value of [authorizer_credential][crate::model::BitbucketCloudConfig::authorizer_credential].
1996 ///
1997 /// # Example
1998 /// ```ignore,no_run
1999 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
2000 /// use google_cloud_build_v2::model::UserCredential;
2001 /// let x = BitbucketCloudConfig::new().set_authorizer_credential(UserCredential::default()/* use setters */);
2002 /// ```
2003 pub fn set_authorizer_credential<T>(mut self, v: T) -> Self
2004 where
2005 T: std::convert::Into<crate::model::UserCredential>,
2006 {
2007 self.authorizer_credential = std::option::Option::Some(v.into());
2008 self
2009 }
2010
2011 /// Sets or clears the value of [authorizer_credential][crate::model::BitbucketCloudConfig::authorizer_credential].
2012 ///
2013 /// # Example
2014 /// ```ignore,no_run
2015 /// # use google_cloud_build_v2::model::BitbucketCloudConfig;
2016 /// use google_cloud_build_v2::model::UserCredential;
2017 /// let x = BitbucketCloudConfig::new().set_or_clear_authorizer_credential(Some(UserCredential::default()/* use setters */));
2018 /// let x = BitbucketCloudConfig::new().set_or_clear_authorizer_credential(None::<UserCredential>);
2019 /// ```
2020 pub fn set_or_clear_authorizer_credential<T>(mut self, v: std::option::Option<T>) -> Self
2021 where
2022 T: std::convert::Into<crate::model::UserCredential>,
2023 {
2024 self.authorizer_credential = v.map(|x| x.into());
2025 self
2026 }
2027}
2028
2029impl wkt::message::Message for BitbucketCloudConfig {
2030 fn typename() -> &'static str {
2031 "type.googleapis.com/google.devtools.cloudbuild.v2.BitbucketCloudConfig"
2032 }
2033}
2034
2035/// ServiceDirectoryConfig represents Service Directory configuration for a
2036/// connection.
2037#[derive(Clone, Default, PartialEq)]
2038#[non_exhaustive]
2039pub struct ServiceDirectoryConfig {
2040 /// Required. The Service Directory service name.
2041 /// Format:
2042 /// projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
2043 pub service: std::string::String,
2044
2045 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2046}
2047
2048impl ServiceDirectoryConfig {
2049 pub fn new() -> Self {
2050 std::default::Default::default()
2051 }
2052
2053 /// Sets the value of [service][crate::model::ServiceDirectoryConfig::service].
2054 ///
2055 /// # Example
2056 /// ```ignore,no_run
2057 /// # use google_cloud_build_v2::model::ServiceDirectoryConfig;
2058 /// let x = ServiceDirectoryConfig::new().set_service("example");
2059 /// ```
2060 pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2061 self.service = v.into();
2062 self
2063 }
2064}
2065
2066impl wkt::message::Message for ServiceDirectoryConfig {
2067 fn typename() -> &'static str {
2068 "type.googleapis.com/google.devtools.cloudbuild.v2.ServiceDirectoryConfig"
2069 }
2070}
2071
2072/// A repository associated to a parent connection.
2073#[derive(Clone, Default, PartialEq)]
2074#[non_exhaustive]
2075pub struct Repository {
2076 /// Immutable. Resource name of the repository, in the format
2077 /// `projects/*/locations/*/connections/*/repositories/*`.
2078 pub name: std::string::String,
2079
2080 /// Required. Git Clone HTTPS URI.
2081 pub remote_uri: std::string::String,
2082
2083 /// Output only. Server assigned timestamp for when the connection was created.
2084 pub create_time: std::option::Option<wkt::Timestamp>,
2085
2086 /// Output only. Server assigned timestamp for when the connection was updated.
2087 pub update_time: std::option::Option<wkt::Timestamp>,
2088
2089 /// Allows clients to store small amounts of arbitrary data.
2090 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2091
2092 /// This checksum is computed by the server based on the value of other
2093 /// fields, and may be sent on update and delete requests to ensure the
2094 /// client has an up-to-date value before proceeding.
2095 pub etag: std::string::String,
2096
2097 /// Output only. External ID of the webhook created for the repository.
2098 pub webhook_id: std::string::String,
2099
2100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2101}
2102
2103impl Repository {
2104 pub fn new() -> Self {
2105 std::default::Default::default()
2106 }
2107
2108 /// Sets the value of [name][crate::model::Repository::name].
2109 ///
2110 /// # Example
2111 /// ```ignore,no_run
2112 /// # use google_cloud_build_v2::model::Repository;
2113 /// let x = Repository::new().set_name("example");
2114 /// ```
2115 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2116 self.name = v.into();
2117 self
2118 }
2119
2120 /// Sets the value of [remote_uri][crate::model::Repository::remote_uri].
2121 ///
2122 /// # Example
2123 /// ```ignore,no_run
2124 /// # use google_cloud_build_v2::model::Repository;
2125 /// let x = Repository::new().set_remote_uri("example");
2126 /// ```
2127 pub fn set_remote_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2128 self.remote_uri = v.into();
2129 self
2130 }
2131
2132 /// Sets the value of [create_time][crate::model::Repository::create_time].
2133 ///
2134 /// # Example
2135 /// ```ignore,no_run
2136 /// # use google_cloud_build_v2::model::Repository;
2137 /// use wkt::Timestamp;
2138 /// let x = Repository::new().set_create_time(Timestamp::default()/* use setters */);
2139 /// ```
2140 pub fn set_create_time<T>(mut self, v: T) -> Self
2141 where
2142 T: std::convert::Into<wkt::Timestamp>,
2143 {
2144 self.create_time = std::option::Option::Some(v.into());
2145 self
2146 }
2147
2148 /// Sets or clears the value of [create_time][crate::model::Repository::create_time].
2149 ///
2150 /// # Example
2151 /// ```ignore,no_run
2152 /// # use google_cloud_build_v2::model::Repository;
2153 /// use wkt::Timestamp;
2154 /// let x = Repository::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2155 /// let x = Repository::new().set_or_clear_create_time(None::<Timestamp>);
2156 /// ```
2157 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2158 where
2159 T: std::convert::Into<wkt::Timestamp>,
2160 {
2161 self.create_time = v.map(|x| x.into());
2162 self
2163 }
2164
2165 /// Sets the value of [update_time][crate::model::Repository::update_time].
2166 ///
2167 /// # Example
2168 /// ```ignore,no_run
2169 /// # use google_cloud_build_v2::model::Repository;
2170 /// use wkt::Timestamp;
2171 /// let x = Repository::new().set_update_time(Timestamp::default()/* use setters */);
2172 /// ```
2173 pub fn set_update_time<T>(mut self, v: T) -> Self
2174 where
2175 T: std::convert::Into<wkt::Timestamp>,
2176 {
2177 self.update_time = std::option::Option::Some(v.into());
2178 self
2179 }
2180
2181 /// Sets or clears the value of [update_time][crate::model::Repository::update_time].
2182 ///
2183 /// # Example
2184 /// ```ignore,no_run
2185 /// # use google_cloud_build_v2::model::Repository;
2186 /// use wkt::Timestamp;
2187 /// let x = Repository::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2188 /// let x = Repository::new().set_or_clear_update_time(None::<Timestamp>);
2189 /// ```
2190 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2191 where
2192 T: std::convert::Into<wkt::Timestamp>,
2193 {
2194 self.update_time = v.map(|x| x.into());
2195 self
2196 }
2197
2198 /// Sets the value of [annotations][crate::model::Repository::annotations].
2199 ///
2200 /// # Example
2201 /// ```ignore,no_run
2202 /// # use google_cloud_build_v2::model::Repository;
2203 /// let x = Repository::new().set_annotations([
2204 /// ("key0", "abc"),
2205 /// ("key1", "xyz"),
2206 /// ]);
2207 /// ```
2208 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2209 where
2210 T: std::iter::IntoIterator<Item = (K, V)>,
2211 K: std::convert::Into<std::string::String>,
2212 V: std::convert::Into<std::string::String>,
2213 {
2214 use std::iter::Iterator;
2215 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2216 self
2217 }
2218
2219 /// Sets the value of [etag][crate::model::Repository::etag].
2220 ///
2221 /// # Example
2222 /// ```ignore,no_run
2223 /// # use google_cloud_build_v2::model::Repository;
2224 /// let x = Repository::new().set_etag("example");
2225 /// ```
2226 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2227 self.etag = v.into();
2228 self
2229 }
2230
2231 /// Sets the value of [webhook_id][crate::model::Repository::webhook_id].
2232 ///
2233 /// # Example
2234 /// ```ignore,no_run
2235 /// # use google_cloud_build_v2::model::Repository;
2236 /// let x = Repository::new().set_webhook_id("example");
2237 /// ```
2238 pub fn set_webhook_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2239 self.webhook_id = v.into();
2240 self
2241 }
2242}
2243
2244impl wkt::message::Message for Repository {
2245 fn typename() -> &'static str {
2246 "type.googleapis.com/google.devtools.cloudbuild.v2.Repository"
2247 }
2248}
2249
2250/// Represents an OAuth token of the account that authorized the Connection,
2251/// and associated metadata.
2252#[derive(Clone, Default, PartialEq)]
2253#[non_exhaustive]
2254pub struct OAuthCredential {
2255 /// A SecretManager resource containing the OAuth token that authorizes
2256 /// the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`.
2257 pub oauth_token_secret_version: std::string::String,
2258
2259 /// Output only. The username associated to this token.
2260 pub username: std::string::String,
2261
2262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2263}
2264
2265impl OAuthCredential {
2266 pub fn new() -> Self {
2267 std::default::Default::default()
2268 }
2269
2270 /// Sets the value of [oauth_token_secret_version][crate::model::OAuthCredential::oauth_token_secret_version].
2271 ///
2272 /// # Example
2273 /// ```ignore,no_run
2274 /// # use google_cloud_build_v2::model::OAuthCredential;
2275 /// let x = OAuthCredential::new().set_oauth_token_secret_version("example");
2276 /// ```
2277 pub fn set_oauth_token_secret_version<T: std::convert::Into<std::string::String>>(
2278 mut self,
2279 v: T,
2280 ) -> Self {
2281 self.oauth_token_secret_version = v.into();
2282 self
2283 }
2284
2285 /// Sets the value of [username][crate::model::OAuthCredential::username].
2286 ///
2287 /// # Example
2288 /// ```ignore,no_run
2289 /// # use google_cloud_build_v2::model::OAuthCredential;
2290 /// let x = OAuthCredential::new().set_username("example");
2291 /// ```
2292 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2293 self.username = v.into();
2294 self
2295 }
2296}
2297
2298impl wkt::message::Message for OAuthCredential {
2299 fn typename() -> &'static str {
2300 "type.googleapis.com/google.devtools.cloudbuild.v2.OAuthCredential"
2301 }
2302}
2303
2304/// Represents a personal access token that authorized the Connection,
2305/// and associated metadata.
2306#[derive(Clone, Default, PartialEq)]
2307#[non_exhaustive]
2308pub struct UserCredential {
2309 /// Required. A SecretManager resource containing the user token that
2310 /// authorizes the Cloud Build connection. Format:
2311 /// `projects/*/secrets/*/versions/*`.
2312 pub user_token_secret_version: std::string::String,
2313
2314 /// Output only. The username associated to this token.
2315 pub username: std::string::String,
2316
2317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2318}
2319
2320impl UserCredential {
2321 pub fn new() -> Self {
2322 std::default::Default::default()
2323 }
2324
2325 /// Sets the value of [user_token_secret_version][crate::model::UserCredential::user_token_secret_version].
2326 ///
2327 /// # Example
2328 /// ```ignore,no_run
2329 /// # use google_cloud_build_v2::model::UserCredential;
2330 /// let x = UserCredential::new().set_user_token_secret_version("example");
2331 /// ```
2332 pub fn set_user_token_secret_version<T: std::convert::Into<std::string::String>>(
2333 mut self,
2334 v: T,
2335 ) -> Self {
2336 self.user_token_secret_version = v.into();
2337 self
2338 }
2339
2340 /// Sets the value of [username][crate::model::UserCredential::username].
2341 ///
2342 /// # Example
2343 /// ```ignore,no_run
2344 /// # use google_cloud_build_v2::model::UserCredential;
2345 /// let x = UserCredential::new().set_username("example");
2346 /// ```
2347 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2348 self.username = v.into();
2349 self
2350 }
2351}
2352
2353impl wkt::message::Message for UserCredential {
2354 fn typename() -> &'static str {
2355 "type.googleapis.com/google.devtools.cloudbuild.v2.UserCredential"
2356 }
2357}
2358
2359/// Message for creating a Connection
2360#[derive(Clone, Default, PartialEq)]
2361#[non_exhaustive]
2362pub struct CreateConnectionRequest {
2363 /// Required. Project and location where the connection will be created.
2364 /// Format: `projects/*/locations/*`.
2365 pub parent: std::string::String,
2366
2367 /// Required. The Connection to create.
2368 pub connection: std::option::Option<crate::model::Connection>,
2369
2370 /// Required. The ID to use for the Connection, which will become the final
2371 /// component of the Connection's resource name. Names must be unique
2372 /// per-project per-location. Allows alphanumeric characters and any of
2373 /// -._~%!$&'()*+,;=@.
2374 pub connection_id: std::string::String,
2375
2376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2377}
2378
2379impl CreateConnectionRequest {
2380 pub fn new() -> Self {
2381 std::default::Default::default()
2382 }
2383
2384 /// Sets the value of [parent][crate::model::CreateConnectionRequest::parent].
2385 ///
2386 /// # Example
2387 /// ```ignore,no_run
2388 /// # use google_cloud_build_v2::model::CreateConnectionRequest;
2389 /// let x = CreateConnectionRequest::new().set_parent("example");
2390 /// ```
2391 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2392 self.parent = v.into();
2393 self
2394 }
2395
2396 /// Sets the value of [connection][crate::model::CreateConnectionRequest::connection].
2397 ///
2398 /// # Example
2399 /// ```ignore,no_run
2400 /// # use google_cloud_build_v2::model::CreateConnectionRequest;
2401 /// use google_cloud_build_v2::model::Connection;
2402 /// let x = CreateConnectionRequest::new().set_connection(Connection::default()/* use setters */);
2403 /// ```
2404 pub fn set_connection<T>(mut self, v: T) -> Self
2405 where
2406 T: std::convert::Into<crate::model::Connection>,
2407 {
2408 self.connection = std::option::Option::Some(v.into());
2409 self
2410 }
2411
2412 /// Sets or clears the value of [connection][crate::model::CreateConnectionRequest::connection].
2413 ///
2414 /// # Example
2415 /// ```ignore,no_run
2416 /// # use google_cloud_build_v2::model::CreateConnectionRequest;
2417 /// use google_cloud_build_v2::model::Connection;
2418 /// let x = CreateConnectionRequest::new().set_or_clear_connection(Some(Connection::default()/* use setters */));
2419 /// let x = CreateConnectionRequest::new().set_or_clear_connection(None::<Connection>);
2420 /// ```
2421 pub fn set_or_clear_connection<T>(mut self, v: std::option::Option<T>) -> Self
2422 where
2423 T: std::convert::Into<crate::model::Connection>,
2424 {
2425 self.connection = v.map(|x| x.into());
2426 self
2427 }
2428
2429 /// Sets the value of [connection_id][crate::model::CreateConnectionRequest::connection_id].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_build_v2::model::CreateConnectionRequest;
2434 /// let x = CreateConnectionRequest::new().set_connection_id("example");
2435 /// ```
2436 pub fn set_connection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2437 self.connection_id = v.into();
2438 self
2439 }
2440}
2441
2442impl wkt::message::Message for CreateConnectionRequest {
2443 fn typename() -> &'static str {
2444 "type.googleapis.com/google.devtools.cloudbuild.v2.CreateConnectionRequest"
2445 }
2446}
2447
2448/// Message for getting the details of a Connection.
2449#[derive(Clone, Default, PartialEq)]
2450#[non_exhaustive]
2451pub struct GetConnectionRequest {
2452 /// Required. The name of the Connection to retrieve.
2453 /// Format: `projects/*/locations/*/connections/*`.
2454 pub name: std::string::String,
2455
2456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2457}
2458
2459impl GetConnectionRequest {
2460 pub fn new() -> Self {
2461 std::default::Default::default()
2462 }
2463
2464 /// Sets the value of [name][crate::model::GetConnectionRequest::name].
2465 ///
2466 /// # Example
2467 /// ```ignore,no_run
2468 /// # use google_cloud_build_v2::model::GetConnectionRequest;
2469 /// let x = GetConnectionRequest::new().set_name("example");
2470 /// ```
2471 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2472 self.name = v.into();
2473 self
2474 }
2475}
2476
2477impl wkt::message::Message for GetConnectionRequest {
2478 fn typename() -> &'static str {
2479 "type.googleapis.com/google.devtools.cloudbuild.v2.GetConnectionRequest"
2480 }
2481}
2482
2483/// Message for requesting list of Connections.
2484#[derive(Clone, Default, PartialEq)]
2485#[non_exhaustive]
2486pub struct ListConnectionsRequest {
2487 /// Required. The parent, which owns this collection of Connections.
2488 /// Format: `projects/*/locations/*`.
2489 pub parent: std::string::String,
2490
2491 /// Number of results to return in the list.
2492 pub page_size: i32,
2493
2494 /// Page start.
2495 pub page_token: std::string::String,
2496
2497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2498}
2499
2500impl ListConnectionsRequest {
2501 pub fn new() -> Self {
2502 std::default::Default::default()
2503 }
2504
2505 /// Sets the value of [parent][crate::model::ListConnectionsRequest::parent].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_build_v2::model::ListConnectionsRequest;
2510 /// let x = ListConnectionsRequest::new().set_parent("example");
2511 /// ```
2512 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2513 self.parent = v.into();
2514 self
2515 }
2516
2517 /// Sets the value of [page_size][crate::model::ListConnectionsRequest::page_size].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_build_v2::model::ListConnectionsRequest;
2522 /// let x = ListConnectionsRequest::new().set_page_size(42);
2523 /// ```
2524 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2525 self.page_size = v.into();
2526 self
2527 }
2528
2529 /// Sets the value of [page_token][crate::model::ListConnectionsRequest::page_token].
2530 ///
2531 /// # Example
2532 /// ```ignore,no_run
2533 /// # use google_cloud_build_v2::model::ListConnectionsRequest;
2534 /// let x = ListConnectionsRequest::new().set_page_token("example");
2535 /// ```
2536 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2537 self.page_token = v.into();
2538 self
2539 }
2540}
2541
2542impl wkt::message::Message for ListConnectionsRequest {
2543 fn typename() -> &'static str {
2544 "type.googleapis.com/google.devtools.cloudbuild.v2.ListConnectionsRequest"
2545 }
2546}
2547
2548/// Message for response to listing Connections.
2549#[derive(Clone, Default, PartialEq)]
2550#[non_exhaustive]
2551pub struct ListConnectionsResponse {
2552 /// The list of Connections.
2553 pub connections: std::vec::Vec<crate::model::Connection>,
2554
2555 /// A token identifying a page of results the server should return.
2556 pub next_page_token: std::string::String,
2557
2558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2559}
2560
2561impl ListConnectionsResponse {
2562 pub fn new() -> Self {
2563 std::default::Default::default()
2564 }
2565
2566 /// Sets the value of [connections][crate::model::ListConnectionsResponse::connections].
2567 ///
2568 /// # Example
2569 /// ```ignore,no_run
2570 /// # use google_cloud_build_v2::model::ListConnectionsResponse;
2571 /// use google_cloud_build_v2::model::Connection;
2572 /// let x = ListConnectionsResponse::new()
2573 /// .set_connections([
2574 /// Connection::default()/* use setters */,
2575 /// Connection::default()/* use (different) setters */,
2576 /// ]);
2577 /// ```
2578 pub fn set_connections<T, V>(mut self, v: T) -> Self
2579 where
2580 T: std::iter::IntoIterator<Item = V>,
2581 V: std::convert::Into<crate::model::Connection>,
2582 {
2583 use std::iter::Iterator;
2584 self.connections = v.into_iter().map(|i| i.into()).collect();
2585 self
2586 }
2587
2588 /// Sets the value of [next_page_token][crate::model::ListConnectionsResponse::next_page_token].
2589 ///
2590 /// # Example
2591 /// ```ignore,no_run
2592 /// # use google_cloud_build_v2::model::ListConnectionsResponse;
2593 /// let x = ListConnectionsResponse::new().set_next_page_token("example");
2594 /// ```
2595 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2596 self.next_page_token = v.into();
2597 self
2598 }
2599}
2600
2601impl wkt::message::Message for ListConnectionsResponse {
2602 fn typename() -> &'static str {
2603 "type.googleapis.com/google.devtools.cloudbuild.v2.ListConnectionsResponse"
2604 }
2605}
2606
2607#[doc(hidden)]
2608impl gax::paginator::internal::PageableResponse for ListConnectionsResponse {
2609 type PageItem = crate::model::Connection;
2610
2611 fn items(self) -> std::vec::Vec<Self::PageItem> {
2612 self.connections
2613 }
2614
2615 fn next_page_token(&self) -> std::string::String {
2616 use std::clone::Clone;
2617 self.next_page_token.clone()
2618 }
2619}
2620
2621/// Message for updating a Connection.
2622#[derive(Clone, Default, PartialEq)]
2623#[non_exhaustive]
2624pub struct UpdateConnectionRequest {
2625 /// Required. The Connection to update.
2626 pub connection: std::option::Option<crate::model::Connection>,
2627
2628 /// The list of fields to be updated.
2629 pub update_mask: std::option::Option<wkt::FieldMask>,
2630
2631 /// If set to true, and the connection is not found a new connection
2632 /// will be created. In this situation `update_mask` is ignored.
2633 /// The creation will succeed only if the input connection has all the
2634 /// necessary information (e.g a github_config with both user_oauth_token and
2635 /// installation_id properties).
2636 pub allow_missing: bool,
2637
2638 /// The current etag of the connection.
2639 /// If an etag is provided and does not match the current etag of the
2640 /// connection, update will be blocked and an ABORTED error will be returned.
2641 pub etag: std::string::String,
2642
2643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2644}
2645
2646impl UpdateConnectionRequest {
2647 pub fn new() -> Self {
2648 std::default::Default::default()
2649 }
2650
2651 /// Sets the value of [connection][crate::model::UpdateConnectionRequest::connection].
2652 ///
2653 /// # Example
2654 /// ```ignore,no_run
2655 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2656 /// use google_cloud_build_v2::model::Connection;
2657 /// let x = UpdateConnectionRequest::new().set_connection(Connection::default()/* use setters */);
2658 /// ```
2659 pub fn set_connection<T>(mut self, v: T) -> Self
2660 where
2661 T: std::convert::Into<crate::model::Connection>,
2662 {
2663 self.connection = std::option::Option::Some(v.into());
2664 self
2665 }
2666
2667 /// Sets or clears the value of [connection][crate::model::UpdateConnectionRequest::connection].
2668 ///
2669 /// # Example
2670 /// ```ignore,no_run
2671 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2672 /// use google_cloud_build_v2::model::Connection;
2673 /// let x = UpdateConnectionRequest::new().set_or_clear_connection(Some(Connection::default()/* use setters */));
2674 /// let x = UpdateConnectionRequest::new().set_or_clear_connection(None::<Connection>);
2675 /// ```
2676 pub fn set_or_clear_connection<T>(mut self, v: std::option::Option<T>) -> Self
2677 where
2678 T: std::convert::Into<crate::model::Connection>,
2679 {
2680 self.connection = v.map(|x| x.into());
2681 self
2682 }
2683
2684 /// Sets the value of [update_mask][crate::model::UpdateConnectionRequest::update_mask].
2685 ///
2686 /// # Example
2687 /// ```ignore,no_run
2688 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2689 /// use wkt::FieldMask;
2690 /// let x = UpdateConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2691 /// ```
2692 pub fn set_update_mask<T>(mut self, v: T) -> Self
2693 where
2694 T: std::convert::Into<wkt::FieldMask>,
2695 {
2696 self.update_mask = std::option::Option::Some(v.into());
2697 self
2698 }
2699
2700 /// Sets or clears the value of [update_mask][crate::model::UpdateConnectionRequest::update_mask].
2701 ///
2702 /// # Example
2703 /// ```ignore,no_run
2704 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2705 /// use wkt::FieldMask;
2706 /// let x = UpdateConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2707 /// let x = UpdateConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2708 /// ```
2709 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2710 where
2711 T: std::convert::Into<wkt::FieldMask>,
2712 {
2713 self.update_mask = v.map(|x| x.into());
2714 self
2715 }
2716
2717 /// Sets the value of [allow_missing][crate::model::UpdateConnectionRequest::allow_missing].
2718 ///
2719 /// # Example
2720 /// ```ignore,no_run
2721 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2722 /// let x = UpdateConnectionRequest::new().set_allow_missing(true);
2723 /// ```
2724 pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2725 self.allow_missing = v.into();
2726 self
2727 }
2728
2729 /// Sets the value of [etag][crate::model::UpdateConnectionRequest::etag].
2730 ///
2731 /// # Example
2732 /// ```ignore,no_run
2733 /// # use google_cloud_build_v2::model::UpdateConnectionRequest;
2734 /// let x = UpdateConnectionRequest::new().set_etag("example");
2735 /// ```
2736 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2737 self.etag = v.into();
2738 self
2739 }
2740}
2741
2742impl wkt::message::Message for UpdateConnectionRequest {
2743 fn typename() -> &'static str {
2744 "type.googleapis.com/google.devtools.cloudbuild.v2.UpdateConnectionRequest"
2745 }
2746}
2747
2748/// Message for deleting a Connection.
2749#[derive(Clone, Default, PartialEq)]
2750#[non_exhaustive]
2751pub struct DeleteConnectionRequest {
2752 /// Required. The name of the Connection to delete.
2753 /// Format: `projects/*/locations/*/connections/*`.
2754 pub name: std::string::String,
2755
2756 /// The current etag of the connection.
2757 /// If an etag is provided and does not match the current etag of the
2758 /// connection, deletion will be blocked and an ABORTED error will be returned.
2759 pub etag: std::string::String,
2760
2761 /// If set, validate the request, but do not actually post it.
2762 pub validate_only: bool,
2763
2764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2765}
2766
2767impl DeleteConnectionRequest {
2768 pub fn new() -> Self {
2769 std::default::Default::default()
2770 }
2771
2772 /// Sets the value of [name][crate::model::DeleteConnectionRequest::name].
2773 ///
2774 /// # Example
2775 /// ```ignore,no_run
2776 /// # use google_cloud_build_v2::model::DeleteConnectionRequest;
2777 /// let x = DeleteConnectionRequest::new().set_name("example");
2778 /// ```
2779 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2780 self.name = v.into();
2781 self
2782 }
2783
2784 /// Sets the value of [etag][crate::model::DeleteConnectionRequest::etag].
2785 ///
2786 /// # Example
2787 /// ```ignore,no_run
2788 /// # use google_cloud_build_v2::model::DeleteConnectionRequest;
2789 /// let x = DeleteConnectionRequest::new().set_etag("example");
2790 /// ```
2791 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2792 self.etag = v.into();
2793 self
2794 }
2795
2796 /// Sets the value of [validate_only][crate::model::DeleteConnectionRequest::validate_only].
2797 ///
2798 /// # Example
2799 /// ```ignore,no_run
2800 /// # use google_cloud_build_v2::model::DeleteConnectionRequest;
2801 /// let x = DeleteConnectionRequest::new().set_validate_only(true);
2802 /// ```
2803 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2804 self.validate_only = v.into();
2805 self
2806 }
2807}
2808
2809impl wkt::message::Message for DeleteConnectionRequest {
2810 fn typename() -> &'static str {
2811 "type.googleapis.com/google.devtools.cloudbuild.v2.DeleteConnectionRequest"
2812 }
2813}
2814
2815/// Message for creating a Repository.
2816#[derive(Clone, Default, PartialEq)]
2817#[non_exhaustive]
2818pub struct CreateRepositoryRequest {
2819 /// Required. The connection to contain the repository. If the request is part
2820 /// of a BatchCreateRepositoriesRequest, this field should be empty or match
2821 /// the parent specified there.
2822 pub parent: std::string::String,
2823
2824 /// Required. The repository to create.
2825 pub repository: std::option::Option<crate::model::Repository>,
2826
2827 /// Required. The ID to use for the repository, which will become the final
2828 /// component of the repository's resource name. This ID should be unique in
2829 /// the connection. Allows alphanumeric characters and any of
2830 /// -._~%!$&'()*+,;=@.
2831 pub repository_id: std::string::String,
2832
2833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2834}
2835
2836impl CreateRepositoryRequest {
2837 pub fn new() -> Self {
2838 std::default::Default::default()
2839 }
2840
2841 /// Sets the value of [parent][crate::model::CreateRepositoryRequest::parent].
2842 ///
2843 /// # Example
2844 /// ```ignore,no_run
2845 /// # use google_cloud_build_v2::model::CreateRepositoryRequest;
2846 /// let x = CreateRepositoryRequest::new().set_parent("example");
2847 /// ```
2848 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2849 self.parent = v.into();
2850 self
2851 }
2852
2853 /// Sets the value of [repository][crate::model::CreateRepositoryRequest::repository].
2854 ///
2855 /// # Example
2856 /// ```ignore,no_run
2857 /// # use google_cloud_build_v2::model::CreateRepositoryRequest;
2858 /// use google_cloud_build_v2::model::Repository;
2859 /// let x = CreateRepositoryRequest::new().set_repository(Repository::default()/* use setters */);
2860 /// ```
2861 pub fn set_repository<T>(mut self, v: T) -> Self
2862 where
2863 T: std::convert::Into<crate::model::Repository>,
2864 {
2865 self.repository = std::option::Option::Some(v.into());
2866 self
2867 }
2868
2869 /// Sets or clears the value of [repository][crate::model::CreateRepositoryRequest::repository].
2870 ///
2871 /// # Example
2872 /// ```ignore,no_run
2873 /// # use google_cloud_build_v2::model::CreateRepositoryRequest;
2874 /// use google_cloud_build_v2::model::Repository;
2875 /// let x = CreateRepositoryRequest::new().set_or_clear_repository(Some(Repository::default()/* use setters */));
2876 /// let x = CreateRepositoryRequest::new().set_or_clear_repository(None::<Repository>);
2877 /// ```
2878 pub fn set_or_clear_repository<T>(mut self, v: std::option::Option<T>) -> Self
2879 where
2880 T: std::convert::Into<crate::model::Repository>,
2881 {
2882 self.repository = v.map(|x| x.into());
2883 self
2884 }
2885
2886 /// Sets the value of [repository_id][crate::model::CreateRepositoryRequest::repository_id].
2887 ///
2888 /// # Example
2889 /// ```ignore,no_run
2890 /// # use google_cloud_build_v2::model::CreateRepositoryRequest;
2891 /// let x = CreateRepositoryRequest::new().set_repository_id("example");
2892 /// ```
2893 pub fn set_repository_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2894 self.repository_id = v.into();
2895 self
2896 }
2897}
2898
2899impl wkt::message::Message for CreateRepositoryRequest {
2900 fn typename() -> &'static str {
2901 "type.googleapis.com/google.devtools.cloudbuild.v2.CreateRepositoryRequest"
2902 }
2903}
2904
2905/// Message for creating repositoritories in batch.
2906#[derive(Clone, Default, PartialEq)]
2907#[non_exhaustive]
2908pub struct BatchCreateRepositoriesRequest {
2909 /// Required. The connection to contain all the repositories being created.
2910 /// Format: projects/*/locations/*/connections/*
2911 /// The parent field in the CreateRepositoryRequest messages
2912 /// must either be empty or match this field.
2913 pub parent: std::string::String,
2914
2915 /// Required. The request messages specifying the repositories to create.
2916 pub requests: std::vec::Vec<crate::model::CreateRepositoryRequest>,
2917
2918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2919}
2920
2921impl BatchCreateRepositoriesRequest {
2922 pub fn new() -> Self {
2923 std::default::Default::default()
2924 }
2925
2926 /// Sets the value of [parent][crate::model::BatchCreateRepositoriesRequest::parent].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_build_v2::model::BatchCreateRepositoriesRequest;
2931 /// let x = BatchCreateRepositoriesRequest::new().set_parent("example");
2932 /// ```
2933 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2934 self.parent = v.into();
2935 self
2936 }
2937
2938 /// Sets the value of [requests][crate::model::BatchCreateRepositoriesRequest::requests].
2939 ///
2940 /// # Example
2941 /// ```ignore,no_run
2942 /// # use google_cloud_build_v2::model::BatchCreateRepositoriesRequest;
2943 /// use google_cloud_build_v2::model::CreateRepositoryRequest;
2944 /// let x = BatchCreateRepositoriesRequest::new()
2945 /// .set_requests([
2946 /// CreateRepositoryRequest::default()/* use setters */,
2947 /// CreateRepositoryRequest::default()/* use (different) setters */,
2948 /// ]);
2949 /// ```
2950 pub fn set_requests<T, V>(mut self, v: T) -> Self
2951 where
2952 T: std::iter::IntoIterator<Item = V>,
2953 V: std::convert::Into<crate::model::CreateRepositoryRequest>,
2954 {
2955 use std::iter::Iterator;
2956 self.requests = v.into_iter().map(|i| i.into()).collect();
2957 self
2958 }
2959}
2960
2961impl wkt::message::Message for BatchCreateRepositoriesRequest {
2962 fn typename() -> &'static str {
2963 "type.googleapis.com/google.devtools.cloudbuild.v2.BatchCreateRepositoriesRequest"
2964 }
2965}
2966
2967/// Message for response of creating repositories in batch.
2968#[derive(Clone, Default, PartialEq)]
2969#[non_exhaustive]
2970pub struct BatchCreateRepositoriesResponse {
2971 /// Repository resources created.
2972 pub repositories: std::vec::Vec<crate::model::Repository>,
2973
2974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2975}
2976
2977impl BatchCreateRepositoriesResponse {
2978 pub fn new() -> Self {
2979 std::default::Default::default()
2980 }
2981
2982 /// Sets the value of [repositories][crate::model::BatchCreateRepositoriesResponse::repositories].
2983 ///
2984 /// # Example
2985 /// ```ignore,no_run
2986 /// # use google_cloud_build_v2::model::BatchCreateRepositoriesResponse;
2987 /// use google_cloud_build_v2::model::Repository;
2988 /// let x = BatchCreateRepositoriesResponse::new()
2989 /// .set_repositories([
2990 /// Repository::default()/* use setters */,
2991 /// Repository::default()/* use (different) setters */,
2992 /// ]);
2993 /// ```
2994 pub fn set_repositories<T, V>(mut self, v: T) -> Self
2995 where
2996 T: std::iter::IntoIterator<Item = V>,
2997 V: std::convert::Into<crate::model::Repository>,
2998 {
2999 use std::iter::Iterator;
3000 self.repositories = v.into_iter().map(|i| i.into()).collect();
3001 self
3002 }
3003}
3004
3005impl wkt::message::Message for BatchCreateRepositoriesResponse {
3006 fn typename() -> &'static str {
3007 "type.googleapis.com/google.devtools.cloudbuild.v2.BatchCreateRepositoriesResponse"
3008 }
3009}
3010
3011/// Message for getting the details of a Repository.
3012#[derive(Clone, Default, PartialEq)]
3013#[non_exhaustive]
3014pub struct GetRepositoryRequest {
3015 /// Required. The name of the Repository to retrieve.
3016 /// Format: `projects/*/locations/*/connections/*/repositories/*`.
3017 pub name: std::string::String,
3018
3019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3020}
3021
3022impl GetRepositoryRequest {
3023 pub fn new() -> Self {
3024 std::default::Default::default()
3025 }
3026
3027 /// Sets the value of [name][crate::model::GetRepositoryRequest::name].
3028 ///
3029 /// # Example
3030 /// ```ignore,no_run
3031 /// # use google_cloud_build_v2::model::GetRepositoryRequest;
3032 /// let x = GetRepositoryRequest::new().set_name("example");
3033 /// ```
3034 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3035 self.name = v.into();
3036 self
3037 }
3038}
3039
3040impl wkt::message::Message for GetRepositoryRequest {
3041 fn typename() -> &'static str {
3042 "type.googleapis.com/google.devtools.cloudbuild.v2.GetRepositoryRequest"
3043 }
3044}
3045
3046/// Message for requesting list of Repositories.
3047#[derive(Clone, Default, PartialEq)]
3048#[non_exhaustive]
3049pub struct ListRepositoriesRequest {
3050 /// Required. The parent, which owns this collection of Repositories.
3051 /// Format: `projects/*/locations/*/connections/*`.
3052 pub parent: std::string::String,
3053
3054 /// Number of results to return in the list.
3055 pub page_size: i32,
3056
3057 /// Page start.
3058 pub page_token: std::string::String,
3059
3060 /// A filter expression that filters resources listed in the response.
3061 /// Expressions must follow API improvement proposal
3062 /// [AIP-160](https://google.aip.dev/160). e.g.
3063 /// `remote_uri:"<https://github.com>*"`.
3064 pub filter: std::string::String,
3065
3066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3067}
3068
3069impl ListRepositoriesRequest {
3070 pub fn new() -> Self {
3071 std::default::Default::default()
3072 }
3073
3074 /// Sets the value of [parent][crate::model::ListRepositoriesRequest::parent].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_build_v2::model::ListRepositoriesRequest;
3079 /// let x = ListRepositoriesRequest::new().set_parent("example");
3080 /// ```
3081 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082 self.parent = v.into();
3083 self
3084 }
3085
3086 /// Sets the value of [page_size][crate::model::ListRepositoriesRequest::page_size].
3087 ///
3088 /// # Example
3089 /// ```ignore,no_run
3090 /// # use google_cloud_build_v2::model::ListRepositoriesRequest;
3091 /// let x = ListRepositoriesRequest::new().set_page_size(42);
3092 /// ```
3093 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3094 self.page_size = v.into();
3095 self
3096 }
3097
3098 /// Sets the value of [page_token][crate::model::ListRepositoriesRequest::page_token].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_build_v2::model::ListRepositoriesRequest;
3103 /// let x = ListRepositoriesRequest::new().set_page_token("example");
3104 /// ```
3105 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3106 self.page_token = v.into();
3107 self
3108 }
3109
3110 /// Sets the value of [filter][crate::model::ListRepositoriesRequest::filter].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_build_v2::model::ListRepositoriesRequest;
3115 /// let x = ListRepositoriesRequest::new().set_filter("example");
3116 /// ```
3117 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118 self.filter = v.into();
3119 self
3120 }
3121}
3122
3123impl wkt::message::Message for ListRepositoriesRequest {
3124 fn typename() -> &'static str {
3125 "type.googleapis.com/google.devtools.cloudbuild.v2.ListRepositoriesRequest"
3126 }
3127}
3128
3129/// Message for response to listing Repositories.
3130#[derive(Clone, Default, PartialEq)]
3131#[non_exhaustive]
3132pub struct ListRepositoriesResponse {
3133 /// The list of Repositories.
3134 pub repositories: std::vec::Vec<crate::model::Repository>,
3135
3136 /// A token identifying a page of results the server should return.
3137 pub next_page_token: std::string::String,
3138
3139 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3140}
3141
3142impl ListRepositoriesResponse {
3143 pub fn new() -> Self {
3144 std::default::Default::default()
3145 }
3146
3147 /// Sets the value of [repositories][crate::model::ListRepositoriesResponse::repositories].
3148 ///
3149 /// # Example
3150 /// ```ignore,no_run
3151 /// # use google_cloud_build_v2::model::ListRepositoriesResponse;
3152 /// use google_cloud_build_v2::model::Repository;
3153 /// let x = ListRepositoriesResponse::new()
3154 /// .set_repositories([
3155 /// Repository::default()/* use setters */,
3156 /// Repository::default()/* use (different) setters */,
3157 /// ]);
3158 /// ```
3159 pub fn set_repositories<T, V>(mut self, v: T) -> Self
3160 where
3161 T: std::iter::IntoIterator<Item = V>,
3162 V: std::convert::Into<crate::model::Repository>,
3163 {
3164 use std::iter::Iterator;
3165 self.repositories = v.into_iter().map(|i| i.into()).collect();
3166 self
3167 }
3168
3169 /// Sets the value of [next_page_token][crate::model::ListRepositoriesResponse::next_page_token].
3170 ///
3171 /// # Example
3172 /// ```ignore,no_run
3173 /// # use google_cloud_build_v2::model::ListRepositoriesResponse;
3174 /// let x = ListRepositoriesResponse::new().set_next_page_token("example");
3175 /// ```
3176 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3177 self.next_page_token = v.into();
3178 self
3179 }
3180}
3181
3182impl wkt::message::Message for ListRepositoriesResponse {
3183 fn typename() -> &'static str {
3184 "type.googleapis.com/google.devtools.cloudbuild.v2.ListRepositoriesResponse"
3185 }
3186}
3187
3188#[doc(hidden)]
3189impl gax::paginator::internal::PageableResponse for ListRepositoriesResponse {
3190 type PageItem = crate::model::Repository;
3191
3192 fn items(self) -> std::vec::Vec<Self::PageItem> {
3193 self.repositories
3194 }
3195
3196 fn next_page_token(&self) -> std::string::String {
3197 use std::clone::Clone;
3198 self.next_page_token.clone()
3199 }
3200}
3201
3202/// Message for deleting a Repository.
3203#[derive(Clone, Default, PartialEq)]
3204#[non_exhaustive]
3205pub struct DeleteRepositoryRequest {
3206 /// Required. The name of the Repository to delete.
3207 /// Format: `projects/*/locations/*/connections/*/repositories/*`.
3208 pub name: std::string::String,
3209
3210 /// The current etag of the repository.
3211 /// If an etag is provided and does not match the current etag of the
3212 /// repository, deletion will be blocked and an ABORTED error will be returned.
3213 pub etag: std::string::String,
3214
3215 /// If set, validate the request, but do not actually post it.
3216 pub validate_only: bool,
3217
3218 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3219}
3220
3221impl DeleteRepositoryRequest {
3222 pub fn new() -> Self {
3223 std::default::Default::default()
3224 }
3225
3226 /// Sets the value of [name][crate::model::DeleteRepositoryRequest::name].
3227 ///
3228 /// # Example
3229 /// ```ignore,no_run
3230 /// # use google_cloud_build_v2::model::DeleteRepositoryRequest;
3231 /// let x = DeleteRepositoryRequest::new().set_name("example");
3232 /// ```
3233 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3234 self.name = v.into();
3235 self
3236 }
3237
3238 /// Sets the value of [etag][crate::model::DeleteRepositoryRequest::etag].
3239 ///
3240 /// # Example
3241 /// ```ignore,no_run
3242 /// # use google_cloud_build_v2::model::DeleteRepositoryRequest;
3243 /// let x = DeleteRepositoryRequest::new().set_etag("example");
3244 /// ```
3245 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3246 self.etag = v.into();
3247 self
3248 }
3249
3250 /// Sets the value of [validate_only][crate::model::DeleteRepositoryRequest::validate_only].
3251 ///
3252 /// # Example
3253 /// ```ignore,no_run
3254 /// # use google_cloud_build_v2::model::DeleteRepositoryRequest;
3255 /// let x = DeleteRepositoryRequest::new().set_validate_only(true);
3256 /// ```
3257 pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3258 self.validate_only = v.into();
3259 self
3260 }
3261}
3262
3263impl wkt::message::Message for DeleteRepositoryRequest {
3264 fn typename() -> &'static str {
3265 "type.googleapis.com/google.devtools.cloudbuild.v2.DeleteRepositoryRequest"
3266 }
3267}
3268
3269/// Message for fetching SCM read/write token.
3270#[derive(Clone, Default, PartialEq)]
3271#[non_exhaustive]
3272pub struct FetchReadWriteTokenRequest {
3273 /// Required. The resource name of the repository in the format
3274 /// `projects/*/locations/*/connections/*/repositories/*`.
3275 pub repository: std::string::String,
3276
3277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3278}
3279
3280impl FetchReadWriteTokenRequest {
3281 pub fn new() -> Self {
3282 std::default::Default::default()
3283 }
3284
3285 /// Sets the value of [repository][crate::model::FetchReadWriteTokenRequest::repository].
3286 ///
3287 /// # Example
3288 /// ```ignore,no_run
3289 /// # use google_cloud_build_v2::model::FetchReadWriteTokenRequest;
3290 /// let x = FetchReadWriteTokenRequest::new().set_repository("example");
3291 /// ```
3292 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3293 self.repository = v.into();
3294 self
3295 }
3296}
3297
3298impl wkt::message::Message for FetchReadWriteTokenRequest {
3299 fn typename() -> &'static str {
3300 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchReadWriteTokenRequest"
3301 }
3302}
3303
3304/// Message for fetching SCM read token.
3305#[derive(Clone, Default, PartialEq)]
3306#[non_exhaustive]
3307pub struct FetchReadTokenRequest {
3308 /// Required. The resource name of the repository in the format
3309 /// `projects/*/locations/*/connections/*/repositories/*`.
3310 pub repository: std::string::String,
3311
3312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3313}
3314
3315impl FetchReadTokenRequest {
3316 pub fn new() -> Self {
3317 std::default::Default::default()
3318 }
3319
3320 /// Sets the value of [repository][crate::model::FetchReadTokenRequest::repository].
3321 ///
3322 /// # Example
3323 /// ```ignore,no_run
3324 /// # use google_cloud_build_v2::model::FetchReadTokenRequest;
3325 /// let x = FetchReadTokenRequest::new().set_repository("example");
3326 /// ```
3327 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3328 self.repository = v.into();
3329 self
3330 }
3331}
3332
3333impl wkt::message::Message for FetchReadTokenRequest {
3334 fn typename() -> &'static str {
3335 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchReadTokenRequest"
3336 }
3337}
3338
3339/// Message for responding to get read token.
3340#[derive(Clone, Default, PartialEq)]
3341#[non_exhaustive]
3342pub struct FetchReadTokenResponse {
3343 /// The token content.
3344 pub token: std::string::String,
3345
3346 /// Expiration timestamp. Can be empty if unknown or non-expiring.
3347 pub expiration_time: std::option::Option<wkt::Timestamp>,
3348
3349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3350}
3351
3352impl FetchReadTokenResponse {
3353 pub fn new() -> Self {
3354 std::default::Default::default()
3355 }
3356
3357 /// Sets the value of [token][crate::model::FetchReadTokenResponse::token].
3358 ///
3359 /// # Example
3360 /// ```ignore,no_run
3361 /// # use google_cloud_build_v2::model::FetchReadTokenResponse;
3362 /// let x = FetchReadTokenResponse::new().set_token("example");
3363 /// ```
3364 pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3365 self.token = v.into();
3366 self
3367 }
3368
3369 /// Sets the value of [expiration_time][crate::model::FetchReadTokenResponse::expiration_time].
3370 ///
3371 /// # Example
3372 /// ```ignore,no_run
3373 /// # use google_cloud_build_v2::model::FetchReadTokenResponse;
3374 /// use wkt::Timestamp;
3375 /// let x = FetchReadTokenResponse::new().set_expiration_time(Timestamp::default()/* use setters */);
3376 /// ```
3377 pub fn set_expiration_time<T>(mut self, v: T) -> Self
3378 where
3379 T: std::convert::Into<wkt::Timestamp>,
3380 {
3381 self.expiration_time = std::option::Option::Some(v.into());
3382 self
3383 }
3384
3385 /// Sets or clears the value of [expiration_time][crate::model::FetchReadTokenResponse::expiration_time].
3386 ///
3387 /// # Example
3388 /// ```ignore,no_run
3389 /// # use google_cloud_build_v2::model::FetchReadTokenResponse;
3390 /// use wkt::Timestamp;
3391 /// let x = FetchReadTokenResponse::new().set_or_clear_expiration_time(Some(Timestamp::default()/* use setters */));
3392 /// let x = FetchReadTokenResponse::new().set_or_clear_expiration_time(None::<Timestamp>);
3393 /// ```
3394 pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
3395 where
3396 T: std::convert::Into<wkt::Timestamp>,
3397 {
3398 self.expiration_time = v.map(|x| x.into());
3399 self
3400 }
3401}
3402
3403impl wkt::message::Message for FetchReadTokenResponse {
3404 fn typename() -> &'static str {
3405 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchReadTokenResponse"
3406 }
3407}
3408
3409/// Message for responding to get read/write token.
3410#[derive(Clone, Default, PartialEq)]
3411#[non_exhaustive]
3412pub struct FetchReadWriteTokenResponse {
3413 /// The token content.
3414 pub token: std::string::String,
3415
3416 /// Expiration timestamp. Can be empty if unknown or non-expiring.
3417 pub expiration_time: std::option::Option<wkt::Timestamp>,
3418
3419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3420}
3421
3422impl FetchReadWriteTokenResponse {
3423 pub fn new() -> Self {
3424 std::default::Default::default()
3425 }
3426
3427 /// Sets the value of [token][crate::model::FetchReadWriteTokenResponse::token].
3428 ///
3429 /// # Example
3430 /// ```ignore,no_run
3431 /// # use google_cloud_build_v2::model::FetchReadWriteTokenResponse;
3432 /// let x = FetchReadWriteTokenResponse::new().set_token("example");
3433 /// ```
3434 pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3435 self.token = v.into();
3436 self
3437 }
3438
3439 /// Sets the value of [expiration_time][crate::model::FetchReadWriteTokenResponse::expiration_time].
3440 ///
3441 /// # Example
3442 /// ```ignore,no_run
3443 /// # use google_cloud_build_v2::model::FetchReadWriteTokenResponse;
3444 /// use wkt::Timestamp;
3445 /// let x = FetchReadWriteTokenResponse::new().set_expiration_time(Timestamp::default()/* use setters */);
3446 /// ```
3447 pub fn set_expiration_time<T>(mut self, v: T) -> Self
3448 where
3449 T: std::convert::Into<wkt::Timestamp>,
3450 {
3451 self.expiration_time = std::option::Option::Some(v.into());
3452 self
3453 }
3454
3455 /// Sets or clears the value of [expiration_time][crate::model::FetchReadWriteTokenResponse::expiration_time].
3456 ///
3457 /// # Example
3458 /// ```ignore,no_run
3459 /// # use google_cloud_build_v2::model::FetchReadWriteTokenResponse;
3460 /// use wkt::Timestamp;
3461 /// let x = FetchReadWriteTokenResponse::new().set_or_clear_expiration_time(Some(Timestamp::default()/* use setters */));
3462 /// let x = FetchReadWriteTokenResponse::new().set_or_clear_expiration_time(None::<Timestamp>);
3463 /// ```
3464 pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
3465 where
3466 T: std::convert::Into<wkt::Timestamp>,
3467 {
3468 self.expiration_time = v.map(|x| x.into());
3469 self
3470 }
3471}
3472
3473impl wkt::message::Message for FetchReadWriteTokenResponse {
3474 fn typename() -> &'static str {
3475 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchReadWriteTokenResponse"
3476 }
3477}
3478
3479/// RPC request object accepted by the ProcessWebhook RPC method.
3480#[derive(Clone, Default, PartialEq)]
3481#[non_exhaustive]
3482pub struct ProcessWebhookRequest {
3483 /// Required. Project and location where the webhook will be received.
3484 /// Format: `projects/*/locations/*`.
3485 pub parent: std::string::String,
3486
3487 /// HTTP request body.
3488 pub body: std::option::Option<api::model::HttpBody>,
3489
3490 /// Arbitrary additional key to find the maching repository for a webhook event
3491 /// if needed.
3492 pub webhook_key: std::string::String,
3493
3494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3495}
3496
3497impl ProcessWebhookRequest {
3498 pub fn new() -> Self {
3499 std::default::Default::default()
3500 }
3501
3502 /// Sets the value of [parent][crate::model::ProcessWebhookRequest::parent].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_build_v2::model::ProcessWebhookRequest;
3507 /// let x = ProcessWebhookRequest::new().set_parent("example");
3508 /// ```
3509 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3510 self.parent = v.into();
3511 self
3512 }
3513
3514 /// Sets the value of [body][crate::model::ProcessWebhookRequest::body].
3515 ///
3516 /// # Example
3517 /// ```ignore,no_run
3518 /// # use google_cloud_build_v2::model::ProcessWebhookRequest;
3519 /// use api::model::HttpBody;
3520 /// let x = ProcessWebhookRequest::new().set_body(HttpBody::default()/* use setters */);
3521 /// ```
3522 pub fn set_body<T>(mut self, v: T) -> Self
3523 where
3524 T: std::convert::Into<api::model::HttpBody>,
3525 {
3526 self.body = std::option::Option::Some(v.into());
3527 self
3528 }
3529
3530 /// Sets or clears the value of [body][crate::model::ProcessWebhookRequest::body].
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_build_v2::model::ProcessWebhookRequest;
3535 /// use api::model::HttpBody;
3536 /// let x = ProcessWebhookRequest::new().set_or_clear_body(Some(HttpBody::default()/* use setters */));
3537 /// let x = ProcessWebhookRequest::new().set_or_clear_body(None::<HttpBody>);
3538 /// ```
3539 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
3540 where
3541 T: std::convert::Into<api::model::HttpBody>,
3542 {
3543 self.body = v.map(|x| x.into());
3544 self
3545 }
3546
3547 /// Sets the value of [webhook_key][crate::model::ProcessWebhookRequest::webhook_key].
3548 ///
3549 /// # Example
3550 /// ```ignore,no_run
3551 /// # use google_cloud_build_v2::model::ProcessWebhookRequest;
3552 /// let x = ProcessWebhookRequest::new().set_webhook_key("example");
3553 /// ```
3554 pub fn set_webhook_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3555 self.webhook_key = v.into();
3556 self
3557 }
3558}
3559
3560impl wkt::message::Message for ProcessWebhookRequest {
3561 fn typename() -> &'static str {
3562 "type.googleapis.com/google.devtools.cloudbuild.v2.ProcessWebhookRequest"
3563 }
3564}
3565
3566/// Request for fetching git refs
3567#[derive(Clone, Default, PartialEq)]
3568#[non_exhaustive]
3569pub struct FetchGitRefsRequest {
3570 /// Required. The resource name of the repository in the format
3571 /// `projects/*/locations/*/connections/*/repositories/*`.
3572 pub repository: std::string::String,
3573
3574 /// Type of refs to fetch
3575 pub ref_type: crate::model::fetch_git_refs_request::RefType,
3576
3577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3578}
3579
3580impl FetchGitRefsRequest {
3581 pub fn new() -> Self {
3582 std::default::Default::default()
3583 }
3584
3585 /// Sets the value of [repository][crate::model::FetchGitRefsRequest::repository].
3586 ///
3587 /// # Example
3588 /// ```ignore,no_run
3589 /// # use google_cloud_build_v2::model::FetchGitRefsRequest;
3590 /// let x = FetchGitRefsRequest::new().set_repository("example");
3591 /// ```
3592 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3593 self.repository = v.into();
3594 self
3595 }
3596
3597 /// Sets the value of [ref_type][crate::model::FetchGitRefsRequest::ref_type].
3598 ///
3599 /// # Example
3600 /// ```ignore,no_run
3601 /// # use google_cloud_build_v2::model::FetchGitRefsRequest;
3602 /// use google_cloud_build_v2::model::fetch_git_refs_request::RefType;
3603 /// let x0 = FetchGitRefsRequest::new().set_ref_type(RefType::Tag);
3604 /// let x1 = FetchGitRefsRequest::new().set_ref_type(RefType::Branch);
3605 /// ```
3606 pub fn set_ref_type<T: std::convert::Into<crate::model::fetch_git_refs_request::RefType>>(
3607 mut self,
3608 v: T,
3609 ) -> Self {
3610 self.ref_type = v.into();
3611 self
3612 }
3613}
3614
3615impl wkt::message::Message for FetchGitRefsRequest {
3616 fn typename() -> &'static str {
3617 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchGitRefsRequest"
3618 }
3619}
3620
3621/// Defines additional types related to [FetchGitRefsRequest].
3622pub mod fetch_git_refs_request {
3623 #[allow(unused_imports)]
3624 use super::*;
3625
3626 /// Type of refs
3627 ///
3628 /// # Working with unknown values
3629 ///
3630 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3631 /// additional enum variants at any time. Adding new variants is not considered
3632 /// a breaking change. Applications should write their code in anticipation of:
3633 ///
3634 /// - New values appearing in future releases of the client library, **and**
3635 /// - New values received dynamically, without application changes.
3636 ///
3637 /// Please consult the [Working with enums] section in the user guide for some
3638 /// guidelines.
3639 ///
3640 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3641 #[derive(Clone, Debug, PartialEq)]
3642 #[non_exhaustive]
3643 pub enum RefType {
3644 /// No type specified.
3645 Unspecified,
3646 /// To fetch tags.
3647 Tag,
3648 /// To fetch branches.
3649 Branch,
3650 /// If set, the enum was initialized with an unknown value.
3651 ///
3652 /// Applications can examine the value using [RefType::value] or
3653 /// [RefType::name].
3654 UnknownValue(ref_type::UnknownValue),
3655 }
3656
3657 #[doc(hidden)]
3658 pub mod ref_type {
3659 #[allow(unused_imports)]
3660 use super::*;
3661 #[derive(Clone, Debug, PartialEq)]
3662 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3663 }
3664
3665 impl RefType {
3666 /// Gets the enum value.
3667 ///
3668 /// Returns `None` if the enum contains an unknown value deserialized from
3669 /// the string representation of enums.
3670 pub fn value(&self) -> std::option::Option<i32> {
3671 match self {
3672 Self::Unspecified => std::option::Option::Some(0),
3673 Self::Tag => std::option::Option::Some(1),
3674 Self::Branch => std::option::Option::Some(2),
3675 Self::UnknownValue(u) => u.0.value(),
3676 }
3677 }
3678
3679 /// Gets the enum value as a string.
3680 ///
3681 /// Returns `None` if the enum contains an unknown value deserialized from
3682 /// the integer representation of enums.
3683 pub fn name(&self) -> std::option::Option<&str> {
3684 match self {
3685 Self::Unspecified => std::option::Option::Some("REF_TYPE_UNSPECIFIED"),
3686 Self::Tag => std::option::Option::Some("TAG"),
3687 Self::Branch => std::option::Option::Some("BRANCH"),
3688 Self::UnknownValue(u) => u.0.name(),
3689 }
3690 }
3691 }
3692
3693 impl std::default::Default for RefType {
3694 fn default() -> Self {
3695 use std::convert::From;
3696 Self::from(0)
3697 }
3698 }
3699
3700 impl std::fmt::Display for RefType {
3701 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3702 wkt::internal::display_enum(f, self.name(), self.value())
3703 }
3704 }
3705
3706 impl std::convert::From<i32> for RefType {
3707 fn from(value: i32) -> Self {
3708 match value {
3709 0 => Self::Unspecified,
3710 1 => Self::Tag,
3711 2 => Self::Branch,
3712 _ => Self::UnknownValue(ref_type::UnknownValue(
3713 wkt::internal::UnknownEnumValue::Integer(value),
3714 )),
3715 }
3716 }
3717 }
3718
3719 impl std::convert::From<&str> for RefType {
3720 fn from(value: &str) -> Self {
3721 use std::string::ToString;
3722 match value {
3723 "REF_TYPE_UNSPECIFIED" => Self::Unspecified,
3724 "TAG" => Self::Tag,
3725 "BRANCH" => Self::Branch,
3726 _ => Self::UnknownValue(ref_type::UnknownValue(
3727 wkt::internal::UnknownEnumValue::String(value.to_string()),
3728 )),
3729 }
3730 }
3731 }
3732
3733 impl serde::ser::Serialize for RefType {
3734 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3735 where
3736 S: serde::Serializer,
3737 {
3738 match self {
3739 Self::Unspecified => serializer.serialize_i32(0),
3740 Self::Tag => serializer.serialize_i32(1),
3741 Self::Branch => serializer.serialize_i32(2),
3742 Self::UnknownValue(u) => u.0.serialize(serializer),
3743 }
3744 }
3745 }
3746
3747 impl<'de> serde::de::Deserialize<'de> for RefType {
3748 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3749 where
3750 D: serde::Deserializer<'de>,
3751 {
3752 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RefType>::new(
3753 ".google.devtools.cloudbuild.v2.FetchGitRefsRequest.RefType",
3754 ))
3755 }
3756 }
3757}
3758
3759/// Response for fetching git refs
3760#[derive(Clone, Default, PartialEq)]
3761#[non_exhaustive]
3762pub struct FetchGitRefsResponse {
3763 /// Name of the refs fetched.
3764 pub ref_names: std::vec::Vec<std::string::String>,
3765
3766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3767}
3768
3769impl FetchGitRefsResponse {
3770 pub fn new() -> Self {
3771 std::default::Default::default()
3772 }
3773
3774 /// Sets the value of [ref_names][crate::model::FetchGitRefsResponse::ref_names].
3775 ///
3776 /// # Example
3777 /// ```ignore,no_run
3778 /// # use google_cloud_build_v2::model::FetchGitRefsResponse;
3779 /// let x = FetchGitRefsResponse::new().set_ref_names(["a", "b", "c"]);
3780 /// ```
3781 pub fn set_ref_names<T, V>(mut self, v: T) -> Self
3782 where
3783 T: std::iter::IntoIterator<Item = V>,
3784 V: std::convert::Into<std::string::String>,
3785 {
3786 use std::iter::Iterator;
3787 self.ref_names = v.into_iter().map(|i| i.into()).collect();
3788 self
3789 }
3790}
3791
3792impl wkt::message::Message for FetchGitRefsResponse {
3793 fn typename() -> &'static str {
3794 "type.googleapis.com/google.devtools.cloudbuild.v2.FetchGitRefsResponse"
3795 }
3796}