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