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