google_cloud_apphub_v1/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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_location;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request for LookupServiceProjectAttachment.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct LookupServiceProjectAttachmentRequest {
45 /// Required. Service project ID and location to lookup service project
46 /// attachment for. Only global location is supported. Expected format:
47 /// `projects/{project}/locations/{location}`.
48 pub name: std::string::String,
49
50 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
51}
52
53impl LookupServiceProjectAttachmentRequest {
54 /// Creates a new default instance.
55 pub fn new() -> Self {
56 std::default::Default::default()
57 }
58
59 /// Sets the value of [name][crate::model::LookupServiceProjectAttachmentRequest::name].
60 ///
61 /// # Example
62 /// ```ignore,no_run
63 /// # use google_cloud_apphub_v1::model::LookupServiceProjectAttachmentRequest;
64 /// let x = LookupServiceProjectAttachmentRequest::new().set_name("example");
65 /// ```
66 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
67 self.name = v.into();
68 self
69 }
70}
71
72impl wkt::message::Message for LookupServiceProjectAttachmentRequest {
73 fn typename() -> &'static str {
74 "type.googleapis.com/google.cloud.apphub.v1.LookupServiceProjectAttachmentRequest"
75 }
76}
77
78/// Response for LookupServiceProjectAttachment.
79#[derive(Clone, Default, PartialEq)]
80#[non_exhaustive]
81pub struct LookupServiceProjectAttachmentResponse {
82 /// Service project attachment for a project if exists, empty otherwise.
83 pub service_project_attachment: std::option::Option<crate::model::ServiceProjectAttachment>,
84
85 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
86}
87
88impl LookupServiceProjectAttachmentResponse {
89 /// Creates a new default instance.
90 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [service_project_attachment][crate::model::LookupServiceProjectAttachmentResponse::service_project_attachment].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_apphub_v1::model::LookupServiceProjectAttachmentResponse;
99 /// use google_cloud_apphub_v1::model::ServiceProjectAttachment;
100 /// let x = LookupServiceProjectAttachmentResponse::new().set_service_project_attachment(ServiceProjectAttachment::default()/* use setters */);
101 /// ```
102 pub fn set_service_project_attachment<T>(mut self, v: T) -> Self
103 where
104 T: std::convert::Into<crate::model::ServiceProjectAttachment>,
105 {
106 self.service_project_attachment = std::option::Option::Some(v.into());
107 self
108 }
109
110 /// Sets or clears the value of [service_project_attachment][crate::model::LookupServiceProjectAttachmentResponse::service_project_attachment].
111 ///
112 /// # Example
113 /// ```ignore,no_run
114 /// # use google_cloud_apphub_v1::model::LookupServiceProjectAttachmentResponse;
115 /// use google_cloud_apphub_v1::model::ServiceProjectAttachment;
116 /// let x = LookupServiceProjectAttachmentResponse::new().set_or_clear_service_project_attachment(Some(ServiceProjectAttachment::default()/* use setters */));
117 /// let x = LookupServiceProjectAttachmentResponse::new().set_or_clear_service_project_attachment(None::<ServiceProjectAttachment>);
118 /// ```
119 pub fn set_or_clear_service_project_attachment<T>(mut self, v: std::option::Option<T>) -> Self
120 where
121 T: std::convert::Into<crate::model::ServiceProjectAttachment>,
122 {
123 self.service_project_attachment = v.map(|x| x.into());
124 self
125 }
126}
127
128impl wkt::message::Message for LookupServiceProjectAttachmentResponse {
129 fn typename() -> &'static str {
130 "type.googleapis.com/google.cloud.apphub.v1.LookupServiceProjectAttachmentResponse"
131 }
132}
133
134/// Request for ListServiceProjectAttachments.
135#[derive(Clone, Default, PartialEq)]
136#[non_exhaustive]
137pub struct ListServiceProjectAttachmentsRequest {
138 /// Required. Host project ID and location to list service project attachments.
139 /// Only global location is supported. Expected format:
140 /// `projects/{project}/locations/{location}`.
141 pub parent: std::string::String,
142
143 /// Optional. Requested page size. Server may return fewer items than
144 /// requested. If unspecified, server will pick an appropriate default.
145 pub page_size: i32,
146
147 /// Optional. A token identifying a page of results the server should return.
148 pub page_token: std::string::String,
149
150 /// Optional. Filtering results.
151 pub filter: std::string::String,
152
153 /// Optional. Hint for how to order the results.
154 pub order_by: std::string::String,
155
156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
157}
158
159impl ListServiceProjectAttachmentsRequest {
160 /// Creates a new default instance.
161 pub fn new() -> Self {
162 std::default::Default::default()
163 }
164
165 /// Sets the value of [parent][crate::model::ListServiceProjectAttachmentsRequest::parent].
166 ///
167 /// # Example
168 /// ```ignore,no_run
169 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsRequest;
170 /// # let project_id = "project_id";
171 /// # let location_id = "location_id";
172 /// let x = ListServiceProjectAttachmentsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
173 /// ```
174 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
175 self.parent = v.into();
176 self
177 }
178
179 /// Sets the value of [page_size][crate::model::ListServiceProjectAttachmentsRequest::page_size].
180 ///
181 /// # Example
182 /// ```ignore,no_run
183 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsRequest;
184 /// let x = ListServiceProjectAttachmentsRequest::new().set_page_size(42);
185 /// ```
186 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
187 self.page_size = v.into();
188 self
189 }
190
191 /// Sets the value of [page_token][crate::model::ListServiceProjectAttachmentsRequest::page_token].
192 ///
193 /// # Example
194 /// ```ignore,no_run
195 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsRequest;
196 /// let x = ListServiceProjectAttachmentsRequest::new().set_page_token("example");
197 /// ```
198 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
199 self.page_token = v.into();
200 self
201 }
202
203 /// Sets the value of [filter][crate::model::ListServiceProjectAttachmentsRequest::filter].
204 ///
205 /// # Example
206 /// ```ignore,no_run
207 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsRequest;
208 /// let x = ListServiceProjectAttachmentsRequest::new().set_filter("example");
209 /// ```
210 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
211 self.filter = v.into();
212 self
213 }
214
215 /// Sets the value of [order_by][crate::model::ListServiceProjectAttachmentsRequest::order_by].
216 ///
217 /// # Example
218 /// ```ignore,no_run
219 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsRequest;
220 /// let x = ListServiceProjectAttachmentsRequest::new().set_order_by("example");
221 /// ```
222 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
223 self.order_by = v.into();
224 self
225 }
226}
227
228impl wkt::message::Message for ListServiceProjectAttachmentsRequest {
229 fn typename() -> &'static str {
230 "type.googleapis.com/google.cloud.apphub.v1.ListServiceProjectAttachmentsRequest"
231 }
232}
233
234/// Response for ListServiceProjectAttachments.
235#[derive(Clone, Default, PartialEq)]
236#[non_exhaustive]
237pub struct ListServiceProjectAttachmentsResponse {
238 /// List of service project attachments.
239 pub service_project_attachments: std::vec::Vec<crate::model::ServiceProjectAttachment>,
240
241 /// A token identifying a page of results the server should return.
242 pub next_page_token: std::string::String,
243
244 /// Locations that could not be reached.
245 pub unreachable: std::vec::Vec<std::string::String>,
246
247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
248}
249
250impl ListServiceProjectAttachmentsResponse {
251 /// Creates a new default instance.
252 pub fn new() -> Self {
253 std::default::Default::default()
254 }
255
256 /// Sets the value of [service_project_attachments][crate::model::ListServiceProjectAttachmentsResponse::service_project_attachments].
257 ///
258 /// # Example
259 /// ```ignore,no_run
260 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsResponse;
261 /// use google_cloud_apphub_v1::model::ServiceProjectAttachment;
262 /// let x = ListServiceProjectAttachmentsResponse::new()
263 /// .set_service_project_attachments([
264 /// ServiceProjectAttachment::default()/* use setters */,
265 /// ServiceProjectAttachment::default()/* use (different) setters */,
266 /// ]);
267 /// ```
268 pub fn set_service_project_attachments<T, V>(mut self, v: T) -> Self
269 where
270 T: std::iter::IntoIterator<Item = V>,
271 V: std::convert::Into<crate::model::ServiceProjectAttachment>,
272 {
273 use std::iter::Iterator;
274 self.service_project_attachments = v.into_iter().map(|i| i.into()).collect();
275 self
276 }
277
278 /// Sets the value of [next_page_token][crate::model::ListServiceProjectAttachmentsResponse::next_page_token].
279 ///
280 /// # Example
281 /// ```ignore,no_run
282 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsResponse;
283 /// let x = ListServiceProjectAttachmentsResponse::new().set_next_page_token("example");
284 /// ```
285 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
286 self.next_page_token = v.into();
287 self
288 }
289
290 /// Sets the value of [unreachable][crate::model::ListServiceProjectAttachmentsResponse::unreachable].
291 ///
292 /// # Example
293 /// ```ignore,no_run
294 /// # use google_cloud_apphub_v1::model::ListServiceProjectAttachmentsResponse;
295 /// let x = ListServiceProjectAttachmentsResponse::new().set_unreachable(["a", "b", "c"]);
296 /// ```
297 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
298 where
299 T: std::iter::IntoIterator<Item = V>,
300 V: std::convert::Into<std::string::String>,
301 {
302 use std::iter::Iterator;
303 self.unreachable = v.into_iter().map(|i| i.into()).collect();
304 self
305 }
306}
307
308impl wkt::message::Message for ListServiceProjectAttachmentsResponse {
309 fn typename() -> &'static str {
310 "type.googleapis.com/google.cloud.apphub.v1.ListServiceProjectAttachmentsResponse"
311 }
312}
313
314#[doc(hidden)]
315impl google_cloud_gax::paginator::internal::PageableResponse
316 for ListServiceProjectAttachmentsResponse
317{
318 type PageItem = crate::model::ServiceProjectAttachment;
319
320 fn items(self) -> std::vec::Vec<Self::PageItem> {
321 self.service_project_attachments
322 }
323
324 fn next_page_token(&self) -> std::string::String {
325 use std::clone::Clone;
326 self.next_page_token.clone()
327 }
328}
329
330/// Request for CreateServiceProjectAttachment.
331#[derive(Clone, Default, PartialEq)]
332#[non_exhaustive]
333pub struct CreateServiceProjectAttachmentRequest {
334 /// Required. Host project ID and location to which service project is being
335 /// attached. Only global location is supported. Expected format:
336 /// `projects/{project}/locations/{location}`.
337 pub parent: std::string::String,
338
339 /// Required. The service project attachment identifier must contain the
340 /// project id of the service project specified in the
341 /// service_project_attachment.service_project field.
342 pub service_project_attachment_id: std::string::String,
343
344 /// Required. The resource being created.
345 pub service_project_attachment: std::option::Option<crate::model::ServiceProjectAttachment>,
346
347 /// Optional. An optional request ID to identify requests. Specify a unique
348 /// request ID so that if you must retry your request, the server will know to
349 /// ignore the request if it has already been completed. The server will
350 /// guarantee that for at least 60 minutes since the first request.
351 ///
352 /// For example, consider a situation where you make an initial request and the
353 /// request times out. If you make the request again with the same request
354 /// ID, the server can check if original operation with the same request ID
355 /// was received, and if so, will ignore the second request. This prevents
356 /// clients from accidentally creating duplicate commitments.
357 ///
358 /// The request ID must be a valid UUID with the exception that zero UUID is
359 /// not supported (00000000-0000-0000-0000-000000000000).
360 pub request_id: std::string::String,
361
362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
363}
364
365impl CreateServiceProjectAttachmentRequest {
366 /// Creates a new default instance.
367 pub fn new() -> Self {
368 std::default::Default::default()
369 }
370
371 /// Sets the value of [parent][crate::model::CreateServiceProjectAttachmentRequest::parent].
372 ///
373 /// # Example
374 /// ```ignore,no_run
375 /// # use google_cloud_apphub_v1::model::CreateServiceProjectAttachmentRequest;
376 /// # let project_id = "project_id";
377 /// # let location_id = "location_id";
378 /// let x = CreateServiceProjectAttachmentRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
379 /// ```
380 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
381 self.parent = v.into();
382 self
383 }
384
385 /// Sets the value of [service_project_attachment_id][crate::model::CreateServiceProjectAttachmentRequest::service_project_attachment_id].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_apphub_v1::model::CreateServiceProjectAttachmentRequest;
390 /// let x = CreateServiceProjectAttachmentRequest::new().set_service_project_attachment_id("example");
391 /// ```
392 pub fn set_service_project_attachment_id<T: std::convert::Into<std::string::String>>(
393 mut self,
394 v: T,
395 ) -> Self {
396 self.service_project_attachment_id = v.into();
397 self
398 }
399
400 /// Sets the value of [service_project_attachment][crate::model::CreateServiceProjectAttachmentRequest::service_project_attachment].
401 ///
402 /// # Example
403 /// ```ignore,no_run
404 /// # use google_cloud_apphub_v1::model::CreateServiceProjectAttachmentRequest;
405 /// use google_cloud_apphub_v1::model::ServiceProjectAttachment;
406 /// let x = CreateServiceProjectAttachmentRequest::new().set_service_project_attachment(ServiceProjectAttachment::default()/* use setters */);
407 /// ```
408 pub fn set_service_project_attachment<T>(mut self, v: T) -> Self
409 where
410 T: std::convert::Into<crate::model::ServiceProjectAttachment>,
411 {
412 self.service_project_attachment = std::option::Option::Some(v.into());
413 self
414 }
415
416 /// Sets or clears the value of [service_project_attachment][crate::model::CreateServiceProjectAttachmentRequest::service_project_attachment].
417 ///
418 /// # Example
419 /// ```ignore,no_run
420 /// # use google_cloud_apphub_v1::model::CreateServiceProjectAttachmentRequest;
421 /// use google_cloud_apphub_v1::model::ServiceProjectAttachment;
422 /// let x = CreateServiceProjectAttachmentRequest::new().set_or_clear_service_project_attachment(Some(ServiceProjectAttachment::default()/* use setters */));
423 /// let x = CreateServiceProjectAttachmentRequest::new().set_or_clear_service_project_attachment(None::<ServiceProjectAttachment>);
424 /// ```
425 pub fn set_or_clear_service_project_attachment<T>(mut self, v: std::option::Option<T>) -> Self
426 where
427 T: std::convert::Into<crate::model::ServiceProjectAttachment>,
428 {
429 self.service_project_attachment = v.map(|x| x.into());
430 self
431 }
432
433 /// Sets the value of [request_id][crate::model::CreateServiceProjectAttachmentRequest::request_id].
434 ///
435 /// # Example
436 /// ```ignore,no_run
437 /// # use google_cloud_apphub_v1::model::CreateServiceProjectAttachmentRequest;
438 /// let x = CreateServiceProjectAttachmentRequest::new().set_request_id("example");
439 /// ```
440 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
441 self.request_id = v.into();
442 self
443 }
444}
445
446impl wkt::message::Message for CreateServiceProjectAttachmentRequest {
447 fn typename() -> &'static str {
448 "type.googleapis.com/google.cloud.apphub.v1.CreateServiceProjectAttachmentRequest"
449 }
450}
451
452/// Request for GetServiceProjectAttachment.
453#[derive(Clone, Default, PartialEq)]
454#[non_exhaustive]
455pub struct GetServiceProjectAttachmentRequest {
456 /// Required. Fully qualified name of the service project attachment to
457 /// retrieve. Expected format:
458 /// `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`.
459 pub name: std::string::String,
460
461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
462}
463
464impl GetServiceProjectAttachmentRequest {
465 /// Creates a new default instance.
466 pub fn new() -> Self {
467 std::default::Default::default()
468 }
469
470 /// Sets the value of [name][crate::model::GetServiceProjectAttachmentRequest::name].
471 ///
472 /// # Example
473 /// ```ignore,no_run
474 /// # use google_cloud_apphub_v1::model::GetServiceProjectAttachmentRequest;
475 /// # let project_id = "project_id";
476 /// # let location_id = "location_id";
477 /// # let service_project_attachment_id = "service_project_attachment_id";
478 /// let x = GetServiceProjectAttachmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/serviceProjectAttachments/{service_project_attachment_id}"));
479 /// ```
480 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
481 self.name = v.into();
482 self
483 }
484}
485
486impl wkt::message::Message for GetServiceProjectAttachmentRequest {
487 fn typename() -> &'static str {
488 "type.googleapis.com/google.cloud.apphub.v1.GetServiceProjectAttachmentRequest"
489 }
490}
491
492/// Request for DeleteServiceProjectAttachment.
493#[derive(Clone, Default, PartialEq)]
494#[non_exhaustive]
495pub struct DeleteServiceProjectAttachmentRequest {
496 /// Required. Fully qualified name of the service project attachment to delete.
497 /// Expected format:
498 /// `projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}`.
499 pub name: std::string::String,
500
501 /// Optional. An optional request ID to identify requests. Specify a unique
502 /// request ID so that if you must retry your request, the server will know to
503 /// ignore the request if it has already been completed. The server will
504 /// guarantee that for at least 60 minutes after the first request.
505 ///
506 /// For example, consider a situation where you make an initial request and the
507 /// request times out. If you make the request again with the same request
508 /// ID, the server can check if original operation with the same request ID
509 /// was received, and if so, will ignore the second request. This prevents
510 /// clients from accidentally creating duplicate commitments.
511 ///
512 /// The request ID must be a valid UUID with the exception that zero UUID is
513 /// not supported (00000000-0000-0000-0000-000000000000).
514 pub request_id: std::string::String,
515
516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
517}
518
519impl DeleteServiceProjectAttachmentRequest {
520 /// Creates a new default instance.
521 pub fn new() -> Self {
522 std::default::Default::default()
523 }
524
525 /// Sets the value of [name][crate::model::DeleteServiceProjectAttachmentRequest::name].
526 ///
527 /// # Example
528 /// ```ignore,no_run
529 /// # use google_cloud_apphub_v1::model::DeleteServiceProjectAttachmentRequest;
530 /// # let project_id = "project_id";
531 /// # let location_id = "location_id";
532 /// # let service_project_attachment_id = "service_project_attachment_id";
533 /// let x = DeleteServiceProjectAttachmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/serviceProjectAttachments/{service_project_attachment_id}"));
534 /// ```
535 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
536 self.name = v.into();
537 self
538 }
539
540 /// Sets the value of [request_id][crate::model::DeleteServiceProjectAttachmentRequest::request_id].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_apphub_v1::model::DeleteServiceProjectAttachmentRequest;
545 /// let x = DeleteServiceProjectAttachmentRequest::new().set_request_id("example");
546 /// ```
547 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
548 self.request_id = v.into();
549 self
550 }
551}
552
553impl wkt::message::Message for DeleteServiceProjectAttachmentRequest {
554 fn typename() -> &'static str {
555 "type.googleapis.com/google.cloud.apphub.v1.DeleteServiceProjectAttachmentRequest"
556 }
557}
558
559/// Request for DetachServiceProjectAttachment.
560#[derive(Clone, Default, PartialEq)]
561#[non_exhaustive]
562pub struct DetachServiceProjectAttachmentRequest {
563 /// Required. Service project id and location to detach from a host project.
564 /// Only global location is supported. Expected format:
565 /// `projects/{project}/locations/{location}`.
566 pub name: std::string::String,
567
568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
569}
570
571impl DetachServiceProjectAttachmentRequest {
572 /// Creates a new default instance.
573 pub fn new() -> Self {
574 std::default::Default::default()
575 }
576
577 /// Sets the value of [name][crate::model::DetachServiceProjectAttachmentRequest::name].
578 ///
579 /// # Example
580 /// ```ignore,no_run
581 /// # use google_cloud_apphub_v1::model::DetachServiceProjectAttachmentRequest;
582 /// let x = DetachServiceProjectAttachmentRequest::new().set_name("example");
583 /// ```
584 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
585 self.name = v.into();
586 self
587 }
588}
589
590impl wkt::message::Message for DetachServiceProjectAttachmentRequest {
591 fn typename() -> &'static str {
592 "type.googleapis.com/google.cloud.apphub.v1.DetachServiceProjectAttachmentRequest"
593 }
594}
595
596/// Response for DetachServiceProjectAttachment.
597#[derive(Clone, Default, PartialEq)]
598#[non_exhaustive]
599pub struct DetachServiceProjectAttachmentResponse {
600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
601}
602
603impl DetachServiceProjectAttachmentResponse {
604 /// Creates a new default instance.
605 pub fn new() -> Self {
606 std::default::Default::default()
607 }
608}
609
610impl wkt::message::Message for DetachServiceProjectAttachmentResponse {
611 fn typename() -> &'static str {
612 "type.googleapis.com/google.cloud.apphub.v1.DetachServiceProjectAttachmentResponse"
613 }
614}
615
616/// Request for ListServices.
617#[derive(Clone, Default, PartialEq)]
618#[non_exhaustive]
619pub struct ListServicesRequest {
620 /// Required. Fully qualified name of the parent Application to list Services
621 /// for. Expected format:
622 /// `projects/{project}/locations/{location}/applications/{application}`.
623 pub parent: std::string::String,
624
625 /// Optional. Requested page size. Server may return fewer items than
626 /// requested. If unspecified, server will pick an appropriate default.
627 pub page_size: i32,
628
629 /// Optional. A token identifying a page of results the server should return.
630 pub page_token: std::string::String,
631
632 /// Optional. Filtering results
633 pub filter: std::string::String,
634
635 /// Optional. Hint for how to order the results
636 pub order_by: std::string::String,
637
638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
639}
640
641impl ListServicesRequest {
642 /// Creates a new default instance.
643 pub fn new() -> Self {
644 std::default::Default::default()
645 }
646
647 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
648 ///
649 /// # Example
650 /// ```ignore,no_run
651 /// # use google_cloud_apphub_v1::model::ListServicesRequest;
652 /// # let project_id = "project_id";
653 /// # let location_id = "location_id";
654 /// # let application_id = "application_id";
655 /// let x = ListServicesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
656 /// ```
657 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
658 self.parent = v.into();
659 self
660 }
661
662 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
663 ///
664 /// # Example
665 /// ```ignore,no_run
666 /// # use google_cloud_apphub_v1::model::ListServicesRequest;
667 /// let x = ListServicesRequest::new().set_page_size(42);
668 /// ```
669 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
670 self.page_size = v.into();
671 self
672 }
673
674 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
675 ///
676 /// # Example
677 /// ```ignore,no_run
678 /// # use google_cloud_apphub_v1::model::ListServicesRequest;
679 /// let x = ListServicesRequest::new().set_page_token("example");
680 /// ```
681 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
682 self.page_token = v.into();
683 self
684 }
685
686 /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
687 ///
688 /// # Example
689 /// ```ignore,no_run
690 /// # use google_cloud_apphub_v1::model::ListServicesRequest;
691 /// let x = ListServicesRequest::new().set_filter("example");
692 /// ```
693 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
694 self.filter = v.into();
695 self
696 }
697
698 /// Sets the value of [order_by][crate::model::ListServicesRequest::order_by].
699 ///
700 /// # Example
701 /// ```ignore,no_run
702 /// # use google_cloud_apphub_v1::model::ListServicesRequest;
703 /// let x = ListServicesRequest::new().set_order_by("example");
704 /// ```
705 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
706 self.order_by = v.into();
707 self
708 }
709}
710
711impl wkt::message::Message for ListServicesRequest {
712 fn typename() -> &'static str {
713 "type.googleapis.com/google.cloud.apphub.v1.ListServicesRequest"
714 }
715}
716
717/// Response for ListServices.
718#[derive(Clone, Default, PartialEq)]
719#[non_exhaustive]
720pub struct ListServicesResponse {
721 /// List of Services.
722 pub services: std::vec::Vec<crate::model::Service>,
723
724 /// A token identifying a page of results the server should return.
725 pub next_page_token: std::string::String,
726
727 /// Locations that could not be reached.
728 pub unreachable: std::vec::Vec<std::string::String>,
729
730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
731}
732
733impl ListServicesResponse {
734 /// Creates a new default instance.
735 pub fn new() -> Self {
736 std::default::Default::default()
737 }
738
739 /// Sets the value of [services][crate::model::ListServicesResponse::services].
740 ///
741 /// # Example
742 /// ```ignore,no_run
743 /// # use google_cloud_apphub_v1::model::ListServicesResponse;
744 /// use google_cloud_apphub_v1::model::Service;
745 /// let x = ListServicesResponse::new()
746 /// .set_services([
747 /// Service::default()/* use setters */,
748 /// Service::default()/* use (different) setters */,
749 /// ]);
750 /// ```
751 pub fn set_services<T, V>(mut self, v: T) -> Self
752 where
753 T: std::iter::IntoIterator<Item = V>,
754 V: std::convert::Into<crate::model::Service>,
755 {
756 use std::iter::Iterator;
757 self.services = v.into_iter().map(|i| i.into()).collect();
758 self
759 }
760
761 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
762 ///
763 /// # Example
764 /// ```ignore,no_run
765 /// # use google_cloud_apphub_v1::model::ListServicesResponse;
766 /// let x = ListServicesResponse::new().set_next_page_token("example");
767 /// ```
768 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
769 self.next_page_token = v.into();
770 self
771 }
772
773 /// Sets the value of [unreachable][crate::model::ListServicesResponse::unreachable].
774 ///
775 /// # Example
776 /// ```ignore,no_run
777 /// # use google_cloud_apphub_v1::model::ListServicesResponse;
778 /// let x = ListServicesResponse::new().set_unreachable(["a", "b", "c"]);
779 /// ```
780 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
781 where
782 T: std::iter::IntoIterator<Item = V>,
783 V: std::convert::Into<std::string::String>,
784 {
785 use std::iter::Iterator;
786 self.unreachable = v.into_iter().map(|i| i.into()).collect();
787 self
788 }
789}
790
791impl wkt::message::Message for ListServicesResponse {
792 fn typename() -> &'static str {
793 "type.googleapis.com/google.cloud.apphub.v1.ListServicesResponse"
794 }
795}
796
797#[doc(hidden)]
798impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
799 type PageItem = crate::model::Service;
800
801 fn items(self) -> std::vec::Vec<Self::PageItem> {
802 self.services
803 }
804
805 fn next_page_token(&self) -> std::string::String {
806 use std::clone::Clone;
807 self.next_page_token.clone()
808 }
809}
810
811/// Request for ListDiscoveredServices.
812#[derive(Clone, Default, PartialEq)]
813#[non_exhaustive]
814pub struct ListDiscoveredServicesRequest {
815 /// Required. Project and location to list Discovered Services on.
816 /// Expected format: `projects/{project}/locations/{location}`.
817 pub parent: std::string::String,
818
819 /// Optional. Requested page size. Server may return fewer items than
820 /// requested. If unspecified, server will pick an appropriate default.
821 pub page_size: i32,
822
823 /// Optional. A token identifying a page of results the server should return.
824 pub page_token: std::string::String,
825
826 /// Optional. Filtering results.
827 pub filter: std::string::String,
828
829 /// Optional. Hint for how to order the results.
830 pub order_by: std::string::String,
831
832 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
833}
834
835impl ListDiscoveredServicesRequest {
836 /// Creates a new default instance.
837 pub fn new() -> Self {
838 std::default::Default::default()
839 }
840
841 /// Sets the value of [parent][crate::model::ListDiscoveredServicesRequest::parent].
842 ///
843 /// # Example
844 /// ```ignore,no_run
845 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesRequest;
846 /// # let project_id = "project_id";
847 /// # let location_id = "location_id";
848 /// let x = ListDiscoveredServicesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
849 /// ```
850 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
851 self.parent = v.into();
852 self
853 }
854
855 /// Sets the value of [page_size][crate::model::ListDiscoveredServicesRequest::page_size].
856 ///
857 /// # Example
858 /// ```ignore,no_run
859 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesRequest;
860 /// let x = ListDiscoveredServicesRequest::new().set_page_size(42);
861 /// ```
862 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
863 self.page_size = v.into();
864 self
865 }
866
867 /// Sets the value of [page_token][crate::model::ListDiscoveredServicesRequest::page_token].
868 ///
869 /// # Example
870 /// ```ignore,no_run
871 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesRequest;
872 /// let x = ListDiscoveredServicesRequest::new().set_page_token("example");
873 /// ```
874 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
875 self.page_token = v.into();
876 self
877 }
878
879 /// Sets the value of [filter][crate::model::ListDiscoveredServicesRequest::filter].
880 ///
881 /// # Example
882 /// ```ignore,no_run
883 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesRequest;
884 /// let x = ListDiscoveredServicesRequest::new().set_filter("example");
885 /// ```
886 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
887 self.filter = v.into();
888 self
889 }
890
891 /// Sets the value of [order_by][crate::model::ListDiscoveredServicesRequest::order_by].
892 ///
893 /// # Example
894 /// ```ignore,no_run
895 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesRequest;
896 /// let x = ListDiscoveredServicesRequest::new().set_order_by("example");
897 /// ```
898 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
899 self.order_by = v.into();
900 self
901 }
902}
903
904impl wkt::message::Message for ListDiscoveredServicesRequest {
905 fn typename() -> &'static str {
906 "type.googleapis.com/google.cloud.apphub.v1.ListDiscoveredServicesRequest"
907 }
908}
909
910/// Response for ListDiscoveredServices.
911#[derive(Clone, Default, PartialEq)]
912#[non_exhaustive]
913pub struct ListDiscoveredServicesResponse {
914 /// List of Discovered Services.
915 pub discovered_services: std::vec::Vec<crate::model::DiscoveredService>,
916
917 /// A token identifying a page of results the server should return.
918 pub next_page_token: std::string::String,
919
920 /// Locations that could not be reached.
921 pub unreachable: std::vec::Vec<std::string::String>,
922
923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
924}
925
926impl ListDiscoveredServicesResponse {
927 /// Creates a new default instance.
928 pub fn new() -> Self {
929 std::default::Default::default()
930 }
931
932 /// Sets the value of [discovered_services][crate::model::ListDiscoveredServicesResponse::discovered_services].
933 ///
934 /// # Example
935 /// ```ignore,no_run
936 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesResponse;
937 /// use google_cloud_apphub_v1::model::DiscoveredService;
938 /// let x = ListDiscoveredServicesResponse::new()
939 /// .set_discovered_services([
940 /// DiscoveredService::default()/* use setters */,
941 /// DiscoveredService::default()/* use (different) setters */,
942 /// ]);
943 /// ```
944 pub fn set_discovered_services<T, V>(mut self, v: T) -> Self
945 where
946 T: std::iter::IntoIterator<Item = V>,
947 V: std::convert::Into<crate::model::DiscoveredService>,
948 {
949 use std::iter::Iterator;
950 self.discovered_services = v.into_iter().map(|i| i.into()).collect();
951 self
952 }
953
954 /// Sets the value of [next_page_token][crate::model::ListDiscoveredServicesResponse::next_page_token].
955 ///
956 /// # Example
957 /// ```ignore,no_run
958 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesResponse;
959 /// let x = ListDiscoveredServicesResponse::new().set_next_page_token("example");
960 /// ```
961 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
962 self.next_page_token = v.into();
963 self
964 }
965
966 /// Sets the value of [unreachable][crate::model::ListDiscoveredServicesResponse::unreachable].
967 ///
968 /// # Example
969 /// ```ignore,no_run
970 /// # use google_cloud_apphub_v1::model::ListDiscoveredServicesResponse;
971 /// let x = ListDiscoveredServicesResponse::new().set_unreachable(["a", "b", "c"]);
972 /// ```
973 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
974 where
975 T: std::iter::IntoIterator<Item = V>,
976 V: std::convert::Into<std::string::String>,
977 {
978 use std::iter::Iterator;
979 self.unreachable = v.into_iter().map(|i| i.into()).collect();
980 self
981 }
982}
983
984impl wkt::message::Message for ListDiscoveredServicesResponse {
985 fn typename() -> &'static str {
986 "type.googleapis.com/google.cloud.apphub.v1.ListDiscoveredServicesResponse"
987 }
988}
989
990#[doc(hidden)]
991impl google_cloud_gax::paginator::internal::PageableResponse for ListDiscoveredServicesResponse {
992 type PageItem = crate::model::DiscoveredService;
993
994 fn items(self) -> std::vec::Vec<Self::PageItem> {
995 self.discovered_services
996 }
997
998 fn next_page_token(&self) -> std::string::String {
999 use std::clone::Clone;
1000 self.next_page_token.clone()
1001 }
1002}
1003
1004/// Request for CreateService.
1005#[derive(Clone, Default, PartialEq)]
1006#[non_exhaustive]
1007pub struct CreateServiceRequest {
1008 /// Required. Fully qualified name of the parent Application to create the
1009 /// Service in. Expected format:
1010 /// `projects/{project}/locations/{location}/applications/{application}`.
1011 pub parent: std::string::String,
1012
1013 /// Required. The Service identifier.
1014 /// Must contain only lowercase letters, numbers
1015 /// or hyphens, with the first character a letter, the last a letter or a
1016 /// number, and a 63 character maximum.
1017 pub service_id: std::string::String,
1018
1019 /// Required. The resource being created.
1020 pub service: std::option::Option<crate::model::Service>,
1021
1022 /// Optional. An optional request ID to identify requests. Specify a unique
1023 /// request ID so that if you must retry your request, the server will know to
1024 /// ignore the request if it has already been completed. The server will
1025 /// guarantee that for at least 60 minutes since the first request.
1026 ///
1027 /// For example, consider a situation where you make an initial request and the
1028 /// request times out. If you make the request again with the same request
1029 /// ID, the server can check if original operation with the same request ID
1030 /// was received, and if so, will ignore the second request. This prevents
1031 /// clients from accidentally creating duplicate commitments.
1032 ///
1033 /// The request ID must be a valid UUID with the exception that zero UUID is
1034 /// not supported (00000000-0000-0000-0000-000000000000).
1035 pub request_id: std::string::String,
1036
1037 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1038}
1039
1040impl CreateServiceRequest {
1041 /// Creates a new default instance.
1042 pub fn new() -> Self {
1043 std::default::Default::default()
1044 }
1045
1046 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
1047 ///
1048 /// # Example
1049 /// ```ignore,no_run
1050 /// # use google_cloud_apphub_v1::model::CreateServiceRequest;
1051 /// # let project_id = "project_id";
1052 /// # let location_id = "location_id";
1053 /// # let application_id = "application_id";
1054 /// let x = CreateServiceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
1055 /// ```
1056 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1057 self.parent = v.into();
1058 self
1059 }
1060
1061 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
1062 ///
1063 /// # Example
1064 /// ```ignore,no_run
1065 /// # use google_cloud_apphub_v1::model::CreateServiceRequest;
1066 /// let x = CreateServiceRequest::new().set_service_id("example");
1067 /// ```
1068 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1069 self.service_id = v.into();
1070 self
1071 }
1072
1073 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
1074 ///
1075 /// # Example
1076 /// ```ignore,no_run
1077 /// # use google_cloud_apphub_v1::model::CreateServiceRequest;
1078 /// use google_cloud_apphub_v1::model::Service;
1079 /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
1080 /// ```
1081 pub fn set_service<T>(mut self, v: T) -> Self
1082 where
1083 T: std::convert::Into<crate::model::Service>,
1084 {
1085 self.service = std::option::Option::Some(v.into());
1086 self
1087 }
1088
1089 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
1090 ///
1091 /// # Example
1092 /// ```ignore,no_run
1093 /// # use google_cloud_apphub_v1::model::CreateServiceRequest;
1094 /// use google_cloud_apphub_v1::model::Service;
1095 /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
1096 /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
1097 /// ```
1098 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
1099 where
1100 T: std::convert::Into<crate::model::Service>,
1101 {
1102 self.service = v.map(|x| x.into());
1103 self
1104 }
1105
1106 /// Sets the value of [request_id][crate::model::CreateServiceRequest::request_id].
1107 ///
1108 /// # Example
1109 /// ```ignore,no_run
1110 /// # use google_cloud_apphub_v1::model::CreateServiceRequest;
1111 /// let x = CreateServiceRequest::new().set_request_id("example");
1112 /// ```
1113 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1114 self.request_id = v.into();
1115 self
1116 }
1117}
1118
1119impl wkt::message::Message for CreateServiceRequest {
1120 fn typename() -> &'static str {
1121 "type.googleapis.com/google.cloud.apphub.v1.CreateServiceRequest"
1122 }
1123}
1124
1125/// Request for GetService.
1126#[derive(Clone, Default, PartialEq)]
1127#[non_exhaustive]
1128pub struct GetServiceRequest {
1129 /// Required. Fully qualified name of the Service to fetch.
1130 /// Expected format:
1131 /// `projects/{project}/locations/{location}/applications/{application}/services/{service}`.
1132 pub name: std::string::String,
1133
1134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1135}
1136
1137impl GetServiceRequest {
1138 /// Creates a new default instance.
1139 pub fn new() -> Self {
1140 std::default::Default::default()
1141 }
1142
1143 /// Sets the value of [name][crate::model::GetServiceRequest::name].
1144 ///
1145 /// # Example
1146 /// ```ignore,no_run
1147 /// # use google_cloud_apphub_v1::model::GetServiceRequest;
1148 /// # let project_id = "project_id";
1149 /// # let location_id = "location_id";
1150 /// # let application_id = "application_id";
1151 /// # let service_id = "service_id";
1152 /// let x = GetServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/services/{service_id}"));
1153 /// ```
1154 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1155 self.name = v.into();
1156 self
1157 }
1158}
1159
1160impl wkt::message::Message for GetServiceRequest {
1161 fn typename() -> &'static str {
1162 "type.googleapis.com/google.cloud.apphub.v1.GetServiceRequest"
1163 }
1164}
1165
1166/// Request for GetDiscoveredService.
1167#[derive(Clone, Default, PartialEq)]
1168#[non_exhaustive]
1169pub struct GetDiscoveredServiceRequest {
1170 /// Required. Fully qualified name of the Discovered Service to fetch.
1171 /// Expected format:
1172 /// `projects/{project}/locations/{location}/discoveredServices/{discoveredService}`.
1173 pub name: std::string::String,
1174
1175 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1176}
1177
1178impl GetDiscoveredServiceRequest {
1179 /// Creates a new default instance.
1180 pub fn new() -> Self {
1181 std::default::Default::default()
1182 }
1183
1184 /// Sets the value of [name][crate::model::GetDiscoveredServiceRequest::name].
1185 ///
1186 /// # Example
1187 /// ```ignore,no_run
1188 /// # use google_cloud_apphub_v1::model::GetDiscoveredServiceRequest;
1189 /// # let project_id = "project_id";
1190 /// # let location_id = "location_id";
1191 /// # let discovered_service_id = "discovered_service_id";
1192 /// let x = GetDiscoveredServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/discoveredServices/{discovered_service_id}"));
1193 /// ```
1194 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1195 self.name = v.into();
1196 self
1197 }
1198}
1199
1200impl wkt::message::Message for GetDiscoveredServiceRequest {
1201 fn typename() -> &'static str {
1202 "type.googleapis.com/google.cloud.apphub.v1.GetDiscoveredServiceRequest"
1203 }
1204}
1205
1206/// Request for LookupDiscoveredService.
1207#[derive(Clone, Default, PartialEq)]
1208#[non_exhaustive]
1209pub struct LookupDiscoveredServiceRequest {
1210 /// Required. Host project ID and location to lookup Discovered Service in.
1211 /// Expected format: `projects/{project}/locations/{location}`.
1212 pub parent: std::string::String,
1213
1214 /// Required. Resource URI to find DiscoveredService for.
1215 /// Accepts both project number and project ID and does translation when
1216 /// needed.
1217 pub uri: std::string::String,
1218
1219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1220}
1221
1222impl LookupDiscoveredServiceRequest {
1223 /// Creates a new default instance.
1224 pub fn new() -> Self {
1225 std::default::Default::default()
1226 }
1227
1228 /// Sets the value of [parent][crate::model::LookupDiscoveredServiceRequest::parent].
1229 ///
1230 /// # Example
1231 /// ```ignore,no_run
1232 /// # use google_cloud_apphub_v1::model::LookupDiscoveredServiceRequest;
1233 /// # let project_id = "project_id";
1234 /// # let location_id = "location_id";
1235 /// let x = LookupDiscoveredServiceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1236 /// ```
1237 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1238 self.parent = v.into();
1239 self
1240 }
1241
1242 /// Sets the value of [uri][crate::model::LookupDiscoveredServiceRequest::uri].
1243 ///
1244 /// # Example
1245 /// ```ignore,no_run
1246 /// # use google_cloud_apphub_v1::model::LookupDiscoveredServiceRequest;
1247 /// let x = LookupDiscoveredServiceRequest::new().set_uri("example");
1248 /// ```
1249 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1250 self.uri = v.into();
1251 self
1252 }
1253}
1254
1255impl wkt::message::Message for LookupDiscoveredServiceRequest {
1256 fn typename() -> &'static str {
1257 "type.googleapis.com/google.cloud.apphub.v1.LookupDiscoveredServiceRequest"
1258 }
1259}
1260
1261/// Response for LookupDiscoveredService.
1262#[derive(Clone, Default, PartialEq)]
1263#[non_exhaustive]
1264pub struct LookupDiscoveredServiceResponse {
1265 /// Discovered Service if exists, empty otherwise.
1266 pub discovered_service: std::option::Option<crate::model::DiscoveredService>,
1267
1268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1269}
1270
1271impl LookupDiscoveredServiceResponse {
1272 /// Creates a new default instance.
1273 pub fn new() -> Self {
1274 std::default::Default::default()
1275 }
1276
1277 /// Sets the value of [discovered_service][crate::model::LookupDiscoveredServiceResponse::discovered_service].
1278 ///
1279 /// # Example
1280 /// ```ignore,no_run
1281 /// # use google_cloud_apphub_v1::model::LookupDiscoveredServiceResponse;
1282 /// use google_cloud_apphub_v1::model::DiscoveredService;
1283 /// let x = LookupDiscoveredServiceResponse::new().set_discovered_service(DiscoveredService::default()/* use setters */);
1284 /// ```
1285 pub fn set_discovered_service<T>(mut self, v: T) -> Self
1286 where
1287 T: std::convert::Into<crate::model::DiscoveredService>,
1288 {
1289 self.discovered_service = std::option::Option::Some(v.into());
1290 self
1291 }
1292
1293 /// Sets or clears the value of [discovered_service][crate::model::LookupDiscoveredServiceResponse::discovered_service].
1294 ///
1295 /// # Example
1296 /// ```ignore,no_run
1297 /// # use google_cloud_apphub_v1::model::LookupDiscoveredServiceResponse;
1298 /// use google_cloud_apphub_v1::model::DiscoveredService;
1299 /// let x = LookupDiscoveredServiceResponse::new().set_or_clear_discovered_service(Some(DiscoveredService::default()/* use setters */));
1300 /// let x = LookupDiscoveredServiceResponse::new().set_or_clear_discovered_service(None::<DiscoveredService>);
1301 /// ```
1302 pub fn set_or_clear_discovered_service<T>(mut self, v: std::option::Option<T>) -> Self
1303 where
1304 T: std::convert::Into<crate::model::DiscoveredService>,
1305 {
1306 self.discovered_service = v.map(|x| x.into());
1307 self
1308 }
1309}
1310
1311impl wkt::message::Message for LookupDiscoveredServiceResponse {
1312 fn typename() -> &'static str {
1313 "type.googleapis.com/google.cloud.apphub.v1.LookupDiscoveredServiceResponse"
1314 }
1315}
1316
1317/// Request for UpdateService.
1318#[derive(Clone, Default, PartialEq)]
1319#[non_exhaustive]
1320pub struct UpdateServiceRequest {
1321 /// Required. Field mask is used to specify the fields to be overwritten in the
1322 /// Service resource by the update.
1323 /// The fields specified in the update_mask are relative to the resource, not
1324 /// the full request.
1325 /// The API changes the values of the fields as specified in the update_mask.
1326 /// The API ignores the values of all fields not covered by the update_mask.
1327 /// You can also unset a field by not specifying it in the updated message, but
1328 /// adding the field to the mask. This clears whatever value the field
1329 /// previously had.
1330 pub update_mask: std::option::Option<wkt::FieldMask>,
1331
1332 /// Required. The resource being updated.
1333 pub service: std::option::Option<crate::model::Service>,
1334
1335 /// Optional. An optional request ID to identify requests. Specify a unique
1336 /// request ID so that if you must retry your request, the server will know to
1337 /// ignore the request if it has already been completed. The server will
1338 /// guarantee that for at least 60 minutes since the first request.
1339 ///
1340 /// For example, consider a situation where you make an initial request and the
1341 /// request times out. If you make the request again with the same request
1342 /// ID, the server can check if original operation with the same request ID
1343 /// was received, and if so, will ignore the second request. This prevents
1344 /// clients from accidentally creating duplicate commitments.
1345 ///
1346 /// The request ID must be a valid UUID with the exception that zero UUID is
1347 /// not supported (00000000-0000-0000-0000-000000000000).
1348 pub request_id: std::string::String,
1349
1350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1351}
1352
1353impl UpdateServiceRequest {
1354 /// Creates a new default instance.
1355 pub fn new() -> Self {
1356 std::default::Default::default()
1357 }
1358
1359 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
1360 ///
1361 /// # Example
1362 /// ```ignore,no_run
1363 /// # use google_cloud_apphub_v1::model::UpdateServiceRequest;
1364 /// use wkt::FieldMask;
1365 /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1366 /// ```
1367 pub fn set_update_mask<T>(mut self, v: T) -> Self
1368 where
1369 T: std::convert::Into<wkt::FieldMask>,
1370 {
1371 self.update_mask = std::option::Option::Some(v.into());
1372 self
1373 }
1374
1375 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
1376 ///
1377 /// # Example
1378 /// ```ignore,no_run
1379 /// # use google_cloud_apphub_v1::model::UpdateServiceRequest;
1380 /// use wkt::FieldMask;
1381 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1382 /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1383 /// ```
1384 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1385 where
1386 T: std::convert::Into<wkt::FieldMask>,
1387 {
1388 self.update_mask = v.map(|x| x.into());
1389 self
1390 }
1391
1392 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
1393 ///
1394 /// # Example
1395 /// ```ignore,no_run
1396 /// # use google_cloud_apphub_v1::model::UpdateServiceRequest;
1397 /// use google_cloud_apphub_v1::model::Service;
1398 /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
1399 /// ```
1400 pub fn set_service<T>(mut self, v: T) -> Self
1401 where
1402 T: std::convert::Into<crate::model::Service>,
1403 {
1404 self.service = std::option::Option::Some(v.into());
1405 self
1406 }
1407
1408 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
1409 ///
1410 /// # Example
1411 /// ```ignore,no_run
1412 /// # use google_cloud_apphub_v1::model::UpdateServiceRequest;
1413 /// use google_cloud_apphub_v1::model::Service;
1414 /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
1415 /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
1416 /// ```
1417 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
1418 where
1419 T: std::convert::Into<crate::model::Service>,
1420 {
1421 self.service = v.map(|x| x.into());
1422 self
1423 }
1424
1425 /// Sets the value of [request_id][crate::model::UpdateServiceRequest::request_id].
1426 ///
1427 /// # Example
1428 /// ```ignore,no_run
1429 /// # use google_cloud_apphub_v1::model::UpdateServiceRequest;
1430 /// let x = UpdateServiceRequest::new().set_request_id("example");
1431 /// ```
1432 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433 self.request_id = v.into();
1434 self
1435 }
1436}
1437
1438impl wkt::message::Message for UpdateServiceRequest {
1439 fn typename() -> &'static str {
1440 "type.googleapis.com/google.cloud.apphub.v1.UpdateServiceRequest"
1441 }
1442}
1443
1444/// Request for DeleteService.
1445#[derive(Clone, Default, PartialEq)]
1446#[non_exhaustive]
1447pub struct DeleteServiceRequest {
1448 /// Required. Fully qualified name of the Service to delete from an
1449 /// Application. Expected format:
1450 /// `projects/{project}/locations/{location}/applications/{application}/services/{service}`.
1451 pub name: std::string::String,
1452
1453 /// Optional. An optional request ID to identify requests. Specify a unique
1454 /// request ID so that if you must retry your request, the server will know to
1455 /// ignore the request if it has already been completed. The server will
1456 /// guarantee that for at least 60 minutes after the first request.
1457 ///
1458 /// For example, consider a situation where you make an initial request and the
1459 /// request times out. If you make the request again with the same request
1460 /// ID, the server can check if original operation with the same request ID
1461 /// was received, and if so, will ignore the second request. This prevents
1462 /// clients from accidentally creating duplicate commitments.
1463 ///
1464 /// The request ID must be a valid UUID with the exception that zero UUID is
1465 /// not supported (00000000-0000-0000-0000-000000000000).
1466 pub request_id: std::string::String,
1467
1468 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1469}
1470
1471impl DeleteServiceRequest {
1472 /// Creates a new default instance.
1473 pub fn new() -> Self {
1474 std::default::Default::default()
1475 }
1476
1477 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
1478 ///
1479 /// # Example
1480 /// ```ignore,no_run
1481 /// # use google_cloud_apphub_v1::model::DeleteServiceRequest;
1482 /// # let project_id = "project_id";
1483 /// # let location_id = "location_id";
1484 /// # let application_id = "application_id";
1485 /// # let service_id = "service_id";
1486 /// let x = DeleteServiceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/services/{service_id}"));
1487 /// ```
1488 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1489 self.name = v.into();
1490 self
1491 }
1492
1493 /// Sets the value of [request_id][crate::model::DeleteServiceRequest::request_id].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_apphub_v1::model::DeleteServiceRequest;
1498 /// let x = DeleteServiceRequest::new().set_request_id("example");
1499 /// ```
1500 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1501 self.request_id = v.into();
1502 self
1503 }
1504}
1505
1506impl wkt::message::Message for DeleteServiceRequest {
1507 fn typename() -> &'static str {
1508 "type.googleapis.com/google.cloud.apphub.v1.DeleteServiceRequest"
1509 }
1510}
1511
1512/// Request for ListApplications.
1513#[derive(Clone, Default, PartialEq)]
1514#[non_exhaustive]
1515pub struct ListApplicationsRequest {
1516 /// Required. Project and location to list Applications on.
1517 /// Expected format: `projects/{project}/locations/{location}`.
1518 pub parent: std::string::String,
1519
1520 /// Optional. Requested page size. Server may return fewer items than
1521 /// requested. If unspecified, server will pick an appropriate default.
1522 pub page_size: i32,
1523
1524 /// Optional. A token identifying a page of results the server should return.
1525 pub page_token: std::string::String,
1526
1527 /// Optional. Filtering results.
1528 pub filter: std::string::String,
1529
1530 /// Optional. Hint for how to order the results.
1531 pub order_by: std::string::String,
1532
1533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1534}
1535
1536impl ListApplicationsRequest {
1537 /// Creates a new default instance.
1538 pub fn new() -> Self {
1539 std::default::Default::default()
1540 }
1541
1542 /// Sets the value of [parent][crate::model::ListApplicationsRequest::parent].
1543 ///
1544 /// # Example
1545 /// ```ignore,no_run
1546 /// # use google_cloud_apphub_v1::model::ListApplicationsRequest;
1547 /// # let project_id = "project_id";
1548 /// # let location_id = "location_id";
1549 /// let x = ListApplicationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1550 /// ```
1551 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1552 self.parent = v.into();
1553 self
1554 }
1555
1556 /// Sets the value of [page_size][crate::model::ListApplicationsRequest::page_size].
1557 ///
1558 /// # Example
1559 /// ```ignore,no_run
1560 /// # use google_cloud_apphub_v1::model::ListApplicationsRequest;
1561 /// let x = ListApplicationsRequest::new().set_page_size(42);
1562 /// ```
1563 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1564 self.page_size = v.into();
1565 self
1566 }
1567
1568 /// Sets the value of [page_token][crate::model::ListApplicationsRequest::page_token].
1569 ///
1570 /// # Example
1571 /// ```ignore,no_run
1572 /// # use google_cloud_apphub_v1::model::ListApplicationsRequest;
1573 /// let x = ListApplicationsRequest::new().set_page_token("example");
1574 /// ```
1575 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1576 self.page_token = v.into();
1577 self
1578 }
1579
1580 /// Sets the value of [filter][crate::model::ListApplicationsRequest::filter].
1581 ///
1582 /// # Example
1583 /// ```ignore,no_run
1584 /// # use google_cloud_apphub_v1::model::ListApplicationsRequest;
1585 /// let x = ListApplicationsRequest::new().set_filter("example");
1586 /// ```
1587 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1588 self.filter = v.into();
1589 self
1590 }
1591
1592 /// Sets the value of [order_by][crate::model::ListApplicationsRequest::order_by].
1593 ///
1594 /// # Example
1595 /// ```ignore,no_run
1596 /// # use google_cloud_apphub_v1::model::ListApplicationsRequest;
1597 /// let x = ListApplicationsRequest::new().set_order_by("example");
1598 /// ```
1599 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1600 self.order_by = v.into();
1601 self
1602 }
1603}
1604
1605impl wkt::message::Message for ListApplicationsRequest {
1606 fn typename() -> &'static str {
1607 "type.googleapis.com/google.cloud.apphub.v1.ListApplicationsRequest"
1608 }
1609}
1610
1611/// Response for ListApplications.
1612#[derive(Clone, Default, PartialEq)]
1613#[non_exhaustive]
1614pub struct ListApplicationsResponse {
1615 /// List of Applications.
1616 pub applications: std::vec::Vec<crate::model::Application>,
1617
1618 /// A token identifying a page of results the server should return.
1619 pub next_page_token: std::string::String,
1620
1621 /// Locations that could not be reached.
1622 pub unreachable: std::vec::Vec<std::string::String>,
1623
1624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1625}
1626
1627impl ListApplicationsResponse {
1628 /// Creates a new default instance.
1629 pub fn new() -> Self {
1630 std::default::Default::default()
1631 }
1632
1633 /// Sets the value of [applications][crate::model::ListApplicationsResponse::applications].
1634 ///
1635 /// # Example
1636 /// ```ignore,no_run
1637 /// # use google_cloud_apphub_v1::model::ListApplicationsResponse;
1638 /// use google_cloud_apphub_v1::model::Application;
1639 /// let x = ListApplicationsResponse::new()
1640 /// .set_applications([
1641 /// Application::default()/* use setters */,
1642 /// Application::default()/* use (different) setters */,
1643 /// ]);
1644 /// ```
1645 pub fn set_applications<T, V>(mut self, v: T) -> Self
1646 where
1647 T: std::iter::IntoIterator<Item = V>,
1648 V: std::convert::Into<crate::model::Application>,
1649 {
1650 use std::iter::Iterator;
1651 self.applications = v.into_iter().map(|i| i.into()).collect();
1652 self
1653 }
1654
1655 /// Sets the value of [next_page_token][crate::model::ListApplicationsResponse::next_page_token].
1656 ///
1657 /// # Example
1658 /// ```ignore,no_run
1659 /// # use google_cloud_apphub_v1::model::ListApplicationsResponse;
1660 /// let x = ListApplicationsResponse::new().set_next_page_token("example");
1661 /// ```
1662 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1663 self.next_page_token = v.into();
1664 self
1665 }
1666
1667 /// Sets the value of [unreachable][crate::model::ListApplicationsResponse::unreachable].
1668 ///
1669 /// # Example
1670 /// ```ignore,no_run
1671 /// # use google_cloud_apphub_v1::model::ListApplicationsResponse;
1672 /// let x = ListApplicationsResponse::new().set_unreachable(["a", "b", "c"]);
1673 /// ```
1674 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1675 where
1676 T: std::iter::IntoIterator<Item = V>,
1677 V: std::convert::Into<std::string::String>,
1678 {
1679 use std::iter::Iterator;
1680 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1681 self
1682 }
1683}
1684
1685impl wkt::message::Message for ListApplicationsResponse {
1686 fn typename() -> &'static str {
1687 "type.googleapis.com/google.cloud.apphub.v1.ListApplicationsResponse"
1688 }
1689}
1690
1691#[doc(hidden)]
1692impl google_cloud_gax::paginator::internal::PageableResponse for ListApplicationsResponse {
1693 type PageItem = crate::model::Application;
1694
1695 fn items(self) -> std::vec::Vec<Self::PageItem> {
1696 self.applications
1697 }
1698
1699 fn next_page_token(&self) -> std::string::String {
1700 use std::clone::Clone;
1701 self.next_page_token.clone()
1702 }
1703}
1704
1705/// Request for CreateApplication.
1706#[derive(Clone, Default, PartialEq)]
1707#[non_exhaustive]
1708pub struct CreateApplicationRequest {
1709 /// Required. Project and location to create Application in.
1710 /// Expected format: `projects/{project}/locations/{location}`.
1711 pub parent: std::string::String,
1712
1713 /// Required. The Application identifier.
1714 /// Must contain only lowercase letters, numbers
1715 /// or hyphens, with the first character a letter, the last a letter or a
1716 /// number, and a 63 character maximum.
1717 pub application_id: std::string::String,
1718
1719 /// Required. The resource being created
1720 pub application: std::option::Option<crate::model::Application>,
1721
1722 /// Optional. An optional request ID to identify requests. Specify a unique
1723 /// request ID so that if you must retry your request, the server will know to
1724 /// ignore the request if it has already been completed. The server will
1725 /// guarantee that for at least 60 minutes since the first request.
1726 ///
1727 /// For example, consider a situation where you make an initial request and the
1728 /// request times out. If you make the request again with the same request
1729 /// ID, the server can check if original operation with the same request ID
1730 /// was received, and if so, will ignore the second request. This prevents
1731 /// clients from accidentally creating duplicate commitments.
1732 ///
1733 /// The request ID must be a valid UUID with the exception that zero UUID is
1734 /// not supported (00000000-0000-0000-0000-000000000000).
1735 pub request_id: std::string::String,
1736
1737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1738}
1739
1740impl CreateApplicationRequest {
1741 /// Creates a new default instance.
1742 pub fn new() -> Self {
1743 std::default::Default::default()
1744 }
1745
1746 /// Sets the value of [parent][crate::model::CreateApplicationRequest::parent].
1747 ///
1748 /// # Example
1749 /// ```ignore,no_run
1750 /// # use google_cloud_apphub_v1::model::CreateApplicationRequest;
1751 /// # let project_id = "project_id";
1752 /// # let location_id = "location_id";
1753 /// let x = CreateApplicationRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1754 /// ```
1755 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1756 self.parent = v.into();
1757 self
1758 }
1759
1760 /// Sets the value of [application_id][crate::model::CreateApplicationRequest::application_id].
1761 ///
1762 /// # Example
1763 /// ```ignore,no_run
1764 /// # use google_cloud_apphub_v1::model::CreateApplicationRequest;
1765 /// let x = CreateApplicationRequest::new().set_application_id("example");
1766 /// ```
1767 pub fn set_application_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1768 self.application_id = v.into();
1769 self
1770 }
1771
1772 /// Sets the value of [application][crate::model::CreateApplicationRequest::application].
1773 ///
1774 /// # Example
1775 /// ```ignore,no_run
1776 /// # use google_cloud_apphub_v1::model::CreateApplicationRequest;
1777 /// use google_cloud_apphub_v1::model::Application;
1778 /// let x = CreateApplicationRequest::new().set_application(Application::default()/* use setters */);
1779 /// ```
1780 pub fn set_application<T>(mut self, v: T) -> Self
1781 where
1782 T: std::convert::Into<crate::model::Application>,
1783 {
1784 self.application = std::option::Option::Some(v.into());
1785 self
1786 }
1787
1788 /// Sets or clears the value of [application][crate::model::CreateApplicationRequest::application].
1789 ///
1790 /// # Example
1791 /// ```ignore,no_run
1792 /// # use google_cloud_apphub_v1::model::CreateApplicationRequest;
1793 /// use google_cloud_apphub_v1::model::Application;
1794 /// let x = CreateApplicationRequest::new().set_or_clear_application(Some(Application::default()/* use setters */));
1795 /// let x = CreateApplicationRequest::new().set_or_clear_application(None::<Application>);
1796 /// ```
1797 pub fn set_or_clear_application<T>(mut self, v: std::option::Option<T>) -> Self
1798 where
1799 T: std::convert::Into<crate::model::Application>,
1800 {
1801 self.application = v.map(|x| x.into());
1802 self
1803 }
1804
1805 /// Sets the value of [request_id][crate::model::CreateApplicationRequest::request_id].
1806 ///
1807 /// # Example
1808 /// ```ignore,no_run
1809 /// # use google_cloud_apphub_v1::model::CreateApplicationRequest;
1810 /// let x = CreateApplicationRequest::new().set_request_id("example");
1811 /// ```
1812 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1813 self.request_id = v.into();
1814 self
1815 }
1816}
1817
1818impl wkt::message::Message for CreateApplicationRequest {
1819 fn typename() -> &'static str {
1820 "type.googleapis.com/google.cloud.apphub.v1.CreateApplicationRequest"
1821 }
1822}
1823
1824/// Request for GetApplication.
1825#[derive(Clone, Default, PartialEq)]
1826#[non_exhaustive]
1827pub struct GetApplicationRequest {
1828 /// Required. Fully qualified name of the Application to fetch.
1829 /// Expected format:
1830 /// `projects/{project}/locations/{location}/applications/{application}`.
1831 pub name: std::string::String,
1832
1833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1834}
1835
1836impl GetApplicationRequest {
1837 /// Creates a new default instance.
1838 pub fn new() -> Self {
1839 std::default::Default::default()
1840 }
1841
1842 /// Sets the value of [name][crate::model::GetApplicationRequest::name].
1843 ///
1844 /// # Example
1845 /// ```ignore,no_run
1846 /// # use google_cloud_apphub_v1::model::GetApplicationRequest;
1847 /// # let project_id = "project_id";
1848 /// # let location_id = "location_id";
1849 /// # let application_id = "application_id";
1850 /// let x = GetApplicationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
1851 /// ```
1852 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1853 self.name = v.into();
1854 self
1855 }
1856}
1857
1858impl wkt::message::Message for GetApplicationRequest {
1859 fn typename() -> &'static str {
1860 "type.googleapis.com/google.cloud.apphub.v1.GetApplicationRequest"
1861 }
1862}
1863
1864/// Request for UpdateApplication.
1865#[derive(Clone, Default, PartialEq)]
1866#[non_exhaustive]
1867pub struct UpdateApplicationRequest {
1868 /// Required. Field mask is used to specify the fields to be overwritten in the
1869 /// Application resource by the update.
1870 /// The fields specified in the update_mask are relative to the resource, not
1871 /// the full request.
1872 /// The API changes the values of the fields as specified in the update_mask.
1873 /// The API ignores the values of all fields not covered by the update_mask.
1874 /// You can also unset a field by not specifying it in the updated message, but
1875 /// adding the field to the mask. This clears whatever value the field
1876 /// previously had.
1877 pub update_mask: std::option::Option<wkt::FieldMask>,
1878
1879 /// Required. The resource being updated.
1880 pub application: std::option::Option<crate::model::Application>,
1881
1882 /// Optional. An optional request ID to identify requests. Specify a unique
1883 /// request ID so that if you must retry your request, the server will know to
1884 /// ignore the request if it has already been completed. The server will
1885 /// guarantee that for at least 60 minutes since the first request.
1886 ///
1887 /// For example, consider a situation where you make an initial request and the
1888 /// request times out. If you make the request again with the same request
1889 /// ID, the server can check if original operation with the same request ID
1890 /// was received, and if so, will ignore the second request. This prevents
1891 /// clients from accidentally creating duplicate commitments.
1892 ///
1893 /// The request ID must be a valid UUID with the exception that zero UUID is
1894 /// not supported (00000000-0000-0000-0000-000000000000).
1895 pub request_id: std::string::String,
1896
1897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1898}
1899
1900impl UpdateApplicationRequest {
1901 /// Creates a new default instance.
1902 pub fn new() -> Self {
1903 std::default::Default::default()
1904 }
1905
1906 /// Sets the value of [update_mask][crate::model::UpdateApplicationRequest::update_mask].
1907 ///
1908 /// # Example
1909 /// ```ignore,no_run
1910 /// # use google_cloud_apphub_v1::model::UpdateApplicationRequest;
1911 /// use wkt::FieldMask;
1912 /// let x = UpdateApplicationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1913 /// ```
1914 pub fn set_update_mask<T>(mut self, v: T) -> Self
1915 where
1916 T: std::convert::Into<wkt::FieldMask>,
1917 {
1918 self.update_mask = std::option::Option::Some(v.into());
1919 self
1920 }
1921
1922 /// Sets or clears the value of [update_mask][crate::model::UpdateApplicationRequest::update_mask].
1923 ///
1924 /// # Example
1925 /// ```ignore,no_run
1926 /// # use google_cloud_apphub_v1::model::UpdateApplicationRequest;
1927 /// use wkt::FieldMask;
1928 /// let x = UpdateApplicationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1929 /// let x = UpdateApplicationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1930 /// ```
1931 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1932 where
1933 T: std::convert::Into<wkt::FieldMask>,
1934 {
1935 self.update_mask = v.map(|x| x.into());
1936 self
1937 }
1938
1939 /// Sets the value of [application][crate::model::UpdateApplicationRequest::application].
1940 ///
1941 /// # Example
1942 /// ```ignore,no_run
1943 /// # use google_cloud_apphub_v1::model::UpdateApplicationRequest;
1944 /// use google_cloud_apphub_v1::model::Application;
1945 /// let x = UpdateApplicationRequest::new().set_application(Application::default()/* use setters */);
1946 /// ```
1947 pub fn set_application<T>(mut self, v: T) -> Self
1948 where
1949 T: std::convert::Into<crate::model::Application>,
1950 {
1951 self.application = std::option::Option::Some(v.into());
1952 self
1953 }
1954
1955 /// Sets or clears the value of [application][crate::model::UpdateApplicationRequest::application].
1956 ///
1957 /// # Example
1958 /// ```ignore,no_run
1959 /// # use google_cloud_apphub_v1::model::UpdateApplicationRequest;
1960 /// use google_cloud_apphub_v1::model::Application;
1961 /// let x = UpdateApplicationRequest::new().set_or_clear_application(Some(Application::default()/* use setters */));
1962 /// let x = UpdateApplicationRequest::new().set_or_clear_application(None::<Application>);
1963 /// ```
1964 pub fn set_or_clear_application<T>(mut self, v: std::option::Option<T>) -> Self
1965 where
1966 T: std::convert::Into<crate::model::Application>,
1967 {
1968 self.application = v.map(|x| x.into());
1969 self
1970 }
1971
1972 /// Sets the value of [request_id][crate::model::UpdateApplicationRequest::request_id].
1973 ///
1974 /// # Example
1975 /// ```ignore,no_run
1976 /// # use google_cloud_apphub_v1::model::UpdateApplicationRequest;
1977 /// let x = UpdateApplicationRequest::new().set_request_id("example");
1978 /// ```
1979 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1980 self.request_id = v.into();
1981 self
1982 }
1983}
1984
1985impl wkt::message::Message for UpdateApplicationRequest {
1986 fn typename() -> &'static str {
1987 "type.googleapis.com/google.cloud.apphub.v1.UpdateApplicationRequest"
1988 }
1989}
1990
1991/// Request for DeleteApplication.
1992#[derive(Clone, Default, PartialEq)]
1993#[non_exhaustive]
1994pub struct DeleteApplicationRequest {
1995 /// Required. Fully qualified name of the Application to delete.
1996 /// Expected format:
1997 /// `projects/{project}/locations/{location}/applications/{application}`.
1998 pub name: std::string::String,
1999
2000 /// Optional. An optional request ID to identify requests. Specify a unique
2001 /// request ID so that if you must retry your request, the server will know to
2002 /// ignore the request if it has already been completed. The server will
2003 /// guarantee that for at least 60 minutes after the first request.
2004 ///
2005 /// For example, consider a situation where you make an initial request and the
2006 /// request times out. If you make the request again with the same request
2007 /// ID, the server can check if original operation with the same request ID
2008 /// was received, and if so, will ignore the second request. This prevents
2009 /// clients from accidentally creating duplicate commitments.
2010 ///
2011 /// The request ID must be a valid UUID with the exception that zero UUID is
2012 /// not supported (00000000-0000-0000-0000-000000000000).
2013 pub request_id: std::string::String,
2014
2015 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2016}
2017
2018impl DeleteApplicationRequest {
2019 /// Creates a new default instance.
2020 pub fn new() -> Self {
2021 std::default::Default::default()
2022 }
2023
2024 /// Sets the value of [name][crate::model::DeleteApplicationRequest::name].
2025 ///
2026 /// # Example
2027 /// ```ignore,no_run
2028 /// # use google_cloud_apphub_v1::model::DeleteApplicationRequest;
2029 /// # let project_id = "project_id";
2030 /// # let location_id = "location_id";
2031 /// # let application_id = "application_id";
2032 /// let x = DeleteApplicationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
2033 /// ```
2034 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2035 self.name = v.into();
2036 self
2037 }
2038
2039 /// Sets the value of [request_id][crate::model::DeleteApplicationRequest::request_id].
2040 ///
2041 /// # Example
2042 /// ```ignore,no_run
2043 /// # use google_cloud_apphub_v1::model::DeleteApplicationRequest;
2044 /// let x = DeleteApplicationRequest::new().set_request_id("example");
2045 /// ```
2046 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2047 self.request_id = v.into();
2048 self
2049 }
2050}
2051
2052impl wkt::message::Message for DeleteApplicationRequest {
2053 fn typename() -> &'static str {
2054 "type.googleapis.com/google.cloud.apphub.v1.DeleteApplicationRequest"
2055 }
2056}
2057
2058/// Request for ListWorkloads.
2059#[derive(Clone, Default, PartialEq)]
2060#[non_exhaustive]
2061pub struct ListWorkloadsRequest {
2062 /// Required. Fully qualified name of the parent Application to list Workloads
2063 /// for. Expected format:
2064 /// `projects/{project}/locations/{location}/applications/{application}`.
2065 pub parent: std::string::String,
2066
2067 /// Optional. Requested page size. Server may return fewer items than
2068 /// requested. If unspecified, server will pick an appropriate default.
2069 pub page_size: i32,
2070
2071 /// Optional. A token identifying a page of results the server should return.
2072 pub page_token: std::string::String,
2073
2074 /// Optional. Filtering results.
2075 pub filter: std::string::String,
2076
2077 /// Optional. Hint for how to order the results.
2078 pub order_by: std::string::String,
2079
2080 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2081}
2082
2083impl ListWorkloadsRequest {
2084 /// Creates a new default instance.
2085 pub fn new() -> Self {
2086 std::default::Default::default()
2087 }
2088
2089 /// Sets the value of [parent][crate::model::ListWorkloadsRequest::parent].
2090 ///
2091 /// # Example
2092 /// ```ignore,no_run
2093 /// # use google_cloud_apphub_v1::model::ListWorkloadsRequest;
2094 /// # let project_id = "project_id";
2095 /// # let location_id = "location_id";
2096 /// # let application_id = "application_id";
2097 /// let x = ListWorkloadsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
2098 /// ```
2099 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2100 self.parent = v.into();
2101 self
2102 }
2103
2104 /// Sets the value of [page_size][crate::model::ListWorkloadsRequest::page_size].
2105 ///
2106 /// # Example
2107 /// ```ignore,no_run
2108 /// # use google_cloud_apphub_v1::model::ListWorkloadsRequest;
2109 /// let x = ListWorkloadsRequest::new().set_page_size(42);
2110 /// ```
2111 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2112 self.page_size = v.into();
2113 self
2114 }
2115
2116 /// Sets the value of [page_token][crate::model::ListWorkloadsRequest::page_token].
2117 ///
2118 /// # Example
2119 /// ```ignore,no_run
2120 /// # use google_cloud_apphub_v1::model::ListWorkloadsRequest;
2121 /// let x = ListWorkloadsRequest::new().set_page_token("example");
2122 /// ```
2123 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2124 self.page_token = v.into();
2125 self
2126 }
2127
2128 /// Sets the value of [filter][crate::model::ListWorkloadsRequest::filter].
2129 ///
2130 /// # Example
2131 /// ```ignore,no_run
2132 /// # use google_cloud_apphub_v1::model::ListWorkloadsRequest;
2133 /// let x = ListWorkloadsRequest::new().set_filter("example");
2134 /// ```
2135 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2136 self.filter = v.into();
2137 self
2138 }
2139
2140 /// Sets the value of [order_by][crate::model::ListWorkloadsRequest::order_by].
2141 ///
2142 /// # Example
2143 /// ```ignore,no_run
2144 /// # use google_cloud_apphub_v1::model::ListWorkloadsRequest;
2145 /// let x = ListWorkloadsRequest::new().set_order_by("example");
2146 /// ```
2147 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2148 self.order_by = v.into();
2149 self
2150 }
2151}
2152
2153impl wkt::message::Message for ListWorkloadsRequest {
2154 fn typename() -> &'static str {
2155 "type.googleapis.com/google.cloud.apphub.v1.ListWorkloadsRequest"
2156 }
2157}
2158
2159/// Response for ListWorkloads.
2160#[derive(Clone, Default, PartialEq)]
2161#[non_exhaustive]
2162pub struct ListWorkloadsResponse {
2163 /// List of Workloads.
2164 pub workloads: std::vec::Vec<crate::model::Workload>,
2165
2166 /// A token identifying a page of results the server should return.
2167 pub next_page_token: std::string::String,
2168
2169 /// Locations that could not be reached.
2170 pub unreachable: std::vec::Vec<std::string::String>,
2171
2172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2173}
2174
2175impl ListWorkloadsResponse {
2176 /// Creates a new default instance.
2177 pub fn new() -> Self {
2178 std::default::Default::default()
2179 }
2180
2181 /// Sets the value of [workloads][crate::model::ListWorkloadsResponse::workloads].
2182 ///
2183 /// # Example
2184 /// ```ignore,no_run
2185 /// # use google_cloud_apphub_v1::model::ListWorkloadsResponse;
2186 /// use google_cloud_apphub_v1::model::Workload;
2187 /// let x = ListWorkloadsResponse::new()
2188 /// .set_workloads([
2189 /// Workload::default()/* use setters */,
2190 /// Workload::default()/* use (different) setters */,
2191 /// ]);
2192 /// ```
2193 pub fn set_workloads<T, V>(mut self, v: T) -> Self
2194 where
2195 T: std::iter::IntoIterator<Item = V>,
2196 V: std::convert::Into<crate::model::Workload>,
2197 {
2198 use std::iter::Iterator;
2199 self.workloads = v.into_iter().map(|i| i.into()).collect();
2200 self
2201 }
2202
2203 /// Sets the value of [next_page_token][crate::model::ListWorkloadsResponse::next_page_token].
2204 ///
2205 /// # Example
2206 /// ```ignore,no_run
2207 /// # use google_cloud_apphub_v1::model::ListWorkloadsResponse;
2208 /// let x = ListWorkloadsResponse::new().set_next_page_token("example");
2209 /// ```
2210 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2211 self.next_page_token = v.into();
2212 self
2213 }
2214
2215 /// Sets the value of [unreachable][crate::model::ListWorkloadsResponse::unreachable].
2216 ///
2217 /// # Example
2218 /// ```ignore,no_run
2219 /// # use google_cloud_apphub_v1::model::ListWorkloadsResponse;
2220 /// let x = ListWorkloadsResponse::new().set_unreachable(["a", "b", "c"]);
2221 /// ```
2222 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2223 where
2224 T: std::iter::IntoIterator<Item = V>,
2225 V: std::convert::Into<std::string::String>,
2226 {
2227 use std::iter::Iterator;
2228 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2229 self
2230 }
2231}
2232
2233impl wkt::message::Message for ListWorkloadsResponse {
2234 fn typename() -> &'static str {
2235 "type.googleapis.com/google.cloud.apphub.v1.ListWorkloadsResponse"
2236 }
2237}
2238
2239#[doc(hidden)]
2240impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkloadsResponse {
2241 type PageItem = crate::model::Workload;
2242
2243 fn items(self) -> std::vec::Vec<Self::PageItem> {
2244 self.workloads
2245 }
2246
2247 fn next_page_token(&self) -> std::string::String {
2248 use std::clone::Clone;
2249 self.next_page_token.clone()
2250 }
2251}
2252
2253/// Request for ListDiscoveredWorkloads.
2254#[derive(Clone, Default, PartialEq)]
2255#[non_exhaustive]
2256pub struct ListDiscoveredWorkloadsRequest {
2257 /// Required. Project and location to list Discovered Workloads on.
2258 /// Expected format: `projects/{project}/locations/{location}`.
2259 pub parent: std::string::String,
2260
2261 /// Optional. Requested page size. Server may return fewer items than
2262 /// requested. If unspecified, server will pick an appropriate default.
2263 pub page_size: i32,
2264
2265 /// Optional. A token identifying a page of results the server should return.
2266 pub page_token: std::string::String,
2267
2268 /// Optional. Filtering results.
2269 pub filter: std::string::String,
2270
2271 /// Optional. Hint for how to order the results.
2272 pub order_by: std::string::String,
2273
2274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2275}
2276
2277impl ListDiscoveredWorkloadsRequest {
2278 /// Creates a new default instance.
2279 pub fn new() -> Self {
2280 std::default::Default::default()
2281 }
2282
2283 /// Sets the value of [parent][crate::model::ListDiscoveredWorkloadsRequest::parent].
2284 ///
2285 /// # Example
2286 /// ```ignore,no_run
2287 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsRequest;
2288 /// # let project_id = "project_id";
2289 /// # let location_id = "location_id";
2290 /// let x = ListDiscoveredWorkloadsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2291 /// ```
2292 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2293 self.parent = v.into();
2294 self
2295 }
2296
2297 /// Sets the value of [page_size][crate::model::ListDiscoveredWorkloadsRequest::page_size].
2298 ///
2299 /// # Example
2300 /// ```ignore,no_run
2301 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsRequest;
2302 /// let x = ListDiscoveredWorkloadsRequest::new().set_page_size(42);
2303 /// ```
2304 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2305 self.page_size = v.into();
2306 self
2307 }
2308
2309 /// Sets the value of [page_token][crate::model::ListDiscoveredWorkloadsRequest::page_token].
2310 ///
2311 /// # Example
2312 /// ```ignore,no_run
2313 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsRequest;
2314 /// let x = ListDiscoveredWorkloadsRequest::new().set_page_token("example");
2315 /// ```
2316 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2317 self.page_token = v.into();
2318 self
2319 }
2320
2321 /// Sets the value of [filter][crate::model::ListDiscoveredWorkloadsRequest::filter].
2322 ///
2323 /// # Example
2324 /// ```ignore,no_run
2325 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsRequest;
2326 /// let x = ListDiscoveredWorkloadsRequest::new().set_filter("example");
2327 /// ```
2328 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2329 self.filter = v.into();
2330 self
2331 }
2332
2333 /// Sets the value of [order_by][crate::model::ListDiscoveredWorkloadsRequest::order_by].
2334 ///
2335 /// # Example
2336 /// ```ignore,no_run
2337 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsRequest;
2338 /// let x = ListDiscoveredWorkloadsRequest::new().set_order_by("example");
2339 /// ```
2340 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2341 self.order_by = v.into();
2342 self
2343 }
2344}
2345
2346impl wkt::message::Message for ListDiscoveredWorkloadsRequest {
2347 fn typename() -> &'static str {
2348 "type.googleapis.com/google.cloud.apphub.v1.ListDiscoveredWorkloadsRequest"
2349 }
2350}
2351
2352/// Response for ListDiscoveredWorkloads.
2353#[derive(Clone, Default, PartialEq)]
2354#[non_exhaustive]
2355pub struct ListDiscoveredWorkloadsResponse {
2356 /// List of Discovered Workloads.
2357 pub discovered_workloads: std::vec::Vec<crate::model::DiscoveredWorkload>,
2358
2359 /// A token identifying a page of results the server should return.
2360 pub next_page_token: std::string::String,
2361
2362 /// Locations that could not be reached.
2363 pub unreachable: std::vec::Vec<std::string::String>,
2364
2365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2366}
2367
2368impl ListDiscoveredWorkloadsResponse {
2369 /// Creates a new default instance.
2370 pub fn new() -> Self {
2371 std::default::Default::default()
2372 }
2373
2374 /// Sets the value of [discovered_workloads][crate::model::ListDiscoveredWorkloadsResponse::discovered_workloads].
2375 ///
2376 /// # Example
2377 /// ```ignore,no_run
2378 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsResponse;
2379 /// use google_cloud_apphub_v1::model::DiscoveredWorkload;
2380 /// let x = ListDiscoveredWorkloadsResponse::new()
2381 /// .set_discovered_workloads([
2382 /// DiscoveredWorkload::default()/* use setters */,
2383 /// DiscoveredWorkload::default()/* use (different) setters */,
2384 /// ]);
2385 /// ```
2386 pub fn set_discovered_workloads<T, V>(mut self, v: T) -> Self
2387 where
2388 T: std::iter::IntoIterator<Item = V>,
2389 V: std::convert::Into<crate::model::DiscoveredWorkload>,
2390 {
2391 use std::iter::Iterator;
2392 self.discovered_workloads = v.into_iter().map(|i| i.into()).collect();
2393 self
2394 }
2395
2396 /// Sets the value of [next_page_token][crate::model::ListDiscoveredWorkloadsResponse::next_page_token].
2397 ///
2398 /// # Example
2399 /// ```ignore,no_run
2400 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsResponse;
2401 /// let x = ListDiscoveredWorkloadsResponse::new().set_next_page_token("example");
2402 /// ```
2403 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2404 self.next_page_token = v.into();
2405 self
2406 }
2407
2408 /// Sets the value of [unreachable][crate::model::ListDiscoveredWorkloadsResponse::unreachable].
2409 ///
2410 /// # Example
2411 /// ```ignore,no_run
2412 /// # use google_cloud_apphub_v1::model::ListDiscoveredWorkloadsResponse;
2413 /// let x = ListDiscoveredWorkloadsResponse::new().set_unreachable(["a", "b", "c"]);
2414 /// ```
2415 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2416 where
2417 T: std::iter::IntoIterator<Item = V>,
2418 V: std::convert::Into<std::string::String>,
2419 {
2420 use std::iter::Iterator;
2421 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2422 self
2423 }
2424}
2425
2426impl wkt::message::Message for ListDiscoveredWorkloadsResponse {
2427 fn typename() -> &'static str {
2428 "type.googleapis.com/google.cloud.apphub.v1.ListDiscoveredWorkloadsResponse"
2429 }
2430}
2431
2432#[doc(hidden)]
2433impl google_cloud_gax::paginator::internal::PageableResponse for ListDiscoveredWorkloadsResponse {
2434 type PageItem = crate::model::DiscoveredWorkload;
2435
2436 fn items(self) -> std::vec::Vec<Self::PageItem> {
2437 self.discovered_workloads
2438 }
2439
2440 fn next_page_token(&self) -> std::string::String {
2441 use std::clone::Clone;
2442 self.next_page_token.clone()
2443 }
2444}
2445
2446/// Request for CreateWorkload.
2447#[derive(Clone, Default, PartialEq)]
2448#[non_exhaustive]
2449pub struct CreateWorkloadRequest {
2450 /// Required. Fully qualified name of the Application to create Workload in.
2451 /// Expected format:
2452 /// `projects/{project}/locations/{location}/applications/{application}`.
2453 pub parent: std::string::String,
2454
2455 /// Required. The Workload identifier.
2456 /// Must contain only lowercase letters, numbers
2457 /// or hyphens, with the first character a letter, the last a letter or a
2458 /// number, and a 63 character maximum.
2459 pub workload_id: std::string::String,
2460
2461 /// Required. The resource being created.
2462 pub workload: std::option::Option<crate::model::Workload>,
2463
2464 /// Optional. An optional request ID to identify requests. Specify a unique
2465 /// request ID so that if you must retry your request, the server will know to
2466 /// ignore the request if it has already been completed. The server will
2467 /// guarantee that for at least 60 minutes since the first request.
2468 ///
2469 /// For example, consider a situation where you make an initial request and the
2470 /// request times out. If you make the request again with the same request
2471 /// ID, the server can check if original operation with the same request ID
2472 /// was received, and if so, will ignore the second request. This prevents
2473 /// clients from accidentally creating duplicate commitments.
2474 ///
2475 /// The request ID must be a valid UUID with the exception that zero UUID is
2476 /// not supported (00000000-0000-0000-0000-000000000000).
2477 pub request_id: std::string::String,
2478
2479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2480}
2481
2482impl CreateWorkloadRequest {
2483 /// Creates a new default instance.
2484 pub fn new() -> Self {
2485 std::default::Default::default()
2486 }
2487
2488 /// Sets the value of [parent][crate::model::CreateWorkloadRequest::parent].
2489 ///
2490 /// # Example
2491 /// ```ignore,no_run
2492 /// # use google_cloud_apphub_v1::model::CreateWorkloadRequest;
2493 /// # let project_id = "project_id";
2494 /// # let location_id = "location_id";
2495 /// # let application_id = "application_id";
2496 /// let x = CreateWorkloadRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
2497 /// ```
2498 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2499 self.parent = v.into();
2500 self
2501 }
2502
2503 /// Sets the value of [workload_id][crate::model::CreateWorkloadRequest::workload_id].
2504 ///
2505 /// # Example
2506 /// ```ignore,no_run
2507 /// # use google_cloud_apphub_v1::model::CreateWorkloadRequest;
2508 /// let x = CreateWorkloadRequest::new().set_workload_id("example");
2509 /// ```
2510 pub fn set_workload_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2511 self.workload_id = v.into();
2512 self
2513 }
2514
2515 /// Sets the value of [workload][crate::model::CreateWorkloadRequest::workload].
2516 ///
2517 /// # Example
2518 /// ```ignore,no_run
2519 /// # use google_cloud_apphub_v1::model::CreateWorkloadRequest;
2520 /// use google_cloud_apphub_v1::model::Workload;
2521 /// let x = CreateWorkloadRequest::new().set_workload(Workload::default()/* use setters */);
2522 /// ```
2523 pub fn set_workload<T>(mut self, v: T) -> Self
2524 where
2525 T: std::convert::Into<crate::model::Workload>,
2526 {
2527 self.workload = std::option::Option::Some(v.into());
2528 self
2529 }
2530
2531 /// Sets or clears the value of [workload][crate::model::CreateWorkloadRequest::workload].
2532 ///
2533 /// # Example
2534 /// ```ignore,no_run
2535 /// # use google_cloud_apphub_v1::model::CreateWorkloadRequest;
2536 /// use google_cloud_apphub_v1::model::Workload;
2537 /// let x = CreateWorkloadRequest::new().set_or_clear_workload(Some(Workload::default()/* use setters */));
2538 /// let x = CreateWorkloadRequest::new().set_or_clear_workload(None::<Workload>);
2539 /// ```
2540 pub fn set_or_clear_workload<T>(mut self, v: std::option::Option<T>) -> Self
2541 where
2542 T: std::convert::Into<crate::model::Workload>,
2543 {
2544 self.workload = v.map(|x| x.into());
2545 self
2546 }
2547
2548 /// Sets the value of [request_id][crate::model::CreateWorkloadRequest::request_id].
2549 ///
2550 /// # Example
2551 /// ```ignore,no_run
2552 /// # use google_cloud_apphub_v1::model::CreateWorkloadRequest;
2553 /// let x = CreateWorkloadRequest::new().set_request_id("example");
2554 /// ```
2555 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2556 self.request_id = v.into();
2557 self
2558 }
2559}
2560
2561impl wkt::message::Message for CreateWorkloadRequest {
2562 fn typename() -> &'static str {
2563 "type.googleapis.com/google.cloud.apphub.v1.CreateWorkloadRequest"
2564 }
2565}
2566
2567/// Request for GetWorkload.
2568#[derive(Clone, Default, PartialEq)]
2569#[non_exhaustive]
2570pub struct GetWorkloadRequest {
2571 /// Required. Fully qualified name of the Workload to fetch.
2572 /// Expected format:
2573 /// `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`.
2574 pub name: std::string::String,
2575
2576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2577}
2578
2579impl GetWorkloadRequest {
2580 /// Creates a new default instance.
2581 pub fn new() -> Self {
2582 std::default::Default::default()
2583 }
2584
2585 /// Sets the value of [name][crate::model::GetWorkloadRequest::name].
2586 ///
2587 /// # Example
2588 /// ```ignore,no_run
2589 /// # use google_cloud_apphub_v1::model::GetWorkloadRequest;
2590 /// # let project_id = "project_id";
2591 /// # let location_id = "location_id";
2592 /// # let application_id = "application_id";
2593 /// # let workload_id = "workload_id";
2594 /// let x = GetWorkloadRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/workloads/{workload_id}"));
2595 /// ```
2596 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2597 self.name = v.into();
2598 self
2599 }
2600}
2601
2602impl wkt::message::Message for GetWorkloadRequest {
2603 fn typename() -> &'static str {
2604 "type.googleapis.com/google.cloud.apphub.v1.GetWorkloadRequest"
2605 }
2606}
2607
2608/// Request for GetDiscoveredWorkload.
2609#[derive(Clone, Default, PartialEq)]
2610#[non_exhaustive]
2611pub struct GetDiscoveredWorkloadRequest {
2612 /// Required. Fully qualified name of the Discovered Workload to fetch.
2613 /// Expected format:
2614 /// `projects/{project}/locations/{location}/discoveredWorkloads/{discoveredWorkload}`.
2615 pub name: std::string::String,
2616
2617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2618}
2619
2620impl GetDiscoveredWorkloadRequest {
2621 /// Creates a new default instance.
2622 pub fn new() -> Self {
2623 std::default::Default::default()
2624 }
2625
2626 /// Sets the value of [name][crate::model::GetDiscoveredWorkloadRequest::name].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_apphub_v1::model::GetDiscoveredWorkloadRequest;
2631 /// # let project_id = "project_id";
2632 /// # let location_id = "location_id";
2633 /// # let discovered_workload_id = "discovered_workload_id";
2634 /// let x = GetDiscoveredWorkloadRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/discoveredWorkloads/{discovered_workload_id}"));
2635 /// ```
2636 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2637 self.name = v.into();
2638 self
2639 }
2640}
2641
2642impl wkt::message::Message for GetDiscoveredWorkloadRequest {
2643 fn typename() -> &'static str {
2644 "type.googleapis.com/google.cloud.apphub.v1.GetDiscoveredWorkloadRequest"
2645 }
2646}
2647
2648/// Request for LookupDiscoveredWorkload.
2649#[derive(Clone, Default, PartialEq)]
2650#[non_exhaustive]
2651pub struct LookupDiscoveredWorkloadRequest {
2652 /// Required. Host project ID and location to lookup Discovered Workload in.
2653 /// Expected format: `projects/{project}/locations/{location}`.
2654 pub parent: std::string::String,
2655
2656 /// Required. Resource URI to find Discovered Workload for.
2657 /// Accepts both project number and project ID and does translation when
2658 /// needed.
2659 pub uri: std::string::String,
2660
2661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2662}
2663
2664impl LookupDiscoveredWorkloadRequest {
2665 /// Creates a new default instance.
2666 pub fn new() -> Self {
2667 std::default::Default::default()
2668 }
2669
2670 /// Sets the value of [parent][crate::model::LookupDiscoveredWorkloadRequest::parent].
2671 ///
2672 /// # Example
2673 /// ```ignore,no_run
2674 /// # use google_cloud_apphub_v1::model::LookupDiscoveredWorkloadRequest;
2675 /// # let project_id = "project_id";
2676 /// # let location_id = "location_id";
2677 /// let x = LookupDiscoveredWorkloadRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
2678 /// ```
2679 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2680 self.parent = v.into();
2681 self
2682 }
2683
2684 /// Sets the value of [uri][crate::model::LookupDiscoveredWorkloadRequest::uri].
2685 ///
2686 /// # Example
2687 /// ```ignore,no_run
2688 /// # use google_cloud_apphub_v1::model::LookupDiscoveredWorkloadRequest;
2689 /// let x = LookupDiscoveredWorkloadRequest::new().set_uri("example");
2690 /// ```
2691 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.uri = v.into();
2693 self
2694 }
2695}
2696
2697impl wkt::message::Message for LookupDiscoveredWorkloadRequest {
2698 fn typename() -> &'static str {
2699 "type.googleapis.com/google.cloud.apphub.v1.LookupDiscoveredWorkloadRequest"
2700 }
2701}
2702
2703/// Response for LookupDiscoveredWorkload.
2704#[derive(Clone, Default, PartialEq)]
2705#[non_exhaustive]
2706pub struct LookupDiscoveredWorkloadResponse {
2707 /// Discovered Workload if exists, empty otherwise.
2708 pub discovered_workload: std::option::Option<crate::model::DiscoveredWorkload>,
2709
2710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2711}
2712
2713impl LookupDiscoveredWorkloadResponse {
2714 /// Creates a new default instance.
2715 pub fn new() -> Self {
2716 std::default::Default::default()
2717 }
2718
2719 /// Sets the value of [discovered_workload][crate::model::LookupDiscoveredWorkloadResponse::discovered_workload].
2720 ///
2721 /// # Example
2722 /// ```ignore,no_run
2723 /// # use google_cloud_apphub_v1::model::LookupDiscoveredWorkloadResponse;
2724 /// use google_cloud_apphub_v1::model::DiscoveredWorkload;
2725 /// let x = LookupDiscoveredWorkloadResponse::new().set_discovered_workload(DiscoveredWorkload::default()/* use setters */);
2726 /// ```
2727 pub fn set_discovered_workload<T>(mut self, v: T) -> Self
2728 where
2729 T: std::convert::Into<crate::model::DiscoveredWorkload>,
2730 {
2731 self.discovered_workload = std::option::Option::Some(v.into());
2732 self
2733 }
2734
2735 /// Sets or clears the value of [discovered_workload][crate::model::LookupDiscoveredWorkloadResponse::discovered_workload].
2736 ///
2737 /// # Example
2738 /// ```ignore,no_run
2739 /// # use google_cloud_apphub_v1::model::LookupDiscoveredWorkloadResponse;
2740 /// use google_cloud_apphub_v1::model::DiscoveredWorkload;
2741 /// let x = LookupDiscoveredWorkloadResponse::new().set_or_clear_discovered_workload(Some(DiscoveredWorkload::default()/* use setters */));
2742 /// let x = LookupDiscoveredWorkloadResponse::new().set_or_clear_discovered_workload(None::<DiscoveredWorkload>);
2743 /// ```
2744 pub fn set_or_clear_discovered_workload<T>(mut self, v: std::option::Option<T>) -> Self
2745 where
2746 T: std::convert::Into<crate::model::DiscoveredWorkload>,
2747 {
2748 self.discovered_workload = v.map(|x| x.into());
2749 self
2750 }
2751}
2752
2753impl wkt::message::Message for LookupDiscoveredWorkloadResponse {
2754 fn typename() -> &'static str {
2755 "type.googleapis.com/google.cloud.apphub.v1.LookupDiscoveredWorkloadResponse"
2756 }
2757}
2758
2759/// Request for UpdateWorkload.
2760#[derive(Clone, Default, PartialEq)]
2761#[non_exhaustive]
2762pub struct UpdateWorkloadRequest {
2763 /// Required. Field mask is used to specify the fields to be overwritten in the
2764 /// Workload resource by the update.
2765 /// The fields specified in the update_mask are relative to the resource, not
2766 /// the full request.
2767 /// The API changes the values of the fields as specified in the update_mask.
2768 /// The API ignores the values of all fields not covered by the update_mask.
2769 /// You can also unset a field by not specifying it in the updated message, but
2770 /// adding the field to the mask. This clears whatever value the field
2771 /// previously had.
2772 pub update_mask: std::option::Option<wkt::FieldMask>,
2773
2774 /// Required. The resource being updated.
2775 pub workload: std::option::Option<crate::model::Workload>,
2776
2777 /// Optional. An optional request ID to identify requests. Specify a unique
2778 /// request ID so that if you must retry your request, the server will know to
2779 /// ignore the request if it has already been completed. The server will
2780 /// guarantee that for at least 60 minutes since the first request.
2781 ///
2782 /// For example, consider a situation where you make an initial request and the
2783 /// request times out. If you make the request again with the same request
2784 /// ID, the server can check if original operation with the same request ID
2785 /// was received, and if so, will ignore the second request. This prevents
2786 /// clients from accidentally creating duplicate commitments.
2787 ///
2788 /// The request ID must be a valid UUID with the exception that zero UUID is
2789 /// not supported (00000000-0000-0000-0000-000000000000).
2790 pub request_id: std::string::String,
2791
2792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2793}
2794
2795impl UpdateWorkloadRequest {
2796 /// Creates a new default instance.
2797 pub fn new() -> Self {
2798 std::default::Default::default()
2799 }
2800
2801 /// Sets the value of [update_mask][crate::model::UpdateWorkloadRequest::update_mask].
2802 ///
2803 /// # Example
2804 /// ```ignore,no_run
2805 /// # use google_cloud_apphub_v1::model::UpdateWorkloadRequest;
2806 /// use wkt::FieldMask;
2807 /// let x = UpdateWorkloadRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2808 /// ```
2809 pub fn set_update_mask<T>(mut self, v: T) -> Self
2810 where
2811 T: std::convert::Into<wkt::FieldMask>,
2812 {
2813 self.update_mask = std::option::Option::Some(v.into());
2814 self
2815 }
2816
2817 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkloadRequest::update_mask].
2818 ///
2819 /// # Example
2820 /// ```ignore,no_run
2821 /// # use google_cloud_apphub_v1::model::UpdateWorkloadRequest;
2822 /// use wkt::FieldMask;
2823 /// let x = UpdateWorkloadRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2824 /// let x = UpdateWorkloadRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2825 /// ```
2826 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2827 where
2828 T: std::convert::Into<wkt::FieldMask>,
2829 {
2830 self.update_mask = v.map(|x| x.into());
2831 self
2832 }
2833
2834 /// Sets the value of [workload][crate::model::UpdateWorkloadRequest::workload].
2835 ///
2836 /// # Example
2837 /// ```ignore,no_run
2838 /// # use google_cloud_apphub_v1::model::UpdateWorkloadRequest;
2839 /// use google_cloud_apphub_v1::model::Workload;
2840 /// let x = UpdateWorkloadRequest::new().set_workload(Workload::default()/* use setters */);
2841 /// ```
2842 pub fn set_workload<T>(mut self, v: T) -> Self
2843 where
2844 T: std::convert::Into<crate::model::Workload>,
2845 {
2846 self.workload = std::option::Option::Some(v.into());
2847 self
2848 }
2849
2850 /// Sets or clears the value of [workload][crate::model::UpdateWorkloadRequest::workload].
2851 ///
2852 /// # Example
2853 /// ```ignore,no_run
2854 /// # use google_cloud_apphub_v1::model::UpdateWorkloadRequest;
2855 /// use google_cloud_apphub_v1::model::Workload;
2856 /// let x = UpdateWorkloadRequest::new().set_or_clear_workload(Some(Workload::default()/* use setters */));
2857 /// let x = UpdateWorkloadRequest::new().set_or_clear_workload(None::<Workload>);
2858 /// ```
2859 pub fn set_or_clear_workload<T>(mut self, v: std::option::Option<T>) -> Self
2860 where
2861 T: std::convert::Into<crate::model::Workload>,
2862 {
2863 self.workload = v.map(|x| x.into());
2864 self
2865 }
2866
2867 /// Sets the value of [request_id][crate::model::UpdateWorkloadRequest::request_id].
2868 ///
2869 /// # Example
2870 /// ```ignore,no_run
2871 /// # use google_cloud_apphub_v1::model::UpdateWorkloadRequest;
2872 /// let x = UpdateWorkloadRequest::new().set_request_id("example");
2873 /// ```
2874 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2875 self.request_id = v.into();
2876 self
2877 }
2878}
2879
2880impl wkt::message::Message for UpdateWorkloadRequest {
2881 fn typename() -> &'static str {
2882 "type.googleapis.com/google.cloud.apphub.v1.UpdateWorkloadRequest"
2883 }
2884}
2885
2886/// Request for DeleteWorkload.
2887#[derive(Clone, Default, PartialEq)]
2888#[non_exhaustive]
2889pub struct DeleteWorkloadRequest {
2890 /// Required. Fully qualified name of the Workload to delete from an
2891 /// Application. Expected format:
2892 /// `projects/{project}/locations/{location}/applications/{application}/workloads/{workload}`.
2893 pub name: std::string::String,
2894
2895 /// Optional. An optional request ID to identify requests. Specify a unique
2896 /// request ID so that if you must retry your request, the server will know to
2897 /// ignore the request if it has already been completed. The server will
2898 /// guarantee that for at least 60 minutes after the first request.
2899 ///
2900 /// For example, consider a situation where you make an initial request and the
2901 /// request times out. If you make the request again with the same request
2902 /// ID, the server can check if original operation with the same request ID
2903 /// was received, and if so, will ignore the second request. This prevents
2904 /// clients from accidentally creating duplicate commitments.
2905 ///
2906 /// The request ID must be a valid UUID with the exception that zero UUID is
2907 /// not supported (00000000-0000-0000-0000-000000000000).
2908 pub request_id: std::string::String,
2909
2910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2911}
2912
2913impl DeleteWorkloadRequest {
2914 /// Creates a new default instance.
2915 pub fn new() -> Self {
2916 std::default::Default::default()
2917 }
2918
2919 /// Sets the value of [name][crate::model::DeleteWorkloadRequest::name].
2920 ///
2921 /// # Example
2922 /// ```ignore,no_run
2923 /// # use google_cloud_apphub_v1::model::DeleteWorkloadRequest;
2924 /// # let project_id = "project_id";
2925 /// # let location_id = "location_id";
2926 /// # let application_id = "application_id";
2927 /// # let workload_id = "workload_id";
2928 /// let x = DeleteWorkloadRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/workloads/{workload_id}"));
2929 /// ```
2930 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2931 self.name = v.into();
2932 self
2933 }
2934
2935 /// Sets the value of [request_id][crate::model::DeleteWorkloadRequest::request_id].
2936 ///
2937 /// # Example
2938 /// ```ignore,no_run
2939 /// # use google_cloud_apphub_v1::model::DeleteWorkloadRequest;
2940 /// let x = DeleteWorkloadRequest::new().set_request_id("example");
2941 /// ```
2942 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2943 self.request_id = v.into();
2944 self
2945 }
2946}
2947
2948impl wkt::message::Message for DeleteWorkloadRequest {
2949 fn typename() -> &'static str {
2950 "type.googleapis.com/google.cloud.apphub.v1.DeleteWorkloadRequest"
2951 }
2952}
2953
2954/// Represents the metadata of the long-running operation.
2955#[derive(Clone, Default, PartialEq)]
2956#[non_exhaustive]
2957pub struct OperationMetadata {
2958 /// Output only. The time the operation was created.
2959 pub create_time: std::option::Option<wkt::Timestamp>,
2960
2961 /// Output only. The time the operation finished running.
2962 pub end_time: std::option::Option<wkt::Timestamp>,
2963
2964 /// Output only. Server-defined resource path for the target of the operation.
2965 pub target: std::string::String,
2966
2967 /// Output only. Name of the verb executed by the operation.
2968 pub verb: std::string::String,
2969
2970 /// Output only. Human-readable status of the operation, if any.
2971 pub status_message: std::string::String,
2972
2973 /// Output only. Identifies whether the user has requested cancellation
2974 /// of the operation. Operations that have been cancelled successfully
2975 /// have
2976 /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
2977 /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
2978 /// corresponding to `Code.CANCELLED`.
2979 ///
2980 /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
2981 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
2982 pub requested_cancellation: bool,
2983
2984 /// Output only. API version used to start the operation.
2985 pub api_version: std::string::String,
2986
2987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2988}
2989
2990impl OperationMetadata {
2991 /// Creates a new default instance.
2992 pub fn new() -> Self {
2993 std::default::Default::default()
2994 }
2995
2996 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
2997 ///
2998 /// # Example
2999 /// ```ignore,no_run
3000 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3001 /// use wkt::Timestamp;
3002 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
3003 /// ```
3004 pub fn set_create_time<T>(mut self, v: T) -> Self
3005 where
3006 T: std::convert::Into<wkt::Timestamp>,
3007 {
3008 self.create_time = std::option::Option::Some(v.into());
3009 self
3010 }
3011
3012 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
3013 ///
3014 /// # Example
3015 /// ```ignore,no_run
3016 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3017 /// use wkt::Timestamp;
3018 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3019 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
3020 /// ```
3021 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3022 where
3023 T: std::convert::Into<wkt::Timestamp>,
3024 {
3025 self.create_time = v.map(|x| x.into());
3026 self
3027 }
3028
3029 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
3030 ///
3031 /// # Example
3032 /// ```ignore,no_run
3033 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3034 /// use wkt::Timestamp;
3035 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
3036 /// ```
3037 pub fn set_end_time<T>(mut self, v: T) -> Self
3038 where
3039 T: std::convert::Into<wkt::Timestamp>,
3040 {
3041 self.end_time = std::option::Option::Some(v.into());
3042 self
3043 }
3044
3045 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
3046 ///
3047 /// # Example
3048 /// ```ignore,no_run
3049 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3050 /// use wkt::Timestamp;
3051 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3052 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
3053 /// ```
3054 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3055 where
3056 T: std::convert::Into<wkt::Timestamp>,
3057 {
3058 self.end_time = v.map(|x| x.into());
3059 self
3060 }
3061
3062 /// Sets the value of [target][crate::model::OperationMetadata::target].
3063 ///
3064 /// # Example
3065 /// ```ignore,no_run
3066 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3067 /// let x = OperationMetadata::new().set_target("example");
3068 /// ```
3069 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3070 self.target = v.into();
3071 self
3072 }
3073
3074 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3079 /// let x = OperationMetadata::new().set_verb("example");
3080 /// ```
3081 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082 self.verb = v.into();
3083 self
3084 }
3085
3086 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
3087 ///
3088 /// # Example
3089 /// ```ignore,no_run
3090 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3091 /// let x = OperationMetadata::new().set_status_message("example");
3092 /// ```
3093 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3094 self.status_message = v.into();
3095 self
3096 }
3097
3098 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3103 /// let x = OperationMetadata::new().set_requested_cancellation(true);
3104 /// ```
3105 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3106 self.requested_cancellation = v.into();
3107 self
3108 }
3109
3110 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_apphub_v1::model::OperationMetadata;
3115 /// let x = OperationMetadata::new().set_api_version("example");
3116 /// ```
3117 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118 self.api_version = v.into();
3119 self
3120 }
3121}
3122
3123impl wkt::message::Message for OperationMetadata {
3124 fn typename() -> &'static str {
3125 "type.googleapis.com/google.cloud.apphub.v1.OperationMetadata"
3126 }
3127}
3128
3129/// Application defines the governance boundary for App Hub entities that
3130/// perform a logical end-to-end business function.
3131/// App Hub supports application level IAM permission to align with governance
3132/// requirements.
3133#[derive(Clone, Default, PartialEq)]
3134#[non_exhaustive]
3135pub struct Application {
3136 /// Identifier. The resource name of an Application. Format:
3137 /// `"projects/{host-project-id}/locations/{location}/applications/{application-id}"`
3138 pub name: std::string::String,
3139
3140 /// Optional. User-defined name for the Application.
3141 /// Can have a maximum length of 63 characters.
3142 pub display_name: std::string::String,
3143
3144 /// Optional. User-defined description of an Application.
3145 /// Can have a maximum length of 2048 characters.
3146 pub description: std::string::String,
3147
3148 /// Optional. Consumer provided attributes.
3149 pub attributes: std::option::Option<crate::model::Attributes>,
3150
3151 /// Output only. Create time.
3152 pub create_time: std::option::Option<wkt::Timestamp>,
3153
3154 /// Output only. Update time.
3155 pub update_time: std::option::Option<wkt::Timestamp>,
3156
3157 /// Required. Immutable. Defines what data can be included into this
3158 /// Application. Limits which Services and Workloads can be registered.
3159 pub scope: std::option::Option<crate::model::Scope>,
3160
3161 /// Output only. A universally unique identifier (in UUID4 format) for the
3162 /// `Application`.
3163 pub uid: std::string::String,
3164
3165 /// Output only. Application state.
3166 pub state: crate::model::application::State,
3167
3168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3169}
3170
3171impl Application {
3172 /// Creates a new default instance.
3173 pub fn new() -> Self {
3174 std::default::Default::default()
3175 }
3176
3177 /// Sets the value of [name][crate::model::Application::name].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_apphub_v1::model::Application;
3182 /// # let project_id = "project_id";
3183 /// # let location_id = "location_id";
3184 /// # let application_id = "application_id";
3185 /// let x = Application::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}"));
3186 /// ```
3187 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3188 self.name = v.into();
3189 self
3190 }
3191
3192 /// Sets the value of [display_name][crate::model::Application::display_name].
3193 ///
3194 /// # Example
3195 /// ```ignore,no_run
3196 /// # use google_cloud_apphub_v1::model::Application;
3197 /// let x = Application::new().set_display_name("example");
3198 /// ```
3199 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3200 self.display_name = v.into();
3201 self
3202 }
3203
3204 /// Sets the value of [description][crate::model::Application::description].
3205 ///
3206 /// # Example
3207 /// ```ignore,no_run
3208 /// # use google_cloud_apphub_v1::model::Application;
3209 /// let x = Application::new().set_description("example");
3210 /// ```
3211 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3212 self.description = v.into();
3213 self
3214 }
3215
3216 /// Sets the value of [attributes][crate::model::Application::attributes].
3217 ///
3218 /// # Example
3219 /// ```ignore,no_run
3220 /// # use google_cloud_apphub_v1::model::Application;
3221 /// use google_cloud_apphub_v1::model::Attributes;
3222 /// let x = Application::new().set_attributes(Attributes::default()/* use setters */);
3223 /// ```
3224 pub fn set_attributes<T>(mut self, v: T) -> Self
3225 where
3226 T: std::convert::Into<crate::model::Attributes>,
3227 {
3228 self.attributes = std::option::Option::Some(v.into());
3229 self
3230 }
3231
3232 /// Sets or clears the value of [attributes][crate::model::Application::attributes].
3233 ///
3234 /// # Example
3235 /// ```ignore,no_run
3236 /// # use google_cloud_apphub_v1::model::Application;
3237 /// use google_cloud_apphub_v1::model::Attributes;
3238 /// let x = Application::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
3239 /// let x = Application::new().set_or_clear_attributes(None::<Attributes>);
3240 /// ```
3241 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
3242 where
3243 T: std::convert::Into<crate::model::Attributes>,
3244 {
3245 self.attributes = v.map(|x| x.into());
3246 self
3247 }
3248
3249 /// Sets the value of [create_time][crate::model::Application::create_time].
3250 ///
3251 /// # Example
3252 /// ```ignore,no_run
3253 /// # use google_cloud_apphub_v1::model::Application;
3254 /// use wkt::Timestamp;
3255 /// let x = Application::new().set_create_time(Timestamp::default()/* use setters */);
3256 /// ```
3257 pub fn set_create_time<T>(mut self, v: T) -> Self
3258 where
3259 T: std::convert::Into<wkt::Timestamp>,
3260 {
3261 self.create_time = std::option::Option::Some(v.into());
3262 self
3263 }
3264
3265 /// Sets or clears the value of [create_time][crate::model::Application::create_time].
3266 ///
3267 /// # Example
3268 /// ```ignore,no_run
3269 /// # use google_cloud_apphub_v1::model::Application;
3270 /// use wkt::Timestamp;
3271 /// let x = Application::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3272 /// let x = Application::new().set_or_clear_create_time(None::<Timestamp>);
3273 /// ```
3274 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3275 where
3276 T: std::convert::Into<wkt::Timestamp>,
3277 {
3278 self.create_time = v.map(|x| x.into());
3279 self
3280 }
3281
3282 /// Sets the value of [update_time][crate::model::Application::update_time].
3283 ///
3284 /// # Example
3285 /// ```ignore,no_run
3286 /// # use google_cloud_apphub_v1::model::Application;
3287 /// use wkt::Timestamp;
3288 /// let x = Application::new().set_update_time(Timestamp::default()/* use setters */);
3289 /// ```
3290 pub fn set_update_time<T>(mut self, v: T) -> Self
3291 where
3292 T: std::convert::Into<wkt::Timestamp>,
3293 {
3294 self.update_time = std::option::Option::Some(v.into());
3295 self
3296 }
3297
3298 /// Sets or clears the value of [update_time][crate::model::Application::update_time].
3299 ///
3300 /// # Example
3301 /// ```ignore,no_run
3302 /// # use google_cloud_apphub_v1::model::Application;
3303 /// use wkt::Timestamp;
3304 /// let x = Application::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3305 /// let x = Application::new().set_or_clear_update_time(None::<Timestamp>);
3306 /// ```
3307 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3308 where
3309 T: std::convert::Into<wkt::Timestamp>,
3310 {
3311 self.update_time = v.map(|x| x.into());
3312 self
3313 }
3314
3315 /// Sets the value of [scope][crate::model::Application::scope].
3316 ///
3317 /// # Example
3318 /// ```ignore,no_run
3319 /// # use google_cloud_apphub_v1::model::Application;
3320 /// use google_cloud_apphub_v1::model::Scope;
3321 /// let x = Application::new().set_scope(Scope::default()/* use setters */);
3322 /// ```
3323 pub fn set_scope<T>(mut self, v: T) -> Self
3324 where
3325 T: std::convert::Into<crate::model::Scope>,
3326 {
3327 self.scope = std::option::Option::Some(v.into());
3328 self
3329 }
3330
3331 /// Sets or clears the value of [scope][crate::model::Application::scope].
3332 ///
3333 /// # Example
3334 /// ```ignore,no_run
3335 /// # use google_cloud_apphub_v1::model::Application;
3336 /// use google_cloud_apphub_v1::model::Scope;
3337 /// let x = Application::new().set_or_clear_scope(Some(Scope::default()/* use setters */));
3338 /// let x = Application::new().set_or_clear_scope(None::<Scope>);
3339 /// ```
3340 pub fn set_or_clear_scope<T>(mut self, v: std::option::Option<T>) -> Self
3341 where
3342 T: std::convert::Into<crate::model::Scope>,
3343 {
3344 self.scope = v.map(|x| x.into());
3345 self
3346 }
3347
3348 /// Sets the value of [uid][crate::model::Application::uid].
3349 ///
3350 /// # Example
3351 /// ```ignore,no_run
3352 /// # use google_cloud_apphub_v1::model::Application;
3353 /// let x = Application::new().set_uid("example");
3354 /// ```
3355 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3356 self.uid = v.into();
3357 self
3358 }
3359
3360 /// Sets the value of [state][crate::model::Application::state].
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_apphub_v1::model::Application;
3365 /// use google_cloud_apphub_v1::model::application::State;
3366 /// let x0 = Application::new().set_state(State::Creating);
3367 /// let x1 = Application::new().set_state(State::Active);
3368 /// let x2 = Application::new().set_state(State::Deleting);
3369 /// ```
3370 pub fn set_state<T: std::convert::Into<crate::model::application::State>>(
3371 mut self,
3372 v: T,
3373 ) -> Self {
3374 self.state = v.into();
3375 self
3376 }
3377}
3378
3379impl wkt::message::Message for Application {
3380 fn typename() -> &'static str {
3381 "type.googleapis.com/google.cloud.apphub.v1.Application"
3382 }
3383}
3384
3385/// Defines additional types related to [Application].
3386pub mod application {
3387 #[allow(unused_imports)]
3388 use super::*;
3389
3390 /// Application state.
3391 ///
3392 /// # Working with unknown values
3393 ///
3394 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3395 /// additional enum variants at any time. Adding new variants is not considered
3396 /// a breaking change. Applications should write their code in anticipation of:
3397 ///
3398 /// - New values appearing in future releases of the client library, **and**
3399 /// - New values received dynamically, without application changes.
3400 ///
3401 /// Please consult the [Working with enums] section in the user guide for some
3402 /// guidelines.
3403 ///
3404 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3405 #[derive(Clone, Debug, PartialEq)]
3406 #[non_exhaustive]
3407 pub enum State {
3408 /// Unspecified state.
3409 Unspecified,
3410 /// The Application is being created.
3411 Creating,
3412 /// The Application is ready to register Services and Workloads.
3413 Active,
3414 /// The Application is being deleted.
3415 Deleting,
3416 /// If set, the enum was initialized with an unknown value.
3417 ///
3418 /// Applications can examine the value using [State::value] or
3419 /// [State::name].
3420 UnknownValue(state::UnknownValue),
3421 }
3422
3423 #[doc(hidden)]
3424 pub mod state {
3425 #[allow(unused_imports)]
3426 use super::*;
3427 #[derive(Clone, Debug, PartialEq)]
3428 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3429 }
3430
3431 impl State {
3432 /// Gets the enum value.
3433 ///
3434 /// Returns `None` if the enum contains an unknown value deserialized from
3435 /// the string representation of enums.
3436 pub fn value(&self) -> std::option::Option<i32> {
3437 match self {
3438 Self::Unspecified => std::option::Option::Some(0),
3439 Self::Creating => std::option::Option::Some(1),
3440 Self::Active => std::option::Option::Some(2),
3441 Self::Deleting => std::option::Option::Some(3),
3442 Self::UnknownValue(u) => u.0.value(),
3443 }
3444 }
3445
3446 /// Gets the enum value as a string.
3447 ///
3448 /// Returns `None` if the enum contains an unknown value deserialized from
3449 /// the integer representation of enums.
3450 pub fn name(&self) -> std::option::Option<&str> {
3451 match self {
3452 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3453 Self::Creating => std::option::Option::Some("CREATING"),
3454 Self::Active => std::option::Option::Some("ACTIVE"),
3455 Self::Deleting => std::option::Option::Some("DELETING"),
3456 Self::UnknownValue(u) => u.0.name(),
3457 }
3458 }
3459 }
3460
3461 impl std::default::Default for State {
3462 fn default() -> Self {
3463 use std::convert::From;
3464 Self::from(0)
3465 }
3466 }
3467
3468 impl std::fmt::Display for State {
3469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3470 wkt::internal::display_enum(f, self.name(), self.value())
3471 }
3472 }
3473
3474 impl std::convert::From<i32> for State {
3475 fn from(value: i32) -> Self {
3476 match value {
3477 0 => Self::Unspecified,
3478 1 => Self::Creating,
3479 2 => Self::Active,
3480 3 => Self::Deleting,
3481 _ => Self::UnknownValue(state::UnknownValue(
3482 wkt::internal::UnknownEnumValue::Integer(value),
3483 )),
3484 }
3485 }
3486 }
3487
3488 impl std::convert::From<&str> for State {
3489 fn from(value: &str) -> Self {
3490 use std::string::ToString;
3491 match value {
3492 "STATE_UNSPECIFIED" => Self::Unspecified,
3493 "CREATING" => Self::Creating,
3494 "ACTIVE" => Self::Active,
3495 "DELETING" => Self::Deleting,
3496 _ => Self::UnknownValue(state::UnknownValue(
3497 wkt::internal::UnknownEnumValue::String(value.to_string()),
3498 )),
3499 }
3500 }
3501 }
3502
3503 impl serde::ser::Serialize for State {
3504 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3505 where
3506 S: serde::Serializer,
3507 {
3508 match self {
3509 Self::Unspecified => serializer.serialize_i32(0),
3510 Self::Creating => serializer.serialize_i32(1),
3511 Self::Active => serializer.serialize_i32(2),
3512 Self::Deleting => serializer.serialize_i32(3),
3513 Self::UnknownValue(u) => u.0.serialize(serializer),
3514 }
3515 }
3516 }
3517
3518 impl<'de> serde::de::Deserialize<'de> for State {
3519 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3520 where
3521 D: serde::Deserializer<'de>,
3522 {
3523 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3524 ".google.cloud.apphub.v1.Application.State",
3525 ))
3526 }
3527 }
3528}
3529
3530/// Scope of an application.
3531#[derive(Clone, Default, PartialEq)]
3532#[non_exhaustive]
3533pub struct Scope {
3534 /// Required. Scope Type.
3535 pub r#type: crate::model::scope::Type,
3536
3537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3538}
3539
3540impl Scope {
3541 /// Creates a new default instance.
3542 pub fn new() -> Self {
3543 std::default::Default::default()
3544 }
3545
3546 /// Sets the value of [r#type][crate::model::Scope::type].
3547 ///
3548 /// # Example
3549 /// ```ignore,no_run
3550 /// # use google_cloud_apphub_v1::model::Scope;
3551 /// use google_cloud_apphub_v1::model::scope::Type;
3552 /// let x0 = Scope::new().set_type(Type::Regional);
3553 /// let x1 = Scope::new().set_type(Type::Global);
3554 /// ```
3555 pub fn set_type<T: std::convert::Into<crate::model::scope::Type>>(mut self, v: T) -> Self {
3556 self.r#type = v.into();
3557 self
3558 }
3559}
3560
3561impl wkt::message::Message for Scope {
3562 fn typename() -> &'static str {
3563 "type.googleapis.com/google.cloud.apphub.v1.Scope"
3564 }
3565}
3566
3567/// Defines additional types related to [Scope].
3568pub mod scope {
3569 #[allow(unused_imports)]
3570 use super::*;
3571
3572 /// Scope Type.
3573 ///
3574 /// # Working with unknown values
3575 ///
3576 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3577 /// additional enum variants at any time. Adding new variants is not considered
3578 /// a breaking change. Applications should write their code in anticipation of:
3579 ///
3580 /// - New values appearing in future releases of the client library, **and**
3581 /// - New values received dynamically, without application changes.
3582 ///
3583 /// Please consult the [Working with enums] section in the user guide for some
3584 /// guidelines.
3585 ///
3586 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3587 #[derive(Clone, Debug, PartialEq)]
3588 #[non_exhaustive]
3589 pub enum Type {
3590 /// Unspecified type.
3591 Unspecified,
3592 /// Regional type.
3593 Regional,
3594 /// Global type.
3595 Global,
3596 /// If set, the enum was initialized with an unknown value.
3597 ///
3598 /// Applications can examine the value using [Type::value] or
3599 /// [Type::name].
3600 UnknownValue(r#type::UnknownValue),
3601 }
3602
3603 #[doc(hidden)]
3604 pub mod r#type {
3605 #[allow(unused_imports)]
3606 use super::*;
3607 #[derive(Clone, Debug, PartialEq)]
3608 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3609 }
3610
3611 impl Type {
3612 /// Gets the enum value.
3613 ///
3614 /// Returns `None` if the enum contains an unknown value deserialized from
3615 /// the string representation of enums.
3616 pub fn value(&self) -> std::option::Option<i32> {
3617 match self {
3618 Self::Unspecified => std::option::Option::Some(0),
3619 Self::Regional => std::option::Option::Some(1),
3620 Self::Global => std::option::Option::Some(2),
3621 Self::UnknownValue(u) => u.0.value(),
3622 }
3623 }
3624
3625 /// Gets the enum value as a string.
3626 ///
3627 /// Returns `None` if the enum contains an unknown value deserialized from
3628 /// the integer representation of enums.
3629 pub fn name(&self) -> std::option::Option<&str> {
3630 match self {
3631 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3632 Self::Regional => std::option::Option::Some("REGIONAL"),
3633 Self::Global => std::option::Option::Some("GLOBAL"),
3634 Self::UnknownValue(u) => u.0.name(),
3635 }
3636 }
3637 }
3638
3639 impl std::default::Default for Type {
3640 fn default() -> Self {
3641 use std::convert::From;
3642 Self::from(0)
3643 }
3644 }
3645
3646 impl std::fmt::Display for Type {
3647 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3648 wkt::internal::display_enum(f, self.name(), self.value())
3649 }
3650 }
3651
3652 impl std::convert::From<i32> for Type {
3653 fn from(value: i32) -> Self {
3654 match value {
3655 0 => Self::Unspecified,
3656 1 => Self::Regional,
3657 2 => Self::Global,
3658 _ => Self::UnknownValue(r#type::UnknownValue(
3659 wkt::internal::UnknownEnumValue::Integer(value),
3660 )),
3661 }
3662 }
3663 }
3664
3665 impl std::convert::From<&str> for Type {
3666 fn from(value: &str) -> Self {
3667 use std::string::ToString;
3668 match value {
3669 "TYPE_UNSPECIFIED" => Self::Unspecified,
3670 "REGIONAL" => Self::Regional,
3671 "GLOBAL" => Self::Global,
3672 _ => Self::UnknownValue(r#type::UnknownValue(
3673 wkt::internal::UnknownEnumValue::String(value.to_string()),
3674 )),
3675 }
3676 }
3677 }
3678
3679 impl serde::ser::Serialize for Type {
3680 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3681 where
3682 S: serde::Serializer,
3683 {
3684 match self {
3685 Self::Unspecified => serializer.serialize_i32(0),
3686 Self::Regional => serializer.serialize_i32(1),
3687 Self::Global => serializer.serialize_i32(2),
3688 Self::UnknownValue(u) => u.0.serialize(serializer),
3689 }
3690 }
3691 }
3692
3693 impl<'de> serde::de::Deserialize<'de> for Type {
3694 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3695 where
3696 D: serde::Deserializer<'de>,
3697 {
3698 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3699 ".google.cloud.apphub.v1.Scope.Type",
3700 ))
3701 }
3702 }
3703}
3704
3705/// Consumer provided attributes.
3706#[derive(Clone, Default, PartialEq)]
3707#[non_exhaustive]
3708pub struct Attributes {
3709 /// Optional. User-defined criticality information.
3710 pub criticality: std::option::Option<crate::model::Criticality>,
3711
3712 /// Optional. User-defined environment information.
3713 pub environment: std::option::Option<crate::model::Environment>,
3714
3715 /// Optional. Developer team that owns development and coding.
3716 pub developer_owners: std::vec::Vec<crate::model::ContactInfo>,
3717
3718 /// Optional. Operator team that ensures runtime and operations.
3719 pub operator_owners: std::vec::Vec<crate::model::ContactInfo>,
3720
3721 /// Optional. Business team that ensures user needs are met and value is
3722 /// delivered
3723 pub business_owners: std::vec::Vec<crate::model::ContactInfo>,
3724
3725 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3726}
3727
3728impl Attributes {
3729 /// Creates a new default instance.
3730 pub fn new() -> Self {
3731 std::default::Default::default()
3732 }
3733
3734 /// Sets the value of [criticality][crate::model::Attributes::criticality].
3735 ///
3736 /// # Example
3737 /// ```ignore,no_run
3738 /// # use google_cloud_apphub_v1::model::Attributes;
3739 /// use google_cloud_apphub_v1::model::Criticality;
3740 /// let x = Attributes::new().set_criticality(Criticality::default()/* use setters */);
3741 /// ```
3742 pub fn set_criticality<T>(mut self, v: T) -> Self
3743 where
3744 T: std::convert::Into<crate::model::Criticality>,
3745 {
3746 self.criticality = std::option::Option::Some(v.into());
3747 self
3748 }
3749
3750 /// Sets or clears the value of [criticality][crate::model::Attributes::criticality].
3751 ///
3752 /// # Example
3753 /// ```ignore,no_run
3754 /// # use google_cloud_apphub_v1::model::Attributes;
3755 /// use google_cloud_apphub_v1::model::Criticality;
3756 /// let x = Attributes::new().set_or_clear_criticality(Some(Criticality::default()/* use setters */));
3757 /// let x = Attributes::new().set_or_clear_criticality(None::<Criticality>);
3758 /// ```
3759 pub fn set_or_clear_criticality<T>(mut self, v: std::option::Option<T>) -> Self
3760 where
3761 T: std::convert::Into<crate::model::Criticality>,
3762 {
3763 self.criticality = v.map(|x| x.into());
3764 self
3765 }
3766
3767 /// Sets the value of [environment][crate::model::Attributes::environment].
3768 ///
3769 /// # Example
3770 /// ```ignore,no_run
3771 /// # use google_cloud_apphub_v1::model::Attributes;
3772 /// use google_cloud_apphub_v1::model::Environment;
3773 /// let x = Attributes::new().set_environment(Environment::default()/* use setters */);
3774 /// ```
3775 pub fn set_environment<T>(mut self, v: T) -> Self
3776 where
3777 T: std::convert::Into<crate::model::Environment>,
3778 {
3779 self.environment = std::option::Option::Some(v.into());
3780 self
3781 }
3782
3783 /// Sets or clears the value of [environment][crate::model::Attributes::environment].
3784 ///
3785 /// # Example
3786 /// ```ignore,no_run
3787 /// # use google_cloud_apphub_v1::model::Attributes;
3788 /// use google_cloud_apphub_v1::model::Environment;
3789 /// let x = Attributes::new().set_or_clear_environment(Some(Environment::default()/* use setters */));
3790 /// let x = Attributes::new().set_or_clear_environment(None::<Environment>);
3791 /// ```
3792 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
3793 where
3794 T: std::convert::Into<crate::model::Environment>,
3795 {
3796 self.environment = v.map(|x| x.into());
3797 self
3798 }
3799
3800 /// Sets the value of [developer_owners][crate::model::Attributes::developer_owners].
3801 ///
3802 /// # Example
3803 /// ```ignore,no_run
3804 /// # use google_cloud_apphub_v1::model::Attributes;
3805 /// use google_cloud_apphub_v1::model::ContactInfo;
3806 /// let x = Attributes::new()
3807 /// .set_developer_owners([
3808 /// ContactInfo::default()/* use setters */,
3809 /// ContactInfo::default()/* use (different) setters */,
3810 /// ]);
3811 /// ```
3812 pub fn set_developer_owners<T, V>(mut self, v: T) -> Self
3813 where
3814 T: std::iter::IntoIterator<Item = V>,
3815 V: std::convert::Into<crate::model::ContactInfo>,
3816 {
3817 use std::iter::Iterator;
3818 self.developer_owners = v.into_iter().map(|i| i.into()).collect();
3819 self
3820 }
3821
3822 /// Sets the value of [operator_owners][crate::model::Attributes::operator_owners].
3823 ///
3824 /// # Example
3825 /// ```ignore,no_run
3826 /// # use google_cloud_apphub_v1::model::Attributes;
3827 /// use google_cloud_apphub_v1::model::ContactInfo;
3828 /// let x = Attributes::new()
3829 /// .set_operator_owners([
3830 /// ContactInfo::default()/* use setters */,
3831 /// ContactInfo::default()/* use (different) setters */,
3832 /// ]);
3833 /// ```
3834 pub fn set_operator_owners<T, V>(mut self, v: T) -> Self
3835 where
3836 T: std::iter::IntoIterator<Item = V>,
3837 V: std::convert::Into<crate::model::ContactInfo>,
3838 {
3839 use std::iter::Iterator;
3840 self.operator_owners = v.into_iter().map(|i| i.into()).collect();
3841 self
3842 }
3843
3844 /// Sets the value of [business_owners][crate::model::Attributes::business_owners].
3845 ///
3846 /// # Example
3847 /// ```ignore,no_run
3848 /// # use google_cloud_apphub_v1::model::Attributes;
3849 /// use google_cloud_apphub_v1::model::ContactInfo;
3850 /// let x = Attributes::new()
3851 /// .set_business_owners([
3852 /// ContactInfo::default()/* use setters */,
3853 /// ContactInfo::default()/* use (different) setters */,
3854 /// ]);
3855 /// ```
3856 pub fn set_business_owners<T, V>(mut self, v: T) -> Self
3857 where
3858 T: std::iter::IntoIterator<Item = V>,
3859 V: std::convert::Into<crate::model::ContactInfo>,
3860 {
3861 use std::iter::Iterator;
3862 self.business_owners = v.into_iter().map(|i| i.into()).collect();
3863 self
3864 }
3865}
3866
3867impl wkt::message::Message for Attributes {
3868 fn typename() -> &'static str {
3869 "type.googleapis.com/google.cloud.apphub.v1.Attributes"
3870 }
3871}
3872
3873/// Criticality of the Application, Service, or Workload
3874#[derive(Clone, Default, PartialEq)]
3875#[non_exhaustive]
3876pub struct Criticality {
3877 /// Required. Criticality Type.
3878 pub r#type: crate::model::criticality::Type,
3879
3880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3881}
3882
3883impl Criticality {
3884 /// Creates a new default instance.
3885 pub fn new() -> Self {
3886 std::default::Default::default()
3887 }
3888
3889 /// Sets the value of [r#type][crate::model::Criticality::type].
3890 ///
3891 /// # Example
3892 /// ```ignore,no_run
3893 /// # use google_cloud_apphub_v1::model::Criticality;
3894 /// use google_cloud_apphub_v1::model::criticality::Type;
3895 /// let x0 = Criticality::new().set_type(Type::MissionCritical);
3896 /// let x1 = Criticality::new().set_type(Type::High);
3897 /// let x2 = Criticality::new().set_type(Type::Medium);
3898 /// ```
3899 pub fn set_type<T: std::convert::Into<crate::model::criticality::Type>>(
3900 mut self,
3901 v: T,
3902 ) -> Self {
3903 self.r#type = v.into();
3904 self
3905 }
3906}
3907
3908impl wkt::message::Message for Criticality {
3909 fn typename() -> &'static str {
3910 "type.googleapis.com/google.cloud.apphub.v1.Criticality"
3911 }
3912}
3913
3914/// Defines additional types related to [Criticality].
3915pub mod criticality {
3916 #[allow(unused_imports)]
3917 use super::*;
3918
3919 /// Criticality Type.
3920 ///
3921 /// # Working with unknown values
3922 ///
3923 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3924 /// additional enum variants at any time. Adding new variants is not considered
3925 /// a breaking change. Applications should write their code in anticipation of:
3926 ///
3927 /// - New values appearing in future releases of the client library, **and**
3928 /// - New values received dynamically, without application changes.
3929 ///
3930 /// Please consult the [Working with enums] section in the user guide for some
3931 /// guidelines.
3932 ///
3933 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3934 #[derive(Clone, Debug, PartialEq)]
3935 #[non_exhaustive]
3936 pub enum Type {
3937 /// Unspecified type.
3938 Unspecified,
3939 /// Mission critical service, application or workload.
3940 MissionCritical,
3941 /// High impact.
3942 High,
3943 /// Medium impact.
3944 Medium,
3945 /// Low impact.
3946 Low,
3947 /// If set, the enum was initialized with an unknown value.
3948 ///
3949 /// Applications can examine the value using [Type::value] or
3950 /// [Type::name].
3951 UnknownValue(r#type::UnknownValue),
3952 }
3953
3954 #[doc(hidden)]
3955 pub mod r#type {
3956 #[allow(unused_imports)]
3957 use super::*;
3958 #[derive(Clone, Debug, PartialEq)]
3959 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3960 }
3961
3962 impl Type {
3963 /// Gets the enum value.
3964 ///
3965 /// Returns `None` if the enum contains an unknown value deserialized from
3966 /// the string representation of enums.
3967 pub fn value(&self) -> std::option::Option<i32> {
3968 match self {
3969 Self::Unspecified => std::option::Option::Some(0),
3970 Self::MissionCritical => std::option::Option::Some(1),
3971 Self::High => std::option::Option::Some(2),
3972 Self::Medium => std::option::Option::Some(3),
3973 Self::Low => std::option::Option::Some(4),
3974 Self::UnknownValue(u) => u.0.value(),
3975 }
3976 }
3977
3978 /// Gets the enum value as a string.
3979 ///
3980 /// Returns `None` if the enum contains an unknown value deserialized from
3981 /// the integer representation of enums.
3982 pub fn name(&self) -> std::option::Option<&str> {
3983 match self {
3984 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3985 Self::MissionCritical => std::option::Option::Some("MISSION_CRITICAL"),
3986 Self::High => std::option::Option::Some("HIGH"),
3987 Self::Medium => std::option::Option::Some("MEDIUM"),
3988 Self::Low => std::option::Option::Some("LOW"),
3989 Self::UnknownValue(u) => u.0.name(),
3990 }
3991 }
3992 }
3993
3994 impl std::default::Default for Type {
3995 fn default() -> Self {
3996 use std::convert::From;
3997 Self::from(0)
3998 }
3999 }
4000
4001 impl std::fmt::Display for Type {
4002 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4003 wkt::internal::display_enum(f, self.name(), self.value())
4004 }
4005 }
4006
4007 impl std::convert::From<i32> for Type {
4008 fn from(value: i32) -> Self {
4009 match value {
4010 0 => Self::Unspecified,
4011 1 => Self::MissionCritical,
4012 2 => Self::High,
4013 3 => Self::Medium,
4014 4 => Self::Low,
4015 _ => Self::UnknownValue(r#type::UnknownValue(
4016 wkt::internal::UnknownEnumValue::Integer(value),
4017 )),
4018 }
4019 }
4020 }
4021
4022 impl std::convert::From<&str> for Type {
4023 fn from(value: &str) -> Self {
4024 use std::string::ToString;
4025 match value {
4026 "TYPE_UNSPECIFIED" => Self::Unspecified,
4027 "MISSION_CRITICAL" => Self::MissionCritical,
4028 "HIGH" => Self::High,
4029 "MEDIUM" => Self::Medium,
4030 "LOW" => Self::Low,
4031 _ => Self::UnknownValue(r#type::UnknownValue(
4032 wkt::internal::UnknownEnumValue::String(value.to_string()),
4033 )),
4034 }
4035 }
4036 }
4037
4038 impl serde::ser::Serialize for Type {
4039 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4040 where
4041 S: serde::Serializer,
4042 {
4043 match self {
4044 Self::Unspecified => serializer.serialize_i32(0),
4045 Self::MissionCritical => serializer.serialize_i32(1),
4046 Self::High => serializer.serialize_i32(2),
4047 Self::Medium => serializer.serialize_i32(3),
4048 Self::Low => serializer.serialize_i32(4),
4049 Self::UnknownValue(u) => u.0.serialize(serializer),
4050 }
4051 }
4052 }
4053
4054 impl<'de> serde::de::Deserialize<'de> for Type {
4055 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4056 where
4057 D: serde::Deserializer<'de>,
4058 {
4059 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
4060 ".google.cloud.apphub.v1.Criticality.Type",
4061 ))
4062 }
4063 }
4064}
4065
4066/// Environment of the Application, Service, or Workload
4067#[derive(Clone, Default, PartialEq)]
4068#[non_exhaustive]
4069pub struct Environment {
4070 /// Required. Environment Type.
4071 pub r#type: crate::model::environment::Type,
4072
4073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4074}
4075
4076impl Environment {
4077 /// Creates a new default instance.
4078 pub fn new() -> Self {
4079 std::default::Default::default()
4080 }
4081
4082 /// Sets the value of [r#type][crate::model::Environment::type].
4083 ///
4084 /// # Example
4085 /// ```ignore,no_run
4086 /// # use google_cloud_apphub_v1::model::Environment;
4087 /// use google_cloud_apphub_v1::model::environment::Type;
4088 /// let x0 = Environment::new().set_type(Type::Production);
4089 /// let x1 = Environment::new().set_type(Type::Staging);
4090 /// let x2 = Environment::new().set_type(Type::Test);
4091 /// ```
4092 pub fn set_type<T: std::convert::Into<crate::model::environment::Type>>(
4093 mut self,
4094 v: T,
4095 ) -> Self {
4096 self.r#type = v.into();
4097 self
4098 }
4099}
4100
4101impl wkt::message::Message for Environment {
4102 fn typename() -> &'static str {
4103 "type.googleapis.com/google.cloud.apphub.v1.Environment"
4104 }
4105}
4106
4107/// Defines additional types related to [Environment].
4108pub mod environment {
4109 #[allow(unused_imports)]
4110 use super::*;
4111
4112 /// Environment Type.
4113 ///
4114 /// # Working with unknown values
4115 ///
4116 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4117 /// additional enum variants at any time. Adding new variants is not considered
4118 /// a breaking change. Applications should write their code in anticipation of:
4119 ///
4120 /// - New values appearing in future releases of the client library, **and**
4121 /// - New values received dynamically, without application changes.
4122 ///
4123 /// Please consult the [Working with enums] section in the user guide for some
4124 /// guidelines.
4125 ///
4126 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4127 #[derive(Clone, Debug, PartialEq)]
4128 #[non_exhaustive]
4129 pub enum Type {
4130 /// Unspecified type.
4131 Unspecified,
4132 /// Production environment.
4133 Production,
4134 /// Staging environment.
4135 Staging,
4136 /// Test environment.
4137 Test,
4138 /// Development environment.
4139 Development,
4140 /// If set, the enum was initialized with an unknown value.
4141 ///
4142 /// Applications can examine the value using [Type::value] or
4143 /// [Type::name].
4144 UnknownValue(r#type::UnknownValue),
4145 }
4146
4147 #[doc(hidden)]
4148 pub mod r#type {
4149 #[allow(unused_imports)]
4150 use super::*;
4151 #[derive(Clone, Debug, PartialEq)]
4152 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4153 }
4154
4155 impl Type {
4156 /// Gets the enum value.
4157 ///
4158 /// Returns `None` if the enum contains an unknown value deserialized from
4159 /// the string representation of enums.
4160 pub fn value(&self) -> std::option::Option<i32> {
4161 match self {
4162 Self::Unspecified => std::option::Option::Some(0),
4163 Self::Production => std::option::Option::Some(1),
4164 Self::Staging => std::option::Option::Some(2),
4165 Self::Test => std::option::Option::Some(3),
4166 Self::Development => std::option::Option::Some(4),
4167 Self::UnknownValue(u) => u.0.value(),
4168 }
4169 }
4170
4171 /// Gets the enum value as a string.
4172 ///
4173 /// Returns `None` if the enum contains an unknown value deserialized from
4174 /// the integer representation of enums.
4175 pub fn name(&self) -> std::option::Option<&str> {
4176 match self {
4177 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
4178 Self::Production => std::option::Option::Some("PRODUCTION"),
4179 Self::Staging => std::option::Option::Some("STAGING"),
4180 Self::Test => std::option::Option::Some("TEST"),
4181 Self::Development => std::option::Option::Some("DEVELOPMENT"),
4182 Self::UnknownValue(u) => u.0.name(),
4183 }
4184 }
4185 }
4186
4187 impl std::default::Default for Type {
4188 fn default() -> Self {
4189 use std::convert::From;
4190 Self::from(0)
4191 }
4192 }
4193
4194 impl std::fmt::Display for Type {
4195 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4196 wkt::internal::display_enum(f, self.name(), self.value())
4197 }
4198 }
4199
4200 impl std::convert::From<i32> for Type {
4201 fn from(value: i32) -> Self {
4202 match value {
4203 0 => Self::Unspecified,
4204 1 => Self::Production,
4205 2 => Self::Staging,
4206 3 => Self::Test,
4207 4 => Self::Development,
4208 _ => Self::UnknownValue(r#type::UnknownValue(
4209 wkt::internal::UnknownEnumValue::Integer(value),
4210 )),
4211 }
4212 }
4213 }
4214
4215 impl std::convert::From<&str> for Type {
4216 fn from(value: &str) -> Self {
4217 use std::string::ToString;
4218 match value {
4219 "TYPE_UNSPECIFIED" => Self::Unspecified,
4220 "PRODUCTION" => Self::Production,
4221 "STAGING" => Self::Staging,
4222 "TEST" => Self::Test,
4223 "DEVELOPMENT" => Self::Development,
4224 _ => Self::UnknownValue(r#type::UnknownValue(
4225 wkt::internal::UnknownEnumValue::String(value.to_string()),
4226 )),
4227 }
4228 }
4229 }
4230
4231 impl serde::ser::Serialize for Type {
4232 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4233 where
4234 S: serde::Serializer,
4235 {
4236 match self {
4237 Self::Unspecified => serializer.serialize_i32(0),
4238 Self::Production => serializer.serialize_i32(1),
4239 Self::Staging => serializer.serialize_i32(2),
4240 Self::Test => serializer.serialize_i32(3),
4241 Self::Development => serializer.serialize_i32(4),
4242 Self::UnknownValue(u) => u.0.serialize(serializer),
4243 }
4244 }
4245 }
4246
4247 impl<'de> serde::de::Deserialize<'de> for Type {
4248 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4249 where
4250 D: serde::Deserializer<'de>,
4251 {
4252 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
4253 ".google.cloud.apphub.v1.Environment.Type",
4254 ))
4255 }
4256 }
4257}
4258
4259/// Contact information of stakeholders.
4260#[derive(Clone, Default, PartialEq)]
4261#[non_exhaustive]
4262pub struct ContactInfo {
4263 /// Optional. Contact's name.
4264 /// Can have a maximum length of 63 characters.
4265 pub display_name: std::string::String,
4266
4267 /// Required. Email address of the contacts.
4268 pub email: std::string::String,
4269
4270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4271}
4272
4273impl ContactInfo {
4274 /// Creates a new default instance.
4275 pub fn new() -> Self {
4276 std::default::Default::default()
4277 }
4278
4279 /// Sets the value of [display_name][crate::model::ContactInfo::display_name].
4280 ///
4281 /// # Example
4282 /// ```ignore,no_run
4283 /// # use google_cloud_apphub_v1::model::ContactInfo;
4284 /// let x = ContactInfo::new().set_display_name("example");
4285 /// ```
4286 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4287 self.display_name = v.into();
4288 self
4289 }
4290
4291 /// Sets the value of [email][crate::model::ContactInfo::email].
4292 ///
4293 /// # Example
4294 /// ```ignore,no_run
4295 /// # use google_cloud_apphub_v1::model::ContactInfo;
4296 /// let x = ContactInfo::new().set_email("example");
4297 /// ```
4298 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4299 self.email = v.into();
4300 self
4301 }
4302}
4303
4304impl wkt::message::Message for ContactInfo {
4305 fn typename() -> &'static str {
4306 "type.googleapis.com/google.cloud.apphub.v1.ContactInfo"
4307 }
4308}
4309
4310/// Service is an App Hub data model that contains a discovered service, which
4311/// represents a network or API interface that exposes some functionality to
4312/// clients for consumption over the network.
4313#[derive(Clone, Default, PartialEq)]
4314#[non_exhaustive]
4315pub struct Service {
4316 /// Identifier. The resource name of a Service. Format:
4317 /// `"projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"`
4318 pub name: std::string::String,
4319
4320 /// Optional. User-defined name for the Service.
4321 /// Can have a maximum length of 63 characters.
4322 pub display_name: std::string::String,
4323
4324 /// Optional. User-defined description of a Service.
4325 /// Can have a maximum length of 2048 characters.
4326 pub description: std::string::String,
4327
4328 /// Output only. Reference to an underlying networking resource that can
4329 /// comprise a Service. These are immutable.
4330 pub service_reference: std::option::Option<crate::model::ServiceReference>,
4331
4332 /// Output only. Properties of an underlying compute resource that can comprise
4333 /// a Service. These are immutable.
4334 pub service_properties: std::option::Option<crate::model::ServiceProperties>,
4335
4336 /// Optional. Consumer provided attributes.
4337 pub attributes: std::option::Option<crate::model::Attributes>,
4338
4339 /// Required. Immutable. The resource name of the original discovered service.
4340 pub discovered_service: std::string::String,
4341
4342 /// Output only. Create time.
4343 pub create_time: std::option::Option<wkt::Timestamp>,
4344
4345 /// Output only. Update time.
4346 pub update_time: std::option::Option<wkt::Timestamp>,
4347
4348 /// Output only. A universally unique identifier (UUID) for the `Service` in
4349 /// the UUID4 format.
4350 pub uid: std::string::String,
4351
4352 /// Output only. Service state.
4353 pub state: crate::model::service::State,
4354
4355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4356}
4357
4358impl Service {
4359 /// Creates a new default instance.
4360 pub fn new() -> Self {
4361 std::default::Default::default()
4362 }
4363
4364 /// Sets the value of [name][crate::model::Service::name].
4365 ///
4366 /// # Example
4367 /// ```ignore,no_run
4368 /// # use google_cloud_apphub_v1::model::Service;
4369 /// # let project_id = "project_id";
4370 /// # let location_id = "location_id";
4371 /// # let application_id = "application_id";
4372 /// # let service_id = "service_id";
4373 /// let x = Service::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/services/{service_id}"));
4374 /// ```
4375 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4376 self.name = v.into();
4377 self
4378 }
4379
4380 /// Sets the value of [display_name][crate::model::Service::display_name].
4381 ///
4382 /// # Example
4383 /// ```ignore,no_run
4384 /// # use google_cloud_apphub_v1::model::Service;
4385 /// let x = Service::new().set_display_name("example");
4386 /// ```
4387 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4388 self.display_name = v.into();
4389 self
4390 }
4391
4392 /// Sets the value of [description][crate::model::Service::description].
4393 ///
4394 /// # Example
4395 /// ```ignore,no_run
4396 /// # use google_cloud_apphub_v1::model::Service;
4397 /// let x = Service::new().set_description("example");
4398 /// ```
4399 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4400 self.description = v.into();
4401 self
4402 }
4403
4404 /// Sets the value of [service_reference][crate::model::Service::service_reference].
4405 ///
4406 /// # Example
4407 /// ```ignore,no_run
4408 /// # use google_cloud_apphub_v1::model::Service;
4409 /// use google_cloud_apphub_v1::model::ServiceReference;
4410 /// let x = Service::new().set_service_reference(ServiceReference::default()/* use setters */);
4411 /// ```
4412 pub fn set_service_reference<T>(mut self, v: T) -> Self
4413 where
4414 T: std::convert::Into<crate::model::ServiceReference>,
4415 {
4416 self.service_reference = std::option::Option::Some(v.into());
4417 self
4418 }
4419
4420 /// Sets or clears the value of [service_reference][crate::model::Service::service_reference].
4421 ///
4422 /// # Example
4423 /// ```ignore,no_run
4424 /// # use google_cloud_apphub_v1::model::Service;
4425 /// use google_cloud_apphub_v1::model::ServiceReference;
4426 /// let x = Service::new().set_or_clear_service_reference(Some(ServiceReference::default()/* use setters */));
4427 /// let x = Service::new().set_or_clear_service_reference(None::<ServiceReference>);
4428 /// ```
4429 pub fn set_or_clear_service_reference<T>(mut self, v: std::option::Option<T>) -> Self
4430 where
4431 T: std::convert::Into<crate::model::ServiceReference>,
4432 {
4433 self.service_reference = v.map(|x| x.into());
4434 self
4435 }
4436
4437 /// Sets the value of [service_properties][crate::model::Service::service_properties].
4438 ///
4439 /// # Example
4440 /// ```ignore,no_run
4441 /// # use google_cloud_apphub_v1::model::Service;
4442 /// use google_cloud_apphub_v1::model::ServiceProperties;
4443 /// let x = Service::new().set_service_properties(ServiceProperties::default()/* use setters */);
4444 /// ```
4445 pub fn set_service_properties<T>(mut self, v: T) -> Self
4446 where
4447 T: std::convert::Into<crate::model::ServiceProperties>,
4448 {
4449 self.service_properties = std::option::Option::Some(v.into());
4450 self
4451 }
4452
4453 /// Sets or clears the value of [service_properties][crate::model::Service::service_properties].
4454 ///
4455 /// # Example
4456 /// ```ignore,no_run
4457 /// # use google_cloud_apphub_v1::model::Service;
4458 /// use google_cloud_apphub_v1::model::ServiceProperties;
4459 /// let x = Service::new().set_or_clear_service_properties(Some(ServiceProperties::default()/* use setters */));
4460 /// let x = Service::new().set_or_clear_service_properties(None::<ServiceProperties>);
4461 /// ```
4462 pub fn set_or_clear_service_properties<T>(mut self, v: std::option::Option<T>) -> Self
4463 where
4464 T: std::convert::Into<crate::model::ServiceProperties>,
4465 {
4466 self.service_properties = v.map(|x| x.into());
4467 self
4468 }
4469
4470 /// Sets the value of [attributes][crate::model::Service::attributes].
4471 ///
4472 /// # Example
4473 /// ```ignore,no_run
4474 /// # use google_cloud_apphub_v1::model::Service;
4475 /// use google_cloud_apphub_v1::model::Attributes;
4476 /// let x = Service::new().set_attributes(Attributes::default()/* use setters */);
4477 /// ```
4478 pub fn set_attributes<T>(mut self, v: T) -> Self
4479 where
4480 T: std::convert::Into<crate::model::Attributes>,
4481 {
4482 self.attributes = std::option::Option::Some(v.into());
4483 self
4484 }
4485
4486 /// Sets or clears the value of [attributes][crate::model::Service::attributes].
4487 ///
4488 /// # Example
4489 /// ```ignore,no_run
4490 /// # use google_cloud_apphub_v1::model::Service;
4491 /// use google_cloud_apphub_v1::model::Attributes;
4492 /// let x = Service::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
4493 /// let x = Service::new().set_or_clear_attributes(None::<Attributes>);
4494 /// ```
4495 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
4496 where
4497 T: std::convert::Into<crate::model::Attributes>,
4498 {
4499 self.attributes = v.map(|x| x.into());
4500 self
4501 }
4502
4503 /// Sets the value of [discovered_service][crate::model::Service::discovered_service].
4504 ///
4505 /// # Example
4506 /// ```ignore,no_run
4507 /// # use google_cloud_apphub_v1::model::Service;
4508 /// # let project_id = "project_id";
4509 /// # let location_id = "location_id";
4510 /// let x = Service::new().set_discovered_service(format!("projects/{project_id}/locations/{location_id}"));
4511 /// ```
4512 pub fn set_discovered_service<T: std::convert::Into<std::string::String>>(
4513 mut self,
4514 v: T,
4515 ) -> Self {
4516 self.discovered_service = v.into();
4517 self
4518 }
4519
4520 /// Sets the value of [create_time][crate::model::Service::create_time].
4521 ///
4522 /// # Example
4523 /// ```ignore,no_run
4524 /// # use google_cloud_apphub_v1::model::Service;
4525 /// use wkt::Timestamp;
4526 /// let x = Service::new().set_create_time(Timestamp::default()/* use setters */);
4527 /// ```
4528 pub fn set_create_time<T>(mut self, v: T) -> Self
4529 where
4530 T: std::convert::Into<wkt::Timestamp>,
4531 {
4532 self.create_time = std::option::Option::Some(v.into());
4533 self
4534 }
4535
4536 /// Sets or clears the value of [create_time][crate::model::Service::create_time].
4537 ///
4538 /// # Example
4539 /// ```ignore,no_run
4540 /// # use google_cloud_apphub_v1::model::Service;
4541 /// use wkt::Timestamp;
4542 /// let x = Service::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4543 /// let x = Service::new().set_or_clear_create_time(None::<Timestamp>);
4544 /// ```
4545 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4546 where
4547 T: std::convert::Into<wkt::Timestamp>,
4548 {
4549 self.create_time = v.map(|x| x.into());
4550 self
4551 }
4552
4553 /// Sets the value of [update_time][crate::model::Service::update_time].
4554 ///
4555 /// # Example
4556 /// ```ignore,no_run
4557 /// # use google_cloud_apphub_v1::model::Service;
4558 /// use wkt::Timestamp;
4559 /// let x = Service::new().set_update_time(Timestamp::default()/* use setters */);
4560 /// ```
4561 pub fn set_update_time<T>(mut self, v: T) -> Self
4562 where
4563 T: std::convert::Into<wkt::Timestamp>,
4564 {
4565 self.update_time = std::option::Option::Some(v.into());
4566 self
4567 }
4568
4569 /// Sets or clears the value of [update_time][crate::model::Service::update_time].
4570 ///
4571 /// # Example
4572 /// ```ignore,no_run
4573 /// # use google_cloud_apphub_v1::model::Service;
4574 /// use wkt::Timestamp;
4575 /// let x = Service::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4576 /// let x = Service::new().set_or_clear_update_time(None::<Timestamp>);
4577 /// ```
4578 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4579 where
4580 T: std::convert::Into<wkt::Timestamp>,
4581 {
4582 self.update_time = v.map(|x| x.into());
4583 self
4584 }
4585
4586 /// Sets the value of [uid][crate::model::Service::uid].
4587 ///
4588 /// # Example
4589 /// ```ignore,no_run
4590 /// # use google_cloud_apphub_v1::model::Service;
4591 /// let x = Service::new().set_uid("example");
4592 /// ```
4593 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4594 self.uid = v.into();
4595 self
4596 }
4597
4598 /// Sets the value of [state][crate::model::Service::state].
4599 ///
4600 /// # Example
4601 /// ```ignore,no_run
4602 /// # use google_cloud_apphub_v1::model::Service;
4603 /// use google_cloud_apphub_v1::model::service::State;
4604 /// let x0 = Service::new().set_state(State::Creating);
4605 /// let x1 = Service::new().set_state(State::Active);
4606 /// let x2 = Service::new().set_state(State::Deleting);
4607 /// ```
4608 pub fn set_state<T: std::convert::Into<crate::model::service::State>>(mut self, v: T) -> Self {
4609 self.state = v.into();
4610 self
4611 }
4612}
4613
4614impl wkt::message::Message for Service {
4615 fn typename() -> &'static str {
4616 "type.googleapis.com/google.cloud.apphub.v1.Service"
4617 }
4618}
4619
4620/// Defines additional types related to [Service].
4621pub mod service {
4622 #[allow(unused_imports)]
4623 use super::*;
4624
4625 /// Service state.
4626 ///
4627 /// # Working with unknown values
4628 ///
4629 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4630 /// additional enum variants at any time. Adding new variants is not considered
4631 /// a breaking change. Applications should write their code in anticipation of:
4632 ///
4633 /// - New values appearing in future releases of the client library, **and**
4634 /// - New values received dynamically, without application changes.
4635 ///
4636 /// Please consult the [Working with enums] section in the user guide for some
4637 /// guidelines.
4638 ///
4639 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4640 #[derive(Clone, Debug, PartialEq)]
4641 #[non_exhaustive]
4642 pub enum State {
4643 /// Unspecified state.
4644 Unspecified,
4645 /// The service is being created.
4646 Creating,
4647 /// The service is ready.
4648 Active,
4649 /// The service is being deleted.
4650 Deleting,
4651 /// The underlying networking resources have been deleted.
4652 Detached,
4653 /// If set, the enum was initialized with an unknown value.
4654 ///
4655 /// Applications can examine the value using [State::value] or
4656 /// [State::name].
4657 UnknownValue(state::UnknownValue),
4658 }
4659
4660 #[doc(hidden)]
4661 pub mod state {
4662 #[allow(unused_imports)]
4663 use super::*;
4664 #[derive(Clone, Debug, PartialEq)]
4665 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4666 }
4667
4668 impl State {
4669 /// Gets the enum value.
4670 ///
4671 /// Returns `None` if the enum contains an unknown value deserialized from
4672 /// the string representation of enums.
4673 pub fn value(&self) -> std::option::Option<i32> {
4674 match self {
4675 Self::Unspecified => std::option::Option::Some(0),
4676 Self::Creating => std::option::Option::Some(1),
4677 Self::Active => std::option::Option::Some(2),
4678 Self::Deleting => std::option::Option::Some(3),
4679 Self::Detached => std::option::Option::Some(4),
4680 Self::UnknownValue(u) => u.0.value(),
4681 }
4682 }
4683
4684 /// Gets the enum value as a string.
4685 ///
4686 /// Returns `None` if the enum contains an unknown value deserialized from
4687 /// the integer representation of enums.
4688 pub fn name(&self) -> std::option::Option<&str> {
4689 match self {
4690 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4691 Self::Creating => std::option::Option::Some("CREATING"),
4692 Self::Active => std::option::Option::Some("ACTIVE"),
4693 Self::Deleting => std::option::Option::Some("DELETING"),
4694 Self::Detached => std::option::Option::Some("DETACHED"),
4695 Self::UnknownValue(u) => u.0.name(),
4696 }
4697 }
4698 }
4699
4700 impl std::default::Default for State {
4701 fn default() -> Self {
4702 use std::convert::From;
4703 Self::from(0)
4704 }
4705 }
4706
4707 impl std::fmt::Display for State {
4708 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4709 wkt::internal::display_enum(f, self.name(), self.value())
4710 }
4711 }
4712
4713 impl std::convert::From<i32> for State {
4714 fn from(value: i32) -> Self {
4715 match value {
4716 0 => Self::Unspecified,
4717 1 => Self::Creating,
4718 2 => Self::Active,
4719 3 => Self::Deleting,
4720 4 => Self::Detached,
4721 _ => Self::UnknownValue(state::UnknownValue(
4722 wkt::internal::UnknownEnumValue::Integer(value),
4723 )),
4724 }
4725 }
4726 }
4727
4728 impl std::convert::From<&str> for State {
4729 fn from(value: &str) -> Self {
4730 use std::string::ToString;
4731 match value {
4732 "STATE_UNSPECIFIED" => Self::Unspecified,
4733 "CREATING" => Self::Creating,
4734 "ACTIVE" => Self::Active,
4735 "DELETING" => Self::Deleting,
4736 "DETACHED" => Self::Detached,
4737 _ => Self::UnknownValue(state::UnknownValue(
4738 wkt::internal::UnknownEnumValue::String(value.to_string()),
4739 )),
4740 }
4741 }
4742 }
4743
4744 impl serde::ser::Serialize for State {
4745 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4746 where
4747 S: serde::Serializer,
4748 {
4749 match self {
4750 Self::Unspecified => serializer.serialize_i32(0),
4751 Self::Creating => serializer.serialize_i32(1),
4752 Self::Active => serializer.serialize_i32(2),
4753 Self::Deleting => serializer.serialize_i32(3),
4754 Self::Detached => serializer.serialize_i32(4),
4755 Self::UnknownValue(u) => u.0.serialize(serializer),
4756 }
4757 }
4758 }
4759
4760 impl<'de> serde::de::Deserialize<'de> for State {
4761 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4762 where
4763 D: serde::Deserializer<'de>,
4764 {
4765 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4766 ".google.cloud.apphub.v1.Service.State",
4767 ))
4768 }
4769 }
4770}
4771
4772/// Reference to an underlying networking resource that can comprise a Service.
4773#[derive(Clone, Default, PartialEq)]
4774#[non_exhaustive]
4775pub struct ServiceReference {
4776 /// Output only. The underlying resource URI. For example, URI of Forwarding
4777 /// Rule, URL Map, and Backend Service.
4778 pub uri: std::string::String,
4779
4780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4781}
4782
4783impl ServiceReference {
4784 /// Creates a new default instance.
4785 pub fn new() -> Self {
4786 std::default::Default::default()
4787 }
4788
4789 /// Sets the value of [uri][crate::model::ServiceReference::uri].
4790 ///
4791 /// # Example
4792 /// ```ignore,no_run
4793 /// # use google_cloud_apphub_v1::model::ServiceReference;
4794 /// let x = ServiceReference::new().set_uri("example");
4795 /// ```
4796 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4797 self.uri = v.into();
4798 self
4799 }
4800}
4801
4802impl wkt::message::Message for ServiceReference {
4803 fn typename() -> &'static str {
4804 "type.googleapis.com/google.cloud.apphub.v1.ServiceReference"
4805 }
4806}
4807
4808/// Properties of an underlying cloud resource that can comprise a Service.
4809#[derive(Clone, Default, PartialEq)]
4810#[non_exhaustive]
4811pub struct ServiceProperties {
4812 /// Output only. The service project identifier that the underlying cloud
4813 /// resource resides in.
4814 pub gcp_project: std::string::String,
4815
4816 /// Output only. The location that the underlying resource resides in, for
4817 /// example, us-west1.
4818 pub location: std::string::String,
4819
4820 /// Output only. The location that the underlying resource resides in if it is
4821 /// zonal, for example, us-west1-a).
4822 pub zone: std::string::String,
4823
4824 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4825}
4826
4827impl ServiceProperties {
4828 /// Creates a new default instance.
4829 pub fn new() -> Self {
4830 std::default::Default::default()
4831 }
4832
4833 /// Sets the value of [gcp_project][crate::model::ServiceProperties::gcp_project].
4834 ///
4835 /// # Example
4836 /// ```ignore,no_run
4837 /// # use google_cloud_apphub_v1::model::ServiceProperties;
4838 /// let x = ServiceProperties::new().set_gcp_project("example");
4839 /// ```
4840 pub fn set_gcp_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4841 self.gcp_project = v.into();
4842 self
4843 }
4844
4845 /// Sets the value of [location][crate::model::ServiceProperties::location].
4846 ///
4847 /// # Example
4848 /// ```ignore,no_run
4849 /// # use google_cloud_apphub_v1::model::ServiceProperties;
4850 /// let x = ServiceProperties::new().set_location("example");
4851 /// ```
4852 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4853 self.location = v.into();
4854 self
4855 }
4856
4857 /// Sets the value of [zone][crate::model::ServiceProperties::zone].
4858 ///
4859 /// # Example
4860 /// ```ignore,no_run
4861 /// # use google_cloud_apphub_v1::model::ServiceProperties;
4862 /// let x = ServiceProperties::new().set_zone("example");
4863 /// ```
4864 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4865 self.zone = v.into();
4866 self
4867 }
4868}
4869
4870impl wkt::message::Message for ServiceProperties {
4871 fn typename() -> &'static str {
4872 "type.googleapis.com/google.cloud.apphub.v1.ServiceProperties"
4873 }
4874}
4875
4876/// DiscoveredService is a network or API interface that exposes some
4877/// functionality to clients for consumption over the network. A discovered
4878/// service can be registered to a App Hub service.
4879#[derive(Clone, Default, PartialEq)]
4880#[non_exhaustive]
4881pub struct DiscoveredService {
4882 /// Identifier. The resource name of the discovered service. Format:
4883 /// `"projects/{host-project-id}/locations/{location}/discoveredServices/{uuid}"`
4884 pub name: std::string::String,
4885
4886 /// Output only. Reference to an underlying networking resource that can
4887 /// comprise a Service. These are immutable.
4888 pub service_reference: std::option::Option<crate::model::ServiceReference>,
4889
4890 /// Output only. Properties of an underlying compute resource that can comprise
4891 /// a Service. These are immutable.
4892 pub service_properties: std::option::Option<crate::model::ServiceProperties>,
4893
4894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4895}
4896
4897impl DiscoveredService {
4898 /// Creates a new default instance.
4899 pub fn new() -> Self {
4900 std::default::Default::default()
4901 }
4902
4903 /// Sets the value of [name][crate::model::DiscoveredService::name].
4904 ///
4905 /// # Example
4906 /// ```ignore,no_run
4907 /// # use google_cloud_apphub_v1::model::DiscoveredService;
4908 /// # let project_id = "project_id";
4909 /// # let location_id = "location_id";
4910 /// # let discovered_service_id = "discovered_service_id";
4911 /// let x = DiscoveredService::new().set_name(format!("projects/{project_id}/locations/{location_id}/discoveredServices/{discovered_service_id}"));
4912 /// ```
4913 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4914 self.name = v.into();
4915 self
4916 }
4917
4918 /// Sets the value of [service_reference][crate::model::DiscoveredService::service_reference].
4919 ///
4920 /// # Example
4921 /// ```ignore,no_run
4922 /// # use google_cloud_apphub_v1::model::DiscoveredService;
4923 /// use google_cloud_apphub_v1::model::ServiceReference;
4924 /// let x = DiscoveredService::new().set_service_reference(ServiceReference::default()/* use setters */);
4925 /// ```
4926 pub fn set_service_reference<T>(mut self, v: T) -> Self
4927 where
4928 T: std::convert::Into<crate::model::ServiceReference>,
4929 {
4930 self.service_reference = std::option::Option::Some(v.into());
4931 self
4932 }
4933
4934 /// Sets or clears the value of [service_reference][crate::model::DiscoveredService::service_reference].
4935 ///
4936 /// # Example
4937 /// ```ignore,no_run
4938 /// # use google_cloud_apphub_v1::model::DiscoveredService;
4939 /// use google_cloud_apphub_v1::model::ServiceReference;
4940 /// let x = DiscoveredService::new().set_or_clear_service_reference(Some(ServiceReference::default()/* use setters */));
4941 /// let x = DiscoveredService::new().set_or_clear_service_reference(None::<ServiceReference>);
4942 /// ```
4943 pub fn set_or_clear_service_reference<T>(mut self, v: std::option::Option<T>) -> Self
4944 where
4945 T: std::convert::Into<crate::model::ServiceReference>,
4946 {
4947 self.service_reference = v.map(|x| x.into());
4948 self
4949 }
4950
4951 /// Sets the value of [service_properties][crate::model::DiscoveredService::service_properties].
4952 ///
4953 /// # Example
4954 /// ```ignore,no_run
4955 /// # use google_cloud_apphub_v1::model::DiscoveredService;
4956 /// use google_cloud_apphub_v1::model::ServiceProperties;
4957 /// let x = DiscoveredService::new().set_service_properties(ServiceProperties::default()/* use setters */);
4958 /// ```
4959 pub fn set_service_properties<T>(mut self, v: T) -> Self
4960 where
4961 T: std::convert::Into<crate::model::ServiceProperties>,
4962 {
4963 self.service_properties = std::option::Option::Some(v.into());
4964 self
4965 }
4966
4967 /// Sets or clears the value of [service_properties][crate::model::DiscoveredService::service_properties].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_apphub_v1::model::DiscoveredService;
4972 /// use google_cloud_apphub_v1::model::ServiceProperties;
4973 /// let x = DiscoveredService::new().set_or_clear_service_properties(Some(ServiceProperties::default()/* use setters */));
4974 /// let x = DiscoveredService::new().set_or_clear_service_properties(None::<ServiceProperties>);
4975 /// ```
4976 pub fn set_or_clear_service_properties<T>(mut self, v: std::option::Option<T>) -> Self
4977 where
4978 T: std::convert::Into<crate::model::ServiceProperties>,
4979 {
4980 self.service_properties = v.map(|x| x.into());
4981 self
4982 }
4983}
4984
4985impl wkt::message::Message for DiscoveredService {
4986 fn typename() -> &'static str {
4987 "type.googleapis.com/google.cloud.apphub.v1.DiscoveredService"
4988 }
4989}
4990
4991/// ServiceProjectAttachment represents an attachment from a service project to a
4992/// host project. Service projects contain the underlying cloud
4993/// infrastructure resources, and expose these resources to the host project
4994/// through a ServiceProjectAttachment. With the attachments, the host project
4995/// can provide an aggregated view of resources across all service projects.
4996#[derive(Clone, Default, PartialEq)]
4997#[non_exhaustive]
4998pub struct ServiceProjectAttachment {
4999 /// Identifier. The resource name of a ServiceProjectAttachment. Format:
5000 /// `"projects/{host-project-id}/locations/global/serviceProjectAttachments/{service-project-id}."`
5001 pub name: std::string::String,
5002
5003 /// Required. Immutable. Service project name in the format: `"projects/abc"`
5004 /// or `"projects/123"`. As input, project name with either project id or
5005 /// number are accepted. As output, this field will contain project number.
5006 pub service_project: std::string::String,
5007
5008 /// Output only. Create time.
5009 pub create_time: std::option::Option<wkt::Timestamp>,
5010
5011 /// Output only. A globally unique identifier (in UUID4 format) for the
5012 /// `ServiceProjectAttachment`.
5013 pub uid: std::string::String,
5014
5015 /// Output only. ServiceProjectAttachment state.
5016 pub state: crate::model::service_project_attachment::State,
5017
5018 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5019}
5020
5021impl ServiceProjectAttachment {
5022 /// Creates a new default instance.
5023 pub fn new() -> Self {
5024 std::default::Default::default()
5025 }
5026
5027 /// Sets the value of [name][crate::model::ServiceProjectAttachment::name].
5028 ///
5029 /// # Example
5030 /// ```ignore,no_run
5031 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5032 /// # let project_id = "project_id";
5033 /// # let location_id = "location_id";
5034 /// # let service_project_attachment_id = "service_project_attachment_id";
5035 /// let x = ServiceProjectAttachment::new().set_name(format!("projects/{project_id}/locations/{location_id}/serviceProjectAttachments/{service_project_attachment_id}"));
5036 /// ```
5037 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5038 self.name = v.into();
5039 self
5040 }
5041
5042 /// Sets the value of [service_project][crate::model::ServiceProjectAttachment::service_project].
5043 ///
5044 /// # Example
5045 /// ```ignore,no_run
5046 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5047 /// let x = ServiceProjectAttachment::new().set_service_project("example");
5048 /// ```
5049 pub fn set_service_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5050 self.service_project = v.into();
5051 self
5052 }
5053
5054 /// Sets the value of [create_time][crate::model::ServiceProjectAttachment::create_time].
5055 ///
5056 /// # Example
5057 /// ```ignore,no_run
5058 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5059 /// use wkt::Timestamp;
5060 /// let x = ServiceProjectAttachment::new().set_create_time(Timestamp::default()/* use setters */);
5061 /// ```
5062 pub fn set_create_time<T>(mut self, v: T) -> Self
5063 where
5064 T: std::convert::Into<wkt::Timestamp>,
5065 {
5066 self.create_time = std::option::Option::Some(v.into());
5067 self
5068 }
5069
5070 /// Sets or clears the value of [create_time][crate::model::ServiceProjectAttachment::create_time].
5071 ///
5072 /// # Example
5073 /// ```ignore,no_run
5074 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5075 /// use wkt::Timestamp;
5076 /// let x = ServiceProjectAttachment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5077 /// let x = ServiceProjectAttachment::new().set_or_clear_create_time(None::<Timestamp>);
5078 /// ```
5079 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5080 where
5081 T: std::convert::Into<wkt::Timestamp>,
5082 {
5083 self.create_time = v.map(|x| x.into());
5084 self
5085 }
5086
5087 /// Sets the value of [uid][crate::model::ServiceProjectAttachment::uid].
5088 ///
5089 /// # Example
5090 /// ```ignore,no_run
5091 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5092 /// let x = ServiceProjectAttachment::new().set_uid("example");
5093 /// ```
5094 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5095 self.uid = v.into();
5096 self
5097 }
5098
5099 /// Sets the value of [state][crate::model::ServiceProjectAttachment::state].
5100 ///
5101 /// # Example
5102 /// ```ignore,no_run
5103 /// # use google_cloud_apphub_v1::model::ServiceProjectAttachment;
5104 /// use google_cloud_apphub_v1::model::service_project_attachment::State;
5105 /// let x0 = ServiceProjectAttachment::new().set_state(State::Creating);
5106 /// let x1 = ServiceProjectAttachment::new().set_state(State::Active);
5107 /// let x2 = ServiceProjectAttachment::new().set_state(State::Deleting);
5108 /// ```
5109 pub fn set_state<T: std::convert::Into<crate::model::service_project_attachment::State>>(
5110 mut self,
5111 v: T,
5112 ) -> Self {
5113 self.state = v.into();
5114 self
5115 }
5116}
5117
5118impl wkt::message::Message for ServiceProjectAttachment {
5119 fn typename() -> &'static str {
5120 "type.googleapis.com/google.cloud.apphub.v1.ServiceProjectAttachment"
5121 }
5122}
5123
5124/// Defines additional types related to [ServiceProjectAttachment].
5125pub mod service_project_attachment {
5126 #[allow(unused_imports)]
5127 use super::*;
5128
5129 /// ServiceProjectAttachment state.
5130 ///
5131 /// # Working with unknown values
5132 ///
5133 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5134 /// additional enum variants at any time. Adding new variants is not considered
5135 /// a breaking change. Applications should write their code in anticipation of:
5136 ///
5137 /// - New values appearing in future releases of the client library, **and**
5138 /// - New values received dynamically, without application changes.
5139 ///
5140 /// Please consult the [Working with enums] section in the user guide for some
5141 /// guidelines.
5142 ///
5143 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5144 #[derive(Clone, Debug, PartialEq)]
5145 #[non_exhaustive]
5146 pub enum State {
5147 /// Unspecified state.
5148 Unspecified,
5149 /// The ServiceProjectAttachment is being created.
5150 Creating,
5151 /// The ServiceProjectAttachment is ready.
5152 /// This means Services and Workloads under the corresponding
5153 /// ServiceProjectAttachment is ready for registration.
5154 Active,
5155 /// The ServiceProjectAttachment is being deleted.
5156 Deleting,
5157 /// If set, the enum was initialized with an unknown value.
5158 ///
5159 /// Applications can examine the value using [State::value] or
5160 /// [State::name].
5161 UnknownValue(state::UnknownValue),
5162 }
5163
5164 #[doc(hidden)]
5165 pub mod state {
5166 #[allow(unused_imports)]
5167 use super::*;
5168 #[derive(Clone, Debug, PartialEq)]
5169 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5170 }
5171
5172 impl State {
5173 /// Gets the enum value.
5174 ///
5175 /// Returns `None` if the enum contains an unknown value deserialized from
5176 /// the string representation of enums.
5177 pub fn value(&self) -> std::option::Option<i32> {
5178 match self {
5179 Self::Unspecified => std::option::Option::Some(0),
5180 Self::Creating => std::option::Option::Some(1),
5181 Self::Active => std::option::Option::Some(2),
5182 Self::Deleting => std::option::Option::Some(3),
5183 Self::UnknownValue(u) => u.0.value(),
5184 }
5185 }
5186
5187 /// Gets the enum value as a string.
5188 ///
5189 /// Returns `None` if the enum contains an unknown value deserialized from
5190 /// the integer representation of enums.
5191 pub fn name(&self) -> std::option::Option<&str> {
5192 match self {
5193 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5194 Self::Creating => std::option::Option::Some("CREATING"),
5195 Self::Active => std::option::Option::Some("ACTIVE"),
5196 Self::Deleting => std::option::Option::Some("DELETING"),
5197 Self::UnknownValue(u) => u.0.name(),
5198 }
5199 }
5200 }
5201
5202 impl std::default::Default for State {
5203 fn default() -> Self {
5204 use std::convert::From;
5205 Self::from(0)
5206 }
5207 }
5208
5209 impl std::fmt::Display for State {
5210 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5211 wkt::internal::display_enum(f, self.name(), self.value())
5212 }
5213 }
5214
5215 impl std::convert::From<i32> for State {
5216 fn from(value: i32) -> Self {
5217 match value {
5218 0 => Self::Unspecified,
5219 1 => Self::Creating,
5220 2 => Self::Active,
5221 3 => Self::Deleting,
5222 _ => Self::UnknownValue(state::UnknownValue(
5223 wkt::internal::UnknownEnumValue::Integer(value),
5224 )),
5225 }
5226 }
5227 }
5228
5229 impl std::convert::From<&str> for State {
5230 fn from(value: &str) -> Self {
5231 use std::string::ToString;
5232 match value {
5233 "STATE_UNSPECIFIED" => Self::Unspecified,
5234 "CREATING" => Self::Creating,
5235 "ACTIVE" => Self::Active,
5236 "DELETING" => Self::Deleting,
5237 _ => Self::UnknownValue(state::UnknownValue(
5238 wkt::internal::UnknownEnumValue::String(value.to_string()),
5239 )),
5240 }
5241 }
5242 }
5243
5244 impl serde::ser::Serialize for State {
5245 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5246 where
5247 S: serde::Serializer,
5248 {
5249 match self {
5250 Self::Unspecified => serializer.serialize_i32(0),
5251 Self::Creating => serializer.serialize_i32(1),
5252 Self::Active => serializer.serialize_i32(2),
5253 Self::Deleting => serializer.serialize_i32(3),
5254 Self::UnknownValue(u) => u.0.serialize(serializer),
5255 }
5256 }
5257 }
5258
5259 impl<'de> serde::de::Deserialize<'de> for State {
5260 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5261 where
5262 D: serde::Deserializer<'de>,
5263 {
5264 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5265 ".google.cloud.apphub.v1.ServiceProjectAttachment.State",
5266 ))
5267 }
5268 }
5269}
5270
5271/// Workload is an App Hub data model that contains a discovered workload, which
5272/// represents a binary deployment (such as managed instance groups (MIGs) and
5273/// GKE deployments) that performs the smallest logical subset of business
5274/// functionality.
5275#[derive(Clone, Default, PartialEq)]
5276#[non_exhaustive]
5277pub struct Workload {
5278 /// Identifier. The resource name of the Workload. Format:
5279 /// `"projects/{host-project-id}/locations/{location}/applications/{application-id}/workloads/{workload-id}"`
5280 pub name: std::string::String,
5281
5282 /// Optional. User-defined name for the Workload.
5283 /// Can have a maximum length of 63 characters.
5284 pub display_name: std::string::String,
5285
5286 /// Optional. User-defined description of a Workload.
5287 /// Can have a maximum length of 2048 characters.
5288 pub description: std::string::String,
5289
5290 /// Output only. Reference of an underlying compute resource represented by the
5291 /// Workload. These are immutable.
5292 pub workload_reference: std::option::Option<crate::model::WorkloadReference>,
5293
5294 /// Output only. Properties of an underlying compute resource represented by
5295 /// the Workload. These are immutable.
5296 pub workload_properties: std::option::Option<crate::model::WorkloadProperties>,
5297
5298 /// Required. Immutable. The resource name of the original discovered workload.
5299 pub discovered_workload: std::string::String,
5300
5301 /// Optional. Consumer provided attributes.
5302 pub attributes: std::option::Option<crate::model::Attributes>,
5303
5304 /// Output only. Create time.
5305 pub create_time: std::option::Option<wkt::Timestamp>,
5306
5307 /// Output only. Update time.
5308 pub update_time: std::option::Option<wkt::Timestamp>,
5309
5310 /// Output only. A universally unique identifier (UUID) for the `Workload` in
5311 /// the UUID4 format.
5312 pub uid: std::string::String,
5313
5314 /// Output only. Workload state.
5315 pub state: crate::model::workload::State,
5316
5317 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5318}
5319
5320impl Workload {
5321 /// Creates a new default instance.
5322 pub fn new() -> Self {
5323 std::default::Default::default()
5324 }
5325
5326 /// Sets the value of [name][crate::model::Workload::name].
5327 ///
5328 /// # Example
5329 /// ```ignore,no_run
5330 /// # use google_cloud_apphub_v1::model::Workload;
5331 /// # let project_id = "project_id";
5332 /// # let location_id = "location_id";
5333 /// # let application_id = "application_id";
5334 /// # let workload_id = "workload_id";
5335 /// let x = Workload::new().set_name(format!("projects/{project_id}/locations/{location_id}/applications/{application_id}/workloads/{workload_id}"));
5336 /// ```
5337 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5338 self.name = v.into();
5339 self
5340 }
5341
5342 /// Sets the value of [display_name][crate::model::Workload::display_name].
5343 ///
5344 /// # Example
5345 /// ```ignore,no_run
5346 /// # use google_cloud_apphub_v1::model::Workload;
5347 /// let x = Workload::new().set_display_name("example");
5348 /// ```
5349 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5350 self.display_name = v.into();
5351 self
5352 }
5353
5354 /// Sets the value of [description][crate::model::Workload::description].
5355 ///
5356 /// # Example
5357 /// ```ignore,no_run
5358 /// # use google_cloud_apphub_v1::model::Workload;
5359 /// let x = Workload::new().set_description("example");
5360 /// ```
5361 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5362 self.description = v.into();
5363 self
5364 }
5365
5366 /// Sets the value of [workload_reference][crate::model::Workload::workload_reference].
5367 ///
5368 /// # Example
5369 /// ```ignore,no_run
5370 /// # use google_cloud_apphub_v1::model::Workload;
5371 /// use google_cloud_apphub_v1::model::WorkloadReference;
5372 /// let x = Workload::new().set_workload_reference(WorkloadReference::default()/* use setters */);
5373 /// ```
5374 pub fn set_workload_reference<T>(mut self, v: T) -> Self
5375 where
5376 T: std::convert::Into<crate::model::WorkloadReference>,
5377 {
5378 self.workload_reference = std::option::Option::Some(v.into());
5379 self
5380 }
5381
5382 /// Sets or clears the value of [workload_reference][crate::model::Workload::workload_reference].
5383 ///
5384 /// # Example
5385 /// ```ignore,no_run
5386 /// # use google_cloud_apphub_v1::model::Workload;
5387 /// use google_cloud_apphub_v1::model::WorkloadReference;
5388 /// let x = Workload::new().set_or_clear_workload_reference(Some(WorkloadReference::default()/* use setters */));
5389 /// let x = Workload::new().set_or_clear_workload_reference(None::<WorkloadReference>);
5390 /// ```
5391 pub fn set_or_clear_workload_reference<T>(mut self, v: std::option::Option<T>) -> Self
5392 where
5393 T: std::convert::Into<crate::model::WorkloadReference>,
5394 {
5395 self.workload_reference = v.map(|x| x.into());
5396 self
5397 }
5398
5399 /// Sets the value of [workload_properties][crate::model::Workload::workload_properties].
5400 ///
5401 /// # Example
5402 /// ```ignore,no_run
5403 /// # use google_cloud_apphub_v1::model::Workload;
5404 /// use google_cloud_apphub_v1::model::WorkloadProperties;
5405 /// let x = Workload::new().set_workload_properties(WorkloadProperties::default()/* use setters */);
5406 /// ```
5407 pub fn set_workload_properties<T>(mut self, v: T) -> Self
5408 where
5409 T: std::convert::Into<crate::model::WorkloadProperties>,
5410 {
5411 self.workload_properties = std::option::Option::Some(v.into());
5412 self
5413 }
5414
5415 /// Sets or clears the value of [workload_properties][crate::model::Workload::workload_properties].
5416 ///
5417 /// # Example
5418 /// ```ignore,no_run
5419 /// # use google_cloud_apphub_v1::model::Workload;
5420 /// use google_cloud_apphub_v1::model::WorkloadProperties;
5421 /// let x = Workload::new().set_or_clear_workload_properties(Some(WorkloadProperties::default()/* use setters */));
5422 /// let x = Workload::new().set_or_clear_workload_properties(None::<WorkloadProperties>);
5423 /// ```
5424 pub fn set_or_clear_workload_properties<T>(mut self, v: std::option::Option<T>) -> Self
5425 where
5426 T: std::convert::Into<crate::model::WorkloadProperties>,
5427 {
5428 self.workload_properties = v.map(|x| x.into());
5429 self
5430 }
5431
5432 /// Sets the value of [discovered_workload][crate::model::Workload::discovered_workload].
5433 ///
5434 /// # Example
5435 /// ```ignore,no_run
5436 /// # use google_cloud_apphub_v1::model::Workload;
5437 /// # let project_id = "project_id";
5438 /// # let location_id = "location_id";
5439 /// let x = Workload::new().set_discovered_workload(format!("projects/{project_id}/locations/{location_id}"));
5440 /// ```
5441 pub fn set_discovered_workload<T: std::convert::Into<std::string::String>>(
5442 mut self,
5443 v: T,
5444 ) -> Self {
5445 self.discovered_workload = v.into();
5446 self
5447 }
5448
5449 /// Sets the value of [attributes][crate::model::Workload::attributes].
5450 ///
5451 /// # Example
5452 /// ```ignore,no_run
5453 /// # use google_cloud_apphub_v1::model::Workload;
5454 /// use google_cloud_apphub_v1::model::Attributes;
5455 /// let x = Workload::new().set_attributes(Attributes::default()/* use setters */);
5456 /// ```
5457 pub fn set_attributes<T>(mut self, v: T) -> Self
5458 where
5459 T: std::convert::Into<crate::model::Attributes>,
5460 {
5461 self.attributes = std::option::Option::Some(v.into());
5462 self
5463 }
5464
5465 /// Sets or clears the value of [attributes][crate::model::Workload::attributes].
5466 ///
5467 /// # Example
5468 /// ```ignore,no_run
5469 /// # use google_cloud_apphub_v1::model::Workload;
5470 /// use google_cloud_apphub_v1::model::Attributes;
5471 /// let x = Workload::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
5472 /// let x = Workload::new().set_or_clear_attributes(None::<Attributes>);
5473 /// ```
5474 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
5475 where
5476 T: std::convert::Into<crate::model::Attributes>,
5477 {
5478 self.attributes = v.map(|x| x.into());
5479 self
5480 }
5481
5482 /// Sets the value of [create_time][crate::model::Workload::create_time].
5483 ///
5484 /// # Example
5485 /// ```ignore,no_run
5486 /// # use google_cloud_apphub_v1::model::Workload;
5487 /// use wkt::Timestamp;
5488 /// let x = Workload::new().set_create_time(Timestamp::default()/* use setters */);
5489 /// ```
5490 pub fn set_create_time<T>(mut self, v: T) -> Self
5491 where
5492 T: std::convert::Into<wkt::Timestamp>,
5493 {
5494 self.create_time = std::option::Option::Some(v.into());
5495 self
5496 }
5497
5498 /// Sets or clears the value of [create_time][crate::model::Workload::create_time].
5499 ///
5500 /// # Example
5501 /// ```ignore,no_run
5502 /// # use google_cloud_apphub_v1::model::Workload;
5503 /// use wkt::Timestamp;
5504 /// let x = Workload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5505 /// let x = Workload::new().set_or_clear_create_time(None::<Timestamp>);
5506 /// ```
5507 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5508 where
5509 T: std::convert::Into<wkt::Timestamp>,
5510 {
5511 self.create_time = v.map(|x| x.into());
5512 self
5513 }
5514
5515 /// Sets the value of [update_time][crate::model::Workload::update_time].
5516 ///
5517 /// # Example
5518 /// ```ignore,no_run
5519 /// # use google_cloud_apphub_v1::model::Workload;
5520 /// use wkt::Timestamp;
5521 /// let x = Workload::new().set_update_time(Timestamp::default()/* use setters */);
5522 /// ```
5523 pub fn set_update_time<T>(mut self, v: T) -> Self
5524 where
5525 T: std::convert::Into<wkt::Timestamp>,
5526 {
5527 self.update_time = std::option::Option::Some(v.into());
5528 self
5529 }
5530
5531 /// Sets or clears the value of [update_time][crate::model::Workload::update_time].
5532 ///
5533 /// # Example
5534 /// ```ignore,no_run
5535 /// # use google_cloud_apphub_v1::model::Workload;
5536 /// use wkt::Timestamp;
5537 /// let x = Workload::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5538 /// let x = Workload::new().set_or_clear_update_time(None::<Timestamp>);
5539 /// ```
5540 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5541 where
5542 T: std::convert::Into<wkt::Timestamp>,
5543 {
5544 self.update_time = v.map(|x| x.into());
5545 self
5546 }
5547
5548 /// Sets the value of [uid][crate::model::Workload::uid].
5549 ///
5550 /// # Example
5551 /// ```ignore,no_run
5552 /// # use google_cloud_apphub_v1::model::Workload;
5553 /// let x = Workload::new().set_uid("example");
5554 /// ```
5555 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5556 self.uid = v.into();
5557 self
5558 }
5559
5560 /// Sets the value of [state][crate::model::Workload::state].
5561 ///
5562 /// # Example
5563 /// ```ignore,no_run
5564 /// # use google_cloud_apphub_v1::model::Workload;
5565 /// use google_cloud_apphub_v1::model::workload::State;
5566 /// let x0 = Workload::new().set_state(State::Creating);
5567 /// let x1 = Workload::new().set_state(State::Active);
5568 /// let x2 = Workload::new().set_state(State::Deleting);
5569 /// ```
5570 pub fn set_state<T: std::convert::Into<crate::model::workload::State>>(mut self, v: T) -> Self {
5571 self.state = v.into();
5572 self
5573 }
5574}
5575
5576impl wkt::message::Message for Workload {
5577 fn typename() -> &'static str {
5578 "type.googleapis.com/google.cloud.apphub.v1.Workload"
5579 }
5580}
5581
5582/// Defines additional types related to [Workload].
5583pub mod workload {
5584 #[allow(unused_imports)]
5585 use super::*;
5586
5587 /// Workload state.
5588 ///
5589 /// # Working with unknown values
5590 ///
5591 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5592 /// additional enum variants at any time. Adding new variants is not considered
5593 /// a breaking change. Applications should write their code in anticipation of:
5594 ///
5595 /// - New values appearing in future releases of the client library, **and**
5596 /// - New values received dynamically, without application changes.
5597 ///
5598 /// Please consult the [Working with enums] section in the user guide for some
5599 /// guidelines.
5600 ///
5601 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5602 #[derive(Clone, Debug, PartialEq)]
5603 #[non_exhaustive]
5604 pub enum State {
5605 /// Unspecified state.
5606 Unspecified,
5607 /// The Workload is being created.
5608 Creating,
5609 /// The Workload is ready.
5610 Active,
5611 /// The Workload is being deleted.
5612 Deleting,
5613 /// The underlying compute resources have been deleted.
5614 Detached,
5615 /// If set, the enum was initialized with an unknown value.
5616 ///
5617 /// Applications can examine the value using [State::value] or
5618 /// [State::name].
5619 UnknownValue(state::UnknownValue),
5620 }
5621
5622 #[doc(hidden)]
5623 pub mod state {
5624 #[allow(unused_imports)]
5625 use super::*;
5626 #[derive(Clone, Debug, PartialEq)]
5627 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5628 }
5629
5630 impl State {
5631 /// Gets the enum value.
5632 ///
5633 /// Returns `None` if the enum contains an unknown value deserialized from
5634 /// the string representation of enums.
5635 pub fn value(&self) -> std::option::Option<i32> {
5636 match self {
5637 Self::Unspecified => std::option::Option::Some(0),
5638 Self::Creating => std::option::Option::Some(1),
5639 Self::Active => std::option::Option::Some(2),
5640 Self::Deleting => std::option::Option::Some(3),
5641 Self::Detached => std::option::Option::Some(4),
5642 Self::UnknownValue(u) => u.0.value(),
5643 }
5644 }
5645
5646 /// Gets the enum value as a string.
5647 ///
5648 /// Returns `None` if the enum contains an unknown value deserialized from
5649 /// the integer representation of enums.
5650 pub fn name(&self) -> std::option::Option<&str> {
5651 match self {
5652 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5653 Self::Creating => std::option::Option::Some("CREATING"),
5654 Self::Active => std::option::Option::Some("ACTIVE"),
5655 Self::Deleting => std::option::Option::Some("DELETING"),
5656 Self::Detached => std::option::Option::Some("DETACHED"),
5657 Self::UnknownValue(u) => u.0.name(),
5658 }
5659 }
5660 }
5661
5662 impl std::default::Default for State {
5663 fn default() -> Self {
5664 use std::convert::From;
5665 Self::from(0)
5666 }
5667 }
5668
5669 impl std::fmt::Display for State {
5670 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5671 wkt::internal::display_enum(f, self.name(), self.value())
5672 }
5673 }
5674
5675 impl std::convert::From<i32> for State {
5676 fn from(value: i32) -> Self {
5677 match value {
5678 0 => Self::Unspecified,
5679 1 => Self::Creating,
5680 2 => Self::Active,
5681 3 => Self::Deleting,
5682 4 => Self::Detached,
5683 _ => Self::UnknownValue(state::UnknownValue(
5684 wkt::internal::UnknownEnumValue::Integer(value),
5685 )),
5686 }
5687 }
5688 }
5689
5690 impl std::convert::From<&str> for State {
5691 fn from(value: &str) -> Self {
5692 use std::string::ToString;
5693 match value {
5694 "STATE_UNSPECIFIED" => Self::Unspecified,
5695 "CREATING" => Self::Creating,
5696 "ACTIVE" => Self::Active,
5697 "DELETING" => Self::Deleting,
5698 "DETACHED" => Self::Detached,
5699 _ => Self::UnknownValue(state::UnknownValue(
5700 wkt::internal::UnknownEnumValue::String(value.to_string()),
5701 )),
5702 }
5703 }
5704 }
5705
5706 impl serde::ser::Serialize for State {
5707 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5708 where
5709 S: serde::Serializer,
5710 {
5711 match self {
5712 Self::Unspecified => serializer.serialize_i32(0),
5713 Self::Creating => serializer.serialize_i32(1),
5714 Self::Active => serializer.serialize_i32(2),
5715 Self::Deleting => serializer.serialize_i32(3),
5716 Self::Detached => serializer.serialize_i32(4),
5717 Self::UnknownValue(u) => u.0.serialize(serializer),
5718 }
5719 }
5720 }
5721
5722 impl<'de> serde::de::Deserialize<'de> for State {
5723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5724 where
5725 D: serde::Deserializer<'de>,
5726 {
5727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5728 ".google.cloud.apphub.v1.Workload.State",
5729 ))
5730 }
5731 }
5732}
5733
5734/// Reference of an underlying compute resource represented by the Workload.
5735#[derive(Clone, Default, PartialEq)]
5736#[non_exhaustive]
5737pub struct WorkloadReference {
5738 /// Output only. The underlying compute resource uri.
5739 pub uri: std::string::String,
5740
5741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5742}
5743
5744impl WorkloadReference {
5745 /// Creates a new default instance.
5746 pub fn new() -> Self {
5747 std::default::Default::default()
5748 }
5749
5750 /// Sets the value of [uri][crate::model::WorkloadReference::uri].
5751 ///
5752 /// # Example
5753 /// ```ignore,no_run
5754 /// # use google_cloud_apphub_v1::model::WorkloadReference;
5755 /// let x = WorkloadReference::new().set_uri("example");
5756 /// ```
5757 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5758 self.uri = v.into();
5759 self
5760 }
5761}
5762
5763impl wkt::message::Message for WorkloadReference {
5764 fn typename() -> &'static str {
5765 "type.googleapis.com/google.cloud.apphub.v1.WorkloadReference"
5766 }
5767}
5768
5769/// Properties of an underlying compute resource represented by the Workload.
5770#[derive(Clone, Default, PartialEq)]
5771#[non_exhaustive]
5772pub struct WorkloadProperties {
5773 /// Output only. The service project identifier that the underlying cloud
5774 /// resource resides in. Empty for non-cloud resources.
5775 pub gcp_project: std::string::String,
5776
5777 /// Output only. The location that the underlying compute resource resides in
5778 /// (for example, us-west1).
5779 pub location: std::string::String,
5780
5781 /// Output only. The location that the underlying compute resource resides in
5782 /// if it is zonal (for example, us-west1-a).
5783 pub zone: std::string::String,
5784
5785 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5786}
5787
5788impl WorkloadProperties {
5789 /// Creates a new default instance.
5790 pub fn new() -> Self {
5791 std::default::Default::default()
5792 }
5793
5794 /// Sets the value of [gcp_project][crate::model::WorkloadProperties::gcp_project].
5795 ///
5796 /// # Example
5797 /// ```ignore,no_run
5798 /// # use google_cloud_apphub_v1::model::WorkloadProperties;
5799 /// let x = WorkloadProperties::new().set_gcp_project("example");
5800 /// ```
5801 pub fn set_gcp_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5802 self.gcp_project = v.into();
5803 self
5804 }
5805
5806 /// Sets the value of [location][crate::model::WorkloadProperties::location].
5807 ///
5808 /// # Example
5809 /// ```ignore,no_run
5810 /// # use google_cloud_apphub_v1::model::WorkloadProperties;
5811 /// let x = WorkloadProperties::new().set_location("example");
5812 /// ```
5813 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5814 self.location = v.into();
5815 self
5816 }
5817
5818 /// Sets the value of [zone][crate::model::WorkloadProperties::zone].
5819 ///
5820 /// # Example
5821 /// ```ignore,no_run
5822 /// # use google_cloud_apphub_v1::model::WorkloadProperties;
5823 /// let x = WorkloadProperties::new().set_zone("example");
5824 /// ```
5825 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5826 self.zone = v.into();
5827 self
5828 }
5829}
5830
5831impl wkt::message::Message for WorkloadProperties {
5832 fn typename() -> &'static str {
5833 "type.googleapis.com/google.cloud.apphub.v1.WorkloadProperties"
5834 }
5835}
5836
5837/// DiscoveredWorkload is a binary deployment (such as managed instance groups
5838/// (MIGs) and GKE deployments) that performs the smallest logical subset of
5839/// business functionality. A discovered workload can be registered to an App Hub
5840/// Workload.
5841#[derive(Clone, Default, PartialEq)]
5842#[non_exhaustive]
5843pub struct DiscoveredWorkload {
5844 /// Identifier. The resource name of the discovered workload. Format:
5845 /// `"projects/{host-project-id}/locations/{location}/discoveredWorkloads/{uuid}"`
5846 pub name: std::string::String,
5847
5848 /// Output only. Reference of an underlying compute resource represented by the
5849 /// Workload. These are immutable.
5850 pub workload_reference: std::option::Option<crate::model::WorkloadReference>,
5851
5852 /// Output only. Properties of an underlying compute resource represented by
5853 /// the Workload. These are immutable.
5854 pub workload_properties: std::option::Option<crate::model::WorkloadProperties>,
5855
5856 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5857}
5858
5859impl DiscoveredWorkload {
5860 /// Creates a new default instance.
5861 pub fn new() -> Self {
5862 std::default::Default::default()
5863 }
5864
5865 /// Sets the value of [name][crate::model::DiscoveredWorkload::name].
5866 ///
5867 /// # Example
5868 /// ```ignore,no_run
5869 /// # use google_cloud_apphub_v1::model::DiscoveredWorkload;
5870 /// # let project_id = "project_id";
5871 /// # let location_id = "location_id";
5872 /// # let discovered_workload_id = "discovered_workload_id";
5873 /// let x = DiscoveredWorkload::new().set_name(format!("projects/{project_id}/locations/{location_id}/discoveredWorkloads/{discovered_workload_id}"));
5874 /// ```
5875 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5876 self.name = v.into();
5877 self
5878 }
5879
5880 /// Sets the value of [workload_reference][crate::model::DiscoveredWorkload::workload_reference].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_apphub_v1::model::DiscoveredWorkload;
5885 /// use google_cloud_apphub_v1::model::WorkloadReference;
5886 /// let x = DiscoveredWorkload::new().set_workload_reference(WorkloadReference::default()/* use setters */);
5887 /// ```
5888 pub fn set_workload_reference<T>(mut self, v: T) -> Self
5889 where
5890 T: std::convert::Into<crate::model::WorkloadReference>,
5891 {
5892 self.workload_reference = std::option::Option::Some(v.into());
5893 self
5894 }
5895
5896 /// Sets or clears the value of [workload_reference][crate::model::DiscoveredWorkload::workload_reference].
5897 ///
5898 /// # Example
5899 /// ```ignore,no_run
5900 /// # use google_cloud_apphub_v1::model::DiscoveredWorkload;
5901 /// use google_cloud_apphub_v1::model::WorkloadReference;
5902 /// let x = DiscoveredWorkload::new().set_or_clear_workload_reference(Some(WorkloadReference::default()/* use setters */));
5903 /// let x = DiscoveredWorkload::new().set_or_clear_workload_reference(None::<WorkloadReference>);
5904 /// ```
5905 pub fn set_or_clear_workload_reference<T>(mut self, v: std::option::Option<T>) -> Self
5906 where
5907 T: std::convert::Into<crate::model::WorkloadReference>,
5908 {
5909 self.workload_reference = v.map(|x| x.into());
5910 self
5911 }
5912
5913 /// Sets the value of [workload_properties][crate::model::DiscoveredWorkload::workload_properties].
5914 ///
5915 /// # Example
5916 /// ```ignore,no_run
5917 /// # use google_cloud_apphub_v1::model::DiscoveredWorkload;
5918 /// use google_cloud_apphub_v1::model::WorkloadProperties;
5919 /// let x = DiscoveredWorkload::new().set_workload_properties(WorkloadProperties::default()/* use setters */);
5920 /// ```
5921 pub fn set_workload_properties<T>(mut self, v: T) -> Self
5922 where
5923 T: std::convert::Into<crate::model::WorkloadProperties>,
5924 {
5925 self.workload_properties = std::option::Option::Some(v.into());
5926 self
5927 }
5928
5929 /// Sets or clears the value of [workload_properties][crate::model::DiscoveredWorkload::workload_properties].
5930 ///
5931 /// # Example
5932 /// ```ignore,no_run
5933 /// # use google_cloud_apphub_v1::model::DiscoveredWorkload;
5934 /// use google_cloud_apphub_v1::model::WorkloadProperties;
5935 /// let x = DiscoveredWorkload::new().set_or_clear_workload_properties(Some(WorkloadProperties::default()/* use setters */));
5936 /// let x = DiscoveredWorkload::new().set_or_clear_workload_properties(None::<WorkloadProperties>);
5937 /// ```
5938 pub fn set_or_clear_workload_properties<T>(mut self, v: std::option::Option<T>) -> Self
5939 where
5940 T: std::convert::Into<crate::model::WorkloadProperties>,
5941 {
5942 self.workload_properties = v.map(|x| x.into());
5943 self
5944 }
5945}
5946
5947impl wkt::message::Message for DiscoveredWorkload {
5948 fn typename() -> &'static str {
5949 "type.googleapis.com/google.cloud.apphub.v1.DiscoveredWorkload"
5950 }
5951}