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