google_cloud_apihub_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::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate lazy_static;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// The [CreateApi][google.cloud.apihub.v1.ApiHub.CreateApi] method's request.
40///
41/// [google.cloud.apihub.v1.ApiHub.CreateApi]: crate::client::ApiHub::create_api
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct CreateApiRequest {
45 /// Required. The parent resource for the API resource.
46 /// Format: `projects/{project}/locations/{location}`
47 pub parent: std::string::String,
48
49 /// Optional. The ID to use for the API resource, which will become the final
50 /// component of the API's resource name. This field is optional.
51 ///
52 /// * If provided, the same will be used. The service will throw an error if
53 /// the specified id is already used by another API resource in the API hub.
54 /// * If not provided, a system generated id will be used.
55 ///
56 /// This value should be 4-500 characters, and valid characters
57 /// are /[a-z][A-Z][0-9]-_/.
58 pub api_id: std::string::String,
59
60 /// Required. The API resource to create.
61 pub api: std::option::Option<crate::model::Api>,
62
63 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
64}
65
66impl CreateApiRequest {
67 pub fn new() -> Self {
68 std::default::Default::default()
69 }
70
71 /// Sets the value of [parent][crate::model::CreateApiRequest::parent].
72 ///
73 /// # Example
74 /// ```ignore,no_run
75 /// # use google_cloud_apihub_v1::model::CreateApiRequest;
76 /// let x = CreateApiRequest::new().set_parent("example");
77 /// ```
78 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
79 self.parent = v.into();
80 self
81 }
82
83 /// Sets the value of [api_id][crate::model::CreateApiRequest::api_id].
84 ///
85 /// # Example
86 /// ```ignore,no_run
87 /// # use google_cloud_apihub_v1::model::CreateApiRequest;
88 /// let x = CreateApiRequest::new().set_api_id("example");
89 /// ```
90 pub fn set_api_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
91 self.api_id = v.into();
92 self
93 }
94
95 /// Sets the value of [api][crate::model::CreateApiRequest::api].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_apihub_v1::model::CreateApiRequest;
100 /// use google_cloud_apihub_v1::model::Api;
101 /// let x = CreateApiRequest::new().set_api(Api::default()/* use setters */);
102 /// ```
103 pub fn set_api<T>(mut self, v: T) -> Self
104 where
105 T: std::convert::Into<crate::model::Api>,
106 {
107 self.api = std::option::Option::Some(v.into());
108 self
109 }
110
111 /// Sets or clears the value of [api][crate::model::CreateApiRequest::api].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_cloud_apihub_v1::model::CreateApiRequest;
116 /// use google_cloud_apihub_v1::model::Api;
117 /// let x = CreateApiRequest::new().set_or_clear_api(Some(Api::default()/* use setters */));
118 /// let x = CreateApiRequest::new().set_or_clear_api(None::<Api>);
119 /// ```
120 pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
121 where
122 T: std::convert::Into<crate::model::Api>,
123 {
124 self.api = v.map(|x| x.into());
125 self
126 }
127}
128
129impl wkt::message::Message for CreateApiRequest {
130 fn typename() -> &'static str {
131 "type.googleapis.com/google.cloud.apihub.v1.CreateApiRequest"
132 }
133}
134
135/// The [GetApi][google.cloud.apihub.v1.ApiHub.GetApi] method's request.
136///
137/// [google.cloud.apihub.v1.ApiHub.GetApi]: crate::client::ApiHub::get_api
138#[derive(Clone, Default, PartialEq)]
139#[non_exhaustive]
140pub struct GetApiRequest {
141 /// Required. The name of the API resource to retrieve.
142 /// Format: `projects/{project}/locations/{location}/apis/{api}`
143 pub name: std::string::String,
144
145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
146}
147
148impl GetApiRequest {
149 pub fn new() -> Self {
150 std::default::Default::default()
151 }
152
153 /// Sets the value of [name][crate::model::GetApiRequest::name].
154 ///
155 /// # Example
156 /// ```ignore,no_run
157 /// # use google_cloud_apihub_v1::model::GetApiRequest;
158 /// let x = GetApiRequest::new().set_name("example");
159 /// ```
160 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
161 self.name = v.into();
162 self
163 }
164}
165
166impl wkt::message::Message for GetApiRequest {
167 fn typename() -> &'static str {
168 "type.googleapis.com/google.cloud.apihub.v1.GetApiRequest"
169 }
170}
171
172/// The [UpdateApi][google.cloud.apihub.v1.ApiHub.UpdateApi] method's request.
173///
174/// [google.cloud.apihub.v1.ApiHub.UpdateApi]: crate::client::ApiHub::update_api
175#[derive(Clone, Default, PartialEq)]
176#[non_exhaustive]
177pub struct UpdateApiRequest {
178 /// Required. The API resource to update.
179 ///
180 /// The API resource's `name` field is used to identify the API resource to
181 /// update.
182 /// Format: `projects/{project}/locations/{location}/apis/{api}`
183 pub api: std::option::Option<crate::model::Api>,
184
185 /// Required. The list of fields to update.
186 pub update_mask: std::option::Option<wkt::FieldMask>,
187
188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
189}
190
191impl UpdateApiRequest {
192 pub fn new() -> Self {
193 std::default::Default::default()
194 }
195
196 /// Sets the value of [api][crate::model::UpdateApiRequest::api].
197 ///
198 /// # Example
199 /// ```ignore,no_run
200 /// # use google_cloud_apihub_v1::model::UpdateApiRequest;
201 /// use google_cloud_apihub_v1::model::Api;
202 /// let x = UpdateApiRequest::new().set_api(Api::default()/* use setters */);
203 /// ```
204 pub fn set_api<T>(mut self, v: T) -> Self
205 where
206 T: std::convert::Into<crate::model::Api>,
207 {
208 self.api = std::option::Option::Some(v.into());
209 self
210 }
211
212 /// Sets or clears the value of [api][crate::model::UpdateApiRequest::api].
213 ///
214 /// # Example
215 /// ```ignore,no_run
216 /// # use google_cloud_apihub_v1::model::UpdateApiRequest;
217 /// use google_cloud_apihub_v1::model::Api;
218 /// let x = UpdateApiRequest::new().set_or_clear_api(Some(Api::default()/* use setters */));
219 /// let x = UpdateApiRequest::new().set_or_clear_api(None::<Api>);
220 /// ```
221 pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
222 where
223 T: std::convert::Into<crate::model::Api>,
224 {
225 self.api = v.map(|x| x.into());
226 self
227 }
228
229 /// Sets the value of [update_mask][crate::model::UpdateApiRequest::update_mask].
230 ///
231 /// # Example
232 /// ```ignore,no_run
233 /// # use google_cloud_apihub_v1::model::UpdateApiRequest;
234 /// use wkt::FieldMask;
235 /// let x = UpdateApiRequest::new().set_update_mask(FieldMask::default()/* use setters */);
236 /// ```
237 pub fn set_update_mask<T>(mut self, v: T) -> Self
238 where
239 T: std::convert::Into<wkt::FieldMask>,
240 {
241 self.update_mask = std::option::Option::Some(v.into());
242 self
243 }
244
245 /// Sets or clears the value of [update_mask][crate::model::UpdateApiRequest::update_mask].
246 ///
247 /// # Example
248 /// ```ignore,no_run
249 /// # use google_cloud_apihub_v1::model::UpdateApiRequest;
250 /// use wkt::FieldMask;
251 /// let x = UpdateApiRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
252 /// let x = UpdateApiRequest::new().set_or_clear_update_mask(None::<FieldMask>);
253 /// ```
254 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
255 where
256 T: std::convert::Into<wkt::FieldMask>,
257 {
258 self.update_mask = v.map(|x| x.into());
259 self
260 }
261}
262
263impl wkt::message::Message for UpdateApiRequest {
264 fn typename() -> &'static str {
265 "type.googleapis.com/google.cloud.apihub.v1.UpdateApiRequest"
266 }
267}
268
269/// The [DeleteApi][google.cloud.apihub.v1.ApiHub.DeleteApi] method's request.
270///
271/// [google.cloud.apihub.v1.ApiHub.DeleteApi]: crate::client::ApiHub::delete_api
272#[derive(Clone, Default, PartialEq)]
273#[non_exhaustive]
274pub struct DeleteApiRequest {
275 /// Required. The name of the API resource to delete.
276 /// Format: `projects/{project}/locations/{location}/apis/{api}`
277 pub name: std::string::String,
278
279 /// Optional. If set to true, any versions from this API will also be deleted.
280 /// Otherwise, the request will only work if the API has no versions.
281 pub force: bool,
282
283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
284}
285
286impl DeleteApiRequest {
287 pub fn new() -> Self {
288 std::default::Default::default()
289 }
290
291 /// Sets the value of [name][crate::model::DeleteApiRequest::name].
292 ///
293 /// # Example
294 /// ```ignore,no_run
295 /// # use google_cloud_apihub_v1::model::DeleteApiRequest;
296 /// let x = DeleteApiRequest::new().set_name("example");
297 /// ```
298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
299 self.name = v.into();
300 self
301 }
302
303 /// Sets the value of [force][crate::model::DeleteApiRequest::force].
304 ///
305 /// # Example
306 /// ```ignore,no_run
307 /// # use google_cloud_apihub_v1::model::DeleteApiRequest;
308 /// let x = DeleteApiRequest::new().set_force(true);
309 /// ```
310 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
311 self.force = v.into();
312 self
313 }
314}
315
316impl wkt::message::Message for DeleteApiRequest {
317 fn typename() -> &'static str {
318 "type.googleapis.com/google.cloud.apihub.v1.DeleteApiRequest"
319 }
320}
321
322/// The [ListApis][google.cloud.apihub.v1.ApiHub.ListApis] method's request.
323///
324/// [google.cloud.apihub.v1.ApiHub.ListApis]: crate::client::ApiHub::list_apis
325#[derive(Clone, Default, PartialEq)]
326#[non_exhaustive]
327pub struct ListApisRequest {
328 /// Required. The parent, which owns this collection of API resources.
329 /// Format: `projects/{project}/locations/{location}`
330 pub parent: std::string::String,
331
332 /// Optional. An expression that filters the list of ApiResources.
333 ///
334 /// A filter expression consists of a field name, a comparison
335 /// operator, and a value for filtering. The value must be a string. The
336 /// comparison operator must be one of: `<`, `>`, `:` or `=`. Filters are not
337 /// case sensitive.
338 ///
339 /// The following fields in the `ApiResource` are eligible for filtering:
340 ///
341 /// * `owner.email` - The email of the team which owns the ApiResource.
342 /// Allowed comparison operators: `=`.
343 /// * `create_time` - The time at which the ApiResource was created. The
344 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
345 /// format. Allowed comparison operators: `>` and `<`.
346 /// * `display_name` - The display name of the ApiResource. Allowed
347 /// comparison operators: `=`.
348 /// * `target_user.enum_values.values.id` - The allowed value id of the
349 /// target users attribute associated with the ApiResource. Allowed
350 /// comparison operator is `:`.
351 /// * `target_user.enum_values.values.display_name` - The allowed value
352 /// display name of the target users attribute associated with the
353 /// ApiResource. Allowed comparison operator is `:`.
354 /// * `team.enum_values.values.id` - The allowed value id of the team
355 /// attribute associated with the ApiResource. Allowed comparison operator is
356 /// `:`.
357 /// * `team.enum_values.values.display_name` - The allowed value display name
358 /// of the team attribute associated with the ApiResource. Allowed comparison
359 /// operator is `:`.
360 /// * `business_unit.enum_values.values.id` - The allowed value id of the
361 /// business unit attribute associated with the ApiResource. Allowed
362 /// comparison operator is `:`.
363 /// * `business_unit.enum_values.values.display_name` - The allowed value
364 /// display name of the business unit attribute associated with the
365 /// ApiResource. Allowed comparison operator is `:`.
366 /// * `maturity_level.enum_values.values.id` - The allowed value id of the
367 /// maturity level attribute associated with the ApiResource. Allowed
368 /// comparison operator is `:`.
369 /// * `maturity_level.enum_values.values.display_name` - The allowed value
370 /// display name of the maturity level attribute associated with the
371 /// ApiResource. Allowed comparison operator is `:`.
372 /// * `api_style.enum_values.values.id` - The allowed value id of the
373 /// api style attribute associated with the ApiResource. Allowed
374 /// comparison operator is `:`.
375 /// * `api_style.enum_values.values.display_name` - The allowed value display
376 /// name of the api style attribute associated with the ApiResource. Allowed
377 /// comparison operator is `:`.
378 /// * `attributes.projects/test-project-id/locations/test-location-id/
379 /// attributes/user-defined-attribute-id.enum_values.values.id` - The
380 /// allowed value id of the user defined enum attribute associated with the
381 /// Resource. Allowed comparison operator is `:`. Here
382 /// user-defined-attribute-enum-id is a placeholder that can be replaced with
383 /// any user defined enum attribute name.
384 /// * `attributes.projects/test-project-id/locations/test-location-id/
385 /// attributes/user-defined-attribute-id.enum_values.values.display_name`
386 ///
387 /// - The allowed value display name of the user defined enum attribute
388 /// associated with the Resource. Allowed comparison operator is `:`. Here
389 /// user-defined-attribute-enum-display-name is a placeholder that can be
390 /// replaced with any user defined enum attribute enum name.
391 ///
392 /// * `attributes.projects/test-project-id/locations/test-location-id/
393 /// attributes/user-defined-attribute-id.string_values.values` - The
394 /// allowed value of the user defined string attribute associated with the
395 /// Resource. Allowed comparison operator is `:`. Here
396 /// user-defined-attribute-string is a placeholder that can be replaced with
397 /// any user defined string attribute name.
398 /// * `attributes.projects/test-project-id/locations/test-location-id/
399 /// attributes/user-defined-attribute-id.json_values.values` - The
400 /// allowed value of the user defined JSON attribute associated with the
401 /// Resource. Allowed comparison operator is `:`. Here
402 /// user-defined-attribute-json is a placeholder that can be replaced with
403 /// any user defined JSON attribute name.
404 ///
405 /// A filter function is also supported in the filter string. The filter
406 /// function is `id(name)`. The `id(name)` function returns the id of the
407 /// resource name. For example, `id(name) = \"api-1\"` is equivalent to
408 /// `name = \"projects/test-project-id/locations/test-location-id/apis/api-1\"`
409 /// provided the parent is
410 /// `projects/test-project-id/locations/test-location-id`.
411 ///
412 /// Expressions are combined with either `AND` logic operator or `OR` logical
413 /// operator but not both of them together i.e. only one of the `AND` or `OR`
414 /// operator can be used throughout the filter string and both the operators
415 /// cannot be used together. No other logical operators are supported. At most
416 /// three filter fields are allowed in the filter string and if provided
417 /// more than that then `INVALID_ARGUMENT` error is returned by the API.
418 ///
419 /// Here are a few examples:
420 ///
421 /// * `owner.email = \"apihub@google.com\"` - - The owner team email is
422 /// _apihub@google.com_.
423 /// * `owner.email = \"apihub@google.com\" AND create_time <
424 /// \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
425 /// The owner team email is _apihub@google.com_ and the api was created
426 /// before _2021-08-15 14:50:00 UTC_ and after _2021-08-10 12:00:00 UTC_.
427 /// * `owner.email = \"apihub@google.com\" OR team.enum_values.values.id:
428 /// apihub-team-id` - The filter string specifies the APIs where the owner
429 /// team email is _apihub@google.com_ or the id of the allowed value
430 /// associated with the team attribute is _apihub-team-id_.
431 /// * `owner.email = \"apihub@google.com\" OR
432 /// team.enum_values.values.display_name: ApiHub Team` - The filter string
433 /// specifies the APIs where the owner team email is _apihub@google.com_ or
434 /// the display name of the allowed value associated with the team attribute
435 /// is `ApiHub Team`.
436 /// * `owner.email = \"apihub@google.com\" AND
437 /// attributes.projects/test-project-id/locations/test-location-id/
438 /// attributes/17650f90-4a29-4971-b3c0-d5532da3764b.enum_values.values.id:
439 /// test_enum_id AND
440 /// attributes.projects/test-project-id/locations/test-location-id/
441 /// attributes/1765\0f90-4a29-5431-b3d0-d5532da3764c.string_values.values:
442 /// test_string_value` - The filter string specifies the APIs where the
443 /// owner team email is _apihub@google.com_ and the id of the allowed value
444 /// associated with the user defined attribute of type enum is _test_enum_id_
445 /// and the value of the user defined attribute of type string is _test_..
446 pub filter: std::string::String,
447
448 /// Optional. The maximum number of API resources to return. The service may
449 /// return fewer than this value. If unspecified, at most 50 Apis will be
450 /// returned. The maximum value is 1000; values above 1000 will be coerced to
451 /// 1000.
452 pub page_size: i32,
453
454 /// Optional. A page token, received from a previous `ListApis` call.
455 /// Provide this to retrieve the subsequent page.
456 ///
457 /// When paginating, all other parameters (except page_size) provided to
458 /// `ListApis` must match the call that provided the page token.
459 pub page_token: std::string::String,
460
461 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
462}
463
464impl ListApisRequest {
465 pub fn new() -> Self {
466 std::default::Default::default()
467 }
468
469 /// Sets the value of [parent][crate::model::ListApisRequest::parent].
470 ///
471 /// # Example
472 /// ```ignore,no_run
473 /// # use google_cloud_apihub_v1::model::ListApisRequest;
474 /// let x = ListApisRequest::new().set_parent("example");
475 /// ```
476 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
477 self.parent = v.into();
478 self
479 }
480
481 /// Sets the value of [filter][crate::model::ListApisRequest::filter].
482 ///
483 /// # Example
484 /// ```ignore,no_run
485 /// # use google_cloud_apihub_v1::model::ListApisRequest;
486 /// let x = ListApisRequest::new().set_filter("example");
487 /// ```
488 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
489 self.filter = v.into();
490 self
491 }
492
493 /// Sets the value of [page_size][crate::model::ListApisRequest::page_size].
494 ///
495 /// # Example
496 /// ```ignore,no_run
497 /// # use google_cloud_apihub_v1::model::ListApisRequest;
498 /// let x = ListApisRequest::new().set_page_size(42);
499 /// ```
500 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
501 self.page_size = v.into();
502 self
503 }
504
505 /// Sets the value of [page_token][crate::model::ListApisRequest::page_token].
506 ///
507 /// # Example
508 /// ```ignore,no_run
509 /// # use google_cloud_apihub_v1::model::ListApisRequest;
510 /// let x = ListApisRequest::new().set_page_token("example");
511 /// ```
512 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
513 self.page_token = v.into();
514 self
515 }
516}
517
518impl wkt::message::Message for ListApisRequest {
519 fn typename() -> &'static str {
520 "type.googleapis.com/google.cloud.apihub.v1.ListApisRequest"
521 }
522}
523
524/// The [ListApis][google.cloud.apihub.v1.ApiHub.ListApis] method's response.
525///
526/// [google.cloud.apihub.v1.ApiHub.ListApis]: crate::client::ApiHub::list_apis
527#[derive(Clone, Default, PartialEq)]
528#[non_exhaustive]
529pub struct ListApisResponse {
530 /// The API resources present in the API hub.
531 pub apis: std::vec::Vec<crate::model::Api>,
532
533 /// A token, which can be sent as `page_token` to retrieve the next page.
534 /// If this field is omitted, there are no subsequent pages.
535 pub next_page_token: std::string::String,
536
537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
538}
539
540impl ListApisResponse {
541 pub fn new() -> Self {
542 std::default::Default::default()
543 }
544
545 /// Sets the value of [apis][crate::model::ListApisResponse::apis].
546 ///
547 /// # Example
548 /// ```ignore,no_run
549 /// # use google_cloud_apihub_v1::model::ListApisResponse;
550 /// use google_cloud_apihub_v1::model::Api;
551 /// let x = ListApisResponse::new()
552 /// .set_apis([
553 /// Api::default()/* use setters */,
554 /// Api::default()/* use (different) setters */,
555 /// ]);
556 /// ```
557 pub fn set_apis<T, V>(mut self, v: T) -> Self
558 where
559 T: std::iter::IntoIterator<Item = V>,
560 V: std::convert::Into<crate::model::Api>,
561 {
562 use std::iter::Iterator;
563 self.apis = v.into_iter().map(|i| i.into()).collect();
564 self
565 }
566
567 /// Sets the value of [next_page_token][crate::model::ListApisResponse::next_page_token].
568 ///
569 /// # Example
570 /// ```ignore,no_run
571 /// # use google_cloud_apihub_v1::model::ListApisResponse;
572 /// let x = ListApisResponse::new().set_next_page_token("example");
573 /// ```
574 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
575 self.next_page_token = v.into();
576 self
577 }
578}
579
580impl wkt::message::Message for ListApisResponse {
581 fn typename() -> &'static str {
582 "type.googleapis.com/google.cloud.apihub.v1.ListApisResponse"
583 }
584}
585
586#[doc(hidden)]
587impl google_cloud_gax::paginator::internal::PageableResponse for ListApisResponse {
588 type PageItem = crate::model::Api;
589
590 fn items(self) -> std::vec::Vec<Self::PageItem> {
591 self.apis
592 }
593
594 fn next_page_token(&self) -> std::string::String {
595 use std::clone::Clone;
596 self.next_page_token.clone()
597 }
598}
599
600/// The [CreateVersion][google.cloud.apihub.v1.ApiHub.CreateVersion] method's
601/// request.
602///
603/// [google.cloud.apihub.v1.ApiHub.CreateVersion]: crate::client::ApiHub::create_version
604#[derive(Clone, Default, PartialEq)]
605#[non_exhaustive]
606pub struct CreateVersionRequest {
607 /// Required. The parent resource for API version.
608 /// Format: `projects/{project}/locations/{location}/apis/{api}`
609 pub parent: std::string::String,
610
611 /// Optional. The ID to use for the API version, which will become the final
612 /// component of the version's resource name. This field is optional.
613 ///
614 /// * If provided, the same will be used. The service will throw an error if
615 /// the specified id is already used by another version in the API resource.
616 /// * If not provided, a system generated id will be used.
617 ///
618 /// This value should be 4-500 characters, overall resource name which will be
619 /// of format
620 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`,
621 /// its length is limited to 700 characters and valid characters are
622 /// /[a-z][A-Z][0-9]-_/.
623 pub version_id: std::string::String,
624
625 /// Required. The version to create.
626 pub version: std::option::Option<crate::model::Version>,
627
628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
629}
630
631impl CreateVersionRequest {
632 pub fn new() -> Self {
633 std::default::Default::default()
634 }
635
636 /// Sets the value of [parent][crate::model::CreateVersionRequest::parent].
637 ///
638 /// # Example
639 /// ```ignore,no_run
640 /// # use google_cloud_apihub_v1::model::CreateVersionRequest;
641 /// let x = CreateVersionRequest::new().set_parent("example");
642 /// ```
643 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
644 self.parent = v.into();
645 self
646 }
647
648 /// Sets the value of [version_id][crate::model::CreateVersionRequest::version_id].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_apihub_v1::model::CreateVersionRequest;
653 /// let x = CreateVersionRequest::new().set_version_id("example");
654 /// ```
655 pub fn set_version_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
656 self.version_id = v.into();
657 self
658 }
659
660 /// Sets the value of [version][crate::model::CreateVersionRequest::version].
661 ///
662 /// # Example
663 /// ```ignore,no_run
664 /// # use google_cloud_apihub_v1::model::CreateVersionRequest;
665 /// use google_cloud_apihub_v1::model::Version;
666 /// let x = CreateVersionRequest::new().set_version(Version::default()/* use setters */);
667 /// ```
668 pub fn set_version<T>(mut self, v: T) -> Self
669 where
670 T: std::convert::Into<crate::model::Version>,
671 {
672 self.version = std::option::Option::Some(v.into());
673 self
674 }
675
676 /// Sets or clears the value of [version][crate::model::CreateVersionRequest::version].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_apihub_v1::model::CreateVersionRequest;
681 /// use google_cloud_apihub_v1::model::Version;
682 /// let x = CreateVersionRequest::new().set_or_clear_version(Some(Version::default()/* use setters */));
683 /// let x = CreateVersionRequest::new().set_or_clear_version(None::<Version>);
684 /// ```
685 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
686 where
687 T: std::convert::Into<crate::model::Version>,
688 {
689 self.version = v.map(|x| x.into());
690 self
691 }
692}
693
694impl wkt::message::Message for CreateVersionRequest {
695 fn typename() -> &'static str {
696 "type.googleapis.com/google.cloud.apihub.v1.CreateVersionRequest"
697 }
698}
699
700/// The [GetVersion][google.cloud.apihub.v1.ApiHub.GetVersion] method's request.
701///
702/// [google.cloud.apihub.v1.ApiHub.GetVersion]: crate::client::ApiHub::get_version
703#[derive(Clone, Default, PartialEq)]
704#[non_exhaustive]
705pub struct GetVersionRequest {
706 /// Required. The name of the API version to retrieve.
707 /// Format:
708 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
709 pub name: std::string::String,
710
711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
712}
713
714impl GetVersionRequest {
715 pub fn new() -> Self {
716 std::default::Default::default()
717 }
718
719 /// Sets the value of [name][crate::model::GetVersionRequest::name].
720 ///
721 /// # Example
722 /// ```ignore,no_run
723 /// # use google_cloud_apihub_v1::model::GetVersionRequest;
724 /// let x = GetVersionRequest::new().set_name("example");
725 /// ```
726 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
727 self.name = v.into();
728 self
729 }
730}
731
732impl wkt::message::Message for GetVersionRequest {
733 fn typename() -> &'static str {
734 "type.googleapis.com/google.cloud.apihub.v1.GetVersionRequest"
735 }
736}
737
738/// The [UpdateVersion][google.cloud.apihub.v1.ApiHub.UpdateVersion] method's
739/// request.
740///
741/// [google.cloud.apihub.v1.ApiHub.UpdateVersion]: crate::client::ApiHub::update_version
742#[derive(Clone, Default, PartialEq)]
743#[non_exhaustive]
744pub struct UpdateVersionRequest {
745 /// Required. The API version to update.
746 ///
747 /// The version's `name` field is used to identify the API version to update.
748 /// Format:
749 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
750 pub version: std::option::Option<crate::model::Version>,
751
752 /// Required. The list of fields to update.
753 pub update_mask: std::option::Option<wkt::FieldMask>,
754
755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
756}
757
758impl UpdateVersionRequest {
759 pub fn new() -> Self {
760 std::default::Default::default()
761 }
762
763 /// Sets the value of [version][crate::model::UpdateVersionRequest::version].
764 ///
765 /// # Example
766 /// ```ignore,no_run
767 /// # use google_cloud_apihub_v1::model::UpdateVersionRequest;
768 /// use google_cloud_apihub_v1::model::Version;
769 /// let x = UpdateVersionRequest::new().set_version(Version::default()/* use setters */);
770 /// ```
771 pub fn set_version<T>(mut self, v: T) -> Self
772 where
773 T: std::convert::Into<crate::model::Version>,
774 {
775 self.version = std::option::Option::Some(v.into());
776 self
777 }
778
779 /// Sets or clears the value of [version][crate::model::UpdateVersionRequest::version].
780 ///
781 /// # Example
782 /// ```ignore,no_run
783 /// # use google_cloud_apihub_v1::model::UpdateVersionRequest;
784 /// use google_cloud_apihub_v1::model::Version;
785 /// let x = UpdateVersionRequest::new().set_or_clear_version(Some(Version::default()/* use setters */));
786 /// let x = UpdateVersionRequest::new().set_or_clear_version(None::<Version>);
787 /// ```
788 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
789 where
790 T: std::convert::Into<crate::model::Version>,
791 {
792 self.version = v.map(|x| x.into());
793 self
794 }
795
796 /// Sets the value of [update_mask][crate::model::UpdateVersionRequest::update_mask].
797 ///
798 /// # Example
799 /// ```ignore,no_run
800 /// # use google_cloud_apihub_v1::model::UpdateVersionRequest;
801 /// use wkt::FieldMask;
802 /// let x = UpdateVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
803 /// ```
804 pub fn set_update_mask<T>(mut self, v: T) -> Self
805 where
806 T: std::convert::Into<wkt::FieldMask>,
807 {
808 self.update_mask = std::option::Option::Some(v.into());
809 self
810 }
811
812 /// Sets or clears the value of [update_mask][crate::model::UpdateVersionRequest::update_mask].
813 ///
814 /// # Example
815 /// ```ignore,no_run
816 /// # use google_cloud_apihub_v1::model::UpdateVersionRequest;
817 /// use wkt::FieldMask;
818 /// let x = UpdateVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
819 /// let x = UpdateVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
820 /// ```
821 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
822 where
823 T: std::convert::Into<wkt::FieldMask>,
824 {
825 self.update_mask = v.map(|x| x.into());
826 self
827 }
828}
829
830impl wkt::message::Message for UpdateVersionRequest {
831 fn typename() -> &'static str {
832 "type.googleapis.com/google.cloud.apihub.v1.UpdateVersionRequest"
833 }
834}
835
836/// The [DeleteVersion][google.cloud.apihub.v1.ApiHub.DeleteVersion] method's
837/// request.
838///
839/// [google.cloud.apihub.v1.ApiHub.DeleteVersion]: crate::client::ApiHub::delete_version
840#[derive(Clone, Default, PartialEq)]
841#[non_exhaustive]
842pub struct DeleteVersionRequest {
843 /// Required. The name of the version to delete.
844 /// Format:
845 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
846 pub name: std::string::String,
847
848 /// Optional. If set to true, any specs from this version will also be deleted.
849 /// Otherwise, the request will only work if the version has no specs.
850 pub force: bool,
851
852 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
853}
854
855impl DeleteVersionRequest {
856 pub fn new() -> Self {
857 std::default::Default::default()
858 }
859
860 /// Sets the value of [name][crate::model::DeleteVersionRequest::name].
861 ///
862 /// # Example
863 /// ```ignore,no_run
864 /// # use google_cloud_apihub_v1::model::DeleteVersionRequest;
865 /// let x = DeleteVersionRequest::new().set_name("example");
866 /// ```
867 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
868 self.name = v.into();
869 self
870 }
871
872 /// Sets the value of [force][crate::model::DeleteVersionRequest::force].
873 ///
874 /// # Example
875 /// ```ignore,no_run
876 /// # use google_cloud_apihub_v1::model::DeleteVersionRequest;
877 /// let x = DeleteVersionRequest::new().set_force(true);
878 /// ```
879 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
880 self.force = v.into();
881 self
882 }
883}
884
885impl wkt::message::Message for DeleteVersionRequest {
886 fn typename() -> &'static str {
887 "type.googleapis.com/google.cloud.apihub.v1.DeleteVersionRequest"
888 }
889}
890
891/// The [ListVersions][google.cloud.apihub.v1.ApiHub.ListVersions] method's
892/// request.
893///
894/// [google.cloud.apihub.v1.ApiHub.ListVersions]: crate::client::ApiHub::list_versions
895#[derive(Clone, Default, PartialEq)]
896#[non_exhaustive]
897pub struct ListVersionsRequest {
898 /// Required. The parent which owns this collection of API versions i.e., the
899 /// API resource Format: `projects/{project}/locations/{location}/apis/{api}`
900 pub parent: std::string::String,
901
902 /// Optional. An expression that filters the list of Versions.
903 ///
904 /// A filter expression consists of a field name, a comparison
905 /// operator, and a value for filtering. The value must be a string, a
906 /// number, or a boolean. The comparison operator must be one of: `<`, `>` or
907 /// `=`. Filters are not case sensitive.
908 ///
909 /// The following fields in the `Version` are eligible for filtering:
910 ///
911 /// * `display_name` - The display name of the Version. Allowed
912 /// comparison operators: `=`.
913 /// * `create_time` - The time at which the Version was created. The
914 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
915 /// format. Allowed comparison operators: `>` and `<`.
916 /// * `lifecycle.enum_values.values.id` - The allowed value id of the
917 /// lifecycle attribute associated with the Version. Allowed comparison
918 /// operators: `:`.
919 /// * `lifecycle.enum_values.values.display_name` - The allowed value display
920 /// name of the lifecycle attribute associated with the Version. Allowed
921 /// comparison operators: `:`.
922 /// * `compliance.enum_values.values.id` - The allowed value id of the
923 /// compliances attribute associated with the Version. Allowed comparison
924 /// operators: `:`.
925 /// * `compliance.enum_values.values.display_name` - The allowed value
926 /// display name of the compliances attribute associated with the Version.
927 /// Allowed comparison operators: `:`.
928 /// * `accreditation.enum_values.values.id` - The allowed value id of the
929 /// accreditations attribute associated with the Version. Allowed
930 /// comparison operators: `:`.
931 /// * `accreditation.enum_values.values.display_name` - The allowed value
932 /// display name of the accreditations attribute associated with the Version.
933 /// Allowed comparison operators: `:`.
934 /// * `attributes.projects/test-project-id/locations/test-location-id/
935 /// attributes/user-defined-attribute-id.enum_values.values.id` - The
936 /// allowed value id of the user defined enum attribute associated with the
937 /// Resource. Allowed comparison operator is `:`. Here
938 /// user-defined-attribute-enum-id is a placeholder that can be replaced with
939 /// any user defined enum attribute name.
940 /// * `attributes.projects/test-project-id/locations/test-location-id/
941 /// attributes/user-defined-attribute-id.enum_values.values.display_name`
942 ///
943 /// - The allowed value display name of the user defined enum attribute
944 /// associated with the Resource. Allowed comparison operator is `:`. Here
945 /// user-defined-attribute-enum-display-name is a placeholder that can be
946 /// replaced with any user defined enum attribute enum name.
947 ///
948 /// * `attributes.projects/test-project-id/locations/test-location-id/
949 /// attributes/user-defined-attribute-id.string_values.values` - The
950 /// allowed value of the user defined string attribute associated with the
951 /// Resource. Allowed comparison operator is `:`. Here
952 /// user-defined-attribute-string is a placeholder that can be replaced with
953 /// any user defined string attribute name.
954 /// * `attributes.projects/test-project-id/locations/test-location-id/
955 /// attributes/user-defined-attribute-id.json_values.values` - The
956 /// allowed value of the user defined JSON attribute associated with the
957 /// Resource. Allowed comparison operator is `:`. Here
958 /// user-defined-attribute-json is a placeholder that can be replaced with
959 /// any user defined JSON attribute name.
960 ///
961 /// Expressions are combined with either `AND` logic operator or `OR` logical
962 /// operator but not both of them together i.e. only one of the `AND` or `OR`
963 /// operator can be used throughout the filter string and both the operators
964 /// cannot be used together. No other logical operators are
965 /// supported. At most three filter fields are allowed in the filter
966 /// string and if provided more than that then `INVALID_ARGUMENT` error is
967 /// returned by the API.
968 ///
969 /// Here are a few examples:
970 ///
971 /// * `lifecycle.enum_values.values.id: preview-id` - The filter string
972 /// specifies that the id of the allowed value associated with the lifecycle
973 /// attribute of the Version is _preview-id_.
974 /// * `lifecycle.enum_values.values.display_name: \"Preview Display Name\"` -
975 /// The filter string specifies that the display name of the allowed value
976 /// associated with the lifecycle attribute of the Version is `Preview
977 /// Display Name`.
978 /// * `lifecycle.enum_values.values.id: preview-id AND create_time <
979 /// \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
980 /// The id of the allowed value associated with the lifecycle attribute of
981 /// the Version is _preview-id_ and it was created before _2021-08-15
982 /// 14:50:00 UTC_ and after _2021-08-10 12:00:00 UTC_.
983 /// * `compliance.enum_values.values.id: gdpr-id OR
984 /// compliance.enum_values.values.id: pci-dss-id`
985 ///
986 /// - The id of the allowed value associated with the compliance attribute is
987 /// _gdpr-id_ or _pci-dss-id_.
988 ///
989 /// * `lifecycle.enum_values.values.id: preview-id AND
990 /// attributes.projects/test-project-id/locations/test-location-id/
991 /// attributes/17650f90-4a29-4971-b3c0-d5532da3764b.string_values.values:
992 /// test` - The filter string specifies that the id of the allowed value
993 /// associated with the lifecycle attribute of the Version is _preview-id_
994 /// and the value of the user defined attribute of type string is _test_.
995 pub filter: std::string::String,
996
997 /// Optional. The maximum number of versions to return. The service may return
998 /// fewer than this value. If unspecified, at most 50 versions will be
999 /// returned. The maximum value is 1000; values above 1000 will be coerced to
1000 /// 1000.
1001 pub page_size: i32,
1002
1003 /// Optional. A page token, received from a previous `ListVersions` call.
1004 /// Provide this to retrieve the subsequent page.
1005 ///
1006 /// When paginating, all other parameters (except page_size) provided to
1007 /// `ListVersions` must match the call that provided the page token.
1008 pub page_token: std::string::String,
1009
1010 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1011}
1012
1013impl ListVersionsRequest {
1014 pub fn new() -> Self {
1015 std::default::Default::default()
1016 }
1017
1018 /// Sets the value of [parent][crate::model::ListVersionsRequest::parent].
1019 ///
1020 /// # Example
1021 /// ```ignore,no_run
1022 /// # use google_cloud_apihub_v1::model::ListVersionsRequest;
1023 /// let x = ListVersionsRequest::new().set_parent("example");
1024 /// ```
1025 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1026 self.parent = v.into();
1027 self
1028 }
1029
1030 /// Sets the value of [filter][crate::model::ListVersionsRequest::filter].
1031 ///
1032 /// # Example
1033 /// ```ignore,no_run
1034 /// # use google_cloud_apihub_v1::model::ListVersionsRequest;
1035 /// let x = ListVersionsRequest::new().set_filter("example");
1036 /// ```
1037 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1038 self.filter = v.into();
1039 self
1040 }
1041
1042 /// Sets the value of [page_size][crate::model::ListVersionsRequest::page_size].
1043 ///
1044 /// # Example
1045 /// ```ignore,no_run
1046 /// # use google_cloud_apihub_v1::model::ListVersionsRequest;
1047 /// let x = ListVersionsRequest::new().set_page_size(42);
1048 /// ```
1049 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1050 self.page_size = v.into();
1051 self
1052 }
1053
1054 /// Sets the value of [page_token][crate::model::ListVersionsRequest::page_token].
1055 ///
1056 /// # Example
1057 /// ```ignore,no_run
1058 /// # use google_cloud_apihub_v1::model::ListVersionsRequest;
1059 /// let x = ListVersionsRequest::new().set_page_token("example");
1060 /// ```
1061 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1062 self.page_token = v.into();
1063 self
1064 }
1065}
1066
1067impl wkt::message::Message for ListVersionsRequest {
1068 fn typename() -> &'static str {
1069 "type.googleapis.com/google.cloud.apihub.v1.ListVersionsRequest"
1070 }
1071}
1072
1073/// The [ListVersions][google.cloud.apihub.v1.ApiHub.ListVersions] method's
1074/// response.
1075///
1076/// [google.cloud.apihub.v1.ApiHub.ListVersions]: crate::client::ApiHub::list_versions
1077#[derive(Clone, Default, PartialEq)]
1078#[non_exhaustive]
1079pub struct ListVersionsResponse {
1080 /// The versions corresponding to an API.
1081 pub versions: std::vec::Vec<crate::model::Version>,
1082
1083 /// A token, which can be sent as `page_token` to retrieve the next page.
1084 /// If this field is omitted, there are no subsequent pages.
1085 pub next_page_token: std::string::String,
1086
1087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1088}
1089
1090impl ListVersionsResponse {
1091 pub fn new() -> Self {
1092 std::default::Default::default()
1093 }
1094
1095 /// Sets the value of [versions][crate::model::ListVersionsResponse::versions].
1096 ///
1097 /// # Example
1098 /// ```ignore,no_run
1099 /// # use google_cloud_apihub_v1::model::ListVersionsResponse;
1100 /// use google_cloud_apihub_v1::model::Version;
1101 /// let x = ListVersionsResponse::new()
1102 /// .set_versions([
1103 /// Version::default()/* use setters */,
1104 /// Version::default()/* use (different) setters */,
1105 /// ]);
1106 /// ```
1107 pub fn set_versions<T, V>(mut self, v: T) -> Self
1108 where
1109 T: std::iter::IntoIterator<Item = V>,
1110 V: std::convert::Into<crate::model::Version>,
1111 {
1112 use std::iter::Iterator;
1113 self.versions = v.into_iter().map(|i| i.into()).collect();
1114 self
1115 }
1116
1117 /// Sets the value of [next_page_token][crate::model::ListVersionsResponse::next_page_token].
1118 ///
1119 /// # Example
1120 /// ```ignore,no_run
1121 /// # use google_cloud_apihub_v1::model::ListVersionsResponse;
1122 /// let x = ListVersionsResponse::new().set_next_page_token("example");
1123 /// ```
1124 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1125 self.next_page_token = v.into();
1126 self
1127 }
1128}
1129
1130impl wkt::message::Message for ListVersionsResponse {
1131 fn typename() -> &'static str {
1132 "type.googleapis.com/google.cloud.apihub.v1.ListVersionsResponse"
1133 }
1134}
1135
1136#[doc(hidden)]
1137impl google_cloud_gax::paginator::internal::PageableResponse for ListVersionsResponse {
1138 type PageItem = crate::model::Version;
1139
1140 fn items(self) -> std::vec::Vec<Self::PageItem> {
1141 self.versions
1142 }
1143
1144 fn next_page_token(&self) -> std::string::String {
1145 use std::clone::Clone;
1146 self.next_page_token.clone()
1147 }
1148}
1149
1150/// The [CreateSpec][google.cloud.apihub.v1.ApiHub.CreateSpec] method's request.
1151///
1152/// [google.cloud.apihub.v1.ApiHub.CreateSpec]: crate::client::ApiHub::create_spec
1153#[derive(Clone, Default, PartialEq)]
1154#[non_exhaustive]
1155pub struct CreateSpecRequest {
1156 /// Required. The parent resource for Spec.
1157 /// Format:
1158 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
1159 pub parent: std::string::String,
1160
1161 /// Optional. The ID to use for the spec, which will become the final component
1162 /// of the spec's resource name. This field is optional.
1163 ///
1164 /// * If provided, the same will be used. The service will throw an error if
1165 /// the specified id is already used by another spec in the API
1166 /// resource.
1167 /// * If not provided, a system generated id will be used.
1168 ///
1169 /// This value should be 4-500 characters, overall resource name which will be
1170 /// of format
1171 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`,
1172 /// its length is limited to 1000 characters and valid characters are
1173 /// /[a-z][A-Z][0-9]-_/.
1174 pub spec_id: std::string::String,
1175
1176 /// Required. The spec to create.
1177 pub spec: std::option::Option<crate::model::Spec>,
1178
1179 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1180}
1181
1182impl CreateSpecRequest {
1183 pub fn new() -> Self {
1184 std::default::Default::default()
1185 }
1186
1187 /// Sets the value of [parent][crate::model::CreateSpecRequest::parent].
1188 ///
1189 /// # Example
1190 /// ```ignore,no_run
1191 /// # use google_cloud_apihub_v1::model::CreateSpecRequest;
1192 /// let x = CreateSpecRequest::new().set_parent("example");
1193 /// ```
1194 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1195 self.parent = v.into();
1196 self
1197 }
1198
1199 /// Sets the value of [spec_id][crate::model::CreateSpecRequest::spec_id].
1200 ///
1201 /// # Example
1202 /// ```ignore,no_run
1203 /// # use google_cloud_apihub_v1::model::CreateSpecRequest;
1204 /// let x = CreateSpecRequest::new().set_spec_id("example");
1205 /// ```
1206 pub fn set_spec_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1207 self.spec_id = v.into();
1208 self
1209 }
1210
1211 /// Sets the value of [spec][crate::model::CreateSpecRequest::spec].
1212 ///
1213 /// # Example
1214 /// ```ignore,no_run
1215 /// # use google_cloud_apihub_v1::model::CreateSpecRequest;
1216 /// use google_cloud_apihub_v1::model::Spec;
1217 /// let x = CreateSpecRequest::new().set_spec(Spec::default()/* use setters */);
1218 /// ```
1219 pub fn set_spec<T>(mut self, v: T) -> Self
1220 where
1221 T: std::convert::Into<crate::model::Spec>,
1222 {
1223 self.spec = std::option::Option::Some(v.into());
1224 self
1225 }
1226
1227 /// Sets or clears the value of [spec][crate::model::CreateSpecRequest::spec].
1228 ///
1229 /// # Example
1230 /// ```ignore,no_run
1231 /// # use google_cloud_apihub_v1::model::CreateSpecRequest;
1232 /// use google_cloud_apihub_v1::model::Spec;
1233 /// let x = CreateSpecRequest::new().set_or_clear_spec(Some(Spec::default()/* use setters */));
1234 /// let x = CreateSpecRequest::new().set_or_clear_spec(None::<Spec>);
1235 /// ```
1236 pub fn set_or_clear_spec<T>(mut self, v: std::option::Option<T>) -> Self
1237 where
1238 T: std::convert::Into<crate::model::Spec>,
1239 {
1240 self.spec = v.map(|x| x.into());
1241 self
1242 }
1243}
1244
1245impl wkt::message::Message for CreateSpecRequest {
1246 fn typename() -> &'static str {
1247 "type.googleapis.com/google.cloud.apihub.v1.CreateSpecRequest"
1248 }
1249}
1250
1251/// The [GetSpec][google.cloud.apihub.v1.ApiHub.GetSpec] method's request.
1252///
1253/// [google.cloud.apihub.v1.ApiHub.GetSpec]: crate::client::ApiHub::get_spec
1254#[derive(Clone, Default, PartialEq)]
1255#[non_exhaustive]
1256pub struct GetSpecRequest {
1257 /// Required. The name of the spec to retrieve.
1258 /// Format:
1259 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
1260 pub name: std::string::String,
1261
1262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1263}
1264
1265impl GetSpecRequest {
1266 pub fn new() -> Self {
1267 std::default::Default::default()
1268 }
1269
1270 /// Sets the value of [name][crate::model::GetSpecRequest::name].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_apihub_v1::model::GetSpecRequest;
1275 /// let x = GetSpecRequest::new().set_name("example");
1276 /// ```
1277 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1278 self.name = v.into();
1279 self
1280 }
1281}
1282
1283impl wkt::message::Message for GetSpecRequest {
1284 fn typename() -> &'static str {
1285 "type.googleapis.com/google.cloud.apihub.v1.GetSpecRequest"
1286 }
1287}
1288
1289/// The [UpdateSpec][google.cloud.apihub.v1.ApiHub.UpdateSpec] method's request.
1290///
1291/// [google.cloud.apihub.v1.ApiHub.UpdateSpec]: crate::client::ApiHub::update_spec
1292#[derive(Clone, Default, PartialEq)]
1293#[non_exhaustive]
1294pub struct UpdateSpecRequest {
1295 /// Required. The spec to update.
1296 ///
1297 /// The spec's `name` field is used to identify the spec to
1298 /// update. Format:
1299 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
1300 pub spec: std::option::Option<crate::model::Spec>,
1301
1302 /// Required. The list of fields to update.
1303 pub update_mask: std::option::Option<wkt::FieldMask>,
1304
1305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1306}
1307
1308impl UpdateSpecRequest {
1309 pub fn new() -> Self {
1310 std::default::Default::default()
1311 }
1312
1313 /// Sets the value of [spec][crate::model::UpdateSpecRequest::spec].
1314 ///
1315 /// # Example
1316 /// ```ignore,no_run
1317 /// # use google_cloud_apihub_v1::model::UpdateSpecRequest;
1318 /// use google_cloud_apihub_v1::model::Spec;
1319 /// let x = UpdateSpecRequest::new().set_spec(Spec::default()/* use setters */);
1320 /// ```
1321 pub fn set_spec<T>(mut self, v: T) -> Self
1322 where
1323 T: std::convert::Into<crate::model::Spec>,
1324 {
1325 self.spec = std::option::Option::Some(v.into());
1326 self
1327 }
1328
1329 /// Sets or clears the value of [spec][crate::model::UpdateSpecRequest::spec].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_apihub_v1::model::UpdateSpecRequest;
1334 /// use google_cloud_apihub_v1::model::Spec;
1335 /// let x = UpdateSpecRequest::new().set_or_clear_spec(Some(Spec::default()/* use setters */));
1336 /// let x = UpdateSpecRequest::new().set_or_clear_spec(None::<Spec>);
1337 /// ```
1338 pub fn set_or_clear_spec<T>(mut self, v: std::option::Option<T>) -> Self
1339 where
1340 T: std::convert::Into<crate::model::Spec>,
1341 {
1342 self.spec = v.map(|x| x.into());
1343 self
1344 }
1345
1346 /// Sets the value of [update_mask][crate::model::UpdateSpecRequest::update_mask].
1347 ///
1348 /// # Example
1349 /// ```ignore,no_run
1350 /// # use google_cloud_apihub_v1::model::UpdateSpecRequest;
1351 /// use wkt::FieldMask;
1352 /// let x = UpdateSpecRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1353 /// ```
1354 pub fn set_update_mask<T>(mut self, v: T) -> Self
1355 where
1356 T: std::convert::Into<wkt::FieldMask>,
1357 {
1358 self.update_mask = std::option::Option::Some(v.into());
1359 self
1360 }
1361
1362 /// Sets or clears the value of [update_mask][crate::model::UpdateSpecRequest::update_mask].
1363 ///
1364 /// # Example
1365 /// ```ignore,no_run
1366 /// # use google_cloud_apihub_v1::model::UpdateSpecRequest;
1367 /// use wkt::FieldMask;
1368 /// let x = UpdateSpecRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1369 /// let x = UpdateSpecRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1370 /// ```
1371 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1372 where
1373 T: std::convert::Into<wkt::FieldMask>,
1374 {
1375 self.update_mask = v.map(|x| x.into());
1376 self
1377 }
1378}
1379
1380impl wkt::message::Message for UpdateSpecRequest {
1381 fn typename() -> &'static str {
1382 "type.googleapis.com/google.cloud.apihub.v1.UpdateSpecRequest"
1383 }
1384}
1385
1386/// The [DeleteSpec][google.cloud.apihub.v1.ApiHub.DeleteSpec] method's request.
1387///
1388/// [google.cloud.apihub.v1.ApiHub.DeleteSpec]: crate::client::ApiHub::delete_spec
1389#[derive(Clone, Default, PartialEq)]
1390#[non_exhaustive]
1391pub struct DeleteSpecRequest {
1392 /// Required. The name of the spec to delete.
1393 /// Format:
1394 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
1395 pub name: std::string::String,
1396
1397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1398}
1399
1400impl DeleteSpecRequest {
1401 pub fn new() -> Self {
1402 std::default::Default::default()
1403 }
1404
1405 /// Sets the value of [name][crate::model::DeleteSpecRequest::name].
1406 ///
1407 /// # Example
1408 /// ```ignore,no_run
1409 /// # use google_cloud_apihub_v1::model::DeleteSpecRequest;
1410 /// let x = DeleteSpecRequest::new().set_name("example");
1411 /// ```
1412 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1413 self.name = v.into();
1414 self
1415 }
1416}
1417
1418impl wkt::message::Message for DeleteSpecRequest {
1419 fn typename() -> &'static str {
1420 "type.googleapis.com/google.cloud.apihub.v1.DeleteSpecRequest"
1421 }
1422}
1423
1424/// The [ListSpecs][ListSpecs] method's request.
1425#[derive(Clone, Default, PartialEq)]
1426#[non_exhaustive]
1427pub struct ListSpecsRequest {
1428 /// Required. The parent, which owns this collection of specs.
1429 /// Format:
1430 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
1431 pub parent: std::string::String,
1432
1433 /// Optional. An expression that filters the list of Specs.
1434 ///
1435 /// A filter expression consists of a field name, a comparison
1436 /// operator, and a value for filtering. The value must be a string. The
1437 /// comparison operator must be one of: `<`, `>`, `:` or `=`. Filters are not
1438 /// case sensitive.
1439 ///
1440 /// The following fields in the `Spec` are eligible for filtering:
1441 ///
1442 /// * `display_name` - The display name of the Spec. Allowed comparison
1443 /// operators: `=`.
1444 /// * `create_time` - The time at which the Spec was created. The
1445 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
1446 /// format. Allowed comparison operators: `>` and `<`.
1447 /// * `spec_type.enum_values.values.id` - The allowed value id of the
1448 /// spec_type attribute associated with the Spec. Allowed comparison
1449 /// operators: `:`.
1450 /// * `spec_type.enum_values.values.display_name` - The allowed value display
1451 /// name of the spec_type attribute associated with the Spec. Allowed
1452 /// comparison operators: `:`.
1453 /// * `lint_response.json_values.values` - The json value of the
1454 /// lint_response attribute associated with the Spec. Allowed comparison
1455 /// operators: `:`.
1456 /// * `mime_type` - The MIME type of the Spec. Allowed comparison
1457 /// operators: `=`.
1458 /// * `attributes.projects/test-project-id/locations/test-location-id/
1459 /// attributes/user-defined-attribute-id.enum_values.values.id` - The
1460 /// allowed value id of the user defined enum attribute associated with the
1461 /// Resource. Allowed comparison operator is `:`. Here
1462 /// user-defined-attribute-enum-id is a placeholder that can be replaced with
1463 /// any user defined enum attribute name.
1464 /// * `attributes.projects/test-project-id/locations/test-location-id/
1465 /// attributes/user-defined-attribute-id.enum_values.values.display_name`
1466 ///
1467 /// - The allowed value display name of the user defined enum attribute
1468 /// associated with the Resource. Allowed comparison operator is `:`. Here
1469 /// user-defined-attribute-enum-display-name is a placeholder that can be
1470 /// replaced with any user defined enum attribute enum name.
1471 ///
1472 /// * `attributes.projects/test-project-id/locations/test-location-id/
1473 /// attributes/user-defined-attribute-id.string_values.values` - The
1474 /// allowed value of the user defined string attribute associated with the
1475 /// Resource. Allowed comparison operator is `:`. Here
1476 /// user-defined-attribute-string is a placeholder that can be replaced with
1477 /// any user defined string attribute name.
1478 /// * `attributes.projects/test-project-id/locations/test-location-id/
1479 /// attributes/user-defined-attribute-id.json_values.values` - The
1480 /// allowed value of the user defined JSON attribute associated with the
1481 /// Resource. Allowed comparison operator is `:`. Here
1482 /// user-defined-attribute-json is a placeholder that can be replaced with
1483 /// any user defined JSON attribute name.
1484 ///
1485 /// Expressions are combined with either `AND` logic operator or `OR` logical
1486 /// operator but not both of them together i.e. only one of the `AND` or `OR`
1487 /// operator can be used throughout the filter string and both the operators
1488 /// cannot be used together. No other logical operators are
1489 /// supported. At most three filter fields are allowed in the filter
1490 /// string and if provided more than that then `INVALID_ARGUMENT` error is
1491 /// returned by the API.
1492 ///
1493 /// Here are a few examples:
1494 ///
1495 /// * `spec_type.enum_values.values.id: rest-id` - The filter
1496 /// string specifies that the id of the allowed value associated with the
1497 /// spec_type attribute is _rest-id_.
1498 /// * `spec_type.enum_values.values.display_name: \"Rest Display Name\"` -
1499 /// The filter string specifies that the display name of the allowed value
1500 /// associated with the spec_type attribute is `Rest Display Name`.
1501 /// * `spec_type.enum_values.values.id: grpc-id AND create_time <
1502 /// \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
1503 /// The id of the allowed value associated with the spec_type attribute is
1504 /// _grpc-id_ and the spec was created before _2021-08-15 14:50:00 UTC_ and
1505 /// after _2021-08-10 12:00:00 UTC_.
1506 /// * `spec_type.enum_values.values.id: rest-id OR
1507 /// spec_type.enum_values.values.id: grpc-id`
1508 ///
1509 /// - The id of the allowed value associated with the spec_type attribute is
1510 /// _rest-id_ or _grpc-id_.
1511 ///
1512 /// * `spec_type.enum_values.values.id: rest-id AND
1513 /// attributes.projects/test-project-id/locations/test-location-id/
1514 /// attributes/17650f90-4a29-4971-b3c0-d5532da3764b.enum_values.values.id:
1515 /// test` - The filter string specifies that the id of the allowed value
1516 /// associated with the spec_type attribute is _rest-id_ and the id of the
1517 /// allowed value associated with the user defined attribute of type enum is
1518 /// _test_.
1519 pub filter: std::string::String,
1520
1521 /// Optional. The maximum number of specs to return. The service may return
1522 /// fewer than this value. If unspecified, at most 50 specs will be
1523 /// returned. The maximum value is 1000; values above 1000 will be coerced to
1524 /// 1000.
1525 pub page_size: i32,
1526
1527 /// Optional. A page token, received from a previous `ListSpecs` call.
1528 /// Provide this to retrieve the subsequent page.
1529 ///
1530 /// When paginating, all other parameters provided to `ListSpecs` must
1531 /// match the call that provided the page token.
1532 pub page_token: std::string::String,
1533
1534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1535}
1536
1537impl ListSpecsRequest {
1538 pub fn new() -> Self {
1539 std::default::Default::default()
1540 }
1541
1542 /// Sets the value of [parent][crate::model::ListSpecsRequest::parent].
1543 ///
1544 /// # Example
1545 /// ```ignore,no_run
1546 /// # use google_cloud_apihub_v1::model::ListSpecsRequest;
1547 /// let x = ListSpecsRequest::new().set_parent("example");
1548 /// ```
1549 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1550 self.parent = v.into();
1551 self
1552 }
1553
1554 /// Sets the value of [filter][crate::model::ListSpecsRequest::filter].
1555 ///
1556 /// # Example
1557 /// ```ignore,no_run
1558 /// # use google_cloud_apihub_v1::model::ListSpecsRequest;
1559 /// let x = ListSpecsRequest::new().set_filter("example");
1560 /// ```
1561 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.filter = v.into();
1563 self
1564 }
1565
1566 /// Sets the value of [page_size][crate::model::ListSpecsRequest::page_size].
1567 ///
1568 /// # Example
1569 /// ```ignore,no_run
1570 /// # use google_cloud_apihub_v1::model::ListSpecsRequest;
1571 /// let x = ListSpecsRequest::new().set_page_size(42);
1572 /// ```
1573 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1574 self.page_size = v.into();
1575 self
1576 }
1577
1578 /// Sets the value of [page_token][crate::model::ListSpecsRequest::page_token].
1579 ///
1580 /// # Example
1581 /// ```ignore,no_run
1582 /// # use google_cloud_apihub_v1::model::ListSpecsRequest;
1583 /// let x = ListSpecsRequest::new().set_page_token("example");
1584 /// ```
1585 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1586 self.page_token = v.into();
1587 self
1588 }
1589}
1590
1591impl wkt::message::Message for ListSpecsRequest {
1592 fn typename() -> &'static str {
1593 "type.googleapis.com/google.cloud.apihub.v1.ListSpecsRequest"
1594 }
1595}
1596
1597/// The [ListSpecs][google.cloud.apihub.v1.ApiHub.ListSpecs] method's response.
1598///
1599/// [google.cloud.apihub.v1.ApiHub.ListSpecs]: crate::client::ApiHub::list_specs
1600#[derive(Clone, Default, PartialEq)]
1601#[non_exhaustive]
1602pub struct ListSpecsResponse {
1603 /// The specs corresponding to an API Version.
1604 pub specs: std::vec::Vec<crate::model::Spec>,
1605
1606 /// A token, which can be sent as `page_token` to retrieve the next page.
1607 /// If this field is omitted, there are no subsequent pages.
1608 pub next_page_token: std::string::String,
1609
1610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1611}
1612
1613impl ListSpecsResponse {
1614 pub fn new() -> Self {
1615 std::default::Default::default()
1616 }
1617
1618 /// Sets the value of [specs][crate::model::ListSpecsResponse::specs].
1619 ///
1620 /// # Example
1621 /// ```ignore,no_run
1622 /// # use google_cloud_apihub_v1::model::ListSpecsResponse;
1623 /// use google_cloud_apihub_v1::model::Spec;
1624 /// let x = ListSpecsResponse::new()
1625 /// .set_specs([
1626 /// Spec::default()/* use setters */,
1627 /// Spec::default()/* use (different) setters */,
1628 /// ]);
1629 /// ```
1630 pub fn set_specs<T, V>(mut self, v: T) -> Self
1631 where
1632 T: std::iter::IntoIterator<Item = V>,
1633 V: std::convert::Into<crate::model::Spec>,
1634 {
1635 use std::iter::Iterator;
1636 self.specs = v.into_iter().map(|i| i.into()).collect();
1637 self
1638 }
1639
1640 /// Sets the value of [next_page_token][crate::model::ListSpecsResponse::next_page_token].
1641 ///
1642 /// # Example
1643 /// ```ignore,no_run
1644 /// # use google_cloud_apihub_v1::model::ListSpecsResponse;
1645 /// let x = ListSpecsResponse::new().set_next_page_token("example");
1646 /// ```
1647 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1648 self.next_page_token = v.into();
1649 self
1650 }
1651}
1652
1653impl wkt::message::Message for ListSpecsResponse {
1654 fn typename() -> &'static str {
1655 "type.googleapis.com/google.cloud.apihub.v1.ListSpecsResponse"
1656 }
1657}
1658
1659#[doc(hidden)]
1660impl google_cloud_gax::paginator::internal::PageableResponse for ListSpecsResponse {
1661 type PageItem = crate::model::Spec;
1662
1663 fn items(self) -> std::vec::Vec<Self::PageItem> {
1664 self.specs
1665 }
1666
1667 fn next_page_token(&self) -> std::string::String {
1668 use std::clone::Clone;
1669 self.next_page_token.clone()
1670 }
1671}
1672
1673/// The [GetSpecContents][google.cloud.apihub.v1.ApiHub.GetSpecContents] method's
1674/// request.
1675///
1676/// [google.cloud.apihub.v1.ApiHub.GetSpecContents]: crate::client::ApiHub::get_spec_contents
1677#[derive(Clone, Default, PartialEq)]
1678#[non_exhaustive]
1679pub struct GetSpecContentsRequest {
1680 /// Required. The name of the spec whose contents need to be retrieved.
1681 /// Format:
1682 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
1683 pub name: std::string::String,
1684
1685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1686}
1687
1688impl GetSpecContentsRequest {
1689 pub fn new() -> Self {
1690 std::default::Default::default()
1691 }
1692
1693 /// Sets the value of [name][crate::model::GetSpecContentsRequest::name].
1694 ///
1695 /// # Example
1696 /// ```ignore,no_run
1697 /// # use google_cloud_apihub_v1::model::GetSpecContentsRequest;
1698 /// let x = GetSpecContentsRequest::new().set_name("example");
1699 /// ```
1700 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1701 self.name = v.into();
1702 self
1703 }
1704}
1705
1706impl wkt::message::Message for GetSpecContentsRequest {
1707 fn typename() -> &'static str {
1708 "type.googleapis.com/google.cloud.apihub.v1.GetSpecContentsRequest"
1709 }
1710}
1711
1712/// The [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation]
1713/// method's request.
1714///
1715/// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
1716#[derive(Clone, Default, PartialEq)]
1717#[non_exhaustive]
1718pub struct CreateApiOperationRequest {
1719 /// Required. The parent resource for the operation resource.
1720 /// Format:
1721 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
1722 pub parent: std::string::String,
1723
1724 /// Optional. The ID to use for the operation resource, which will become the
1725 /// final component of the operation's resource name. This field is optional.
1726 ///
1727 /// * If provided, the same will be used. The service will throw an error if
1728 /// the specified id is already used by another operation resource in the API
1729 /// hub.
1730 /// * If not provided, a system generated id will be used.
1731 ///
1732 /// This value should be 4-500 characters, overall resource name which
1733 /// will be of format
1734 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`,
1735 /// its length is limited to 700 characters, and valid characters are
1736 /// /[a-z][A-Z][0-9]-_/.
1737 pub api_operation_id: std::string::String,
1738
1739 /// Required. The operation resource to create.
1740 pub api_operation: std::option::Option<crate::model::ApiOperation>,
1741
1742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1743}
1744
1745impl CreateApiOperationRequest {
1746 pub fn new() -> Self {
1747 std::default::Default::default()
1748 }
1749
1750 /// Sets the value of [parent][crate::model::CreateApiOperationRequest::parent].
1751 ///
1752 /// # Example
1753 /// ```ignore,no_run
1754 /// # use google_cloud_apihub_v1::model::CreateApiOperationRequest;
1755 /// let x = CreateApiOperationRequest::new().set_parent("example");
1756 /// ```
1757 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1758 self.parent = v.into();
1759 self
1760 }
1761
1762 /// Sets the value of [api_operation_id][crate::model::CreateApiOperationRequest::api_operation_id].
1763 ///
1764 /// # Example
1765 /// ```ignore,no_run
1766 /// # use google_cloud_apihub_v1::model::CreateApiOperationRequest;
1767 /// let x = CreateApiOperationRequest::new().set_api_operation_id("example");
1768 /// ```
1769 pub fn set_api_operation_id<T: std::convert::Into<std::string::String>>(
1770 mut self,
1771 v: T,
1772 ) -> Self {
1773 self.api_operation_id = v.into();
1774 self
1775 }
1776
1777 /// Sets the value of [api_operation][crate::model::CreateApiOperationRequest::api_operation].
1778 ///
1779 /// # Example
1780 /// ```ignore,no_run
1781 /// # use google_cloud_apihub_v1::model::CreateApiOperationRequest;
1782 /// use google_cloud_apihub_v1::model::ApiOperation;
1783 /// let x = CreateApiOperationRequest::new().set_api_operation(ApiOperation::default()/* use setters */);
1784 /// ```
1785 pub fn set_api_operation<T>(mut self, v: T) -> Self
1786 where
1787 T: std::convert::Into<crate::model::ApiOperation>,
1788 {
1789 self.api_operation = std::option::Option::Some(v.into());
1790 self
1791 }
1792
1793 /// Sets or clears the value of [api_operation][crate::model::CreateApiOperationRequest::api_operation].
1794 ///
1795 /// # Example
1796 /// ```ignore,no_run
1797 /// # use google_cloud_apihub_v1::model::CreateApiOperationRequest;
1798 /// use google_cloud_apihub_v1::model::ApiOperation;
1799 /// let x = CreateApiOperationRequest::new().set_or_clear_api_operation(Some(ApiOperation::default()/* use setters */));
1800 /// let x = CreateApiOperationRequest::new().set_or_clear_api_operation(None::<ApiOperation>);
1801 /// ```
1802 pub fn set_or_clear_api_operation<T>(mut self, v: std::option::Option<T>) -> Self
1803 where
1804 T: std::convert::Into<crate::model::ApiOperation>,
1805 {
1806 self.api_operation = v.map(|x| x.into());
1807 self
1808 }
1809}
1810
1811impl wkt::message::Message for CreateApiOperationRequest {
1812 fn typename() -> &'static str {
1813 "type.googleapis.com/google.cloud.apihub.v1.CreateApiOperationRequest"
1814 }
1815}
1816
1817/// The [GetApiOperation][google.cloud.apihub.v1.ApiHub.GetApiOperation] method's
1818/// request.
1819///
1820/// [google.cloud.apihub.v1.ApiHub.GetApiOperation]: crate::client::ApiHub::get_api_operation
1821#[derive(Clone, Default, PartialEq)]
1822#[non_exhaustive]
1823pub struct GetApiOperationRequest {
1824 /// Required. The name of the operation to retrieve.
1825 /// Format:
1826 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
1827 pub name: std::string::String,
1828
1829 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1830}
1831
1832impl GetApiOperationRequest {
1833 pub fn new() -> Self {
1834 std::default::Default::default()
1835 }
1836
1837 /// Sets the value of [name][crate::model::GetApiOperationRequest::name].
1838 ///
1839 /// # Example
1840 /// ```ignore,no_run
1841 /// # use google_cloud_apihub_v1::model::GetApiOperationRequest;
1842 /// let x = GetApiOperationRequest::new().set_name("example");
1843 /// ```
1844 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.name = v.into();
1846 self
1847 }
1848}
1849
1850impl wkt::message::Message for GetApiOperationRequest {
1851 fn typename() -> &'static str {
1852 "type.googleapis.com/google.cloud.apihub.v1.GetApiOperationRequest"
1853 }
1854}
1855
1856/// The [UpdateApiOperation][google.cloud.apihub.v1.ApiHub.UpdateApiOperation]
1857/// method's request.
1858///
1859/// [google.cloud.apihub.v1.ApiHub.UpdateApiOperation]: crate::client::ApiHub::update_api_operation
1860#[derive(Clone, Default, PartialEq)]
1861#[non_exhaustive]
1862pub struct UpdateApiOperationRequest {
1863 /// Required. The apiOperation resource to update.
1864 ///
1865 /// The operation resource's `name` field is used to identify the operation
1866 /// resource to update.
1867 /// Format:
1868 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
1869 pub api_operation: std::option::Option<crate::model::ApiOperation>,
1870
1871 /// Required. The list of fields to update.
1872 pub update_mask: std::option::Option<wkt::FieldMask>,
1873
1874 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1875}
1876
1877impl UpdateApiOperationRequest {
1878 pub fn new() -> Self {
1879 std::default::Default::default()
1880 }
1881
1882 /// Sets the value of [api_operation][crate::model::UpdateApiOperationRequest::api_operation].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_apihub_v1::model::UpdateApiOperationRequest;
1887 /// use google_cloud_apihub_v1::model::ApiOperation;
1888 /// let x = UpdateApiOperationRequest::new().set_api_operation(ApiOperation::default()/* use setters */);
1889 /// ```
1890 pub fn set_api_operation<T>(mut self, v: T) -> Self
1891 where
1892 T: std::convert::Into<crate::model::ApiOperation>,
1893 {
1894 self.api_operation = std::option::Option::Some(v.into());
1895 self
1896 }
1897
1898 /// Sets or clears the value of [api_operation][crate::model::UpdateApiOperationRequest::api_operation].
1899 ///
1900 /// # Example
1901 /// ```ignore,no_run
1902 /// # use google_cloud_apihub_v1::model::UpdateApiOperationRequest;
1903 /// use google_cloud_apihub_v1::model::ApiOperation;
1904 /// let x = UpdateApiOperationRequest::new().set_or_clear_api_operation(Some(ApiOperation::default()/* use setters */));
1905 /// let x = UpdateApiOperationRequest::new().set_or_clear_api_operation(None::<ApiOperation>);
1906 /// ```
1907 pub fn set_or_clear_api_operation<T>(mut self, v: std::option::Option<T>) -> Self
1908 where
1909 T: std::convert::Into<crate::model::ApiOperation>,
1910 {
1911 self.api_operation = v.map(|x| x.into());
1912 self
1913 }
1914
1915 /// Sets the value of [update_mask][crate::model::UpdateApiOperationRequest::update_mask].
1916 ///
1917 /// # Example
1918 /// ```ignore,no_run
1919 /// # use google_cloud_apihub_v1::model::UpdateApiOperationRequest;
1920 /// use wkt::FieldMask;
1921 /// let x = UpdateApiOperationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1922 /// ```
1923 pub fn set_update_mask<T>(mut self, v: T) -> Self
1924 where
1925 T: std::convert::Into<wkt::FieldMask>,
1926 {
1927 self.update_mask = std::option::Option::Some(v.into());
1928 self
1929 }
1930
1931 /// Sets or clears the value of [update_mask][crate::model::UpdateApiOperationRequest::update_mask].
1932 ///
1933 /// # Example
1934 /// ```ignore,no_run
1935 /// # use google_cloud_apihub_v1::model::UpdateApiOperationRequest;
1936 /// use wkt::FieldMask;
1937 /// let x = UpdateApiOperationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1938 /// let x = UpdateApiOperationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1939 /// ```
1940 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1941 where
1942 T: std::convert::Into<wkt::FieldMask>,
1943 {
1944 self.update_mask = v.map(|x| x.into());
1945 self
1946 }
1947}
1948
1949impl wkt::message::Message for UpdateApiOperationRequest {
1950 fn typename() -> &'static str {
1951 "type.googleapis.com/google.cloud.apihub.v1.UpdateApiOperationRequest"
1952 }
1953}
1954
1955/// The [DeleteApiOperation][google.cloud.apihub.v1.ApiHub.DeleteApiOperation]
1956/// method's request.
1957///
1958/// [google.cloud.apihub.v1.ApiHub.DeleteApiOperation]: crate::client::ApiHub::delete_api_operation
1959#[derive(Clone, Default, PartialEq)]
1960#[non_exhaustive]
1961pub struct DeleteApiOperationRequest {
1962 /// Required. The name of the operation resource to delete.
1963 /// Format:
1964 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
1965 pub name: std::string::String,
1966
1967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1968}
1969
1970impl DeleteApiOperationRequest {
1971 pub fn new() -> Self {
1972 std::default::Default::default()
1973 }
1974
1975 /// Sets the value of [name][crate::model::DeleteApiOperationRequest::name].
1976 ///
1977 /// # Example
1978 /// ```ignore,no_run
1979 /// # use google_cloud_apihub_v1::model::DeleteApiOperationRequest;
1980 /// let x = DeleteApiOperationRequest::new().set_name("example");
1981 /// ```
1982 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.name = v.into();
1984 self
1985 }
1986}
1987
1988impl wkt::message::Message for DeleteApiOperationRequest {
1989 fn typename() -> &'static str {
1990 "type.googleapis.com/google.cloud.apihub.v1.DeleteApiOperationRequest"
1991 }
1992}
1993
1994/// The [ListApiOperations][google.cloud.apihub.v1.ApiHub.ListApiOperations]
1995/// method's request.
1996///
1997/// [google.cloud.apihub.v1.ApiHub.ListApiOperations]: crate::client::ApiHub::list_api_operations
1998#[derive(Clone, Default, PartialEq)]
1999#[non_exhaustive]
2000pub struct ListApiOperationsRequest {
2001 /// Required. The parent which owns this collection of operations i.e., the API
2002 /// version. Format:
2003 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
2004 pub parent: std::string::String,
2005
2006 /// Optional. An expression that filters the list of ApiOperations.
2007 ///
2008 /// A filter expression consists of a field name, a comparison
2009 /// operator, and a value for filtering. The value must be a string or a
2010 /// boolean. The comparison operator must be one of: `<`, `>` or
2011 /// `=`. Filters are not case sensitive.
2012 ///
2013 /// The following fields in the `ApiOperation` are eligible for filtering:
2014 ///
2015 /// * `name` - The ApiOperation resource name. Allowed comparison
2016 /// operators:
2017 /// `=`.
2018 /// * `details.http_operation.path.path` - The http operation's complete path
2019 /// relative to server endpoint. Allowed comparison operators: `=`.
2020 /// * `details.http_operation.method` - The http operation method type.
2021 /// Allowed comparison operators: `=`.
2022 /// * `details.deprecated` - Indicates if the ApiOperation is deprecated.
2023 /// Allowed values are True / False indicating the deprycation status of the
2024 /// ApiOperation. Allowed comparison operators: `=`.
2025 /// * `create_time` - The time at which the ApiOperation was created. The
2026 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
2027 /// format. Allowed comparison operators: `>` and `<`.
2028 /// * `attributes.projects/test-project-id/locations/test-location-id/
2029 /// attributes/user-defined-attribute-id.enum_values.values.id` - The
2030 /// allowed value id of the user defined enum attribute associated with the
2031 /// Resource. Allowed comparison operator is `:`. Here
2032 /// user-defined-attribute-enum-id is a placeholder that can be replaced with
2033 /// any user defined enum attribute name.
2034 /// * `attributes.projects/test-project-id/locations/test-location-id/
2035 /// attributes/user-defined-attribute-id.enum_values.values.display_name`
2036 ///
2037 /// - The allowed value display name of the user defined enum attribute
2038 /// associated with the Resource. Allowed comparison operator is `:`. Here
2039 /// user-defined-attribute-enum-display-name is a placeholder that can be
2040 /// replaced with any user defined enum attribute enum name.
2041 ///
2042 /// * `attributes.projects/test-project-id/locations/test-location-id/
2043 /// attributes/user-defined-attribute-id.string_values.values` - The
2044 /// allowed value of the user defined string attribute associated with the
2045 /// Resource. Allowed comparison operator is `:`. Here
2046 /// user-defined-attribute-string is a placeholder that can be replaced with
2047 /// any user defined string attribute name.
2048 /// * `attributes.projects/test-project-id/locations/test-location-id/
2049 /// attributes/user-defined-attribute-id.json_values.values` - The
2050 /// allowed value of the user defined JSON attribute associated with the
2051 /// Resource. Allowed comparison operator is `:`. Here
2052 /// user-defined-attribute-json is a placeholder that can be replaced with
2053 /// any user defined JSON attribute name.
2054 ///
2055 /// Expressions are combined with either `AND` logic operator or `OR` logical
2056 /// operator but not both of them together i.e. only one of the `AND` or `OR`
2057 /// operator can be used throughout the filter string and both the operators
2058 /// cannot be used together. No other logical operators are supported. At most
2059 /// three filter fields are allowed in the filter string and if provided
2060 /// more than that then `INVALID_ARGUMENT` error is returned by the API.
2061 ///
2062 /// Here are a few examples:
2063 ///
2064 /// * `details.deprecated = True` - The ApiOperation is deprecated.
2065 /// * `details.http_operation.method = GET AND create_time <
2066 /// \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
2067 /// The method of the http operation of the ApiOperation is _GET_ and the
2068 /// spec was created before _2021-08-15 14:50:00 UTC_ and after _2021-08-10
2069 /// 12:00:00 UTC_.
2070 /// * `details.http_operation.method = GET OR details.http_operation.method =
2071 /// POST`. - The http operation of the method of ApiOperation is _GET_ or
2072 /// _POST_.
2073 /// * `details.deprecated = True AND
2074 /// attributes.projects/test-project-id/locations/test-location-id/
2075 /// attributes/17650f90-4a29-4971-b3c0-d5532da3764b.string_values.values:
2076 /// test` - The filter string specifies that the ApiOperation is deprecated
2077 /// and the value of the user defined attribute of type string is _test_.
2078 pub filter: std::string::String,
2079
2080 /// Optional. The maximum number of operations to return. The service may
2081 /// return fewer than this value. If unspecified, at most 50 operations will be
2082 /// returned. The maximum value is 1000; values above 1000 will be coerced to
2083 /// 1000.
2084 pub page_size: i32,
2085
2086 /// Optional. A page token, received from a previous `ListApiOperations` call.
2087 /// Provide this to retrieve the subsequent page.
2088 ///
2089 /// When paginating, all other parameters (except page_size) provided to
2090 /// `ListApiOperations` must match the call that provided the page token.
2091 pub page_token: std::string::String,
2092
2093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2094}
2095
2096impl ListApiOperationsRequest {
2097 pub fn new() -> Self {
2098 std::default::Default::default()
2099 }
2100
2101 /// Sets the value of [parent][crate::model::ListApiOperationsRequest::parent].
2102 ///
2103 /// # Example
2104 /// ```ignore,no_run
2105 /// # use google_cloud_apihub_v1::model::ListApiOperationsRequest;
2106 /// let x = ListApiOperationsRequest::new().set_parent("example");
2107 /// ```
2108 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2109 self.parent = v.into();
2110 self
2111 }
2112
2113 /// Sets the value of [filter][crate::model::ListApiOperationsRequest::filter].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_apihub_v1::model::ListApiOperationsRequest;
2118 /// let x = ListApiOperationsRequest::new().set_filter("example");
2119 /// ```
2120 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2121 self.filter = v.into();
2122 self
2123 }
2124
2125 /// Sets the value of [page_size][crate::model::ListApiOperationsRequest::page_size].
2126 ///
2127 /// # Example
2128 /// ```ignore,no_run
2129 /// # use google_cloud_apihub_v1::model::ListApiOperationsRequest;
2130 /// let x = ListApiOperationsRequest::new().set_page_size(42);
2131 /// ```
2132 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2133 self.page_size = v.into();
2134 self
2135 }
2136
2137 /// Sets the value of [page_token][crate::model::ListApiOperationsRequest::page_token].
2138 ///
2139 /// # Example
2140 /// ```ignore,no_run
2141 /// # use google_cloud_apihub_v1::model::ListApiOperationsRequest;
2142 /// let x = ListApiOperationsRequest::new().set_page_token("example");
2143 /// ```
2144 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2145 self.page_token = v.into();
2146 self
2147 }
2148}
2149
2150impl wkt::message::Message for ListApiOperationsRequest {
2151 fn typename() -> &'static str {
2152 "type.googleapis.com/google.cloud.apihub.v1.ListApiOperationsRequest"
2153 }
2154}
2155
2156/// The [ListApiOperations][google.cloud.apihub.v1.ApiHub.ListApiOperations]
2157/// method's response.
2158///
2159/// [google.cloud.apihub.v1.ApiHub.ListApiOperations]: crate::client::ApiHub::list_api_operations
2160#[derive(Clone, Default, PartialEq)]
2161#[non_exhaustive]
2162pub struct ListApiOperationsResponse {
2163 /// The operations corresponding to an API version.
2164 pub api_operations: std::vec::Vec<crate::model::ApiOperation>,
2165
2166 /// A token, which can be sent as `page_token` to retrieve the next page.
2167 /// If this field is omitted, there are no subsequent pages.
2168 pub next_page_token: std::string::String,
2169
2170 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2171}
2172
2173impl ListApiOperationsResponse {
2174 pub fn new() -> Self {
2175 std::default::Default::default()
2176 }
2177
2178 /// Sets the value of [api_operations][crate::model::ListApiOperationsResponse::api_operations].
2179 ///
2180 /// # Example
2181 /// ```ignore,no_run
2182 /// # use google_cloud_apihub_v1::model::ListApiOperationsResponse;
2183 /// use google_cloud_apihub_v1::model::ApiOperation;
2184 /// let x = ListApiOperationsResponse::new()
2185 /// .set_api_operations([
2186 /// ApiOperation::default()/* use setters */,
2187 /// ApiOperation::default()/* use (different) setters */,
2188 /// ]);
2189 /// ```
2190 pub fn set_api_operations<T, V>(mut self, v: T) -> Self
2191 where
2192 T: std::iter::IntoIterator<Item = V>,
2193 V: std::convert::Into<crate::model::ApiOperation>,
2194 {
2195 use std::iter::Iterator;
2196 self.api_operations = v.into_iter().map(|i| i.into()).collect();
2197 self
2198 }
2199
2200 /// Sets the value of [next_page_token][crate::model::ListApiOperationsResponse::next_page_token].
2201 ///
2202 /// # Example
2203 /// ```ignore,no_run
2204 /// # use google_cloud_apihub_v1::model::ListApiOperationsResponse;
2205 /// let x = ListApiOperationsResponse::new().set_next_page_token("example");
2206 /// ```
2207 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2208 self.next_page_token = v.into();
2209 self
2210 }
2211}
2212
2213impl wkt::message::Message for ListApiOperationsResponse {
2214 fn typename() -> &'static str {
2215 "type.googleapis.com/google.cloud.apihub.v1.ListApiOperationsResponse"
2216 }
2217}
2218
2219#[doc(hidden)]
2220impl google_cloud_gax::paginator::internal::PageableResponse for ListApiOperationsResponse {
2221 type PageItem = crate::model::ApiOperation;
2222
2223 fn items(self) -> std::vec::Vec<Self::PageItem> {
2224 self.api_operations
2225 }
2226
2227 fn next_page_token(&self) -> std::string::String {
2228 use std::clone::Clone;
2229 self.next_page_token.clone()
2230 }
2231}
2232
2233/// The [GetDefinition][google.cloud.apihub.v1.ApiHub.GetDefinition] method's
2234/// request.
2235///
2236/// [google.cloud.apihub.v1.ApiHub.GetDefinition]: crate::client::ApiHub::get_definition
2237#[derive(Clone, Default, PartialEq)]
2238#[non_exhaustive]
2239pub struct GetDefinitionRequest {
2240 /// Required. The name of the definition to retrieve.
2241 /// Format:
2242 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}`
2243 pub name: std::string::String,
2244
2245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2246}
2247
2248impl GetDefinitionRequest {
2249 pub fn new() -> Self {
2250 std::default::Default::default()
2251 }
2252
2253 /// Sets the value of [name][crate::model::GetDefinitionRequest::name].
2254 ///
2255 /// # Example
2256 /// ```ignore,no_run
2257 /// # use google_cloud_apihub_v1::model::GetDefinitionRequest;
2258 /// let x = GetDefinitionRequest::new().set_name("example");
2259 /// ```
2260 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2261 self.name = v.into();
2262 self
2263 }
2264}
2265
2266impl wkt::message::Message for GetDefinitionRequest {
2267 fn typename() -> &'static str {
2268 "type.googleapis.com/google.cloud.apihub.v1.GetDefinitionRequest"
2269 }
2270}
2271
2272/// The [CreateDeployment][google.cloud.apihub.v1.ApiHub.CreateDeployment]
2273/// method's request.
2274///
2275/// [google.cloud.apihub.v1.ApiHub.CreateDeployment]: crate::client::ApiHub::create_deployment
2276#[derive(Clone, Default, PartialEq)]
2277#[non_exhaustive]
2278pub struct CreateDeploymentRequest {
2279 /// Required. The parent resource for the deployment resource.
2280 /// Format: `projects/{project}/locations/{location}`
2281 pub parent: std::string::String,
2282
2283 /// Optional. The ID to use for the deployment resource, which will become the
2284 /// final component of the deployment's resource name. This field is optional.
2285 ///
2286 /// * If provided, the same will be used. The service will throw an error if
2287 /// the specified id is already used by another deployment resource in the API
2288 /// hub.
2289 /// * If not provided, a system generated id will be used.
2290 ///
2291 /// This value should be 4-500 characters, and valid characters
2292 /// are /[a-z][A-Z][0-9]-_/.
2293 pub deployment_id: std::string::String,
2294
2295 /// Required. The deployment resource to create.
2296 pub deployment: std::option::Option<crate::model::Deployment>,
2297
2298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2299}
2300
2301impl CreateDeploymentRequest {
2302 pub fn new() -> Self {
2303 std::default::Default::default()
2304 }
2305
2306 /// Sets the value of [parent][crate::model::CreateDeploymentRequest::parent].
2307 ///
2308 /// # Example
2309 /// ```ignore,no_run
2310 /// # use google_cloud_apihub_v1::model::CreateDeploymentRequest;
2311 /// let x = CreateDeploymentRequest::new().set_parent("example");
2312 /// ```
2313 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2314 self.parent = v.into();
2315 self
2316 }
2317
2318 /// Sets the value of [deployment_id][crate::model::CreateDeploymentRequest::deployment_id].
2319 ///
2320 /// # Example
2321 /// ```ignore,no_run
2322 /// # use google_cloud_apihub_v1::model::CreateDeploymentRequest;
2323 /// let x = CreateDeploymentRequest::new().set_deployment_id("example");
2324 /// ```
2325 pub fn set_deployment_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2326 self.deployment_id = v.into();
2327 self
2328 }
2329
2330 /// Sets the value of [deployment][crate::model::CreateDeploymentRequest::deployment].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_apihub_v1::model::CreateDeploymentRequest;
2335 /// use google_cloud_apihub_v1::model::Deployment;
2336 /// let x = CreateDeploymentRequest::new().set_deployment(Deployment::default()/* use setters */);
2337 /// ```
2338 pub fn set_deployment<T>(mut self, v: T) -> Self
2339 where
2340 T: std::convert::Into<crate::model::Deployment>,
2341 {
2342 self.deployment = std::option::Option::Some(v.into());
2343 self
2344 }
2345
2346 /// Sets or clears the value of [deployment][crate::model::CreateDeploymentRequest::deployment].
2347 ///
2348 /// # Example
2349 /// ```ignore,no_run
2350 /// # use google_cloud_apihub_v1::model::CreateDeploymentRequest;
2351 /// use google_cloud_apihub_v1::model::Deployment;
2352 /// let x = CreateDeploymentRequest::new().set_or_clear_deployment(Some(Deployment::default()/* use setters */));
2353 /// let x = CreateDeploymentRequest::new().set_or_clear_deployment(None::<Deployment>);
2354 /// ```
2355 pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
2356 where
2357 T: std::convert::Into<crate::model::Deployment>,
2358 {
2359 self.deployment = v.map(|x| x.into());
2360 self
2361 }
2362}
2363
2364impl wkt::message::Message for CreateDeploymentRequest {
2365 fn typename() -> &'static str {
2366 "type.googleapis.com/google.cloud.apihub.v1.CreateDeploymentRequest"
2367 }
2368}
2369
2370/// The [GetDeployment][google.cloud.apihub.v1.ApiHub.GetDeployment] method's
2371/// request.
2372///
2373/// [google.cloud.apihub.v1.ApiHub.GetDeployment]: crate::client::ApiHub::get_deployment
2374#[derive(Clone, Default, PartialEq)]
2375#[non_exhaustive]
2376pub struct GetDeploymentRequest {
2377 /// Required. The name of the deployment resource to retrieve.
2378 /// Format: `projects/{project}/locations/{location}/deployments/{deployment}`
2379 pub name: std::string::String,
2380
2381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2382}
2383
2384impl GetDeploymentRequest {
2385 pub fn new() -> Self {
2386 std::default::Default::default()
2387 }
2388
2389 /// Sets the value of [name][crate::model::GetDeploymentRequest::name].
2390 ///
2391 /// # Example
2392 /// ```ignore,no_run
2393 /// # use google_cloud_apihub_v1::model::GetDeploymentRequest;
2394 /// let x = GetDeploymentRequest::new().set_name("example");
2395 /// ```
2396 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2397 self.name = v.into();
2398 self
2399 }
2400}
2401
2402impl wkt::message::Message for GetDeploymentRequest {
2403 fn typename() -> &'static str {
2404 "type.googleapis.com/google.cloud.apihub.v1.GetDeploymentRequest"
2405 }
2406}
2407
2408/// The [UpdateDeployment][google.cloud.apihub.v1.ApiHub.UpdateDeployment]
2409/// method's request.
2410///
2411/// [google.cloud.apihub.v1.ApiHub.UpdateDeployment]: crate::client::ApiHub::update_deployment
2412#[derive(Clone, Default, PartialEq)]
2413#[non_exhaustive]
2414pub struct UpdateDeploymentRequest {
2415 /// Required. The deployment resource to update.
2416 ///
2417 /// The deployment resource's `name` field is used to identify the deployment
2418 /// resource to update.
2419 /// Format: `projects/{project}/locations/{location}/deployments/{deployment}`
2420 pub deployment: std::option::Option<crate::model::Deployment>,
2421
2422 /// Required. The list of fields to update.
2423 pub update_mask: std::option::Option<wkt::FieldMask>,
2424
2425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2426}
2427
2428impl UpdateDeploymentRequest {
2429 pub fn new() -> Self {
2430 std::default::Default::default()
2431 }
2432
2433 /// Sets the value of [deployment][crate::model::UpdateDeploymentRequest::deployment].
2434 ///
2435 /// # Example
2436 /// ```ignore,no_run
2437 /// # use google_cloud_apihub_v1::model::UpdateDeploymentRequest;
2438 /// use google_cloud_apihub_v1::model::Deployment;
2439 /// let x = UpdateDeploymentRequest::new().set_deployment(Deployment::default()/* use setters */);
2440 /// ```
2441 pub fn set_deployment<T>(mut self, v: T) -> Self
2442 where
2443 T: std::convert::Into<crate::model::Deployment>,
2444 {
2445 self.deployment = std::option::Option::Some(v.into());
2446 self
2447 }
2448
2449 /// Sets or clears the value of [deployment][crate::model::UpdateDeploymentRequest::deployment].
2450 ///
2451 /// # Example
2452 /// ```ignore,no_run
2453 /// # use google_cloud_apihub_v1::model::UpdateDeploymentRequest;
2454 /// use google_cloud_apihub_v1::model::Deployment;
2455 /// let x = UpdateDeploymentRequest::new().set_or_clear_deployment(Some(Deployment::default()/* use setters */));
2456 /// let x = UpdateDeploymentRequest::new().set_or_clear_deployment(None::<Deployment>);
2457 /// ```
2458 pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
2459 where
2460 T: std::convert::Into<crate::model::Deployment>,
2461 {
2462 self.deployment = v.map(|x| x.into());
2463 self
2464 }
2465
2466 /// Sets the value of [update_mask][crate::model::UpdateDeploymentRequest::update_mask].
2467 ///
2468 /// # Example
2469 /// ```ignore,no_run
2470 /// # use google_cloud_apihub_v1::model::UpdateDeploymentRequest;
2471 /// use wkt::FieldMask;
2472 /// let x = UpdateDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2473 /// ```
2474 pub fn set_update_mask<T>(mut self, v: T) -> Self
2475 where
2476 T: std::convert::Into<wkt::FieldMask>,
2477 {
2478 self.update_mask = std::option::Option::Some(v.into());
2479 self
2480 }
2481
2482 /// Sets or clears the value of [update_mask][crate::model::UpdateDeploymentRequest::update_mask].
2483 ///
2484 /// # Example
2485 /// ```ignore,no_run
2486 /// # use google_cloud_apihub_v1::model::UpdateDeploymentRequest;
2487 /// use wkt::FieldMask;
2488 /// let x = UpdateDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2489 /// let x = UpdateDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2490 /// ```
2491 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2492 where
2493 T: std::convert::Into<wkt::FieldMask>,
2494 {
2495 self.update_mask = v.map(|x| x.into());
2496 self
2497 }
2498}
2499
2500impl wkt::message::Message for UpdateDeploymentRequest {
2501 fn typename() -> &'static str {
2502 "type.googleapis.com/google.cloud.apihub.v1.UpdateDeploymentRequest"
2503 }
2504}
2505
2506/// The [DeleteDeployment][google.cloud.apihub.v1.ApiHub.DeleteDeployment]
2507/// method's request.
2508///
2509/// [google.cloud.apihub.v1.ApiHub.DeleteDeployment]: crate::client::ApiHub::delete_deployment
2510#[derive(Clone, Default, PartialEq)]
2511#[non_exhaustive]
2512pub struct DeleteDeploymentRequest {
2513 /// Required. The name of the deployment resource to delete.
2514 /// Format: `projects/{project}/locations/{location}/deployments/{deployment}`
2515 pub name: std::string::String,
2516
2517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2518}
2519
2520impl DeleteDeploymentRequest {
2521 pub fn new() -> Self {
2522 std::default::Default::default()
2523 }
2524
2525 /// Sets the value of [name][crate::model::DeleteDeploymentRequest::name].
2526 ///
2527 /// # Example
2528 /// ```ignore,no_run
2529 /// # use google_cloud_apihub_v1::model::DeleteDeploymentRequest;
2530 /// let x = DeleteDeploymentRequest::new().set_name("example");
2531 /// ```
2532 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2533 self.name = v.into();
2534 self
2535 }
2536}
2537
2538impl wkt::message::Message for DeleteDeploymentRequest {
2539 fn typename() -> &'static str {
2540 "type.googleapis.com/google.cloud.apihub.v1.DeleteDeploymentRequest"
2541 }
2542}
2543
2544/// The [ListDeployments][google.cloud.apihub.v1.ApiHub.ListDeployments] method's
2545/// request.
2546///
2547/// [google.cloud.apihub.v1.ApiHub.ListDeployments]: crate::client::ApiHub::list_deployments
2548#[derive(Clone, Default, PartialEq)]
2549#[non_exhaustive]
2550pub struct ListDeploymentsRequest {
2551 /// Required. The parent, which owns this collection of deployment resources.
2552 /// Format: `projects/{project}/locations/{location}`
2553 pub parent: std::string::String,
2554
2555 /// Optional. An expression that filters the list of Deployments.
2556 ///
2557 /// A filter expression consists of a field name, a comparison
2558 /// operator, and a value for filtering. The value must be a string. The
2559 /// comparison operator must be one of: `<`, `>` or
2560 /// `=`. Filters are not case sensitive.
2561 ///
2562 /// The following fields in the `Deployments` are eligible for filtering:
2563 ///
2564 /// * `display_name` - The display name of the Deployment. Allowed
2565 /// comparison operators: `=`.
2566 /// * `create_time` - The time at which the Deployment was created. The
2567 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
2568 /// format. Allowed comparison operators: `>` and `<`.
2569 /// * `resource_uri` - A URI to the deployment resource. Allowed
2570 /// comparison operators: `=`.
2571 /// * `api_versions` - The API versions linked to this deployment. Allowed
2572 /// comparison operators: `:`.
2573 /// * `source_project` - The project/organization at source for the
2574 /// deployment. Allowed comparison operators: `=`.
2575 /// * `source_environment` - The environment at source for the
2576 /// deployment. Allowed comparison operators: `=`.
2577 /// * `deployment_type.enum_values.values.id` - The allowed value id of the
2578 /// deployment_type attribute associated with the Deployment. Allowed
2579 /// comparison operators: `:`.
2580 /// * `deployment_type.enum_values.values.display_name` - The allowed value
2581 /// display name of the deployment_type attribute associated with the
2582 /// Deployment. Allowed comparison operators: `:`.
2583 /// * `slo.string_values.values` -The allowed string value of the slo
2584 /// attribute associated with the deployment. Allowed comparison
2585 /// operators: `:`.
2586 /// * `environment.enum_values.values.id` - The allowed value id of the
2587 /// environment attribute associated with the deployment. Allowed
2588 /// comparison operators: `:`.
2589 /// * `environment.enum_values.values.display_name` - The allowed value
2590 /// display name of the environment attribute associated with the deployment.
2591 /// Allowed comparison operators: `:`.
2592 /// * `attributes.projects/test-project-id/locations/test-location-id/
2593 /// attributes/user-defined-attribute-id.enum_values.values.id` - The
2594 /// allowed value id of the user defined enum attribute associated with the
2595 /// Resource. Allowed comparison operator is `:`. Here
2596 /// user-defined-attribute-enum-id is a placeholder that can be replaced with
2597 /// any user defined enum attribute name.
2598 /// * `attributes.projects/test-project-id/locations/test-location-id/
2599 /// attributes/user-defined-attribute-id.enum_values.values.display_name`
2600 ///
2601 /// - The allowed value display name of the user defined enum attribute
2602 /// associated with the Resource. Allowed comparison operator is `:`. Here
2603 /// user-defined-attribute-enum-display-name is a placeholder that can be
2604 /// replaced with any user defined enum attribute enum name.
2605 ///
2606 /// * `attributes.projects/test-project-id/locations/test-location-id/
2607 /// attributes/user-defined-attribute-id.string_values.values` - The
2608 /// allowed value of the user defined string attribute associated with the
2609 /// Resource. Allowed comparison operator is `:`. Here
2610 /// user-defined-attribute-string is a placeholder that can be replaced with
2611 /// any user defined string attribute name.
2612 /// * `attributes.projects/test-project-id/locations/test-location-id/
2613 /// attributes/user-defined-attribute-id.json_values.values` - The
2614 /// allowed value of the user defined JSON attribute associated with the
2615 /// Resource. Allowed comparison operator is `:`. Here
2616 /// user-defined-attribute-json is a placeholder that can be replaced with
2617 /// any user defined JSON attribute name.
2618 ///
2619 /// A filter function is also supported in the filter string. The filter
2620 /// function is `id(name)`. The `id(name)` function returns the id of the
2621 /// resource name. For example, `id(name) = \"deployment-1\"` is equivalent to
2622 /// `name =
2623 /// \"projects/test-project-id/locations/test-location-id/deployments/deployment-1\"`
2624 /// provided the parent is
2625 /// `projects/test-project-id/locations/test-location-id`.
2626 ///
2627 /// Expressions are combined with either `AND` logic operator or `OR` logical
2628 /// operator but not both of them together i.e. only one of the `AND` or `OR`
2629 /// operator can be used throughout the filter string and both the operators
2630 /// cannot be used together. No other logical operators are supported. At most
2631 /// three filter fields are allowed in the filter string and if provided
2632 /// more than that then `INVALID_ARGUMENT` error is returned by the API.
2633 ///
2634 /// Here are a few examples:
2635 ///
2636 /// * `environment.enum_values.values.id: staging-id` - The allowed value id
2637 /// of the environment attribute associated with the Deployment is
2638 /// _staging-id_.
2639 /// * `environment.enum_values.values.display_name: \"Staging Deployment\"` -
2640 /// The allowed value display name of the environment attribute associated
2641 /// with the Deployment is `Staging Deployment`.
2642 /// * `environment.enum_values.values.id: production-id AND create_time <
2643 /// \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
2644 /// The allowed value id of the environment attribute associated with the
2645 /// Deployment is _production-id_ and Deployment was created before
2646 /// _2021-08-15 14:50:00 UTC_ and after _2021-08-10 12:00:00 UTC_.
2647 /// * `environment.enum_values.values.id: production-id OR
2648 /// slo.string_values.values: \"99.99%\"`
2649 ///
2650 /// - The allowed value id of the environment attribute Deployment is
2651 /// _production-id_ or string value of the slo attribute is _99.99%_.
2652 ///
2653 /// * `environment.enum_values.values.id: staging-id AND
2654 /// attributes.projects/test-project-id/locations/test-location-id/
2655 /// attributes/17650f90-4a29-4971-b3c0-d5532da3764b.string_values.values:
2656 /// test` - The filter string specifies that the allowed value id of the
2657 /// environment attribute associated with the Deployment is _staging-id_ and
2658 /// the value of the user defined attribute of type string is _test_.
2659 pub filter: std::string::String,
2660
2661 /// Optional. The maximum number of deployment resources to return. The service
2662 /// may return fewer than this value. If unspecified, at most 50 deployments
2663 /// will be returned. The maximum value is 1000; values above 1000 will be
2664 /// coerced to 1000.
2665 pub page_size: i32,
2666
2667 /// Optional. A page token, received from a previous `ListDeployments` call.
2668 /// Provide this to retrieve the subsequent page.
2669 ///
2670 /// When paginating, all other parameters (except page_size) provided to
2671 /// `ListDeployments` must match the call that provided the page token.
2672 pub page_token: std::string::String,
2673
2674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2675}
2676
2677impl ListDeploymentsRequest {
2678 pub fn new() -> Self {
2679 std::default::Default::default()
2680 }
2681
2682 /// Sets the value of [parent][crate::model::ListDeploymentsRequest::parent].
2683 ///
2684 /// # Example
2685 /// ```ignore,no_run
2686 /// # use google_cloud_apihub_v1::model::ListDeploymentsRequest;
2687 /// let x = ListDeploymentsRequest::new().set_parent("example");
2688 /// ```
2689 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2690 self.parent = v.into();
2691 self
2692 }
2693
2694 /// Sets the value of [filter][crate::model::ListDeploymentsRequest::filter].
2695 ///
2696 /// # Example
2697 /// ```ignore,no_run
2698 /// # use google_cloud_apihub_v1::model::ListDeploymentsRequest;
2699 /// let x = ListDeploymentsRequest::new().set_filter("example");
2700 /// ```
2701 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2702 self.filter = v.into();
2703 self
2704 }
2705
2706 /// Sets the value of [page_size][crate::model::ListDeploymentsRequest::page_size].
2707 ///
2708 /// # Example
2709 /// ```ignore,no_run
2710 /// # use google_cloud_apihub_v1::model::ListDeploymentsRequest;
2711 /// let x = ListDeploymentsRequest::new().set_page_size(42);
2712 /// ```
2713 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2714 self.page_size = v.into();
2715 self
2716 }
2717
2718 /// Sets the value of [page_token][crate::model::ListDeploymentsRequest::page_token].
2719 ///
2720 /// # Example
2721 /// ```ignore,no_run
2722 /// # use google_cloud_apihub_v1::model::ListDeploymentsRequest;
2723 /// let x = ListDeploymentsRequest::new().set_page_token("example");
2724 /// ```
2725 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2726 self.page_token = v.into();
2727 self
2728 }
2729}
2730
2731impl wkt::message::Message for ListDeploymentsRequest {
2732 fn typename() -> &'static str {
2733 "type.googleapis.com/google.cloud.apihub.v1.ListDeploymentsRequest"
2734 }
2735}
2736
2737/// The [ListDeployments][google.cloud.apihub.v1.ApiHub.ListDeployments] method's
2738/// response.
2739///
2740/// [google.cloud.apihub.v1.ApiHub.ListDeployments]: crate::client::ApiHub::list_deployments
2741#[derive(Clone, Default, PartialEq)]
2742#[non_exhaustive]
2743pub struct ListDeploymentsResponse {
2744 /// The deployment resources present in the API hub.
2745 pub deployments: std::vec::Vec<crate::model::Deployment>,
2746
2747 /// A token, which can be sent as `page_token` to retrieve the next page.
2748 /// If this field is omitted, there are no subsequent pages.
2749 pub next_page_token: std::string::String,
2750
2751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2752}
2753
2754impl ListDeploymentsResponse {
2755 pub fn new() -> Self {
2756 std::default::Default::default()
2757 }
2758
2759 /// Sets the value of [deployments][crate::model::ListDeploymentsResponse::deployments].
2760 ///
2761 /// # Example
2762 /// ```ignore,no_run
2763 /// # use google_cloud_apihub_v1::model::ListDeploymentsResponse;
2764 /// use google_cloud_apihub_v1::model::Deployment;
2765 /// let x = ListDeploymentsResponse::new()
2766 /// .set_deployments([
2767 /// Deployment::default()/* use setters */,
2768 /// Deployment::default()/* use (different) setters */,
2769 /// ]);
2770 /// ```
2771 pub fn set_deployments<T, V>(mut self, v: T) -> Self
2772 where
2773 T: std::iter::IntoIterator<Item = V>,
2774 V: std::convert::Into<crate::model::Deployment>,
2775 {
2776 use std::iter::Iterator;
2777 self.deployments = v.into_iter().map(|i| i.into()).collect();
2778 self
2779 }
2780
2781 /// Sets the value of [next_page_token][crate::model::ListDeploymentsResponse::next_page_token].
2782 ///
2783 /// # Example
2784 /// ```ignore,no_run
2785 /// # use google_cloud_apihub_v1::model::ListDeploymentsResponse;
2786 /// let x = ListDeploymentsResponse::new().set_next_page_token("example");
2787 /// ```
2788 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2789 self.next_page_token = v.into();
2790 self
2791 }
2792}
2793
2794impl wkt::message::Message for ListDeploymentsResponse {
2795 fn typename() -> &'static str {
2796 "type.googleapis.com/google.cloud.apihub.v1.ListDeploymentsResponse"
2797 }
2798}
2799
2800#[doc(hidden)]
2801impl google_cloud_gax::paginator::internal::PageableResponse for ListDeploymentsResponse {
2802 type PageItem = crate::model::Deployment;
2803
2804 fn items(self) -> std::vec::Vec<Self::PageItem> {
2805 self.deployments
2806 }
2807
2808 fn next_page_token(&self) -> std::string::String {
2809 use std::clone::Clone;
2810 self.next_page_token.clone()
2811 }
2812}
2813
2814/// The [CreateAttribute][google.cloud.apihub.v1.ApiHub.CreateAttribute] method's
2815/// request.
2816///
2817/// [google.cloud.apihub.v1.ApiHub.CreateAttribute]: crate::client::ApiHub::create_attribute
2818#[derive(Clone, Default, PartialEq)]
2819#[non_exhaustive]
2820pub struct CreateAttributeRequest {
2821 /// Required. The parent resource for Attribute.
2822 /// Format: `projects/{project}/locations/{location}`
2823 pub parent: std::string::String,
2824
2825 /// Optional. The ID to use for the attribute, which will become the final
2826 /// component of the attribute's resource name. This field is optional.
2827 ///
2828 /// * If provided, the same will be used. The service will throw an error if
2829 /// the specified id is already used by another attribute resource in the API
2830 /// hub.
2831 /// * If not provided, a system generated id will be used.
2832 ///
2833 /// This value should be 4-500 characters, and valid characters
2834 /// are /[a-z][A-Z][0-9]-_/.
2835 pub attribute_id: std::string::String,
2836
2837 /// Required. The attribute to create.
2838 pub attribute: std::option::Option<crate::model::Attribute>,
2839
2840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2841}
2842
2843impl CreateAttributeRequest {
2844 pub fn new() -> Self {
2845 std::default::Default::default()
2846 }
2847
2848 /// Sets the value of [parent][crate::model::CreateAttributeRequest::parent].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_apihub_v1::model::CreateAttributeRequest;
2853 /// let x = CreateAttributeRequest::new().set_parent("example");
2854 /// ```
2855 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856 self.parent = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [attribute_id][crate::model::CreateAttributeRequest::attribute_id].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_apihub_v1::model::CreateAttributeRequest;
2865 /// let x = CreateAttributeRequest::new().set_attribute_id("example");
2866 /// ```
2867 pub fn set_attribute_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2868 self.attribute_id = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [attribute][crate::model::CreateAttributeRequest::attribute].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_apihub_v1::model::CreateAttributeRequest;
2877 /// use google_cloud_apihub_v1::model::Attribute;
2878 /// let x = CreateAttributeRequest::new().set_attribute(Attribute::default()/* use setters */);
2879 /// ```
2880 pub fn set_attribute<T>(mut self, v: T) -> Self
2881 where
2882 T: std::convert::Into<crate::model::Attribute>,
2883 {
2884 self.attribute = std::option::Option::Some(v.into());
2885 self
2886 }
2887
2888 /// Sets or clears the value of [attribute][crate::model::CreateAttributeRequest::attribute].
2889 ///
2890 /// # Example
2891 /// ```ignore,no_run
2892 /// # use google_cloud_apihub_v1::model::CreateAttributeRequest;
2893 /// use google_cloud_apihub_v1::model::Attribute;
2894 /// let x = CreateAttributeRequest::new().set_or_clear_attribute(Some(Attribute::default()/* use setters */));
2895 /// let x = CreateAttributeRequest::new().set_or_clear_attribute(None::<Attribute>);
2896 /// ```
2897 pub fn set_or_clear_attribute<T>(mut self, v: std::option::Option<T>) -> Self
2898 where
2899 T: std::convert::Into<crate::model::Attribute>,
2900 {
2901 self.attribute = v.map(|x| x.into());
2902 self
2903 }
2904}
2905
2906impl wkt::message::Message for CreateAttributeRequest {
2907 fn typename() -> &'static str {
2908 "type.googleapis.com/google.cloud.apihub.v1.CreateAttributeRequest"
2909 }
2910}
2911
2912/// The [GetAttribute][google.cloud.apihub.v1.ApiHub.GetAttribute] method's
2913/// request.
2914///
2915/// [google.cloud.apihub.v1.ApiHub.GetAttribute]: crate::client::ApiHub::get_attribute
2916#[derive(Clone, Default, PartialEq)]
2917#[non_exhaustive]
2918pub struct GetAttributeRequest {
2919 /// Required. The name of the attribute to retrieve.
2920 /// Format:
2921 /// `projects/{project}/locations/{location}/attributes/{attribute}`
2922 pub name: std::string::String,
2923
2924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2925}
2926
2927impl GetAttributeRequest {
2928 pub fn new() -> Self {
2929 std::default::Default::default()
2930 }
2931
2932 /// Sets the value of [name][crate::model::GetAttributeRequest::name].
2933 ///
2934 /// # Example
2935 /// ```ignore,no_run
2936 /// # use google_cloud_apihub_v1::model::GetAttributeRequest;
2937 /// let x = GetAttributeRequest::new().set_name("example");
2938 /// ```
2939 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2940 self.name = v.into();
2941 self
2942 }
2943}
2944
2945impl wkt::message::Message for GetAttributeRequest {
2946 fn typename() -> &'static str {
2947 "type.googleapis.com/google.cloud.apihub.v1.GetAttributeRequest"
2948 }
2949}
2950
2951/// The [UpdateAttribute][google.cloud.apihub.v1.ApiHub.UpdateAttribute] method's
2952/// request.
2953///
2954/// [google.cloud.apihub.v1.ApiHub.UpdateAttribute]: crate::client::ApiHub::update_attribute
2955#[derive(Clone, Default, PartialEq)]
2956#[non_exhaustive]
2957pub struct UpdateAttributeRequest {
2958 /// Required. The attribute to update.
2959 ///
2960 /// The attribute's `name` field is used to identify the attribute to update.
2961 /// Format:
2962 /// `projects/{project}/locations/{location}/attributes/{attribute}`
2963 pub attribute: std::option::Option<crate::model::Attribute>,
2964
2965 /// Required. The list of fields to update.
2966 pub update_mask: std::option::Option<wkt::FieldMask>,
2967
2968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2969}
2970
2971impl UpdateAttributeRequest {
2972 pub fn new() -> Self {
2973 std::default::Default::default()
2974 }
2975
2976 /// Sets the value of [attribute][crate::model::UpdateAttributeRequest::attribute].
2977 ///
2978 /// # Example
2979 /// ```ignore,no_run
2980 /// # use google_cloud_apihub_v1::model::UpdateAttributeRequest;
2981 /// use google_cloud_apihub_v1::model::Attribute;
2982 /// let x = UpdateAttributeRequest::new().set_attribute(Attribute::default()/* use setters */);
2983 /// ```
2984 pub fn set_attribute<T>(mut self, v: T) -> Self
2985 where
2986 T: std::convert::Into<crate::model::Attribute>,
2987 {
2988 self.attribute = std::option::Option::Some(v.into());
2989 self
2990 }
2991
2992 /// Sets or clears the value of [attribute][crate::model::UpdateAttributeRequest::attribute].
2993 ///
2994 /// # Example
2995 /// ```ignore,no_run
2996 /// # use google_cloud_apihub_v1::model::UpdateAttributeRequest;
2997 /// use google_cloud_apihub_v1::model::Attribute;
2998 /// let x = UpdateAttributeRequest::new().set_or_clear_attribute(Some(Attribute::default()/* use setters */));
2999 /// let x = UpdateAttributeRequest::new().set_or_clear_attribute(None::<Attribute>);
3000 /// ```
3001 pub fn set_or_clear_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3002 where
3003 T: std::convert::Into<crate::model::Attribute>,
3004 {
3005 self.attribute = v.map(|x| x.into());
3006 self
3007 }
3008
3009 /// Sets the value of [update_mask][crate::model::UpdateAttributeRequest::update_mask].
3010 ///
3011 /// # Example
3012 /// ```ignore,no_run
3013 /// # use google_cloud_apihub_v1::model::UpdateAttributeRequest;
3014 /// use wkt::FieldMask;
3015 /// let x = UpdateAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3016 /// ```
3017 pub fn set_update_mask<T>(mut self, v: T) -> Self
3018 where
3019 T: std::convert::Into<wkt::FieldMask>,
3020 {
3021 self.update_mask = std::option::Option::Some(v.into());
3022 self
3023 }
3024
3025 /// Sets or clears the value of [update_mask][crate::model::UpdateAttributeRequest::update_mask].
3026 ///
3027 /// # Example
3028 /// ```ignore,no_run
3029 /// # use google_cloud_apihub_v1::model::UpdateAttributeRequest;
3030 /// use wkt::FieldMask;
3031 /// let x = UpdateAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3032 /// let x = UpdateAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3033 /// ```
3034 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3035 where
3036 T: std::convert::Into<wkt::FieldMask>,
3037 {
3038 self.update_mask = v.map(|x| x.into());
3039 self
3040 }
3041}
3042
3043impl wkt::message::Message for UpdateAttributeRequest {
3044 fn typename() -> &'static str {
3045 "type.googleapis.com/google.cloud.apihub.v1.UpdateAttributeRequest"
3046 }
3047}
3048
3049/// The [DeleteAttribute][google.cloud.apihub.v1.ApiHub.DeleteAttribute] method's
3050/// request.
3051///
3052/// [google.cloud.apihub.v1.ApiHub.DeleteAttribute]: crate::client::ApiHub::delete_attribute
3053#[derive(Clone, Default, PartialEq)]
3054#[non_exhaustive]
3055pub struct DeleteAttributeRequest {
3056 /// Required. The name of the attribute to delete.
3057 /// Format:
3058 /// `projects/{project}/locations/{location}/attributes/{attribute}`
3059 pub name: std::string::String,
3060
3061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3062}
3063
3064impl DeleteAttributeRequest {
3065 pub fn new() -> Self {
3066 std::default::Default::default()
3067 }
3068
3069 /// Sets the value of [name][crate::model::DeleteAttributeRequest::name].
3070 ///
3071 /// # Example
3072 /// ```ignore,no_run
3073 /// # use google_cloud_apihub_v1::model::DeleteAttributeRequest;
3074 /// let x = DeleteAttributeRequest::new().set_name("example");
3075 /// ```
3076 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3077 self.name = v.into();
3078 self
3079 }
3080}
3081
3082impl wkt::message::Message for DeleteAttributeRequest {
3083 fn typename() -> &'static str {
3084 "type.googleapis.com/google.cloud.apihub.v1.DeleteAttributeRequest"
3085 }
3086}
3087
3088/// The [ListAttributes][google.cloud.apihub.v1.ApiHub.ListAttributes] method's
3089/// request.
3090///
3091/// [google.cloud.apihub.v1.ApiHub.ListAttributes]: crate::client::ApiHub::list_attributes
3092#[derive(Clone, Default, PartialEq)]
3093#[non_exhaustive]
3094pub struct ListAttributesRequest {
3095 /// Required. The parent resource for Attribute.
3096 /// Format: `projects/{project}/locations/{location}`
3097 pub parent: std::string::String,
3098
3099 /// Optional. An expression that filters the list of Attributes.
3100 ///
3101 /// A filter expression consists of a field name, a comparison
3102 /// operator, and a value for filtering. The value must be a string or a
3103 /// boolean. The comparison operator must be one of: `<`, `>` or
3104 /// `=`. Filters are not case sensitive.
3105 ///
3106 /// The following fields in the `Attribute` are eligible for filtering:
3107 ///
3108 /// * `display_name` - The display name of the Attribute. Allowed
3109 /// comparison operators: `=`.
3110 /// * `definition_type` - The definition type of the attribute. Allowed
3111 /// comparison operators: `=`.
3112 /// * `scope` - The scope of the attribute. Allowed comparison operators:
3113 /// `=`.
3114 /// * `data_type` - The type of the data of the attribute. Allowed
3115 /// comparison operators: `=`.
3116 /// * `mandatory` - Denotes whether the attribute is mandatory or not.
3117 /// Allowed comparison operators: `=`.
3118 /// * `create_time` - The time at which the Attribute was created. The
3119 /// value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
3120 /// format. Allowed comparison operators: `>` and `<`.
3121 ///
3122 /// Expressions are combined with either `AND` logic operator or `OR` logical
3123 /// operator but not both of them together i.e. only one of the `AND` or `OR`
3124 /// operator can be used throughout the filter string and both the operators
3125 /// cannot be used together. No other logical operators are
3126 /// supported. At most three filter fields are allowed in the filter
3127 /// string and if provided more than that then `INVALID_ARGUMENT` error is
3128 /// returned by the API.
3129 ///
3130 /// Here are a few examples:
3131 ///
3132 /// * `display_name = production` - - The display name of the attribute is
3133 /// _production_.
3134 /// * `(display_name = production) AND (create_time <
3135 /// \"2021-08-15T14:50:00Z\") AND (create_time > \"2021-08-10T12:00:00Z\")` -
3136 /// The display name of the attribute is _production_ and the attribute was
3137 /// created before _2021-08-15 14:50:00 UTC_ and after _2021-08-10 12:00:00
3138 /// UTC_.
3139 /// * `display_name = production OR scope = api` -
3140 /// The attribute where the display name is _production_ or the scope is
3141 /// _api_.
3142 pub filter: std::string::String,
3143
3144 /// Optional. The maximum number of attribute resources to return. The service
3145 /// may return fewer than this value. If unspecified, at most 50 attributes
3146 /// will be returned. The maximum value is 1000; values above 1000 will be
3147 /// coerced to 1000.
3148 pub page_size: i32,
3149
3150 /// Optional. A page token, received from a previous `ListAttributes` call.
3151 /// Provide this to retrieve the subsequent page.
3152 ///
3153 /// When paginating, all other parameters provided to `ListAttributes` must
3154 /// match the call that provided the page token.
3155 pub page_token: std::string::String,
3156
3157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3158}
3159
3160impl ListAttributesRequest {
3161 pub fn new() -> Self {
3162 std::default::Default::default()
3163 }
3164
3165 /// Sets the value of [parent][crate::model::ListAttributesRequest::parent].
3166 ///
3167 /// # Example
3168 /// ```ignore,no_run
3169 /// # use google_cloud_apihub_v1::model::ListAttributesRequest;
3170 /// let x = ListAttributesRequest::new().set_parent("example");
3171 /// ```
3172 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3173 self.parent = v.into();
3174 self
3175 }
3176
3177 /// Sets the value of [filter][crate::model::ListAttributesRequest::filter].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_apihub_v1::model::ListAttributesRequest;
3182 /// let x = ListAttributesRequest::new().set_filter("example");
3183 /// ```
3184 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3185 self.filter = v.into();
3186 self
3187 }
3188
3189 /// Sets the value of [page_size][crate::model::ListAttributesRequest::page_size].
3190 ///
3191 /// # Example
3192 /// ```ignore,no_run
3193 /// # use google_cloud_apihub_v1::model::ListAttributesRequest;
3194 /// let x = ListAttributesRequest::new().set_page_size(42);
3195 /// ```
3196 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3197 self.page_size = v.into();
3198 self
3199 }
3200
3201 /// Sets the value of [page_token][crate::model::ListAttributesRequest::page_token].
3202 ///
3203 /// # Example
3204 /// ```ignore,no_run
3205 /// # use google_cloud_apihub_v1::model::ListAttributesRequest;
3206 /// let x = ListAttributesRequest::new().set_page_token("example");
3207 /// ```
3208 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3209 self.page_token = v.into();
3210 self
3211 }
3212}
3213
3214impl wkt::message::Message for ListAttributesRequest {
3215 fn typename() -> &'static str {
3216 "type.googleapis.com/google.cloud.apihub.v1.ListAttributesRequest"
3217 }
3218}
3219
3220/// The [ListAttributes][google.cloud.apihub.v1.ApiHub.ListAttributes] method's
3221/// response.
3222///
3223/// [google.cloud.apihub.v1.ApiHub.ListAttributes]: crate::client::ApiHub::list_attributes
3224#[derive(Clone, Default, PartialEq)]
3225#[non_exhaustive]
3226pub struct ListAttributesResponse {
3227 /// The list of all attributes.
3228 pub attributes: std::vec::Vec<crate::model::Attribute>,
3229
3230 /// A token, which can be sent as `page_token` to retrieve the next page.
3231 /// If this field is omitted, there are no subsequent pages.
3232 pub next_page_token: std::string::String,
3233
3234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3235}
3236
3237impl ListAttributesResponse {
3238 pub fn new() -> Self {
3239 std::default::Default::default()
3240 }
3241
3242 /// Sets the value of [attributes][crate::model::ListAttributesResponse::attributes].
3243 ///
3244 /// # Example
3245 /// ```ignore,no_run
3246 /// # use google_cloud_apihub_v1::model::ListAttributesResponse;
3247 /// use google_cloud_apihub_v1::model::Attribute;
3248 /// let x = ListAttributesResponse::new()
3249 /// .set_attributes([
3250 /// Attribute::default()/* use setters */,
3251 /// Attribute::default()/* use (different) setters */,
3252 /// ]);
3253 /// ```
3254 pub fn set_attributes<T, V>(mut self, v: T) -> Self
3255 where
3256 T: std::iter::IntoIterator<Item = V>,
3257 V: std::convert::Into<crate::model::Attribute>,
3258 {
3259 use std::iter::Iterator;
3260 self.attributes = v.into_iter().map(|i| i.into()).collect();
3261 self
3262 }
3263
3264 /// Sets the value of [next_page_token][crate::model::ListAttributesResponse::next_page_token].
3265 ///
3266 /// # Example
3267 /// ```ignore,no_run
3268 /// # use google_cloud_apihub_v1::model::ListAttributesResponse;
3269 /// let x = ListAttributesResponse::new().set_next_page_token("example");
3270 /// ```
3271 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3272 self.next_page_token = v.into();
3273 self
3274 }
3275}
3276
3277impl wkt::message::Message for ListAttributesResponse {
3278 fn typename() -> &'static str {
3279 "type.googleapis.com/google.cloud.apihub.v1.ListAttributesResponse"
3280 }
3281}
3282
3283#[doc(hidden)]
3284impl google_cloud_gax::paginator::internal::PageableResponse for ListAttributesResponse {
3285 type PageItem = crate::model::Attribute;
3286
3287 fn items(self) -> std::vec::Vec<Self::PageItem> {
3288 self.attributes
3289 }
3290
3291 fn next_page_token(&self) -> std::string::String {
3292 use std::clone::Clone;
3293 self.next_page_token.clone()
3294 }
3295}
3296
3297/// The [SearchResources][google.cloud.apihub.v1.ApiHub.SearchResources] method's
3298/// request.
3299///
3300/// [google.cloud.apihub.v1.ApiHub.SearchResources]: crate::client::ApiHub::search_resources
3301#[derive(Clone, Default, PartialEq)]
3302#[non_exhaustive]
3303pub struct SearchResourcesRequest {
3304 /// Required. The resource name of the location which will be of the type
3305 /// `projects/{project_id}/locations/{location_id}`. This field is used to
3306 /// identify the instance of API-Hub in which resources should be searched.
3307 pub location: std::string::String,
3308
3309 /// Required. The free text search query. This query can contain keywords which
3310 /// could be related to any detail of the API-Hub resources such display names,
3311 /// descriptions, attributes etc.
3312 pub query: std::string::String,
3313
3314 /// Optional. An expression that filters the list of search results.
3315 ///
3316 /// A filter expression consists of a field name, a comparison operator,
3317 /// and a value for filtering. The value must be a string, a number, or a
3318 /// boolean. The comparison operator must be `=`. Filters are not case
3319 /// sensitive.
3320 ///
3321 /// The following field names are eligible for filtering:
3322 ///
3323 /// * `resource_type` - The type of resource in the search results.
3324 /// Must be one of the following: `Api`, `ApiOperation`, `Deployment`,
3325 /// `Definition`, `Spec` or `Version`. This field can only be specified once
3326 /// in the filter.
3327 ///
3328 /// Here are is an example:
3329 ///
3330 /// * `resource_type = Api` - The resource_type is _Api_.
3331 pub filter: std::string::String,
3332
3333 /// Optional. The maximum number of search results to return. The service may
3334 /// return fewer than this value. If unspecified at most 10 search results will
3335 /// be returned. If value is negative then `INVALID_ARGUMENT` error is
3336 /// returned. The maximum value is 25; values above 25 will be coerced to 25.
3337 /// While paginating, you can specify a new page size parameter for each page
3338 /// of search results to be listed.
3339 pub page_size: i32,
3340
3341 /// Optional. A page token, received from a previous
3342 /// [SearchResources][SearchResources]
3343 /// call. Specify this parameter to retrieve the next page of transactions.
3344 ///
3345 /// When paginating, you must specify the `page_token` parameter and all the
3346 /// other parameters except
3347 /// [page_size][google.cloud.apihub.v1.SearchResourcesRequest.page_size]
3348 /// should be specified with the same value which was used in the previous
3349 /// call. If the other fields are set with a different value than the previous
3350 /// call then `INVALID_ARGUMENT` error is returned.
3351 ///
3352 /// [google.cloud.apihub.v1.SearchResourcesRequest.page_size]: crate::model::SearchResourcesRequest::page_size
3353 pub page_token: std::string::String,
3354
3355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3356}
3357
3358impl SearchResourcesRequest {
3359 pub fn new() -> Self {
3360 std::default::Default::default()
3361 }
3362
3363 /// Sets the value of [location][crate::model::SearchResourcesRequest::location].
3364 ///
3365 /// # Example
3366 /// ```ignore,no_run
3367 /// # use google_cloud_apihub_v1::model::SearchResourcesRequest;
3368 /// let x = SearchResourcesRequest::new().set_location("example");
3369 /// ```
3370 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3371 self.location = v.into();
3372 self
3373 }
3374
3375 /// Sets the value of [query][crate::model::SearchResourcesRequest::query].
3376 ///
3377 /// # Example
3378 /// ```ignore,no_run
3379 /// # use google_cloud_apihub_v1::model::SearchResourcesRequest;
3380 /// let x = SearchResourcesRequest::new().set_query("example");
3381 /// ```
3382 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3383 self.query = v.into();
3384 self
3385 }
3386
3387 /// Sets the value of [filter][crate::model::SearchResourcesRequest::filter].
3388 ///
3389 /// # Example
3390 /// ```ignore,no_run
3391 /// # use google_cloud_apihub_v1::model::SearchResourcesRequest;
3392 /// let x = SearchResourcesRequest::new().set_filter("example");
3393 /// ```
3394 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3395 self.filter = v.into();
3396 self
3397 }
3398
3399 /// Sets the value of [page_size][crate::model::SearchResourcesRequest::page_size].
3400 ///
3401 /// # Example
3402 /// ```ignore,no_run
3403 /// # use google_cloud_apihub_v1::model::SearchResourcesRequest;
3404 /// let x = SearchResourcesRequest::new().set_page_size(42);
3405 /// ```
3406 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3407 self.page_size = v.into();
3408 self
3409 }
3410
3411 /// Sets the value of [page_token][crate::model::SearchResourcesRequest::page_token].
3412 ///
3413 /// # Example
3414 /// ```ignore,no_run
3415 /// # use google_cloud_apihub_v1::model::SearchResourcesRequest;
3416 /// let x = SearchResourcesRequest::new().set_page_token("example");
3417 /// ```
3418 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3419 self.page_token = v.into();
3420 self
3421 }
3422}
3423
3424impl wkt::message::Message for SearchResourcesRequest {
3425 fn typename() -> &'static str {
3426 "type.googleapis.com/google.cloud.apihub.v1.SearchResourcesRequest"
3427 }
3428}
3429
3430/// ApiHubResource is one of the resources such as Api, Operation, Deployment,
3431/// Definition, Spec and Version resources stored in API-Hub.
3432#[derive(Clone, Default, PartialEq)]
3433#[non_exhaustive]
3434pub struct ApiHubResource {
3435 pub resource: std::option::Option<crate::model::api_hub_resource::Resource>,
3436
3437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3438}
3439
3440impl ApiHubResource {
3441 pub fn new() -> Self {
3442 std::default::Default::default()
3443 }
3444
3445 /// Sets the value of [resource][crate::model::ApiHubResource::resource].
3446 ///
3447 /// Note that all the setters affecting `resource` are mutually
3448 /// exclusive.
3449 ///
3450 /// # Example
3451 /// ```ignore,no_run
3452 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3453 /// use google_cloud_apihub_v1::model::Api;
3454 /// let x = ApiHubResource::new().set_resource(Some(
3455 /// google_cloud_apihub_v1::model::api_hub_resource::Resource::Api(Api::default().into())));
3456 /// ```
3457 pub fn set_resource<
3458 T: std::convert::Into<std::option::Option<crate::model::api_hub_resource::Resource>>,
3459 >(
3460 mut self,
3461 v: T,
3462 ) -> Self {
3463 self.resource = v.into();
3464 self
3465 }
3466
3467 /// The value of [resource][crate::model::ApiHubResource::resource]
3468 /// if it holds a `Api`, `None` if the field is not set or
3469 /// holds a different branch.
3470 pub fn api(&self) -> std::option::Option<&std::boxed::Box<crate::model::Api>> {
3471 #[allow(unreachable_patterns)]
3472 self.resource.as_ref().and_then(|v| match v {
3473 crate::model::api_hub_resource::Resource::Api(v) => std::option::Option::Some(v),
3474 _ => std::option::Option::None,
3475 })
3476 }
3477
3478 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3479 /// to hold a `Api`.
3480 ///
3481 /// Note that all the setters affecting `resource` are
3482 /// mutually exclusive.
3483 ///
3484 /// # Example
3485 /// ```ignore,no_run
3486 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3487 /// use google_cloud_apihub_v1::model::Api;
3488 /// let x = ApiHubResource::new().set_api(Api::default()/* use setters */);
3489 /// assert!(x.api().is_some());
3490 /// assert!(x.operation().is_none());
3491 /// assert!(x.deployment().is_none());
3492 /// assert!(x.spec().is_none());
3493 /// assert!(x.definition().is_none());
3494 /// assert!(x.version().is_none());
3495 /// ```
3496 pub fn set_api<T: std::convert::Into<std::boxed::Box<crate::model::Api>>>(
3497 mut self,
3498 v: T,
3499 ) -> Self {
3500 self.resource =
3501 std::option::Option::Some(crate::model::api_hub_resource::Resource::Api(v.into()));
3502 self
3503 }
3504
3505 /// The value of [resource][crate::model::ApiHubResource::resource]
3506 /// if it holds a `Operation`, `None` if the field is not set or
3507 /// holds a different branch.
3508 pub fn operation(&self) -> std::option::Option<&std::boxed::Box<crate::model::ApiOperation>> {
3509 #[allow(unreachable_patterns)]
3510 self.resource.as_ref().and_then(|v| match v {
3511 crate::model::api_hub_resource::Resource::Operation(v) => std::option::Option::Some(v),
3512 _ => std::option::Option::None,
3513 })
3514 }
3515
3516 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3517 /// to hold a `Operation`.
3518 ///
3519 /// Note that all the setters affecting `resource` are
3520 /// mutually exclusive.
3521 ///
3522 /// # Example
3523 /// ```ignore,no_run
3524 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3525 /// use google_cloud_apihub_v1::model::ApiOperation;
3526 /// let x = ApiHubResource::new().set_operation(ApiOperation::default()/* use setters */);
3527 /// assert!(x.operation().is_some());
3528 /// assert!(x.api().is_none());
3529 /// assert!(x.deployment().is_none());
3530 /// assert!(x.spec().is_none());
3531 /// assert!(x.definition().is_none());
3532 /// assert!(x.version().is_none());
3533 /// ```
3534 pub fn set_operation<T: std::convert::Into<std::boxed::Box<crate::model::ApiOperation>>>(
3535 mut self,
3536 v: T,
3537 ) -> Self {
3538 self.resource = std::option::Option::Some(
3539 crate::model::api_hub_resource::Resource::Operation(v.into()),
3540 );
3541 self
3542 }
3543
3544 /// The value of [resource][crate::model::ApiHubResource::resource]
3545 /// if it holds a `Deployment`, `None` if the field is not set or
3546 /// holds a different branch.
3547 pub fn deployment(&self) -> std::option::Option<&std::boxed::Box<crate::model::Deployment>> {
3548 #[allow(unreachable_patterns)]
3549 self.resource.as_ref().and_then(|v| match v {
3550 crate::model::api_hub_resource::Resource::Deployment(v) => std::option::Option::Some(v),
3551 _ => std::option::Option::None,
3552 })
3553 }
3554
3555 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3556 /// to hold a `Deployment`.
3557 ///
3558 /// Note that all the setters affecting `resource` are
3559 /// mutually exclusive.
3560 ///
3561 /// # Example
3562 /// ```ignore,no_run
3563 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3564 /// use google_cloud_apihub_v1::model::Deployment;
3565 /// let x = ApiHubResource::new().set_deployment(Deployment::default()/* use setters */);
3566 /// assert!(x.deployment().is_some());
3567 /// assert!(x.api().is_none());
3568 /// assert!(x.operation().is_none());
3569 /// assert!(x.spec().is_none());
3570 /// assert!(x.definition().is_none());
3571 /// assert!(x.version().is_none());
3572 /// ```
3573 pub fn set_deployment<T: std::convert::Into<std::boxed::Box<crate::model::Deployment>>>(
3574 mut self,
3575 v: T,
3576 ) -> Self {
3577 self.resource = std::option::Option::Some(
3578 crate::model::api_hub_resource::Resource::Deployment(v.into()),
3579 );
3580 self
3581 }
3582
3583 /// The value of [resource][crate::model::ApiHubResource::resource]
3584 /// if it holds a `Spec`, `None` if the field is not set or
3585 /// holds a different branch.
3586 pub fn spec(&self) -> std::option::Option<&std::boxed::Box<crate::model::Spec>> {
3587 #[allow(unreachable_patterns)]
3588 self.resource.as_ref().and_then(|v| match v {
3589 crate::model::api_hub_resource::Resource::Spec(v) => std::option::Option::Some(v),
3590 _ => std::option::Option::None,
3591 })
3592 }
3593
3594 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3595 /// to hold a `Spec`.
3596 ///
3597 /// Note that all the setters affecting `resource` are
3598 /// mutually exclusive.
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3603 /// use google_cloud_apihub_v1::model::Spec;
3604 /// let x = ApiHubResource::new().set_spec(Spec::default()/* use setters */);
3605 /// assert!(x.spec().is_some());
3606 /// assert!(x.api().is_none());
3607 /// assert!(x.operation().is_none());
3608 /// assert!(x.deployment().is_none());
3609 /// assert!(x.definition().is_none());
3610 /// assert!(x.version().is_none());
3611 /// ```
3612 pub fn set_spec<T: std::convert::Into<std::boxed::Box<crate::model::Spec>>>(
3613 mut self,
3614 v: T,
3615 ) -> Self {
3616 self.resource =
3617 std::option::Option::Some(crate::model::api_hub_resource::Resource::Spec(v.into()));
3618 self
3619 }
3620
3621 /// The value of [resource][crate::model::ApiHubResource::resource]
3622 /// if it holds a `Definition`, `None` if the field is not set or
3623 /// holds a different branch.
3624 pub fn definition(&self) -> std::option::Option<&std::boxed::Box<crate::model::Definition>> {
3625 #[allow(unreachable_patterns)]
3626 self.resource.as_ref().and_then(|v| match v {
3627 crate::model::api_hub_resource::Resource::Definition(v) => std::option::Option::Some(v),
3628 _ => std::option::Option::None,
3629 })
3630 }
3631
3632 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3633 /// to hold a `Definition`.
3634 ///
3635 /// Note that all the setters affecting `resource` are
3636 /// mutually exclusive.
3637 ///
3638 /// # Example
3639 /// ```ignore,no_run
3640 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3641 /// use google_cloud_apihub_v1::model::Definition;
3642 /// let x = ApiHubResource::new().set_definition(Definition::default()/* use setters */);
3643 /// assert!(x.definition().is_some());
3644 /// assert!(x.api().is_none());
3645 /// assert!(x.operation().is_none());
3646 /// assert!(x.deployment().is_none());
3647 /// assert!(x.spec().is_none());
3648 /// assert!(x.version().is_none());
3649 /// ```
3650 pub fn set_definition<T: std::convert::Into<std::boxed::Box<crate::model::Definition>>>(
3651 mut self,
3652 v: T,
3653 ) -> Self {
3654 self.resource = std::option::Option::Some(
3655 crate::model::api_hub_resource::Resource::Definition(v.into()),
3656 );
3657 self
3658 }
3659
3660 /// The value of [resource][crate::model::ApiHubResource::resource]
3661 /// if it holds a `Version`, `None` if the field is not set or
3662 /// holds a different branch.
3663 pub fn version(&self) -> std::option::Option<&std::boxed::Box<crate::model::Version>> {
3664 #[allow(unreachable_patterns)]
3665 self.resource.as_ref().and_then(|v| match v {
3666 crate::model::api_hub_resource::Resource::Version(v) => std::option::Option::Some(v),
3667 _ => std::option::Option::None,
3668 })
3669 }
3670
3671 /// Sets the value of [resource][crate::model::ApiHubResource::resource]
3672 /// to hold a `Version`.
3673 ///
3674 /// Note that all the setters affecting `resource` are
3675 /// mutually exclusive.
3676 ///
3677 /// # Example
3678 /// ```ignore,no_run
3679 /// # use google_cloud_apihub_v1::model::ApiHubResource;
3680 /// use google_cloud_apihub_v1::model::Version;
3681 /// let x = ApiHubResource::new().set_version(Version::default()/* use setters */);
3682 /// assert!(x.version().is_some());
3683 /// assert!(x.api().is_none());
3684 /// assert!(x.operation().is_none());
3685 /// assert!(x.deployment().is_none());
3686 /// assert!(x.spec().is_none());
3687 /// assert!(x.definition().is_none());
3688 /// ```
3689 pub fn set_version<T: std::convert::Into<std::boxed::Box<crate::model::Version>>>(
3690 mut self,
3691 v: T,
3692 ) -> Self {
3693 self.resource =
3694 std::option::Option::Some(crate::model::api_hub_resource::Resource::Version(v.into()));
3695 self
3696 }
3697}
3698
3699impl wkt::message::Message for ApiHubResource {
3700 fn typename() -> &'static str {
3701 "type.googleapis.com/google.cloud.apihub.v1.ApiHubResource"
3702 }
3703}
3704
3705/// Defines additional types related to [ApiHubResource].
3706pub mod api_hub_resource {
3707 #[allow(unused_imports)]
3708 use super::*;
3709
3710 #[derive(Clone, Debug, PartialEq)]
3711 #[non_exhaustive]
3712 pub enum Resource {
3713 /// This represents Api resource in search results. Only name, display_name,
3714 /// description and owner fields are populated in search results.
3715 Api(std::boxed::Box<crate::model::Api>),
3716 /// This represents ApiOperation resource in search results. Only name,
3717 /// description, spec and details fields are populated in search results.
3718 Operation(std::boxed::Box<crate::model::ApiOperation>),
3719 /// This represents Deployment resource in search results. Only name,
3720 /// display_name, description, deployment_type and api_versions fields are
3721 /// populated in search results.
3722 Deployment(std::boxed::Box<crate::model::Deployment>),
3723 /// This represents Spec resource in search results. Only name,
3724 /// display_name, description, spec_type and documentation fields are
3725 /// populated in search results.
3726 Spec(std::boxed::Box<crate::model::Spec>),
3727 /// This represents Definition resource in search results.
3728 /// Only name field is populated in search results.
3729 Definition(std::boxed::Box<crate::model::Definition>),
3730 /// This represents Version resource in search results. Only name,
3731 /// display_name, description, lifecycle, compliance and accreditation fields
3732 /// are populated in search results.
3733 Version(std::boxed::Box<crate::model::Version>),
3734 }
3735}
3736
3737/// Represents the search results.
3738#[derive(Clone, Default, PartialEq)]
3739#[non_exhaustive]
3740pub struct SearchResult {
3741 /// This represents the ApiHubResource.
3742 /// Note: Only selected fields of the resources are populated in response.
3743 pub resource: std::option::Option<crate::model::ApiHubResource>,
3744
3745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3746}
3747
3748impl SearchResult {
3749 pub fn new() -> Self {
3750 std::default::Default::default()
3751 }
3752
3753 /// Sets the value of [resource][crate::model::SearchResult::resource].
3754 ///
3755 /// # Example
3756 /// ```ignore,no_run
3757 /// # use google_cloud_apihub_v1::model::SearchResult;
3758 /// use google_cloud_apihub_v1::model::ApiHubResource;
3759 /// let x = SearchResult::new().set_resource(ApiHubResource::default()/* use setters */);
3760 /// ```
3761 pub fn set_resource<T>(mut self, v: T) -> Self
3762 where
3763 T: std::convert::Into<crate::model::ApiHubResource>,
3764 {
3765 self.resource = std::option::Option::Some(v.into());
3766 self
3767 }
3768
3769 /// Sets or clears the value of [resource][crate::model::SearchResult::resource].
3770 ///
3771 /// # Example
3772 /// ```ignore,no_run
3773 /// # use google_cloud_apihub_v1::model::SearchResult;
3774 /// use google_cloud_apihub_v1::model::ApiHubResource;
3775 /// let x = SearchResult::new().set_or_clear_resource(Some(ApiHubResource::default()/* use setters */));
3776 /// let x = SearchResult::new().set_or_clear_resource(None::<ApiHubResource>);
3777 /// ```
3778 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
3779 where
3780 T: std::convert::Into<crate::model::ApiHubResource>,
3781 {
3782 self.resource = v.map(|x| x.into());
3783 self
3784 }
3785}
3786
3787impl wkt::message::Message for SearchResult {
3788 fn typename() -> &'static str {
3789 "type.googleapis.com/google.cloud.apihub.v1.SearchResult"
3790 }
3791}
3792
3793/// Response for the
3794/// [SearchResources][google.cloud.apihub.v1.ApiHub.SearchResources] method.
3795///
3796/// [google.cloud.apihub.v1.ApiHub.SearchResources]: crate::client::ApiHub::search_resources
3797#[derive(Clone, Default, PartialEq)]
3798#[non_exhaustive]
3799pub struct SearchResourcesResponse {
3800 /// List of search results according to the filter and search query specified.
3801 /// The order of search results represents the ranking.
3802 pub search_results: std::vec::Vec<crate::model::SearchResult>,
3803
3804 /// Pass this token in the
3805 /// [SearchResourcesRequest][google.cloud.apihub.v1.SearchResourcesRequest]
3806 /// to continue to list results. If all results have been returned, this field
3807 /// is an empty string or not present in the response.
3808 ///
3809 /// [google.cloud.apihub.v1.SearchResourcesRequest]: crate::model::SearchResourcesRequest
3810 pub next_page_token: std::string::String,
3811
3812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3813}
3814
3815impl SearchResourcesResponse {
3816 pub fn new() -> Self {
3817 std::default::Default::default()
3818 }
3819
3820 /// Sets the value of [search_results][crate::model::SearchResourcesResponse::search_results].
3821 ///
3822 /// # Example
3823 /// ```ignore,no_run
3824 /// # use google_cloud_apihub_v1::model::SearchResourcesResponse;
3825 /// use google_cloud_apihub_v1::model::SearchResult;
3826 /// let x = SearchResourcesResponse::new()
3827 /// .set_search_results([
3828 /// SearchResult::default()/* use setters */,
3829 /// SearchResult::default()/* use (different) setters */,
3830 /// ]);
3831 /// ```
3832 pub fn set_search_results<T, V>(mut self, v: T) -> Self
3833 where
3834 T: std::iter::IntoIterator<Item = V>,
3835 V: std::convert::Into<crate::model::SearchResult>,
3836 {
3837 use std::iter::Iterator;
3838 self.search_results = v.into_iter().map(|i| i.into()).collect();
3839 self
3840 }
3841
3842 /// Sets the value of [next_page_token][crate::model::SearchResourcesResponse::next_page_token].
3843 ///
3844 /// # Example
3845 /// ```ignore,no_run
3846 /// # use google_cloud_apihub_v1::model::SearchResourcesResponse;
3847 /// let x = SearchResourcesResponse::new().set_next_page_token("example");
3848 /// ```
3849 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3850 self.next_page_token = v.into();
3851 self
3852 }
3853}
3854
3855impl wkt::message::Message for SearchResourcesResponse {
3856 fn typename() -> &'static str {
3857 "type.googleapis.com/google.cloud.apihub.v1.SearchResourcesResponse"
3858 }
3859}
3860
3861#[doc(hidden)]
3862impl google_cloud_gax::paginator::internal::PageableResponse for SearchResourcesResponse {
3863 type PageItem = crate::model::SearchResult;
3864
3865 fn items(self) -> std::vec::Vec<Self::PageItem> {
3866 self.search_results
3867 }
3868
3869 fn next_page_token(&self) -> std::string::String {
3870 use std::clone::Clone;
3871 self.next_page_token.clone()
3872 }
3873}
3874
3875/// The
3876/// [CreateDependency][google.cloud.apihub.v1.ApiHubDependencies.CreateDependency]
3877/// method's request.
3878///
3879/// [google.cloud.apihub.v1.ApiHubDependencies.CreateDependency]: crate::client::ApiHubDependencies::create_dependency
3880#[derive(Clone, Default, PartialEq)]
3881#[non_exhaustive]
3882pub struct CreateDependencyRequest {
3883 /// Required. The parent resource for the dependency resource.
3884 /// Format: `projects/{project}/locations/{location}`
3885 pub parent: std::string::String,
3886
3887 /// Optional. The ID to use for the dependency resource, which will become the
3888 /// final component of the dependency's resource name. This field is optional.
3889 ///
3890 /// * If provided, the same will be used. The service will throw an error if
3891 /// duplicate id is provided by the client.
3892 /// * If not provided, a system generated id will be used.
3893 ///
3894 /// This value should be 4-500 characters, and valid characters
3895 /// are `[a-z][A-Z][0-9]-_`.
3896 pub dependency_id: std::string::String,
3897
3898 /// Required. The dependency resource to create.
3899 pub dependency: std::option::Option<crate::model::Dependency>,
3900
3901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3902}
3903
3904impl CreateDependencyRequest {
3905 pub fn new() -> Self {
3906 std::default::Default::default()
3907 }
3908
3909 /// Sets the value of [parent][crate::model::CreateDependencyRequest::parent].
3910 ///
3911 /// # Example
3912 /// ```ignore,no_run
3913 /// # use google_cloud_apihub_v1::model::CreateDependencyRequest;
3914 /// let x = CreateDependencyRequest::new().set_parent("example");
3915 /// ```
3916 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3917 self.parent = v.into();
3918 self
3919 }
3920
3921 /// Sets the value of [dependency_id][crate::model::CreateDependencyRequest::dependency_id].
3922 ///
3923 /// # Example
3924 /// ```ignore,no_run
3925 /// # use google_cloud_apihub_v1::model::CreateDependencyRequest;
3926 /// let x = CreateDependencyRequest::new().set_dependency_id("example");
3927 /// ```
3928 pub fn set_dependency_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3929 self.dependency_id = v.into();
3930 self
3931 }
3932
3933 /// Sets the value of [dependency][crate::model::CreateDependencyRequest::dependency].
3934 ///
3935 /// # Example
3936 /// ```ignore,no_run
3937 /// # use google_cloud_apihub_v1::model::CreateDependencyRequest;
3938 /// use google_cloud_apihub_v1::model::Dependency;
3939 /// let x = CreateDependencyRequest::new().set_dependency(Dependency::default()/* use setters */);
3940 /// ```
3941 pub fn set_dependency<T>(mut self, v: T) -> Self
3942 where
3943 T: std::convert::Into<crate::model::Dependency>,
3944 {
3945 self.dependency = std::option::Option::Some(v.into());
3946 self
3947 }
3948
3949 /// Sets or clears the value of [dependency][crate::model::CreateDependencyRequest::dependency].
3950 ///
3951 /// # Example
3952 /// ```ignore,no_run
3953 /// # use google_cloud_apihub_v1::model::CreateDependencyRequest;
3954 /// use google_cloud_apihub_v1::model::Dependency;
3955 /// let x = CreateDependencyRequest::new().set_or_clear_dependency(Some(Dependency::default()/* use setters */));
3956 /// let x = CreateDependencyRequest::new().set_or_clear_dependency(None::<Dependency>);
3957 /// ```
3958 pub fn set_or_clear_dependency<T>(mut self, v: std::option::Option<T>) -> Self
3959 where
3960 T: std::convert::Into<crate::model::Dependency>,
3961 {
3962 self.dependency = v.map(|x| x.into());
3963 self
3964 }
3965}
3966
3967impl wkt::message::Message for CreateDependencyRequest {
3968 fn typename() -> &'static str {
3969 "type.googleapis.com/google.cloud.apihub.v1.CreateDependencyRequest"
3970 }
3971}
3972
3973/// The [GetDependency][.ApiHubDependencies.GetDependency]
3974/// method's request.
3975#[derive(Clone, Default, PartialEq)]
3976#[non_exhaustive]
3977pub struct GetDependencyRequest {
3978 /// Required. The name of the dependency resource to retrieve.
3979 /// Format: `projects/{project}/locations/{location}/dependencies/{dependency}`
3980 pub name: std::string::String,
3981
3982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3983}
3984
3985impl GetDependencyRequest {
3986 pub fn new() -> Self {
3987 std::default::Default::default()
3988 }
3989
3990 /// Sets the value of [name][crate::model::GetDependencyRequest::name].
3991 ///
3992 /// # Example
3993 /// ```ignore,no_run
3994 /// # use google_cloud_apihub_v1::model::GetDependencyRequest;
3995 /// let x = GetDependencyRequest::new().set_name("example");
3996 /// ```
3997 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3998 self.name = v.into();
3999 self
4000 }
4001}
4002
4003impl wkt::message::Message for GetDependencyRequest {
4004 fn typename() -> &'static str {
4005 "type.googleapis.com/google.cloud.apihub.v1.GetDependencyRequest"
4006 }
4007}
4008
4009/// The
4010/// [UpdateDependency][google.cloud.apihub.v1.ApiHubDependencies.UpdateDependency]
4011/// method's request.
4012///
4013/// [google.cloud.apihub.v1.ApiHubDependencies.UpdateDependency]: crate::client::ApiHubDependencies::update_dependency
4014#[derive(Clone, Default, PartialEq)]
4015#[non_exhaustive]
4016pub struct UpdateDependencyRequest {
4017 /// Required. The dependency resource to update.
4018 ///
4019 /// The dependency's `name` field is used to identify the dependency to update.
4020 /// Format: `projects/{project}/locations/{location}/dependencies/{dependency}`
4021 pub dependency: std::option::Option<crate::model::Dependency>,
4022
4023 /// Required. The list of fields to update.
4024 pub update_mask: std::option::Option<wkt::FieldMask>,
4025
4026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4027}
4028
4029impl UpdateDependencyRequest {
4030 pub fn new() -> Self {
4031 std::default::Default::default()
4032 }
4033
4034 /// Sets the value of [dependency][crate::model::UpdateDependencyRequest::dependency].
4035 ///
4036 /// # Example
4037 /// ```ignore,no_run
4038 /// # use google_cloud_apihub_v1::model::UpdateDependencyRequest;
4039 /// use google_cloud_apihub_v1::model::Dependency;
4040 /// let x = UpdateDependencyRequest::new().set_dependency(Dependency::default()/* use setters */);
4041 /// ```
4042 pub fn set_dependency<T>(mut self, v: T) -> Self
4043 where
4044 T: std::convert::Into<crate::model::Dependency>,
4045 {
4046 self.dependency = std::option::Option::Some(v.into());
4047 self
4048 }
4049
4050 /// Sets or clears the value of [dependency][crate::model::UpdateDependencyRequest::dependency].
4051 ///
4052 /// # Example
4053 /// ```ignore,no_run
4054 /// # use google_cloud_apihub_v1::model::UpdateDependencyRequest;
4055 /// use google_cloud_apihub_v1::model::Dependency;
4056 /// let x = UpdateDependencyRequest::new().set_or_clear_dependency(Some(Dependency::default()/* use setters */));
4057 /// let x = UpdateDependencyRequest::new().set_or_clear_dependency(None::<Dependency>);
4058 /// ```
4059 pub fn set_or_clear_dependency<T>(mut self, v: std::option::Option<T>) -> Self
4060 where
4061 T: std::convert::Into<crate::model::Dependency>,
4062 {
4063 self.dependency = v.map(|x| x.into());
4064 self
4065 }
4066
4067 /// Sets the value of [update_mask][crate::model::UpdateDependencyRequest::update_mask].
4068 ///
4069 /// # Example
4070 /// ```ignore,no_run
4071 /// # use google_cloud_apihub_v1::model::UpdateDependencyRequest;
4072 /// use wkt::FieldMask;
4073 /// let x = UpdateDependencyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4074 /// ```
4075 pub fn set_update_mask<T>(mut self, v: T) -> Self
4076 where
4077 T: std::convert::Into<wkt::FieldMask>,
4078 {
4079 self.update_mask = std::option::Option::Some(v.into());
4080 self
4081 }
4082
4083 /// Sets or clears the value of [update_mask][crate::model::UpdateDependencyRequest::update_mask].
4084 ///
4085 /// # Example
4086 /// ```ignore,no_run
4087 /// # use google_cloud_apihub_v1::model::UpdateDependencyRequest;
4088 /// use wkt::FieldMask;
4089 /// let x = UpdateDependencyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4090 /// let x = UpdateDependencyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4091 /// ```
4092 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4093 where
4094 T: std::convert::Into<wkt::FieldMask>,
4095 {
4096 self.update_mask = v.map(|x| x.into());
4097 self
4098 }
4099}
4100
4101impl wkt::message::Message for UpdateDependencyRequest {
4102 fn typename() -> &'static str {
4103 "type.googleapis.com/google.cloud.apihub.v1.UpdateDependencyRequest"
4104 }
4105}
4106
4107/// The
4108/// [DeleteDependency][google.cloud.apihub.v1.ApiHubDependencies.DeleteDependency]
4109/// method's request.
4110///
4111/// [google.cloud.apihub.v1.ApiHubDependencies.DeleteDependency]: crate::client::ApiHubDependencies::delete_dependency
4112#[derive(Clone, Default, PartialEq)]
4113#[non_exhaustive]
4114pub struct DeleteDependencyRequest {
4115 /// Required. The name of the dependency resource to delete.
4116 /// Format: `projects/{project}/locations/{location}/dependencies/{dependency}`
4117 pub name: std::string::String,
4118
4119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4120}
4121
4122impl DeleteDependencyRequest {
4123 pub fn new() -> Self {
4124 std::default::Default::default()
4125 }
4126
4127 /// Sets the value of [name][crate::model::DeleteDependencyRequest::name].
4128 ///
4129 /// # Example
4130 /// ```ignore,no_run
4131 /// # use google_cloud_apihub_v1::model::DeleteDependencyRequest;
4132 /// let x = DeleteDependencyRequest::new().set_name("example");
4133 /// ```
4134 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4135 self.name = v.into();
4136 self
4137 }
4138}
4139
4140impl wkt::message::Message for DeleteDependencyRequest {
4141 fn typename() -> &'static str {
4142 "type.googleapis.com/google.cloud.apihub.v1.DeleteDependencyRequest"
4143 }
4144}
4145
4146/// The
4147/// [ListDependencies][google.cloud.apihub.v1.ApiHubDependencies.ListDependencies]
4148/// method's request.
4149///
4150/// [google.cloud.apihub.v1.ApiHubDependencies.ListDependencies]: crate::client::ApiHubDependencies::list_dependencies
4151#[derive(Clone, Default, PartialEq)]
4152#[non_exhaustive]
4153pub struct ListDependenciesRequest {
4154 /// Required. The parent which owns this collection of dependency resources.
4155 /// Format: `projects/{project}/locations/{location}`
4156 pub parent: std::string::String,
4157
4158 /// Optional. An expression that filters the list of Dependencies.
4159 ///
4160 /// A filter expression consists of a field name, a comparison operator, and
4161 /// a value for filtering. The value must be a string. Allowed comparison
4162 /// operator is `=`. Filters are not case sensitive.
4163 ///
4164 /// The following fields in the `Dependency` are eligible for filtering:
4165 ///
4166 /// * `consumer.operation_resource_name` - The operation resource name for
4167 /// the consumer entity involved in a dependency. Allowed comparison
4168 /// operators: `=`.
4169 /// * `consumer.external_api_resource_name` - The external api resource name
4170 /// for the consumer entity involved in a dependency. Allowed comparison
4171 /// operators: `=`.
4172 /// * `supplier.operation_resource_name` - The operation resource name for
4173 /// the supplier entity involved in a dependency. Allowed comparison
4174 /// operators: `=`.
4175 /// * `supplier.external_api_resource_name` - The external api resource name
4176 /// for the supplier entity involved in a dependency. Allowed comparison
4177 /// operators: `=`.
4178 ///
4179 /// Expressions are combined with either `AND` logic operator or `OR` logical
4180 /// operator but not both of them together i.e. only one of the `AND` or `OR`
4181 /// operator can be used throughout the filter string and both the operators
4182 /// cannot be used together. No other logical operators are supported. At most
4183 /// three filter fields are allowed in the filter string and if provided
4184 /// more than that then `INVALID_ARGUMENT` error is returned by the API.
4185 ///
4186 /// For example, `consumer.operation_resource_name =
4187 /// \"projects/p1/locations/global/apis/a1/versions/v1/operations/o1\" OR
4188 /// supplier.operation_resource_name =
4189 /// \"projects/p1/locations/global/apis/a1/versions/v1/operations/o1\"` - The
4190 /// dependencies with either consumer or supplier operation resource name as
4191 /// _projects/p1/locations/global/apis/a1/versions/v1/operations/o1_.
4192 pub filter: std::string::String,
4193
4194 /// Optional. The maximum number of dependency resources to return. The service
4195 /// may return fewer than this value. If unspecified, at most 50 dependencies
4196 /// will be returned. The maximum value is 1000; values above 1000 will be
4197 /// coerced to 1000.
4198 pub page_size: i32,
4199
4200 /// Optional. A page token, received from a previous `ListDependencies` call.
4201 /// Provide this to retrieve the subsequent page.
4202 ///
4203 /// When paginating, all other parameters provided to `ListDependencies` must
4204 /// match the call that provided the page token.
4205 pub page_token: std::string::String,
4206
4207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4208}
4209
4210impl ListDependenciesRequest {
4211 pub fn new() -> Self {
4212 std::default::Default::default()
4213 }
4214
4215 /// Sets the value of [parent][crate::model::ListDependenciesRequest::parent].
4216 ///
4217 /// # Example
4218 /// ```ignore,no_run
4219 /// # use google_cloud_apihub_v1::model::ListDependenciesRequest;
4220 /// let x = ListDependenciesRequest::new().set_parent("example");
4221 /// ```
4222 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4223 self.parent = v.into();
4224 self
4225 }
4226
4227 /// Sets the value of [filter][crate::model::ListDependenciesRequest::filter].
4228 ///
4229 /// # Example
4230 /// ```ignore,no_run
4231 /// # use google_cloud_apihub_v1::model::ListDependenciesRequest;
4232 /// let x = ListDependenciesRequest::new().set_filter("example");
4233 /// ```
4234 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4235 self.filter = v.into();
4236 self
4237 }
4238
4239 /// Sets the value of [page_size][crate::model::ListDependenciesRequest::page_size].
4240 ///
4241 /// # Example
4242 /// ```ignore,no_run
4243 /// # use google_cloud_apihub_v1::model::ListDependenciesRequest;
4244 /// let x = ListDependenciesRequest::new().set_page_size(42);
4245 /// ```
4246 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4247 self.page_size = v.into();
4248 self
4249 }
4250
4251 /// Sets the value of [page_token][crate::model::ListDependenciesRequest::page_token].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_apihub_v1::model::ListDependenciesRequest;
4256 /// let x = ListDependenciesRequest::new().set_page_token("example");
4257 /// ```
4258 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4259 self.page_token = v.into();
4260 self
4261 }
4262}
4263
4264impl wkt::message::Message for ListDependenciesRequest {
4265 fn typename() -> &'static str {
4266 "type.googleapis.com/google.cloud.apihub.v1.ListDependenciesRequest"
4267 }
4268}
4269
4270/// The
4271/// [ListDependencies][google.cloud.apihub.v1.ApiHubDependencies.ListDependencies]
4272/// method's response.
4273///
4274/// [google.cloud.apihub.v1.ApiHubDependencies.ListDependencies]: crate::client::ApiHubDependencies::list_dependencies
4275#[derive(Clone, Default, PartialEq)]
4276#[non_exhaustive]
4277pub struct ListDependenciesResponse {
4278 /// The dependency resources present in the API hub.
4279 pub dependencies: std::vec::Vec<crate::model::Dependency>,
4280
4281 /// A token, which can be sent as `page_token` to retrieve the next page.
4282 /// If this field is omitted, there are no subsequent pages.
4283 pub next_page_token: std::string::String,
4284
4285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4286}
4287
4288impl ListDependenciesResponse {
4289 pub fn new() -> Self {
4290 std::default::Default::default()
4291 }
4292
4293 /// Sets the value of [dependencies][crate::model::ListDependenciesResponse::dependencies].
4294 ///
4295 /// # Example
4296 /// ```ignore,no_run
4297 /// # use google_cloud_apihub_v1::model::ListDependenciesResponse;
4298 /// use google_cloud_apihub_v1::model::Dependency;
4299 /// let x = ListDependenciesResponse::new()
4300 /// .set_dependencies([
4301 /// Dependency::default()/* use setters */,
4302 /// Dependency::default()/* use (different) setters */,
4303 /// ]);
4304 /// ```
4305 pub fn set_dependencies<T, V>(mut self, v: T) -> Self
4306 where
4307 T: std::iter::IntoIterator<Item = V>,
4308 V: std::convert::Into<crate::model::Dependency>,
4309 {
4310 use std::iter::Iterator;
4311 self.dependencies = v.into_iter().map(|i| i.into()).collect();
4312 self
4313 }
4314
4315 /// Sets the value of [next_page_token][crate::model::ListDependenciesResponse::next_page_token].
4316 ///
4317 /// # Example
4318 /// ```ignore,no_run
4319 /// # use google_cloud_apihub_v1::model::ListDependenciesResponse;
4320 /// let x = ListDependenciesResponse::new().set_next_page_token("example");
4321 /// ```
4322 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4323 self.next_page_token = v.into();
4324 self
4325 }
4326}
4327
4328impl wkt::message::Message for ListDependenciesResponse {
4329 fn typename() -> &'static str {
4330 "type.googleapis.com/google.cloud.apihub.v1.ListDependenciesResponse"
4331 }
4332}
4333
4334#[doc(hidden)]
4335impl google_cloud_gax::paginator::internal::PageableResponse for ListDependenciesResponse {
4336 type PageItem = crate::model::Dependency;
4337
4338 fn items(self) -> std::vec::Vec<Self::PageItem> {
4339 self.dependencies
4340 }
4341
4342 fn next_page_token(&self) -> std::string::String {
4343 use std::clone::Clone;
4344 self.next_page_token.clone()
4345 }
4346}
4347
4348/// The [CreateExternalApi][google.cloud.apihub.v1.ApiHub.CreateExternalApi]
4349/// method's request.
4350///
4351/// [google.cloud.apihub.v1.ApiHub.CreateExternalApi]: crate::client::ApiHub::create_external_api
4352#[derive(Clone, Default, PartialEq)]
4353#[non_exhaustive]
4354pub struct CreateExternalApiRequest {
4355 /// Required. The parent resource for the External API resource.
4356 /// Format: `projects/{project}/locations/{location}`
4357 pub parent: std::string::String,
4358
4359 /// Optional. The ID to use for the External API resource, which will become
4360 /// the final component of the External API's resource name. This field is
4361 /// optional.
4362 ///
4363 /// * If provided, the same will be used. The service will throw an error if
4364 /// the specified id is already used by another External API resource in the
4365 /// API hub.
4366 /// * If not provided, a system generated id will be used.
4367 ///
4368 /// This value should be 4-500 characters, and valid characters
4369 /// are /[a-z][A-Z][0-9]-_/.
4370 pub external_api_id: std::string::String,
4371
4372 /// Required. The External API resource to create.
4373 pub external_api: std::option::Option<crate::model::ExternalApi>,
4374
4375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4376}
4377
4378impl CreateExternalApiRequest {
4379 pub fn new() -> Self {
4380 std::default::Default::default()
4381 }
4382
4383 /// Sets the value of [parent][crate::model::CreateExternalApiRequest::parent].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_apihub_v1::model::CreateExternalApiRequest;
4388 /// let x = CreateExternalApiRequest::new().set_parent("example");
4389 /// ```
4390 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.parent = v.into();
4392 self
4393 }
4394
4395 /// Sets the value of [external_api_id][crate::model::CreateExternalApiRequest::external_api_id].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_apihub_v1::model::CreateExternalApiRequest;
4400 /// let x = CreateExternalApiRequest::new().set_external_api_id("example");
4401 /// ```
4402 pub fn set_external_api_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4403 self.external_api_id = v.into();
4404 self
4405 }
4406
4407 /// Sets the value of [external_api][crate::model::CreateExternalApiRequest::external_api].
4408 ///
4409 /// # Example
4410 /// ```ignore,no_run
4411 /// # use google_cloud_apihub_v1::model::CreateExternalApiRequest;
4412 /// use google_cloud_apihub_v1::model::ExternalApi;
4413 /// let x = CreateExternalApiRequest::new().set_external_api(ExternalApi::default()/* use setters */);
4414 /// ```
4415 pub fn set_external_api<T>(mut self, v: T) -> Self
4416 where
4417 T: std::convert::Into<crate::model::ExternalApi>,
4418 {
4419 self.external_api = std::option::Option::Some(v.into());
4420 self
4421 }
4422
4423 /// Sets or clears the value of [external_api][crate::model::CreateExternalApiRequest::external_api].
4424 ///
4425 /// # Example
4426 /// ```ignore,no_run
4427 /// # use google_cloud_apihub_v1::model::CreateExternalApiRequest;
4428 /// use google_cloud_apihub_v1::model::ExternalApi;
4429 /// let x = CreateExternalApiRequest::new().set_or_clear_external_api(Some(ExternalApi::default()/* use setters */));
4430 /// let x = CreateExternalApiRequest::new().set_or_clear_external_api(None::<ExternalApi>);
4431 /// ```
4432 pub fn set_or_clear_external_api<T>(mut self, v: std::option::Option<T>) -> Self
4433 where
4434 T: std::convert::Into<crate::model::ExternalApi>,
4435 {
4436 self.external_api = v.map(|x| x.into());
4437 self
4438 }
4439}
4440
4441impl wkt::message::Message for CreateExternalApiRequest {
4442 fn typename() -> &'static str {
4443 "type.googleapis.com/google.cloud.apihub.v1.CreateExternalApiRequest"
4444 }
4445}
4446
4447/// The [GetExternalApi][google.cloud.apihub.v1.ApiHub.GetExternalApi] method's
4448/// request.
4449///
4450/// [google.cloud.apihub.v1.ApiHub.GetExternalApi]: crate::client::ApiHub::get_external_api
4451#[derive(Clone, Default, PartialEq)]
4452#[non_exhaustive]
4453pub struct GetExternalApiRequest {
4454 /// Required. The name of the External API resource to retrieve.
4455 /// Format:
4456 /// `projects/{project}/locations/{location}/externalApis/{externalApi}`
4457 pub name: std::string::String,
4458
4459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4460}
4461
4462impl GetExternalApiRequest {
4463 pub fn new() -> Self {
4464 std::default::Default::default()
4465 }
4466
4467 /// Sets the value of [name][crate::model::GetExternalApiRequest::name].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_apihub_v1::model::GetExternalApiRequest;
4472 /// let x = GetExternalApiRequest::new().set_name("example");
4473 /// ```
4474 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4475 self.name = v.into();
4476 self
4477 }
4478}
4479
4480impl wkt::message::Message for GetExternalApiRequest {
4481 fn typename() -> &'static str {
4482 "type.googleapis.com/google.cloud.apihub.v1.GetExternalApiRequest"
4483 }
4484}
4485
4486/// The [UpdateExternalApi][google.cloud.apihub.v1.ApiHub.UpdateExternalApi]
4487/// method's request.
4488///
4489/// [google.cloud.apihub.v1.ApiHub.UpdateExternalApi]: crate::client::ApiHub::update_external_api
4490#[derive(Clone, Default, PartialEq)]
4491#[non_exhaustive]
4492pub struct UpdateExternalApiRequest {
4493 /// Required. The External API resource to update.
4494 ///
4495 /// The External API resource's `name` field is used to identify the External
4496 /// API resource to update. Format:
4497 /// `projects/{project}/locations/{location}/externalApis/{externalApi}`
4498 pub external_api: std::option::Option<crate::model::ExternalApi>,
4499
4500 /// Required. The list of fields to update.
4501 pub update_mask: std::option::Option<wkt::FieldMask>,
4502
4503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4504}
4505
4506impl UpdateExternalApiRequest {
4507 pub fn new() -> Self {
4508 std::default::Default::default()
4509 }
4510
4511 /// Sets the value of [external_api][crate::model::UpdateExternalApiRequest::external_api].
4512 ///
4513 /// # Example
4514 /// ```ignore,no_run
4515 /// # use google_cloud_apihub_v1::model::UpdateExternalApiRequest;
4516 /// use google_cloud_apihub_v1::model::ExternalApi;
4517 /// let x = UpdateExternalApiRequest::new().set_external_api(ExternalApi::default()/* use setters */);
4518 /// ```
4519 pub fn set_external_api<T>(mut self, v: T) -> Self
4520 where
4521 T: std::convert::Into<crate::model::ExternalApi>,
4522 {
4523 self.external_api = std::option::Option::Some(v.into());
4524 self
4525 }
4526
4527 /// Sets or clears the value of [external_api][crate::model::UpdateExternalApiRequest::external_api].
4528 ///
4529 /// # Example
4530 /// ```ignore,no_run
4531 /// # use google_cloud_apihub_v1::model::UpdateExternalApiRequest;
4532 /// use google_cloud_apihub_v1::model::ExternalApi;
4533 /// let x = UpdateExternalApiRequest::new().set_or_clear_external_api(Some(ExternalApi::default()/* use setters */));
4534 /// let x = UpdateExternalApiRequest::new().set_or_clear_external_api(None::<ExternalApi>);
4535 /// ```
4536 pub fn set_or_clear_external_api<T>(mut self, v: std::option::Option<T>) -> Self
4537 where
4538 T: std::convert::Into<crate::model::ExternalApi>,
4539 {
4540 self.external_api = v.map(|x| x.into());
4541 self
4542 }
4543
4544 /// Sets the value of [update_mask][crate::model::UpdateExternalApiRequest::update_mask].
4545 ///
4546 /// # Example
4547 /// ```ignore,no_run
4548 /// # use google_cloud_apihub_v1::model::UpdateExternalApiRequest;
4549 /// use wkt::FieldMask;
4550 /// let x = UpdateExternalApiRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4551 /// ```
4552 pub fn set_update_mask<T>(mut self, v: T) -> Self
4553 where
4554 T: std::convert::Into<wkt::FieldMask>,
4555 {
4556 self.update_mask = std::option::Option::Some(v.into());
4557 self
4558 }
4559
4560 /// Sets or clears the value of [update_mask][crate::model::UpdateExternalApiRequest::update_mask].
4561 ///
4562 /// # Example
4563 /// ```ignore,no_run
4564 /// # use google_cloud_apihub_v1::model::UpdateExternalApiRequest;
4565 /// use wkt::FieldMask;
4566 /// let x = UpdateExternalApiRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4567 /// let x = UpdateExternalApiRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4568 /// ```
4569 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4570 where
4571 T: std::convert::Into<wkt::FieldMask>,
4572 {
4573 self.update_mask = v.map(|x| x.into());
4574 self
4575 }
4576}
4577
4578impl wkt::message::Message for UpdateExternalApiRequest {
4579 fn typename() -> &'static str {
4580 "type.googleapis.com/google.cloud.apihub.v1.UpdateExternalApiRequest"
4581 }
4582}
4583
4584/// The [DeleteExternalApi][google.cloud.apihub.v1.ApiHub.DeleteExternalApi]
4585/// method's request.
4586///
4587/// [google.cloud.apihub.v1.ApiHub.DeleteExternalApi]: crate::client::ApiHub::delete_external_api
4588#[derive(Clone, Default, PartialEq)]
4589#[non_exhaustive]
4590pub struct DeleteExternalApiRequest {
4591 /// Required. The name of the External API resource to delete.
4592 /// Format:
4593 /// `projects/{project}/locations/{location}/externalApis/{externalApi}`
4594 pub name: std::string::String,
4595
4596 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4597}
4598
4599impl DeleteExternalApiRequest {
4600 pub fn new() -> Self {
4601 std::default::Default::default()
4602 }
4603
4604 /// Sets the value of [name][crate::model::DeleteExternalApiRequest::name].
4605 ///
4606 /// # Example
4607 /// ```ignore,no_run
4608 /// # use google_cloud_apihub_v1::model::DeleteExternalApiRequest;
4609 /// let x = DeleteExternalApiRequest::new().set_name("example");
4610 /// ```
4611 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4612 self.name = v.into();
4613 self
4614 }
4615}
4616
4617impl wkt::message::Message for DeleteExternalApiRequest {
4618 fn typename() -> &'static str {
4619 "type.googleapis.com/google.cloud.apihub.v1.DeleteExternalApiRequest"
4620 }
4621}
4622
4623/// The [ListExternalApis][google.cloud.apihub.v1.ApiHub.ListExternalApis]
4624/// method's request.
4625///
4626/// [google.cloud.apihub.v1.ApiHub.ListExternalApis]: crate::client::ApiHub::list_external_apis
4627#[derive(Clone, Default, PartialEq)]
4628#[non_exhaustive]
4629pub struct ListExternalApisRequest {
4630 /// Required. The parent, which owns this collection of External API resources.
4631 /// Format: `projects/{project}/locations/{location}`
4632 pub parent: std::string::String,
4633
4634 /// Optional. The maximum number of External API resources to return. The
4635 /// service may return fewer than this value. If unspecified, at most 50
4636 /// ExternalApis will be returned. The maximum value is 1000; values above 1000
4637 /// will be coerced to 1000.
4638 pub page_size: i32,
4639
4640 /// Optional. A page token, received from a previous `ListExternalApis` call.
4641 /// Provide this to retrieve the subsequent page.
4642 ///
4643 /// When paginating, all other parameters (except page_size) provided to
4644 /// `ListExternalApis` must match the call that provided the page token.
4645 pub page_token: std::string::String,
4646
4647 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4648}
4649
4650impl ListExternalApisRequest {
4651 pub fn new() -> Self {
4652 std::default::Default::default()
4653 }
4654
4655 /// Sets the value of [parent][crate::model::ListExternalApisRequest::parent].
4656 ///
4657 /// # Example
4658 /// ```ignore,no_run
4659 /// # use google_cloud_apihub_v1::model::ListExternalApisRequest;
4660 /// let x = ListExternalApisRequest::new().set_parent("example");
4661 /// ```
4662 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4663 self.parent = v.into();
4664 self
4665 }
4666
4667 /// Sets the value of [page_size][crate::model::ListExternalApisRequest::page_size].
4668 ///
4669 /// # Example
4670 /// ```ignore,no_run
4671 /// # use google_cloud_apihub_v1::model::ListExternalApisRequest;
4672 /// let x = ListExternalApisRequest::new().set_page_size(42);
4673 /// ```
4674 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4675 self.page_size = v.into();
4676 self
4677 }
4678
4679 /// Sets the value of [page_token][crate::model::ListExternalApisRequest::page_token].
4680 ///
4681 /// # Example
4682 /// ```ignore,no_run
4683 /// # use google_cloud_apihub_v1::model::ListExternalApisRequest;
4684 /// let x = ListExternalApisRequest::new().set_page_token("example");
4685 /// ```
4686 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4687 self.page_token = v.into();
4688 self
4689 }
4690}
4691
4692impl wkt::message::Message for ListExternalApisRequest {
4693 fn typename() -> &'static str {
4694 "type.googleapis.com/google.cloud.apihub.v1.ListExternalApisRequest"
4695 }
4696}
4697
4698/// The [ListExternalApis][google.cloud.apihub.v1.ApiHub.ListExternalApis]
4699/// method's response.
4700///
4701/// [google.cloud.apihub.v1.ApiHub.ListExternalApis]: crate::client::ApiHub::list_external_apis
4702#[derive(Clone, Default, PartialEq)]
4703#[non_exhaustive]
4704pub struct ListExternalApisResponse {
4705 /// The External API resources present in the API hub.
4706 pub external_apis: std::vec::Vec<crate::model::ExternalApi>,
4707
4708 /// A token, which can be sent as `page_token` to retrieve the next page.
4709 /// If this field is omitted, there are no subsequent pages.
4710 pub next_page_token: std::string::String,
4711
4712 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4713}
4714
4715impl ListExternalApisResponse {
4716 pub fn new() -> Self {
4717 std::default::Default::default()
4718 }
4719
4720 /// Sets the value of [external_apis][crate::model::ListExternalApisResponse::external_apis].
4721 ///
4722 /// # Example
4723 /// ```ignore,no_run
4724 /// # use google_cloud_apihub_v1::model::ListExternalApisResponse;
4725 /// use google_cloud_apihub_v1::model::ExternalApi;
4726 /// let x = ListExternalApisResponse::new()
4727 /// .set_external_apis([
4728 /// ExternalApi::default()/* use setters */,
4729 /// ExternalApi::default()/* use (different) setters */,
4730 /// ]);
4731 /// ```
4732 pub fn set_external_apis<T, V>(mut self, v: T) -> Self
4733 where
4734 T: std::iter::IntoIterator<Item = V>,
4735 V: std::convert::Into<crate::model::ExternalApi>,
4736 {
4737 use std::iter::Iterator;
4738 self.external_apis = v.into_iter().map(|i| i.into()).collect();
4739 self
4740 }
4741
4742 /// Sets the value of [next_page_token][crate::model::ListExternalApisResponse::next_page_token].
4743 ///
4744 /// # Example
4745 /// ```ignore,no_run
4746 /// # use google_cloud_apihub_v1::model::ListExternalApisResponse;
4747 /// let x = ListExternalApisResponse::new().set_next_page_token("example");
4748 /// ```
4749 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4750 self.next_page_token = v.into();
4751 self
4752 }
4753}
4754
4755impl wkt::message::Message for ListExternalApisResponse {
4756 fn typename() -> &'static str {
4757 "type.googleapis.com/google.cloud.apihub.v1.ListExternalApisResponse"
4758 }
4759}
4760
4761#[doc(hidden)]
4762impl google_cloud_gax::paginator::internal::PageableResponse for ListExternalApisResponse {
4763 type PageItem = crate::model::ExternalApi;
4764
4765 fn items(self) -> std::vec::Vec<Self::PageItem> {
4766 self.external_apis
4767 }
4768
4769 fn next_page_token(&self) -> std::string::String {
4770 use std::clone::Clone;
4771 self.next_page_token.clone()
4772 }
4773}
4774
4775/// The CollectApiData method's request.
4776#[derive(Clone, Default, PartialEq)]
4777#[non_exhaustive]
4778pub struct CollectApiDataRequest {
4779 /// Required. The regional location of the API hub instance and its resources.
4780 /// Format: `projects/{project}/locations/{location}`
4781 pub location: std::string::String,
4782
4783 /// Required. The type of collection. Applies to all entries in
4784 /// [api_data][google.cloud.apihub.v1.CollectApiDataRequest.api_data].
4785 ///
4786 /// [google.cloud.apihub.v1.CollectApiDataRequest.api_data]: crate::model::CollectApiDataRequest::api_data
4787 pub collection_type: crate::model::CollectionType,
4788
4789 /// Required. The plugin instance collecting the API data.
4790 /// Format:
4791 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`.
4792 pub plugin_instance: std::string::String,
4793
4794 /// Required. The action ID to be used for collecting the API data.
4795 /// This should map to one of the action IDs specified
4796 /// in action configs in the plugin.
4797 pub action_id: std::string::String,
4798
4799 /// Required. The API data to be collected.
4800 pub api_data: std::option::Option<crate::model::ApiData>,
4801
4802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4803}
4804
4805impl CollectApiDataRequest {
4806 pub fn new() -> Self {
4807 std::default::Default::default()
4808 }
4809
4810 /// Sets the value of [location][crate::model::CollectApiDataRequest::location].
4811 ///
4812 /// # Example
4813 /// ```ignore,no_run
4814 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4815 /// let x = CollectApiDataRequest::new().set_location("example");
4816 /// ```
4817 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4818 self.location = v.into();
4819 self
4820 }
4821
4822 /// Sets the value of [collection_type][crate::model::CollectApiDataRequest::collection_type].
4823 ///
4824 /// # Example
4825 /// ```ignore,no_run
4826 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4827 /// use google_cloud_apihub_v1::model::CollectionType;
4828 /// let x0 = CollectApiDataRequest::new().set_collection_type(CollectionType::Upsert);
4829 /// let x1 = CollectApiDataRequest::new().set_collection_type(CollectionType::Delete);
4830 /// ```
4831 pub fn set_collection_type<T: std::convert::Into<crate::model::CollectionType>>(
4832 mut self,
4833 v: T,
4834 ) -> Self {
4835 self.collection_type = v.into();
4836 self
4837 }
4838
4839 /// Sets the value of [plugin_instance][crate::model::CollectApiDataRequest::plugin_instance].
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4844 /// let x = CollectApiDataRequest::new().set_plugin_instance("example");
4845 /// ```
4846 pub fn set_plugin_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4847 self.plugin_instance = v.into();
4848 self
4849 }
4850
4851 /// Sets the value of [action_id][crate::model::CollectApiDataRequest::action_id].
4852 ///
4853 /// # Example
4854 /// ```ignore,no_run
4855 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4856 /// let x = CollectApiDataRequest::new().set_action_id("example");
4857 /// ```
4858 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4859 self.action_id = v.into();
4860 self
4861 }
4862
4863 /// Sets the value of [api_data][crate::model::CollectApiDataRequest::api_data].
4864 ///
4865 /// # Example
4866 /// ```ignore,no_run
4867 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4868 /// use google_cloud_apihub_v1::model::ApiData;
4869 /// let x = CollectApiDataRequest::new().set_api_data(ApiData::default()/* use setters */);
4870 /// ```
4871 pub fn set_api_data<T>(mut self, v: T) -> Self
4872 where
4873 T: std::convert::Into<crate::model::ApiData>,
4874 {
4875 self.api_data = std::option::Option::Some(v.into());
4876 self
4877 }
4878
4879 /// Sets or clears the value of [api_data][crate::model::CollectApiDataRequest::api_data].
4880 ///
4881 /// # Example
4882 /// ```ignore,no_run
4883 /// # use google_cloud_apihub_v1::model::CollectApiDataRequest;
4884 /// use google_cloud_apihub_v1::model::ApiData;
4885 /// let x = CollectApiDataRequest::new().set_or_clear_api_data(Some(ApiData::default()/* use setters */));
4886 /// let x = CollectApiDataRequest::new().set_or_clear_api_data(None::<ApiData>);
4887 /// ```
4888 pub fn set_or_clear_api_data<T>(mut self, v: std::option::Option<T>) -> Self
4889 where
4890 T: std::convert::Into<crate::model::ApiData>,
4891 {
4892 self.api_data = v.map(|x| x.into());
4893 self
4894 }
4895}
4896
4897impl wkt::message::Message for CollectApiDataRequest {
4898 fn typename() -> &'static str {
4899 "type.googleapis.com/google.cloud.apihub.v1.CollectApiDataRequest"
4900 }
4901}
4902
4903/// The API data to be collected.
4904#[derive(Clone, Default, PartialEq)]
4905#[non_exhaustive]
4906pub struct ApiData {
4907 /// The data to be collected.
4908 pub data: std::option::Option<crate::model::api_data::Data>,
4909
4910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4911}
4912
4913impl ApiData {
4914 pub fn new() -> Self {
4915 std::default::Default::default()
4916 }
4917
4918 /// Sets the value of [data][crate::model::ApiData::data].
4919 ///
4920 /// Note that all the setters affecting `data` are mutually
4921 /// exclusive.
4922 ///
4923 /// # Example
4924 /// ```ignore,no_run
4925 /// # use google_cloud_apihub_v1::model::ApiData;
4926 /// use google_cloud_apihub_v1::model::ApiMetadataList;
4927 /// let x = ApiData::new().set_data(Some(
4928 /// google_cloud_apihub_v1::model::api_data::Data::ApiMetadataList(ApiMetadataList::default().into())));
4929 /// ```
4930 pub fn set_data<T: std::convert::Into<std::option::Option<crate::model::api_data::Data>>>(
4931 mut self,
4932 v: T,
4933 ) -> Self {
4934 self.data = v.into();
4935 self
4936 }
4937
4938 /// The value of [data][crate::model::ApiData::data]
4939 /// if it holds a `ApiMetadataList`, `None` if the field is not set or
4940 /// holds a different branch.
4941 pub fn api_metadata_list(
4942 &self,
4943 ) -> std::option::Option<&std::boxed::Box<crate::model::ApiMetadataList>> {
4944 #[allow(unreachable_patterns)]
4945 self.data.as_ref().and_then(|v| match v {
4946 crate::model::api_data::Data::ApiMetadataList(v) => std::option::Option::Some(v),
4947 _ => std::option::Option::None,
4948 })
4949 }
4950
4951 /// Sets the value of [data][crate::model::ApiData::data]
4952 /// to hold a `ApiMetadataList`.
4953 ///
4954 /// Note that all the setters affecting `data` are
4955 /// mutually exclusive.
4956 ///
4957 /// # Example
4958 /// ```ignore,no_run
4959 /// # use google_cloud_apihub_v1::model::ApiData;
4960 /// use google_cloud_apihub_v1::model::ApiMetadataList;
4961 /// let x = ApiData::new().set_api_metadata_list(ApiMetadataList::default()/* use setters */);
4962 /// assert!(x.api_metadata_list().is_some());
4963 /// ```
4964 pub fn set_api_metadata_list<
4965 T: std::convert::Into<std::boxed::Box<crate::model::ApiMetadataList>>,
4966 >(
4967 mut self,
4968 v: T,
4969 ) -> Self {
4970 self.data =
4971 std::option::Option::Some(crate::model::api_data::Data::ApiMetadataList(v.into()));
4972 self
4973 }
4974}
4975
4976impl wkt::message::Message for ApiData {
4977 fn typename() -> &'static str {
4978 "type.googleapis.com/google.cloud.apihub.v1.ApiData"
4979 }
4980}
4981
4982/// Defines additional types related to [ApiData].
4983pub mod api_data {
4984 #[allow(unused_imports)]
4985 use super::*;
4986
4987 /// The data to be collected.
4988 #[derive(Clone, Debug, PartialEq)]
4989 #[non_exhaustive]
4990 pub enum Data {
4991 /// Optional. The list of API metadata.
4992 ApiMetadataList(std::boxed::Box<crate::model::ApiMetadataList>),
4993 }
4994}
4995
4996/// The message to hold repeated API metadata.
4997#[derive(Clone, Default, PartialEq)]
4998#[non_exhaustive]
4999pub struct ApiMetadataList {
5000 /// Required. The list of API metadata.
5001 pub api_metadata: std::vec::Vec<crate::model::APIMetadata>,
5002
5003 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5004}
5005
5006impl ApiMetadataList {
5007 pub fn new() -> Self {
5008 std::default::Default::default()
5009 }
5010
5011 /// Sets the value of [api_metadata][crate::model::ApiMetadataList::api_metadata].
5012 ///
5013 /// # Example
5014 /// ```ignore,no_run
5015 /// # use google_cloud_apihub_v1::model::ApiMetadataList;
5016 /// use google_cloud_apihub_v1::model::APIMetadata;
5017 /// let x = ApiMetadataList::new()
5018 /// .set_api_metadata([
5019 /// APIMetadata::default()/* use setters */,
5020 /// APIMetadata::default()/* use (different) setters */,
5021 /// ]);
5022 /// ```
5023 pub fn set_api_metadata<T, V>(mut self, v: T) -> Self
5024 where
5025 T: std::iter::IntoIterator<Item = V>,
5026 V: std::convert::Into<crate::model::APIMetadata>,
5027 {
5028 use std::iter::Iterator;
5029 self.api_metadata = v.into_iter().map(|i| i.into()).collect();
5030 self
5031 }
5032}
5033
5034impl wkt::message::Message for ApiMetadataList {
5035 fn typename() -> &'static str {
5036 "type.googleapis.com/google.cloud.apihub.v1.ApiMetadataList"
5037 }
5038}
5039
5040/// The API metadata.
5041#[derive(Clone, Default, PartialEq)]
5042#[non_exhaustive]
5043pub struct APIMetadata {
5044 /// Required. The API resource to be pushed to Hub's collect layer. The ID of
5045 /// the API resource will be generated by Hub to ensure uniqueness across all
5046 /// APIs across systems.
5047 pub api: std::option::Option<crate::model::Api>,
5048
5049 /// Optional. The list of versions present in an API resource.
5050 pub versions: std::vec::Vec<crate::model::VersionMetadata>,
5051
5052 /// Optional. The unique identifier of the API in the system where it was
5053 /// originally created.
5054 pub original_id: std::string::String,
5055
5056 /// Optional. Timestamp indicating when the API was created at the source.
5057 pub original_create_time: std::option::Option<wkt::Timestamp>,
5058
5059 /// Required. Timestamp indicating when the API was last updated at the source.
5060 pub original_update_time: std::option::Option<wkt::Timestamp>,
5061
5062 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5063}
5064
5065impl APIMetadata {
5066 pub fn new() -> Self {
5067 std::default::Default::default()
5068 }
5069
5070 /// Sets the value of [api][crate::model::APIMetadata::api].
5071 ///
5072 /// # Example
5073 /// ```ignore,no_run
5074 /// # use google_cloud_apihub_v1::model::APIMetadata;
5075 /// use google_cloud_apihub_v1::model::Api;
5076 /// let x = APIMetadata::new().set_api(Api::default()/* use setters */);
5077 /// ```
5078 pub fn set_api<T>(mut self, v: T) -> Self
5079 where
5080 T: std::convert::Into<crate::model::Api>,
5081 {
5082 self.api = std::option::Option::Some(v.into());
5083 self
5084 }
5085
5086 /// Sets or clears the value of [api][crate::model::APIMetadata::api].
5087 ///
5088 /// # Example
5089 /// ```ignore,no_run
5090 /// # use google_cloud_apihub_v1::model::APIMetadata;
5091 /// use google_cloud_apihub_v1::model::Api;
5092 /// let x = APIMetadata::new().set_or_clear_api(Some(Api::default()/* use setters */));
5093 /// let x = APIMetadata::new().set_or_clear_api(None::<Api>);
5094 /// ```
5095 pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
5096 where
5097 T: std::convert::Into<crate::model::Api>,
5098 {
5099 self.api = v.map(|x| x.into());
5100 self
5101 }
5102
5103 /// Sets the value of [versions][crate::model::APIMetadata::versions].
5104 ///
5105 /// # Example
5106 /// ```ignore,no_run
5107 /// # use google_cloud_apihub_v1::model::APIMetadata;
5108 /// use google_cloud_apihub_v1::model::VersionMetadata;
5109 /// let x = APIMetadata::new()
5110 /// .set_versions([
5111 /// VersionMetadata::default()/* use setters */,
5112 /// VersionMetadata::default()/* use (different) setters */,
5113 /// ]);
5114 /// ```
5115 pub fn set_versions<T, V>(mut self, v: T) -> Self
5116 where
5117 T: std::iter::IntoIterator<Item = V>,
5118 V: std::convert::Into<crate::model::VersionMetadata>,
5119 {
5120 use std::iter::Iterator;
5121 self.versions = v.into_iter().map(|i| i.into()).collect();
5122 self
5123 }
5124
5125 /// Sets the value of [original_id][crate::model::APIMetadata::original_id].
5126 ///
5127 /// # Example
5128 /// ```ignore,no_run
5129 /// # use google_cloud_apihub_v1::model::APIMetadata;
5130 /// let x = APIMetadata::new().set_original_id("example");
5131 /// ```
5132 pub fn set_original_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5133 self.original_id = v.into();
5134 self
5135 }
5136
5137 /// Sets the value of [original_create_time][crate::model::APIMetadata::original_create_time].
5138 ///
5139 /// # Example
5140 /// ```ignore,no_run
5141 /// # use google_cloud_apihub_v1::model::APIMetadata;
5142 /// use wkt::Timestamp;
5143 /// let x = APIMetadata::new().set_original_create_time(Timestamp::default()/* use setters */);
5144 /// ```
5145 pub fn set_original_create_time<T>(mut self, v: T) -> Self
5146 where
5147 T: std::convert::Into<wkt::Timestamp>,
5148 {
5149 self.original_create_time = std::option::Option::Some(v.into());
5150 self
5151 }
5152
5153 /// Sets or clears the value of [original_create_time][crate::model::APIMetadata::original_create_time].
5154 ///
5155 /// # Example
5156 /// ```ignore,no_run
5157 /// # use google_cloud_apihub_v1::model::APIMetadata;
5158 /// use wkt::Timestamp;
5159 /// let x = APIMetadata::new().set_or_clear_original_create_time(Some(Timestamp::default()/* use setters */));
5160 /// let x = APIMetadata::new().set_or_clear_original_create_time(None::<Timestamp>);
5161 /// ```
5162 pub fn set_or_clear_original_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5163 where
5164 T: std::convert::Into<wkt::Timestamp>,
5165 {
5166 self.original_create_time = v.map(|x| x.into());
5167 self
5168 }
5169
5170 /// Sets the value of [original_update_time][crate::model::APIMetadata::original_update_time].
5171 ///
5172 /// # Example
5173 /// ```ignore,no_run
5174 /// # use google_cloud_apihub_v1::model::APIMetadata;
5175 /// use wkt::Timestamp;
5176 /// let x = APIMetadata::new().set_original_update_time(Timestamp::default()/* use setters */);
5177 /// ```
5178 pub fn set_original_update_time<T>(mut self, v: T) -> Self
5179 where
5180 T: std::convert::Into<wkt::Timestamp>,
5181 {
5182 self.original_update_time = std::option::Option::Some(v.into());
5183 self
5184 }
5185
5186 /// Sets or clears the value of [original_update_time][crate::model::APIMetadata::original_update_time].
5187 ///
5188 /// # Example
5189 /// ```ignore,no_run
5190 /// # use google_cloud_apihub_v1::model::APIMetadata;
5191 /// use wkt::Timestamp;
5192 /// let x = APIMetadata::new().set_or_clear_original_update_time(Some(Timestamp::default()/* use setters */));
5193 /// let x = APIMetadata::new().set_or_clear_original_update_time(None::<Timestamp>);
5194 /// ```
5195 pub fn set_or_clear_original_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5196 where
5197 T: std::convert::Into<wkt::Timestamp>,
5198 {
5199 self.original_update_time = v.map(|x| x.into());
5200 self
5201 }
5202}
5203
5204impl wkt::message::Message for APIMetadata {
5205 fn typename() -> &'static str {
5206 "type.googleapis.com/google.cloud.apihub.v1.APIMetadata"
5207 }
5208}
5209
5210/// The metadata associated with a version of the API resource.
5211#[derive(Clone, Default, PartialEq)]
5212#[non_exhaustive]
5213pub struct VersionMetadata {
5214 /// Required. Represents a version of the API resource in API hub. The ID of
5215 /// the version will be generated by Hub.
5216 pub version: std::option::Option<crate::model::Version>,
5217
5218 /// Optional. The specs associated with this version.
5219 /// Note that an API version can be associated with multiple specs.
5220 pub specs: std::vec::Vec<crate::model::SpecMetadata>,
5221
5222 /// Optional. The deployments linked to this API version.
5223 /// Note: A particular API version could be deployed to multiple deployments
5224 /// (for dev deployment, UAT deployment, etc.)
5225 pub deployments: std::vec::Vec<crate::model::DeploymentMetadata>,
5226
5227 /// Optional. The unique identifier of the version in the system where it was
5228 /// originally created.
5229 pub original_id: std::string::String,
5230
5231 /// Optional. Timestamp indicating when the version was created at the source.
5232 pub original_create_time: std::option::Option<wkt::Timestamp>,
5233
5234 /// Required. Timestamp indicating when the version was last updated at the
5235 /// source.
5236 pub original_update_time: std::option::Option<wkt::Timestamp>,
5237
5238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5239}
5240
5241impl VersionMetadata {
5242 pub fn new() -> Self {
5243 std::default::Default::default()
5244 }
5245
5246 /// Sets the value of [version][crate::model::VersionMetadata::version].
5247 ///
5248 /// # Example
5249 /// ```ignore,no_run
5250 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5251 /// use google_cloud_apihub_v1::model::Version;
5252 /// let x = VersionMetadata::new().set_version(Version::default()/* use setters */);
5253 /// ```
5254 pub fn set_version<T>(mut self, v: T) -> Self
5255 where
5256 T: std::convert::Into<crate::model::Version>,
5257 {
5258 self.version = std::option::Option::Some(v.into());
5259 self
5260 }
5261
5262 /// Sets or clears the value of [version][crate::model::VersionMetadata::version].
5263 ///
5264 /// # Example
5265 /// ```ignore,no_run
5266 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5267 /// use google_cloud_apihub_v1::model::Version;
5268 /// let x = VersionMetadata::new().set_or_clear_version(Some(Version::default()/* use setters */));
5269 /// let x = VersionMetadata::new().set_or_clear_version(None::<Version>);
5270 /// ```
5271 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
5272 where
5273 T: std::convert::Into<crate::model::Version>,
5274 {
5275 self.version = v.map(|x| x.into());
5276 self
5277 }
5278
5279 /// Sets the value of [specs][crate::model::VersionMetadata::specs].
5280 ///
5281 /// # Example
5282 /// ```ignore,no_run
5283 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5284 /// use google_cloud_apihub_v1::model::SpecMetadata;
5285 /// let x = VersionMetadata::new()
5286 /// .set_specs([
5287 /// SpecMetadata::default()/* use setters */,
5288 /// SpecMetadata::default()/* use (different) setters */,
5289 /// ]);
5290 /// ```
5291 pub fn set_specs<T, V>(mut self, v: T) -> Self
5292 where
5293 T: std::iter::IntoIterator<Item = V>,
5294 V: std::convert::Into<crate::model::SpecMetadata>,
5295 {
5296 use std::iter::Iterator;
5297 self.specs = v.into_iter().map(|i| i.into()).collect();
5298 self
5299 }
5300
5301 /// Sets the value of [deployments][crate::model::VersionMetadata::deployments].
5302 ///
5303 /// # Example
5304 /// ```ignore,no_run
5305 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5306 /// use google_cloud_apihub_v1::model::DeploymentMetadata;
5307 /// let x = VersionMetadata::new()
5308 /// .set_deployments([
5309 /// DeploymentMetadata::default()/* use setters */,
5310 /// DeploymentMetadata::default()/* use (different) setters */,
5311 /// ]);
5312 /// ```
5313 pub fn set_deployments<T, V>(mut self, v: T) -> Self
5314 where
5315 T: std::iter::IntoIterator<Item = V>,
5316 V: std::convert::Into<crate::model::DeploymentMetadata>,
5317 {
5318 use std::iter::Iterator;
5319 self.deployments = v.into_iter().map(|i| i.into()).collect();
5320 self
5321 }
5322
5323 /// Sets the value of [original_id][crate::model::VersionMetadata::original_id].
5324 ///
5325 /// # Example
5326 /// ```ignore,no_run
5327 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5328 /// let x = VersionMetadata::new().set_original_id("example");
5329 /// ```
5330 pub fn set_original_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5331 self.original_id = v.into();
5332 self
5333 }
5334
5335 /// Sets the value of [original_create_time][crate::model::VersionMetadata::original_create_time].
5336 ///
5337 /// # Example
5338 /// ```ignore,no_run
5339 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5340 /// use wkt::Timestamp;
5341 /// let x = VersionMetadata::new().set_original_create_time(Timestamp::default()/* use setters */);
5342 /// ```
5343 pub fn set_original_create_time<T>(mut self, v: T) -> Self
5344 where
5345 T: std::convert::Into<wkt::Timestamp>,
5346 {
5347 self.original_create_time = std::option::Option::Some(v.into());
5348 self
5349 }
5350
5351 /// Sets or clears the value of [original_create_time][crate::model::VersionMetadata::original_create_time].
5352 ///
5353 /// # Example
5354 /// ```ignore,no_run
5355 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5356 /// use wkt::Timestamp;
5357 /// let x = VersionMetadata::new().set_or_clear_original_create_time(Some(Timestamp::default()/* use setters */));
5358 /// let x = VersionMetadata::new().set_or_clear_original_create_time(None::<Timestamp>);
5359 /// ```
5360 pub fn set_or_clear_original_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5361 where
5362 T: std::convert::Into<wkt::Timestamp>,
5363 {
5364 self.original_create_time = v.map(|x| x.into());
5365 self
5366 }
5367
5368 /// Sets the value of [original_update_time][crate::model::VersionMetadata::original_update_time].
5369 ///
5370 /// # Example
5371 /// ```ignore,no_run
5372 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5373 /// use wkt::Timestamp;
5374 /// let x = VersionMetadata::new().set_original_update_time(Timestamp::default()/* use setters */);
5375 /// ```
5376 pub fn set_original_update_time<T>(mut self, v: T) -> Self
5377 where
5378 T: std::convert::Into<wkt::Timestamp>,
5379 {
5380 self.original_update_time = std::option::Option::Some(v.into());
5381 self
5382 }
5383
5384 /// Sets or clears the value of [original_update_time][crate::model::VersionMetadata::original_update_time].
5385 ///
5386 /// # Example
5387 /// ```ignore,no_run
5388 /// # use google_cloud_apihub_v1::model::VersionMetadata;
5389 /// use wkt::Timestamp;
5390 /// let x = VersionMetadata::new().set_or_clear_original_update_time(Some(Timestamp::default()/* use setters */));
5391 /// let x = VersionMetadata::new().set_or_clear_original_update_time(None::<Timestamp>);
5392 /// ```
5393 pub fn set_or_clear_original_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5394 where
5395 T: std::convert::Into<wkt::Timestamp>,
5396 {
5397 self.original_update_time = v.map(|x| x.into());
5398 self
5399 }
5400}
5401
5402impl wkt::message::Message for VersionMetadata {
5403 fn typename() -> &'static str {
5404 "type.googleapis.com/google.cloud.apihub.v1.VersionMetadata"
5405 }
5406}
5407
5408/// The metadata associated with a spec of the API version.
5409#[derive(Clone, Default, PartialEq)]
5410#[non_exhaustive]
5411pub struct SpecMetadata {
5412 /// Required. The spec resource to be pushed to Hub's collect layer. The ID of
5413 /// the spec will be generated by Hub.
5414 pub spec: std::option::Option<crate::model::Spec>,
5415
5416 /// Optional. The unique identifier of the spec in the system where it was
5417 /// originally created.
5418 pub original_id: std::string::String,
5419
5420 /// Optional. Timestamp indicating when the spec was created at the source.
5421 pub original_create_time: std::option::Option<wkt::Timestamp>,
5422
5423 /// Required. Timestamp indicating when the spec was last updated at the
5424 /// source.
5425 pub original_update_time: std::option::Option<wkt::Timestamp>,
5426
5427 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5428}
5429
5430impl SpecMetadata {
5431 pub fn new() -> Self {
5432 std::default::Default::default()
5433 }
5434
5435 /// Sets the value of [spec][crate::model::SpecMetadata::spec].
5436 ///
5437 /// # Example
5438 /// ```ignore,no_run
5439 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5440 /// use google_cloud_apihub_v1::model::Spec;
5441 /// let x = SpecMetadata::new().set_spec(Spec::default()/* use setters */);
5442 /// ```
5443 pub fn set_spec<T>(mut self, v: T) -> Self
5444 where
5445 T: std::convert::Into<crate::model::Spec>,
5446 {
5447 self.spec = std::option::Option::Some(v.into());
5448 self
5449 }
5450
5451 /// Sets or clears the value of [spec][crate::model::SpecMetadata::spec].
5452 ///
5453 /// # Example
5454 /// ```ignore,no_run
5455 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5456 /// use google_cloud_apihub_v1::model::Spec;
5457 /// let x = SpecMetadata::new().set_or_clear_spec(Some(Spec::default()/* use setters */));
5458 /// let x = SpecMetadata::new().set_or_clear_spec(None::<Spec>);
5459 /// ```
5460 pub fn set_or_clear_spec<T>(mut self, v: std::option::Option<T>) -> Self
5461 where
5462 T: std::convert::Into<crate::model::Spec>,
5463 {
5464 self.spec = v.map(|x| x.into());
5465 self
5466 }
5467
5468 /// Sets the value of [original_id][crate::model::SpecMetadata::original_id].
5469 ///
5470 /// # Example
5471 /// ```ignore,no_run
5472 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5473 /// let x = SpecMetadata::new().set_original_id("example");
5474 /// ```
5475 pub fn set_original_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5476 self.original_id = v.into();
5477 self
5478 }
5479
5480 /// Sets the value of [original_create_time][crate::model::SpecMetadata::original_create_time].
5481 ///
5482 /// # Example
5483 /// ```ignore,no_run
5484 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5485 /// use wkt::Timestamp;
5486 /// let x = SpecMetadata::new().set_original_create_time(Timestamp::default()/* use setters */);
5487 /// ```
5488 pub fn set_original_create_time<T>(mut self, v: T) -> Self
5489 where
5490 T: std::convert::Into<wkt::Timestamp>,
5491 {
5492 self.original_create_time = std::option::Option::Some(v.into());
5493 self
5494 }
5495
5496 /// Sets or clears the value of [original_create_time][crate::model::SpecMetadata::original_create_time].
5497 ///
5498 /// # Example
5499 /// ```ignore,no_run
5500 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5501 /// use wkt::Timestamp;
5502 /// let x = SpecMetadata::new().set_or_clear_original_create_time(Some(Timestamp::default()/* use setters */));
5503 /// let x = SpecMetadata::new().set_or_clear_original_create_time(None::<Timestamp>);
5504 /// ```
5505 pub fn set_or_clear_original_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5506 where
5507 T: std::convert::Into<wkt::Timestamp>,
5508 {
5509 self.original_create_time = v.map(|x| x.into());
5510 self
5511 }
5512
5513 /// Sets the value of [original_update_time][crate::model::SpecMetadata::original_update_time].
5514 ///
5515 /// # Example
5516 /// ```ignore,no_run
5517 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5518 /// use wkt::Timestamp;
5519 /// let x = SpecMetadata::new().set_original_update_time(Timestamp::default()/* use setters */);
5520 /// ```
5521 pub fn set_original_update_time<T>(mut self, v: T) -> Self
5522 where
5523 T: std::convert::Into<wkt::Timestamp>,
5524 {
5525 self.original_update_time = std::option::Option::Some(v.into());
5526 self
5527 }
5528
5529 /// Sets or clears the value of [original_update_time][crate::model::SpecMetadata::original_update_time].
5530 ///
5531 /// # Example
5532 /// ```ignore,no_run
5533 /// # use google_cloud_apihub_v1::model::SpecMetadata;
5534 /// use wkt::Timestamp;
5535 /// let x = SpecMetadata::new().set_or_clear_original_update_time(Some(Timestamp::default()/* use setters */));
5536 /// let x = SpecMetadata::new().set_or_clear_original_update_time(None::<Timestamp>);
5537 /// ```
5538 pub fn set_or_clear_original_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5539 where
5540 T: std::convert::Into<wkt::Timestamp>,
5541 {
5542 self.original_update_time = v.map(|x| x.into());
5543 self
5544 }
5545}
5546
5547impl wkt::message::Message for SpecMetadata {
5548 fn typename() -> &'static str {
5549 "type.googleapis.com/google.cloud.apihub.v1.SpecMetadata"
5550 }
5551}
5552
5553/// The metadata associated with a deployment.
5554#[derive(Clone, Default, PartialEq)]
5555#[non_exhaustive]
5556pub struct DeploymentMetadata {
5557 /// Required. The deployment resource to be pushed to Hub's collect layer. The
5558 /// ID of the deployment will be generated by Hub.
5559 pub deployment: std::option::Option<crate::model::Deployment>,
5560
5561 /// Optional. The unique identifier of the deployment in the system where it
5562 /// was originally created.
5563 pub original_id: std::string::String,
5564
5565 /// Optional. Timestamp indicating when the deployment was created at the
5566 /// source.
5567 pub original_create_time: std::option::Option<wkt::Timestamp>,
5568
5569 /// Required. Timestamp indicating when the deployment was last updated at the
5570 /// source.
5571 pub original_update_time: std::option::Option<wkt::Timestamp>,
5572
5573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5574}
5575
5576impl DeploymentMetadata {
5577 pub fn new() -> Self {
5578 std::default::Default::default()
5579 }
5580
5581 /// Sets the value of [deployment][crate::model::DeploymentMetadata::deployment].
5582 ///
5583 /// # Example
5584 /// ```ignore,no_run
5585 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5586 /// use google_cloud_apihub_v1::model::Deployment;
5587 /// let x = DeploymentMetadata::new().set_deployment(Deployment::default()/* use setters */);
5588 /// ```
5589 pub fn set_deployment<T>(mut self, v: T) -> Self
5590 where
5591 T: std::convert::Into<crate::model::Deployment>,
5592 {
5593 self.deployment = std::option::Option::Some(v.into());
5594 self
5595 }
5596
5597 /// Sets or clears the value of [deployment][crate::model::DeploymentMetadata::deployment].
5598 ///
5599 /// # Example
5600 /// ```ignore,no_run
5601 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5602 /// use google_cloud_apihub_v1::model::Deployment;
5603 /// let x = DeploymentMetadata::new().set_or_clear_deployment(Some(Deployment::default()/* use setters */));
5604 /// let x = DeploymentMetadata::new().set_or_clear_deployment(None::<Deployment>);
5605 /// ```
5606 pub fn set_or_clear_deployment<T>(mut self, v: std::option::Option<T>) -> Self
5607 where
5608 T: std::convert::Into<crate::model::Deployment>,
5609 {
5610 self.deployment = v.map(|x| x.into());
5611 self
5612 }
5613
5614 /// Sets the value of [original_id][crate::model::DeploymentMetadata::original_id].
5615 ///
5616 /// # Example
5617 /// ```ignore,no_run
5618 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5619 /// let x = DeploymentMetadata::new().set_original_id("example");
5620 /// ```
5621 pub fn set_original_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5622 self.original_id = v.into();
5623 self
5624 }
5625
5626 /// Sets the value of [original_create_time][crate::model::DeploymentMetadata::original_create_time].
5627 ///
5628 /// # Example
5629 /// ```ignore,no_run
5630 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5631 /// use wkt::Timestamp;
5632 /// let x = DeploymentMetadata::new().set_original_create_time(Timestamp::default()/* use setters */);
5633 /// ```
5634 pub fn set_original_create_time<T>(mut self, v: T) -> Self
5635 where
5636 T: std::convert::Into<wkt::Timestamp>,
5637 {
5638 self.original_create_time = std::option::Option::Some(v.into());
5639 self
5640 }
5641
5642 /// Sets or clears the value of [original_create_time][crate::model::DeploymentMetadata::original_create_time].
5643 ///
5644 /// # Example
5645 /// ```ignore,no_run
5646 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5647 /// use wkt::Timestamp;
5648 /// let x = DeploymentMetadata::new().set_or_clear_original_create_time(Some(Timestamp::default()/* use setters */));
5649 /// let x = DeploymentMetadata::new().set_or_clear_original_create_time(None::<Timestamp>);
5650 /// ```
5651 pub fn set_or_clear_original_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5652 where
5653 T: std::convert::Into<wkt::Timestamp>,
5654 {
5655 self.original_create_time = v.map(|x| x.into());
5656 self
5657 }
5658
5659 /// Sets the value of [original_update_time][crate::model::DeploymentMetadata::original_update_time].
5660 ///
5661 /// # Example
5662 /// ```ignore,no_run
5663 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5664 /// use wkt::Timestamp;
5665 /// let x = DeploymentMetadata::new().set_original_update_time(Timestamp::default()/* use setters */);
5666 /// ```
5667 pub fn set_original_update_time<T>(mut self, v: T) -> Self
5668 where
5669 T: std::convert::Into<wkt::Timestamp>,
5670 {
5671 self.original_update_time = std::option::Option::Some(v.into());
5672 self
5673 }
5674
5675 /// Sets or clears the value of [original_update_time][crate::model::DeploymentMetadata::original_update_time].
5676 ///
5677 /// # Example
5678 /// ```ignore,no_run
5679 /// # use google_cloud_apihub_v1::model::DeploymentMetadata;
5680 /// use wkt::Timestamp;
5681 /// let x = DeploymentMetadata::new().set_or_clear_original_update_time(Some(Timestamp::default()/* use setters */));
5682 /// let x = DeploymentMetadata::new().set_or_clear_original_update_time(None::<Timestamp>);
5683 /// ```
5684 pub fn set_or_clear_original_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5685 where
5686 T: std::convert::Into<wkt::Timestamp>,
5687 {
5688 self.original_update_time = v.map(|x| x.into());
5689 self
5690 }
5691}
5692
5693impl wkt::message::Message for DeploymentMetadata {
5694 fn typename() -> &'static str {
5695 "type.googleapis.com/google.cloud.apihub.v1.DeploymentMetadata"
5696 }
5697}
5698
5699/// The CollectApiData method's response.
5700#[derive(Clone, Default, PartialEq)]
5701#[non_exhaustive]
5702pub struct CollectApiDataResponse {
5703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5704}
5705
5706impl CollectApiDataResponse {
5707 pub fn new() -> Self {
5708 std::default::Default::default()
5709 }
5710}
5711
5712impl wkt::message::Message for CollectApiDataResponse {
5713 fn typename() -> &'static str {
5714 "type.googleapis.com/google.cloud.apihub.v1.CollectApiDataResponse"
5715 }
5716}
5717
5718/// An API resource in the API Hub.
5719#[derive(Clone, Default, PartialEq)]
5720#[non_exhaustive]
5721pub struct Api {
5722 /// Identifier. The name of the API resource in the API Hub.
5723 ///
5724 /// Format:
5725 /// `projects/{project}/locations/{location}/apis/{api}`
5726 pub name: std::string::String,
5727
5728 /// Required. The display name of the API resource.
5729 pub display_name: std::string::String,
5730
5731 /// Optional. The description of the API resource.
5732 pub description: std::string::String,
5733
5734 /// Optional. The documentation for the API resource.
5735 pub documentation: std::option::Option<crate::model::Documentation>,
5736
5737 /// Optional. Owner details for the API resource.
5738 pub owner: std::option::Option<crate::model::Owner>,
5739
5740 /// Output only. The list of versions present in an API resource.
5741 /// Note: An API resource can be associated with more than 1 version.
5742 /// Format is
5743 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
5744 pub versions: std::vec::Vec<std::string::String>,
5745
5746 /// Output only. The time at which the API resource was created.
5747 pub create_time: std::option::Option<wkt::Timestamp>,
5748
5749 /// Output only. The time at which the API resource was last updated.
5750 pub update_time: std::option::Option<wkt::Timestamp>,
5751
5752 /// Optional. The target users for the API.
5753 /// This maps to the following system defined attribute:
5754 /// `projects/{project}/locations/{location}/attributes/system-target-user`
5755 /// attribute.
5756 /// The number of values for this attribute will be based on the
5757 /// cardinality of the attribute. The same can be retrieved via GetAttribute
5758 /// API. All values should be from the list of allowed values defined for the
5759 /// attribute.
5760 pub target_user: std::option::Option<crate::model::AttributeValues>,
5761
5762 /// Optional. The team owning the API.
5763 /// This maps to the following system defined attribute:
5764 /// `projects/{project}/locations/{location}/attributes/system-team`
5765 /// attribute.
5766 /// The number of values for this attribute will be based on the
5767 /// cardinality of the attribute. The same can be retrieved via GetAttribute
5768 /// API. All values should be from the list of allowed values defined for the
5769 /// attribute.
5770 pub team: std::option::Option<crate::model::AttributeValues>,
5771
5772 /// Optional. The business unit owning the API.
5773 /// This maps to the following system defined attribute:
5774 /// `projects/{project}/locations/{location}/attributes/system-business-unit`
5775 /// attribute.
5776 /// The number of values for this attribute will be based on the
5777 /// cardinality of the attribute. The same can be retrieved via GetAttribute
5778 /// API. All values should be from the list of allowed values defined for the
5779 /// attribute.
5780 pub business_unit: std::option::Option<crate::model::AttributeValues>,
5781
5782 /// Optional. The maturity level of the API.
5783 /// This maps to the following system defined attribute:
5784 /// `projects/{project}/locations/{location}/attributes/system-maturity-level`
5785 /// attribute.
5786 /// The number of values for this attribute will be based on the
5787 /// cardinality of the attribute. The same can be retrieved via GetAttribute
5788 /// API. All values should be from the list of allowed values defined for the
5789 /// attribute.
5790 pub maturity_level: std::option::Option<crate::model::AttributeValues>,
5791
5792 /// Optional. The list of user defined attributes associated with the API
5793 /// resource. The key is the attribute name. It will be of the format:
5794 /// `projects/{project}/locations/{location}/attributes/{attribute}`.
5795 /// The value is the attribute values associated with the resource.
5796 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
5797
5798 /// Optional. The style of the API.
5799 /// This maps to the following system defined attribute:
5800 /// `projects/{project}/locations/{location}/attributes/system-api-style`
5801 /// attribute.
5802 /// The number of values for this attribute will be based on the
5803 /// cardinality of the attribute. The same can be retrieved via GetAttribute
5804 /// API. All values should be from the list of allowed values defined for the
5805 /// attribute.
5806 pub api_style: std::option::Option<crate::model::AttributeValues>,
5807
5808 /// Optional. The selected version for an API resource.
5809 /// This can be used when special handling is needed on client side for
5810 /// particular version of the API. Format is
5811 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
5812 pub selected_version: std::string::String,
5813
5814 /// Optional. The api requirement doc associated with the API resource.
5815 /// Carinality is 1 for this attribute. This maps to the following system
5816 /// defined attribute:
5817 /// `projects/{project}/locations/{location}/attributes/system-api-requirements`
5818 /// attribute. The value of the attribute should be a proper URI, and in case
5819 /// of Cloud Storage URI, it should point to a Cloud Storage object,
5820 /// not a directory.
5821 pub api_requirements: std::option::Option<crate::model::AttributeValues>,
5822
5823 /// Optional. Fingerprint of the API resource.
5824 pub fingerprint: std::string::String,
5825
5826 /// Output only. The list of sources and metadata from the sources of the API
5827 /// resource.
5828 pub source_metadata: std::vec::Vec<crate::model::SourceMetadata>,
5829
5830 /// Optional. The api functional requirements associated with the API resource.
5831 /// Carinality is 1 for this attribute.
5832 /// This maps to the following system defined attribute:
5833 /// `projects/{project}/locations/{location}/attributes/system-api-functional-requirements`
5834 /// attribute. The value of the attribute should be a proper URI, and in case
5835 /// of Cloud Storage URI, it should point to a Cloud Storage object,
5836 /// not a directory.
5837 pub api_functional_requirements: std::option::Option<crate::model::AttributeValues>,
5838
5839 /// Optional. The api technical requirements associated with the API resource.
5840 /// Carinality is 1 for this attribute. This maps to the following system
5841 /// defined attribute:
5842 /// `projects/{project}/locations/{location}/attributes/system-api-technical-requirements`
5843 /// attribute. The value of the attribute should be a proper URI, and in case
5844 /// of Cloud Storage URI, it should point to a Cloud Storage object,
5845 /// not a directory.
5846 pub api_technical_requirements: std::option::Option<crate::model::AttributeValues>,
5847
5848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5849}
5850
5851impl Api {
5852 pub fn new() -> Self {
5853 std::default::Default::default()
5854 }
5855
5856 /// Sets the value of [name][crate::model::Api::name].
5857 ///
5858 /// # Example
5859 /// ```ignore,no_run
5860 /// # use google_cloud_apihub_v1::model::Api;
5861 /// let x = Api::new().set_name("example");
5862 /// ```
5863 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5864 self.name = v.into();
5865 self
5866 }
5867
5868 /// Sets the value of [display_name][crate::model::Api::display_name].
5869 ///
5870 /// # Example
5871 /// ```ignore,no_run
5872 /// # use google_cloud_apihub_v1::model::Api;
5873 /// let x = Api::new().set_display_name("example");
5874 /// ```
5875 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5876 self.display_name = v.into();
5877 self
5878 }
5879
5880 /// Sets the value of [description][crate::model::Api::description].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_apihub_v1::model::Api;
5885 /// let x = Api::new().set_description("example");
5886 /// ```
5887 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5888 self.description = v.into();
5889 self
5890 }
5891
5892 /// Sets the value of [documentation][crate::model::Api::documentation].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_apihub_v1::model::Api;
5897 /// use google_cloud_apihub_v1::model::Documentation;
5898 /// let x = Api::new().set_documentation(Documentation::default()/* use setters */);
5899 /// ```
5900 pub fn set_documentation<T>(mut self, v: T) -> Self
5901 where
5902 T: std::convert::Into<crate::model::Documentation>,
5903 {
5904 self.documentation = std::option::Option::Some(v.into());
5905 self
5906 }
5907
5908 /// Sets or clears the value of [documentation][crate::model::Api::documentation].
5909 ///
5910 /// # Example
5911 /// ```ignore,no_run
5912 /// # use google_cloud_apihub_v1::model::Api;
5913 /// use google_cloud_apihub_v1::model::Documentation;
5914 /// let x = Api::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
5915 /// let x = Api::new().set_or_clear_documentation(None::<Documentation>);
5916 /// ```
5917 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
5918 where
5919 T: std::convert::Into<crate::model::Documentation>,
5920 {
5921 self.documentation = v.map(|x| x.into());
5922 self
5923 }
5924
5925 /// Sets the value of [owner][crate::model::Api::owner].
5926 ///
5927 /// # Example
5928 /// ```ignore,no_run
5929 /// # use google_cloud_apihub_v1::model::Api;
5930 /// use google_cloud_apihub_v1::model::Owner;
5931 /// let x = Api::new().set_owner(Owner::default()/* use setters */);
5932 /// ```
5933 pub fn set_owner<T>(mut self, v: T) -> Self
5934 where
5935 T: std::convert::Into<crate::model::Owner>,
5936 {
5937 self.owner = std::option::Option::Some(v.into());
5938 self
5939 }
5940
5941 /// Sets or clears the value of [owner][crate::model::Api::owner].
5942 ///
5943 /// # Example
5944 /// ```ignore,no_run
5945 /// # use google_cloud_apihub_v1::model::Api;
5946 /// use google_cloud_apihub_v1::model::Owner;
5947 /// let x = Api::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
5948 /// let x = Api::new().set_or_clear_owner(None::<Owner>);
5949 /// ```
5950 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
5951 where
5952 T: std::convert::Into<crate::model::Owner>,
5953 {
5954 self.owner = v.map(|x| x.into());
5955 self
5956 }
5957
5958 /// Sets the value of [versions][crate::model::Api::versions].
5959 ///
5960 /// # Example
5961 /// ```ignore,no_run
5962 /// # use google_cloud_apihub_v1::model::Api;
5963 /// let x = Api::new().set_versions(["a", "b", "c"]);
5964 /// ```
5965 pub fn set_versions<T, V>(mut self, v: T) -> Self
5966 where
5967 T: std::iter::IntoIterator<Item = V>,
5968 V: std::convert::Into<std::string::String>,
5969 {
5970 use std::iter::Iterator;
5971 self.versions = v.into_iter().map(|i| i.into()).collect();
5972 self
5973 }
5974
5975 /// Sets the value of [create_time][crate::model::Api::create_time].
5976 ///
5977 /// # Example
5978 /// ```ignore,no_run
5979 /// # use google_cloud_apihub_v1::model::Api;
5980 /// use wkt::Timestamp;
5981 /// let x = Api::new().set_create_time(Timestamp::default()/* use setters */);
5982 /// ```
5983 pub fn set_create_time<T>(mut self, v: T) -> Self
5984 where
5985 T: std::convert::Into<wkt::Timestamp>,
5986 {
5987 self.create_time = std::option::Option::Some(v.into());
5988 self
5989 }
5990
5991 /// Sets or clears the value of [create_time][crate::model::Api::create_time].
5992 ///
5993 /// # Example
5994 /// ```ignore,no_run
5995 /// # use google_cloud_apihub_v1::model::Api;
5996 /// use wkt::Timestamp;
5997 /// let x = Api::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5998 /// let x = Api::new().set_or_clear_create_time(None::<Timestamp>);
5999 /// ```
6000 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6001 where
6002 T: std::convert::Into<wkt::Timestamp>,
6003 {
6004 self.create_time = v.map(|x| x.into());
6005 self
6006 }
6007
6008 /// Sets the value of [update_time][crate::model::Api::update_time].
6009 ///
6010 /// # Example
6011 /// ```ignore,no_run
6012 /// # use google_cloud_apihub_v1::model::Api;
6013 /// use wkt::Timestamp;
6014 /// let x = Api::new().set_update_time(Timestamp::default()/* use setters */);
6015 /// ```
6016 pub fn set_update_time<T>(mut self, v: T) -> Self
6017 where
6018 T: std::convert::Into<wkt::Timestamp>,
6019 {
6020 self.update_time = std::option::Option::Some(v.into());
6021 self
6022 }
6023
6024 /// Sets or clears the value of [update_time][crate::model::Api::update_time].
6025 ///
6026 /// # Example
6027 /// ```ignore,no_run
6028 /// # use google_cloud_apihub_v1::model::Api;
6029 /// use wkt::Timestamp;
6030 /// let x = Api::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6031 /// let x = Api::new().set_or_clear_update_time(None::<Timestamp>);
6032 /// ```
6033 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6034 where
6035 T: std::convert::Into<wkt::Timestamp>,
6036 {
6037 self.update_time = v.map(|x| x.into());
6038 self
6039 }
6040
6041 /// Sets the value of [target_user][crate::model::Api::target_user].
6042 ///
6043 /// # Example
6044 /// ```ignore,no_run
6045 /// # use google_cloud_apihub_v1::model::Api;
6046 /// use google_cloud_apihub_v1::model::AttributeValues;
6047 /// let x = Api::new().set_target_user(AttributeValues::default()/* use setters */);
6048 /// ```
6049 pub fn set_target_user<T>(mut self, v: T) -> Self
6050 where
6051 T: std::convert::Into<crate::model::AttributeValues>,
6052 {
6053 self.target_user = std::option::Option::Some(v.into());
6054 self
6055 }
6056
6057 /// Sets or clears the value of [target_user][crate::model::Api::target_user].
6058 ///
6059 /// # Example
6060 /// ```ignore,no_run
6061 /// # use google_cloud_apihub_v1::model::Api;
6062 /// use google_cloud_apihub_v1::model::AttributeValues;
6063 /// let x = Api::new().set_or_clear_target_user(Some(AttributeValues::default()/* use setters */));
6064 /// let x = Api::new().set_or_clear_target_user(None::<AttributeValues>);
6065 /// ```
6066 pub fn set_or_clear_target_user<T>(mut self, v: std::option::Option<T>) -> Self
6067 where
6068 T: std::convert::Into<crate::model::AttributeValues>,
6069 {
6070 self.target_user = v.map(|x| x.into());
6071 self
6072 }
6073
6074 /// Sets the value of [team][crate::model::Api::team].
6075 ///
6076 /// # Example
6077 /// ```ignore,no_run
6078 /// # use google_cloud_apihub_v1::model::Api;
6079 /// use google_cloud_apihub_v1::model::AttributeValues;
6080 /// let x = Api::new().set_team(AttributeValues::default()/* use setters */);
6081 /// ```
6082 pub fn set_team<T>(mut self, v: T) -> Self
6083 where
6084 T: std::convert::Into<crate::model::AttributeValues>,
6085 {
6086 self.team = std::option::Option::Some(v.into());
6087 self
6088 }
6089
6090 /// Sets or clears the value of [team][crate::model::Api::team].
6091 ///
6092 /// # Example
6093 /// ```ignore,no_run
6094 /// # use google_cloud_apihub_v1::model::Api;
6095 /// use google_cloud_apihub_v1::model::AttributeValues;
6096 /// let x = Api::new().set_or_clear_team(Some(AttributeValues::default()/* use setters */));
6097 /// let x = Api::new().set_or_clear_team(None::<AttributeValues>);
6098 /// ```
6099 pub fn set_or_clear_team<T>(mut self, v: std::option::Option<T>) -> Self
6100 where
6101 T: std::convert::Into<crate::model::AttributeValues>,
6102 {
6103 self.team = v.map(|x| x.into());
6104 self
6105 }
6106
6107 /// Sets the value of [business_unit][crate::model::Api::business_unit].
6108 ///
6109 /// # Example
6110 /// ```ignore,no_run
6111 /// # use google_cloud_apihub_v1::model::Api;
6112 /// use google_cloud_apihub_v1::model::AttributeValues;
6113 /// let x = Api::new().set_business_unit(AttributeValues::default()/* use setters */);
6114 /// ```
6115 pub fn set_business_unit<T>(mut self, v: T) -> Self
6116 where
6117 T: std::convert::Into<crate::model::AttributeValues>,
6118 {
6119 self.business_unit = std::option::Option::Some(v.into());
6120 self
6121 }
6122
6123 /// Sets or clears the value of [business_unit][crate::model::Api::business_unit].
6124 ///
6125 /// # Example
6126 /// ```ignore,no_run
6127 /// # use google_cloud_apihub_v1::model::Api;
6128 /// use google_cloud_apihub_v1::model::AttributeValues;
6129 /// let x = Api::new().set_or_clear_business_unit(Some(AttributeValues::default()/* use setters */));
6130 /// let x = Api::new().set_or_clear_business_unit(None::<AttributeValues>);
6131 /// ```
6132 pub fn set_or_clear_business_unit<T>(mut self, v: std::option::Option<T>) -> Self
6133 where
6134 T: std::convert::Into<crate::model::AttributeValues>,
6135 {
6136 self.business_unit = v.map(|x| x.into());
6137 self
6138 }
6139
6140 /// Sets the value of [maturity_level][crate::model::Api::maturity_level].
6141 ///
6142 /// # Example
6143 /// ```ignore,no_run
6144 /// # use google_cloud_apihub_v1::model::Api;
6145 /// use google_cloud_apihub_v1::model::AttributeValues;
6146 /// let x = Api::new().set_maturity_level(AttributeValues::default()/* use setters */);
6147 /// ```
6148 pub fn set_maturity_level<T>(mut self, v: T) -> Self
6149 where
6150 T: std::convert::Into<crate::model::AttributeValues>,
6151 {
6152 self.maturity_level = std::option::Option::Some(v.into());
6153 self
6154 }
6155
6156 /// Sets or clears the value of [maturity_level][crate::model::Api::maturity_level].
6157 ///
6158 /// # Example
6159 /// ```ignore,no_run
6160 /// # use google_cloud_apihub_v1::model::Api;
6161 /// use google_cloud_apihub_v1::model::AttributeValues;
6162 /// let x = Api::new().set_or_clear_maturity_level(Some(AttributeValues::default()/* use setters */));
6163 /// let x = Api::new().set_or_clear_maturity_level(None::<AttributeValues>);
6164 /// ```
6165 pub fn set_or_clear_maturity_level<T>(mut self, v: std::option::Option<T>) -> Self
6166 where
6167 T: std::convert::Into<crate::model::AttributeValues>,
6168 {
6169 self.maturity_level = v.map(|x| x.into());
6170 self
6171 }
6172
6173 /// Sets the value of [attributes][crate::model::Api::attributes].
6174 ///
6175 /// # Example
6176 /// ```ignore,no_run
6177 /// # use google_cloud_apihub_v1::model::Api;
6178 /// use google_cloud_apihub_v1::model::AttributeValues;
6179 /// let x = Api::new().set_attributes([
6180 /// ("key0", AttributeValues::default()/* use setters */),
6181 /// ("key1", AttributeValues::default()/* use (different) setters */),
6182 /// ]);
6183 /// ```
6184 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6185 where
6186 T: std::iter::IntoIterator<Item = (K, V)>,
6187 K: std::convert::Into<std::string::String>,
6188 V: std::convert::Into<crate::model::AttributeValues>,
6189 {
6190 use std::iter::Iterator;
6191 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6192 self
6193 }
6194
6195 /// Sets the value of [api_style][crate::model::Api::api_style].
6196 ///
6197 /// # Example
6198 /// ```ignore,no_run
6199 /// # use google_cloud_apihub_v1::model::Api;
6200 /// use google_cloud_apihub_v1::model::AttributeValues;
6201 /// let x = Api::new().set_api_style(AttributeValues::default()/* use setters */);
6202 /// ```
6203 pub fn set_api_style<T>(mut self, v: T) -> Self
6204 where
6205 T: std::convert::Into<crate::model::AttributeValues>,
6206 {
6207 self.api_style = std::option::Option::Some(v.into());
6208 self
6209 }
6210
6211 /// Sets or clears the value of [api_style][crate::model::Api::api_style].
6212 ///
6213 /// # Example
6214 /// ```ignore,no_run
6215 /// # use google_cloud_apihub_v1::model::Api;
6216 /// use google_cloud_apihub_v1::model::AttributeValues;
6217 /// let x = Api::new().set_or_clear_api_style(Some(AttributeValues::default()/* use setters */));
6218 /// let x = Api::new().set_or_clear_api_style(None::<AttributeValues>);
6219 /// ```
6220 pub fn set_or_clear_api_style<T>(mut self, v: std::option::Option<T>) -> Self
6221 where
6222 T: std::convert::Into<crate::model::AttributeValues>,
6223 {
6224 self.api_style = v.map(|x| x.into());
6225 self
6226 }
6227
6228 /// Sets the value of [selected_version][crate::model::Api::selected_version].
6229 ///
6230 /// # Example
6231 /// ```ignore,no_run
6232 /// # use google_cloud_apihub_v1::model::Api;
6233 /// let x = Api::new().set_selected_version("example");
6234 /// ```
6235 pub fn set_selected_version<T: std::convert::Into<std::string::String>>(
6236 mut self,
6237 v: T,
6238 ) -> Self {
6239 self.selected_version = v.into();
6240 self
6241 }
6242
6243 /// Sets the value of [api_requirements][crate::model::Api::api_requirements].
6244 ///
6245 /// # Example
6246 /// ```ignore,no_run
6247 /// # use google_cloud_apihub_v1::model::Api;
6248 /// use google_cloud_apihub_v1::model::AttributeValues;
6249 /// let x = Api::new().set_api_requirements(AttributeValues::default()/* use setters */);
6250 /// ```
6251 pub fn set_api_requirements<T>(mut self, v: T) -> Self
6252 where
6253 T: std::convert::Into<crate::model::AttributeValues>,
6254 {
6255 self.api_requirements = std::option::Option::Some(v.into());
6256 self
6257 }
6258
6259 /// Sets or clears the value of [api_requirements][crate::model::Api::api_requirements].
6260 ///
6261 /// # Example
6262 /// ```ignore,no_run
6263 /// # use google_cloud_apihub_v1::model::Api;
6264 /// use google_cloud_apihub_v1::model::AttributeValues;
6265 /// let x = Api::new().set_or_clear_api_requirements(Some(AttributeValues::default()/* use setters */));
6266 /// let x = Api::new().set_or_clear_api_requirements(None::<AttributeValues>);
6267 /// ```
6268 pub fn set_or_clear_api_requirements<T>(mut self, v: std::option::Option<T>) -> Self
6269 where
6270 T: std::convert::Into<crate::model::AttributeValues>,
6271 {
6272 self.api_requirements = v.map(|x| x.into());
6273 self
6274 }
6275
6276 /// Sets the value of [fingerprint][crate::model::Api::fingerprint].
6277 ///
6278 /// # Example
6279 /// ```ignore,no_run
6280 /// # use google_cloud_apihub_v1::model::Api;
6281 /// let x = Api::new().set_fingerprint("example");
6282 /// ```
6283 pub fn set_fingerprint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6284 self.fingerprint = v.into();
6285 self
6286 }
6287
6288 /// Sets the value of [source_metadata][crate::model::Api::source_metadata].
6289 ///
6290 /// # Example
6291 /// ```ignore,no_run
6292 /// # use google_cloud_apihub_v1::model::Api;
6293 /// use google_cloud_apihub_v1::model::SourceMetadata;
6294 /// let x = Api::new()
6295 /// .set_source_metadata([
6296 /// SourceMetadata::default()/* use setters */,
6297 /// SourceMetadata::default()/* use (different) setters */,
6298 /// ]);
6299 /// ```
6300 pub fn set_source_metadata<T, V>(mut self, v: T) -> Self
6301 where
6302 T: std::iter::IntoIterator<Item = V>,
6303 V: std::convert::Into<crate::model::SourceMetadata>,
6304 {
6305 use std::iter::Iterator;
6306 self.source_metadata = v.into_iter().map(|i| i.into()).collect();
6307 self
6308 }
6309
6310 /// Sets the value of [api_functional_requirements][crate::model::Api::api_functional_requirements].
6311 ///
6312 /// # Example
6313 /// ```ignore,no_run
6314 /// # use google_cloud_apihub_v1::model::Api;
6315 /// use google_cloud_apihub_v1::model::AttributeValues;
6316 /// let x = Api::new().set_api_functional_requirements(AttributeValues::default()/* use setters */);
6317 /// ```
6318 pub fn set_api_functional_requirements<T>(mut self, v: T) -> Self
6319 where
6320 T: std::convert::Into<crate::model::AttributeValues>,
6321 {
6322 self.api_functional_requirements = std::option::Option::Some(v.into());
6323 self
6324 }
6325
6326 /// Sets or clears the value of [api_functional_requirements][crate::model::Api::api_functional_requirements].
6327 ///
6328 /// # Example
6329 /// ```ignore,no_run
6330 /// # use google_cloud_apihub_v1::model::Api;
6331 /// use google_cloud_apihub_v1::model::AttributeValues;
6332 /// let x = Api::new().set_or_clear_api_functional_requirements(Some(AttributeValues::default()/* use setters */));
6333 /// let x = Api::new().set_or_clear_api_functional_requirements(None::<AttributeValues>);
6334 /// ```
6335 pub fn set_or_clear_api_functional_requirements<T>(mut self, v: std::option::Option<T>) -> Self
6336 where
6337 T: std::convert::Into<crate::model::AttributeValues>,
6338 {
6339 self.api_functional_requirements = v.map(|x| x.into());
6340 self
6341 }
6342
6343 /// Sets the value of [api_technical_requirements][crate::model::Api::api_technical_requirements].
6344 ///
6345 /// # Example
6346 /// ```ignore,no_run
6347 /// # use google_cloud_apihub_v1::model::Api;
6348 /// use google_cloud_apihub_v1::model::AttributeValues;
6349 /// let x = Api::new().set_api_technical_requirements(AttributeValues::default()/* use setters */);
6350 /// ```
6351 pub fn set_api_technical_requirements<T>(mut self, v: T) -> Self
6352 where
6353 T: std::convert::Into<crate::model::AttributeValues>,
6354 {
6355 self.api_technical_requirements = std::option::Option::Some(v.into());
6356 self
6357 }
6358
6359 /// Sets or clears the value of [api_technical_requirements][crate::model::Api::api_technical_requirements].
6360 ///
6361 /// # Example
6362 /// ```ignore,no_run
6363 /// # use google_cloud_apihub_v1::model::Api;
6364 /// use google_cloud_apihub_v1::model::AttributeValues;
6365 /// let x = Api::new().set_or_clear_api_technical_requirements(Some(AttributeValues::default()/* use setters */));
6366 /// let x = Api::new().set_or_clear_api_technical_requirements(None::<AttributeValues>);
6367 /// ```
6368 pub fn set_or_clear_api_technical_requirements<T>(mut self, v: std::option::Option<T>) -> Self
6369 where
6370 T: std::convert::Into<crate::model::AttributeValues>,
6371 {
6372 self.api_technical_requirements = v.map(|x| x.into());
6373 self
6374 }
6375}
6376
6377impl wkt::message::Message for Api {
6378 fn typename() -> &'static str {
6379 "type.googleapis.com/google.cloud.apihub.v1.Api"
6380 }
6381}
6382
6383/// Represents a version of the API resource in API hub. This is also referred
6384/// to as the API version.
6385#[derive(Clone, Default, PartialEq)]
6386#[non_exhaustive]
6387pub struct Version {
6388 /// Identifier. The name of the version.
6389 ///
6390 /// Format:
6391 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
6392 pub name: std::string::String,
6393
6394 /// Required. The display name of the version.
6395 pub display_name: std::string::String,
6396
6397 /// Optional. The description of the version.
6398 pub description: std::string::String,
6399
6400 /// Optional. The documentation of the version.
6401 pub documentation: std::option::Option<crate::model::Documentation>,
6402
6403 /// Output only. The specs associated with this version.
6404 /// Note that an API version can be associated with multiple specs.
6405 /// Format is
6406 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
6407 pub specs: std::vec::Vec<std::string::String>,
6408
6409 /// Output only. The operations contained in the API version.
6410 /// These operations will be added to the version when a new spec is
6411 /// added or when an existing spec is updated. Format is
6412 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
6413 pub api_operations: std::vec::Vec<std::string::String>,
6414
6415 /// Output only. The definitions contained in the API version.
6416 /// These definitions will be added to the version when a new spec is
6417 /// added or when an existing spec is updated. Format is
6418 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}`
6419 pub definitions: std::vec::Vec<std::string::String>,
6420
6421 /// Optional. The deployments linked to this API version.
6422 /// Note: A particular API version could be deployed to multiple deployments
6423 /// (for dev deployment, UAT deployment, etc)
6424 /// Format is
6425 /// `projects/{project}/locations/{location}/deployments/{deployment}`
6426 pub deployments: std::vec::Vec<std::string::String>,
6427
6428 /// Output only. The time at which the version was created.
6429 pub create_time: std::option::Option<wkt::Timestamp>,
6430
6431 /// Output only. The time at which the version was last updated.
6432 pub update_time: std::option::Option<wkt::Timestamp>,
6433
6434 /// Optional. The lifecycle of the API version.
6435 /// This maps to the following system defined attribute:
6436 /// `projects/{project}/locations/{location}/attributes/system-lifecycle`
6437 /// attribute.
6438 /// The number of values for this attribute will be based on the
6439 /// cardinality of the attribute. The same can be retrieved via GetAttribute
6440 /// API. All values should be from the list of allowed values defined for the
6441 /// attribute.
6442 pub lifecycle: std::option::Option<crate::model::AttributeValues>,
6443
6444 /// Optional. The compliance associated with the API version.
6445 /// This maps to the following system defined attribute:
6446 /// `projects/{project}/locations/{location}/attributes/system-compliance`
6447 /// attribute.
6448 /// The number of values for this attribute will be based on the
6449 /// cardinality of the attribute. The same can be retrieved via GetAttribute
6450 /// API. All values should be from the list of allowed values defined for the
6451 /// attribute.
6452 pub compliance: std::option::Option<crate::model::AttributeValues>,
6453
6454 /// Optional. The accreditations associated with the API version.
6455 /// This maps to the following system defined attribute:
6456 /// `projects/{project}/locations/{location}/attributes/system-accreditation`
6457 /// attribute.
6458 /// The number of values for this attribute will be based on the
6459 /// cardinality of the attribute. The same can be retrieved via GetAttribute
6460 /// API. All values should be from the list of allowed values defined for the
6461 /// attribute.
6462 pub accreditation: std::option::Option<crate::model::AttributeValues>,
6463
6464 /// Optional. The list of user defined attributes associated with the Version
6465 /// resource. The key is the attribute name. It will be of the format:
6466 /// `projects/{project}/locations/{location}/attributes/{attribute}`.
6467 /// The value is the attribute values associated with the resource.
6468 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
6469
6470 /// Optional. The selected deployment for a Version resource.
6471 /// This can be used when special handling is needed on client side for a
6472 /// particular deployment linked to the version.
6473 /// Format is
6474 /// `projects/{project}/locations/{location}/deployments/{deployment}`
6475 pub selected_deployment: std::string::String,
6476
6477 /// Output only. The list of sources and metadata from the sources of the
6478 /// version.
6479 pub source_metadata: std::vec::Vec<crate::model::SourceMetadata>,
6480
6481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6482}
6483
6484impl Version {
6485 pub fn new() -> Self {
6486 std::default::Default::default()
6487 }
6488
6489 /// Sets the value of [name][crate::model::Version::name].
6490 ///
6491 /// # Example
6492 /// ```ignore,no_run
6493 /// # use google_cloud_apihub_v1::model::Version;
6494 /// let x = Version::new().set_name("example");
6495 /// ```
6496 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6497 self.name = v.into();
6498 self
6499 }
6500
6501 /// Sets the value of [display_name][crate::model::Version::display_name].
6502 ///
6503 /// # Example
6504 /// ```ignore,no_run
6505 /// # use google_cloud_apihub_v1::model::Version;
6506 /// let x = Version::new().set_display_name("example");
6507 /// ```
6508 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6509 self.display_name = v.into();
6510 self
6511 }
6512
6513 /// Sets the value of [description][crate::model::Version::description].
6514 ///
6515 /// # Example
6516 /// ```ignore,no_run
6517 /// # use google_cloud_apihub_v1::model::Version;
6518 /// let x = Version::new().set_description("example");
6519 /// ```
6520 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6521 self.description = v.into();
6522 self
6523 }
6524
6525 /// Sets the value of [documentation][crate::model::Version::documentation].
6526 ///
6527 /// # Example
6528 /// ```ignore,no_run
6529 /// # use google_cloud_apihub_v1::model::Version;
6530 /// use google_cloud_apihub_v1::model::Documentation;
6531 /// let x = Version::new().set_documentation(Documentation::default()/* use setters */);
6532 /// ```
6533 pub fn set_documentation<T>(mut self, v: T) -> Self
6534 where
6535 T: std::convert::Into<crate::model::Documentation>,
6536 {
6537 self.documentation = std::option::Option::Some(v.into());
6538 self
6539 }
6540
6541 /// Sets or clears the value of [documentation][crate::model::Version::documentation].
6542 ///
6543 /// # Example
6544 /// ```ignore,no_run
6545 /// # use google_cloud_apihub_v1::model::Version;
6546 /// use google_cloud_apihub_v1::model::Documentation;
6547 /// let x = Version::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
6548 /// let x = Version::new().set_or_clear_documentation(None::<Documentation>);
6549 /// ```
6550 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
6551 where
6552 T: std::convert::Into<crate::model::Documentation>,
6553 {
6554 self.documentation = v.map(|x| x.into());
6555 self
6556 }
6557
6558 /// Sets the value of [specs][crate::model::Version::specs].
6559 ///
6560 /// # Example
6561 /// ```ignore,no_run
6562 /// # use google_cloud_apihub_v1::model::Version;
6563 /// let x = Version::new().set_specs(["a", "b", "c"]);
6564 /// ```
6565 pub fn set_specs<T, V>(mut self, v: T) -> Self
6566 where
6567 T: std::iter::IntoIterator<Item = V>,
6568 V: std::convert::Into<std::string::String>,
6569 {
6570 use std::iter::Iterator;
6571 self.specs = v.into_iter().map(|i| i.into()).collect();
6572 self
6573 }
6574
6575 /// Sets the value of [api_operations][crate::model::Version::api_operations].
6576 ///
6577 /// # Example
6578 /// ```ignore,no_run
6579 /// # use google_cloud_apihub_v1::model::Version;
6580 /// let x = Version::new().set_api_operations(["a", "b", "c"]);
6581 /// ```
6582 pub fn set_api_operations<T, V>(mut self, v: T) -> Self
6583 where
6584 T: std::iter::IntoIterator<Item = V>,
6585 V: std::convert::Into<std::string::String>,
6586 {
6587 use std::iter::Iterator;
6588 self.api_operations = v.into_iter().map(|i| i.into()).collect();
6589 self
6590 }
6591
6592 /// Sets the value of [definitions][crate::model::Version::definitions].
6593 ///
6594 /// # Example
6595 /// ```ignore,no_run
6596 /// # use google_cloud_apihub_v1::model::Version;
6597 /// let x = Version::new().set_definitions(["a", "b", "c"]);
6598 /// ```
6599 pub fn set_definitions<T, V>(mut self, v: T) -> Self
6600 where
6601 T: std::iter::IntoIterator<Item = V>,
6602 V: std::convert::Into<std::string::String>,
6603 {
6604 use std::iter::Iterator;
6605 self.definitions = v.into_iter().map(|i| i.into()).collect();
6606 self
6607 }
6608
6609 /// Sets the value of [deployments][crate::model::Version::deployments].
6610 ///
6611 /// # Example
6612 /// ```ignore,no_run
6613 /// # use google_cloud_apihub_v1::model::Version;
6614 /// let x = Version::new().set_deployments(["a", "b", "c"]);
6615 /// ```
6616 pub fn set_deployments<T, V>(mut self, v: T) -> Self
6617 where
6618 T: std::iter::IntoIterator<Item = V>,
6619 V: std::convert::Into<std::string::String>,
6620 {
6621 use std::iter::Iterator;
6622 self.deployments = v.into_iter().map(|i| i.into()).collect();
6623 self
6624 }
6625
6626 /// Sets the value of [create_time][crate::model::Version::create_time].
6627 ///
6628 /// # Example
6629 /// ```ignore,no_run
6630 /// # use google_cloud_apihub_v1::model::Version;
6631 /// use wkt::Timestamp;
6632 /// let x = Version::new().set_create_time(Timestamp::default()/* use setters */);
6633 /// ```
6634 pub fn set_create_time<T>(mut self, v: T) -> Self
6635 where
6636 T: std::convert::Into<wkt::Timestamp>,
6637 {
6638 self.create_time = std::option::Option::Some(v.into());
6639 self
6640 }
6641
6642 /// Sets or clears the value of [create_time][crate::model::Version::create_time].
6643 ///
6644 /// # Example
6645 /// ```ignore,no_run
6646 /// # use google_cloud_apihub_v1::model::Version;
6647 /// use wkt::Timestamp;
6648 /// let x = Version::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6649 /// let x = Version::new().set_or_clear_create_time(None::<Timestamp>);
6650 /// ```
6651 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6652 where
6653 T: std::convert::Into<wkt::Timestamp>,
6654 {
6655 self.create_time = v.map(|x| x.into());
6656 self
6657 }
6658
6659 /// Sets the value of [update_time][crate::model::Version::update_time].
6660 ///
6661 /// # Example
6662 /// ```ignore,no_run
6663 /// # use google_cloud_apihub_v1::model::Version;
6664 /// use wkt::Timestamp;
6665 /// let x = Version::new().set_update_time(Timestamp::default()/* use setters */);
6666 /// ```
6667 pub fn set_update_time<T>(mut self, v: T) -> Self
6668 where
6669 T: std::convert::Into<wkt::Timestamp>,
6670 {
6671 self.update_time = std::option::Option::Some(v.into());
6672 self
6673 }
6674
6675 /// Sets or clears the value of [update_time][crate::model::Version::update_time].
6676 ///
6677 /// # Example
6678 /// ```ignore,no_run
6679 /// # use google_cloud_apihub_v1::model::Version;
6680 /// use wkt::Timestamp;
6681 /// let x = Version::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6682 /// let x = Version::new().set_or_clear_update_time(None::<Timestamp>);
6683 /// ```
6684 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6685 where
6686 T: std::convert::Into<wkt::Timestamp>,
6687 {
6688 self.update_time = v.map(|x| x.into());
6689 self
6690 }
6691
6692 /// Sets the value of [lifecycle][crate::model::Version::lifecycle].
6693 ///
6694 /// # Example
6695 /// ```ignore,no_run
6696 /// # use google_cloud_apihub_v1::model::Version;
6697 /// use google_cloud_apihub_v1::model::AttributeValues;
6698 /// let x = Version::new().set_lifecycle(AttributeValues::default()/* use setters */);
6699 /// ```
6700 pub fn set_lifecycle<T>(mut self, v: T) -> Self
6701 where
6702 T: std::convert::Into<crate::model::AttributeValues>,
6703 {
6704 self.lifecycle = std::option::Option::Some(v.into());
6705 self
6706 }
6707
6708 /// Sets or clears the value of [lifecycle][crate::model::Version::lifecycle].
6709 ///
6710 /// # Example
6711 /// ```ignore,no_run
6712 /// # use google_cloud_apihub_v1::model::Version;
6713 /// use google_cloud_apihub_v1::model::AttributeValues;
6714 /// let x = Version::new().set_or_clear_lifecycle(Some(AttributeValues::default()/* use setters */));
6715 /// let x = Version::new().set_or_clear_lifecycle(None::<AttributeValues>);
6716 /// ```
6717 pub fn set_or_clear_lifecycle<T>(mut self, v: std::option::Option<T>) -> Self
6718 where
6719 T: std::convert::Into<crate::model::AttributeValues>,
6720 {
6721 self.lifecycle = v.map(|x| x.into());
6722 self
6723 }
6724
6725 /// Sets the value of [compliance][crate::model::Version::compliance].
6726 ///
6727 /// # Example
6728 /// ```ignore,no_run
6729 /// # use google_cloud_apihub_v1::model::Version;
6730 /// use google_cloud_apihub_v1::model::AttributeValues;
6731 /// let x = Version::new().set_compliance(AttributeValues::default()/* use setters */);
6732 /// ```
6733 pub fn set_compliance<T>(mut self, v: T) -> Self
6734 where
6735 T: std::convert::Into<crate::model::AttributeValues>,
6736 {
6737 self.compliance = std::option::Option::Some(v.into());
6738 self
6739 }
6740
6741 /// Sets or clears the value of [compliance][crate::model::Version::compliance].
6742 ///
6743 /// # Example
6744 /// ```ignore,no_run
6745 /// # use google_cloud_apihub_v1::model::Version;
6746 /// use google_cloud_apihub_v1::model::AttributeValues;
6747 /// let x = Version::new().set_or_clear_compliance(Some(AttributeValues::default()/* use setters */));
6748 /// let x = Version::new().set_or_clear_compliance(None::<AttributeValues>);
6749 /// ```
6750 pub fn set_or_clear_compliance<T>(mut self, v: std::option::Option<T>) -> Self
6751 where
6752 T: std::convert::Into<crate::model::AttributeValues>,
6753 {
6754 self.compliance = v.map(|x| x.into());
6755 self
6756 }
6757
6758 /// Sets the value of [accreditation][crate::model::Version::accreditation].
6759 ///
6760 /// # Example
6761 /// ```ignore,no_run
6762 /// # use google_cloud_apihub_v1::model::Version;
6763 /// use google_cloud_apihub_v1::model::AttributeValues;
6764 /// let x = Version::new().set_accreditation(AttributeValues::default()/* use setters */);
6765 /// ```
6766 pub fn set_accreditation<T>(mut self, v: T) -> Self
6767 where
6768 T: std::convert::Into<crate::model::AttributeValues>,
6769 {
6770 self.accreditation = std::option::Option::Some(v.into());
6771 self
6772 }
6773
6774 /// Sets or clears the value of [accreditation][crate::model::Version::accreditation].
6775 ///
6776 /// # Example
6777 /// ```ignore,no_run
6778 /// # use google_cloud_apihub_v1::model::Version;
6779 /// use google_cloud_apihub_v1::model::AttributeValues;
6780 /// let x = Version::new().set_or_clear_accreditation(Some(AttributeValues::default()/* use setters */));
6781 /// let x = Version::new().set_or_clear_accreditation(None::<AttributeValues>);
6782 /// ```
6783 pub fn set_or_clear_accreditation<T>(mut self, v: std::option::Option<T>) -> Self
6784 where
6785 T: std::convert::Into<crate::model::AttributeValues>,
6786 {
6787 self.accreditation = v.map(|x| x.into());
6788 self
6789 }
6790
6791 /// Sets the value of [attributes][crate::model::Version::attributes].
6792 ///
6793 /// # Example
6794 /// ```ignore,no_run
6795 /// # use google_cloud_apihub_v1::model::Version;
6796 /// use google_cloud_apihub_v1::model::AttributeValues;
6797 /// let x = Version::new().set_attributes([
6798 /// ("key0", AttributeValues::default()/* use setters */),
6799 /// ("key1", AttributeValues::default()/* use (different) setters */),
6800 /// ]);
6801 /// ```
6802 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6803 where
6804 T: std::iter::IntoIterator<Item = (K, V)>,
6805 K: std::convert::Into<std::string::String>,
6806 V: std::convert::Into<crate::model::AttributeValues>,
6807 {
6808 use std::iter::Iterator;
6809 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6810 self
6811 }
6812
6813 /// Sets the value of [selected_deployment][crate::model::Version::selected_deployment].
6814 ///
6815 /// # Example
6816 /// ```ignore,no_run
6817 /// # use google_cloud_apihub_v1::model::Version;
6818 /// let x = Version::new().set_selected_deployment("example");
6819 /// ```
6820 pub fn set_selected_deployment<T: std::convert::Into<std::string::String>>(
6821 mut self,
6822 v: T,
6823 ) -> Self {
6824 self.selected_deployment = v.into();
6825 self
6826 }
6827
6828 /// Sets the value of [source_metadata][crate::model::Version::source_metadata].
6829 ///
6830 /// # Example
6831 /// ```ignore,no_run
6832 /// # use google_cloud_apihub_v1::model::Version;
6833 /// use google_cloud_apihub_v1::model::SourceMetadata;
6834 /// let x = Version::new()
6835 /// .set_source_metadata([
6836 /// SourceMetadata::default()/* use setters */,
6837 /// SourceMetadata::default()/* use (different) setters */,
6838 /// ]);
6839 /// ```
6840 pub fn set_source_metadata<T, V>(mut self, v: T) -> Self
6841 where
6842 T: std::iter::IntoIterator<Item = V>,
6843 V: std::convert::Into<crate::model::SourceMetadata>,
6844 {
6845 use std::iter::Iterator;
6846 self.source_metadata = v.into_iter().map(|i| i.into()).collect();
6847 self
6848 }
6849}
6850
6851impl wkt::message::Message for Version {
6852 fn typename() -> &'static str {
6853 "type.googleapis.com/google.cloud.apihub.v1.Version"
6854 }
6855}
6856
6857/// Represents a spec associated with an API version in the API
6858/// Hub. Note that specs of various types can be uploaded, however
6859/// parsing of details is supported for OpenAPI spec currently.
6860#[derive(Clone, Default, PartialEq)]
6861#[non_exhaustive]
6862pub struct Spec {
6863 /// Identifier. The name of the spec.
6864 ///
6865 /// Format:
6866 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
6867 pub name: std::string::String,
6868
6869 /// Required. The display name of the spec.
6870 /// This can contain the file name of the spec.
6871 pub display_name: std::string::String,
6872
6873 /// Required. The type of spec.
6874 /// The value should be one of the allowed values defined for
6875 /// `projects/{project}/locations/{location}/attributes/system-spec-type`
6876 /// attribute.
6877 /// The number of values for this attribute will be based on the
6878 /// cardinality of the attribute. The same can be retrieved via GetAttribute
6879 /// API.
6880 ///
6881 /// Note, this field is mandatory if content is provided.
6882 pub spec_type: std::option::Option<crate::model::AttributeValues>,
6883
6884 /// Optional. Input only. The contents of the uploaded spec.
6885 pub contents: std::option::Option<crate::model::SpecContents>,
6886
6887 /// Output only. Details parsed from the spec.
6888 pub details: std::option::Option<crate::model::SpecDetails>,
6889
6890 /// Optional. The URI of the spec source in case file is uploaded
6891 /// from an external version control system.
6892 pub source_uri: std::string::String,
6893
6894 /// Output only. The time at which the spec was created.
6895 pub create_time: std::option::Option<wkt::Timestamp>,
6896
6897 /// Output only. The time at which the spec was last updated.
6898 pub update_time: std::option::Option<wkt::Timestamp>,
6899
6900 /// Optional. The lint response for the spec.
6901 pub lint_response: std::option::Option<crate::model::LintResponse>,
6902
6903 /// Optional. The list of user defined attributes associated with the spec.
6904 /// The key is the attribute name. It will be of the format:
6905 /// `projects/{project}/locations/{location}/attributes/{attribute}`.
6906 /// The value is the attribute values associated with the resource.
6907 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
6908
6909 /// Optional. The documentation of the spec.
6910 /// For OpenAPI spec, this will be populated from `externalDocs` in OpenAPI
6911 /// spec.
6912 pub documentation: std::option::Option<crate::model::Documentation>,
6913
6914 /// Optional. Input only. Enum specifying the parsing mode for OpenAPI
6915 /// Specification (OAS) parsing.
6916 pub parsing_mode: crate::model::spec::ParsingMode,
6917
6918 /// Output only. The list of sources and metadata from the sources of the spec.
6919 pub source_metadata: std::vec::Vec<crate::model::SourceMetadata>,
6920
6921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6922}
6923
6924impl Spec {
6925 pub fn new() -> Self {
6926 std::default::Default::default()
6927 }
6928
6929 /// Sets the value of [name][crate::model::Spec::name].
6930 ///
6931 /// # Example
6932 /// ```ignore,no_run
6933 /// # use google_cloud_apihub_v1::model::Spec;
6934 /// let x = Spec::new().set_name("example");
6935 /// ```
6936 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6937 self.name = v.into();
6938 self
6939 }
6940
6941 /// Sets the value of [display_name][crate::model::Spec::display_name].
6942 ///
6943 /// # Example
6944 /// ```ignore,no_run
6945 /// # use google_cloud_apihub_v1::model::Spec;
6946 /// let x = Spec::new().set_display_name("example");
6947 /// ```
6948 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6949 self.display_name = v.into();
6950 self
6951 }
6952
6953 /// Sets the value of [spec_type][crate::model::Spec::spec_type].
6954 ///
6955 /// # Example
6956 /// ```ignore,no_run
6957 /// # use google_cloud_apihub_v1::model::Spec;
6958 /// use google_cloud_apihub_v1::model::AttributeValues;
6959 /// let x = Spec::new().set_spec_type(AttributeValues::default()/* use setters */);
6960 /// ```
6961 pub fn set_spec_type<T>(mut self, v: T) -> Self
6962 where
6963 T: std::convert::Into<crate::model::AttributeValues>,
6964 {
6965 self.spec_type = std::option::Option::Some(v.into());
6966 self
6967 }
6968
6969 /// Sets or clears the value of [spec_type][crate::model::Spec::spec_type].
6970 ///
6971 /// # Example
6972 /// ```ignore,no_run
6973 /// # use google_cloud_apihub_v1::model::Spec;
6974 /// use google_cloud_apihub_v1::model::AttributeValues;
6975 /// let x = Spec::new().set_or_clear_spec_type(Some(AttributeValues::default()/* use setters */));
6976 /// let x = Spec::new().set_or_clear_spec_type(None::<AttributeValues>);
6977 /// ```
6978 pub fn set_or_clear_spec_type<T>(mut self, v: std::option::Option<T>) -> Self
6979 where
6980 T: std::convert::Into<crate::model::AttributeValues>,
6981 {
6982 self.spec_type = v.map(|x| x.into());
6983 self
6984 }
6985
6986 /// Sets the value of [contents][crate::model::Spec::contents].
6987 ///
6988 /// # Example
6989 /// ```ignore,no_run
6990 /// # use google_cloud_apihub_v1::model::Spec;
6991 /// use google_cloud_apihub_v1::model::SpecContents;
6992 /// let x = Spec::new().set_contents(SpecContents::default()/* use setters */);
6993 /// ```
6994 pub fn set_contents<T>(mut self, v: T) -> Self
6995 where
6996 T: std::convert::Into<crate::model::SpecContents>,
6997 {
6998 self.contents = std::option::Option::Some(v.into());
6999 self
7000 }
7001
7002 /// Sets or clears the value of [contents][crate::model::Spec::contents].
7003 ///
7004 /// # Example
7005 /// ```ignore,no_run
7006 /// # use google_cloud_apihub_v1::model::Spec;
7007 /// use google_cloud_apihub_v1::model::SpecContents;
7008 /// let x = Spec::new().set_or_clear_contents(Some(SpecContents::default()/* use setters */));
7009 /// let x = Spec::new().set_or_clear_contents(None::<SpecContents>);
7010 /// ```
7011 pub fn set_or_clear_contents<T>(mut self, v: std::option::Option<T>) -> Self
7012 where
7013 T: std::convert::Into<crate::model::SpecContents>,
7014 {
7015 self.contents = v.map(|x| x.into());
7016 self
7017 }
7018
7019 /// Sets the value of [details][crate::model::Spec::details].
7020 ///
7021 /// # Example
7022 /// ```ignore,no_run
7023 /// # use google_cloud_apihub_v1::model::Spec;
7024 /// use google_cloud_apihub_v1::model::SpecDetails;
7025 /// let x = Spec::new().set_details(SpecDetails::default()/* use setters */);
7026 /// ```
7027 pub fn set_details<T>(mut self, v: T) -> Self
7028 where
7029 T: std::convert::Into<crate::model::SpecDetails>,
7030 {
7031 self.details = std::option::Option::Some(v.into());
7032 self
7033 }
7034
7035 /// Sets or clears the value of [details][crate::model::Spec::details].
7036 ///
7037 /// # Example
7038 /// ```ignore,no_run
7039 /// # use google_cloud_apihub_v1::model::Spec;
7040 /// use google_cloud_apihub_v1::model::SpecDetails;
7041 /// let x = Spec::new().set_or_clear_details(Some(SpecDetails::default()/* use setters */));
7042 /// let x = Spec::new().set_or_clear_details(None::<SpecDetails>);
7043 /// ```
7044 pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
7045 where
7046 T: std::convert::Into<crate::model::SpecDetails>,
7047 {
7048 self.details = v.map(|x| x.into());
7049 self
7050 }
7051
7052 /// Sets the value of [source_uri][crate::model::Spec::source_uri].
7053 ///
7054 /// # Example
7055 /// ```ignore,no_run
7056 /// # use google_cloud_apihub_v1::model::Spec;
7057 /// let x = Spec::new().set_source_uri("example");
7058 /// ```
7059 pub fn set_source_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7060 self.source_uri = v.into();
7061 self
7062 }
7063
7064 /// Sets the value of [create_time][crate::model::Spec::create_time].
7065 ///
7066 /// # Example
7067 /// ```ignore,no_run
7068 /// # use google_cloud_apihub_v1::model::Spec;
7069 /// use wkt::Timestamp;
7070 /// let x = Spec::new().set_create_time(Timestamp::default()/* use setters */);
7071 /// ```
7072 pub fn set_create_time<T>(mut self, v: T) -> Self
7073 where
7074 T: std::convert::Into<wkt::Timestamp>,
7075 {
7076 self.create_time = std::option::Option::Some(v.into());
7077 self
7078 }
7079
7080 /// Sets or clears the value of [create_time][crate::model::Spec::create_time].
7081 ///
7082 /// # Example
7083 /// ```ignore,no_run
7084 /// # use google_cloud_apihub_v1::model::Spec;
7085 /// use wkt::Timestamp;
7086 /// let x = Spec::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7087 /// let x = Spec::new().set_or_clear_create_time(None::<Timestamp>);
7088 /// ```
7089 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7090 where
7091 T: std::convert::Into<wkt::Timestamp>,
7092 {
7093 self.create_time = v.map(|x| x.into());
7094 self
7095 }
7096
7097 /// Sets the value of [update_time][crate::model::Spec::update_time].
7098 ///
7099 /// # Example
7100 /// ```ignore,no_run
7101 /// # use google_cloud_apihub_v1::model::Spec;
7102 /// use wkt::Timestamp;
7103 /// let x = Spec::new().set_update_time(Timestamp::default()/* use setters */);
7104 /// ```
7105 pub fn set_update_time<T>(mut self, v: T) -> Self
7106 where
7107 T: std::convert::Into<wkt::Timestamp>,
7108 {
7109 self.update_time = std::option::Option::Some(v.into());
7110 self
7111 }
7112
7113 /// Sets or clears the value of [update_time][crate::model::Spec::update_time].
7114 ///
7115 /// # Example
7116 /// ```ignore,no_run
7117 /// # use google_cloud_apihub_v1::model::Spec;
7118 /// use wkt::Timestamp;
7119 /// let x = Spec::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7120 /// let x = Spec::new().set_or_clear_update_time(None::<Timestamp>);
7121 /// ```
7122 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7123 where
7124 T: std::convert::Into<wkt::Timestamp>,
7125 {
7126 self.update_time = v.map(|x| x.into());
7127 self
7128 }
7129
7130 /// Sets the value of [lint_response][crate::model::Spec::lint_response].
7131 ///
7132 /// # Example
7133 /// ```ignore,no_run
7134 /// # use google_cloud_apihub_v1::model::Spec;
7135 /// use google_cloud_apihub_v1::model::LintResponse;
7136 /// let x = Spec::new().set_lint_response(LintResponse::default()/* use setters */);
7137 /// ```
7138 pub fn set_lint_response<T>(mut self, v: T) -> Self
7139 where
7140 T: std::convert::Into<crate::model::LintResponse>,
7141 {
7142 self.lint_response = std::option::Option::Some(v.into());
7143 self
7144 }
7145
7146 /// Sets or clears the value of [lint_response][crate::model::Spec::lint_response].
7147 ///
7148 /// # Example
7149 /// ```ignore,no_run
7150 /// # use google_cloud_apihub_v1::model::Spec;
7151 /// use google_cloud_apihub_v1::model::LintResponse;
7152 /// let x = Spec::new().set_or_clear_lint_response(Some(LintResponse::default()/* use setters */));
7153 /// let x = Spec::new().set_or_clear_lint_response(None::<LintResponse>);
7154 /// ```
7155 pub fn set_or_clear_lint_response<T>(mut self, v: std::option::Option<T>) -> Self
7156 where
7157 T: std::convert::Into<crate::model::LintResponse>,
7158 {
7159 self.lint_response = v.map(|x| x.into());
7160 self
7161 }
7162
7163 /// Sets the value of [attributes][crate::model::Spec::attributes].
7164 ///
7165 /// # Example
7166 /// ```ignore,no_run
7167 /// # use google_cloud_apihub_v1::model::Spec;
7168 /// use google_cloud_apihub_v1::model::AttributeValues;
7169 /// let x = Spec::new().set_attributes([
7170 /// ("key0", AttributeValues::default()/* use setters */),
7171 /// ("key1", AttributeValues::default()/* use (different) setters */),
7172 /// ]);
7173 /// ```
7174 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7175 where
7176 T: std::iter::IntoIterator<Item = (K, V)>,
7177 K: std::convert::Into<std::string::String>,
7178 V: std::convert::Into<crate::model::AttributeValues>,
7179 {
7180 use std::iter::Iterator;
7181 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7182 self
7183 }
7184
7185 /// Sets the value of [documentation][crate::model::Spec::documentation].
7186 ///
7187 /// # Example
7188 /// ```ignore,no_run
7189 /// # use google_cloud_apihub_v1::model::Spec;
7190 /// use google_cloud_apihub_v1::model::Documentation;
7191 /// let x = Spec::new().set_documentation(Documentation::default()/* use setters */);
7192 /// ```
7193 pub fn set_documentation<T>(mut self, v: T) -> Self
7194 where
7195 T: std::convert::Into<crate::model::Documentation>,
7196 {
7197 self.documentation = std::option::Option::Some(v.into());
7198 self
7199 }
7200
7201 /// Sets or clears the value of [documentation][crate::model::Spec::documentation].
7202 ///
7203 /// # Example
7204 /// ```ignore,no_run
7205 /// # use google_cloud_apihub_v1::model::Spec;
7206 /// use google_cloud_apihub_v1::model::Documentation;
7207 /// let x = Spec::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
7208 /// let x = Spec::new().set_or_clear_documentation(None::<Documentation>);
7209 /// ```
7210 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
7211 where
7212 T: std::convert::Into<crate::model::Documentation>,
7213 {
7214 self.documentation = v.map(|x| x.into());
7215 self
7216 }
7217
7218 /// Sets the value of [parsing_mode][crate::model::Spec::parsing_mode].
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_apihub_v1::model::Spec;
7223 /// use google_cloud_apihub_v1::model::spec::ParsingMode;
7224 /// let x0 = Spec::new().set_parsing_mode(ParsingMode::Relaxed);
7225 /// let x1 = Spec::new().set_parsing_mode(ParsingMode::Strict);
7226 /// ```
7227 pub fn set_parsing_mode<T: std::convert::Into<crate::model::spec::ParsingMode>>(
7228 mut self,
7229 v: T,
7230 ) -> Self {
7231 self.parsing_mode = v.into();
7232 self
7233 }
7234
7235 /// Sets the value of [source_metadata][crate::model::Spec::source_metadata].
7236 ///
7237 /// # Example
7238 /// ```ignore,no_run
7239 /// # use google_cloud_apihub_v1::model::Spec;
7240 /// use google_cloud_apihub_v1::model::SourceMetadata;
7241 /// let x = Spec::new()
7242 /// .set_source_metadata([
7243 /// SourceMetadata::default()/* use setters */,
7244 /// SourceMetadata::default()/* use (different) setters */,
7245 /// ]);
7246 /// ```
7247 pub fn set_source_metadata<T, V>(mut self, v: T) -> Self
7248 where
7249 T: std::iter::IntoIterator<Item = V>,
7250 V: std::convert::Into<crate::model::SourceMetadata>,
7251 {
7252 use std::iter::Iterator;
7253 self.source_metadata = v.into_iter().map(|i| i.into()).collect();
7254 self
7255 }
7256}
7257
7258impl wkt::message::Message for Spec {
7259 fn typename() -> &'static str {
7260 "type.googleapis.com/google.cloud.apihub.v1.Spec"
7261 }
7262}
7263
7264/// Defines additional types related to [Spec].
7265pub mod spec {
7266 #[allow(unused_imports)]
7267 use super::*;
7268
7269 /// Specifies the parsing mode for API specifications during creation and
7270 /// update.
7271 ///
7272 /// - `RELAXED`: Parsing errors in the specification content do not fail the
7273 /// API call.
7274 /// - `STRICT`: Parsing errors in the specification content result in failure
7275 /// of the API call.
7276 /// If not specified, defaults to `RELAXED`.
7277 ///
7278 /// # Working with unknown values
7279 ///
7280 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7281 /// additional enum variants at any time. Adding new variants is not considered
7282 /// a breaking change. Applications should write their code in anticipation of:
7283 ///
7284 /// - New values appearing in future releases of the client library, **and**
7285 /// - New values received dynamically, without application changes.
7286 ///
7287 /// Please consult the [Working with enums] section in the user guide for some
7288 /// guidelines.
7289 ///
7290 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7291 #[derive(Clone, Debug, PartialEq)]
7292 #[non_exhaustive]
7293 pub enum ParsingMode {
7294 /// Defaults to `RELAXED`.
7295 Unspecified,
7296 /// Parsing of the Spec on create and update is relaxed, meaning that
7297 /// parsing errors the spec contents will not fail the API call.
7298 Relaxed,
7299 /// Parsing of the Spec on create and update is strict, meaning that
7300 /// parsing errors in the spec contents will fail the API call.
7301 Strict,
7302 /// If set, the enum was initialized with an unknown value.
7303 ///
7304 /// Applications can examine the value using [ParsingMode::value] or
7305 /// [ParsingMode::name].
7306 UnknownValue(parsing_mode::UnknownValue),
7307 }
7308
7309 #[doc(hidden)]
7310 pub mod parsing_mode {
7311 #[allow(unused_imports)]
7312 use super::*;
7313 #[derive(Clone, Debug, PartialEq)]
7314 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7315 }
7316
7317 impl ParsingMode {
7318 /// Gets the enum value.
7319 ///
7320 /// Returns `None` if the enum contains an unknown value deserialized from
7321 /// the string representation of enums.
7322 pub fn value(&self) -> std::option::Option<i32> {
7323 match self {
7324 Self::Unspecified => std::option::Option::Some(0),
7325 Self::Relaxed => std::option::Option::Some(1),
7326 Self::Strict => std::option::Option::Some(2),
7327 Self::UnknownValue(u) => u.0.value(),
7328 }
7329 }
7330
7331 /// Gets the enum value as a string.
7332 ///
7333 /// Returns `None` if the enum contains an unknown value deserialized from
7334 /// the integer representation of enums.
7335 pub fn name(&self) -> std::option::Option<&str> {
7336 match self {
7337 Self::Unspecified => std::option::Option::Some("PARSING_MODE_UNSPECIFIED"),
7338 Self::Relaxed => std::option::Option::Some("RELAXED"),
7339 Self::Strict => std::option::Option::Some("STRICT"),
7340 Self::UnknownValue(u) => u.0.name(),
7341 }
7342 }
7343 }
7344
7345 impl std::default::Default for ParsingMode {
7346 fn default() -> Self {
7347 use std::convert::From;
7348 Self::from(0)
7349 }
7350 }
7351
7352 impl std::fmt::Display for ParsingMode {
7353 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7354 wkt::internal::display_enum(f, self.name(), self.value())
7355 }
7356 }
7357
7358 impl std::convert::From<i32> for ParsingMode {
7359 fn from(value: i32) -> Self {
7360 match value {
7361 0 => Self::Unspecified,
7362 1 => Self::Relaxed,
7363 2 => Self::Strict,
7364 _ => Self::UnknownValue(parsing_mode::UnknownValue(
7365 wkt::internal::UnknownEnumValue::Integer(value),
7366 )),
7367 }
7368 }
7369 }
7370
7371 impl std::convert::From<&str> for ParsingMode {
7372 fn from(value: &str) -> Self {
7373 use std::string::ToString;
7374 match value {
7375 "PARSING_MODE_UNSPECIFIED" => Self::Unspecified,
7376 "RELAXED" => Self::Relaxed,
7377 "STRICT" => Self::Strict,
7378 _ => Self::UnknownValue(parsing_mode::UnknownValue(
7379 wkt::internal::UnknownEnumValue::String(value.to_string()),
7380 )),
7381 }
7382 }
7383 }
7384
7385 impl serde::ser::Serialize for ParsingMode {
7386 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7387 where
7388 S: serde::Serializer,
7389 {
7390 match self {
7391 Self::Unspecified => serializer.serialize_i32(0),
7392 Self::Relaxed => serializer.serialize_i32(1),
7393 Self::Strict => serializer.serialize_i32(2),
7394 Self::UnknownValue(u) => u.0.serialize(serializer),
7395 }
7396 }
7397 }
7398
7399 impl<'de> serde::de::Deserialize<'de> for ParsingMode {
7400 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7401 where
7402 D: serde::Deserializer<'de>,
7403 {
7404 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ParsingMode>::new(
7405 ".google.cloud.apihub.v1.Spec.ParsingMode",
7406 ))
7407 }
7408 }
7409}
7410
7411/// Details of the deployment where APIs are hosted.
7412/// A deployment could represent an Apigee proxy, API gateway, other Google Cloud
7413/// services or non-Google Cloud services as well. A deployment entity is a root
7414/// level entity in the API hub and exists independent of any API.
7415#[derive(Clone, Default, PartialEq)]
7416#[non_exhaustive]
7417pub struct Deployment {
7418 /// Identifier. The name of the deployment.
7419 ///
7420 /// Format:
7421 /// `projects/{project}/locations/{location}/deployments/{deployment}`
7422 pub name: std::string::String,
7423
7424 /// Required. The display name of the deployment.
7425 pub display_name: std::string::String,
7426
7427 /// Optional. The description of the deployment.
7428 pub description: std::string::String,
7429
7430 /// Optional. The documentation of the deployment.
7431 pub documentation: std::option::Option<crate::model::Documentation>,
7432
7433 /// Required. The type of deployment.
7434 /// This maps to the following system defined attribute:
7435 /// `projects/{project}/locations/{location}/attributes/system-deployment-type`
7436 /// attribute.
7437 /// The number of values for this attribute will be based on the
7438 /// cardinality of the attribute. The same can be retrieved via GetAttribute
7439 /// API. All values should be from the list of allowed values defined for the
7440 /// attribute.
7441 pub deployment_type: std::option::Option<crate::model::AttributeValues>,
7442
7443 /// Required. The resource URI identifies the deployment within its gateway.
7444 /// For Apigee gateways, its recommended to use the format:
7445 /// organizations/{org}/environments/{env}/apis/{api}.
7446 /// For ex: if a proxy with name `orders` is deployed in `staging`
7447 /// environment of `cymbal` organization, the resource URI would be:
7448 /// `organizations/cymbal/environments/staging/apis/orders`.
7449 pub resource_uri: std::string::String,
7450
7451 /// Required. The endpoints at which this deployment resource is listening for
7452 /// API requests. This could be a list of complete URIs, hostnames or an IP
7453 /// addresses.
7454 pub endpoints: std::vec::Vec<std::string::String>,
7455
7456 /// Output only. The API versions linked to this deployment.
7457 /// Note: A particular deployment could be linked to multiple different API
7458 /// versions (of same or different APIs).
7459 pub api_versions: std::vec::Vec<std::string::String>,
7460
7461 /// Output only. The time at which the deployment was created.
7462 pub create_time: std::option::Option<wkt::Timestamp>,
7463
7464 /// Output only. The time at which the deployment was last updated.
7465 pub update_time: std::option::Option<wkt::Timestamp>,
7466
7467 /// Optional. The SLO for this deployment.
7468 /// This maps to the following system defined attribute:
7469 /// `projects/{project}/locations/{location}/attributes/system-slo`
7470 /// attribute.
7471 /// The number of values for this attribute will be based on the
7472 /// cardinality of the attribute. The same can be retrieved via GetAttribute
7473 /// API. All values should be from the list of allowed values defined for the
7474 /// attribute.
7475 pub slo: std::option::Option<crate::model::AttributeValues>,
7476
7477 /// Optional. The environment mapping to this deployment.
7478 /// This maps to the following system defined attribute:
7479 /// `projects/{project}/locations/{location}/attributes/system-environment`
7480 /// attribute.
7481 /// The number of values for this attribute will be based on the
7482 /// cardinality of the attribute. The same can be retrieved via GetAttribute
7483 /// API. All values should be from the list of allowed values defined for the
7484 /// attribute.
7485 pub environment: std::option::Option<crate::model::AttributeValues>,
7486
7487 /// Optional. The list of user defined attributes associated with the
7488 /// deployment resource. The key is the attribute name. It will be of the
7489 /// format: `projects/{project}/locations/{location}/attributes/{attribute}`.
7490 /// The value is the attribute values associated with the resource.
7491 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
7492
7493 /// Output only. The list of sources and metadata from the sources of the
7494 /// deployment.
7495 pub source_metadata: std::vec::Vec<crate::model::SourceMetadata>,
7496
7497 /// Optional. The uri where users can navigate to for the management of the
7498 /// deployment. This maps to the following system defined attribute:
7499 /// `projects/{project}/locations/{location}/attributes/system-management-url`
7500 /// The number of values for this attribute will be based on the
7501 /// cardinality of the attribute. The same can be retrieved via GetAttribute
7502 /// API. The value of the attribute should be a valid URL.
7503 pub management_url: std::option::Option<crate::model::AttributeValues>,
7504
7505 /// Optional. The uri where additional source specific information for this
7506 /// deployment can be found. This maps to the following system defined
7507 /// attribute:
7508 /// `projects/{project}/locations/{location}/attributes/system-source-uri`
7509 /// The number of values for this attribute will be based on the
7510 /// cardinality of the attribute. The same can be retrieved via GetAttribute
7511 /// API. The value of the attribute should be a valid URI, and in case
7512 /// of Cloud Storage URI, it should point to a Cloud Storage object,
7513 /// not a directory.
7514 pub source_uri: std::option::Option<crate::model::AttributeValues>,
7515
7516 /// Optional. The project to which the deployment belongs.
7517 /// For GCP gateways, this will refer to the project identifier.
7518 /// For others like Edge/OPDK, this will refer to the org identifier.
7519 pub source_project: std::string::String,
7520
7521 /// Optional. The environment at source for the deployment.
7522 /// For example: prod, dev, staging, etc.
7523 pub source_environment: std::string::String,
7524
7525 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7526}
7527
7528impl Deployment {
7529 pub fn new() -> Self {
7530 std::default::Default::default()
7531 }
7532
7533 /// Sets the value of [name][crate::model::Deployment::name].
7534 ///
7535 /// # Example
7536 /// ```ignore,no_run
7537 /// # use google_cloud_apihub_v1::model::Deployment;
7538 /// let x = Deployment::new().set_name("example");
7539 /// ```
7540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7541 self.name = v.into();
7542 self
7543 }
7544
7545 /// Sets the value of [display_name][crate::model::Deployment::display_name].
7546 ///
7547 /// # Example
7548 /// ```ignore,no_run
7549 /// # use google_cloud_apihub_v1::model::Deployment;
7550 /// let x = Deployment::new().set_display_name("example");
7551 /// ```
7552 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7553 self.display_name = v.into();
7554 self
7555 }
7556
7557 /// Sets the value of [description][crate::model::Deployment::description].
7558 ///
7559 /// # Example
7560 /// ```ignore,no_run
7561 /// # use google_cloud_apihub_v1::model::Deployment;
7562 /// let x = Deployment::new().set_description("example");
7563 /// ```
7564 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7565 self.description = v.into();
7566 self
7567 }
7568
7569 /// Sets the value of [documentation][crate::model::Deployment::documentation].
7570 ///
7571 /// # Example
7572 /// ```ignore,no_run
7573 /// # use google_cloud_apihub_v1::model::Deployment;
7574 /// use google_cloud_apihub_v1::model::Documentation;
7575 /// let x = Deployment::new().set_documentation(Documentation::default()/* use setters */);
7576 /// ```
7577 pub fn set_documentation<T>(mut self, v: T) -> Self
7578 where
7579 T: std::convert::Into<crate::model::Documentation>,
7580 {
7581 self.documentation = std::option::Option::Some(v.into());
7582 self
7583 }
7584
7585 /// Sets or clears the value of [documentation][crate::model::Deployment::documentation].
7586 ///
7587 /// # Example
7588 /// ```ignore,no_run
7589 /// # use google_cloud_apihub_v1::model::Deployment;
7590 /// use google_cloud_apihub_v1::model::Documentation;
7591 /// let x = Deployment::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
7592 /// let x = Deployment::new().set_or_clear_documentation(None::<Documentation>);
7593 /// ```
7594 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
7595 where
7596 T: std::convert::Into<crate::model::Documentation>,
7597 {
7598 self.documentation = v.map(|x| x.into());
7599 self
7600 }
7601
7602 /// Sets the value of [deployment_type][crate::model::Deployment::deployment_type].
7603 ///
7604 /// # Example
7605 /// ```ignore,no_run
7606 /// # use google_cloud_apihub_v1::model::Deployment;
7607 /// use google_cloud_apihub_v1::model::AttributeValues;
7608 /// let x = Deployment::new().set_deployment_type(AttributeValues::default()/* use setters */);
7609 /// ```
7610 pub fn set_deployment_type<T>(mut self, v: T) -> Self
7611 where
7612 T: std::convert::Into<crate::model::AttributeValues>,
7613 {
7614 self.deployment_type = std::option::Option::Some(v.into());
7615 self
7616 }
7617
7618 /// Sets or clears the value of [deployment_type][crate::model::Deployment::deployment_type].
7619 ///
7620 /// # Example
7621 /// ```ignore,no_run
7622 /// # use google_cloud_apihub_v1::model::Deployment;
7623 /// use google_cloud_apihub_v1::model::AttributeValues;
7624 /// let x = Deployment::new().set_or_clear_deployment_type(Some(AttributeValues::default()/* use setters */));
7625 /// let x = Deployment::new().set_or_clear_deployment_type(None::<AttributeValues>);
7626 /// ```
7627 pub fn set_or_clear_deployment_type<T>(mut self, v: std::option::Option<T>) -> Self
7628 where
7629 T: std::convert::Into<crate::model::AttributeValues>,
7630 {
7631 self.deployment_type = v.map(|x| x.into());
7632 self
7633 }
7634
7635 /// Sets the value of [resource_uri][crate::model::Deployment::resource_uri].
7636 ///
7637 /// # Example
7638 /// ```ignore,no_run
7639 /// # use google_cloud_apihub_v1::model::Deployment;
7640 /// let x = Deployment::new().set_resource_uri("example");
7641 /// ```
7642 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7643 self.resource_uri = v.into();
7644 self
7645 }
7646
7647 /// Sets the value of [endpoints][crate::model::Deployment::endpoints].
7648 ///
7649 /// # Example
7650 /// ```ignore,no_run
7651 /// # use google_cloud_apihub_v1::model::Deployment;
7652 /// let x = Deployment::new().set_endpoints(["a", "b", "c"]);
7653 /// ```
7654 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
7655 where
7656 T: std::iter::IntoIterator<Item = V>,
7657 V: std::convert::Into<std::string::String>,
7658 {
7659 use std::iter::Iterator;
7660 self.endpoints = v.into_iter().map(|i| i.into()).collect();
7661 self
7662 }
7663
7664 /// Sets the value of [api_versions][crate::model::Deployment::api_versions].
7665 ///
7666 /// # Example
7667 /// ```ignore,no_run
7668 /// # use google_cloud_apihub_v1::model::Deployment;
7669 /// let x = Deployment::new().set_api_versions(["a", "b", "c"]);
7670 /// ```
7671 pub fn set_api_versions<T, V>(mut self, v: T) -> Self
7672 where
7673 T: std::iter::IntoIterator<Item = V>,
7674 V: std::convert::Into<std::string::String>,
7675 {
7676 use std::iter::Iterator;
7677 self.api_versions = v.into_iter().map(|i| i.into()).collect();
7678 self
7679 }
7680
7681 /// Sets the value of [create_time][crate::model::Deployment::create_time].
7682 ///
7683 /// # Example
7684 /// ```ignore,no_run
7685 /// # use google_cloud_apihub_v1::model::Deployment;
7686 /// use wkt::Timestamp;
7687 /// let x = Deployment::new().set_create_time(Timestamp::default()/* use setters */);
7688 /// ```
7689 pub fn set_create_time<T>(mut self, v: T) -> Self
7690 where
7691 T: std::convert::Into<wkt::Timestamp>,
7692 {
7693 self.create_time = std::option::Option::Some(v.into());
7694 self
7695 }
7696
7697 /// Sets or clears the value of [create_time][crate::model::Deployment::create_time].
7698 ///
7699 /// # Example
7700 /// ```ignore,no_run
7701 /// # use google_cloud_apihub_v1::model::Deployment;
7702 /// use wkt::Timestamp;
7703 /// let x = Deployment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7704 /// let x = Deployment::new().set_or_clear_create_time(None::<Timestamp>);
7705 /// ```
7706 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7707 where
7708 T: std::convert::Into<wkt::Timestamp>,
7709 {
7710 self.create_time = v.map(|x| x.into());
7711 self
7712 }
7713
7714 /// Sets the value of [update_time][crate::model::Deployment::update_time].
7715 ///
7716 /// # Example
7717 /// ```ignore,no_run
7718 /// # use google_cloud_apihub_v1::model::Deployment;
7719 /// use wkt::Timestamp;
7720 /// let x = Deployment::new().set_update_time(Timestamp::default()/* use setters */);
7721 /// ```
7722 pub fn set_update_time<T>(mut self, v: T) -> Self
7723 where
7724 T: std::convert::Into<wkt::Timestamp>,
7725 {
7726 self.update_time = std::option::Option::Some(v.into());
7727 self
7728 }
7729
7730 /// Sets or clears the value of [update_time][crate::model::Deployment::update_time].
7731 ///
7732 /// # Example
7733 /// ```ignore,no_run
7734 /// # use google_cloud_apihub_v1::model::Deployment;
7735 /// use wkt::Timestamp;
7736 /// let x = Deployment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7737 /// let x = Deployment::new().set_or_clear_update_time(None::<Timestamp>);
7738 /// ```
7739 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7740 where
7741 T: std::convert::Into<wkt::Timestamp>,
7742 {
7743 self.update_time = v.map(|x| x.into());
7744 self
7745 }
7746
7747 /// Sets the value of [slo][crate::model::Deployment::slo].
7748 ///
7749 /// # Example
7750 /// ```ignore,no_run
7751 /// # use google_cloud_apihub_v1::model::Deployment;
7752 /// use google_cloud_apihub_v1::model::AttributeValues;
7753 /// let x = Deployment::new().set_slo(AttributeValues::default()/* use setters */);
7754 /// ```
7755 pub fn set_slo<T>(mut self, v: T) -> Self
7756 where
7757 T: std::convert::Into<crate::model::AttributeValues>,
7758 {
7759 self.slo = std::option::Option::Some(v.into());
7760 self
7761 }
7762
7763 /// Sets or clears the value of [slo][crate::model::Deployment::slo].
7764 ///
7765 /// # Example
7766 /// ```ignore,no_run
7767 /// # use google_cloud_apihub_v1::model::Deployment;
7768 /// use google_cloud_apihub_v1::model::AttributeValues;
7769 /// let x = Deployment::new().set_or_clear_slo(Some(AttributeValues::default()/* use setters */));
7770 /// let x = Deployment::new().set_or_clear_slo(None::<AttributeValues>);
7771 /// ```
7772 pub fn set_or_clear_slo<T>(mut self, v: std::option::Option<T>) -> Self
7773 where
7774 T: std::convert::Into<crate::model::AttributeValues>,
7775 {
7776 self.slo = v.map(|x| x.into());
7777 self
7778 }
7779
7780 /// Sets the value of [environment][crate::model::Deployment::environment].
7781 ///
7782 /// # Example
7783 /// ```ignore,no_run
7784 /// # use google_cloud_apihub_v1::model::Deployment;
7785 /// use google_cloud_apihub_v1::model::AttributeValues;
7786 /// let x = Deployment::new().set_environment(AttributeValues::default()/* use setters */);
7787 /// ```
7788 pub fn set_environment<T>(mut self, v: T) -> Self
7789 where
7790 T: std::convert::Into<crate::model::AttributeValues>,
7791 {
7792 self.environment = std::option::Option::Some(v.into());
7793 self
7794 }
7795
7796 /// Sets or clears the value of [environment][crate::model::Deployment::environment].
7797 ///
7798 /// # Example
7799 /// ```ignore,no_run
7800 /// # use google_cloud_apihub_v1::model::Deployment;
7801 /// use google_cloud_apihub_v1::model::AttributeValues;
7802 /// let x = Deployment::new().set_or_clear_environment(Some(AttributeValues::default()/* use setters */));
7803 /// let x = Deployment::new().set_or_clear_environment(None::<AttributeValues>);
7804 /// ```
7805 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
7806 where
7807 T: std::convert::Into<crate::model::AttributeValues>,
7808 {
7809 self.environment = v.map(|x| x.into());
7810 self
7811 }
7812
7813 /// Sets the value of [attributes][crate::model::Deployment::attributes].
7814 ///
7815 /// # Example
7816 /// ```ignore,no_run
7817 /// # use google_cloud_apihub_v1::model::Deployment;
7818 /// use google_cloud_apihub_v1::model::AttributeValues;
7819 /// let x = Deployment::new().set_attributes([
7820 /// ("key0", AttributeValues::default()/* use setters */),
7821 /// ("key1", AttributeValues::default()/* use (different) setters */),
7822 /// ]);
7823 /// ```
7824 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7825 where
7826 T: std::iter::IntoIterator<Item = (K, V)>,
7827 K: std::convert::Into<std::string::String>,
7828 V: std::convert::Into<crate::model::AttributeValues>,
7829 {
7830 use std::iter::Iterator;
7831 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7832 self
7833 }
7834
7835 /// Sets the value of [source_metadata][crate::model::Deployment::source_metadata].
7836 ///
7837 /// # Example
7838 /// ```ignore,no_run
7839 /// # use google_cloud_apihub_v1::model::Deployment;
7840 /// use google_cloud_apihub_v1::model::SourceMetadata;
7841 /// let x = Deployment::new()
7842 /// .set_source_metadata([
7843 /// SourceMetadata::default()/* use setters */,
7844 /// SourceMetadata::default()/* use (different) setters */,
7845 /// ]);
7846 /// ```
7847 pub fn set_source_metadata<T, V>(mut self, v: T) -> Self
7848 where
7849 T: std::iter::IntoIterator<Item = V>,
7850 V: std::convert::Into<crate::model::SourceMetadata>,
7851 {
7852 use std::iter::Iterator;
7853 self.source_metadata = v.into_iter().map(|i| i.into()).collect();
7854 self
7855 }
7856
7857 /// Sets the value of [management_url][crate::model::Deployment::management_url].
7858 ///
7859 /// # Example
7860 /// ```ignore,no_run
7861 /// # use google_cloud_apihub_v1::model::Deployment;
7862 /// use google_cloud_apihub_v1::model::AttributeValues;
7863 /// let x = Deployment::new().set_management_url(AttributeValues::default()/* use setters */);
7864 /// ```
7865 pub fn set_management_url<T>(mut self, v: T) -> Self
7866 where
7867 T: std::convert::Into<crate::model::AttributeValues>,
7868 {
7869 self.management_url = std::option::Option::Some(v.into());
7870 self
7871 }
7872
7873 /// Sets or clears the value of [management_url][crate::model::Deployment::management_url].
7874 ///
7875 /// # Example
7876 /// ```ignore,no_run
7877 /// # use google_cloud_apihub_v1::model::Deployment;
7878 /// use google_cloud_apihub_v1::model::AttributeValues;
7879 /// let x = Deployment::new().set_or_clear_management_url(Some(AttributeValues::default()/* use setters */));
7880 /// let x = Deployment::new().set_or_clear_management_url(None::<AttributeValues>);
7881 /// ```
7882 pub fn set_or_clear_management_url<T>(mut self, v: std::option::Option<T>) -> Self
7883 where
7884 T: std::convert::Into<crate::model::AttributeValues>,
7885 {
7886 self.management_url = v.map(|x| x.into());
7887 self
7888 }
7889
7890 /// Sets the value of [source_uri][crate::model::Deployment::source_uri].
7891 ///
7892 /// # Example
7893 /// ```ignore,no_run
7894 /// # use google_cloud_apihub_v1::model::Deployment;
7895 /// use google_cloud_apihub_v1::model::AttributeValues;
7896 /// let x = Deployment::new().set_source_uri(AttributeValues::default()/* use setters */);
7897 /// ```
7898 pub fn set_source_uri<T>(mut self, v: T) -> Self
7899 where
7900 T: std::convert::Into<crate::model::AttributeValues>,
7901 {
7902 self.source_uri = std::option::Option::Some(v.into());
7903 self
7904 }
7905
7906 /// Sets or clears the value of [source_uri][crate::model::Deployment::source_uri].
7907 ///
7908 /// # Example
7909 /// ```ignore,no_run
7910 /// # use google_cloud_apihub_v1::model::Deployment;
7911 /// use google_cloud_apihub_v1::model::AttributeValues;
7912 /// let x = Deployment::new().set_or_clear_source_uri(Some(AttributeValues::default()/* use setters */));
7913 /// let x = Deployment::new().set_or_clear_source_uri(None::<AttributeValues>);
7914 /// ```
7915 pub fn set_or_clear_source_uri<T>(mut self, v: std::option::Option<T>) -> Self
7916 where
7917 T: std::convert::Into<crate::model::AttributeValues>,
7918 {
7919 self.source_uri = v.map(|x| x.into());
7920 self
7921 }
7922
7923 /// Sets the value of [source_project][crate::model::Deployment::source_project].
7924 ///
7925 /// # Example
7926 /// ```ignore,no_run
7927 /// # use google_cloud_apihub_v1::model::Deployment;
7928 /// let x = Deployment::new().set_source_project("example");
7929 /// ```
7930 pub fn set_source_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7931 self.source_project = v.into();
7932 self
7933 }
7934
7935 /// Sets the value of [source_environment][crate::model::Deployment::source_environment].
7936 ///
7937 /// # Example
7938 /// ```ignore,no_run
7939 /// # use google_cloud_apihub_v1::model::Deployment;
7940 /// let x = Deployment::new().set_source_environment("example");
7941 /// ```
7942 pub fn set_source_environment<T: std::convert::Into<std::string::String>>(
7943 mut self,
7944 v: T,
7945 ) -> Self {
7946 self.source_environment = v.into();
7947 self
7948 }
7949}
7950
7951impl wkt::message::Message for Deployment {
7952 fn typename() -> &'static str {
7953 "type.googleapis.com/google.cloud.apihub.v1.Deployment"
7954 }
7955}
7956
7957/// Represents an operation contained in an API version in the API Hub.
7958/// An operation is added/updated/deleted in an API version when a new spec is
7959/// added or an existing spec is updated/deleted in a version.
7960/// Currently, an operation will be created only corresponding to OpenAPI spec as
7961/// parsing is supported for OpenAPI spec.
7962/// Alternatively operations can be managed via create,update and delete APIs,
7963/// creation of apiOperation can be possible only for version with no parsed
7964/// operations and update/delete can be possible only for operations created via
7965/// create API.
7966#[derive(Clone, Default, PartialEq)]
7967#[non_exhaustive]
7968pub struct ApiOperation {
7969 /// Identifier. The name of the operation.
7970 ///
7971 /// Format:
7972 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
7973 pub name: std::string::String,
7974
7975 /// Output only. The name of the spec will be of the format:
7976 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
7977 /// Note:The name of the spec will be empty if the operation is created via
7978 /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation] API.
7979 ///
7980 /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
7981 pub spec: std::string::String,
7982
7983 /// Optional. Operation details.
7984 /// Note: Even though this field is optional, it is required for
7985 /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation]
7986 /// API and we will fail the request if not provided.
7987 ///
7988 /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
7989 pub details: std::option::Option<crate::model::OperationDetails>,
7990
7991 /// Output only. The time at which the operation was created.
7992 pub create_time: std::option::Option<wkt::Timestamp>,
7993
7994 /// Output only. The time at which the operation was last updated.
7995 pub update_time: std::option::Option<wkt::Timestamp>,
7996
7997 /// Optional. The list of user defined attributes associated with the API
7998 /// operation resource. The key is the attribute name. It will be of the
7999 /// format: `projects/{project}/locations/{location}/attributes/{attribute}`.
8000 /// The value is the attribute values associated with the resource.
8001 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
8002
8003 /// Output only. The list of sources and metadata from the sources of the API
8004 /// operation.
8005 pub source_metadata: std::vec::Vec<crate::model::SourceMetadata>,
8006
8007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8008}
8009
8010impl ApiOperation {
8011 pub fn new() -> Self {
8012 std::default::Default::default()
8013 }
8014
8015 /// Sets the value of [name][crate::model::ApiOperation::name].
8016 ///
8017 /// # Example
8018 /// ```ignore,no_run
8019 /// # use google_cloud_apihub_v1::model::ApiOperation;
8020 /// let x = ApiOperation::new().set_name("example");
8021 /// ```
8022 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8023 self.name = v.into();
8024 self
8025 }
8026
8027 /// Sets the value of [spec][crate::model::ApiOperation::spec].
8028 ///
8029 /// # Example
8030 /// ```ignore,no_run
8031 /// # use google_cloud_apihub_v1::model::ApiOperation;
8032 /// let x = ApiOperation::new().set_spec("example");
8033 /// ```
8034 pub fn set_spec<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8035 self.spec = v.into();
8036 self
8037 }
8038
8039 /// Sets the value of [details][crate::model::ApiOperation::details].
8040 ///
8041 /// # Example
8042 /// ```ignore,no_run
8043 /// # use google_cloud_apihub_v1::model::ApiOperation;
8044 /// use google_cloud_apihub_v1::model::OperationDetails;
8045 /// let x = ApiOperation::new().set_details(OperationDetails::default()/* use setters */);
8046 /// ```
8047 pub fn set_details<T>(mut self, v: T) -> Self
8048 where
8049 T: std::convert::Into<crate::model::OperationDetails>,
8050 {
8051 self.details = std::option::Option::Some(v.into());
8052 self
8053 }
8054
8055 /// Sets or clears the value of [details][crate::model::ApiOperation::details].
8056 ///
8057 /// # Example
8058 /// ```ignore,no_run
8059 /// # use google_cloud_apihub_v1::model::ApiOperation;
8060 /// use google_cloud_apihub_v1::model::OperationDetails;
8061 /// let x = ApiOperation::new().set_or_clear_details(Some(OperationDetails::default()/* use setters */));
8062 /// let x = ApiOperation::new().set_or_clear_details(None::<OperationDetails>);
8063 /// ```
8064 pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
8065 where
8066 T: std::convert::Into<crate::model::OperationDetails>,
8067 {
8068 self.details = v.map(|x| x.into());
8069 self
8070 }
8071
8072 /// Sets the value of [create_time][crate::model::ApiOperation::create_time].
8073 ///
8074 /// # Example
8075 /// ```ignore,no_run
8076 /// # use google_cloud_apihub_v1::model::ApiOperation;
8077 /// use wkt::Timestamp;
8078 /// let x = ApiOperation::new().set_create_time(Timestamp::default()/* use setters */);
8079 /// ```
8080 pub fn set_create_time<T>(mut self, v: T) -> Self
8081 where
8082 T: std::convert::Into<wkt::Timestamp>,
8083 {
8084 self.create_time = std::option::Option::Some(v.into());
8085 self
8086 }
8087
8088 /// Sets or clears the value of [create_time][crate::model::ApiOperation::create_time].
8089 ///
8090 /// # Example
8091 /// ```ignore,no_run
8092 /// # use google_cloud_apihub_v1::model::ApiOperation;
8093 /// use wkt::Timestamp;
8094 /// let x = ApiOperation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8095 /// let x = ApiOperation::new().set_or_clear_create_time(None::<Timestamp>);
8096 /// ```
8097 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8098 where
8099 T: std::convert::Into<wkt::Timestamp>,
8100 {
8101 self.create_time = v.map(|x| x.into());
8102 self
8103 }
8104
8105 /// Sets the value of [update_time][crate::model::ApiOperation::update_time].
8106 ///
8107 /// # Example
8108 /// ```ignore,no_run
8109 /// # use google_cloud_apihub_v1::model::ApiOperation;
8110 /// use wkt::Timestamp;
8111 /// let x = ApiOperation::new().set_update_time(Timestamp::default()/* use setters */);
8112 /// ```
8113 pub fn set_update_time<T>(mut self, v: T) -> Self
8114 where
8115 T: std::convert::Into<wkt::Timestamp>,
8116 {
8117 self.update_time = std::option::Option::Some(v.into());
8118 self
8119 }
8120
8121 /// Sets or clears the value of [update_time][crate::model::ApiOperation::update_time].
8122 ///
8123 /// # Example
8124 /// ```ignore,no_run
8125 /// # use google_cloud_apihub_v1::model::ApiOperation;
8126 /// use wkt::Timestamp;
8127 /// let x = ApiOperation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8128 /// let x = ApiOperation::new().set_or_clear_update_time(None::<Timestamp>);
8129 /// ```
8130 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8131 where
8132 T: std::convert::Into<wkt::Timestamp>,
8133 {
8134 self.update_time = v.map(|x| x.into());
8135 self
8136 }
8137
8138 /// Sets the value of [attributes][crate::model::ApiOperation::attributes].
8139 ///
8140 /// # Example
8141 /// ```ignore,no_run
8142 /// # use google_cloud_apihub_v1::model::ApiOperation;
8143 /// use google_cloud_apihub_v1::model::AttributeValues;
8144 /// let x = ApiOperation::new().set_attributes([
8145 /// ("key0", AttributeValues::default()/* use setters */),
8146 /// ("key1", AttributeValues::default()/* use (different) setters */),
8147 /// ]);
8148 /// ```
8149 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
8150 where
8151 T: std::iter::IntoIterator<Item = (K, V)>,
8152 K: std::convert::Into<std::string::String>,
8153 V: std::convert::Into<crate::model::AttributeValues>,
8154 {
8155 use std::iter::Iterator;
8156 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8157 self
8158 }
8159
8160 /// Sets the value of [source_metadata][crate::model::ApiOperation::source_metadata].
8161 ///
8162 /// # Example
8163 /// ```ignore,no_run
8164 /// # use google_cloud_apihub_v1::model::ApiOperation;
8165 /// use google_cloud_apihub_v1::model::SourceMetadata;
8166 /// let x = ApiOperation::new()
8167 /// .set_source_metadata([
8168 /// SourceMetadata::default()/* use setters */,
8169 /// SourceMetadata::default()/* use (different) setters */,
8170 /// ]);
8171 /// ```
8172 pub fn set_source_metadata<T, V>(mut self, v: T) -> Self
8173 where
8174 T: std::iter::IntoIterator<Item = V>,
8175 V: std::convert::Into<crate::model::SourceMetadata>,
8176 {
8177 use std::iter::Iterator;
8178 self.source_metadata = v.into_iter().map(|i| i.into()).collect();
8179 self
8180 }
8181}
8182
8183impl wkt::message::Message for ApiOperation {
8184 fn typename() -> &'static str {
8185 "type.googleapis.com/google.cloud.apihub.v1.ApiOperation"
8186 }
8187}
8188
8189/// Represents a definition for example schema, request, response definitions
8190/// contained in an API version.
8191/// A definition is added/updated/deleted in an API version when a new spec is
8192/// added or an existing spec is updated/deleted in a version. Currently,
8193/// definition will be created only corresponding to OpenAPI spec as parsing is
8194/// supported for OpenAPI spec. Also, within OpenAPI spec, only `schema` object
8195/// is supported.
8196#[derive(Clone, Default, PartialEq)]
8197#[non_exhaustive]
8198pub struct Definition {
8199 /// Identifier. The name of the definition.
8200 ///
8201 /// Format:
8202 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}`
8203 pub name: std::string::String,
8204
8205 /// Output only. The name of the spec from where the definition was parsed.
8206 /// Format is
8207 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
8208 pub spec: std::string::String,
8209
8210 /// Output only. The type of the definition.
8211 pub r#type: crate::model::definition::Type,
8212
8213 /// Output only. The time at which the definition was created.
8214 pub create_time: std::option::Option<wkt::Timestamp>,
8215
8216 /// Output only. The time at which the definition was last updated.
8217 pub update_time: std::option::Option<wkt::Timestamp>,
8218
8219 /// Optional. The list of user defined attributes associated with the
8220 /// definition resource. The key is the attribute name. It will be of the
8221 /// format: `projects/{project}/locations/{location}/attributes/{attribute}`.
8222 /// The value is the attribute values associated with the resource.
8223 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
8224
8225 pub value: std::option::Option<crate::model::definition::Value>,
8226
8227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8228}
8229
8230impl Definition {
8231 pub fn new() -> Self {
8232 std::default::Default::default()
8233 }
8234
8235 /// Sets the value of [name][crate::model::Definition::name].
8236 ///
8237 /// # Example
8238 /// ```ignore,no_run
8239 /// # use google_cloud_apihub_v1::model::Definition;
8240 /// let x = Definition::new().set_name("example");
8241 /// ```
8242 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8243 self.name = v.into();
8244 self
8245 }
8246
8247 /// Sets the value of [spec][crate::model::Definition::spec].
8248 ///
8249 /// # Example
8250 /// ```ignore,no_run
8251 /// # use google_cloud_apihub_v1::model::Definition;
8252 /// let x = Definition::new().set_spec("example");
8253 /// ```
8254 pub fn set_spec<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8255 self.spec = v.into();
8256 self
8257 }
8258
8259 /// Sets the value of [r#type][crate::model::Definition::type].
8260 ///
8261 /// # Example
8262 /// ```ignore,no_run
8263 /// # use google_cloud_apihub_v1::model::Definition;
8264 /// use google_cloud_apihub_v1::model::definition::Type;
8265 /// let x0 = Definition::new().set_type(Type::Schema);
8266 /// ```
8267 pub fn set_type<T: std::convert::Into<crate::model::definition::Type>>(mut self, v: T) -> Self {
8268 self.r#type = v.into();
8269 self
8270 }
8271
8272 /// Sets the value of [create_time][crate::model::Definition::create_time].
8273 ///
8274 /// # Example
8275 /// ```ignore,no_run
8276 /// # use google_cloud_apihub_v1::model::Definition;
8277 /// use wkt::Timestamp;
8278 /// let x = Definition::new().set_create_time(Timestamp::default()/* use setters */);
8279 /// ```
8280 pub fn set_create_time<T>(mut self, v: T) -> Self
8281 where
8282 T: std::convert::Into<wkt::Timestamp>,
8283 {
8284 self.create_time = std::option::Option::Some(v.into());
8285 self
8286 }
8287
8288 /// Sets or clears the value of [create_time][crate::model::Definition::create_time].
8289 ///
8290 /// # Example
8291 /// ```ignore,no_run
8292 /// # use google_cloud_apihub_v1::model::Definition;
8293 /// use wkt::Timestamp;
8294 /// let x = Definition::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8295 /// let x = Definition::new().set_or_clear_create_time(None::<Timestamp>);
8296 /// ```
8297 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8298 where
8299 T: std::convert::Into<wkt::Timestamp>,
8300 {
8301 self.create_time = v.map(|x| x.into());
8302 self
8303 }
8304
8305 /// Sets the value of [update_time][crate::model::Definition::update_time].
8306 ///
8307 /// # Example
8308 /// ```ignore,no_run
8309 /// # use google_cloud_apihub_v1::model::Definition;
8310 /// use wkt::Timestamp;
8311 /// let x = Definition::new().set_update_time(Timestamp::default()/* use setters */);
8312 /// ```
8313 pub fn set_update_time<T>(mut self, v: T) -> Self
8314 where
8315 T: std::convert::Into<wkt::Timestamp>,
8316 {
8317 self.update_time = std::option::Option::Some(v.into());
8318 self
8319 }
8320
8321 /// Sets or clears the value of [update_time][crate::model::Definition::update_time].
8322 ///
8323 /// # Example
8324 /// ```ignore,no_run
8325 /// # use google_cloud_apihub_v1::model::Definition;
8326 /// use wkt::Timestamp;
8327 /// let x = Definition::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8328 /// let x = Definition::new().set_or_clear_update_time(None::<Timestamp>);
8329 /// ```
8330 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8331 where
8332 T: std::convert::Into<wkt::Timestamp>,
8333 {
8334 self.update_time = v.map(|x| x.into());
8335 self
8336 }
8337
8338 /// Sets the value of [attributes][crate::model::Definition::attributes].
8339 ///
8340 /// # Example
8341 /// ```ignore,no_run
8342 /// # use google_cloud_apihub_v1::model::Definition;
8343 /// use google_cloud_apihub_v1::model::AttributeValues;
8344 /// let x = Definition::new().set_attributes([
8345 /// ("key0", AttributeValues::default()/* use setters */),
8346 /// ("key1", AttributeValues::default()/* use (different) setters */),
8347 /// ]);
8348 /// ```
8349 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
8350 where
8351 T: std::iter::IntoIterator<Item = (K, V)>,
8352 K: std::convert::Into<std::string::String>,
8353 V: std::convert::Into<crate::model::AttributeValues>,
8354 {
8355 use std::iter::Iterator;
8356 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8357 self
8358 }
8359
8360 /// Sets the value of [value][crate::model::Definition::value].
8361 ///
8362 /// Note that all the setters affecting `value` are mutually
8363 /// exclusive.
8364 ///
8365 /// # Example
8366 /// ```ignore,no_run
8367 /// # use google_cloud_apihub_v1::model::Definition;
8368 /// use google_cloud_apihub_v1::model::Schema;
8369 /// let x = Definition::new().set_value(Some(
8370 /// google_cloud_apihub_v1::model::definition::Value::Schema(Schema::default().into())));
8371 /// ```
8372 pub fn set_value<
8373 T: std::convert::Into<std::option::Option<crate::model::definition::Value>>,
8374 >(
8375 mut self,
8376 v: T,
8377 ) -> Self {
8378 self.value = v.into();
8379 self
8380 }
8381
8382 /// The value of [value][crate::model::Definition::value]
8383 /// if it holds a `Schema`, `None` if the field is not set or
8384 /// holds a different branch.
8385 pub fn schema(&self) -> std::option::Option<&std::boxed::Box<crate::model::Schema>> {
8386 #[allow(unreachable_patterns)]
8387 self.value.as_ref().and_then(|v| match v {
8388 crate::model::definition::Value::Schema(v) => std::option::Option::Some(v),
8389 _ => std::option::Option::None,
8390 })
8391 }
8392
8393 /// Sets the value of [value][crate::model::Definition::value]
8394 /// to hold a `Schema`.
8395 ///
8396 /// Note that all the setters affecting `value` are
8397 /// mutually exclusive.
8398 ///
8399 /// # Example
8400 /// ```ignore,no_run
8401 /// # use google_cloud_apihub_v1::model::Definition;
8402 /// use google_cloud_apihub_v1::model::Schema;
8403 /// let x = Definition::new().set_schema(Schema::default()/* use setters */);
8404 /// assert!(x.schema().is_some());
8405 /// ```
8406 pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
8407 mut self,
8408 v: T,
8409 ) -> Self {
8410 self.value = std::option::Option::Some(crate::model::definition::Value::Schema(v.into()));
8411 self
8412 }
8413}
8414
8415impl wkt::message::Message for Definition {
8416 fn typename() -> &'static str {
8417 "type.googleapis.com/google.cloud.apihub.v1.Definition"
8418 }
8419}
8420
8421/// Defines additional types related to [Definition].
8422pub mod definition {
8423 #[allow(unused_imports)]
8424 use super::*;
8425
8426 /// Enumeration of definition types.
8427 ///
8428 /// # Working with unknown values
8429 ///
8430 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8431 /// additional enum variants at any time. Adding new variants is not considered
8432 /// a breaking change. Applications should write their code in anticipation of:
8433 ///
8434 /// - New values appearing in future releases of the client library, **and**
8435 /// - New values received dynamically, without application changes.
8436 ///
8437 /// Please consult the [Working with enums] section in the user guide for some
8438 /// guidelines.
8439 ///
8440 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8441 #[derive(Clone, Debug, PartialEq)]
8442 #[non_exhaustive]
8443 pub enum Type {
8444 /// Definition type unspecified.
8445 Unspecified,
8446 /// Definition type schema.
8447 Schema,
8448 /// If set, the enum was initialized with an unknown value.
8449 ///
8450 /// Applications can examine the value using [Type::value] or
8451 /// [Type::name].
8452 UnknownValue(r#type::UnknownValue),
8453 }
8454
8455 #[doc(hidden)]
8456 pub mod r#type {
8457 #[allow(unused_imports)]
8458 use super::*;
8459 #[derive(Clone, Debug, PartialEq)]
8460 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8461 }
8462
8463 impl Type {
8464 /// Gets the enum value.
8465 ///
8466 /// Returns `None` if the enum contains an unknown value deserialized from
8467 /// the string representation of enums.
8468 pub fn value(&self) -> std::option::Option<i32> {
8469 match self {
8470 Self::Unspecified => std::option::Option::Some(0),
8471 Self::Schema => std::option::Option::Some(1),
8472 Self::UnknownValue(u) => u.0.value(),
8473 }
8474 }
8475
8476 /// Gets the enum value as a string.
8477 ///
8478 /// Returns `None` if the enum contains an unknown value deserialized from
8479 /// the integer representation of enums.
8480 pub fn name(&self) -> std::option::Option<&str> {
8481 match self {
8482 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8483 Self::Schema => std::option::Option::Some("SCHEMA"),
8484 Self::UnknownValue(u) => u.0.name(),
8485 }
8486 }
8487 }
8488
8489 impl std::default::Default for Type {
8490 fn default() -> Self {
8491 use std::convert::From;
8492 Self::from(0)
8493 }
8494 }
8495
8496 impl std::fmt::Display for Type {
8497 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8498 wkt::internal::display_enum(f, self.name(), self.value())
8499 }
8500 }
8501
8502 impl std::convert::From<i32> for Type {
8503 fn from(value: i32) -> Self {
8504 match value {
8505 0 => Self::Unspecified,
8506 1 => Self::Schema,
8507 _ => Self::UnknownValue(r#type::UnknownValue(
8508 wkt::internal::UnknownEnumValue::Integer(value),
8509 )),
8510 }
8511 }
8512 }
8513
8514 impl std::convert::From<&str> for Type {
8515 fn from(value: &str) -> Self {
8516 use std::string::ToString;
8517 match value {
8518 "TYPE_UNSPECIFIED" => Self::Unspecified,
8519 "SCHEMA" => Self::Schema,
8520 _ => Self::UnknownValue(r#type::UnknownValue(
8521 wkt::internal::UnknownEnumValue::String(value.to_string()),
8522 )),
8523 }
8524 }
8525 }
8526
8527 impl serde::ser::Serialize for Type {
8528 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8529 where
8530 S: serde::Serializer,
8531 {
8532 match self {
8533 Self::Unspecified => serializer.serialize_i32(0),
8534 Self::Schema => serializer.serialize_i32(1),
8535 Self::UnknownValue(u) => u.0.serialize(serializer),
8536 }
8537 }
8538 }
8539
8540 impl<'de> serde::de::Deserialize<'de> for Type {
8541 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8542 where
8543 D: serde::Deserializer<'de>,
8544 {
8545 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8546 ".google.cloud.apihub.v1.Definition.Type",
8547 ))
8548 }
8549 }
8550
8551 #[derive(Clone, Debug, PartialEq)]
8552 #[non_exhaustive]
8553 pub enum Value {
8554 /// Output only. The value of a schema definition.
8555 Schema(std::boxed::Box<crate::model::Schema>),
8556 }
8557}
8558
8559/// An attribute in the API Hub.
8560/// An attribute is a name value pair which can be attached to different
8561/// resources in the API hub based on the scope of the attribute. Attributes can
8562/// either be pre-defined by the API Hub or created by users.
8563#[derive(Clone, Default, PartialEq)]
8564#[non_exhaustive]
8565pub struct Attribute {
8566 /// Identifier. The name of the attribute in the API Hub.
8567 ///
8568 /// Format:
8569 /// `projects/{project}/locations/{location}/attributes/{attribute}`
8570 pub name: std::string::String,
8571
8572 /// Required. The display name of the attribute.
8573 pub display_name: std::string::String,
8574
8575 /// Optional. The description of the attribute.
8576 pub description: std::string::String,
8577
8578 /// Output only. The definition type of the attribute.
8579 pub definition_type: crate::model::attribute::DefinitionType,
8580
8581 /// Required. The scope of the attribute. It represents the resource in the API
8582 /// Hub to which the attribute can be linked.
8583 pub scope: crate::model::attribute::Scope,
8584
8585 /// Required. The type of the data of the attribute.
8586 pub data_type: crate::model::attribute::DataType,
8587
8588 /// Optional. The list of allowed values when the attribute value is of type
8589 /// enum. This is required when the data_type of the attribute is ENUM. The
8590 /// maximum number of allowed values of an attribute will be 1000.
8591 pub allowed_values: std::vec::Vec<crate::model::attribute::AllowedValue>,
8592
8593 /// Optional. The maximum number of values that the attribute can have when
8594 /// associated with an API Hub resource. Cardinality 1 would represent a
8595 /// single-valued attribute. It must not be less than 1 or greater than 20. If
8596 /// not specified, the cardinality would be set to 1 by default and represent a
8597 /// single-valued attribute.
8598 pub cardinality: i32,
8599
8600 /// Output only. When mandatory is true, the attribute is mandatory for the
8601 /// resource specified in the scope. Only System defined attributes can be
8602 /// mandatory.
8603 pub mandatory: bool,
8604
8605 /// Output only. The time at which the attribute was created.
8606 pub create_time: std::option::Option<wkt::Timestamp>,
8607
8608 /// Output only. The time at which the attribute was last updated.
8609 pub update_time: std::option::Option<wkt::Timestamp>,
8610
8611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8612}
8613
8614impl Attribute {
8615 pub fn new() -> Self {
8616 std::default::Default::default()
8617 }
8618
8619 /// Sets the value of [name][crate::model::Attribute::name].
8620 ///
8621 /// # Example
8622 /// ```ignore,no_run
8623 /// # use google_cloud_apihub_v1::model::Attribute;
8624 /// let x = Attribute::new().set_name("example");
8625 /// ```
8626 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8627 self.name = v.into();
8628 self
8629 }
8630
8631 /// Sets the value of [display_name][crate::model::Attribute::display_name].
8632 ///
8633 /// # Example
8634 /// ```ignore,no_run
8635 /// # use google_cloud_apihub_v1::model::Attribute;
8636 /// let x = Attribute::new().set_display_name("example");
8637 /// ```
8638 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8639 self.display_name = v.into();
8640 self
8641 }
8642
8643 /// Sets the value of [description][crate::model::Attribute::description].
8644 ///
8645 /// # Example
8646 /// ```ignore,no_run
8647 /// # use google_cloud_apihub_v1::model::Attribute;
8648 /// let x = Attribute::new().set_description("example");
8649 /// ```
8650 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8651 self.description = v.into();
8652 self
8653 }
8654
8655 /// Sets the value of [definition_type][crate::model::Attribute::definition_type].
8656 ///
8657 /// # Example
8658 /// ```ignore,no_run
8659 /// # use google_cloud_apihub_v1::model::Attribute;
8660 /// use google_cloud_apihub_v1::model::attribute::DefinitionType;
8661 /// let x0 = Attribute::new().set_definition_type(DefinitionType::SystemDefined);
8662 /// let x1 = Attribute::new().set_definition_type(DefinitionType::UserDefined);
8663 /// ```
8664 pub fn set_definition_type<T: std::convert::Into<crate::model::attribute::DefinitionType>>(
8665 mut self,
8666 v: T,
8667 ) -> Self {
8668 self.definition_type = v.into();
8669 self
8670 }
8671
8672 /// Sets the value of [scope][crate::model::Attribute::scope].
8673 ///
8674 /// # Example
8675 /// ```ignore,no_run
8676 /// # use google_cloud_apihub_v1::model::Attribute;
8677 /// use google_cloud_apihub_v1::model::attribute::Scope;
8678 /// let x0 = Attribute::new().set_scope(Scope::Api);
8679 /// let x1 = Attribute::new().set_scope(Scope::Version);
8680 /// let x2 = Attribute::new().set_scope(Scope::Spec);
8681 /// ```
8682 pub fn set_scope<T: std::convert::Into<crate::model::attribute::Scope>>(
8683 mut self,
8684 v: T,
8685 ) -> Self {
8686 self.scope = v.into();
8687 self
8688 }
8689
8690 /// Sets the value of [data_type][crate::model::Attribute::data_type].
8691 ///
8692 /// # Example
8693 /// ```ignore,no_run
8694 /// # use google_cloud_apihub_v1::model::Attribute;
8695 /// use google_cloud_apihub_v1::model::attribute::DataType;
8696 /// let x0 = Attribute::new().set_data_type(DataType::Enum);
8697 /// let x1 = Attribute::new().set_data_type(DataType::Json);
8698 /// let x2 = Attribute::new().set_data_type(DataType::String);
8699 /// ```
8700 pub fn set_data_type<T: std::convert::Into<crate::model::attribute::DataType>>(
8701 mut self,
8702 v: T,
8703 ) -> Self {
8704 self.data_type = v.into();
8705 self
8706 }
8707
8708 /// Sets the value of [allowed_values][crate::model::Attribute::allowed_values].
8709 ///
8710 /// # Example
8711 /// ```ignore,no_run
8712 /// # use google_cloud_apihub_v1::model::Attribute;
8713 /// use google_cloud_apihub_v1::model::attribute::AllowedValue;
8714 /// let x = Attribute::new()
8715 /// .set_allowed_values([
8716 /// AllowedValue::default()/* use setters */,
8717 /// AllowedValue::default()/* use (different) setters */,
8718 /// ]);
8719 /// ```
8720 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
8721 where
8722 T: std::iter::IntoIterator<Item = V>,
8723 V: std::convert::Into<crate::model::attribute::AllowedValue>,
8724 {
8725 use std::iter::Iterator;
8726 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
8727 self
8728 }
8729
8730 /// Sets the value of [cardinality][crate::model::Attribute::cardinality].
8731 ///
8732 /// # Example
8733 /// ```ignore,no_run
8734 /// # use google_cloud_apihub_v1::model::Attribute;
8735 /// let x = Attribute::new().set_cardinality(42);
8736 /// ```
8737 pub fn set_cardinality<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8738 self.cardinality = v.into();
8739 self
8740 }
8741
8742 /// Sets the value of [mandatory][crate::model::Attribute::mandatory].
8743 ///
8744 /// # Example
8745 /// ```ignore,no_run
8746 /// # use google_cloud_apihub_v1::model::Attribute;
8747 /// let x = Attribute::new().set_mandatory(true);
8748 /// ```
8749 pub fn set_mandatory<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8750 self.mandatory = v.into();
8751 self
8752 }
8753
8754 /// Sets the value of [create_time][crate::model::Attribute::create_time].
8755 ///
8756 /// # Example
8757 /// ```ignore,no_run
8758 /// # use google_cloud_apihub_v1::model::Attribute;
8759 /// use wkt::Timestamp;
8760 /// let x = Attribute::new().set_create_time(Timestamp::default()/* use setters */);
8761 /// ```
8762 pub fn set_create_time<T>(mut self, v: T) -> Self
8763 where
8764 T: std::convert::Into<wkt::Timestamp>,
8765 {
8766 self.create_time = std::option::Option::Some(v.into());
8767 self
8768 }
8769
8770 /// Sets or clears the value of [create_time][crate::model::Attribute::create_time].
8771 ///
8772 /// # Example
8773 /// ```ignore,no_run
8774 /// # use google_cloud_apihub_v1::model::Attribute;
8775 /// use wkt::Timestamp;
8776 /// let x = Attribute::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8777 /// let x = Attribute::new().set_or_clear_create_time(None::<Timestamp>);
8778 /// ```
8779 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8780 where
8781 T: std::convert::Into<wkt::Timestamp>,
8782 {
8783 self.create_time = v.map(|x| x.into());
8784 self
8785 }
8786
8787 /// Sets the value of [update_time][crate::model::Attribute::update_time].
8788 ///
8789 /// # Example
8790 /// ```ignore,no_run
8791 /// # use google_cloud_apihub_v1::model::Attribute;
8792 /// use wkt::Timestamp;
8793 /// let x = Attribute::new().set_update_time(Timestamp::default()/* use setters */);
8794 /// ```
8795 pub fn set_update_time<T>(mut self, v: T) -> Self
8796 where
8797 T: std::convert::Into<wkt::Timestamp>,
8798 {
8799 self.update_time = std::option::Option::Some(v.into());
8800 self
8801 }
8802
8803 /// Sets or clears the value of [update_time][crate::model::Attribute::update_time].
8804 ///
8805 /// # Example
8806 /// ```ignore,no_run
8807 /// # use google_cloud_apihub_v1::model::Attribute;
8808 /// use wkt::Timestamp;
8809 /// let x = Attribute::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8810 /// let x = Attribute::new().set_or_clear_update_time(None::<Timestamp>);
8811 /// ```
8812 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8813 where
8814 T: std::convert::Into<wkt::Timestamp>,
8815 {
8816 self.update_time = v.map(|x| x.into());
8817 self
8818 }
8819}
8820
8821impl wkt::message::Message for Attribute {
8822 fn typename() -> &'static str {
8823 "type.googleapis.com/google.cloud.apihub.v1.Attribute"
8824 }
8825}
8826
8827/// Defines additional types related to [Attribute].
8828pub mod attribute {
8829 #[allow(unused_imports)]
8830 use super::*;
8831
8832 /// The value that can be assigned to the attribute when the data type is
8833 /// enum.
8834 #[derive(Clone, Default, PartialEq)]
8835 #[non_exhaustive]
8836 pub struct AllowedValue {
8837 /// Required. The ID of the allowed value.
8838 ///
8839 /// * If provided, the same will be used. The service will throw an error if
8840 /// the specified id is already used by another allowed value in the same
8841 /// attribute resource.
8842 /// * If not provided, a system generated id derived from the display name
8843 /// will be used. In this case, the service will handle conflict resolution
8844 /// by adding a system generated suffix in case of duplicates.
8845 ///
8846 /// This value should be 4-63 characters, and valid characters
8847 /// are /[a-z][0-9]-/.
8848 pub id: std::string::String,
8849
8850 /// Required. The display name of the allowed value.
8851 pub display_name: std::string::String,
8852
8853 /// Optional. The detailed description of the allowed value.
8854 pub description: std::string::String,
8855
8856 /// Optional. When set to true, the allowed value cannot be updated or
8857 /// deleted by the user. It can only be true for System defined attributes.
8858 pub immutable: bool,
8859
8860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8861 }
8862
8863 impl AllowedValue {
8864 pub fn new() -> Self {
8865 std::default::Default::default()
8866 }
8867
8868 /// Sets the value of [id][crate::model::attribute::AllowedValue::id].
8869 ///
8870 /// # Example
8871 /// ```ignore,no_run
8872 /// # use google_cloud_apihub_v1::model::attribute::AllowedValue;
8873 /// let x = AllowedValue::new().set_id("example");
8874 /// ```
8875 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8876 self.id = v.into();
8877 self
8878 }
8879
8880 /// Sets the value of [display_name][crate::model::attribute::AllowedValue::display_name].
8881 ///
8882 /// # Example
8883 /// ```ignore,no_run
8884 /// # use google_cloud_apihub_v1::model::attribute::AllowedValue;
8885 /// let x = AllowedValue::new().set_display_name("example");
8886 /// ```
8887 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
8888 mut self,
8889 v: T,
8890 ) -> Self {
8891 self.display_name = v.into();
8892 self
8893 }
8894
8895 /// Sets the value of [description][crate::model::attribute::AllowedValue::description].
8896 ///
8897 /// # Example
8898 /// ```ignore,no_run
8899 /// # use google_cloud_apihub_v1::model::attribute::AllowedValue;
8900 /// let x = AllowedValue::new().set_description("example");
8901 /// ```
8902 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8903 self.description = v.into();
8904 self
8905 }
8906
8907 /// Sets the value of [immutable][crate::model::attribute::AllowedValue::immutable].
8908 ///
8909 /// # Example
8910 /// ```ignore,no_run
8911 /// # use google_cloud_apihub_v1::model::attribute::AllowedValue;
8912 /// let x = AllowedValue::new().set_immutable(true);
8913 /// ```
8914 pub fn set_immutable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8915 self.immutable = v.into();
8916 self
8917 }
8918 }
8919
8920 impl wkt::message::Message for AllowedValue {
8921 fn typename() -> &'static str {
8922 "type.googleapis.com/google.cloud.apihub.v1.Attribute.AllowedValue"
8923 }
8924 }
8925
8926 /// Enumeration of attribute definition types.
8927 ///
8928 /// # Working with unknown values
8929 ///
8930 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8931 /// additional enum variants at any time. Adding new variants is not considered
8932 /// a breaking change. Applications should write their code in anticipation of:
8933 ///
8934 /// - New values appearing in future releases of the client library, **and**
8935 /// - New values received dynamically, without application changes.
8936 ///
8937 /// Please consult the [Working with enums] section in the user guide for some
8938 /// guidelines.
8939 ///
8940 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8941 #[derive(Clone, Debug, PartialEq)]
8942 #[non_exhaustive]
8943 pub enum DefinitionType {
8944 /// Attribute definition type unspecified.
8945 Unspecified,
8946 /// The attribute is predefined by the API Hub. Note that only the list of
8947 /// allowed values can be updated in this case via UpdateAttribute method.
8948 SystemDefined,
8949 /// The attribute is defined by the user.
8950 UserDefined,
8951 /// If set, the enum was initialized with an unknown value.
8952 ///
8953 /// Applications can examine the value using [DefinitionType::value] or
8954 /// [DefinitionType::name].
8955 UnknownValue(definition_type::UnknownValue),
8956 }
8957
8958 #[doc(hidden)]
8959 pub mod definition_type {
8960 #[allow(unused_imports)]
8961 use super::*;
8962 #[derive(Clone, Debug, PartialEq)]
8963 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8964 }
8965
8966 impl DefinitionType {
8967 /// Gets the enum value.
8968 ///
8969 /// Returns `None` if the enum contains an unknown value deserialized from
8970 /// the string representation of enums.
8971 pub fn value(&self) -> std::option::Option<i32> {
8972 match self {
8973 Self::Unspecified => std::option::Option::Some(0),
8974 Self::SystemDefined => std::option::Option::Some(1),
8975 Self::UserDefined => std::option::Option::Some(2),
8976 Self::UnknownValue(u) => u.0.value(),
8977 }
8978 }
8979
8980 /// Gets the enum value as a string.
8981 ///
8982 /// Returns `None` if the enum contains an unknown value deserialized from
8983 /// the integer representation of enums.
8984 pub fn name(&self) -> std::option::Option<&str> {
8985 match self {
8986 Self::Unspecified => std::option::Option::Some("DEFINITION_TYPE_UNSPECIFIED"),
8987 Self::SystemDefined => std::option::Option::Some("SYSTEM_DEFINED"),
8988 Self::UserDefined => std::option::Option::Some("USER_DEFINED"),
8989 Self::UnknownValue(u) => u.0.name(),
8990 }
8991 }
8992 }
8993
8994 impl std::default::Default for DefinitionType {
8995 fn default() -> Self {
8996 use std::convert::From;
8997 Self::from(0)
8998 }
8999 }
9000
9001 impl std::fmt::Display for DefinitionType {
9002 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9003 wkt::internal::display_enum(f, self.name(), self.value())
9004 }
9005 }
9006
9007 impl std::convert::From<i32> for DefinitionType {
9008 fn from(value: i32) -> Self {
9009 match value {
9010 0 => Self::Unspecified,
9011 1 => Self::SystemDefined,
9012 2 => Self::UserDefined,
9013 _ => Self::UnknownValue(definition_type::UnknownValue(
9014 wkt::internal::UnknownEnumValue::Integer(value),
9015 )),
9016 }
9017 }
9018 }
9019
9020 impl std::convert::From<&str> for DefinitionType {
9021 fn from(value: &str) -> Self {
9022 use std::string::ToString;
9023 match value {
9024 "DEFINITION_TYPE_UNSPECIFIED" => Self::Unspecified,
9025 "SYSTEM_DEFINED" => Self::SystemDefined,
9026 "USER_DEFINED" => Self::UserDefined,
9027 _ => Self::UnknownValue(definition_type::UnknownValue(
9028 wkt::internal::UnknownEnumValue::String(value.to_string()),
9029 )),
9030 }
9031 }
9032 }
9033
9034 impl serde::ser::Serialize for DefinitionType {
9035 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9036 where
9037 S: serde::Serializer,
9038 {
9039 match self {
9040 Self::Unspecified => serializer.serialize_i32(0),
9041 Self::SystemDefined => serializer.serialize_i32(1),
9042 Self::UserDefined => serializer.serialize_i32(2),
9043 Self::UnknownValue(u) => u.0.serialize(serializer),
9044 }
9045 }
9046 }
9047
9048 impl<'de> serde::de::Deserialize<'de> for DefinitionType {
9049 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9050 where
9051 D: serde::Deserializer<'de>,
9052 {
9053 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DefinitionType>::new(
9054 ".google.cloud.apihub.v1.Attribute.DefinitionType",
9055 ))
9056 }
9057 }
9058
9059 /// Enumeration for the scope of the attribute representing the resource in the
9060 /// API Hub to which the attribute can be linked.
9061 ///
9062 /// # Working with unknown values
9063 ///
9064 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9065 /// additional enum variants at any time. Adding new variants is not considered
9066 /// a breaking change. Applications should write their code in anticipation of:
9067 ///
9068 /// - New values appearing in future releases of the client library, **and**
9069 /// - New values received dynamically, without application changes.
9070 ///
9071 /// Please consult the [Working with enums] section in the user guide for some
9072 /// guidelines.
9073 ///
9074 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9075 #[derive(Clone, Debug, PartialEq)]
9076 #[non_exhaustive]
9077 pub enum Scope {
9078 /// Scope Unspecified.
9079 Unspecified,
9080 /// Attribute can be linked to an API.
9081 Api,
9082 /// Attribute can be linked to an API version.
9083 Version,
9084 /// Attribute can be linked to a Spec.
9085 Spec,
9086 /// Attribute can be linked to an API Operation.
9087 ApiOperation,
9088 /// Attribute can be linked to a Deployment.
9089 Deployment,
9090 /// Attribute can be linked to a Dependency.
9091 Dependency,
9092 /// Attribute can be linked to a definition.
9093 Definition,
9094 /// Attribute can be linked to a ExternalAPI.
9095 ExternalApi,
9096 /// Attribute can be linked to a Plugin.
9097 Plugin,
9098 /// If set, the enum was initialized with an unknown value.
9099 ///
9100 /// Applications can examine the value using [Scope::value] or
9101 /// [Scope::name].
9102 UnknownValue(scope::UnknownValue),
9103 }
9104
9105 #[doc(hidden)]
9106 pub mod scope {
9107 #[allow(unused_imports)]
9108 use super::*;
9109 #[derive(Clone, Debug, PartialEq)]
9110 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9111 }
9112
9113 impl Scope {
9114 /// Gets the enum value.
9115 ///
9116 /// Returns `None` if the enum contains an unknown value deserialized from
9117 /// the string representation of enums.
9118 pub fn value(&self) -> std::option::Option<i32> {
9119 match self {
9120 Self::Unspecified => std::option::Option::Some(0),
9121 Self::Api => std::option::Option::Some(1),
9122 Self::Version => std::option::Option::Some(2),
9123 Self::Spec => std::option::Option::Some(3),
9124 Self::ApiOperation => std::option::Option::Some(4),
9125 Self::Deployment => std::option::Option::Some(5),
9126 Self::Dependency => std::option::Option::Some(6),
9127 Self::Definition => std::option::Option::Some(7),
9128 Self::ExternalApi => std::option::Option::Some(8),
9129 Self::Plugin => std::option::Option::Some(9),
9130 Self::UnknownValue(u) => u.0.value(),
9131 }
9132 }
9133
9134 /// Gets the enum value as a string.
9135 ///
9136 /// Returns `None` if the enum contains an unknown value deserialized from
9137 /// the integer representation of enums.
9138 pub fn name(&self) -> std::option::Option<&str> {
9139 match self {
9140 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
9141 Self::Api => std::option::Option::Some("API"),
9142 Self::Version => std::option::Option::Some("VERSION"),
9143 Self::Spec => std::option::Option::Some("SPEC"),
9144 Self::ApiOperation => std::option::Option::Some("API_OPERATION"),
9145 Self::Deployment => std::option::Option::Some("DEPLOYMENT"),
9146 Self::Dependency => std::option::Option::Some("DEPENDENCY"),
9147 Self::Definition => std::option::Option::Some("DEFINITION"),
9148 Self::ExternalApi => std::option::Option::Some("EXTERNAL_API"),
9149 Self::Plugin => std::option::Option::Some("PLUGIN"),
9150 Self::UnknownValue(u) => u.0.name(),
9151 }
9152 }
9153 }
9154
9155 impl std::default::Default for Scope {
9156 fn default() -> Self {
9157 use std::convert::From;
9158 Self::from(0)
9159 }
9160 }
9161
9162 impl std::fmt::Display for Scope {
9163 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9164 wkt::internal::display_enum(f, self.name(), self.value())
9165 }
9166 }
9167
9168 impl std::convert::From<i32> for Scope {
9169 fn from(value: i32) -> Self {
9170 match value {
9171 0 => Self::Unspecified,
9172 1 => Self::Api,
9173 2 => Self::Version,
9174 3 => Self::Spec,
9175 4 => Self::ApiOperation,
9176 5 => Self::Deployment,
9177 6 => Self::Dependency,
9178 7 => Self::Definition,
9179 8 => Self::ExternalApi,
9180 9 => Self::Plugin,
9181 _ => Self::UnknownValue(scope::UnknownValue(
9182 wkt::internal::UnknownEnumValue::Integer(value),
9183 )),
9184 }
9185 }
9186 }
9187
9188 impl std::convert::From<&str> for Scope {
9189 fn from(value: &str) -> Self {
9190 use std::string::ToString;
9191 match value {
9192 "SCOPE_UNSPECIFIED" => Self::Unspecified,
9193 "API" => Self::Api,
9194 "VERSION" => Self::Version,
9195 "SPEC" => Self::Spec,
9196 "API_OPERATION" => Self::ApiOperation,
9197 "DEPLOYMENT" => Self::Deployment,
9198 "DEPENDENCY" => Self::Dependency,
9199 "DEFINITION" => Self::Definition,
9200 "EXTERNAL_API" => Self::ExternalApi,
9201 "PLUGIN" => Self::Plugin,
9202 _ => Self::UnknownValue(scope::UnknownValue(
9203 wkt::internal::UnknownEnumValue::String(value.to_string()),
9204 )),
9205 }
9206 }
9207 }
9208
9209 impl serde::ser::Serialize for Scope {
9210 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9211 where
9212 S: serde::Serializer,
9213 {
9214 match self {
9215 Self::Unspecified => serializer.serialize_i32(0),
9216 Self::Api => serializer.serialize_i32(1),
9217 Self::Version => serializer.serialize_i32(2),
9218 Self::Spec => serializer.serialize_i32(3),
9219 Self::ApiOperation => serializer.serialize_i32(4),
9220 Self::Deployment => serializer.serialize_i32(5),
9221 Self::Dependency => serializer.serialize_i32(6),
9222 Self::Definition => serializer.serialize_i32(7),
9223 Self::ExternalApi => serializer.serialize_i32(8),
9224 Self::Plugin => serializer.serialize_i32(9),
9225 Self::UnknownValue(u) => u.0.serialize(serializer),
9226 }
9227 }
9228 }
9229
9230 impl<'de> serde::de::Deserialize<'de> for Scope {
9231 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9232 where
9233 D: serde::Deserializer<'de>,
9234 {
9235 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
9236 ".google.cloud.apihub.v1.Attribute.Scope",
9237 ))
9238 }
9239 }
9240
9241 /// Enumeration of attribute's data type.
9242 ///
9243 /// # Working with unknown values
9244 ///
9245 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9246 /// additional enum variants at any time. Adding new variants is not considered
9247 /// a breaking change. Applications should write their code in anticipation of:
9248 ///
9249 /// - New values appearing in future releases of the client library, **and**
9250 /// - New values received dynamically, without application changes.
9251 ///
9252 /// Please consult the [Working with enums] section in the user guide for some
9253 /// guidelines.
9254 ///
9255 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9256 #[derive(Clone, Debug, PartialEq)]
9257 #[non_exhaustive]
9258 pub enum DataType {
9259 /// Attribute data type unspecified.
9260 Unspecified,
9261 /// Attribute's value is of type enum.
9262 Enum,
9263 /// Attribute's value is of type json.
9264 Json,
9265 /// Attribute's value is of type string.
9266 String,
9267 /// Attribute's value is of type uri.
9268 Uri,
9269 /// If set, the enum was initialized with an unknown value.
9270 ///
9271 /// Applications can examine the value using [DataType::value] or
9272 /// [DataType::name].
9273 UnknownValue(data_type::UnknownValue),
9274 }
9275
9276 #[doc(hidden)]
9277 pub mod data_type {
9278 #[allow(unused_imports)]
9279 use super::*;
9280 #[derive(Clone, Debug, PartialEq)]
9281 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9282 }
9283
9284 impl DataType {
9285 /// Gets the enum value.
9286 ///
9287 /// Returns `None` if the enum contains an unknown value deserialized from
9288 /// the string representation of enums.
9289 pub fn value(&self) -> std::option::Option<i32> {
9290 match self {
9291 Self::Unspecified => std::option::Option::Some(0),
9292 Self::Enum => std::option::Option::Some(1),
9293 Self::Json => std::option::Option::Some(2),
9294 Self::String => std::option::Option::Some(3),
9295 Self::Uri => std::option::Option::Some(4),
9296 Self::UnknownValue(u) => u.0.value(),
9297 }
9298 }
9299
9300 /// Gets the enum value as a string.
9301 ///
9302 /// Returns `None` if the enum contains an unknown value deserialized from
9303 /// the integer representation of enums.
9304 pub fn name(&self) -> std::option::Option<&str> {
9305 match self {
9306 Self::Unspecified => std::option::Option::Some("DATA_TYPE_UNSPECIFIED"),
9307 Self::Enum => std::option::Option::Some("ENUM"),
9308 Self::Json => std::option::Option::Some("JSON"),
9309 Self::String => std::option::Option::Some("STRING"),
9310 Self::Uri => std::option::Option::Some("URI"),
9311 Self::UnknownValue(u) => u.0.name(),
9312 }
9313 }
9314 }
9315
9316 impl std::default::Default for DataType {
9317 fn default() -> Self {
9318 use std::convert::From;
9319 Self::from(0)
9320 }
9321 }
9322
9323 impl std::fmt::Display for DataType {
9324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9325 wkt::internal::display_enum(f, self.name(), self.value())
9326 }
9327 }
9328
9329 impl std::convert::From<i32> for DataType {
9330 fn from(value: i32) -> Self {
9331 match value {
9332 0 => Self::Unspecified,
9333 1 => Self::Enum,
9334 2 => Self::Json,
9335 3 => Self::String,
9336 4 => Self::Uri,
9337 _ => Self::UnknownValue(data_type::UnknownValue(
9338 wkt::internal::UnknownEnumValue::Integer(value),
9339 )),
9340 }
9341 }
9342 }
9343
9344 impl std::convert::From<&str> for DataType {
9345 fn from(value: &str) -> Self {
9346 use std::string::ToString;
9347 match value {
9348 "DATA_TYPE_UNSPECIFIED" => Self::Unspecified,
9349 "ENUM" => Self::Enum,
9350 "JSON" => Self::Json,
9351 "STRING" => Self::String,
9352 "URI" => Self::Uri,
9353 _ => Self::UnknownValue(data_type::UnknownValue(
9354 wkt::internal::UnknownEnumValue::String(value.to_string()),
9355 )),
9356 }
9357 }
9358 }
9359
9360 impl serde::ser::Serialize for DataType {
9361 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9362 where
9363 S: serde::Serializer,
9364 {
9365 match self {
9366 Self::Unspecified => serializer.serialize_i32(0),
9367 Self::Enum => serializer.serialize_i32(1),
9368 Self::Json => serializer.serialize_i32(2),
9369 Self::String => serializer.serialize_i32(3),
9370 Self::Uri => serializer.serialize_i32(4),
9371 Self::UnknownValue(u) => u.0.serialize(serializer),
9372 }
9373 }
9374 }
9375
9376 impl<'de> serde::de::Deserialize<'de> for DataType {
9377 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9378 where
9379 D: serde::Deserializer<'de>,
9380 {
9381 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataType>::new(
9382 ".google.cloud.apihub.v1.Attribute.DataType",
9383 ))
9384 }
9385 }
9386}
9387
9388/// The spec contents.
9389#[derive(Clone, Default, PartialEq)]
9390#[non_exhaustive]
9391pub struct SpecContents {
9392 /// Required. The contents of the spec.
9393 pub contents: ::bytes::Bytes,
9394
9395 /// Required. The mime type of the content for example application/json,
9396 /// application/yaml, application/wsdl etc.
9397 pub mime_type: std::string::String,
9398
9399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9400}
9401
9402impl SpecContents {
9403 pub fn new() -> Self {
9404 std::default::Default::default()
9405 }
9406
9407 /// Sets the value of [contents][crate::model::SpecContents::contents].
9408 ///
9409 /// # Example
9410 /// ```ignore,no_run
9411 /// # use google_cloud_apihub_v1::model::SpecContents;
9412 /// let x = SpecContents::new().set_contents(bytes::Bytes::from_static(b"example"));
9413 /// ```
9414 pub fn set_contents<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9415 self.contents = v.into();
9416 self
9417 }
9418
9419 /// Sets the value of [mime_type][crate::model::SpecContents::mime_type].
9420 ///
9421 /// # Example
9422 /// ```ignore,no_run
9423 /// # use google_cloud_apihub_v1::model::SpecContents;
9424 /// let x = SpecContents::new().set_mime_type("example");
9425 /// ```
9426 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9427 self.mime_type = v.into();
9428 self
9429 }
9430}
9431
9432impl wkt::message::Message for SpecContents {
9433 fn typename() -> &'static str {
9434 "type.googleapis.com/google.cloud.apihub.v1.SpecContents"
9435 }
9436}
9437
9438/// SpecDetails contains the details parsed from supported
9439/// spec types.
9440#[derive(Clone, Default, PartialEq)]
9441#[non_exhaustive]
9442pub struct SpecDetails {
9443 /// Output only. The description of the spec.
9444 pub description: std::string::String,
9445
9446 pub details: std::option::Option<crate::model::spec_details::Details>,
9447
9448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9449}
9450
9451impl SpecDetails {
9452 pub fn new() -> Self {
9453 std::default::Default::default()
9454 }
9455
9456 /// Sets the value of [description][crate::model::SpecDetails::description].
9457 ///
9458 /// # Example
9459 /// ```ignore,no_run
9460 /// # use google_cloud_apihub_v1::model::SpecDetails;
9461 /// let x = SpecDetails::new().set_description("example");
9462 /// ```
9463 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9464 self.description = v.into();
9465 self
9466 }
9467
9468 /// Sets the value of [details][crate::model::SpecDetails::details].
9469 ///
9470 /// Note that all the setters affecting `details` are mutually
9471 /// exclusive.
9472 ///
9473 /// # Example
9474 /// ```ignore,no_run
9475 /// # use google_cloud_apihub_v1::model::SpecDetails;
9476 /// use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9477 /// let x = SpecDetails::new().set_details(Some(
9478 /// google_cloud_apihub_v1::model::spec_details::Details::OpenApiSpecDetails(OpenApiSpecDetails::default().into())));
9479 /// ```
9480 pub fn set_details<
9481 T: std::convert::Into<std::option::Option<crate::model::spec_details::Details>>,
9482 >(
9483 mut self,
9484 v: T,
9485 ) -> Self {
9486 self.details = v.into();
9487 self
9488 }
9489
9490 /// The value of [details][crate::model::SpecDetails::details]
9491 /// if it holds a `OpenApiSpecDetails`, `None` if the field is not set or
9492 /// holds a different branch.
9493 pub fn open_api_spec_details(
9494 &self,
9495 ) -> std::option::Option<&std::boxed::Box<crate::model::OpenApiSpecDetails>> {
9496 #[allow(unreachable_patterns)]
9497 self.details.as_ref().and_then(|v| match v {
9498 crate::model::spec_details::Details::OpenApiSpecDetails(v) => {
9499 std::option::Option::Some(v)
9500 }
9501 _ => std::option::Option::None,
9502 })
9503 }
9504
9505 /// Sets the value of [details][crate::model::SpecDetails::details]
9506 /// to hold a `OpenApiSpecDetails`.
9507 ///
9508 /// Note that all the setters affecting `details` are
9509 /// mutually exclusive.
9510 ///
9511 /// # Example
9512 /// ```ignore,no_run
9513 /// # use google_cloud_apihub_v1::model::SpecDetails;
9514 /// use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9515 /// let x = SpecDetails::new().set_open_api_spec_details(OpenApiSpecDetails::default()/* use setters */);
9516 /// assert!(x.open_api_spec_details().is_some());
9517 /// ```
9518 pub fn set_open_api_spec_details<
9519 T: std::convert::Into<std::boxed::Box<crate::model::OpenApiSpecDetails>>,
9520 >(
9521 mut self,
9522 v: T,
9523 ) -> Self {
9524 self.details = std::option::Option::Some(
9525 crate::model::spec_details::Details::OpenApiSpecDetails(v.into()),
9526 );
9527 self
9528 }
9529}
9530
9531impl wkt::message::Message for SpecDetails {
9532 fn typename() -> &'static str {
9533 "type.googleapis.com/google.cloud.apihub.v1.SpecDetails"
9534 }
9535}
9536
9537/// Defines additional types related to [SpecDetails].
9538pub mod spec_details {
9539 #[allow(unused_imports)]
9540 use super::*;
9541
9542 #[derive(Clone, Debug, PartialEq)]
9543 #[non_exhaustive]
9544 pub enum Details {
9545 /// Output only. Additional details apart from `OperationDetails` parsed from
9546 /// an OpenAPI spec. The OperationDetails parsed from the spec can be
9547 /// obtained by using
9548 /// [ListAPIOperations][google.cloud.apihub.v1.ApiHub.ListApiOperations]
9549 /// method.
9550 ///
9551 /// [google.cloud.apihub.v1.ApiHub.ListApiOperations]: crate::client::ApiHub::list_api_operations
9552 OpenApiSpecDetails(std::boxed::Box<crate::model::OpenApiSpecDetails>),
9553 }
9554}
9555
9556/// OpenApiSpecDetails contains the details parsed from an OpenAPI spec in
9557/// addition to the fields mentioned in
9558/// [SpecDetails][google.cloud.apihub.v1.SpecDetails].
9559///
9560/// [google.cloud.apihub.v1.SpecDetails]: crate::model::SpecDetails
9561#[derive(Clone, Default, PartialEq)]
9562#[non_exhaustive]
9563pub struct OpenApiSpecDetails {
9564 /// Output only. The format of the spec.
9565 pub format: crate::model::open_api_spec_details::Format,
9566
9567 /// Output only. The version in the spec.
9568 /// This maps to `info.version` in OpenAPI spec.
9569 pub version: std::string::String,
9570
9571 /// Output only. Owner details for the spec.
9572 /// This maps to `info.contact` in OpenAPI spec.
9573 pub owner: std::option::Option<crate::model::Owner>,
9574
9575 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9576}
9577
9578impl OpenApiSpecDetails {
9579 pub fn new() -> Self {
9580 std::default::Default::default()
9581 }
9582
9583 /// Sets the value of [format][crate::model::OpenApiSpecDetails::format].
9584 ///
9585 /// # Example
9586 /// ```ignore,no_run
9587 /// # use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9588 /// use google_cloud_apihub_v1::model::open_api_spec_details::Format;
9589 /// let x0 = OpenApiSpecDetails::new().set_format(Format::OpenApiSpec20);
9590 /// let x1 = OpenApiSpecDetails::new().set_format(Format::OpenApiSpec30);
9591 /// let x2 = OpenApiSpecDetails::new().set_format(Format::OpenApiSpec31);
9592 /// ```
9593 pub fn set_format<T: std::convert::Into<crate::model::open_api_spec_details::Format>>(
9594 mut self,
9595 v: T,
9596 ) -> Self {
9597 self.format = v.into();
9598 self
9599 }
9600
9601 /// Sets the value of [version][crate::model::OpenApiSpecDetails::version].
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9606 /// let x = OpenApiSpecDetails::new().set_version("example");
9607 /// ```
9608 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9609 self.version = v.into();
9610 self
9611 }
9612
9613 /// Sets the value of [owner][crate::model::OpenApiSpecDetails::owner].
9614 ///
9615 /// # Example
9616 /// ```ignore,no_run
9617 /// # use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9618 /// use google_cloud_apihub_v1::model::Owner;
9619 /// let x = OpenApiSpecDetails::new().set_owner(Owner::default()/* use setters */);
9620 /// ```
9621 pub fn set_owner<T>(mut self, v: T) -> Self
9622 where
9623 T: std::convert::Into<crate::model::Owner>,
9624 {
9625 self.owner = std::option::Option::Some(v.into());
9626 self
9627 }
9628
9629 /// Sets or clears the value of [owner][crate::model::OpenApiSpecDetails::owner].
9630 ///
9631 /// # Example
9632 /// ```ignore,no_run
9633 /// # use google_cloud_apihub_v1::model::OpenApiSpecDetails;
9634 /// use google_cloud_apihub_v1::model::Owner;
9635 /// let x = OpenApiSpecDetails::new().set_or_clear_owner(Some(Owner::default()/* use setters */));
9636 /// let x = OpenApiSpecDetails::new().set_or_clear_owner(None::<Owner>);
9637 /// ```
9638 pub fn set_or_clear_owner<T>(mut self, v: std::option::Option<T>) -> Self
9639 where
9640 T: std::convert::Into<crate::model::Owner>,
9641 {
9642 self.owner = v.map(|x| x.into());
9643 self
9644 }
9645}
9646
9647impl wkt::message::Message for OpenApiSpecDetails {
9648 fn typename() -> &'static str {
9649 "type.googleapis.com/google.cloud.apihub.v1.OpenApiSpecDetails"
9650 }
9651}
9652
9653/// Defines additional types related to [OpenApiSpecDetails].
9654pub mod open_api_spec_details {
9655 #[allow(unused_imports)]
9656 use super::*;
9657
9658 /// Enumeration of spec formats.
9659 ///
9660 /// # Working with unknown values
9661 ///
9662 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9663 /// additional enum variants at any time. Adding new variants is not considered
9664 /// a breaking change. Applications should write their code in anticipation of:
9665 ///
9666 /// - New values appearing in future releases of the client library, **and**
9667 /// - New values received dynamically, without application changes.
9668 ///
9669 /// Please consult the [Working with enums] section in the user guide for some
9670 /// guidelines.
9671 ///
9672 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9673 #[derive(Clone, Debug, PartialEq)]
9674 #[non_exhaustive]
9675 pub enum Format {
9676 /// SpecFile type unspecified.
9677 Unspecified,
9678 /// OpenAPI Spec v2.0.
9679 OpenApiSpec20,
9680 /// OpenAPI Spec v3.0.
9681 OpenApiSpec30,
9682 /// OpenAPI Spec v3.1.
9683 OpenApiSpec31,
9684 /// If set, the enum was initialized with an unknown value.
9685 ///
9686 /// Applications can examine the value using [Format::value] or
9687 /// [Format::name].
9688 UnknownValue(format::UnknownValue),
9689 }
9690
9691 #[doc(hidden)]
9692 pub mod format {
9693 #[allow(unused_imports)]
9694 use super::*;
9695 #[derive(Clone, Debug, PartialEq)]
9696 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9697 }
9698
9699 impl Format {
9700 /// Gets the enum value.
9701 ///
9702 /// Returns `None` if the enum contains an unknown value deserialized from
9703 /// the string representation of enums.
9704 pub fn value(&self) -> std::option::Option<i32> {
9705 match self {
9706 Self::Unspecified => std::option::Option::Some(0),
9707 Self::OpenApiSpec20 => std::option::Option::Some(1),
9708 Self::OpenApiSpec30 => std::option::Option::Some(2),
9709 Self::OpenApiSpec31 => std::option::Option::Some(3),
9710 Self::UnknownValue(u) => u.0.value(),
9711 }
9712 }
9713
9714 /// Gets the enum value as a string.
9715 ///
9716 /// Returns `None` if the enum contains an unknown value deserialized from
9717 /// the integer representation of enums.
9718 pub fn name(&self) -> std::option::Option<&str> {
9719 match self {
9720 Self::Unspecified => std::option::Option::Some("FORMAT_UNSPECIFIED"),
9721 Self::OpenApiSpec20 => std::option::Option::Some("OPEN_API_SPEC_2_0"),
9722 Self::OpenApiSpec30 => std::option::Option::Some("OPEN_API_SPEC_3_0"),
9723 Self::OpenApiSpec31 => std::option::Option::Some("OPEN_API_SPEC_3_1"),
9724 Self::UnknownValue(u) => u.0.name(),
9725 }
9726 }
9727 }
9728
9729 impl std::default::Default for Format {
9730 fn default() -> Self {
9731 use std::convert::From;
9732 Self::from(0)
9733 }
9734 }
9735
9736 impl std::fmt::Display for Format {
9737 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9738 wkt::internal::display_enum(f, self.name(), self.value())
9739 }
9740 }
9741
9742 impl std::convert::From<i32> for Format {
9743 fn from(value: i32) -> Self {
9744 match value {
9745 0 => Self::Unspecified,
9746 1 => Self::OpenApiSpec20,
9747 2 => Self::OpenApiSpec30,
9748 3 => Self::OpenApiSpec31,
9749 _ => Self::UnknownValue(format::UnknownValue(
9750 wkt::internal::UnknownEnumValue::Integer(value),
9751 )),
9752 }
9753 }
9754 }
9755
9756 impl std::convert::From<&str> for Format {
9757 fn from(value: &str) -> Self {
9758 use std::string::ToString;
9759 match value {
9760 "FORMAT_UNSPECIFIED" => Self::Unspecified,
9761 "OPEN_API_SPEC_2_0" => Self::OpenApiSpec20,
9762 "OPEN_API_SPEC_3_0" => Self::OpenApiSpec30,
9763 "OPEN_API_SPEC_3_1" => Self::OpenApiSpec31,
9764 _ => Self::UnknownValue(format::UnknownValue(
9765 wkt::internal::UnknownEnumValue::String(value.to_string()),
9766 )),
9767 }
9768 }
9769 }
9770
9771 impl serde::ser::Serialize for Format {
9772 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9773 where
9774 S: serde::Serializer,
9775 {
9776 match self {
9777 Self::Unspecified => serializer.serialize_i32(0),
9778 Self::OpenApiSpec20 => serializer.serialize_i32(1),
9779 Self::OpenApiSpec30 => serializer.serialize_i32(2),
9780 Self::OpenApiSpec31 => serializer.serialize_i32(3),
9781 Self::UnknownValue(u) => u.0.serialize(serializer),
9782 }
9783 }
9784 }
9785
9786 impl<'de> serde::de::Deserialize<'de> for Format {
9787 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9788 where
9789 D: serde::Deserializer<'de>,
9790 {
9791 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Format>::new(
9792 ".google.cloud.apihub.v1.OpenApiSpecDetails.Format",
9793 ))
9794 }
9795 }
9796}
9797
9798/// The operation details parsed from the spec.
9799#[derive(Clone, Default, PartialEq)]
9800#[non_exhaustive]
9801pub struct OperationDetails {
9802 /// Optional. Description of the operation behavior.
9803 /// For OpenAPI spec, this will map to `operation.description` in the
9804 /// spec, in case description is empty, `operation.summary` will be used.
9805 pub description: std::string::String,
9806
9807 /// Optional. Additional external documentation for this operation.
9808 /// For OpenAPI spec, this will map to `operation.documentation` in the spec.
9809 pub documentation: std::option::Option<crate::model::Documentation>,
9810
9811 /// Optional. For OpenAPI spec, this will be set if `operation.deprecated`is
9812 /// marked as `true` in the spec.
9813 pub deprecated: bool,
9814
9815 pub operation: std::option::Option<crate::model::operation_details::Operation>,
9816
9817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9818}
9819
9820impl OperationDetails {
9821 pub fn new() -> Self {
9822 std::default::Default::default()
9823 }
9824
9825 /// Sets the value of [description][crate::model::OperationDetails::description].
9826 ///
9827 /// # Example
9828 /// ```ignore,no_run
9829 /// # use google_cloud_apihub_v1::model::OperationDetails;
9830 /// let x = OperationDetails::new().set_description("example");
9831 /// ```
9832 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9833 self.description = v.into();
9834 self
9835 }
9836
9837 /// Sets the value of [documentation][crate::model::OperationDetails::documentation].
9838 ///
9839 /// # Example
9840 /// ```ignore,no_run
9841 /// # use google_cloud_apihub_v1::model::OperationDetails;
9842 /// use google_cloud_apihub_v1::model::Documentation;
9843 /// let x = OperationDetails::new().set_documentation(Documentation::default()/* use setters */);
9844 /// ```
9845 pub fn set_documentation<T>(mut self, v: T) -> Self
9846 where
9847 T: std::convert::Into<crate::model::Documentation>,
9848 {
9849 self.documentation = std::option::Option::Some(v.into());
9850 self
9851 }
9852
9853 /// Sets or clears the value of [documentation][crate::model::OperationDetails::documentation].
9854 ///
9855 /// # Example
9856 /// ```ignore,no_run
9857 /// # use google_cloud_apihub_v1::model::OperationDetails;
9858 /// use google_cloud_apihub_v1::model::Documentation;
9859 /// let x = OperationDetails::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
9860 /// let x = OperationDetails::new().set_or_clear_documentation(None::<Documentation>);
9861 /// ```
9862 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
9863 where
9864 T: std::convert::Into<crate::model::Documentation>,
9865 {
9866 self.documentation = v.map(|x| x.into());
9867 self
9868 }
9869
9870 /// Sets the value of [deprecated][crate::model::OperationDetails::deprecated].
9871 ///
9872 /// # Example
9873 /// ```ignore,no_run
9874 /// # use google_cloud_apihub_v1::model::OperationDetails;
9875 /// let x = OperationDetails::new().set_deprecated(true);
9876 /// ```
9877 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9878 self.deprecated = v.into();
9879 self
9880 }
9881
9882 /// Sets the value of [operation][crate::model::OperationDetails::operation].
9883 ///
9884 /// Note that all the setters affecting `operation` are mutually
9885 /// exclusive.
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_apihub_v1::model::OperationDetails;
9890 /// use google_cloud_apihub_v1::model::HttpOperation;
9891 /// let x = OperationDetails::new().set_operation(Some(
9892 /// google_cloud_apihub_v1::model::operation_details::Operation::HttpOperation(HttpOperation::default().into())));
9893 /// ```
9894 pub fn set_operation<
9895 T: std::convert::Into<std::option::Option<crate::model::operation_details::Operation>>,
9896 >(
9897 mut self,
9898 v: T,
9899 ) -> Self {
9900 self.operation = v.into();
9901 self
9902 }
9903
9904 /// The value of [operation][crate::model::OperationDetails::operation]
9905 /// if it holds a `HttpOperation`, `None` if the field is not set or
9906 /// holds a different branch.
9907 pub fn http_operation(
9908 &self,
9909 ) -> std::option::Option<&std::boxed::Box<crate::model::HttpOperation>> {
9910 #[allow(unreachable_patterns)]
9911 self.operation.as_ref().and_then(|v| match v {
9912 crate::model::operation_details::Operation::HttpOperation(v) => {
9913 std::option::Option::Some(v)
9914 }
9915 _ => std::option::Option::None,
9916 })
9917 }
9918
9919 /// Sets the value of [operation][crate::model::OperationDetails::operation]
9920 /// to hold a `HttpOperation`.
9921 ///
9922 /// Note that all the setters affecting `operation` are
9923 /// mutually exclusive.
9924 ///
9925 /// # Example
9926 /// ```ignore,no_run
9927 /// # use google_cloud_apihub_v1::model::OperationDetails;
9928 /// use google_cloud_apihub_v1::model::HttpOperation;
9929 /// let x = OperationDetails::new().set_http_operation(HttpOperation::default()/* use setters */);
9930 /// assert!(x.http_operation().is_some());
9931 /// ```
9932 pub fn set_http_operation<
9933 T: std::convert::Into<std::boxed::Box<crate::model::HttpOperation>>,
9934 >(
9935 mut self,
9936 v: T,
9937 ) -> Self {
9938 self.operation = std::option::Option::Some(
9939 crate::model::operation_details::Operation::HttpOperation(v.into()),
9940 );
9941 self
9942 }
9943}
9944
9945impl wkt::message::Message for OperationDetails {
9946 fn typename() -> &'static str {
9947 "type.googleapis.com/google.cloud.apihub.v1.OperationDetails"
9948 }
9949}
9950
9951/// Defines additional types related to [OperationDetails].
9952pub mod operation_details {
9953 #[allow(unused_imports)]
9954 use super::*;
9955
9956 #[derive(Clone, Debug, PartialEq)]
9957 #[non_exhaustive]
9958 pub enum Operation {
9959 /// The HTTP Operation.
9960 HttpOperation(std::boxed::Box<crate::model::HttpOperation>),
9961 }
9962}
9963
9964/// The HTTP Operation.
9965#[derive(Clone, Default, PartialEq)]
9966#[non_exhaustive]
9967pub struct HttpOperation {
9968 /// Optional. The path details for the Operation.
9969 /// Note: Even though this field is optional, it is required for
9970 /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation]
9971 /// API and we will fail the request if not provided.
9972 ///
9973 /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
9974 pub path: std::option::Option<crate::model::Path>,
9975
9976 /// Optional. Operation method
9977 /// Note: Even though this field is optional, it is required for
9978 /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation]
9979 /// API and we will fail the request if not provided.
9980 ///
9981 /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
9982 pub method: crate::model::http_operation::Method,
9983
9984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9985}
9986
9987impl HttpOperation {
9988 pub fn new() -> Self {
9989 std::default::Default::default()
9990 }
9991
9992 /// Sets the value of [path][crate::model::HttpOperation::path].
9993 ///
9994 /// # Example
9995 /// ```ignore,no_run
9996 /// # use google_cloud_apihub_v1::model::HttpOperation;
9997 /// use google_cloud_apihub_v1::model::Path;
9998 /// let x = HttpOperation::new().set_path(Path::default()/* use setters */);
9999 /// ```
10000 pub fn set_path<T>(mut self, v: T) -> Self
10001 where
10002 T: std::convert::Into<crate::model::Path>,
10003 {
10004 self.path = std::option::Option::Some(v.into());
10005 self
10006 }
10007
10008 /// Sets or clears the value of [path][crate::model::HttpOperation::path].
10009 ///
10010 /// # Example
10011 /// ```ignore,no_run
10012 /// # use google_cloud_apihub_v1::model::HttpOperation;
10013 /// use google_cloud_apihub_v1::model::Path;
10014 /// let x = HttpOperation::new().set_or_clear_path(Some(Path::default()/* use setters */));
10015 /// let x = HttpOperation::new().set_or_clear_path(None::<Path>);
10016 /// ```
10017 pub fn set_or_clear_path<T>(mut self, v: std::option::Option<T>) -> Self
10018 where
10019 T: std::convert::Into<crate::model::Path>,
10020 {
10021 self.path = v.map(|x| x.into());
10022 self
10023 }
10024
10025 /// Sets the value of [method][crate::model::HttpOperation::method].
10026 ///
10027 /// # Example
10028 /// ```ignore,no_run
10029 /// # use google_cloud_apihub_v1::model::HttpOperation;
10030 /// use google_cloud_apihub_v1::model::http_operation::Method;
10031 /// let x0 = HttpOperation::new().set_method(Method::Get);
10032 /// let x1 = HttpOperation::new().set_method(Method::Put);
10033 /// let x2 = HttpOperation::new().set_method(Method::Post);
10034 /// ```
10035 pub fn set_method<T: std::convert::Into<crate::model::http_operation::Method>>(
10036 mut self,
10037 v: T,
10038 ) -> Self {
10039 self.method = v.into();
10040 self
10041 }
10042}
10043
10044impl wkt::message::Message for HttpOperation {
10045 fn typename() -> &'static str {
10046 "type.googleapis.com/google.cloud.apihub.v1.HttpOperation"
10047 }
10048}
10049
10050/// Defines additional types related to [HttpOperation].
10051pub mod http_operation {
10052 #[allow(unused_imports)]
10053 use super::*;
10054
10055 /// Enumeration of Method types.
10056 ///
10057 /// # Working with unknown values
10058 ///
10059 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10060 /// additional enum variants at any time. Adding new variants is not considered
10061 /// a breaking change. Applications should write their code in anticipation of:
10062 ///
10063 /// - New values appearing in future releases of the client library, **and**
10064 /// - New values received dynamically, without application changes.
10065 ///
10066 /// Please consult the [Working with enums] section in the user guide for some
10067 /// guidelines.
10068 ///
10069 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10070 #[derive(Clone, Debug, PartialEq)]
10071 #[non_exhaustive]
10072 pub enum Method {
10073 /// Method unspecified.
10074 Unspecified,
10075 /// Get Operation type.
10076 Get,
10077 /// Put Operation type.
10078 Put,
10079 /// Post Operation type.
10080 Post,
10081 /// Delete Operation type.
10082 Delete,
10083 /// Options Operation type.
10084 Options,
10085 /// Head Operation type.
10086 Head,
10087 /// Patch Operation type.
10088 Patch,
10089 /// Trace Operation type.
10090 Trace,
10091 /// If set, the enum was initialized with an unknown value.
10092 ///
10093 /// Applications can examine the value using [Method::value] or
10094 /// [Method::name].
10095 UnknownValue(method::UnknownValue),
10096 }
10097
10098 #[doc(hidden)]
10099 pub mod method {
10100 #[allow(unused_imports)]
10101 use super::*;
10102 #[derive(Clone, Debug, PartialEq)]
10103 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10104 }
10105
10106 impl Method {
10107 /// Gets the enum value.
10108 ///
10109 /// Returns `None` if the enum contains an unknown value deserialized from
10110 /// the string representation of enums.
10111 pub fn value(&self) -> std::option::Option<i32> {
10112 match self {
10113 Self::Unspecified => std::option::Option::Some(0),
10114 Self::Get => std::option::Option::Some(1),
10115 Self::Put => std::option::Option::Some(2),
10116 Self::Post => std::option::Option::Some(3),
10117 Self::Delete => std::option::Option::Some(4),
10118 Self::Options => std::option::Option::Some(5),
10119 Self::Head => std::option::Option::Some(6),
10120 Self::Patch => std::option::Option::Some(7),
10121 Self::Trace => std::option::Option::Some(8),
10122 Self::UnknownValue(u) => u.0.value(),
10123 }
10124 }
10125
10126 /// Gets the enum value as a string.
10127 ///
10128 /// Returns `None` if the enum contains an unknown value deserialized from
10129 /// the integer representation of enums.
10130 pub fn name(&self) -> std::option::Option<&str> {
10131 match self {
10132 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
10133 Self::Get => std::option::Option::Some("GET"),
10134 Self::Put => std::option::Option::Some("PUT"),
10135 Self::Post => std::option::Option::Some("POST"),
10136 Self::Delete => std::option::Option::Some("DELETE"),
10137 Self::Options => std::option::Option::Some("OPTIONS"),
10138 Self::Head => std::option::Option::Some("HEAD"),
10139 Self::Patch => std::option::Option::Some("PATCH"),
10140 Self::Trace => std::option::Option::Some("TRACE"),
10141 Self::UnknownValue(u) => u.0.name(),
10142 }
10143 }
10144 }
10145
10146 impl std::default::Default for Method {
10147 fn default() -> Self {
10148 use std::convert::From;
10149 Self::from(0)
10150 }
10151 }
10152
10153 impl std::fmt::Display for Method {
10154 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10155 wkt::internal::display_enum(f, self.name(), self.value())
10156 }
10157 }
10158
10159 impl std::convert::From<i32> for Method {
10160 fn from(value: i32) -> Self {
10161 match value {
10162 0 => Self::Unspecified,
10163 1 => Self::Get,
10164 2 => Self::Put,
10165 3 => Self::Post,
10166 4 => Self::Delete,
10167 5 => Self::Options,
10168 6 => Self::Head,
10169 7 => Self::Patch,
10170 8 => Self::Trace,
10171 _ => Self::UnknownValue(method::UnknownValue(
10172 wkt::internal::UnknownEnumValue::Integer(value),
10173 )),
10174 }
10175 }
10176 }
10177
10178 impl std::convert::From<&str> for Method {
10179 fn from(value: &str) -> Self {
10180 use std::string::ToString;
10181 match value {
10182 "METHOD_UNSPECIFIED" => Self::Unspecified,
10183 "GET" => Self::Get,
10184 "PUT" => Self::Put,
10185 "POST" => Self::Post,
10186 "DELETE" => Self::Delete,
10187 "OPTIONS" => Self::Options,
10188 "HEAD" => Self::Head,
10189 "PATCH" => Self::Patch,
10190 "TRACE" => Self::Trace,
10191 _ => Self::UnknownValue(method::UnknownValue(
10192 wkt::internal::UnknownEnumValue::String(value.to_string()),
10193 )),
10194 }
10195 }
10196 }
10197
10198 impl serde::ser::Serialize for Method {
10199 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10200 where
10201 S: serde::Serializer,
10202 {
10203 match self {
10204 Self::Unspecified => serializer.serialize_i32(0),
10205 Self::Get => serializer.serialize_i32(1),
10206 Self::Put => serializer.serialize_i32(2),
10207 Self::Post => serializer.serialize_i32(3),
10208 Self::Delete => serializer.serialize_i32(4),
10209 Self::Options => serializer.serialize_i32(5),
10210 Self::Head => serializer.serialize_i32(6),
10211 Self::Patch => serializer.serialize_i32(7),
10212 Self::Trace => serializer.serialize_i32(8),
10213 Self::UnknownValue(u) => u.0.serialize(serializer),
10214 }
10215 }
10216 }
10217
10218 impl<'de> serde::de::Deserialize<'de> for Method {
10219 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10220 where
10221 D: serde::Deserializer<'de>,
10222 {
10223 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
10224 ".google.cloud.apihub.v1.HttpOperation.Method",
10225 ))
10226 }
10227 }
10228}
10229
10230/// The path details derived from the spec.
10231#[derive(Clone, Default, PartialEq)]
10232#[non_exhaustive]
10233pub struct Path {
10234 /// Optional. Complete path relative to server endpoint.
10235 /// Note: Even though this field is optional, it is required for
10236 /// [CreateApiOperation][google.cloud.apihub.v1.ApiHub.CreateApiOperation]
10237 /// API and we will fail the request if not provided.
10238 ///
10239 /// [google.cloud.apihub.v1.ApiHub.CreateApiOperation]: crate::client::ApiHub::create_api_operation
10240 pub path: std::string::String,
10241
10242 /// Optional. A short description for the path applicable to all operations.
10243 pub description: std::string::String,
10244
10245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10246}
10247
10248impl Path {
10249 pub fn new() -> Self {
10250 std::default::Default::default()
10251 }
10252
10253 /// Sets the value of [path][crate::model::Path::path].
10254 ///
10255 /// # Example
10256 /// ```ignore,no_run
10257 /// # use google_cloud_apihub_v1::model::Path;
10258 /// let x = Path::new().set_path("example");
10259 /// ```
10260 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10261 self.path = v.into();
10262 self
10263 }
10264
10265 /// Sets the value of [description][crate::model::Path::description].
10266 ///
10267 /// # Example
10268 /// ```ignore,no_run
10269 /// # use google_cloud_apihub_v1::model::Path;
10270 /// let x = Path::new().set_description("example");
10271 /// ```
10272 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10273 self.description = v.into();
10274 self
10275 }
10276}
10277
10278impl wkt::message::Message for Path {
10279 fn typename() -> &'static str {
10280 "type.googleapis.com/google.cloud.apihub.v1.Path"
10281 }
10282}
10283
10284/// The schema details derived from the spec. Currently, this entity is supported
10285/// for OpenAPI spec only.
10286/// For OpenAPI spec, this maps to the schema defined in
10287/// the `definitions` section for OpenAPI 2.0 version and in
10288/// `components.schemas` section for OpenAPI 3.0 and 3.1 version.
10289#[derive(Clone, Default, PartialEq)]
10290#[non_exhaustive]
10291pub struct Schema {
10292 /// Output only. The display name of the schema.
10293 /// This will map to the name of the schema in the spec.
10294 pub display_name: std::string::String,
10295
10296 /// Output only. The raw value of the schema definition corresponding to the
10297 /// schema name in the spec.
10298 pub raw_value: ::bytes::Bytes,
10299
10300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10301}
10302
10303impl Schema {
10304 pub fn new() -> Self {
10305 std::default::Default::default()
10306 }
10307
10308 /// Sets the value of [display_name][crate::model::Schema::display_name].
10309 ///
10310 /// # Example
10311 /// ```ignore,no_run
10312 /// # use google_cloud_apihub_v1::model::Schema;
10313 /// let x = Schema::new().set_display_name("example");
10314 /// ```
10315 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10316 self.display_name = v.into();
10317 self
10318 }
10319
10320 /// Sets the value of [raw_value][crate::model::Schema::raw_value].
10321 ///
10322 /// # Example
10323 /// ```ignore,no_run
10324 /// # use google_cloud_apihub_v1::model::Schema;
10325 /// let x = Schema::new().set_raw_value(bytes::Bytes::from_static(b"example"));
10326 /// ```
10327 pub fn set_raw_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10328 self.raw_value = v.into();
10329 self
10330 }
10331}
10332
10333impl wkt::message::Message for Schema {
10334 fn typename() -> &'static str {
10335 "type.googleapis.com/google.cloud.apihub.v1.Schema"
10336 }
10337}
10338
10339/// Owner details.
10340#[derive(Clone, Default, PartialEq)]
10341#[non_exhaustive]
10342pub struct Owner {
10343 /// Optional. The name of the owner.
10344 pub display_name: std::string::String,
10345
10346 /// Required. The email of the owner.
10347 pub email: std::string::String,
10348
10349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10350}
10351
10352impl Owner {
10353 pub fn new() -> Self {
10354 std::default::Default::default()
10355 }
10356
10357 /// Sets the value of [display_name][crate::model::Owner::display_name].
10358 ///
10359 /// # Example
10360 /// ```ignore,no_run
10361 /// # use google_cloud_apihub_v1::model::Owner;
10362 /// let x = Owner::new().set_display_name("example");
10363 /// ```
10364 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10365 self.display_name = v.into();
10366 self
10367 }
10368
10369 /// Sets the value of [email][crate::model::Owner::email].
10370 ///
10371 /// # Example
10372 /// ```ignore,no_run
10373 /// # use google_cloud_apihub_v1::model::Owner;
10374 /// let x = Owner::new().set_email("example");
10375 /// ```
10376 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10377 self.email = v.into();
10378 self
10379 }
10380}
10381
10382impl wkt::message::Message for Owner {
10383 fn typename() -> &'static str {
10384 "type.googleapis.com/google.cloud.apihub.v1.Owner"
10385 }
10386}
10387
10388/// Documentation details.
10389#[derive(Clone, Default, PartialEq)]
10390#[non_exhaustive]
10391pub struct Documentation {
10392 /// Optional. The uri of the externally hosted documentation.
10393 pub external_uri: std::string::String,
10394
10395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10396}
10397
10398impl Documentation {
10399 pub fn new() -> Self {
10400 std::default::Default::default()
10401 }
10402
10403 /// Sets the value of [external_uri][crate::model::Documentation::external_uri].
10404 ///
10405 /// # Example
10406 /// ```ignore,no_run
10407 /// # use google_cloud_apihub_v1::model::Documentation;
10408 /// let x = Documentation::new().set_external_uri("example");
10409 /// ```
10410 pub fn set_external_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10411 self.external_uri = v.into();
10412 self
10413 }
10414}
10415
10416impl wkt::message::Message for Documentation {
10417 fn typename() -> &'static str {
10418 "type.googleapis.com/google.cloud.apihub.v1.Documentation"
10419 }
10420}
10421
10422/// The attribute values associated with resource.
10423#[derive(Clone, Default, PartialEq)]
10424#[non_exhaustive]
10425pub struct AttributeValues {
10426 /// Output only. The name of the attribute.
10427 /// Format: projects/{project}/locations/{location}/attributes/{attribute}
10428 pub attribute: std::string::String,
10429
10430 /// The attribute values associated with the resource.
10431 pub value: std::option::Option<crate::model::attribute_values::Value>,
10432
10433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10434}
10435
10436impl AttributeValues {
10437 pub fn new() -> Self {
10438 std::default::Default::default()
10439 }
10440
10441 /// Sets the value of [attribute][crate::model::AttributeValues::attribute].
10442 ///
10443 /// # Example
10444 /// ```ignore,no_run
10445 /// # use google_cloud_apihub_v1::model::AttributeValues;
10446 /// let x = AttributeValues::new().set_attribute("example");
10447 /// ```
10448 pub fn set_attribute<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10449 self.attribute = v.into();
10450 self
10451 }
10452
10453 /// Sets the value of [value][crate::model::AttributeValues::value].
10454 ///
10455 /// Note that all the setters affecting `value` are mutually
10456 /// exclusive.
10457 ///
10458 /// # Example
10459 /// ```ignore,no_run
10460 /// # use google_cloud_apihub_v1::model::AttributeValues;
10461 /// use google_cloud_apihub_v1::model::attribute_values::EnumAttributeValues;
10462 /// let x = AttributeValues::new().set_value(Some(
10463 /// google_cloud_apihub_v1::model::attribute_values::Value::EnumValues(EnumAttributeValues::default().into())));
10464 /// ```
10465 pub fn set_value<
10466 T: std::convert::Into<std::option::Option<crate::model::attribute_values::Value>>,
10467 >(
10468 mut self,
10469 v: T,
10470 ) -> Self {
10471 self.value = v.into();
10472 self
10473 }
10474
10475 /// The value of [value][crate::model::AttributeValues::value]
10476 /// if it holds a `EnumValues`, `None` if the field is not set or
10477 /// holds a different branch.
10478 pub fn enum_values(
10479 &self,
10480 ) -> std::option::Option<&std::boxed::Box<crate::model::attribute_values::EnumAttributeValues>>
10481 {
10482 #[allow(unreachable_patterns)]
10483 self.value.as_ref().and_then(|v| match v {
10484 crate::model::attribute_values::Value::EnumValues(v) => std::option::Option::Some(v),
10485 _ => std::option::Option::None,
10486 })
10487 }
10488
10489 /// Sets the value of [value][crate::model::AttributeValues::value]
10490 /// to hold a `EnumValues`.
10491 ///
10492 /// Note that all the setters affecting `value` are
10493 /// mutually exclusive.
10494 ///
10495 /// # Example
10496 /// ```ignore,no_run
10497 /// # use google_cloud_apihub_v1::model::AttributeValues;
10498 /// use google_cloud_apihub_v1::model::attribute_values::EnumAttributeValues;
10499 /// let x = AttributeValues::new().set_enum_values(EnumAttributeValues::default()/* use setters */);
10500 /// assert!(x.enum_values().is_some());
10501 /// assert!(x.string_values().is_none());
10502 /// assert!(x.json_values().is_none());
10503 /// assert!(x.uri_values().is_none());
10504 /// ```
10505 pub fn set_enum_values<
10506 T: std::convert::Into<std::boxed::Box<crate::model::attribute_values::EnumAttributeValues>>,
10507 >(
10508 mut self,
10509 v: T,
10510 ) -> Self {
10511 self.value =
10512 std::option::Option::Some(crate::model::attribute_values::Value::EnumValues(v.into()));
10513 self
10514 }
10515
10516 /// The value of [value][crate::model::AttributeValues::value]
10517 /// if it holds a `StringValues`, `None` if the field is not set or
10518 /// holds a different branch.
10519 pub fn string_values(
10520 &self,
10521 ) -> std::option::Option<&std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>
10522 {
10523 #[allow(unreachable_patterns)]
10524 self.value.as_ref().and_then(|v| match v {
10525 crate::model::attribute_values::Value::StringValues(v) => std::option::Option::Some(v),
10526 _ => std::option::Option::None,
10527 })
10528 }
10529
10530 /// Sets the value of [value][crate::model::AttributeValues::value]
10531 /// to hold a `StringValues`.
10532 ///
10533 /// Note that all the setters affecting `value` are
10534 /// mutually exclusive.
10535 ///
10536 /// # Example
10537 /// ```ignore,no_run
10538 /// # use google_cloud_apihub_v1::model::AttributeValues;
10539 /// use google_cloud_apihub_v1::model::attribute_values::StringAttributeValues;
10540 /// let x = AttributeValues::new().set_string_values(StringAttributeValues::default()/* use setters */);
10541 /// assert!(x.string_values().is_some());
10542 /// assert!(x.enum_values().is_none());
10543 /// assert!(x.json_values().is_none());
10544 /// assert!(x.uri_values().is_none());
10545 /// ```
10546 pub fn set_string_values<
10547 T: std::convert::Into<std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>,
10548 >(
10549 mut self,
10550 v: T,
10551 ) -> Self {
10552 self.value = std::option::Option::Some(
10553 crate::model::attribute_values::Value::StringValues(v.into()),
10554 );
10555 self
10556 }
10557
10558 /// The value of [value][crate::model::AttributeValues::value]
10559 /// if it holds a `JsonValues`, `None` if the field is not set or
10560 /// holds a different branch.
10561 pub fn json_values(
10562 &self,
10563 ) -> std::option::Option<&std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>
10564 {
10565 #[allow(unreachable_patterns)]
10566 self.value.as_ref().and_then(|v| match v {
10567 crate::model::attribute_values::Value::JsonValues(v) => std::option::Option::Some(v),
10568 _ => std::option::Option::None,
10569 })
10570 }
10571
10572 /// Sets the value of [value][crate::model::AttributeValues::value]
10573 /// to hold a `JsonValues`.
10574 ///
10575 /// Note that all the setters affecting `value` are
10576 /// mutually exclusive.
10577 ///
10578 /// # Example
10579 /// ```ignore,no_run
10580 /// # use google_cloud_apihub_v1::model::AttributeValues;
10581 /// use google_cloud_apihub_v1::model::attribute_values::StringAttributeValues;
10582 /// let x = AttributeValues::new().set_json_values(StringAttributeValues::default()/* use setters */);
10583 /// assert!(x.json_values().is_some());
10584 /// assert!(x.enum_values().is_none());
10585 /// assert!(x.string_values().is_none());
10586 /// assert!(x.uri_values().is_none());
10587 /// ```
10588 pub fn set_json_values<
10589 T: std::convert::Into<std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>,
10590 >(
10591 mut self,
10592 v: T,
10593 ) -> Self {
10594 self.value =
10595 std::option::Option::Some(crate::model::attribute_values::Value::JsonValues(v.into()));
10596 self
10597 }
10598
10599 /// The value of [value][crate::model::AttributeValues::value]
10600 /// if it holds a `UriValues`, `None` if the field is not set or
10601 /// holds a different branch.
10602 pub fn uri_values(
10603 &self,
10604 ) -> std::option::Option<&std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>
10605 {
10606 #[allow(unreachable_patterns)]
10607 self.value.as_ref().and_then(|v| match v {
10608 crate::model::attribute_values::Value::UriValues(v) => std::option::Option::Some(v),
10609 _ => std::option::Option::None,
10610 })
10611 }
10612
10613 /// Sets the value of [value][crate::model::AttributeValues::value]
10614 /// to hold a `UriValues`.
10615 ///
10616 /// Note that all the setters affecting `value` are
10617 /// mutually exclusive.
10618 ///
10619 /// # Example
10620 /// ```ignore,no_run
10621 /// # use google_cloud_apihub_v1::model::AttributeValues;
10622 /// use google_cloud_apihub_v1::model::attribute_values::StringAttributeValues;
10623 /// let x = AttributeValues::new().set_uri_values(StringAttributeValues::default()/* use setters */);
10624 /// assert!(x.uri_values().is_some());
10625 /// assert!(x.enum_values().is_none());
10626 /// assert!(x.string_values().is_none());
10627 /// assert!(x.json_values().is_none());
10628 /// ```
10629 pub fn set_uri_values<
10630 T: std::convert::Into<std::boxed::Box<crate::model::attribute_values::StringAttributeValues>>,
10631 >(
10632 mut self,
10633 v: T,
10634 ) -> Self {
10635 self.value =
10636 std::option::Option::Some(crate::model::attribute_values::Value::UriValues(v.into()));
10637 self
10638 }
10639}
10640
10641impl wkt::message::Message for AttributeValues {
10642 fn typename() -> &'static str {
10643 "type.googleapis.com/google.cloud.apihub.v1.AttributeValues"
10644 }
10645}
10646
10647/// Defines additional types related to [AttributeValues].
10648pub mod attribute_values {
10649 #[allow(unused_imports)]
10650 use super::*;
10651
10652 /// The attribute values of data type enum.
10653 #[derive(Clone, Default, PartialEq)]
10654 #[non_exhaustive]
10655 pub struct EnumAttributeValues {
10656 /// Required. The attribute values in case attribute data type is enum.
10657 pub values: std::vec::Vec<crate::model::attribute::AllowedValue>,
10658
10659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10660 }
10661
10662 impl EnumAttributeValues {
10663 pub fn new() -> Self {
10664 std::default::Default::default()
10665 }
10666
10667 /// Sets the value of [values][crate::model::attribute_values::EnumAttributeValues::values].
10668 ///
10669 /// # Example
10670 /// ```ignore,no_run
10671 /// # use google_cloud_apihub_v1::model::attribute_values::EnumAttributeValues;
10672 /// use google_cloud_apihub_v1::model::attribute::AllowedValue;
10673 /// let x = EnumAttributeValues::new()
10674 /// .set_values([
10675 /// AllowedValue::default()/* use setters */,
10676 /// AllowedValue::default()/* use (different) setters */,
10677 /// ]);
10678 /// ```
10679 pub fn set_values<T, V>(mut self, v: T) -> Self
10680 where
10681 T: std::iter::IntoIterator<Item = V>,
10682 V: std::convert::Into<crate::model::attribute::AllowedValue>,
10683 {
10684 use std::iter::Iterator;
10685 self.values = v.into_iter().map(|i| i.into()).collect();
10686 self
10687 }
10688 }
10689
10690 impl wkt::message::Message for EnumAttributeValues {
10691 fn typename() -> &'static str {
10692 "type.googleapis.com/google.cloud.apihub.v1.AttributeValues.EnumAttributeValues"
10693 }
10694 }
10695
10696 /// The attribute values of data type string or JSON.
10697 #[derive(Clone, Default, PartialEq)]
10698 #[non_exhaustive]
10699 pub struct StringAttributeValues {
10700 /// Required. The attribute values in case attribute data type is string or
10701 /// JSON.
10702 pub values: std::vec::Vec<std::string::String>,
10703
10704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10705 }
10706
10707 impl StringAttributeValues {
10708 pub fn new() -> Self {
10709 std::default::Default::default()
10710 }
10711
10712 /// Sets the value of [values][crate::model::attribute_values::StringAttributeValues::values].
10713 ///
10714 /// # Example
10715 /// ```ignore,no_run
10716 /// # use google_cloud_apihub_v1::model::attribute_values::StringAttributeValues;
10717 /// let x = StringAttributeValues::new().set_values(["a", "b", "c"]);
10718 /// ```
10719 pub fn set_values<T, V>(mut self, v: T) -> Self
10720 where
10721 T: std::iter::IntoIterator<Item = V>,
10722 V: std::convert::Into<std::string::String>,
10723 {
10724 use std::iter::Iterator;
10725 self.values = v.into_iter().map(|i| i.into()).collect();
10726 self
10727 }
10728 }
10729
10730 impl wkt::message::Message for StringAttributeValues {
10731 fn typename() -> &'static str {
10732 "type.googleapis.com/google.cloud.apihub.v1.AttributeValues.StringAttributeValues"
10733 }
10734 }
10735
10736 /// The attribute values associated with the resource.
10737 #[derive(Clone, Debug, PartialEq)]
10738 #[non_exhaustive]
10739 pub enum Value {
10740 /// The attribute values associated with a resource in case attribute data
10741 /// type is enum.
10742 EnumValues(std::boxed::Box<crate::model::attribute_values::EnumAttributeValues>),
10743 /// The attribute values associated with a resource in case attribute data
10744 /// type is string.
10745 StringValues(std::boxed::Box<crate::model::attribute_values::StringAttributeValues>),
10746 /// The attribute values associated with a resource in case attribute data
10747 /// type is JSON.
10748 JsonValues(std::boxed::Box<crate::model::attribute_values::StringAttributeValues>),
10749 /// The attribute values associated with a resource in case attribute data
10750 /// type is URL, URI or IP, like gs://bucket-name/object-name.
10751 UriValues(std::boxed::Box<crate::model::attribute_values::StringAttributeValues>),
10752 }
10753}
10754
10755/// A dependency resource defined in the API hub describes a dependency directed
10756/// from a consumer to a supplier entity. A dependency can be defined between two
10757/// [Operations][google.cloud.apihub.v1.ApiOperation] or between
10758/// an [Operation][google.cloud.apihub.v1.ApiOperation] and [External
10759/// API][google.cloud.apihub.v1.ExternalApi].
10760///
10761/// [google.cloud.apihub.v1.ApiOperation]: crate::model::ApiOperation
10762/// [google.cloud.apihub.v1.ExternalApi]: crate::model::ExternalApi
10763#[derive(Clone, Default, PartialEq)]
10764#[non_exhaustive]
10765pub struct Dependency {
10766 /// Identifier. The name of the dependency in the API Hub.
10767 ///
10768 /// Format: `projects/{project}/locations/{location}/dependencies/{dependency}`
10769 pub name: std::string::String,
10770
10771 /// Required. Immutable. The entity acting as the consumer in the dependency.
10772 pub consumer: std::option::Option<crate::model::DependencyEntityReference>,
10773
10774 /// Required. Immutable. The entity acting as the supplier in the dependency.
10775 pub supplier: std::option::Option<crate::model::DependencyEntityReference>,
10776
10777 /// Output only. State of the dependency.
10778 pub state: crate::model::dependency::State,
10779
10780 /// Optional. Human readable description corresponding of the dependency.
10781 pub description: std::string::String,
10782
10783 /// Output only. Discovery mode of the dependency.
10784 pub discovery_mode: crate::model::dependency::DiscoveryMode,
10785
10786 /// Output only. Error details of a dependency if the system has detected it
10787 /// internally.
10788 pub error_detail: std::option::Option<crate::model::DependencyErrorDetail>,
10789
10790 /// Output only. The time at which the dependency was created.
10791 pub create_time: std::option::Option<wkt::Timestamp>,
10792
10793 /// Output only. The time at which the dependency was last updated.
10794 pub update_time: std::option::Option<wkt::Timestamp>,
10795
10796 /// Optional. The list of user defined attributes associated with the
10797 /// dependency resource. The key is the attribute name. It will be of the
10798 /// format: `projects/{project}/locations/{location}/attributes/{attribute}`.
10799 /// The value is the attribute values associated with the resource.
10800 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
10801
10802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10803}
10804
10805impl Dependency {
10806 pub fn new() -> Self {
10807 std::default::Default::default()
10808 }
10809
10810 /// Sets the value of [name][crate::model::Dependency::name].
10811 ///
10812 /// # Example
10813 /// ```ignore,no_run
10814 /// # use google_cloud_apihub_v1::model::Dependency;
10815 /// let x = Dependency::new().set_name("example");
10816 /// ```
10817 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10818 self.name = v.into();
10819 self
10820 }
10821
10822 /// Sets the value of [consumer][crate::model::Dependency::consumer].
10823 ///
10824 /// # Example
10825 /// ```ignore,no_run
10826 /// # use google_cloud_apihub_v1::model::Dependency;
10827 /// use google_cloud_apihub_v1::model::DependencyEntityReference;
10828 /// let x = Dependency::new().set_consumer(DependencyEntityReference::default()/* use setters */);
10829 /// ```
10830 pub fn set_consumer<T>(mut self, v: T) -> Self
10831 where
10832 T: std::convert::Into<crate::model::DependencyEntityReference>,
10833 {
10834 self.consumer = std::option::Option::Some(v.into());
10835 self
10836 }
10837
10838 /// Sets or clears the value of [consumer][crate::model::Dependency::consumer].
10839 ///
10840 /// # Example
10841 /// ```ignore,no_run
10842 /// # use google_cloud_apihub_v1::model::Dependency;
10843 /// use google_cloud_apihub_v1::model::DependencyEntityReference;
10844 /// let x = Dependency::new().set_or_clear_consumer(Some(DependencyEntityReference::default()/* use setters */));
10845 /// let x = Dependency::new().set_or_clear_consumer(None::<DependencyEntityReference>);
10846 /// ```
10847 pub fn set_or_clear_consumer<T>(mut self, v: std::option::Option<T>) -> Self
10848 where
10849 T: std::convert::Into<crate::model::DependencyEntityReference>,
10850 {
10851 self.consumer = v.map(|x| x.into());
10852 self
10853 }
10854
10855 /// Sets the value of [supplier][crate::model::Dependency::supplier].
10856 ///
10857 /// # Example
10858 /// ```ignore,no_run
10859 /// # use google_cloud_apihub_v1::model::Dependency;
10860 /// use google_cloud_apihub_v1::model::DependencyEntityReference;
10861 /// let x = Dependency::new().set_supplier(DependencyEntityReference::default()/* use setters */);
10862 /// ```
10863 pub fn set_supplier<T>(mut self, v: T) -> Self
10864 where
10865 T: std::convert::Into<crate::model::DependencyEntityReference>,
10866 {
10867 self.supplier = std::option::Option::Some(v.into());
10868 self
10869 }
10870
10871 /// Sets or clears the value of [supplier][crate::model::Dependency::supplier].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_apihub_v1::model::Dependency;
10876 /// use google_cloud_apihub_v1::model::DependencyEntityReference;
10877 /// let x = Dependency::new().set_or_clear_supplier(Some(DependencyEntityReference::default()/* use setters */));
10878 /// let x = Dependency::new().set_or_clear_supplier(None::<DependencyEntityReference>);
10879 /// ```
10880 pub fn set_or_clear_supplier<T>(mut self, v: std::option::Option<T>) -> Self
10881 where
10882 T: std::convert::Into<crate::model::DependencyEntityReference>,
10883 {
10884 self.supplier = v.map(|x| x.into());
10885 self
10886 }
10887
10888 /// Sets the value of [state][crate::model::Dependency::state].
10889 ///
10890 /// # Example
10891 /// ```ignore,no_run
10892 /// # use google_cloud_apihub_v1::model::Dependency;
10893 /// use google_cloud_apihub_v1::model::dependency::State;
10894 /// let x0 = Dependency::new().set_state(State::Proposed);
10895 /// let x1 = Dependency::new().set_state(State::Validated);
10896 /// ```
10897 pub fn set_state<T: std::convert::Into<crate::model::dependency::State>>(
10898 mut self,
10899 v: T,
10900 ) -> Self {
10901 self.state = v.into();
10902 self
10903 }
10904
10905 /// Sets the value of [description][crate::model::Dependency::description].
10906 ///
10907 /// # Example
10908 /// ```ignore,no_run
10909 /// # use google_cloud_apihub_v1::model::Dependency;
10910 /// let x = Dependency::new().set_description("example");
10911 /// ```
10912 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10913 self.description = v.into();
10914 self
10915 }
10916
10917 /// Sets the value of [discovery_mode][crate::model::Dependency::discovery_mode].
10918 ///
10919 /// # Example
10920 /// ```ignore,no_run
10921 /// # use google_cloud_apihub_v1::model::Dependency;
10922 /// use google_cloud_apihub_v1::model::dependency::DiscoveryMode;
10923 /// let x0 = Dependency::new().set_discovery_mode(DiscoveryMode::Manual);
10924 /// ```
10925 pub fn set_discovery_mode<T: std::convert::Into<crate::model::dependency::DiscoveryMode>>(
10926 mut self,
10927 v: T,
10928 ) -> Self {
10929 self.discovery_mode = v.into();
10930 self
10931 }
10932
10933 /// Sets the value of [error_detail][crate::model::Dependency::error_detail].
10934 ///
10935 /// # Example
10936 /// ```ignore,no_run
10937 /// # use google_cloud_apihub_v1::model::Dependency;
10938 /// use google_cloud_apihub_v1::model::DependencyErrorDetail;
10939 /// let x = Dependency::new().set_error_detail(DependencyErrorDetail::default()/* use setters */);
10940 /// ```
10941 pub fn set_error_detail<T>(mut self, v: T) -> Self
10942 where
10943 T: std::convert::Into<crate::model::DependencyErrorDetail>,
10944 {
10945 self.error_detail = std::option::Option::Some(v.into());
10946 self
10947 }
10948
10949 /// Sets or clears the value of [error_detail][crate::model::Dependency::error_detail].
10950 ///
10951 /// # Example
10952 /// ```ignore,no_run
10953 /// # use google_cloud_apihub_v1::model::Dependency;
10954 /// use google_cloud_apihub_v1::model::DependencyErrorDetail;
10955 /// let x = Dependency::new().set_or_clear_error_detail(Some(DependencyErrorDetail::default()/* use setters */));
10956 /// let x = Dependency::new().set_or_clear_error_detail(None::<DependencyErrorDetail>);
10957 /// ```
10958 pub fn set_or_clear_error_detail<T>(mut self, v: std::option::Option<T>) -> Self
10959 where
10960 T: std::convert::Into<crate::model::DependencyErrorDetail>,
10961 {
10962 self.error_detail = v.map(|x| x.into());
10963 self
10964 }
10965
10966 /// Sets the value of [create_time][crate::model::Dependency::create_time].
10967 ///
10968 /// # Example
10969 /// ```ignore,no_run
10970 /// # use google_cloud_apihub_v1::model::Dependency;
10971 /// use wkt::Timestamp;
10972 /// let x = Dependency::new().set_create_time(Timestamp::default()/* use setters */);
10973 /// ```
10974 pub fn set_create_time<T>(mut self, v: T) -> Self
10975 where
10976 T: std::convert::Into<wkt::Timestamp>,
10977 {
10978 self.create_time = std::option::Option::Some(v.into());
10979 self
10980 }
10981
10982 /// Sets or clears the value of [create_time][crate::model::Dependency::create_time].
10983 ///
10984 /// # Example
10985 /// ```ignore,no_run
10986 /// # use google_cloud_apihub_v1::model::Dependency;
10987 /// use wkt::Timestamp;
10988 /// let x = Dependency::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10989 /// let x = Dependency::new().set_or_clear_create_time(None::<Timestamp>);
10990 /// ```
10991 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10992 where
10993 T: std::convert::Into<wkt::Timestamp>,
10994 {
10995 self.create_time = v.map(|x| x.into());
10996 self
10997 }
10998
10999 /// Sets the value of [update_time][crate::model::Dependency::update_time].
11000 ///
11001 /// # Example
11002 /// ```ignore,no_run
11003 /// # use google_cloud_apihub_v1::model::Dependency;
11004 /// use wkt::Timestamp;
11005 /// let x = Dependency::new().set_update_time(Timestamp::default()/* use setters */);
11006 /// ```
11007 pub fn set_update_time<T>(mut self, v: T) -> Self
11008 where
11009 T: std::convert::Into<wkt::Timestamp>,
11010 {
11011 self.update_time = std::option::Option::Some(v.into());
11012 self
11013 }
11014
11015 /// Sets or clears the value of [update_time][crate::model::Dependency::update_time].
11016 ///
11017 /// # Example
11018 /// ```ignore,no_run
11019 /// # use google_cloud_apihub_v1::model::Dependency;
11020 /// use wkt::Timestamp;
11021 /// let x = Dependency::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11022 /// let x = Dependency::new().set_or_clear_update_time(None::<Timestamp>);
11023 /// ```
11024 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11025 where
11026 T: std::convert::Into<wkt::Timestamp>,
11027 {
11028 self.update_time = v.map(|x| x.into());
11029 self
11030 }
11031
11032 /// Sets the value of [attributes][crate::model::Dependency::attributes].
11033 ///
11034 /// # Example
11035 /// ```ignore,no_run
11036 /// # use google_cloud_apihub_v1::model::Dependency;
11037 /// use google_cloud_apihub_v1::model::AttributeValues;
11038 /// let x = Dependency::new().set_attributes([
11039 /// ("key0", AttributeValues::default()/* use setters */),
11040 /// ("key1", AttributeValues::default()/* use (different) setters */),
11041 /// ]);
11042 /// ```
11043 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
11044 where
11045 T: std::iter::IntoIterator<Item = (K, V)>,
11046 K: std::convert::Into<std::string::String>,
11047 V: std::convert::Into<crate::model::AttributeValues>,
11048 {
11049 use std::iter::Iterator;
11050 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11051 self
11052 }
11053}
11054
11055impl wkt::message::Message for Dependency {
11056 fn typename() -> &'static str {
11057 "type.googleapis.com/google.cloud.apihub.v1.Dependency"
11058 }
11059}
11060
11061/// Defines additional types related to [Dependency].
11062pub mod dependency {
11063 #[allow(unused_imports)]
11064 use super::*;
11065
11066 /// Possible states for a dependency.
11067 ///
11068 /// # Working with unknown values
11069 ///
11070 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11071 /// additional enum variants at any time. Adding new variants is not considered
11072 /// a breaking change. Applications should write their code in anticipation of:
11073 ///
11074 /// - New values appearing in future releases of the client library, **and**
11075 /// - New values received dynamically, without application changes.
11076 ///
11077 /// Please consult the [Working with enums] section in the user guide for some
11078 /// guidelines.
11079 ///
11080 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11081 #[derive(Clone, Debug, PartialEq)]
11082 #[non_exhaustive]
11083 pub enum State {
11084 /// Default value. This value is unused.
11085 Unspecified,
11086 /// Dependency will be in a proposed state when it is newly identified by the
11087 /// API hub on its own.
11088 Proposed,
11089 /// Dependency will be in a validated state when it is validated by the
11090 /// admin or manually created in the API hub.
11091 Validated,
11092 /// If set, the enum was initialized with an unknown value.
11093 ///
11094 /// Applications can examine the value using [State::value] or
11095 /// [State::name].
11096 UnknownValue(state::UnknownValue),
11097 }
11098
11099 #[doc(hidden)]
11100 pub mod state {
11101 #[allow(unused_imports)]
11102 use super::*;
11103 #[derive(Clone, Debug, PartialEq)]
11104 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11105 }
11106
11107 impl State {
11108 /// Gets the enum value.
11109 ///
11110 /// Returns `None` if the enum contains an unknown value deserialized from
11111 /// the string representation of enums.
11112 pub fn value(&self) -> std::option::Option<i32> {
11113 match self {
11114 Self::Unspecified => std::option::Option::Some(0),
11115 Self::Proposed => std::option::Option::Some(1),
11116 Self::Validated => std::option::Option::Some(2),
11117 Self::UnknownValue(u) => u.0.value(),
11118 }
11119 }
11120
11121 /// Gets the enum value as a string.
11122 ///
11123 /// Returns `None` if the enum contains an unknown value deserialized from
11124 /// the integer representation of enums.
11125 pub fn name(&self) -> std::option::Option<&str> {
11126 match self {
11127 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11128 Self::Proposed => std::option::Option::Some("PROPOSED"),
11129 Self::Validated => std::option::Option::Some("VALIDATED"),
11130 Self::UnknownValue(u) => u.0.name(),
11131 }
11132 }
11133 }
11134
11135 impl std::default::Default for State {
11136 fn default() -> Self {
11137 use std::convert::From;
11138 Self::from(0)
11139 }
11140 }
11141
11142 impl std::fmt::Display for State {
11143 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11144 wkt::internal::display_enum(f, self.name(), self.value())
11145 }
11146 }
11147
11148 impl std::convert::From<i32> for State {
11149 fn from(value: i32) -> Self {
11150 match value {
11151 0 => Self::Unspecified,
11152 1 => Self::Proposed,
11153 2 => Self::Validated,
11154 _ => Self::UnknownValue(state::UnknownValue(
11155 wkt::internal::UnknownEnumValue::Integer(value),
11156 )),
11157 }
11158 }
11159 }
11160
11161 impl std::convert::From<&str> for State {
11162 fn from(value: &str) -> Self {
11163 use std::string::ToString;
11164 match value {
11165 "STATE_UNSPECIFIED" => Self::Unspecified,
11166 "PROPOSED" => Self::Proposed,
11167 "VALIDATED" => Self::Validated,
11168 _ => Self::UnknownValue(state::UnknownValue(
11169 wkt::internal::UnknownEnumValue::String(value.to_string()),
11170 )),
11171 }
11172 }
11173 }
11174
11175 impl serde::ser::Serialize for State {
11176 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11177 where
11178 S: serde::Serializer,
11179 {
11180 match self {
11181 Self::Unspecified => serializer.serialize_i32(0),
11182 Self::Proposed => serializer.serialize_i32(1),
11183 Self::Validated => serializer.serialize_i32(2),
11184 Self::UnknownValue(u) => u.0.serialize(serializer),
11185 }
11186 }
11187 }
11188
11189 impl<'de> serde::de::Deserialize<'de> for State {
11190 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11191 where
11192 D: serde::Deserializer<'de>,
11193 {
11194 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11195 ".google.cloud.apihub.v1.Dependency.State",
11196 ))
11197 }
11198 }
11199
11200 /// Possible modes of discovering the dependency.
11201 ///
11202 /// # Working with unknown values
11203 ///
11204 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11205 /// additional enum variants at any time. Adding new variants is not considered
11206 /// a breaking change. Applications should write their code in anticipation of:
11207 ///
11208 /// - New values appearing in future releases of the client library, **and**
11209 /// - New values received dynamically, without application changes.
11210 ///
11211 /// Please consult the [Working with enums] section in the user guide for some
11212 /// guidelines.
11213 ///
11214 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11215 #[derive(Clone, Debug, PartialEq)]
11216 #[non_exhaustive]
11217 pub enum DiscoveryMode {
11218 /// Default value. This value is unused.
11219 Unspecified,
11220 /// Manual mode of discovery when the dependency is defined by the user.
11221 Manual,
11222 /// If set, the enum was initialized with an unknown value.
11223 ///
11224 /// Applications can examine the value using [DiscoveryMode::value] or
11225 /// [DiscoveryMode::name].
11226 UnknownValue(discovery_mode::UnknownValue),
11227 }
11228
11229 #[doc(hidden)]
11230 pub mod discovery_mode {
11231 #[allow(unused_imports)]
11232 use super::*;
11233 #[derive(Clone, Debug, PartialEq)]
11234 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11235 }
11236
11237 impl DiscoveryMode {
11238 /// Gets the enum value.
11239 ///
11240 /// Returns `None` if the enum contains an unknown value deserialized from
11241 /// the string representation of enums.
11242 pub fn value(&self) -> std::option::Option<i32> {
11243 match self {
11244 Self::Unspecified => std::option::Option::Some(0),
11245 Self::Manual => std::option::Option::Some(1),
11246 Self::UnknownValue(u) => u.0.value(),
11247 }
11248 }
11249
11250 /// Gets the enum value as a string.
11251 ///
11252 /// Returns `None` if the enum contains an unknown value deserialized from
11253 /// the integer representation of enums.
11254 pub fn name(&self) -> std::option::Option<&str> {
11255 match self {
11256 Self::Unspecified => std::option::Option::Some("DISCOVERY_MODE_UNSPECIFIED"),
11257 Self::Manual => std::option::Option::Some("MANUAL"),
11258 Self::UnknownValue(u) => u.0.name(),
11259 }
11260 }
11261 }
11262
11263 impl std::default::Default for DiscoveryMode {
11264 fn default() -> Self {
11265 use std::convert::From;
11266 Self::from(0)
11267 }
11268 }
11269
11270 impl std::fmt::Display for DiscoveryMode {
11271 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11272 wkt::internal::display_enum(f, self.name(), self.value())
11273 }
11274 }
11275
11276 impl std::convert::From<i32> for DiscoveryMode {
11277 fn from(value: i32) -> Self {
11278 match value {
11279 0 => Self::Unspecified,
11280 1 => Self::Manual,
11281 _ => Self::UnknownValue(discovery_mode::UnknownValue(
11282 wkt::internal::UnknownEnumValue::Integer(value),
11283 )),
11284 }
11285 }
11286 }
11287
11288 impl std::convert::From<&str> for DiscoveryMode {
11289 fn from(value: &str) -> Self {
11290 use std::string::ToString;
11291 match value {
11292 "DISCOVERY_MODE_UNSPECIFIED" => Self::Unspecified,
11293 "MANUAL" => Self::Manual,
11294 _ => Self::UnknownValue(discovery_mode::UnknownValue(
11295 wkt::internal::UnknownEnumValue::String(value.to_string()),
11296 )),
11297 }
11298 }
11299 }
11300
11301 impl serde::ser::Serialize for DiscoveryMode {
11302 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11303 where
11304 S: serde::Serializer,
11305 {
11306 match self {
11307 Self::Unspecified => serializer.serialize_i32(0),
11308 Self::Manual => serializer.serialize_i32(1),
11309 Self::UnknownValue(u) => u.0.serialize(serializer),
11310 }
11311 }
11312 }
11313
11314 impl<'de> serde::de::Deserialize<'de> for DiscoveryMode {
11315 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11316 where
11317 D: serde::Deserializer<'de>,
11318 {
11319 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiscoveryMode>::new(
11320 ".google.cloud.apihub.v1.Dependency.DiscoveryMode",
11321 ))
11322 }
11323 }
11324}
11325
11326/// Reference to an entity participating in a dependency.
11327#[derive(Clone, Default, PartialEq)]
11328#[non_exhaustive]
11329pub struct DependencyEntityReference {
11330 /// Output only. Display name of the entity.
11331 pub display_name: std::string::String,
11332
11333 /// Required. Unique identifier for the participating entity.
11334 pub identifier: std::option::Option<crate::model::dependency_entity_reference::Identifier>,
11335
11336 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11337}
11338
11339impl DependencyEntityReference {
11340 pub fn new() -> Self {
11341 std::default::Default::default()
11342 }
11343
11344 /// Sets the value of [display_name][crate::model::DependencyEntityReference::display_name].
11345 ///
11346 /// # Example
11347 /// ```ignore,no_run
11348 /// # use google_cloud_apihub_v1::model::DependencyEntityReference;
11349 /// let x = DependencyEntityReference::new().set_display_name("example");
11350 /// ```
11351 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11352 self.display_name = v.into();
11353 self
11354 }
11355
11356 /// Sets the value of [identifier][crate::model::DependencyEntityReference::identifier].
11357 ///
11358 /// Note that all the setters affecting `identifier` are mutually
11359 /// exclusive.
11360 ///
11361 /// # Example
11362 /// ```ignore,no_run
11363 /// # use google_cloud_apihub_v1::model::DependencyEntityReference;
11364 /// use google_cloud_apihub_v1::model::dependency_entity_reference::Identifier;
11365 /// let x = DependencyEntityReference::new().set_identifier(Some(Identifier::OperationResourceName("example".to_string())));
11366 /// ```
11367 pub fn set_identifier<
11368 T: std::convert::Into<
11369 std::option::Option<crate::model::dependency_entity_reference::Identifier>,
11370 >,
11371 >(
11372 mut self,
11373 v: T,
11374 ) -> Self {
11375 self.identifier = v.into();
11376 self
11377 }
11378
11379 /// The value of [identifier][crate::model::DependencyEntityReference::identifier]
11380 /// if it holds a `OperationResourceName`, `None` if the field is not set or
11381 /// holds a different branch.
11382 pub fn operation_resource_name(&self) -> std::option::Option<&std::string::String> {
11383 #[allow(unreachable_patterns)]
11384 self.identifier.as_ref().and_then(|v| match v {
11385 crate::model::dependency_entity_reference::Identifier::OperationResourceName(v) => {
11386 std::option::Option::Some(v)
11387 }
11388 _ => std::option::Option::None,
11389 })
11390 }
11391
11392 /// Sets the value of [identifier][crate::model::DependencyEntityReference::identifier]
11393 /// to hold a `OperationResourceName`.
11394 ///
11395 /// Note that all the setters affecting `identifier` are
11396 /// mutually exclusive.
11397 ///
11398 /// # Example
11399 /// ```ignore,no_run
11400 /// # use google_cloud_apihub_v1::model::DependencyEntityReference;
11401 /// let x = DependencyEntityReference::new().set_operation_resource_name("example");
11402 /// assert!(x.operation_resource_name().is_some());
11403 /// assert!(x.external_api_resource_name().is_none());
11404 /// ```
11405 pub fn set_operation_resource_name<T: std::convert::Into<std::string::String>>(
11406 mut self,
11407 v: T,
11408 ) -> Self {
11409 self.identifier = std::option::Option::Some(
11410 crate::model::dependency_entity_reference::Identifier::OperationResourceName(v.into()),
11411 );
11412 self
11413 }
11414
11415 /// The value of [identifier][crate::model::DependencyEntityReference::identifier]
11416 /// if it holds a `ExternalApiResourceName`, `None` if the field is not set or
11417 /// holds a different branch.
11418 pub fn external_api_resource_name(&self) -> std::option::Option<&std::string::String> {
11419 #[allow(unreachable_patterns)]
11420 self.identifier.as_ref().and_then(|v| match v {
11421 crate::model::dependency_entity_reference::Identifier::ExternalApiResourceName(v) => {
11422 std::option::Option::Some(v)
11423 }
11424 _ => std::option::Option::None,
11425 })
11426 }
11427
11428 /// Sets the value of [identifier][crate::model::DependencyEntityReference::identifier]
11429 /// to hold a `ExternalApiResourceName`.
11430 ///
11431 /// Note that all the setters affecting `identifier` are
11432 /// mutually exclusive.
11433 ///
11434 /// # Example
11435 /// ```ignore,no_run
11436 /// # use google_cloud_apihub_v1::model::DependencyEntityReference;
11437 /// let x = DependencyEntityReference::new().set_external_api_resource_name("example");
11438 /// assert!(x.external_api_resource_name().is_some());
11439 /// assert!(x.operation_resource_name().is_none());
11440 /// ```
11441 pub fn set_external_api_resource_name<T: std::convert::Into<std::string::String>>(
11442 mut self,
11443 v: T,
11444 ) -> Self {
11445 self.identifier = std::option::Option::Some(
11446 crate::model::dependency_entity_reference::Identifier::ExternalApiResourceName(
11447 v.into(),
11448 ),
11449 );
11450 self
11451 }
11452}
11453
11454impl wkt::message::Message for DependencyEntityReference {
11455 fn typename() -> &'static str {
11456 "type.googleapis.com/google.cloud.apihub.v1.DependencyEntityReference"
11457 }
11458}
11459
11460/// Defines additional types related to [DependencyEntityReference].
11461pub mod dependency_entity_reference {
11462 #[allow(unused_imports)]
11463 use super::*;
11464
11465 /// Required. Unique identifier for the participating entity.
11466 #[derive(Clone, Debug, PartialEq)]
11467 #[non_exhaustive]
11468 pub enum Identifier {
11469 /// The resource name of an operation in the API Hub.
11470 ///
11471 /// Format:
11472 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
11473 OperationResourceName(std::string::String),
11474 /// The resource name of an external API in the API Hub.
11475 ///
11476 /// Format:
11477 /// `projects/{project}/locations/{location}/externalApis/{external_api}`
11478 ExternalApiResourceName(std::string::String),
11479 }
11480}
11481
11482/// Details describing error condition of a dependency.
11483#[derive(Clone, Default, PartialEq)]
11484#[non_exhaustive]
11485pub struct DependencyErrorDetail {
11486 /// Optional. Error in the dependency.
11487 pub error: crate::model::dependency_error_detail::Error,
11488
11489 /// Optional. Timestamp at which the error was found.
11490 pub error_time: std::option::Option<wkt::Timestamp>,
11491
11492 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11493}
11494
11495impl DependencyErrorDetail {
11496 pub fn new() -> Self {
11497 std::default::Default::default()
11498 }
11499
11500 /// Sets the value of [error][crate::model::DependencyErrorDetail::error].
11501 ///
11502 /// # Example
11503 /// ```ignore,no_run
11504 /// # use google_cloud_apihub_v1::model::DependencyErrorDetail;
11505 /// use google_cloud_apihub_v1::model::dependency_error_detail::Error;
11506 /// let x0 = DependencyErrorDetail::new().set_error(Error::SupplierNotFound);
11507 /// let x1 = DependencyErrorDetail::new().set_error(Error::SupplierRecreated);
11508 /// ```
11509 pub fn set_error<T: std::convert::Into<crate::model::dependency_error_detail::Error>>(
11510 mut self,
11511 v: T,
11512 ) -> Self {
11513 self.error = v.into();
11514 self
11515 }
11516
11517 /// Sets the value of [error_time][crate::model::DependencyErrorDetail::error_time].
11518 ///
11519 /// # Example
11520 /// ```ignore,no_run
11521 /// # use google_cloud_apihub_v1::model::DependencyErrorDetail;
11522 /// use wkt::Timestamp;
11523 /// let x = DependencyErrorDetail::new().set_error_time(Timestamp::default()/* use setters */);
11524 /// ```
11525 pub fn set_error_time<T>(mut self, v: T) -> Self
11526 where
11527 T: std::convert::Into<wkt::Timestamp>,
11528 {
11529 self.error_time = std::option::Option::Some(v.into());
11530 self
11531 }
11532
11533 /// Sets or clears the value of [error_time][crate::model::DependencyErrorDetail::error_time].
11534 ///
11535 /// # Example
11536 /// ```ignore,no_run
11537 /// # use google_cloud_apihub_v1::model::DependencyErrorDetail;
11538 /// use wkt::Timestamp;
11539 /// let x = DependencyErrorDetail::new().set_or_clear_error_time(Some(Timestamp::default()/* use setters */));
11540 /// let x = DependencyErrorDetail::new().set_or_clear_error_time(None::<Timestamp>);
11541 /// ```
11542 pub fn set_or_clear_error_time<T>(mut self, v: std::option::Option<T>) -> Self
11543 where
11544 T: std::convert::Into<wkt::Timestamp>,
11545 {
11546 self.error_time = v.map(|x| x.into());
11547 self
11548 }
11549}
11550
11551impl wkt::message::Message for DependencyErrorDetail {
11552 fn typename() -> &'static str {
11553 "type.googleapis.com/google.cloud.apihub.v1.DependencyErrorDetail"
11554 }
11555}
11556
11557/// Defines additional types related to [DependencyErrorDetail].
11558pub mod dependency_error_detail {
11559 #[allow(unused_imports)]
11560 use super::*;
11561
11562 /// Possible values representing an error in the dependency.
11563 ///
11564 /// # Working with unknown values
11565 ///
11566 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11567 /// additional enum variants at any time. Adding new variants is not considered
11568 /// a breaking change. Applications should write their code in anticipation of:
11569 ///
11570 /// - New values appearing in future releases of the client library, **and**
11571 /// - New values received dynamically, without application changes.
11572 ///
11573 /// Please consult the [Working with enums] section in the user guide for some
11574 /// guidelines.
11575 ///
11576 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11577 #[derive(Clone, Debug, PartialEq)]
11578 #[non_exhaustive]
11579 pub enum Error {
11580 /// Default value used for no error in the dependency.
11581 Unspecified,
11582 /// Supplier entity has been deleted.
11583 SupplierNotFound,
11584 /// Supplier entity has been recreated.
11585 SupplierRecreated,
11586 /// If set, the enum was initialized with an unknown value.
11587 ///
11588 /// Applications can examine the value using [Error::value] or
11589 /// [Error::name].
11590 UnknownValue(error::UnknownValue),
11591 }
11592
11593 #[doc(hidden)]
11594 pub mod error {
11595 #[allow(unused_imports)]
11596 use super::*;
11597 #[derive(Clone, Debug, PartialEq)]
11598 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11599 }
11600
11601 impl Error {
11602 /// Gets the enum value.
11603 ///
11604 /// Returns `None` if the enum contains an unknown value deserialized from
11605 /// the string representation of enums.
11606 pub fn value(&self) -> std::option::Option<i32> {
11607 match self {
11608 Self::Unspecified => std::option::Option::Some(0),
11609 Self::SupplierNotFound => std::option::Option::Some(1),
11610 Self::SupplierRecreated => std::option::Option::Some(2),
11611 Self::UnknownValue(u) => u.0.value(),
11612 }
11613 }
11614
11615 /// Gets the enum value as a string.
11616 ///
11617 /// Returns `None` if the enum contains an unknown value deserialized from
11618 /// the integer representation of enums.
11619 pub fn name(&self) -> std::option::Option<&str> {
11620 match self {
11621 Self::Unspecified => std::option::Option::Some("ERROR_UNSPECIFIED"),
11622 Self::SupplierNotFound => std::option::Option::Some("SUPPLIER_NOT_FOUND"),
11623 Self::SupplierRecreated => std::option::Option::Some("SUPPLIER_RECREATED"),
11624 Self::UnknownValue(u) => u.0.name(),
11625 }
11626 }
11627 }
11628
11629 impl std::default::Default for Error {
11630 fn default() -> Self {
11631 use std::convert::From;
11632 Self::from(0)
11633 }
11634 }
11635
11636 impl std::fmt::Display for Error {
11637 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11638 wkt::internal::display_enum(f, self.name(), self.value())
11639 }
11640 }
11641
11642 impl std::convert::From<i32> for Error {
11643 fn from(value: i32) -> Self {
11644 match value {
11645 0 => Self::Unspecified,
11646 1 => Self::SupplierNotFound,
11647 2 => Self::SupplierRecreated,
11648 _ => Self::UnknownValue(error::UnknownValue(
11649 wkt::internal::UnknownEnumValue::Integer(value),
11650 )),
11651 }
11652 }
11653 }
11654
11655 impl std::convert::From<&str> for Error {
11656 fn from(value: &str) -> Self {
11657 use std::string::ToString;
11658 match value {
11659 "ERROR_UNSPECIFIED" => Self::Unspecified,
11660 "SUPPLIER_NOT_FOUND" => Self::SupplierNotFound,
11661 "SUPPLIER_RECREATED" => Self::SupplierRecreated,
11662 _ => Self::UnknownValue(error::UnknownValue(
11663 wkt::internal::UnknownEnumValue::String(value.to_string()),
11664 )),
11665 }
11666 }
11667 }
11668
11669 impl serde::ser::Serialize for Error {
11670 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11671 where
11672 S: serde::Serializer,
11673 {
11674 match self {
11675 Self::Unspecified => serializer.serialize_i32(0),
11676 Self::SupplierNotFound => serializer.serialize_i32(1),
11677 Self::SupplierRecreated => serializer.serialize_i32(2),
11678 Self::UnknownValue(u) => u.0.serialize(serializer),
11679 }
11680 }
11681 }
11682
11683 impl<'de> serde::de::Deserialize<'de> for Error {
11684 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11685 where
11686 D: serde::Deserializer<'de>,
11687 {
11688 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Error>::new(
11689 ".google.cloud.apihub.v1.DependencyErrorDetail.Error",
11690 ))
11691 }
11692 }
11693}
11694
11695/// LintResponse contains the response from the linter.
11696#[derive(Clone, Default, PartialEq)]
11697#[non_exhaustive]
11698pub struct LintResponse {
11699 /// Optional. Array of issues found in the analyzed document.
11700 pub issues: std::vec::Vec<crate::model::Issue>,
11701
11702 /// Optional. Summary of all issue types and counts for each severity level.
11703 pub summary: std::vec::Vec<crate::model::lint_response::SummaryEntry>,
11704
11705 /// Required. Lint state represents success or failure for linting.
11706 pub state: crate::model::LintState,
11707
11708 /// Required. Name of the linting application.
11709 pub source: std::string::String,
11710
11711 /// Required. Name of the linter used.
11712 pub linter: crate::model::Linter,
11713
11714 /// Required. Timestamp when the linting response was generated.
11715 pub create_time: std::option::Option<wkt::Timestamp>,
11716
11717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11718}
11719
11720impl LintResponse {
11721 pub fn new() -> Self {
11722 std::default::Default::default()
11723 }
11724
11725 /// Sets the value of [issues][crate::model::LintResponse::issues].
11726 ///
11727 /// # Example
11728 /// ```ignore,no_run
11729 /// # use google_cloud_apihub_v1::model::LintResponse;
11730 /// use google_cloud_apihub_v1::model::Issue;
11731 /// let x = LintResponse::new()
11732 /// .set_issues([
11733 /// Issue::default()/* use setters */,
11734 /// Issue::default()/* use (different) setters */,
11735 /// ]);
11736 /// ```
11737 pub fn set_issues<T, V>(mut self, v: T) -> Self
11738 where
11739 T: std::iter::IntoIterator<Item = V>,
11740 V: std::convert::Into<crate::model::Issue>,
11741 {
11742 use std::iter::Iterator;
11743 self.issues = v.into_iter().map(|i| i.into()).collect();
11744 self
11745 }
11746
11747 /// Sets the value of [summary][crate::model::LintResponse::summary].
11748 ///
11749 /// # Example
11750 /// ```ignore,no_run
11751 /// # use google_cloud_apihub_v1::model::LintResponse;
11752 /// use google_cloud_apihub_v1::model::lint_response::SummaryEntry;
11753 /// let x = LintResponse::new()
11754 /// .set_summary([
11755 /// SummaryEntry::default()/* use setters */,
11756 /// SummaryEntry::default()/* use (different) setters */,
11757 /// ]);
11758 /// ```
11759 pub fn set_summary<T, V>(mut self, v: T) -> Self
11760 where
11761 T: std::iter::IntoIterator<Item = V>,
11762 V: std::convert::Into<crate::model::lint_response::SummaryEntry>,
11763 {
11764 use std::iter::Iterator;
11765 self.summary = v.into_iter().map(|i| i.into()).collect();
11766 self
11767 }
11768
11769 /// Sets the value of [state][crate::model::LintResponse::state].
11770 ///
11771 /// # Example
11772 /// ```ignore,no_run
11773 /// # use google_cloud_apihub_v1::model::LintResponse;
11774 /// use google_cloud_apihub_v1::model::LintState;
11775 /// let x0 = LintResponse::new().set_state(LintState::Success);
11776 /// let x1 = LintResponse::new().set_state(LintState::Error);
11777 /// ```
11778 pub fn set_state<T: std::convert::Into<crate::model::LintState>>(mut self, v: T) -> Self {
11779 self.state = v.into();
11780 self
11781 }
11782
11783 /// Sets the value of [source][crate::model::LintResponse::source].
11784 ///
11785 /// # Example
11786 /// ```ignore,no_run
11787 /// # use google_cloud_apihub_v1::model::LintResponse;
11788 /// let x = LintResponse::new().set_source("example");
11789 /// ```
11790 pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11791 self.source = v.into();
11792 self
11793 }
11794
11795 /// Sets the value of [linter][crate::model::LintResponse::linter].
11796 ///
11797 /// # Example
11798 /// ```ignore,no_run
11799 /// # use google_cloud_apihub_v1::model::LintResponse;
11800 /// use google_cloud_apihub_v1::model::Linter;
11801 /// let x0 = LintResponse::new().set_linter(Linter::Spectral);
11802 /// let x1 = LintResponse::new().set_linter(Linter::Other);
11803 /// ```
11804 pub fn set_linter<T: std::convert::Into<crate::model::Linter>>(mut self, v: T) -> Self {
11805 self.linter = v.into();
11806 self
11807 }
11808
11809 /// Sets the value of [create_time][crate::model::LintResponse::create_time].
11810 ///
11811 /// # Example
11812 /// ```ignore,no_run
11813 /// # use google_cloud_apihub_v1::model::LintResponse;
11814 /// use wkt::Timestamp;
11815 /// let x = LintResponse::new().set_create_time(Timestamp::default()/* use setters */);
11816 /// ```
11817 pub fn set_create_time<T>(mut self, v: T) -> Self
11818 where
11819 T: std::convert::Into<wkt::Timestamp>,
11820 {
11821 self.create_time = std::option::Option::Some(v.into());
11822 self
11823 }
11824
11825 /// Sets or clears the value of [create_time][crate::model::LintResponse::create_time].
11826 ///
11827 /// # Example
11828 /// ```ignore,no_run
11829 /// # use google_cloud_apihub_v1::model::LintResponse;
11830 /// use wkt::Timestamp;
11831 /// let x = LintResponse::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11832 /// let x = LintResponse::new().set_or_clear_create_time(None::<Timestamp>);
11833 /// ```
11834 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11835 where
11836 T: std::convert::Into<wkt::Timestamp>,
11837 {
11838 self.create_time = v.map(|x| x.into());
11839 self
11840 }
11841}
11842
11843impl wkt::message::Message for LintResponse {
11844 fn typename() -> &'static str {
11845 "type.googleapis.com/google.cloud.apihub.v1.LintResponse"
11846 }
11847}
11848
11849/// Defines additional types related to [LintResponse].
11850pub mod lint_response {
11851 #[allow(unused_imports)]
11852 use super::*;
11853
11854 /// Count of issues with a given severity.
11855 #[derive(Clone, Default, PartialEq)]
11856 #[non_exhaustive]
11857 pub struct SummaryEntry {
11858 /// Required. Severity of the issue.
11859 pub severity: crate::model::Severity,
11860
11861 /// Required. Count of issues with the given severity.
11862 pub count: i32,
11863
11864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11865 }
11866
11867 impl SummaryEntry {
11868 pub fn new() -> Self {
11869 std::default::Default::default()
11870 }
11871
11872 /// Sets the value of [severity][crate::model::lint_response::SummaryEntry::severity].
11873 ///
11874 /// # Example
11875 /// ```ignore,no_run
11876 /// # use google_cloud_apihub_v1::model::lint_response::SummaryEntry;
11877 /// use google_cloud_apihub_v1::model::Severity;
11878 /// let x0 = SummaryEntry::new().set_severity(Severity::Error);
11879 /// let x1 = SummaryEntry::new().set_severity(Severity::Warning);
11880 /// let x2 = SummaryEntry::new().set_severity(Severity::Info);
11881 /// ```
11882 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
11883 self.severity = v.into();
11884 self
11885 }
11886
11887 /// Sets the value of [count][crate::model::lint_response::SummaryEntry::count].
11888 ///
11889 /// # Example
11890 /// ```ignore,no_run
11891 /// # use google_cloud_apihub_v1::model::lint_response::SummaryEntry;
11892 /// let x = SummaryEntry::new().set_count(42);
11893 /// ```
11894 pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11895 self.count = v.into();
11896 self
11897 }
11898 }
11899
11900 impl wkt::message::Message for SummaryEntry {
11901 fn typename() -> &'static str {
11902 "type.googleapis.com/google.cloud.apihub.v1.LintResponse.SummaryEntry"
11903 }
11904 }
11905}
11906
11907/// Issue contains the details of a single issue found by the linter.
11908#[derive(Clone, Default, PartialEq)]
11909#[non_exhaustive]
11910pub struct Issue {
11911 /// Required. Rule code unique to each rule defined in linter.
11912 pub code: std::string::String,
11913
11914 /// Required. An array of strings indicating the location in the analyzed
11915 /// document where the rule was triggered.
11916 pub path: std::vec::Vec<std::string::String>,
11917
11918 /// Required. Human-readable message describing the issue found by the linter.
11919 pub message: std::string::String,
11920
11921 /// Required. Severity level of the rule violation.
11922 pub severity: crate::model::Severity,
11923
11924 /// Required. Object describing where in the file the issue was found.
11925 pub range: std::option::Option<crate::model::Range>,
11926
11927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11928}
11929
11930impl Issue {
11931 pub fn new() -> Self {
11932 std::default::Default::default()
11933 }
11934
11935 /// Sets the value of [code][crate::model::Issue::code].
11936 ///
11937 /// # Example
11938 /// ```ignore,no_run
11939 /// # use google_cloud_apihub_v1::model::Issue;
11940 /// let x = Issue::new().set_code("example");
11941 /// ```
11942 pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11943 self.code = v.into();
11944 self
11945 }
11946
11947 /// Sets the value of [path][crate::model::Issue::path].
11948 ///
11949 /// # Example
11950 /// ```ignore,no_run
11951 /// # use google_cloud_apihub_v1::model::Issue;
11952 /// let x = Issue::new().set_path(["a", "b", "c"]);
11953 /// ```
11954 pub fn set_path<T, V>(mut self, v: T) -> Self
11955 where
11956 T: std::iter::IntoIterator<Item = V>,
11957 V: std::convert::Into<std::string::String>,
11958 {
11959 use std::iter::Iterator;
11960 self.path = v.into_iter().map(|i| i.into()).collect();
11961 self
11962 }
11963
11964 /// Sets the value of [message][crate::model::Issue::message].
11965 ///
11966 /// # Example
11967 /// ```ignore,no_run
11968 /// # use google_cloud_apihub_v1::model::Issue;
11969 /// let x = Issue::new().set_message("example");
11970 /// ```
11971 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11972 self.message = v.into();
11973 self
11974 }
11975
11976 /// Sets the value of [severity][crate::model::Issue::severity].
11977 ///
11978 /// # Example
11979 /// ```ignore,no_run
11980 /// # use google_cloud_apihub_v1::model::Issue;
11981 /// use google_cloud_apihub_v1::model::Severity;
11982 /// let x0 = Issue::new().set_severity(Severity::Error);
11983 /// let x1 = Issue::new().set_severity(Severity::Warning);
11984 /// let x2 = Issue::new().set_severity(Severity::Info);
11985 /// ```
11986 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
11987 self.severity = v.into();
11988 self
11989 }
11990
11991 /// Sets the value of [range][crate::model::Issue::range].
11992 ///
11993 /// # Example
11994 /// ```ignore,no_run
11995 /// # use google_cloud_apihub_v1::model::Issue;
11996 /// use google_cloud_apihub_v1::model::Range;
11997 /// let x = Issue::new().set_range(Range::default()/* use setters */);
11998 /// ```
11999 pub fn set_range<T>(mut self, v: T) -> Self
12000 where
12001 T: std::convert::Into<crate::model::Range>,
12002 {
12003 self.range = std::option::Option::Some(v.into());
12004 self
12005 }
12006
12007 /// Sets or clears the value of [range][crate::model::Issue::range].
12008 ///
12009 /// # Example
12010 /// ```ignore,no_run
12011 /// # use google_cloud_apihub_v1::model::Issue;
12012 /// use google_cloud_apihub_v1::model::Range;
12013 /// let x = Issue::new().set_or_clear_range(Some(Range::default()/* use setters */));
12014 /// let x = Issue::new().set_or_clear_range(None::<Range>);
12015 /// ```
12016 pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
12017 where
12018 T: std::convert::Into<crate::model::Range>,
12019 {
12020 self.range = v.map(|x| x.into());
12021 self
12022 }
12023}
12024
12025impl wkt::message::Message for Issue {
12026 fn typename() -> &'static str {
12027 "type.googleapis.com/google.cloud.apihub.v1.Issue"
12028 }
12029}
12030
12031/// Object describing where in the file the issue was found.
12032#[derive(Clone, Default, PartialEq)]
12033#[non_exhaustive]
12034pub struct Range {
12035 /// Required. Start of the issue.
12036 pub start: std::option::Option<crate::model::Point>,
12037
12038 /// Required. End of the issue.
12039 pub end: std::option::Option<crate::model::Point>,
12040
12041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12042}
12043
12044impl Range {
12045 pub fn new() -> Self {
12046 std::default::Default::default()
12047 }
12048
12049 /// Sets the value of [start][crate::model::Range::start].
12050 ///
12051 /// # Example
12052 /// ```ignore,no_run
12053 /// # use google_cloud_apihub_v1::model::Range;
12054 /// use google_cloud_apihub_v1::model::Point;
12055 /// let x = Range::new().set_start(Point::default()/* use setters */);
12056 /// ```
12057 pub fn set_start<T>(mut self, v: T) -> Self
12058 where
12059 T: std::convert::Into<crate::model::Point>,
12060 {
12061 self.start = std::option::Option::Some(v.into());
12062 self
12063 }
12064
12065 /// Sets or clears the value of [start][crate::model::Range::start].
12066 ///
12067 /// # Example
12068 /// ```ignore,no_run
12069 /// # use google_cloud_apihub_v1::model::Range;
12070 /// use google_cloud_apihub_v1::model::Point;
12071 /// let x = Range::new().set_or_clear_start(Some(Point::default()/* use setters */));
12072 /// let x = Range::new().set_or_clear_start(None::<Point>);
12073 /// ```
12074 pub fn set_or_clear_start<T>(mut self, v: std::option::Option<T>) -> Self
12075 where
12076 T: std::convert::Into<crate::model::Point>,
12077 {
12078 self.start = v.map(|x| x.into());
12079 self
12080 }
12081
12082 /// Sets the value of [end][crate::model::Range::end].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_cloud_apihub_v1::model::Range;
12087 /// use google_cloud_apihub_v1::model::Point;
12088 /// let x = Range::new().set_end(Point::default()/* use setters */);
12089 /// ```
12090 pub fn set_end<T>(mut self, v: T) -> Self
12091 where
12092 T: std::convert::Into<crate::model::Point>,
12093 {
12094 self.end = std::option::Option::Some(v.into());
12095 self
12096 }
12097
12098 /// Sets or clears the value of [end][crate::model::Range::end].
12099 ///
12100 /// # Example
12101 /// ```ignore,no_run
12102 /// # use google_cloud_apihub_v1::model::Range;
12103 /// use google_cloud_apihub_v1::model::Point;
12104 /// let x = Range::new().set_or_clear_end(Some(Point::default()/* use setters */));
12105 /// let x = Range::new().set_or_clear_end(None::<Point>);
12106 /// ```
12107 pub fn set_or_clear_end<T>(mut self, v: std::option::Option<T>) -> Self
12108 where
12109 T: std::convert::Into<crate::model::Point>,
12110 {
12111 self.end = v.map(|x| x.into());
12112 self
12113 }
12114}
12115
12116impl wkt::message::Message for Range {
12117 fn typename() -> &'static str {
12118 "type.googleapis.com/google.cloud.apihub.v1.Range"
12119 }
12120}
12121
12122/// Point within the file (line and character).
12123#[derive(Clone, Default, PartialEq)]
12124#[non_exhaustive]
12125pub struct Point {
12126 /// Required. Line number (zero-indexed).
12127 pub line: i32,
12128
12129 /// Required. Character position within the line (zero-indexed).
12130 pub character: i32,
12131
12132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12133}
12134
12135impl Point {
12136 pub fn new() -> Self {
12137 std::default::Default::default()
12138 }
12139
12140 /// Sets the value of [line][crate::model::Point::line].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_apihub_v1::model::Point;
12145 /// let x = Point::new().set_line(42);
12146 /// ```
12147 pub fn set_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12148 self.line = v.into();
12149 self
12150 }
12151
12152 /// Sets the value of [character][crate::model::Point::character].
12153 ///
12154 /// # Example
12155 /// ```ignore,no_run
12156 /// # use google_cloud_apihub_v1::model::Point;
12157 /// let x = Point::new().set_character(42);
12158 /// ```
12159 pub fn set_character<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12160 self.character = v.into();
12161 self
12162 }
12163}
12164
12165impl wkt::message::Message for Point {
12166 fn typename() -> &'static str {
12167 "type.googleapis.com/google.cloud.apihub.v1.Point"
12168 }
12169}
12170
12171/// Represents the metadata of the long-running operation.
12172#[derive(Clone, Default, PartialEq)]
12173#[non_exhaustive]
12174pub struct OperationMetadata {
12175 /// Output only. The time the operation was created.
12176 pub create_time: std::option::Option<wkt::Timestamp>,
12177
12178 /// Output only. The time the operation finished running.
12179 pub end_time: std::option::Option<wkt::Timestamp>,
12180
12181 /// Output only. Server-defined resource path for the target of the operation.
12182 pub target: std::string::String,
12183
12184 /// Output only. Name of the verb executed by the operation.
12185 pub verb: std::string::String,
12186
12187 /// Output only. Human-readable status of the operation, if any.
12188 pub status_message: std::string::String,
12189
12190 /// Output only. Identifies whether the user has requested cancellation
12191 /// of the operation. Operations that have been cancelled successfully
12192 /// have [Operation.error][google.longrunning.Operation.error] value with a
12193 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
12194 /// `Code.CANCELLED`.
12195 ///
12196 /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
12197 /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
12198 pub requested_cancellation: bool,
12199
12200 /// Output only. API version used to start the operation.
12201 pub api_version: std::string::String,
12202
12203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12204}
12205
12206impl OperationMetadata {
12207 pub fn new() -> Self {
12208 std::default::Default::default()
12209 }
12210
12211 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
12212 ///
12213 /// # Example
12214 /// ```ignore,no_run
12215 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12216 /// use wkt::Timestamp;
12217 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12218 /// ```
12219 pub fn set_create_time<T>(mut self, v: T) -> Self
12220 where
12221 T: std::convert::Into<wkt::Timestamp>,
12222 {
12223 self.create_time = std::option::Option::Some(v.into());
12224 self
12225 }
12226
12227 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
12228 ///
12229 /// # Example
12230 /// ```ignore,no_run
12231 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12232 /// use wkt::Timestamp;
12233 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12234 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12235 /// ```
12236 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12237 where
12238 T: std::convert::Into<wkt::Timestamp>,
12239 {
12240 self.create_time = v.map(|x| x.into());
12241 self
12242 }
12243
12244 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
12245 ///
12246 /// # Example
12247 /// ```ignore,no_run
12248 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12249 /// use wkt::Timestamp;
12250 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
12251 /// ```
12252 pub fn set_end_time<T>(mut self, v: T) -> Self
12253 where
12254 T: std::convert::Into<wkt::Timestamp>,
12255 {
12256 self.end_time = std::option::Option::Some(v.into());
12257 self
12258 }
12259
12260 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
12261 ///
12262 /// # Example
12263 /// ```ignore,no_run
12264 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12265 /// use wkt::Timestamp;
12266 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
12267 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
12268 /// ```
12269 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
12270 where
12271 T: std::convert::Into<wkt::Timestamp>,
12272 {
12273 self.end_time = v.map(|x| x.into());
12274 self
12275 }
12276
12277 /// Sets the value of [target][crate::model::OperationMetadata::target].
12278 ///
12279 /// # Example
12280 /// ```ignore,no_run
12281 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12282 /// let x = OperationMetadata::new().set_target("example");
12283 /// ```
12284 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12285 self.target = v.into();
12286 self
12287 }
12288
12289 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
12290 ///
12291 /// # Example
12292 /// ```ignore,no_run
12293 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12294 /// let x = OperationMetadata::new().set_verb("example");
12295 /// ```
12296 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12297 self.verb = v.into();
12298 self
12299 }
12300
12301 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
12302 ///
12303 /// # Example
12304 /// ```ignore,no_run
12305 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12306 /// let x = OperationMetadata::new().set_status_message("example");
12307 /// ```
12308 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12309 self.status_message = v.into();
12310 self
12311 }
12312
12313 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
12314 ///
12315 /// # Example
12316 /// ```ignore,no_run
12317 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12318 /// let x = OperationMetadata::new().set_requested_cancellation(true);
12319 /// ```
12320 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12321 self.requested_cancellation = v.into();
12322 self
12323 }
12324
12325 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
12326 ///
12327 /// # Example
12328 /// ```ignore,no_run
12329 /// # use google_cloud_apihub_v1::model::OperationMetadata;
12330 /// let x = OperationMetadata::new().set_api_version("example");
12331 /// ```
12332 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12333 self.api_version = v.into();
12334 self
12335 }
12336}
12337
12338impl wkt::message::Message for OperationMetadata {
12339 fn typename() -> &'static str {
12340 "type.googleapis.com/google.cloud.apihub.v1.OperationMetadata"
12341 }
12342}
12343
12344/// An ApiHubInstance represents the instance resources of the API Hub.
12345/// Currently, only one ApiHub instance is allowed for each project.
12346#[derive(Clone, Default, PartialEq)]
12347#[non_exhaustive]
12348pub struct ApiHubInstance {
12349 /// Identifier. Format:
12350 /// `projects/{project}/locations/{location}/apiHubInstances/{apiHubInstance}`.
12351 pub name: std::string::String,
12352
12353 /// Output only. Creation timestamp.
12354 pub create_time: std::option::Option<wkt::Timestamp>,
12355
12356 /// Output only. Last update timestamp.
12357 pub update_time: std::option::Option<wkt::Timestamp>,
12358
12359 /// Output only. The current state of the ApiHub instance.
12360 pub state: crate::model::api_hub_instance::State,
12361
12362 /// Output only. Extra information about ApiHub instance state. Currently the
12363 /// message would be populated when state is `FAILED`.
12364 pub state_message: std::string::String,
12365
12366 /// Required. Config of the ApiHub instance.
12367 pub config: std::option::Option<crate::model::api_hub_instance::Config>,
12368
12369 /// Optional. Instance labels to represent user-provided metadata.
12370 /// Refer to cloud documentation on labels for more details.
12371 /// <https://cloud.google.com/compute/docs/labeling-resources>
12372 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12373
12374 /// Optional. Description of the ApiHub instance.
12375 pub description: std::string::String,
12376
12377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12378}
12379
12380impl ApiHubInstance {
12381 pub fn new() -> Self {
12382 std::default::Default::default()
12383 }
12384
12385 /// Sets the value of [name][crate::model::ApiHubInstance::name].
12386 ///
12387 /// # Example
12388 /// ```ignore,no_run
12389 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12390 /// let x = ApiHubInstance::new().set_name("example");
12391 /// ```
12392 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12393 self.name = v.into();
12394 self
12395 }
12396
12397 /// Sets the value of [create_time][crate::model::ApiHubInstance::create_time].
12398 ///
12399 /// # Example
12400 /// ```ignore,no_run
12401 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12402 /// use wkt::Timestamp;
12403 /// let x = ApiHubInstance::new().set_create_time(Timestamp::default()/* use setters */);
12404 /// ```
12405 pub fn set_create_time<T>(mut self, v: T) -> Self
12406 where
12407 T: std::convert::Into<wkt::Timestamp>,
12408 {
12409 self.create_time = std::option::Option::Some(v.into());
12410 self
12411 }
12412
12413 /// Sets or clears the value of [create_time][crate::model::ApiHubInstance::create_time].
12414 ///
12415 /// # Example
12416 /// ```ignore,no_run
12417 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12418 /// use wkt::Timestamp;
12419 /// let x = ApiHubInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12420 /// let x = ApiHubInstance::new().set_or_clear_create_time(None::<Timestamp>);
12421 /// ```
12422 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12423 where
12424 T: std::convert::Into<wkt::Timestamp>,
12425 {
12426 self.create_time = v.map(|x| x.into());
12427 self
12428 }
12429
12430 /// Sets the value of [update_time][crate::model::ApiHubInstance::update_time].
12431 ///
12432 /// # Example
12433 /// ```ignore,no_run
12434 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12435 /// use wkt::Timestamp;
12436 /// let x = ApiHubInstance::new().set_update_time(Timestamp::default()/* use setters */);
12437 /// ```
12438 pub fn set_update_time<T>(mut self, v: T) -> Self
12439 where
12440 T: std::convert::Into<wkt::Timestamp>,
12441 {
12442 self.update_time = std::option::Option::Some(v.into());
12443 self
12444 }
12445
12446 /// Sets or clears the value of [update_time][crate::model::ApiHubInstance::update_time].
12447 ///
12448 /// # Example
12449 /// ```ignore,no_run
12450 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12451 /// use wkt::Timestamp;
12452 /// let x = ApiHubInstance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12453 /// let x = ApiHubInstance::new().set_or_clear_update_time(None::<Timestamp>);
12454 /// ```
12455 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12456 where
12457 T: std::convert::Into<wkt::Timestamp>,
12458 {
12459 self.update_time = v.map(|x| x.into());
12460 self
12461 }
12462
12463 /// Sets the value of [state][crate::model::ApiHubInstance::state].
12464 ///
12465 /// # Example
12466 /// ```ignore,no_run
12467 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12468 /// use google_cloud_apihub_v1::model::api_hub_instance::State;
12469 /// let x0 = ApiHubInstance::new().set_state(State::Inactive);
12470 /// let x1 = ApiHubInstance::new().set_state(State::Creating);
12471 /// let x2 = ApiHubInstance::new().set_state(State::Active);
12472 /// ```
12473 pub fn set_state<T: std::convert::Into<crate::model::api_hub_instance::State>>(
12474 mut self,
12475 v: T,
12476 ) -> Self {
12477 self.state = v.into();
12478 self
12479 }
12480
12481 /// Sets the value of [state_message][crate::model::ApiHubInstance::state_message].
12482 ///
12483 /// # Example
12484 /// ```ignore,no_run
12485 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12486 /// let x = ApiHubInstance::new().set_state_message("example");
12487 /// ```
12488 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12489 self.state_message = v.into();
12490 self
12491 }
12492
12493 /// Sets the value of [config][crate::model::ApiHubInstance::config].
12494 ///
12495 /// # Example
12496 /// ```ignore,no_run
12497 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12498 /// use google_cloud_apihub_v1::model::api_hub_instance::Config;
12499 /// let x = ApiHubInstance::new().set_config(Config::default()/* use setters */);
12500 /// ```
12501 pub fn set_config<T>(mut self, v: T) -> Self
12502 where
12503 T: std::convert::Into<crate::model::api_hub_instance::Config>,
12504 {
12505 self.config = std::option::Option::Some(v.into());
12506 self
12507 }
12508
12509 /// Sets or clears the value of [config][crate::model::ApiHubInstance::config].
12510 ///
12511 /// # Example
12512 /// ```ignore,no_run
12513 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12514 /// use google_cloud_apihub_v1::model::api_hub_instance::Config;
12515 /// let x = ApiHubInstance::new().set_or_clear_config(Some(Config::default()/* use setters */));
12516 /// let x = ApiHubInstance::new().set_or_clear_config(None::<Config>);
12517 /// ```
12518 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
12519 where
12520 T: std::convert::Into<crate::model::api_hub_instance::Config>,
12521 {
12522 self.config = v.map(|x| x.into());
12523 self
12524 }
12525
12526 /// Sets the value of [labels][crate::model::ApiHubInstance::labels].
12527 ///
12528 /// # Example
12529 /// ```ignore,no_run
12530 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12531 /// let x = ApiHubInstance::new().set_labels([
12532 /// ("key0", "abc"),
12533 /// ("key1", "xyz"),
12534 /// ]);
12535 /// ```
12536 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12537 where
12538 T: std::iter::IntoIterator<Item = (K, V)>,
12539 K: std::convert::Into<std::string::String>,
12540 V: std::convert::Into<std::string::String>,
12541 {
12542 use std::iter::Iterator;
12543 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12544 self
12545 }
12546
12547 /// Sets the value of [description][crate::model::ApiHubInstance::description].
12548 ///
12549 /// # Example
12550 /// ```ignore,no_run
12551 /// # use google_cloud_apihub_v1::model::ApiHubInstance;
12552 /// let x = ApiHubInstance::new().set_description("example");
12553 /// ```
12554 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12555 self.description = v.into();
12556 self
12557 }
12558}
12559
12560impl wkt::message::Message for ApiHubInstance {
12561 fn typename() -> &'static str {
12562 "type.googleapis.com/google.cloud.apihub.v1.ApiHubInstance"
12563 }
12564}
12565
12566/// Defines additional types related to [ApiHubInstance].
12567pub mod api_hub_instance {
12568 #[allow(unused_imports)]
12569 use super::*;
12570
12571 /// Available configurations to provision an ApiHub Instance.
12572 #[derive(Clone, Default, PartialEq)]
12573 #[non_exhaustive]
12574 pub struct Config {
12575 /// Optional. The Customer Managed Encryption Key (CMEK) used for data
12576 /// encryption. The CMEK name should follow the format of
12577 /// `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`,
12578 /// where the location must match the instance location.
12579 /// If the CMEK is not provided, a GMEK will be created for the instance.
12580 pub cmek_key_name: std::string::String,
12581
12582 /// Optional. If true, the search will be disabled for the instance. The
12583 /// default value is false.
12584 pub disable_search: bool,
12585
12586 /// Optional. The name of the Vertex AI location where the data store is
12587 /// stored.
12588 pub vertex_location: std::string::String,
12589
12590 /// Optional. Encryption type for the region. If the encryption type is CMEK,
12591 /// the cmek_key_name must be provided. If no encryption type is provided,
12592 /// GMEK will be used.
12593 pub encryption_type: crate::model::api_hub_instance::config::EncryptionType,
12594
12595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12596 }
12597
12598 impl Config {
12599 pub fn new() -> Self {
12600 std::default::Default::default()
12601 }
12602
12603 /// Sets the value of [cmek_key_name][crate::model::api_hub_instance::Config::cmek_key_name].
12604 ///
12605 /// # Example
12606 /// ```ignore,no_run
12607 /// # use google_cloud_apihub_v1::model::api_hub_instance::Config;
12608 /// let x = Config::new().set_cmek_key_name("example");
12609 /// ```
12610 pub fn set_cmek_key_name<T: std::convert::Into<std::string::String>>(
12611 mut self,
12612 v: T,
12613 ) -> Self {
12614 self.cmek_key_name = v.into();
12615 self
12616 }
12617
12618 /// Sets the value of [disable_search][crate::model::api_hub_instance::Config::disable_search].
12619 ///
12620 /// # Example
12621 /// ```ignore,no_run
12622 /// # use google_cloud_apihub_v1::model::api_hub_instance::Config;
12623 /// let x = Config::new().set_disable_search(true);
12624 /// ```
12625 pub fn set_disable_search<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12626 self.disable_search = v.into();
12627 self
12628 }
12629
12630 /// Sets the value of [vertex_location][crate::model::api_hub_instance::Config::vertex_location].
12631 ///
12632 /// # Example
12633 /// ```ignore,no_run
12634 /// # use google_cloud_apihub_v1::model::api_hub_instance::Config;
12635 /// let x = Config::new().set_vertex_location("example");
12636 /// ```
12637 pub fn set_vertex_location<T: std::convert::Into<std::string::String>>(
12638 mut self,
12639 v: T,
12640 ) -> Self {
12641 self.vertex_location = v.into();
12642 self
12643 }
12644
12645 /// Sets the value of [encryption_type][crate::model::api_hub_instance::Config::encryption_type].
12646 ///
12647 /// # Example
12648 /// ```ignore,no_run
12649 /// # use google_cloud_apihub_v1::model::api_hub_instance::Config;
12650 /// use google_cloud_apihub_v1::model::api_hub_instance::config::EncryptionType;
12651 /// let x0 = Config::new().set_encryption_type(EncryptionType::Gmek);
12652 /// let x1 = Config::new().set_encryption_type(EncryptionType::Cmek);
12653 /// ```
12654 pub fn set_encryption_type<
12655 T: std::convert::Into<crate::model::api_hub_instance::config::EncryptionType>,
12656 >(
12657 mut self,
12658 v: T,
12659 ) -> Self {
12660 self.encryption_type = v.into();
12661 self
12662 }
12663 }
12664
12665 impl wkt::message::Message for Config {
12666 fn typename() -> &'static str {
12667 "type.googleapis.com/google.cloud.apihub.v1.ApiHubInstance.Config"
12668 }
12669 }
12670
12671 /// Defines additional types related to [Config].
12672 pub mod config {
12673 #[allow(unused_imports)]
12674 use super::*;
12675
12676 /// Types of data encryption.
12677 ///
12678 /// # Working with unknown values
12679 ///
12680 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12681 /// additional enum variants at any time. Adding new variants is not considered
12682 /// a breaking change. Applications should write their code in anticipation of:
12683 ///
12684 /// - New values appearing in future releases of the client library, **and**
12685 /// - New values received dynamically, without application changes.
12686 ///
12687 /// Please consult the [Working with enums] section in the user guide for some
12688 /// guidelines.
12689 ///
12690 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12691 #[derive(Clone, Debug, PartialEq)]
12692 #[non_exhaustive]
12693 pub enum EncryptionType {
12694 /// Encryption type unspecified.
12695 Unspecified,
12696 /// Default encryption using Google managed encryption key.
12697 Gmek,
12698 /// Encryption using customer managed encryption key.
12699 Cmek,
12700 /// If set, the enum was initialized with an unknown value.
12701 ///
12702 /// Applications can examine the value using [EncryptionType::value] or
12703 /// [EncryptionType::name].
12704 UnknownValue(encryption_type::UnknownValue),
12705 }
12706
12707 #[doc(hidden)]
12708 pub mod encryption_type {
12709 #[allow(unused_imports)]
12710 use super::*;
12711 #[derive(Clone, Debug, PartialEq)]
12712 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12713 }
12714
12715 impl EncryptionType {
12716 /// Gets the enum value.
12717 ///
12718 /// Returns `None` if the enum contains an unknown value deserialized from
12719 /// the string representation of enums.
12720 pub fn value(&self) -> std::option::Option<i32> {
12721 match self {
12722 Self::Unspecified => std::option::Option::Some(0),
12723 Self::Gmek => std::option::Option::Some(1),
12724 Self::Cmek => std::option::Option::Some(2),
12725 Self::UnknownValue(u) => u.0.value(),
12726 }
12727 }
12728
12729 /// Gets the enum value as a string.
12730 ///
12731 /// Returns `None` if the enum contains an unknown value deserialized from
12732 /// the integer representation of enums.
12733 pub fn name(&self) -> std::option::Option<&str> {
12734 match self {
12735 Self::Unspecified => std::option::Option::Some("ENCRYPTION_TYPE_UNSPECIFIED"),
12736 Self::Gmek => std::option::Option::Some("GMEK"),
12737 Self::Cmek => std::option::Option::Some("CMEK"),
12738 Self::UnknownValue(u) => u.0.name(),
12739 }
12740 }
12741 }
12742
12743 impl std::default::Default for EncryptionType {
12744 fn default() -> Self {
12745 use std::convert::From;
12746 Self::from(0)
12747 }
12748 }
12749
12750 impl std::fmt::Display for EncryptionType {
12751 fn fmt(
12752 &self,
12753 f: &mut std::fmt::Formatter<'_>,
12754 ) -> std::result::Result<(), std::fmt::Error> {
12755 wkt::internal::display_enum(f, self.name(), self.value())
12756 }
12757 }
12758
12759 impl std::convert::From<i32> for EncryptionType {
12760 fn from(value: i32) -> Self {
12761 match value {
12762 0 => Self::Unspecified,
12763 1 => Self::Gmek,
12764 2 => Self::Cmek,
12765 _ => Self::UnknownValue(encryption_type::UnknownValue(
12766 wkt::internal::UnknownEnumValue::Integer(value),
12767 )),
12768 }
12769 }
12770 }
12771
12772 impl std::convert::From<&str> for EncryptionType {
12773 fn from(value: &str) -> Self {
12774 use std::string::ToString;
12775 match value {
12776 "ENCRYPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
12777 "GMEK" => Self::Gmek,
12778 "CMEK" => Self::Cmek,
12779 _ => Self::UnknownValue(encryption_type::UnknownValue(
12780 wkt::internal::UnknownEnumValue::String(value.to_string()),
12781 )),
12782 }
12783 }
12784 }
12785
12786 impl serde::ser::Serialize for EncryptionType {
12787 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12788 where
12789 S: serde::Serializer,
12790 {
12791 match self {
12792 Self::Unspecified => serializer.serialize_i32(0),
12793 Self::Gmek => serializer.serialize_i32(1),
12794 Self::Cmek => serializer.serialize_i32(2),
12795 Self::UnknownValue(u) => u.0.serialize(serializer),
12796 }
12797 }
12798 }
12799
12800 impl<'de> serde::de::Deserialize<'de> for EncryptionType {
12801 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12802 where
12803 D: serde::Deserializer<'de>,
12804 {
12805 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EncryptionType>::new(
12806 ".google.cloud.apihub.v1.ApiHubInstance.Config.EncryptionType",
12807 ))
12808 }
12809 }
12810 }
12811
12812 /// State of the ApiHub Instance.
12813 ///
12814 /// # Working with unknown values
12815 ///
12816 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12817 /// additional enum variants at any time. Adding new variants is not considered
12818 /// a breaking change. Applications should write their code in anticipation of:
12819 ///
12820 /// - New values appearing in future releases of the client library, **and**
12821 /// - New values received dynamically, without application changes.
12822 ///
12823 /// Please consult the [Working with enums] section in the user guide for some
12824 /// guidelines.
12825 ///
12826 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12827 #[derive(Clone, Debug, PartialEq)]
12828 #[non_exhaustive]
12829 pub enum State {
12830 /// The default value. This value is used if the state is omitted.
12831 Unspecified,
12832 /// The ApiHub instance has not been initialized or has been deleted.
12833 Inactive,
12834 /// The ApiHub instance is being created.
12835 Creating,
12836 /// The ApiHub instance has been created and is ready for use.
12837 Active,
12838 /// The ApiHub instance is being updated.
12839 Updating,
12840 /// The ApiHub instance is being deleted.
12841 Deleting,
12842 /// The ApiHub instance encountered an error during a state change.
12843 Failed,
12844 /// If set, the enum was initialized with an unknown value.
12845 ///
12846 /// Applications can examine the value using [State::value] or
12847 /// [State::name].
12848 UnknownValue(state::UnknownValue),
12849 }
12850
12851 #[doc(hidden)]
12852 pub mod state {
12853 #[allow(unused_imports)]
12854 use super::*;
12855 #[derive(Clone, Debug, PartialEq)]
12856 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12857 }
12858
12859 impl State {
12860 /// Gets the enum value.
12861 ///
12862 /// Returns `None` if the enum contains an unknown value deserialized from
12863 /// the string representation of enums.
12864 pub fn value(&self) -> std::option::Option<i32> {
12865 match self {
12866 Self::Unspecified => std::option::Option::Some(0),
12867 Self::Inactive => std::option::Option::Some(1),
12868 Self::Creating => std::option::Option::Some(2),
12869 Self::Active => std::option::Option::Some(3),
12870 Self::Updating => std::option::Option::Some(4),
12871 Self::Deleting => std::option::Option::Some(5),
12872 Self::Failed => std::option::Option::Some(6),
12873 Self::UnknownValue(u) => u.0.value(),
12874 }
12875 }
12876
12877 /// Gets the enum value as a string.
12878 ///
12879 /// Returns `None` if the enum contains an unknown value deserialized from
12880 /// the integer representation of enums.
12881 pub fn name(&self) -> std::option::Option<&str> {
12882 match self {
12883 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12884 Self::Inactive => std::option::Option::Some("INACTIVE"),
12885 Self::Creating => std::option::Option::Some("CREATING"),
12886 Self::Active => std::option::Option::Some("ACTIVE"),
12887 Self::Updating => std::option::Option::Some("UPDATING"),
12888 Self::Deleting => std::option::Option::Some("DELETING"),
12889 Self::Failed => std::option::Option::Some("FAILED"),
12890 Self::UnknownValue(u) => u.0.name(),
12891 }
12892 }
12893 }
12894
12895 impl std::default::Default for State {
12896 fn default() -> Self {
12897 use std::convert::From;
12898 Self::from(0)
12899 }
12900 }
12901
12902 impl std::fmt::Display for State {
12903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12904 wkt::internal::display_enum(f, self.name(), self.value())
12905 }
12906 }
12907
12908 impl std::convert::From<i32> for State {
12909 fn from(value: i32) -> Self {
12910 match value {
12911 0 => Self::Unspecified,
12912 1 => Self::Inactive,
12913 2 => Self::Creating,
12914 3 => Self::Active,
12915 4 => Self::Updating,
12916 5 => Self::Deleting,
12917 6 => Self::Failed,
12918 _ => Self::UnknownValue(state::UnknownValue(
12919 wkt::internal::UnknownEnumValue::Integer(value),
12920 )),
12921 }
12922 }
12923 }
12924
12925 impl std::convert::From<&str> for State {
12926 fn from(value: &str) -> Self {
12927 use std::string::ToString;
12928 match value {
12929 "STATE_UNSPECIFIED" => Self::Unspecified,
12930 "INACTIVE" => Self::Inactive,
12931 "CREATING" => Self::Creating,
12932 "ACTIVE" => Self::Active,
12933 "UPDATING" => Self::Updating,
12934 "DELETING" => Self::Deleting,
12935 "FAILED" => Self::Failed,
12936 _ => Self::UnknownValue(state::UnknownValue(
12937 wkt::internal::UnknownEnumValue::String(value.to_string()),
12938 )),
12939 }
12940 }
12941 }
12942
12943 impl serde::ser::Serialize for State {
12944 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12945 where
12946 S: serde::Serializer,
12947 {
12948 match self {
12949 Self::Unspecified => serializer.serialize_i32(0),
12950 Self::Inactive => serializer.serialize_i32(1),
12951 Self::Creating => serializer.serialize_i32(2),
12952 Self::Active => serializer.serialize_i32(3),
12953 Self::Updating => serializer.serialize_i32(4),
12954 Self::Deleting => serializer.serialize_i32(5),
12955 Self::Failed => serializer.serialize_i32(6),
12956 Self::UnknownValue(u) => u.0.serialize(serializer),
12957 }
12958 }
12959 }
12960
12961 impl<'de> serde::de::Deserialize<'de> for State {
12962 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12963 where
12964 D: serde::Deserializer<'de>,
12965 {
12966 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12967 ".google.cloud.apihub.v1.ApiHubInstance.State",
12968 ))
12969 }
12970 }
12971}
12972
12973/// An external API represents an API being provided by external sources. This
12974/// can be used to model third-party APIs and can be used to define dependencies.
12975#[derive(Clone, Default, PartialEq)]
12976#[non_exhaustive]
12977pub struct ExternalApi {
12978 /// Identifier. Format:
12979 /// `projects/{project}/locations/{location}/externalApi/{externalApi}`.
12980 pub name: std::string::String,
12981
12982 /// Required. Display name of the external API. Max length is 63 characters
12983 /// (Unicode Code Points).
12984 pub display_name: std::string::String,
12985
12986 /// Optional. Description of the external API. Max length is 2000 characters
12987 /// (Unicode Code Points).
12988 pub description: std::string::String,
12989
12990 /// Optional. List of endpoints on which this API is accessible.
12991 pub endpoints: std::vec::Vec<std::string::String>,
12992
12993 /// Optional. List of paths served by this API.
12994 pub paths: std::vec::Vec<std::string::String>,
12995
12996 /// Optional. Documentation of the external API.
12997 pub documentation: std::option::Option<crate::model::Documentation>,
12998
12999 /// Optional. The list of user defined attributes associated with the Version
13000 /// resource. The key is the attribute name. It will be of the format:
13001 /// `projects/{project}/locations/{location}/attributes/{attribute}`.
13002 /// The value is the attribute values associated with the resource.
13003 pub attributes: std::collections::HashMap<std::string::String, crate::model::AttributeValues>,
13004
13005 /// Output only. Creation timestamp.
13006 pub create_time: std::option::Option<wkt::Timestamp>,
13007
13008 /// Output only. Last update timestamp.
13009 pub update_time: std::option::Option<wkt::Timestamp>,
13010
13011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13012}
13013
13014impl ExternalApi {
13015 pub fn new() -> Self {
13016 std::default::Default::default()
13017 }
13018
13019 /// Sets the value of [name][crate::model::ExternalApi::name].
13020 ///
13021 /// # Example
13022 /// ```ignore,no_run
13023 /// # use google_cloud_apihub_v1::model::ExternalApi;
13024 /// let x = ExternalApi::new().set_name("example");
13025 /// ```
13026 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13027 self.name = v.into();
13028 self
13029 }
13030
13031 /// Sets the value of [display_name][crate::model::ExternalApi::display_name].
13032 ///
13033 /// # Example
13034 /// ```ignore,no_run
13035 /// # use google_cloud_apihub_v1::model::ExternalApi;
13036 /// let x = ExternalApi::new().set_display_name("example");
13037 /// ```
13038 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13039 self.display_name = v.into();
13040 self
13041 }
13042
13043 /// Sets the value of [description][crate::model::ExternalApi::description].
13044 ///
13045 /// # Example
13046 /// ```ignore,no_run
13047 /// # use google_cloud_apihub_v1::model::ExternalApi;
13048 /// let x = ExternalApi::new().set_description("example");
13049 /// ```
13050 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13051 self.description = v.into();
13052 self
13053 }
13054
13055 /// Sets the value of [endpoints][crate::model::ExternalApi::endpoints].
13056 ///
13057 /// # Example
13058 /// ```ignore,no_run
13059 /// # use google_cloud_apihub_v1::model::ExternalApi;
13060 /// let x = ExternalApi::new().set_endpoints(["a", "b", "c"]);
13061 /// ```
13062 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
13063 where
13064 T: std::iter::IntoIterator<Item = V>,
13065 V: std::convert::Into<std::string::String>,
13066 {
13067 use std::iter::Iterator;
13068 self.endpoints = v.into_iter().map(|i| i.into()).collect();
13069 self
13070 }
13071
13072 /// Sets the value of [paths][crate::model::ExternalApi::paths].
13073 ///
13074 /// # Example
13075 /// ```ignore,no_run
13076 /// # use google_cloud_apihub_v1::model::ExternalApi;
13077 /// let x = ExternalApi::new().set_paths(["a", "b", "c"]);
13078 /// ```
13079 pub fn set_paths<T, V>(mut self, v: T) -> Self
13080 where
13081 T: std::iter::IntoIterator<Item = V>,
13082 V: std::convert::Into<std::string::String>,
13083 {
13084 use std::iter::Iterator;
13085 self.paths = v.into_iter().map(|i| i.into()).collect();
13086 self
13087 }
13088
13089 /// Sets the value of [documentation][crate::model::ExternalApi::documentation].
13090 ///
13091 /// # Example
13092 /// ```ignore,no_run
13093 /// # use google_cloud_apihub_v1::model::ExternalApi;
13094 /// use google_cloud_apihub_v1::model::Documentation;
13095 /// let x = ExternalApi::new().set_documentation(Documentation::default()/* use setters */);
13096 /// ```
13097 pub fn set_documentation<T>(mut self, v: T) -> Self
13098 where
13099 T: std::convert::Into<crate::model::Documentation>,
13100 {
13101 self.documentation = std::option::Option::Some(v.into());
13102 self
13103 }
13104
13105 /// Sets or clears the value of [documentation][crate::model::ExternalApi::documentation].
13106 ///
13107 /// # Example
13108 /// ```ignore,no_run
13109 /// # use google_cloud_apihub_v1::model::ExternalApi;
13110 /// use google_cloud_apihub_v1::model::Documentation;
13111 /// let x = ExternalApi::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
13112 /// let x = ExternalApi::new().set_or_clear_documentation(None::<Documentation>);
13113 /// ```
13114 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
13115 where
13116 T: std::convert::Into<crate::model::Documentation>,
13117 {
13118 self.documentation = v.map(|x| x.into());
13119 self
13120 }
13121
13122 /// Sets the value of [attributes][crate::model::ExternalApi::attributes].
13123 ///
13124 /// # Example
13125 /// ```ignore,no_run
13126 /// # use google_cloud_apihub_v1::model::ExternalApi;
13127 /// use google_cloud_apihub_v1::model::AttributeValues;
13128 /// let x = ExternalApi::new().set_attributes([
13129 /// ("key0", AttributeValues::default()/* use setters */),
13130 /// ("key1", AttributeValues::default()/* use (different) setters */),
13131 /// ]);
13132 /// ```
13133 pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
13134 where
13135 T: std::iter::IntoIterator<Item = (K, V)>,
13136 K: std::convert::Into<std::string::String>,
13137 V: std::convert::Into<crate::model::AttributeValues>,
13138 {
13139 use std::iter::Iterator;
13140 self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13141 self
13142 }
13143
13144 /// Sets the value of [create_time][crate::model::ExternalApi::create_time].
13145 ///
13146 /// # Example
13147 /// ```ignore,no_run
13148 /// # use google_cloud_apihub_v1::model::ExternalApi;
13149 /// use wkt::Timestamp;
13150 /// let x = ExternalApi::new().set_create_time(Timestamp::default()/* use setters */);
13151 /// ```
13152 pub fn set_create_time<T>(mut self, v: T) -> Self
13153 where
13154 T: std::convert::Into<wkt::Timestamp>,
13155 {
13156 self.create_time = std::option::Option::Some(v.into());
13157 self
13158 }
13159
13160 /// Sets or clears the value of [create_time][crate::model::ExternalApi::create_time].
13161 ///
13162 /// # Example
13163 /// ```ignore,no_run
13164 /// # use google_cloud_apihub_v1::model::ExternalApi;
13165 /// use wkt::Timestamp;
13166 /// let x = ExternalApi::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13167 /// let x = ExternalApi::new().set_or_clear_create_time(None::<Timestamp>);
13168 /// ```
13169 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13170 where
13171 T: std::convert::Into<wkt::Timestamp>,
13172 {
13173 self.create_time = v.map(|x| x.into());
13174 self
13175 }
13176
13177 /// Sets the value of [update_time][crate::model::ExternalApi::update_time].
13178 ///
13179 /// # Example
13180 /// ```ignore,no_run
13181 /// # use google_cloud_apihub_v1::model::ExternalApi;
13182 /// use wkt::Timestamp;
13183 /// let x = ExternalApi::new().set_update_time(Timestamp::default()/* use setters */);
13184 /// ```
13185 pub fn set_update_time<T>(mut self, v: T) -> Self
13186 where
13187 T: std::convert::Into<wkt::Timestamp>,
13188 {
13189 self.update_time = std::option::Option::Some(v.into());
13190 self
13191 }
13192
13193 /// Sets or clears the value of [update_time][crate::model::ExternalApi::update_time].
13194 ///
13195 /// # Example
13196 /// ```ignore,no_run
13197 /// # use google_cloud_apihub_v1::model::ExternalApi;
13198 /// use wkt::Timestamp;
13199 /// let x = ExternalApi::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13200 /// let x = ExternalApi::new().set_or_clear_update_time(None::<Timestamp>);
13201 /// ```
13202 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13203 where
13204 T: std::convert::Into<wkt::Timestamp>,
13205 {
13206 self.update_time = v.map(|x| x.into());
13207 self
13208 }
13209}
13210
13211impl wkt::message::Message for ExternalApi {
13212 fn typename() -> &'static str {
13213 "type.googleapis.com/google.cloud.apihub.v1.ExternalApi"
13214 }
13215}
13216
13217/// ConfigValueOption represents an option for a config variable of type enum or
13218/// multi select.
13219#[derive(Clone, Default, PartialEq)]
13220#[non_exhaustive]
13221pub struct ConfigValueOption {
13222 /// Required. Id of the option.
13223 pub id: std::string::String,
13224
13225 /// Required. Display name of the option.
13226 pub display_name: std::string::String,
13227
13228 /// Optional. Description of the option.
13229 pub description: std::string::String,
13230
13231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13232}
13233
13234impl ConfigValueOption {
13235 pub fn new() -> Self {
13236 std::default::Default::default()
13237 }
13238
13239 /// Sets the value of [id][crate::model::ConfigValueOption::id].
13240 ///
13241 /// # Example
13242 /// ```ignore,no_run
13243 /// # use google_cloud_apihub_v1::model::ConfigValueOption;
13244 /// let x = ConfigValueOption::new().set_id("example");
13245 /// ```
13246 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13247 self.id = v.into();
13248 self
13249 }
13250
13251 /// Sets the value of [display_name][crate::model::ConfigValueOption::display_name].
13252 ///
13253 /// # Example
13254 /// ```ignore,no_run
13255 /// # use google_cloud_apihub_v1::model::ConfigValueOption;
13256 /// let x = ConfigValueOption::new().set_display_name("example");
13257 /// ```
13258 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13259 self.display_name = v.into();
13260 self
13261 }
13262
13263 /// Sets the value of [description][crate::model::ConfigValueOption::description].
13264 ///
13265 /// # Example
13266 /// ```ignore,no_run
13267 /// # use google_cloud_apihub_v1::model::ConfigValueOption;
13268 /// let x = ConfigValueOption::new().set_description("example");
13269 /// ```
13270 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13271 self.description = v.into();
13272 self
13273 }
13274}
13275
13276impl wkt::message::Message for ConfigValueOption {
13277 fn typename() -> &'static str {
13278 "type.googleapis.com/google.cloud.apihub.v1.ConfigValueOption"
13279 }
13280}
13281
13282/// Secret provides a reference to entries in Secret Manager.
13283#[derive(Clone, Default, PartialEq)]
13284#[non_exhaustive]
13285pub struct Secret {
13286 /// Required. The resource name of the secret version in the format,
13287 /// format as: `projects/*/secrets/*/versions/*`.
13288 pub secret_version: std::string::String,
13289
13290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13291}
13292
13293impl Secret {
13294 pub fn new() -> Self {
13295 std::default::Default::default()
13296 }
13297
13298 /// Sets the value of [secret_version][crate::model::Secret::secret_version].
13299 ///
13300 /// # Example
13301 /// ```ignore,no_run
13302 /// # use google_cloud_apihub_v1::model::Secret;
13303 /// let x = Secret::new().set_secret_version("example");
13304 /// ```
13305 pub fn set_secret_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13306 self.secret_version = v.into();
13307 self
13308 }
13309}
13310
13311impl wkt::message::Message for Secret {
13312 fn typename() -> &'static str {
13313 "type.googleapis.com/google.cloud.apihub.v1.Secret"
13314 }
13315}
13316
13317/// ConfigVariableTemplate represents a configuration variable template present
13318/// in a Plugin Config.
13319#[derive(Clone, Default, PartialEq)]
13320#[non_exhaustive]
13321pub struct ConfigVariableTemplate {
13322 /// Required. ID of the config variable. Must be unique within the
13323 /// configuration.
13324 pub id: std::string::String,
13325
13326 /// Required. Type of the parameter: string, int, bool etc.
13327 pub value_type: crate::model::config_variable_template::ValueType,
13328
13329 /// Optional. Description.
13330 pub description: std::string::String,
13331
13332 /// Optional. Regular expression in RE2 syntax used for validating the `value`
13333 /// of a `ConfigVariable`.
13334 pub validation_regex: std::string::String,
13335
13336 /// Optional. Flag represents that this `ConfigVariable` must be provided for a
13337 /// PluginInstance.
13338 pub required: bool,
13339
13340 /// Optional. Enum options. To be populated if `ValueType` is `ENUM`.
13341 pub enum_options: std::vec::Vec<crate::model::ConfigValueOption>,
13342
13343 /// Optional. Multi select options. To be populated if `ValueType` is
13344 /// `MULTI_SELECT`.
13345 pub multi_select_options: std::vec::Vec<crate::model::ConfigValueOption>,
13346
13347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13348}
13349
13350impl ConfigVariableTemplate {
13351 pub fn new() -> Self {
13352 std::default::Default::default()
13353 }
13354
13355 /// Sets the value of [id][crate::model::ConfigVariableTemplate::id].
13356 ///
13357 /// # Example
13358 /// ```ignore,no_run
13359 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13360 /// let x = ConfigVariableTemplate::new().set_id("example");
13361 /// ```
13362 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13363 self.id = v.into();
13364 self
13365 }
13366
13367 /// Sets the value of [value_type][crate::model::ConfigVariableTemplate::value_type].
13368 ///
13369 /// # Example
13370 /// ```ignore,no_run
13371 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13372 /// use google_cloud_apihub_v1::model::config_variable_template::ValueType;
13373 /// let x0 = ConfigVariableTemplate::new().set_value_type(ValueType::String);
13374 /// let x1 = ConfigVariableTemplate::new().set_value_type(ValueType::Int);
13375 /// let x2 = ConfigVariableTemplate::new().set_value_type(ValueType::Bool);
13376 /// ```
13377 pub fn set_value_type<
13378 T: std::convert::Into<crate::model::config_variable_template::ValueType>,
13379 >(
13380 mut self,
13381 v: T,
13382 ) -> Self {
13383 self.value_type = v.into();
13384 self
13385 }
13386
13387 /// Sets the value of [description][crate::model::ConfigVariableTemplate::description].
13388 ///
13389 /// # Example
13390 /// ```ignore,no_run
13391 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13392 /// let x = ConfigVariableTemplate::new().set_description("example");
13393 /// ```
13394 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13395 self.description = v.into();
13396 self
13397 }
13398
13399 /// Sets the value of [validation_regex][crate::model::ConfigVariableTemplate::validation_regex].
13400 ///
13401 /// # Example
13402 /// ```ignore,no_run
13403 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13404 /// let x = ConfigVariableTemplate::new().set_validation_regex("example");
13405 /// ```
13406 pub fn set_validation_regex<T: std::convert::Into<std::string::String>>(
13407 mut self,
13408 v: T,
13409 ) -> Self {
13410 self.validation_regex = v.into();
13411 self
13412 }
13413
13414 /// Sets the value of [required][crate::model::ConfigVariableTemplate::required].
13415 ///
13416 /// # Example
13417 /// ```ignore,no_run
13418 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13419 /// let x = ConfigVariableTemplate::new().set_required(true);
13420 /// ```
13421 pub fn set_required<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13422 self.required = v.into();
13423 self
13424 }
13425
13426 /// Sets the value of [enum_options][crate::model::ConfigVariableTemplate::enum_options].
13427 ///
13428 /// # Example
13429 /// ```ignore,no_run
13430 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13431 /// use google_cloud_apihub_v1::model::ConfigValueOption;
13432 /// let x = ConfigVariableTemplate::new()
13433 /// .set_enum_options([
13434 /// ConfigValueOption::default()/* use setters */,
13435 /// ConfigValueOption::default()/* use (different) setters */,
13436 /// ]);
13437 /// ```
13438 pub fn set_enum_options<T, V>(mut self, v: T) -> Self
13439 where
13440 T: std::iter::IntoIterator<Item = V>,
13441 V: std::convert::Into<crate::model::ConfigValueOption>,
13442 {
13443 use std::iter::Iterator;
13444 self.enum_options = v.into_iter().map(|i| i.into()).collect();
13445 self
13446 }
13447
13448 /// Sets the value of [multi_select_options][crate::model::ConfigVariableTemplate::multi_select_options].
13449 ///
13450 /// # Example
13451 /// ```ignore,no_run
13452 /// # use google_cloud_apihub_v1::model::ConfigVariableTemplate;
13453 /// use google_cloud_apihub_v1::model::ConfigValueOption;
13454 /// let x = ConfigVariableTemplate::new()
13455 /// .set_multi_select_options([
13456 /// ConfigValueOption::default()/* use setters */,
13457 /// ConfigValueOption::default()/* use (different) setters */,
13458 /// ]);
13459 /// ```
13460 pub fn set_multi_select_options<T, V>(mut self, v: T) -> Self
13461 where
13462 T: std::iter::IntoIterator<Item = V>,
13463 V: std::convert::Into<crate::model::ConfigValueOption>,
13464 {
13465 use std::iter::Iterator;
13466 self.multi_select_options = v.into_iter().map(|i| i.into()).collect();
13467 self
13468 }
13469}
13470
13471impl wkt::message::Message for ConfigVariableTemplate {
13472 fn typename() -> &'static str {
13473 "type.googleapis.com/google.cloud.apihub.v1.ConfigVariableTemplate"
13474 }
13475}
13476
13477/// Defines additional types related to [ConfigVariableTemplate].
13478pub mod config_variable_template {
13479 #[allow(unused_imports)]
13480 use super::*;
13481
13482 /// ValueType indicates the data type of the value.
13483 ///
13484 /// # Working with unknown values
13485 ///
13486 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13487 /// additional enum variants at any time. Adding new variants is not considered
13488 /// a breaking change. Applications should write their code in anticipation of:
13489 ///
13490 /// - New values appearing in future releases of the client library, **and**
13491 /// - New values received dynamically, without application changes.
13492 ///
13493 /// Please consult the [Working with enums] section in the user guide for some
13494 /// guidelines.
13495 ///
13496 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13497 #[derive(Clone, Debug, PartialEq)]
13498 #[non_exhaustive]
13499 pub enum ValueType {
13500 /// Value type is not specified.
13501 Unspecified,
13502 /// Value type is string.
13503 String,
13504 /// Value type is integer.
13505 Int,
13506 /// Value type is boolean.
13507 Bool,
13508 /// Value type is secret.
13509 Secret,
13510 /// Value type is enum.
13511 Enum,
13512 /// Value type is multi select.
13513 MultiSelect,
13514 /// Value type is multi string.
13515 MultiString,
13516 /// Value type is multi int.
13517 MultiInt,
13518 /// If set, the enum was initialized with an unknown value.
13519 ///
13520 /// Applications can examine the value using [ValueType::value] or
13521 /// [ValueType::name].
13522 UnknownValue(value_type::UnknownValue),
13523 }
13524
13525 #[doc(hidden)]
13526 pub mod value_type {
13527 #[allow(unused_imports)]
13528 use super::*;
13529 #[derive(Clone, Debug, PartialEq)]
13530 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13531 }
13532
13533 impl ValueType {
13534 /// Gets the enum value.
13535 ///
13536 /// Returns `None` if the enum contains an unknown value deserialized from
13537 /// the string representation of enums.
13538 pub fn value(&self) -> std::option::Option<i32> {
13539 match self {
13540 Self::Unspecified => std::option::Option::Some(0),
13541 Self::String => std::option::Option::Some(1),
13542 Self::Int => std::option::Option::Some(2),
13543 Self::Bool => std::option::Option::Some(3),
13544 Self::Secret => std::option::Option::Some(4),
13545 Self::Enum => std::option::Option::Some(5),
13546 Self::MultiSelect => std::option::Option::Some(6),
13547 Self::MultiString => std::option::Option::Some(7),
13548 Self::MultiInt => std::option::Option::Some(8),
13549 Self::UnknownValue(u) => u.0.value(),
13550 }
13551 }
13552
13553 /// Gets the enum value as a string.
13554 ///
13555 /// Returns `None` if the enum contains an unknown value deserialized from
13556 /// the integer representation of enums.
13557 pub fn name(&self) -> std::option::Option<&str> {
13558 match self {
13559 Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
13560 Self::String => std::option::Option::Some("STRING"),
13561 Self::Int => std::option::Option::Some("INT"),
13562 Self::Bool => std::option::Option::Some("BOOL"),
13563 Self::Secret => std::option::Option::Some("SECRET"),
13564 Self::Enum => std::option::Option::Some("ENUM"),
13565 Self::MultiSelect => std::option::Option::Some("MULTI_SELECT"),
13566 Self::MultiString => std::option::Option::Some("MULTI_STRING"),
13567 Self::MultiInt => std::option::Option::Some("MULTI_INT"),
13568 Self::UnknownValue(u) => u.0.name(),
13569 }
13570 }
13571 }
13572
13573 impl std::default::Default for ValueType {
13574 fn default() -> Self {
13575 use std::convert::From;
13576 Self::from(0)
13577 }
13578 }
13579
13580 impl std::fmt::Display for ValueType {
13581 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13582 wkt::internal::display_enum(f, self.name(), self.value())
13583 }
13584 }
13585
13586 impl std::convert::From<i32> for ValueType {
13587 fn from(value: i32) -> Self {
13588 match value {
13589 0 => Self::Unspecified,
13590 1 => Self::String,
13591 2 => Self::Int,
13592 3 => Self::Bool,
13593 4 => Self::Secret,
13594 5 => Self::Enum,
13595 6 => Self::MultiSelect,
13596 7 => Self::MultiString,
13597 8 => Self::MultiInt,
13598 _ => Self::UnknownValue(value_type::UnknownValue(
13599 wkt::internal::UnknownEnumValue::Integer(value),
13600 )),
13601 }
13602 }
13603 }
13604
13605 impl std::convert::From<&str> for ValueType {
13606 fn from(value: &str) -> Self {
13607 use std::string::ToString;
13608 match value {
13609 "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
13610 "STRING" => Self::String,
13611 "INT" => Self::Int,
13612 "BOOL" => Self::Bool,
13613 "SECRET" => Self::Secret,
13614 "ENUM" => Self::Enum,
13615 "MULTI_SELECT" => Self::MultiSelect,
13616 "MULTI_STRING" => Self::MultiString,
13617 "MULTI_INT" => Self::MultiInt,
13618 _ => Self::UnknownValue(value_type::UnknownValue(
13619 wkt::internal::UnknownEnumValue::String(value.to_string()),
13620 )),
13621 }
13622 }
13623 }
13624
13625 impl serde::ser::Serialize for ValueType {
13626 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13627 where
13628 S: serde::Serializer,
13629 {
13630 match self {
13631 Self::Unspecified => serializer.serialize_i32(0),
13632 Self::String => serializer.serialize_i32(1),
13633 Self::Int => serializer.serialize_i32(2),
13634 Self::Bool => serializer.serialize_i32(3),
13635 Self::Secret => serializer.serialize_i32(4),
13636 Self::Enum => serializer.serialize_i32(5),
13637 Self::MultiSelect => serializer.serialize_i32(6),
13638 Self::MultiString => serializer.serialize_i32(7),
13639 Self::MultiInt => serializer.serialize_i32(8),
13640 Self::UnknownValue(u) => u.0.serialize(serializer),
13641 }
13642 }
13643 }
13644
13645 impl<'de> serde::de::Deserialize<'de> for ValueType {
13646 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13647 where
13648 D: serde::Deserializer<'de>,
13649 {
13650 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
13651 ".google.cloud.apihub.v1.ConfigVariableTemplate.ValueType",
13652 ))
13653 }
13654 }
13655}
13656
13657/// ConfigVariable represents a additional configuration variable present in a
13658/// PluginInstance Config or AuthConfig, based on a ConfigVariableTemplate.
13659#[derive(Clone, Default, PartialEq)]
13660#[non_exhaustive]
13661pub struct ConfigVariable {
13662 /// Output only. Key will be the
13663 /// [id][google.cloud.apihub.v1.ConfigVariableTemplate.id] to uniquely identify
13664 /// the config variable.
13665 ///
13666 /// [google.cloud.apihub.v1.ConfigVariableTemplate.id]: crate::model::ConfigVariableTemplate::id
13667 pub key: std::string::String,
13668
13669 /// The values associated with the config variable.
13670 pub value: std::option::Option<crate::model::config_variable::Value>,
13671
13672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13673}
13674
13675impl ConfigVariable {
13676 pub fn new() -> Self {
13677 std::default::Default::default()
13678 }
13679
13680 /// Sets the value of [key][crate::model::ConfigVariable::key].
13681 ///
13682 /// # Example
13683 /// ```ignore,no_run
13684 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13685 /// let x = ConfigVariable::new().set_key("example");
13686 /// ```
13687 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13688 self.key = v.into();
13689 self
13690 }
13691
13692 /// Sets the value of [value][crate::model::ConfigVariable::value].
13693 ///
13694 /// Note that all the setters affecting `value` are mutually
13695 /// exclusive.
13696 ///
13697 /// # Example
13698 /// ```ignore,no_run
13699 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13700 /// use google_cloud_apihub_v1::model::config_variable::Value;
13701 /// let x = ConfigVariable::new().set_value(Some(Value::StringValue("example".to_string())));
13702 /// ```
13703 pub fn set_value<
13704 T: std::convert::Into<std::option::Option<crate::model::config_variable::Value>>,
13705 >(
13706 mut self,
13707 v: T,
13708 ) -> Self {
13709 self.value = v.into();
13710 self
13711 }
13712
13713 /// The value of [value][crate::model::ConfigVariable::value]
13714 /// if it holds a `StringValue`, `None` if the field is not set or
13715 /// holds a different branch.
13716 pub fn string_value(&self) -> std::option::Option<&std::string::String> {
13717 #[allow(unreachable_patterns)]
13718 self.value.as_ref().and_then(|v| match v {
13719 crate::model::config_variable::Value::StringValue(v) => std::option::Option::Some(v),
13720 _ => std::option::Option::None,
13721 })
13722 }
13723
13724 /// Sets the value of [value][crate::model::ConfigVariable::value]
13725 /// to hold a `StringValue`.
13726 ///
13727 /// Note that all the setters affecting `value` are
13728 /// mutually exclusive.
13729 ///
13730 /// # Example
13731 /// ```ignore,no_run
13732 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13733 /// let x = ConfigVariable::new().set_string_value("example");
13734 /// assert!(x.string_value().is_some());
13735 /// assert!(x.int_value().is_none());
13736 /// assert!(x.bool_value().is_none());
13737 /// assert!(x.secret_value().is_none());
13738 /// assert!(x.enum_value().is_none());
13739 /// assert!(x.multi_select_values().is_none());
13740 /// assert!(x.multi_string_values().is_none());
13741 /// assert!(x.multi_int_values().is_none());
13742 /// ```
13743 pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13744 self.value =
13745 std::option::Option::Some(crate::model::config_variable::Value::StringValue(v.into()));
13746 self
13747 }
13748
13749 /// The value of [value][crate::model::ConfigVariable::value]
13750 /// if it holds a `IntValue`, `None` if the field is not set or
13751 /// holds a different branch.
13752 pub fn int_value(&self) -> std::option::Option<&i64> {
13753 #[allow(unreachable_patterns)]
13754 self.value.as_ref().and_then(|v| match v {
13755 crate::model::config_variable::Value::IntValue(v) => std::option::Option::Some(v),
13756 _ => std::option::Option::None,
13757 })
13758 }
13759
13760 /// Sets the value of [value][crate::model::ConfigVariable::value]
13761 /// to hold a `IntValue`.
13762 ///
13763 /// Note that all the setters affecting `value` are
13764 /// mutually exclusive.
13765 ///
13766 /// # Example
13767 /// ```ignore,no_run
13768 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13769 /// let x = ConfigVariable::new().set_int_value(42);
13770 /// assert!(x.int_value().is_some());
13771 /// assert!(x.string_value().is_none());
13772 /// assert!(x.bool_value().is_none());
13773 /// assert!(x.secret_value().is_none());
13774 /// assert!(x.enum_value().is_none());
13775 /// assert!(x.multi_select_values().is_none());
13776 /// assert!(x.multi_string_values().is_none());
13777 /// assert!(x.multi_int_values().is_none());
13778 /// ```
13779 pub fn set_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13780 self.value =
13781 std::option::Option::Some(crate::model::config_variable::Value::IntValue(v.into()));
13782 self
13783 }
13784
13785 /// The value of [value][crate::model::ConfigVariable::value]
13786 /// if it holds a `BoolValue`, `None` if the field is not set or
13787 /// holds a different branch.
13788 pub fn bool_value(&self) -> std::option::Option<&bool> {
13789 #[allow(unreachable_patterns)]
13790 self.value.as_ref().and_then(|v| match v {
13791 crate::model::config_variable::Value::BoolValue(v) => std::option::Option::Some(v),
13792 _ => std::option::Option::None,
13793 })
13794 }
13795
13796 /// Sets the value of [value][crate::model::ConfigVariable::value]
13797 /// to hold a `BoolValue`.
13798 ///
13799 /// Note that all the setters affecting `value` are
13800 /// mutually exclusive.
13801 ///
13802 /// # Example
13803 /// ```ignore,no_run
13804 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13805 /// let x = ConfigVariable::new().set_bool_value(true);
13806 /// assert!(x.bool_value().is_some());
13807 /// assert!(x.string_value().is_none());
13808 /// assert!(x.int_value().is_none());
13809 /// assert!(x.secret_value().is_none());
13810 /// assert!(x.enum_value().is_none());
13811 /// assert!(x.multi_select_values().is_none());
13812 /// assert!(x.multi_string_values().is_none());
13813 /// assert!(x.multi_int_values().is_none());
13814 /// ```
13815 pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13816 self.value =
13817 std::option::Option::Some(crate::model::config_variable::Value::BoolValue(v.into()));
13818 self
13819 }
13820
13821 /// The value of [value][crate::model::ConfigVariable::value]
13822 /// if it holds a `SecretValue`, `None` if the field is not set or
13823 /// holds a different branch.
13824 pub fn secret_value(&self) -> std::option::Option<&std::boxed::Box<crate::model::Secret>> {
13825 #[allow(unreachable_patterns)]
13826 self.value.as_ref().and_then(|v| match v {
13827 crate::model::config_variable::Value::SecretValue(v) => std::option::Option::Some(v),
13828 _ => std::option::Option::None,
13829 })
13830 }
13831
13832 /// Sets the value of [value][crate::model::ConfigVariable::value]
13833 /// to hold a `SecretValue`.
13834 ///
13835 /// Note that all the setters affecting `value` are
13836 /// mutually exclusive.
13837 ///
13838 /// # Example
13839 /// ```ignore,no_run
13840 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13841 /// use google_cloud_apihub_v1::model::Secret;
13842 /// let x = ConfigVariable::new().set_secret_value(Secret::default()/* use setters */);
13843 /// assert!(x.secret_value().is_some());
13844 /// assert!(x.string_value().is_none());
13845 /// assert!(x.int_value().is_none());
13846 /// assert!(x.bool_value().is_none());
13847 /// assert!(x.enum_value().is_none());
13848 /// assert!(x.multi_select_values().is_none());
13849 /// assert!(x.multi_string_values().is_none());
13850 /// assert!(x.multi_int_values().is_none());
13851 /// ```
13852 pub fn set_secret_value<T: std::convert::Into<std::boxed::Box<crate::model::Secret>>>(
13853 mut self,
13854 v: T,
13855 ) -> Self {
13856 self.value =
13857 std::option::Option::Some(crate::model::config_variable::Value::SecretValue(v.into()));
13858 self
13859 }
13860
13861 /// The value of [value][crate::model::ConfigVariable::value]
13862 /// if it holds a `EnumValue`, `None` if the field is not set or
13863 /// holds a different branch.
13864 pub fn enum_value(
13865 &self,
13866 ) -> std::option::Option<&std::boxed::Box<crate::model::ConfigValueOption>> {
13867 #[allow(unreachable_patterns)]
13868 self.value.as_ref().and_then(|v| match v {
13869 crate::model::config_variable::Value::EnumValue(v) => std::option::Option::Some(v),
13870 _ => std::option::Option::None,
13871 })
13872 }
13873
13874 /// Sets the value of [value][crate::model::ConfigVariable::value]
13875 /// to hold a `EnumValue`.
13876 ///
13877 /// Note that all the setters affecting `value` are
13878 /// mutually exclusive.
13879 ///
13880 /// # Example
13881 /// ```ignore,no_run
13882 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13883 /// use google_cloud_apihub_v1::model::ConfigValueOption;
13884 /// let x = ConfigVariable::new().set_enum_value(ConfigValueOption::default()/* use setters */);
13885 /// assert!(x.enum_value().is_some());
13886 /// assert!(x.string_value().is_none());
13887 /// assert!(x.int_value().is_none());
13888 /// assert!(x.bool_value().is_none());
13889 /// assert!(x.secret_value().is_none());
13890 /// assert!(x.multi_select_values().is_none());
13891 /// assert!(x.multi_string_values().is_none());
13892 /// assert!(x.multi_int_values().is_none());
13893 /// ```
13894 pub fn set_enum_value<
13895 T: std::convert::Into<std::boxed::Box<crate::model::ConfigValueOption>>,
13896 >(
13897 mut self,
13898 v: T,
13899 ) -> Self {
13900 self.value =
13901 std::option::Option::Some(crate::model::config_variable::Value::EnumValue(v.into()));
13902 self
13903 }
13904
13905 /// The value of [value][crate::model::ConfigVariable::value]
13906 /// if it holds a `MultiSelectValues`, `None` if the field is not set or
13907 /// holds a different branch.
13908 pub fn multi_select_values(
13909 &self,
13910 ) -> std::option::Option<&std::boxed::Box<crate::model::config_variable::MultiSelectValues>>
13911 {
13912 #[allow(unreachable_patterns)]
13913 self.value.as_ref().and_then(|v| match v {
13914 crate::model::config_variable::Value::MultiSelectValues(v) => {
13915 std::option::Option::Some(v)
13916 }
13917 _ => std::option::Option::None,
13918 })
13919 }
13920
13921 /// Sets the value of [value][crate::model::ConfigVariable::value]
13922 /// to hold a `MultiSelectValues`.
13923 ///
13924 /// Note that all the setters affecting `value` are
13925 /// mutually exclusive.
13926 ///
13927 /// # Example
13928 /// ```ignore,no_run
13929 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13930 /// use google_cloud_apihub_v1::model::config_variable::MultiSelectValues;
13931 /// let x = ConfigVariable::new().set_multi_select_values(MultiSelectValues::default()/* use setters */);
13932 /// assert!(x.multi_select_values().is_some());
13933 /// assert!(x.string_value().is_none());
13934 /// assert!(x.int_value().is_none());
13935 /// assert!(x.bool_value().is_none());
13936 /// assert!(x.secret_value().is_none());
13937 /// assert!(x.enum_value().is_none());
13938 /// assert!(x.multi_string_values().is_none());
13939 /// assert!(x.multi_int_values().is_none());
13940 /// ```
13941 pub fn set_multi_select_values<
13942 T: std::convert::Into<std::boxed::Box<crate::model::config_variable::MultiSelectValues>>,
13943 >(
13944 mut self,
13945 v: T,
13946 ) -> Self {
13947 self.value = std::option::Option::Some(
13948 crate::model::config_variable::Value::MultiSelectValues(v.into()),
13949 );
13950 self
13951 }
13952
13953 /// The value of [value][crate::model::ConfigVariable::value]
13954 /// if it holds a `MultiStringValues`, `None` if the field is not set or
13955 /// holds a different branch.
13956 pub fn multi_string_values(
13957 &self,
13958 ) -> std::option::Option<&std::boxed::Box<crate::model::config_variable::MultiStringValues>>
13959 {
13960 #[allow(unreachable_patterns)]
13961 self.value.as_ref().and_then(|v| match v {
13962 crate::model::config_variable::Value::MultiStringValues(v) => {
13963 std::option::Option::Some(v)
13964 }
13965 _ => std::option::Option::None,
13966 })
13967 }
13968
13969 /// Sets the value of [value][crate::model::ConfigVariable::value]
13970 /// to hold a `MultiStringValues`.
13971 ///
13972 /// Note that all the setters affecting `value` are
13973 /// mutually exclusive.
13974 ///
13975 /// # Example
13976 /// ```ignore,no_run
13977 /// # use google_cloud_apihub_v1::model::ConfigVariable;
13978 /// use google_cloud_apihub_v1::model::config_variable::MultiStringValues;
13979 /// let x = ConfigVariable::new().set_multi_string_values(MultiStringValues::default()/* use setters */);
13980 /// assert!(x.multi_string_values().is_some());
13981 /// assert!(x.string_value().is_none());
13982 /// assert!(x.int_value().is_none());
13983 /// assert!(x.bool_value().is_none());
13984 /// assert!(x.secret_value().is_none());
13985 /// assert!(x.enum_value().is_none());
13986 /// assert!(x.multi_select_values().is_none());
13987 /// assert!(x.multi_int_values().is_none());
13988 /// ```
13989 pub fn set_multi_string_values<
13990 T: std::convert::Into<std::boxed::Box<crate::model::config_variable::MultiStringValues>>,
13991 >(
13992 mut self,
13993 v: T,
13994 ) -> Self {
13995 self.value = std::option::Option::Some(
13996 crate::model::config_variable::Value::MultiStringValues(v.into()),
13997 );
13998 self
13999 }
14000
14001 /// The value of [value][crate::model::ConfigVariable::value]
14002 /// if it holds a `MultiIntValues`, `None` if the field is not set or
14003 /// holds a different branch.
14004 pub fn multi_int_values(
14005 &self,
14006 ) -> std::option::Option<&std::boxed::Box<crate::model::config_variable::MultiIntValues>> {
14007 #[allow(unreachable_patterns)]
14008 self.value.as_ref().and_then(|v| match v {
14009 crate::model::config_variable::Value::MultiIntValues(v) => std::option::Option::Some(v),
14010 _ => std::option::Option::None,
14011 })
14012 }
14013
14014 /// Sets the value of [value][crate::model::ConfigVariable::value]
14015 /// to hold a `MultiIntValues`.
14016 ///
14017 /// Note that all the setters affecting `value` are
14018 /// mutually exclusive.
14019 ///
14020 /// # Example
14021 /// ```ignore,no_run
14022 /// # use google_cloud_apihub_v1::model::ConfigVariable;
14023 /// use google_cloud_apihub_v1::model::config_variable::MultiIntValues;
14024 /// let x = ConfigVariable::new().set_multi_int_values(MultiIntValues::default()/* use setters */);
14025 /// assert!(x.multi_int_values().is_some());
14026 /// assert!(x.string_value().is_none());
14027 /// assert!(x.int_value().is_none());
14028 /// assert!(x.bool_value().is_none());
14029 /// assert!(x.secret_value().is_none());
14030 /// assert!(x.enum_value().is_none());
14031 /// assert!(x.multi_select_values().is_none());
14032 /// assert!(x.multi_string_values().is_none());
14033 /// ```
14034 pub fn set_multi_int_values<
14035 T: std::convert::Into<std::boxed::Box<crate::model::config_variable::MultiIntValues>>,
14036 >(
14037 mut self,
14038 v: T,
14039 ) -> Self {
14040 self.value = std::option::Option::Some(
14041 crate::model::config_variable::Value::MultiIntValues(v.into()),
14042 );
14043 self
14044 }
14045}
14046
14047impl wkt::message::Message for ConfigVariable {
14048 fn typename() -> &'static str {
14049 "type.googleapis.com/google.cloud.apihub.v1.ConfigVariable"
14050 }
14051}
14052
14053/// Defines additional types related to [ConfigVariable].
14054pub mod config_variable {
14055 #[allow(unused_imports)]
14056 use super::*;
14057
14058 /// The config variable value of data type multi select.
14059 #[derive(Clone, Default, PartialEq)]
14060 #[non_exhaustive]
14061 pub struct MultiSelectValues {
14062 /// Optional. The config variable value of data type multi select.
14063 pub values: std::vec::Vec<crate::model::ConfigValueOption>,
14064
14065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14066 }
14067
14068 impl MultiSelectValues {
14069 pub fn new() -> Self {
14070 std::default::Default::default()
14071 }
14072
14073 /// Sets the value of [values][crate::model::config_variable::MultiSelectValues::values].
14074 ///
14075 /// # Example
14076 /// ```ignore,no_run
14077 /// # use google_cloud_apihub_v1::model::config_variable::MultiSelectValues;
14078 /// use google_cloud_apihub_v1::model::ConfigValueOption;
14079 /// let x = MultiSelectValues::new()
14080 /// .set_values([
14081 /// ConfigValueOption::default()/* use setters */,
14082 /// ConfigValueOption::default()/* use (different) setters */,
14083 /// ]);
14084 /// ```
14085 pub fn set_values<T, V>(mut self, v: T) -> Self
14086 where
14087 T: std::iter::IntoIterator<Item = V>,
14088 V: std::convert::Into<crate::model::ConfigValueOption>,
14089 {
14090 use std::iter::Iterator;
14091 self.values = v.into_iter().map(|i| i.into()).collect();
14092 self
14093 }
14094 }
14095
14096 impl wkt::message::Message for MultiSelectValues {
14097 fn typename() -> &'static str {
14098 "type.googleapis.com/google.cloud.apihub.v1.ConfigVariable.MultiSelectValues"
14099 }
14100 }
14101
14102 /// The config variable value of data type multi string.
14103 #[derive(Clone, Default, PartialEq)]
14104 #[non_exhaustive]
14105 pub struct MultiStringValues {
14106 /// Optional. The config variable value of data type multi string.
14107 pub values: std::vec::Vec<std::string::String>,
14108
14109 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14110 }
14111
14112 impl MultiStringValues {
14113 pub fn new() -> Self {
14114 std::default::Default::default()
14115 }
14116
14117 /// Sets the value of [values][crate::model::config_variable::MultiStringValues::values].
14118 ///
14119 /// # Example
14120 /// ```ignore,no_run
14121 /// # use google_cloud_apihub_v1::model::config_variable::MultiStringValues;
14122 /// let x = MultiStringValues::new().set_values(["a", "b", "c"]);
14123 /// ```
14124 pub fn set_values<T, V>(mut self, v: T) -> Self
14125 where
14126 T: std::iter::IntoIterator<Item = V>,
14127 V: std::convert::Into<std::string::String>,
14128 {
14129 use std::iter::Iterator;
14130 self.values = v.into_iter().map(|i| i.into()).collect();
14131 self
14132 }
14133 }
14134
14135 impl wkt::message::Message for MultiStringValues {
14136 fn typename() -> &'static str {
14137 "type.googleapis.com/google.cloud.apihub.v1.ConfigVariable.MultiStringValues"
14138 }
14139 }
14140
14141 /// The config variable value of data type multi int.
14142 #[derive(Clone, Default, PartialEq)]
14143 #[non_exhaustive]
14144 pub struct MultiIntValues {
14145 /// Optional. The config variable value of data type multi int.
14146 pub values: std::vec::Vec<i32>,
14147
14148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14149 }
14150
14151 impl MultiIntValues {
14152 pub fn new() -> Self {
14153 std::default::Default::default()
14154 }
14155
14156 /// Sets the value of [values][crate::model::config_variable::MultiIntValues::values].
14157 ///
14158 /// # Example
14159 /// ```ignore,no_run
14160 /// # use google_cloud_apihub_v1::model::config_variable::MultiIntValues;
14161 /// let x = MultiIntValues::new().set_values([1, 2, 3]);
14162 /// ```
14163 pub fn set_values<T, V>(mut self, v: T) -> Self
14164 where
14165 T: std::iter::IntoIterator<Item = V>,
14166 V: std::convert::Into<i32>,
14167 {
14168 use std::iter::Iterator;
14169 self.values = v.into_iter().map(|i| i.into()).collect();
14170 self
14171 }
14172 }
14173
14174 impl wkt::message::Message for MultiIntValues {
14175 fn typename() -> &'static str {
14176 "type.googleapis.com/google.cloud.apihub.v1.ConfigVariable.MultiIntValues"
14177 }
14178 }
14179
14180 /// The values associated with the config variable.
14181 #[derive(Clone, Debug, PartialEq)]
14182 #[non_exhaustive]
14183 pub enum Value {
14184 /// Optional. The config variable value in case of config variable of type
14185 /// string.
14186 StringValue(std::string::String),
14187 /// Optional. The config variable value in case of config variable of type
14188 /// integer.
14189 IntValue(i64),
14190 /// Optional. The config variable value in case of config variable of type
14191 /// boolean.
14192 BoolValue(bool),
14193 /// Optional. The config variable value in case of config variable of type
14194 /// secret.
14195 SecretValue(std::boxed::Box<crate::model::Secret>),
14196 /// Optional. The config variable value in case of config variable of type
14197 /// enum.
14198 EnumValue(std::boxed::Box<crate::model::ConfigValueOption>),
14199 /// Optional. The config variable value in case of config variable of type
14200 /// multi select.
14201 MultiSelectValues(std::boxed::Box<crate::model::config_variable::MultiSelectValues>),
14202 /// Optional. The config variable value in case of config variable of type
14203 /// multi string.
14204 MultiStringValues(std::boxed::Box<crate::model::config_variable::MultiStringValues>),
14205 /// Optional. The config variable value in case of config variable of type
14206 /// multi integer.
14207 MultiIntValues(std::boxed::Box<crate::model::config_variable::MultiIntValues>),
14208 }
14209}
14210
14211/// Config for Google service account authentication.
14212#[derive(Clone, Default, PartialEq)]
14213#[non_exhaustive]
14214pub struct GoogleServiceAccountConfig {
14215 /// Required. The service account to be used for authenticating request.
14216 ///
14217 /// The `iam.serviceAccounts.getAccessToken` permission should be granted on
14218 /// this service account to the impersonator service account.
14219 pub service_account: std::string::String,
14220
14221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14222}
14223
14224impl GoogleServiceAccountConfig {
14225 pub fn new() -> Self {
14226 std::default::Default::default()
14227 }
14228
14229 /// Sets the value of [service_account][crate::model::GoogleServiceAccountConfig::service_account].
14230 ///
14231 /// # Example
14232 /// ```ignore,no_run
14233 /// # use google_cloud_apihub_v1::model::GoogleServiceAccountConfig;
14234 /// let x = GoogleServiceAccountConfig::new().set_service_account("example");
14235 /// ```
14236 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14237 self.service_account = v.into();
14238 self
14239 }
14240}
14241
14242impl wkt::message::Message for GoogleServiceAccountConfig {
14243 fn typename() -> &'static str {
14244 "type.googleapis.com/google.cloud.apihub.v1.GoogleServiceAccountConfig"
14245 }
14246}
14247
14248/// AuthConfig represents the authentication information.
14249#[derive(Clone, Default, PartialEq)]
14250#[non_exhaustive]
14251pub struct AuthConfig {
14252 /// Required. The authentication type.
14253 pub auth_type: crate::model::AuthType,
14254
14255 /// Supported auth types.
14256 pub config: std::option::Option<crate::model::auth_config::Config>,
14257
14258 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14259}
14260
14261impl AuthConfig {
14262 pub fn new() -> Self {
14263 std::default::Default::default()
14264 }
14265
14266 /// Sets the value of [auth_type][crate::model::AuthConfig::auth_type].
14267 ///
14268 /// # Example
14269 /// ```ignore,no_run
14270 /// # use google_cloud_apihub_v1::model::AuthConfig;
14271 /// use google_cloud_apihub_v1::model::AuthType;
14272 /// let x0 = AuthConfig::new().set_auth_type(AuthType::NoAuth);
14273 /// let x1 = AuthConfig::new().set_auth_type(AuthType::GoogleServiceAccount);
14274 /// let x2 = AuthConfig::new().set_auth_type(AuthType::UserPassword);
14275 /// ```
14276 pub fn set_auth_type<T: std::convert::Into<crate::model::AuthType>>(mut self, v: T) -> Self {
14277 self.auth_type = v.into();
14278 self
14279 }
14280
14281 /// Sets the value of [config][crate::model::AuthConfig::config].
14282 ///
14283 /// Note that all the setters affecting `config` are mutually
14284 /// exclusive.
14285 ///
14286 /// # Example
14287 /// ```ignore,no_run
14288 /// # use google_cloud_apihub_v1::model::AuthConfig;
14289 /// use google_cloud_apihub_v1::model::GoogleServiceAccountConfig;
14290 /// let x = AuthConfig::new().set_config(Some(
14291 /// google_cloud_apihub_v1::model::auth_config::Config::GoogleServiceAccountConfig(GoogleServiceAccountConfig::default().into())));
14292 /// ```
14293 pub fn set_config<
14294 T: std::convert::Into<std::option::Option<crate::model::auth_config::Config>>,
14295 >(
14296 mut self,
14297 v: T,
14298 ) -> Self {
14299 self.config = v.into();
14300 self
14301 }
14302
14303 /// The value of [config][crate::model::AuthConfig::config]
14304 /// if it holds a `GoogleServiceAccountConfig`, `None` if the field is not set or
14305 /// holds a different branch.
14306 pub fn google_service_account_config(
14307 &self,
14308 ) -> std::option::Option<&std::boxed::Box<crate::model::GoogleServiceAccountConfig>> {
14309 #[allow(unreachable_patterns)]
14310 self.config.as_ref().and_then(|v| match v {
14311 crate::model::auth_config::Config::GoogleServiceAccountConfig(v) => {
14312 std::option::Option::Some(v)
14313 }
14314 _ => std::option::Option::None,
14315 })
14316 }
14317
14318 /// Sets the value of [config][crate::model::AuthConfig::config]
14319 /// to hold a `GoogleServiceAccountConfig`.
14320 ///
14321 /// Note that all the setters affecting `config` are
14322 /// mutually exclusive.
14323 ///
14324 /// # Example
14325 /// ```ignore,no_run
14326 /// # use google_cloud_apihub_v1::model::AuthConfig;
14327 /// use google_cloud_apihub_v1::model::GoogleServiceAccountConfig;
14328 /// let x = AuthConfig::new().set_google_service_account_config(GoogleServiceAccountConfig::default()/* use setters */);
14329 /// assert!(x.google_service_account_config().is_some());
14330 /// assert!(x.user_password_config().is_none());
14331 /// assert!(x.api_key_config().is_none());
14332 /// assert!(x.oauth2_client_credentials_config().is_none());
14333 /// ```
14334 pub fn set_google_service_account_config<
14335 T: std::convert::Into<std::boxed::Box<crate::model::GoogleServiceAccountConfig>>,
14336 >(
14337 mut self,
14338 v: T,
14339 ) -> Self {
14340 self.config = std::option::Option::Some(
14341 crate::model::auth_config::Config::GoogleServiceAccountConfig(v.into()),
14342 );
14343 self
14344 }
14345
14346 /// The value of [config][crate::model::AuthConfig::config]
14347 /// if it holds a `UserPasswordConfig`, `None` if the field is not set or
14348 /// holds a different branch.
14349 pub fn user_password_config(
14350 &self,
14351 ) -> std::option::Option<&std::boxed::Box<crate::model::auth_config::UserPasswordConfig>> {
14352 #[allow(unreachable_patterns)]
14353 self.config.as_ref().and_then(|v| match v {
14354 crate::model::auth_config::Config::UserPasswordConfig(v) => {
14355 std::option::Option::Some(v)
14356 }
14357 _ => std::option::Option::None,
14358 })
14359 }
14360
14361 /// Sets the value of [config][crate::model::AuthConfig::config]
14362 /// to hold a `UserPasswordConfig`.
14363 ///
14364 /// Note that all the setters affecting `config` are
14365 /// mutually exclusive.
14366 ///
14367 /// # Example
14368 /// ```ignore,no_run
14369 /// # use google_cloud_apihub_v1::model::AuthConfig;
14370 /// use google_cloud_apihub_v1::model::auth_config::UserPasswordConfig;
14371 /// let x = AuthConfig::new().set_user_password_config(UserPasswordConfig::default()/* use setters */);
14372 /// assert!(x.user_password_config().is_some());
14373 /// assert!(x.google_service_account_config().is_none());
14374 /// assert!(x.api_key_config().is_none());
14375 /// assert!(x.oauth2_client_credentials_config().is_none());
14376 /// ```
14377 pub fn set_user_password_config<
14378 T: std::convert::Into<std::boxed::Box<crate::model::auth_config::UserPasswordConfig>>,
14379 >(
14380 mut self,
14381 v: T,
14382 ) -> Self {
14383 self.config = std::option::Option::Some(
14384 crate::model::auth_config::Config::UserPasswordConfig(v.into()),
14385 );
14386 self
14387 }
14388
14389 /// The value of [config][crate::model::AuthConfig::config]
14390 /// if it holds a `ApiKeyConfig`, `None` if the field is not set or
14391 /// holds a different branch.
14392 pub fn api_key_config(
14393 &self,
14394 ) -> std::option::Option<&std::boxed::Box<crate::model::auth_config::ApiKeyConfig>> {
14395 #[allow(unreachable_patterns)]
14396 self.config.as_ref().and_then(|v| match v {
14397 crate::model::auth_config::Config::ApiKeyConfig(v) => std::option::Option::Some(v),
14398 _ => std::option::Option::None,
14399 })
14400 }
14401
14402 /// Sets the value of [config][crate::model::AuthConfig::config]
14403 /// to hold a `ApiKeyConfig`.
14404 ///
14405 /// Note that all the setters affecting `config` are
14406 /// mutually exclusive.
14407 ///
14408 /// # Example
14409 /// ```ignore,no_run
14410 /// # use google_cloud_apihub_v1::model::AuthConfig;
14411 /// use google_cloud_apihub_v1::model::auth_config::ApiKeyConfig;
14412 /// let x = AuthConfig::new().set_api_key_config(ApiKeyConfig::default()/* use setters */);
14413 /// assert!(x.api_key_config().is_some());
14414 /// assert!(x.google_service_account_config().is_none());
14415 /// assert!(x.user_password_config().is_none());
14416 /// assert!(x.oauth2_client_credentials_config().is_none());
14417 /// ```
14418 pub fn set_api_key_config<
14419 T: std::convert::Into<std::boxed::Box<crate::model::auth_config::ApiKeyConfig>>,
14420 >(
14421 mut self,
14422 v: T,
14423 ) -> Self {
14424 self.config =
14425 std::option::Option::Some(crate::model::auth_config::Config::ApiKeyConfig(v.into()));
14426 self
14427 }
14428
14429 /// The value of [config][crate::model::AuthConfig::config]
14430 /// if it holds a `Oauth2ClientCredentialsConfig`, `None` if the field is not set or
14431 /// holds a different branch.
14432 pub fn oauth2_client_credentials_config(
14433 &self,
14434 ) -> std::option::Option<
14435 &std::boxed::Box<crate::model::auth_config::Oauth2ClientCredentialsConfig>,
14436 > {
14437 #[allow(unreachable_patterns)]
14438 self.config.as_ref().and_then(|v| match v {
14439 crate::model::auth_config::Config::Oauth2ClientCredentialsConfig(v) => {
14440 std::option::Option::Some(v)
14441 }
14442 _ => std::option::Option::None,
14443 })
14444 }
14445
14446 /// Sets the value of [config][crate::model::AuthConfig::config]
14447 /// to hold a `Oauth2ClientCredentialsConfig`.
14448 ///
14449 /// Note that all the setters affecting `config` are
14450 /// mutually exclusive.
14451 ///
14452 /// # Example
14453 /// ```ignore,no_run
14454 /// # use google_cloud_apihub_v1::model::AuthConfig;
14455 /// use google_cloud_apihub_v1::model::auth_config::Oauth2ClientCredentialsConfig;
14456 /// let x = AuthConfig::new().set_oauth2_client_credentials_config(Oauth2ClientCredentialsConfig::default()/* use setters */);
14457 /// assert!(x.oauth2_client_credentials_config().is_some());
14458 /// assert!(x.google_service_account_config().is_none());
14459 /// assert!(x.user_password_config().is_none());
14460 /// assert!(x.api_key_config().is_none());
14461 /// ```
14462 pub fn set_oauth2_client_credentials_config<
14463 T: std::convert::Into<
14464 std::boxed::Box<crate::model::auth_config::Oauth2ClientCredentialsConfig>,
14465 >,
14466 >(
14467 mut self,
14468 v: T,
14469 ) -> Self {
14470 self.config = std::option::Option::Some(
14471 crate::model::auth_config::Config::Oauth2ClientCredentialsConfig(v.into()),
14472 );
14473 self
14474 }
14475}
14476
14477impl wkt::message::Message for AuthConfig {
14478 fn typename() -> &'static str {
14479 "type.googleapis.com/google.cloud.apihub.v1.AuthConfig"
14480 }
14481}
14482
14483/// Defines additional types related to [AuthConfig].
14484pub mod auth_config {
14485 #[allow(unused_imports)]
14486 use super::*;
14487
14488 /// Parameters to support Username and Password Authentication.
14489 #[derive(Clone, Default, PartialEq)]
14490 #[non_exhaustive]
14491 pub struct UserPasswordConfig {
14492 /// Required. Username.
14493 pub username: std::string::String,
14494
14495 /// Required. Secret version reference containing the password.
14496 /// The `secretmanager.versions.access` permission should be
14497 /// granted to the service account accessing the secret.
14498 pub password: std::option::Option<crate::model::Secret>,
14499
14500 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14501 }
14502
14503 impl UserPasswordConfig {
14504 pub fn new() -> Self {
14505 std::default::Default::default()
14506 }
14507
14508 /// Sets the value of [username][crate::model::auth_config::UserPasswordConfig::username].
14509 ///
14510 /// # Example
14511 /// ```ignore,no_run
14512 /// # use google_cloud_apihub_v1::model::auth_config::UserPasswordConfig;
14513 /// let x = UserPasswordConfig::new().set_username("example");
14514 /// ```
14515 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14516 self.username = v.into();
14517 self
14518 }
14519
14520 /// Sets the value of [password][crate::model::auth_config::UserPasswordConfig::password].
14521 ///
14522 /// # Example
14523 /// ```ignore,no_run
14524 /// # use google_cloud_apihub_v1::model::auth_config::UserPasswordConfig;
14525 /// use google_cloud_apihub_v1::model::Secret;
14526 /// let x = UserPasswordConfig::new().set_password(Secret::default()/* use setters */);
14527 /// ```
14528 pub fn set_password<T>(mut self, v: T) -> Self
14529 where
14530 T: std::convert::Into<crate::model::Secret>,
14531 {
14532 self.password = std::option::Option::Some(v.into());
14533 self
14534 }
14535
14536 /// Sets or clears the value of [password][crate::model::auth_config::UserPasswordConfig::password].
14537 ///
14538 /// # Example
14539 /// ```ignore,no_run
14540 /// # use google_cloud_apihub_v1::model::auth_config::UserPasswordConfig;
14541 /// use google_cloud_apihub_v1::model::Secret;
14542 /// let x = UserPasswordConfig::new().set_or_clear_password(Some(Secret::default()/* use setters */));
14543 /// let x = UserPasswordConfig::new().set_or_clear_password(None::<Secret>);
14544 /// ```
14545 pub fn set_or_clear_password<T>(mut self, v: std::option::Option<T>) -> Self
14546 where
14547 T: std::convert::Into<crate::model::Secret>,
14548 {
14549 self.password = v.map(|x| x.into());
14550 self
14551 }
14552 }
14553
14554 impl wkt::message::Message for UserPasswordConfig {
14555 fn typename() -> &'static str {
14556 "type.googleapis.com/google.cloud.apihub.v1.AuthConfig.UserPasswordConfig"
14557 }
14558 }
14559
14560 /// Parameters to support Oauth 2.0 client credentials grant authentication.
14561 /// See <https://tools.ietf.org/html/rfc6749#section-1.3.4> for more details.
14562 #[derive(Clone, Default, PartialEq)]
14563 #[non_exhaustive]
14564 pub struct Oauth2ClientCredentialsConfig {
14565 /// Required. The client identifier.
14566 pub client_id: std::string::String,
14567
14568 /// Required. Secret version reference containing the client secret.
14569 /// The `secretmanager.versions.access` permission should be
14570 /// granted to the service account accessing the secret.
14571 pub client_secret: std::option::Option<crate::model::Secret>,
14572
14573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14574 }
14575
14576 impl Oauth2ClientCredentialsConfig {
14577 pub fn new() -> Self {
14578 std::default::Default::default()
14579 }
14580
14581 /// Sets the value of [client_id][crate::model::auth_config::Oauth2ClientCredentialsConfig::client_id].
14582 ///
14583 /// # Example
14584 /// ```ignore,no_run
14585 /// # use google_cloud_apihub_v1::model::auth_config::Oauth2ClientCredentialsConfig;
14586 /// let x = Oauth2ClientCredentialsConfig::new().set_client_id("example");
14587 /// ```
14588 pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14589 self.client_id = v.into();
14590 self
14591 }
14592
14593 /// Sets the value of [client_secret][crate::model::auth_config::Oauth2ClientCredentialsConfig::client_secret].
14594 ///
14595 /// # Example
14596 /// ```ignore,no_run
14597 /// # use google_cloud_apihub_v1::model::auth_config::Oauth2ClientCredentialsConfig;
14598 /// use google_cloud_apihub_v1::model::Secret;
14599 /// let x = Oauth2ClientCredentialsConfig::new().set_client_secret(Secret::default()/* use setters */);
14600 /// ```
14601 pub fn set_client_secret<T>(mut self, v: T) -> Self
14602 where
14603 T: std::convert::Into<crate::model::Secret>,
14604 {
14605 self.client_secret = std::option::Option::Some(v.into());
14606 self
14607 }
14608
14609 /// Sets or clears the value of [client_secret][crate::model::auth_config::Oauth2ClientCredentialsConfig::client_secret].
14610 ///
14611 /// # Example
14612 /// ```ignore,no_run
14613 /// # use google_cloud_apihub_v1::model::auth_config::Oauth2ClientCredentialsConfig;
14614 /// use google_cloud_apihub_v1::model::Secret;
14615 /// let x = Oauth2ClientCredentialsConfig::new().set_or_clear_client_secret(Some(Secret::default()/* use setters */));
14616 /// let x = Oauth2ClientCredentialsConfig::new().set_or_clear_client_secret(None::<Secret>);
14617 /// ```
14618 pub fn set_or_clear_client_secret<T>(mut self, v: std::option::Option<T>) -> Self
14619 where
14620 T: std::convert::Into<crate::model::Secret>,
14621 {
14622 self.client_secret = v.map(|x| x.into());
14623 self
14624 }
14625 }
14626
14627 impl wkt::message::Message for Oauth2ClientCredentialsConfig {
14628 fn typename() -> &'static str {
14629 "type.googleapis.com/google.cloud.apihub.v1.AuthConfig.Oauth2ClientCredentialsConfig"
14630 }
14631 }
14632
14633 /// Config for authentication with API key.
14634 #[derive(Clone, Default, PartialEq)]
14635 #[non_exhaustive]
14636 pub struct ApiKeyConfig {
14637 /// Required. The parameter name of the API key.
14638 /// E.g. If the API request is "<https://example.com/act?api_key=>\<API KEY\>",
14639 /// "api_key" would be the parameter name.
14640 pub name: std::string::String,
14641
14642 /// Required. The name of the SecretManager secret version resource storing
14643 /// the API key. Format:
14644 /// `projects/{project}/secrets/{secrete}/versions/{version}`. The
14645 /// `secretmanager.versions.access` permission should be granted to the
14646 /// service account accessing the secret.
14647 pub api_key: std::option::Option<crate::model::Secret>,
14648
14649 /// Required. The location of the API key.
14650 /// The default value is QUERY.
14651 pub http_element_location: crate::model::auth_config::api_key_config::HttpElementLocation,
14652
14653 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14654 }
14655
14656 impl ApiKeyConfig {
14657 pub fn new() -> Self {
14658 std::default::Default::default()
14659 }
14660
14661 /// Sets the value of [name][crate::model::auth_config::ApiKeyConfig::name].
14662 ///
14663 /// # Example
14664 /// ```ignore,no_run
14665 /// # use google_cloud_apihub_v1::model::auth_config::ApiKeyConfig;
14666 /// let x = ApiKeyConfig::new().set_name("example");
14667 /// ```
14668 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14669 self.name = v.into();
14670 self
14671 }
14672
14673 /// Sets the value of [api_key][crate::model::auth_config::ApiKeyConfig::api_key].
14674 ///
14675 /// # Example
14676 /// ```ignore,no_run
14677 /// # use google_cloud_apihub_v1::model::auth_config::ApiKeyConfig;
14678 /// use google_cloud_apihub_v1::model::Secret;
14679 /// let x = ApiKeyConfig::new().set_api_key(Secret::default()/* use setters */);
14680 /// ```
14681 pub fn set_api_key<T>(mut self, v: T) -> Self
14682 where
14683 T: std::convert::Into<crate::model::Secret>,
14684 {
14685 self.api_key = std::option::Option::Some(v.into());
14686 self
14687 }
14688
14689 /// Sets or clears the value of [api_key][crate::model::auth_config::ApiKeyConfig::api_key].
14690 ///
14691 /// # Example
14692 /// ```ignore,no_run
14693 /// # use google_cloud_apihub_v1::model::auth_config::ApiKeyConfig;
14694 /// use google_cloud_apihub_v1::model::Secret;
14695 /// let x = ApiKeyConfig::new().set_or_clear_api_key(Some(Secret::default()/* use setters */));
14696 /// let x = ApiKeyConfig::new().set_or_clear_api_key(None::<Secret>);
14697 /// ```
14698 pub fn set_or_clear_api_key<T>(mut self, v: std::option::Option<T>) -> Self
14699 where
14700 T: std::convert::Into<crate::model::Secret>,
14701 {
14702 self.api_key = v.map(|x| x.into());
14703 self
14704 }
14705
14706 /// Sets the value of [http_element_location][crate::model::auth_config::ApiKeyConfig::http_element_location].
14707 ///
14708 /// # Example
14709 /// ```ignore,no_run
14710 /// # use google_cloud_apihub_v1::model::auth_config::ApiKeyConfig;
14711 /// use google_cloud_apihub_v1::model::auth_config::api_key_config::HttpElementLocation;
14712 /// let x0 = ApiKeyConfig::new().set_http_element_location(HttpElementLocation::Query);
14713 /// let x1 = ApiKeyConfig::new().set_http_element_location(HttpElementLocation::Header);
14714 /// let x2 = ApiKeyConfig::new().set_http_element_location(HttpElementLocation::Path);
14715 /// ```
14716 pub fn set_http_element_location<
14717 T: std::convert::Into<crate::model::auth_config::api_key_config::HttpElementLocation>,
14718 >(
14719 mut self,
14720 v: T,
14721 ) -> Self {
14722 self.http_element_location = v.into();
14723 self
14724 }
14725 }
14726
14727 impl wkt::message::Message for ApiKeyConfig {
14728 fn typename() -> &'static str {
14729 "type.googleapis.com/google.cloud.apihub.v1.AuthConfig.ApiKeyConfig"
14730 }
14731 }
14732
14733 /// Defines additional types related to [ApiKeyConfig].
14734 pub mod api_key_config {
14735 #[allow(unused_imports)]
14736 use super::*;
14737
14738 /// Enum of location an HTTP element can be.
14739 ///
14740 /// # Working with unknown values
14741 ///
14742 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14743 /// additional enum variants at any time. Adding new variants is not considered
14744 /// a breaking change. Applications should write their code in anticipation of:
14745 ///
14746 /// - New values appearing in future releases of the client library, **and**
14747 /// - New values received dynamically, without application changes.
14748 ///
14749 /// Please consult the [Working with enums] section in the user guide for some
14750 /// guidelines.
14751 ///
14752 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14753 #[derive(Clone, Debug, PartialEq)]
14754 #[non_exhaustive]
14755 pub enum HttpElementLocation {
14756 /// HTTP element location not specified.
14757 Unspecified,
14758 /// Element is in the HTTP request query.
14759 Query,
14760 /// Element is in the HTTP request header.
14761 Header,
14762 /// Element is in the HTTP request path.
14763 Path,
14764 /// Element is in the HTTP request body.
14765 Body,
14766 /// Element is in the HTTP request cookie.
14767 Cookie,
14768 /// If set, the enum was initialized with an unknown value.
14769 ///
14770 /// Applications can examine the value using [HttpElementLocation::value] or
14771 /// [HttpElementLocation::name].
14772 UnknownValue(http_element_location::UnknownValue),
14773 }
14774
14775 #[doc(hidden)]
14776 pub mod http_element_location {
14777 #[allow(unused_imports)]
14778 use super::*;
14779 #[derive(Clone, Debug, PartialEq)]
14780 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14781 }
14782
14783 impl HttpElementLocation {
14784 /// Gets the enum value.
14785 ///
14786 /// Returns `None` if the enum contains an unknown value deserialized from
14787 /// the string representation of enums.
14788 pub fn value(&self) -> std::option::Option<i32> {
14789 match self {
14790 Self::Unspecified => std::option::Option::Some(0),
14791 Self::Query => std::option::Option::Some(1),
14792 Self::Header => std::option::Option::Some(2),
14793 Self::Path => std::option::Option::Some(3),
14794 Self::Body => std::option::Option::Some(4),
14795 Self::Cookie => std::option::Option::Some(5),
14796 Self::UnknownValue(u) => u.0.value(),
14797 }
14798 }
14799
14800 /// Gets the enum value as a string.
14801 ///
14802 /// Returns `None` if the enum contains an unknown value deserialized from
14803 /// the integer representation of enums.
14804 pub fn name(&self) -> std::option::Option<&str> {
14805 match self {
14806 Self::Unspecified => {
14807 std::option::Option::Some("HTTP_ELEMENT_LOCATION_UNSPECIFIED")
14808 }
14809 Self::Query => std::option::Option::Some("QUERY"),
14810 Self::Header => std::option::Option::Some("HEADER"),
14811 Self::Path => std::option::Option::Some("PATH"),
14812 Self::Body => std::option::Option::Some("BODY"),
14813 Self::Cookie => std::option::Option::Some("COOKIE"),
14814 Self::UnknownValue(u) => u.0.name(),
14815 }
14816 }
14817 }
14818
14819 impl std::default::Default for HttpElementLocation {
14820 fn default() -> Self {
14821 use std::convert::From;
14822 Self::from(0)
14823 }
14824 }
14825
14826 impl std::fmt::Display for HttpElementLocation {
14827 fn fmt(
14828 &self,
14829 f: &mut std::fmt::Formatter<'_>,
14830 ) -> std::result::Result<(), std::fmt::Error> {
14831 wkt::internal::display_enum(f, self.name(), self.value())
14832 }
14833 }
14834
14835 impl std::convert::From<i32> for HttpElementLocation {
14836 fn from(value: i32) -> Self {
14837 match value {
14838 0 => Self::Unspecified,
14839 1 => Self::Query,
14840 2 => Self::Header,
14841 3 => Self::Path,
14842 4 => Self::Body,
14843 5 => Self::Cookie,
14844 _ => Self::UnknownValue(http_element_location::UnknownValue(
14845 wkt::internal::UnknownEnumValue::Integer(value),
14846 )),
14847 }
14848 }
14849 }
14850
14851 impl std::convert::From<&str> for HttpElementLocation {
14852 fn from(value: &str) -> Self {
14853 use std::string::ToString;
14854 match value {
14855 "HTTP_ELEMENT_LOCATION_UNSPECIFIED" => Self::Unspecified,
14856 "QUERY" => Self::Query,
14857 "HEADER" => Self::Header,
14858 "PATH" => Self::Path,
14859 "BODY" => Self::Body,
14860 "COOKIE" => Self::Cookie,
14861 _ => Self::UnknownValue(http_element_location::UnknownValue(
14862 wkt::internal::UnknownEnumValue::String(value.to_string()),
14863 )),
14864 }
14865 }
14866 }
14867
14868 impl serde::ser::Serialize for HttpElementLocation {
14869 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14870 where
14871 S: serde::Serializer,
14872 {
14873 match self {
14874 Self::Unspecified => serializer.serialize_i32(0),
14875 Self::Query => serializer.serialize_i32(1),
14876 Self::Header => serializer.serialize_i32(2),
14877 Self::Path => serializer.serialize_i32(3),
14878 Self::Body => serializer.serialize_i32(4),
14879 Self::Cookie => serializer.serialize_i32(5),
14880 Self::UnknownValue(u) => u.0.serialize(serializer),
14881 }
14882 }
14883 }
14884
14885 impl<'de> serde::de::Deserialize<'de> for HttpElementLocation {
14886 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14887 where
14888 D: serde::Deserializer<'de>,
14889 {
14890 deserializer.deserialize_any(
14891 wkt::internal::EnumVisitor::<HttpElementLocation>::new(
14892 ".google.cloud.apihub.v1.AuthConfig.ApiKeyConfig.HttpElementLocation",
14893 ),
14894 )
14895 }
14896 }
14897 }
14898
14899 /// Supported auth types.
14900 #[derive(Clone, Debug, PartialEq)]
14901 #[non_exhaustive]
14902 pub enum Config {
14903 /// Google Service Account.
14904 GoogleServiceAccountConfig(std::boxed::Box<crate::model::GoogleServiceAccountConfig>),
14905 /// User Password.
14906 UserPasswordConfig(std::boxed::Box<crate::model::auth_config::UserPasswordConfig>),
14907 /// Api Key Config.
14908 ApiKeyConfig(std::boxed::Box<crate::model::auth_config::ApiKeyConfig>),
14909 /// Oauth2.0 Client Credentials.
14910 Oauth2ClientCredentialsConfig(
14911 std::boxed::Box<crate::model::auth_config::Oauth2ClientCredentialsConfig>,
14912 ),
14913 }
14914}
14915
14916/// SourceMetadata represents the metadata for a resource at the source.
14917#[derive(Clone, Default, PartialEq)]
14918#[non_exhaustive]
14919pub struct SourceMetadata {
14920 /// Output only. The type of the source.
14921 pub source_type: crate::model::source_metadata::SourceType,
14922
14923 /// Output only. The unique identifier of the resource at the source.
14924 pub original_resource_id: std::string::String,
14925
14926 /// Output only. The time at which the resource was created at the source.
14927 pub original_resource_create_time: std::option::Option<wkt::Timestamp>,
14928
14929 /// Output only. The time at which the resource was last updated at the source.
14930 pub original_resource_update_time: std::option::Option<wkt::Timestamp>,
14931
14932 /// The source of the resource.
14933 pub source: std::option::Option<crate::model::source_metadata::Source>,
14934
14935 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14936}
14937
14938impl SourceMetadata {
14939 pub fn new() -> Self {
14940 std::default::Default::default()
14941 }
14942
14943 /// Sets the value of [source_type][crate::model::SourceMetadata::source_type].
14944 ///
14945 /// # Example
14946 /// ```ignore,no_run
14947 /// # use google_cloud_apihub_v1::model::SourceMetadata;
14948 /// use google_cloud_apihub_v1::model::source_metadata::SourceType;
14949 /// let x0 = SourceMetadata::new().set_source_type(SourceType::Plugin);
14950 /// ```
14951 pub fn set_source_type<T: std::convert::Into<crate::model::source_metadata::SourceType>>(
14952 mut self,
14953 v: T,
14954 ) -> Self {
14955 self.source_type = v.into();
14956 self
14957 }
14958
14959 /// Sets the value of [original_resource_id][crate::model::SourceMetadata::original_resource_id].
14960 ///
14961 /// # Example
14962 /// ```ignore,no_run
14963 /// # use google_cloud_apihub_v1::model::SourceMetadata;
14964 /// let x = SourceMetadata::new().set_original_resource_id("example");
14965 /// ```
14966 pub fn set_original_resource_id<T: std::convert::Into<std::string::String>>(
14967 mut self,
14968 v: T,
14969 ) -> Self {
14970 self.original_resource_id = v.into();
14971 self
14972 }
14973
14974 /// Sets the value of [original_resource_create_time][crate::model::SourceMetadata::original_resource_create_time].
14975 ///
14976 /// # Example
14977 /// ```ignore,no_run
14978 /// # use google_cloud_apihub_v1::model::SourceMetadata;
14979 /// use wkt::Timestamp;
14980 /// let x = SourceMetadata::new().set_original_resource_create_time(Timestamp::default()/* use setters */);
14981 /// ```
14982 pub fn set_original_resource_create_time<T>(mut self, v: T) -> Self
14983 where
14984 T: std::convert::Into<wkt::Timestamp>,
14985 {
14986 self.original_resource_create_time = std::option::Option::Some(v.into());
14987 self
14988 }
14989
14990 /// Sets or clears the value of [original_resource_create_time][crate::model::SourceMetadata::original_resource_create_time].
14991 ///
14992 /// # Example
14993 /// ```ignore,no_run
14994 /// # use google_cloud_apihub_v1::model::SourceMetadata;
14995 /// use wkt::Timestamp;
14996 /// let x = SourceMetadata::new().set_or_clear_original_resource_create_time(Some(Timestamp::default()/* use setters */));
14997 /// let x = SourceMetadata::new().set_or_clear_original_resource_create_time(None::<Timestamp>);
14998 /// ```
14999 pub fn set_or_clear_original_resource_create_time<T>(
15000 mut self,
15001 v: std::option::Option<T>,
15002 ) -> Self
15003 where
15004 T: std::convert::Into<wkt::Timestamp>,
15005 {
15006 self.original_resource_create_time = v.map(|x| x.into());
15007 self
15008 }
15009
15010 /// Sets the value of [original_resource_update_time][crate::model::SourceMetadata::original_resource_update_time].
15011 ///
15012 /// # Example
15013 /// ```ignore,no_run
15014 /// # use google_cloud_apihub_v1::model::SourceMetadata;
15015 /// use wkt::Timestamp;
15016 /// let x = SourceMetadata::new().set_original_resource_update_time(Timestamp::default()/* use setters */);
15017 /// ```
15018 pub fn set_original_resource_update_time<T>(mut self, v: T) -> Self
15019 where
15020 T: std::convert::Into<wkt::Timestamp>,
15021 {
15022 self.original_resource_update_time = std::option::Option::Some(v.into());
15023 self
15024 }
15025
15026 /// Sets or clears the value of [original_resource_update_time][crate::model::SourceMetadata::original_resource_update_time].
15027 ///
15028 /// # Example
15029 /// ```ignore,no_run
15030 /// # use google_cloud_apihub_v1::model::SourceMetadata;
15031 /// use wkt::Timestamp;
15032 /// let x = SourceMetadata::new().set_or_clear_original_resource_update_time(Some(Timestamp::default()/* use setters */));
15033 /// let x = SourceMetadata::new().set_or_clear_original_resource_update_time(None::<Timestamp>);
15034 /// ```
15035 pub fn set_or_clear_original_resource_update_time<T>(
15036 mut self,
15037 v: std::option::Option<T>,
15038 ) -> Self
15039 where
15040 T: std::convert::Into<wkt::Timestamp>,
15041 {
15042 self.original_resource_update_time = v.map(|x| x.into());
15043 self
15044 }
15045
15046 /// Sets the value of [source][crate::model::SourceMetadata::source].
15047 ///
15048 /// Note that all the setters affecting `source` are mutually
15049 /// exclusive.
15050 ///
15051 /// # Example
15052 /// ```ignore,no_run
15053 /// # use google_cloud_apihub_v1::model::SourceMetadata;
15054 /// use google_cloud_apihub_v1::model::source_metadata::PluginInstanceActionSource;
15055 /// let x = SourceMetadata::new().set_source(Some(
15056 /// google_cloud_apihub_v1::model::source_metadata::Source::PluginInstanceActionSource(PluginInstanceActionSource::default().into())));
15057 /// ```
15058 pub fn set_source<
15059 T: std::convert::Into<std::option::Option<crate::model::source_metadata::Source>>,
15060 >(
15061 mut self,
15062 v: T,
15063 ) -> Self {
15064 self.source = v.into();
15065 self
15066 }
15067
15068 /// The value of [source][crate::model::SourceMetadata::source]
15069 /// if it holds a `PluginInstanceActionSource`, `None` if the field is not set or
15070 /// holds a different branch.
15071 pub fn plugin_instance_action_source(
15072 &self,
15073 ) -> std::option::Option<
15074 &std::boxed::Box<crate::model::source_metadata::PluginInstanceActionSource>,
15075 > {
15076 #[allow(unreachable_patterns)]
15077 self.source.as_ref().and_then(|v| match v {
15078 crate::model::source_metadata::Source::PluginInstanceActionSource(v) => {
15079 std::option::Option::Some(v)
15080 }
15081 _ => std::option::Option::None,
15082 })
15083 }
15084
15085 /// Sets the value of [source][crate::model::SourceMetadata::source]
15086 /// to hold a `PluginInstanceActionSource`.
15087 ///
15088 /// Note that all the setters affecting `source` are
15089 /// mutually exclusive.
15090 ///
15091 /// # Example
15092 /// ```ignore,no_run
15093 /// # use google_cloud_apihub_v1::model::SourceMetadata;
15094 /// use google_cloud_apihub_v1::model::source_metadata::PluginInstanceActionSource;
15095 /// let x = SourceMetadata::new().set_plugin_instance_action_source(PluginInstanceActionSource::default()/* use setters */);
15096 /// assert!(x.plugin_instance_action_source().is_some());
15097 /// ```
15098 pub fn set_plugin_instance_action_source<
15099 T: std::convert::Into<
15100 std::boxed::Box<crate::model::source_metadata::PluginInstanceActionSource>,
15101 >,
15102 >(
15103 mut self,
15104 v: T,
15105 ) -> Self {
15106 self.source = std::option::Option::Some(
15107 crate::model::source_metadata::Source::PluginInstanceActionSource(v.into()),
15108 );
15109 self
15110 }
15111}
15112
15113impl wkt::message::Message for SourceMetadata {
15114 fn typename() -> &'static str {
15115 "type.googleapis.com/google.cloud.apihub.v1.SourceMetadata"
15116 }
15117}
15118
15119/// Defines additional types related to [SourceMetadata].
15120pub mod source_metadata {
15121 #[allow(unused_imports)]
15122 use super::*;
15123
15124 /// PluginInstanceActionSource represents the plugin instance action source.
15125 #[derive(Clone, Default, PartialEq)]
15126 #[non_exhaustive]
15127 pub struct PluginInstanceActionSource {
15128 /// Output only. The resource name of the source plugin instance.
15129 /// Format is
15130 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
15131 pub plugin_instance: std::string::String,
15132
15133 /// Output only. The id of the plugin instance action.
15134 pub action_id: std::string::String,
15135
15136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15137 }
15138
15139 impl PluginInstanceActionSource {
15140 pub fn new() -> Self {
15141 std::default::Default::default()
15142 }
15143
15144 /// Sets the value of [plugin_instance][crate::model::source_metadata::PluginInstanceActionSource::plugin_instance].
15145 ///
15146 /// # Example
15147 /// ```ignore,no_run
15148 /// # use google_cloud_apihub_v1::model::source_metadata::PluginInstanceActionSource;
15149 /// let x = PluginInstanceActionSource::new().set_plugin_instance("example");
15150 /// ```
15151 pub fn set_plugin_instance<T: std::convert::Into<std::string::String>>(
15152 mut self,
15153 v: T,
15154 ) -> Self {
15155 self.plugin_instance = v.into();
15156 self
15157 }
15158
15159 /// Sets the value of [action_id][crate::model::source_metadata::PluginInstanceActionSource::action_id].
15160 ///
15161 /// # Example
15162 /// ```ignore,no_run
15163 /// # use google_cloud_apihub_v1::model::source_metadata::PluginInstanceActionSource;
15164 /// let x = PluginInstanceActionSource::new().set_action_id("example");
15165 /// ```
15166 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15167 self.action_id = v.into();
15168 self
15169 }
15170 }
15171
15172 impl wkt::message::Message for PluginInstanceActionSource {
15173 fn typename() -> &'static str {
15174 "type.googleapis.com/google.cloud.apihub.v1.SourceMetadata.PluginInstanceActionSource"
15175 }
15176 }
15177
15178 /// The possible types of the source.
15179 ///
15180 /// # Working with unknown values
15181 ///
15182 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15183 /// additional enum variants at any time. Adding new variants is not considered
15184 /// a breaking change. Applications should write their code in anticipation of:
15185 ///
15186 /// - New values appearing in future releases of the client library, **and**
15187 /// - New values received dynamically, without application changes.
15188 ///
15189 /// Please consult the [Working with enums] section in the user guide for some
15190 /// guidelines.
15191 ///
15192 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15193 #[derive(Clone, Debug, PartialEq)]
15194 #[non_exhaustive]
15195 pub enum SourceType {
15196 /// Source type not specified.
15197 Unspecified,
15198 /// Source type plugin.
15199 Plugin,
15200 /// If set, the enum was initialized with an unknown value.
15201 ///
15202 /// Applications can examine the value using [SourceType::value] or
15203 /// [SourceType::name].
15204 UnknownValue(source_type::UnknownValue),
15205 }
15206
15207 #[doc(hidden)]
15208 pub mod source_type {
15209 #[allow(unused_imports)]
15210 use super::*;
15211 #[derive(Clone, Debug, PartialEq)]
15212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15213 }
15214
15215 impl SourceType {
15216 /// Gets the enum value.
15217 ///
15218 /// Returns `None` if the enum contains an unknown value deserialized from
15219 /// the string representation of enums.
15220 pub fn value(&self) -> std::option::Option<i32> {
15221 match self {
15222 Self::Unspecified => std::option::Option::Some(0),
15223 Self::Plugin => std::option::Option::Some(1),
15224 Self::UnknownValue(u) => u.0.value(),
15225 }
15226 }
15227
15228 /// Gets the enum value as a string.
15229 ///
15230 /// Returns `None` if the enum contains an unknown value deserialized from
15231 /// the integer representation of enums.
15232 pub fn name(&self) -> std::option::Option<&str> {
15233 match self {
15234 Self::Unspecified => std::option::Option::Some("SOURCE_TYPE_UNSPECIFIED"),
15235 Self::Plugin => std::option::Option::Some("PLUGIN"),
15236 Self::UnknownValue(u) => u.0.name(),
15237 }
15238 }
15239 }
15240
15241 impl std::default::Default for SourceType {
15242 fn default() -> Self {
15243 use std::convert::From;
15244 Self::from(0)
15245 }
15246 }
15247
15248 impl std::fmt::Display for SourceType {
15249 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15250 wkt::internal::display_enum(f, self.name(), self.value())
15251 }
15252 }
15253
15254 impl std::convert::From<i32> for SourceType {
15255 fn from(value: i32) -> Self {
15256 match value {
15257 0 => Self::Unspecified,
15258 1 => Self::Plugin,
15259 _ => Self::UnknownValue(source_type::UnknownValue(
15260 wkt::internal::UnknownEnumValue::Integer(value),
15261 )),
15262 }
15263 }
15264 }
15265
15266 impl std::convert::From<&str> for SourceType {
15267 fn from(value: &str) -> Self {
15268 use std::string::ToString;
15269 match value {
15270 "SOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
15271 "PLUGIN" => Self::Plugin,
15272 _ => Self::UnknownValue(source_type::UnknownValue(
15273 wkt::internal::UnknownEnumValue::String(value.to_string()),
15274 )),
15275 }
15276 }
15277 }
15278
15279 impl serde::ser::Serialize for SourceType {
15280 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15281 where
15282 S: serde::Serializer,
15283 {
15284 match self {
15285 Self::Unspecified => serializer.serialize_i32(0),
15286 Self::Plugin => serializer.serialize_i32(1),
15287 Self::UnknownValue(u) => u.0.serialize(serializer),
15288 }
15289 }
15290 }
15291
15292 impl<'de> serde::de::Deserialize<'de> for SourceType {
15293 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15294 where
15295 D: serde::Deserializer<'de>,
15296 {
15297 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceType>::new(
15298 ".google.cloud.apihub.v1.SourceMetadata.SourceType",
15299 ))
15300 }
15301 }
15302
15303 /// The source of the resource.
15304 #[derive(Clone, Debug, PartialEq)]
15305 #[non_exhaustive]
15306 pub enum Source {
15307 /// Output only. The source of the resource is a plugin instance action.
15308 PluginInstanceActionSource(
15309 std::boxed::Box<crate::model::source_metadata::PluginInstanceActionSource>,
15310 ),
15311 }
15312}
15313
15314/// Respresents an API Observation observed in one of the sources.
15315#[derive(Clone, Default, PartialEq)]
15316#[non_exhaustive]
15317pub struct DiscoveredApiObservation {
15318 /// Identifier. The name of the discovered API Observation.
15319 ///
15320 /// Format:
15321 /// `projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}`
15322 pub name: std::string::String,
15323
15324 /// Optional. Style of ApiObservation
15325 pub style: crate::model::discovered_api_observation::Style,
15326
15327 /// Optional. The IP address (IPv4 or IPv6) of the origin server that the
15328 /// request was sent to. This field can include port information. Examples:
15329 /// `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`.
15330 pub server_ips: std::vec::Vec<std::string::String>,
15331
15332 /// Optional. The hostname of requests processed for this Observation.
15333 pub hostname: std::string::String,
15334
15335 /// Optional. Last event detected time stamp
15336 pub last_event_detected_time: std::option::Option<wkt::Timestamp>,
15337
15338 /// Optional. The location of the observation source.
15339 pub source_locations: std::vec::Vec<std::string::String>,
15340
15341 /// Optional. The number of observed API Operations.
15342 pub api_operation_count: i64,
15343
15344 /// Optional. For an observation pushed from a gcp resource, this would be the
15345 /// gcp project id.
15346 pub origin: std::string::String,
15347
15348 /// Optional. The type of the source from which the observation was collected.
15349 pub source_types: std::vec::Vec<crate::model::discovered_api_observation::SourceType>,
15350
15351 /// Output only. The number of known API Operations.
15352 pub known_operations_count: i64,
15353
15354 /// Output only. The number of unknown API Operations.
15355 pub unknown_operations_count: i64,
15356
15357 /// Output only. Create time stamp of the observation in API Hub.
15358 pub create_time: std::option::Option<wkt::Timestamp>,
15359
15360 /// Output only. Update time stamp of the observation in API Hub.
15361 pub update_time: std::option::Option<wkt::Timestamp>,
15362
15363 /// Output only. The metadata of the source from which the observation was
15364 /// collected.
15365 pub source_metadata: std::option::Option<crate::model::SourceMetadata>,
15366
15367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15368}
15369
15370impl DiscoveredApiObservation {
15371 pub fn new() -> Self {
15372 std::default::Default::default()
15373 }
15374
15375 /// Sets the value of [name][crate::model::DiscoveredApiObservation::name].
15376 ///
15377 /// # Example
15378 /// ```ignore,no_run
15379 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15380 /// let x = DiscoveredApiObservation::new().set_name("example");
15381 /// ```
15382 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15383 self.name = v.into();
15384 self
15385 }
15386
15387 /// Sets the value of [style][crate::model::DiscoveredApiObservation::style].
15388 ///
15389 /// # Example
15390 /// ```ignore,no_run
15391 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15392 /// use google_cloud_apihub_v1::model::discovered_api_observation::Style;
15393 /// let x0 = DiscoveredApiObservation::new().set_style(Style::Rest);
15394 /// let x1 = DiscoveredApiObservation::new().set_style(Style::Grpc);
15395 /// let x2 = DiscoveredApiObservation::new().set_style(Style::Graphql);
15396 /// ```
15397 pub fn set_style<T: std::convert::Into<crate::model::discovered_api_observation::Style>>(
15398 mut self,
15399 v: T,
15400 ) -> Self {
15401 self.style = v.into();
15402 self
15403 }
15404
15405 /// Sets the value of [server_ips][crate::model::DiscoveredApiObservation::server_ips].
15406 ///
15407 /// # Example
15408 /// ```ignore,no_run
15409 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15410 /// let x = DiscoveredApiObservation::new().set_server_ips(["a", "b", "c"]);
15411 /// ```
15412 pub fn set_server_ips<T, V>(mut self, v: T) -> Self
15413 where
15414 T: std::iter::IntoIterator<Item = V>,
15415 V: std::convert::Into<std::string::String>,
15416 {
15417 use std::iter::Iterator;
15418 self.server_ips = v.into_iter().map(|i| i.into()).collect();
15419 self
15420 }
15421
15422 /// Sets the value of [hostname][crate::model::DiscoveredApiObservation::hostname].
15423 ///
15424 /// # Example
15425 /// ```ignore,no_run
15426 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15427 /// let x = DiscoveredApiObservation::new().set_hostname("example");
15428 /// ```
15429 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15430 self.hostname = v.into();
15431 self
15432 }
15433
15434 /// Sets the value of [last_event_detected_time][crate::model::DiscoveredApiObservation::last_event_detected_time].
15435 ///
15436 /// # Example
15437 /// ```ignore,no_run
15438 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15439 /// use wkt::Timestamp;
15440 /// let x = DiscoveredApiObservation::new().set_last_event_detected_time(Timestamp::default()/* use setters */);
15441 /// ```
15442 pub fn set_last_event_detected_time<T>(mut self, v: T) -> Self
15443 where
15444 T: std::convert::Into<wkt::Timestamp>,
15445 {
15446 self.last_event_detected_time = std::option::Option::Some(v.into());
15447 self
15448 }
15449
15450 /// Sets or clears the value of [last_event_detected_time][crate::model::DiscoveredApiObservation::last_event_detected_time].
15451 ///
15452 /// # Example
15453 /// ```ignore,no_run
15454 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15455 /// use wkt::Timestamp;
15456 /// let x = DiscoveredApiObservation::new().set_or_clear_last_event_detected_time(Some(Timestamp::default()/* use setters */));
15457 /// let x = DiscoveredApiObservation::new().set_or_clear_last_event_detected_time(None::<Timestamp>);
15458 /// ```
15459 pub fn set_or_clear_last_event_detected_time<T>(mut self, v: std::option::Option<T>) -> Self
15460 where
15461 T: std::convert::Into<wkt::Timestamp>,
15462 {
15463 self.last_event_detected_time = v.map(|x| x.into());
15464 self
15465 }
15466
15467 /// Sets the value of [source_locations][crate::model::DiscoveredApiObservation::source_locations].
15468 ///
15469 /// # Example
15470 /// ```ignore,no_run
15471 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15472 /// let x = DiscoveredApiObservation::new().set_source_locations(["a", "b", "c"]);
15473 /// ```
15474 pub fn set_source_locations<T, V>(mut self, v: T) -> Self
15475 where
15476 T: std::iter::IntoIterator<Item = V>,
15477 V: std::convert::Into<std::string::String>,
15478 {
15479 use std::iter::Iterator;
15480 self.source_locations = v.into_iter().map(|i| i.into()).collect();
15481 self
15482 }
15483
15484 /// Sets the value of [api_operation_count][crate::model::DiscoveredApiObservation::api_operation_count].
15485 ///
15486 /// # Example
15487 /// ```ignore,no_run
15488 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15489 /// let x = DiscoveredApiObservation::new().set_api_operation_count(42);
15490 /// ```
15491 pub fn set_api_operation_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15492 self.api_operation_count = v.into();
15493 self
15494 }
15495
15496 /// Sets the value of [origin][crate::model::DiscoveredApiObservation::origin].
15497 ///
15498 /// # Example
15499 /// ```ignore,no_run
15500 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15501 /// let x = DiscoveredApiObservation::new().set_origin("example");
15502 /// ```
15503 pub fn set_origin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15504 self.origin = v.into();
15505 self
15506 }
15507
15508 /// Sets the value of [source_types][crate::model::DiscoveredApiObservation::source_types].
15509 ///
15510 /// # Example
15511 /// ```ignore,no_run
15512 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15513 /// use google_cloud_apihub_v1::model::discovered_api_observation::SourceType;
15514 /// let x = DiscoveredApiObservation::new().set_source_types([
15515 /// SourceType::GcpXlb,
15516 /// SourceType::GcpIlb,
15517 /// ]);
15518 /// ```
15519 pub fn set_source_types<T, V>(mut self, v: T) -> Self
15520 where
15521 T: std::iter::IntoIterator<Item = V>,
15522 V: std::convert::Into<crate::model::discovered_api_observation::SourceType>,
15523 {
15524 use std::iter::Iterator;
15525 self.source_types = v.into_iter().map(|i| i.into()).collect();
15526 self
15527 }
15528
15529 /// Sets the value of [known_operations_count][crate::model::DiscoveredApiObservation::known_operations_count].
15530 ///
15531 /// # Example
15532 /// ```ignore,no_run
15533 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15534 /// let x = DiscoveredApiObservation::new().set_known_operations_count(42);
15535 /// ```
15536 pub fn set_known_operations_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15537 self.known_operations_count = v.into();
15538 self
15539 }
15540
15541 /// Sets the value of [unknown_operations_count][crate::model::DiscoveredApiObservation::unknown_operations_count].
15542 ///
15543 /// # Example
15544 /// ```ignore,no_run
15545 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15546 /// let x = DiscoveredApiObservation::new().set_unknown_operations_count(42);
15547 /// ```
15548 pub fn set_unknown_operations_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15549 self.unknown_operations_count = v.into();
15550 self
15551 }
15552
15553 /// Sets the value of [create_time][crate::model::DiscoveredApiObservation::create_time].
15554 ///
15555 /// # Example
15556 /// ```ignore,no_run
15557 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15558 /// use wkt::Timestamp;
15559 /// let x = DiscoveredApiObservation::new().set_create_time(Timestamp::default()/* use setters */);
15560 /// ```
15561 pub fn set_create_time<T>(mut self, v: T) -> Self
15562 where
15563 T: std::convert::Into<wkt::Timestamp>,
15564 {
15565 self.create_time = std::option::Option::Some(v.into());
15566 self
15567 }
15568
15569 /// Sets or clears the value of [create_time][crate::model::DiscoveredApiObservation::create_time].
15570 ///
15571 /// # Example
15572 /// ```ignore,no_run
15573 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15574 /// use wkt::Timestamp;
15575 /// let x = DiscoveredApiObservation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15576 /// let x = DiscoveredApiObservation::new().set_or_clear_create_time(None::<Timestamp>);
15577 /// ```
15578 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15579 where
15580 T: std::convert::Into<wkt::Timestamp>,
15581 {
15582 self.create_time = v.map(|x| x.into());
15583 self
15584 }
15585
15586 /// Sets the value of [update_time][crate::model::DiscoveredApiObservation::update_time].
15587 ///
15588 /// # Example
15589 /// ```ignore,no_run
15590 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15591 /// use wkt::Timestamp;
15592 /// let x = DiscoveredApiObservation::new().set_update_time(Timestamp::default()/* use setters */);
15593 /// ```
15594 pub fn set_update_time<T>(mut self, v: T) -> Self
15595 where
15596 T: std::convert::Into<wkt::Timestamp>,
15597 {
15598 self.update_time = std::option::Option::Some(v.into());
15599 self
15600 }
15601
15602 /// Sets or clears the value of [update_time][crate::model::DiscoveredApiObservation::update_time].
15603 ///
15604 /// # Example
15605 /// ```ignore,no_run
15606 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15607 /// use wkt::Timestamp;
15608 /// let x = DiscoveredApiObservation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15609 /// let x = DiscoveredApiObservation::new().set_or_clear_update_time(None::<Timestamp>);
15610 /// ```
15611 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15612 where
15613 T: std::convert::Into<wkt::Timestamp>,
15614 {
15615 self.update_time = v.map(|x| x.into());
15616 self
15617 }
15618
15619 /// Sets the value of [source_metadata][crate::model::DiscoveredApiObservation::source_metadata].
15620 ///
15621 /// # Example
15622 /// ```ignore,no_run
15623 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15624 /// use google_cloud_apihub_v1::model::SourceMetadata;
15625 /// let x = DiscoveredApiObservation::new().set_source_metadata(SourceMetadata::default()/* use setters */);
15626 /// ```
15627 pub fn set_source_metadata<T>(mut self, v: T) -> Self
15628 where
15629 T: std::convert::Into<crate::model::SourceMetadata>,
15630 {
15631 self.source_metadata = std::option::Option::Some(v.into());
15632 self
15633 }
15634
15635 /// Sets or clears the value of [source_metadata][crate::model::DiscoveredApiObservation::source_metadata].
15636 ///
15637 /// # Example
15638 /// ```ignore,no_run
15639 /// # use google_cloud_apihub_v1::model::DiscoveredApiObservation;
15640 /// use google_cloud_apihub_v1::model::SourceMetadata;
15641 /// let x = DiscoveredApiObservation::new().set_or_clear_source_metadata(Some(SourceMetadata::default()/* use setters */));
15642 /// let x = DiscoveredApiObservation::new().set_or_clear_source_metadata(None::<SourceMetadata>);
15643 /// ```
15644 pub fn set_or_clear_source_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15645 where
15646 T: std::convert::Into<crate::model::SourceMetadata>,
15647 {
15648 self.source_metadata = v.map(|x| x.into());
15649 self
15650 }
15651}
15652
15653impl wkt::message::Message for DiscoveredApiObservation {
15654 fn typename() -> &'static str {
15655 "type.googleapis.com/google.cloud.apihub.v1.DiscoveredApiObservation"
15656 }
15657}
15658
15659/// Defines additional types related to [DiscoveredApiObservation].
15660pub mod discovered_api_observation {
15661 #[allow(unused_imports)]
15662 use super::*;
15663
15664 /// DiscoveredApiObservation protocol style
15665 ///
15666 /// # Working with unknown values
15667 ///
15668 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15669 /// additional enum variants at any time. Adding new variants is not considered
15670 /// a breaking change. Applications should write their code in anticipation of:
15671 ///
15672 /// - New values appearing in future releases of the client library, **and**
15673 /// - New values received dynamically, without application changes.
15674 ///
15675 /// Please consult the [Working with enums] section in the user guide for some
15676 /// guidelines.
15677 ///
15678 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15679 #[derive(Clone, Debug, PartialEq)]
15680 #[non_exhaustive]
15681 pub enum Style {
15682 /// Unknown style
15683 Unspecified,
15684 /// Style is Rest API
15685 Rest,
15686 /// Style is Grpc API
15687 Grpc,
15688 /// Style is GraphQL API
15689 Graphql,
15690 /// If set, the enum was initialized with an unknown value.
15691 ///
15692 /// Applications can examine the value using [Style::value] or
15693 /// [Style::name].
15694 UnknownValue(style::UnknownValue),
15695 }
15696
15697 #[doc(hidden)]
15698 pub mod style {
15699 #[allow(unused_imports)]
15700 use super::*;
15701 #[derive(Clone, Debug, PartialEq)]
15702 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15703 }
15704
15705 impl Style {
15706 /// Gets the enum value.
15707 ///
15708 /// Returns `None` if the enum contains an unknown value deserialized from
15709 /// the string representation of enums.
15710 pub fn value(&self) -> std::option::Option<i32> {
15711 match self {
15712 Self::Unspecified => std::option::Option::Some(0),
15713 Self::Rest => std::option::Option::Some(1),
15714 Self::Grpc => std::option::Option::Some(2),
15715 Self::Graphql => std::option::Option::Some(3),
15716 Self::UnknownValue(u) => u.0.value(),
15717 }
15718 }
15719
15720 /// Gets the enum value as a string.
15721 ///
15722 /// Returns `None` if the enum contains an unknown value deserialized from
15723 /// the integer representation of enums.
15724 pub fn name(&self) -> std::option::Option<&str> {
15725 match self {
15726 Self::Unspecified => std::option::Option::Some("STYLE_UNSPECIFIED"),
15727 Self::Rest => std::option::Option::Some("REST"),
15728 Self::Grpc => std::option::Option::Some("GRPC"),
15729 Self::Graphql => std::option::Option::Some("GRAPHQL"),
15730 Self::UnknownValue(u) => u.0.name(),
15731 }
15732 }
15733 }
15734
15735 impl std::default::Default for Style {
15736 fn default() -> Self {
15737 use std::convert::From;
15738 Self::from(0)
15739 }
15740 }
15741
15742 impl std::fmt::Display for Style {
15743 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15744 wkt::internal::display_enum(f, self.name(), self.value())
15745 }
15746 }
15747
15748 impl std::convert::From<i32> for Style {
15749 fn from(value: i32) -> Self {
15750 match value {
15751 0 => Self::Unspecified,
15752 1 => Self::Rest,
15753 2 => Self::Grpc,
15754 3 => Self::Graphql,
15755 _ => Self::UnknownValue(style::UnknownValue(
15756 wkt::internal::UnknownEnumValue::Integer(value),
15757 )),
15758 }
15759 }
15760 }
15761
15762 impl std::convert::From<&str> for Style {
15763 fn from(value: &str) -> Self {
15764 use std::string::ToString;
15765 match value {
15766 "STYLE_UNSPECIFIED" => Self::Unspecified,
15767 "REST" => Self::Rest,
15768 "GRPC" => Self::Grpc,
15769 "GRAPHQL" => Self::Graphql,
15770 _ => Self::UnknownValue(style::UnknownValue(
15771 wkt::internal::UnknownEnumValue::String(value.to_string()),
15772 )),
15773 }
15774 }
15775 }
15776
15777 impl serde::ser::Serialize for Style {
15778 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15779 where
15780 S: serde::Serializer,
15781 {
15782 match self {
15783 Self::Unspecified => serializer.serialize_i32(0),
15784 Self::Rest => serializer.serialize_i32(1),
15785 Self::Grpc => serializer.serialize_i32(2),
15786 Self::Graphql => serializer.serialize_i32(3),
15787 Self::UnknownValue(u) => u.0.serialize(serializer),
15788 }
15789 }
15790 }
15791
15792 impl<'de> serde::de::Deserialize<'de> for Style {
15793 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15794 where
15795 D: serde::Deserializer<'de>,
15796 {
15797 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Style>::new(
15798 ".google.cloud.apihub.v1.DiscoveredApiObservation.Style",
15799 ))
15800 }
15801 }
15802
15803 /// The possible types of the source from which the observation was collected.
15804 ///
15805 /// # Working with unknown values
15806 ///
15807 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15808 /// additional enum variants at any time. Adding new variants is not considered
15809 /// a breaking change. Applications should write their code in anticipation of:
15810 ///
15811 /// - New values appearing in future releases of the client library, **and**
15812 /// - New values received dynamically, without application changes.
15813 ///
15814 /// Please consult the [Working with enums] section in the user guide for some
15815 /// guidelines.
15816 ///
15817 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15818 #[derive(Clone, Debug, PartialEq)]
15819 #[non_exhaustive]
15820 pub enum SourceType {
15821 /// Source type not specified.
15822 Unspecified,
15823 /// GCP external load balancer.
15824 GcpXlb,
15825 /// GCP internal load balancer.
15826 GcpIlb,
15827 /// If set, the enum was initialized with an unknown value.
15828 ///
15829 /// Applications can examine the value using [SourceType::value] or
15830 /// [SourceType::name].
15831 UnknownValue(source_type::UnknownValue),
15832 }
15833
15834 #[doc(hidden)]
15835 pub mod source_type {
15836 #[allow(unused_imports)]
15837 use super::*;
15838 #[derive(Clone, Debug, PartialEq)]
15839 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15840 }
15841
15842 impl SourceType {
15843 /// Gets the enum value.
15844 ///
15845 /// Returns `None` if the enum contains an unknown value deserialized from
15846 /// the string representation of enums.
15847 pub fn value(&self) -> std::option::Option<i32> {
15848 match self {
15849 Self::Unspecified => std::option::Option::Some(0),
15850 Self::GcpXlb => std::option::Option::Some(1),
15851 Self::GcpIlb => std::option::Option::Some(2),
15852 Self::UnknownValue(u) => u.0.value(),
15853 }
15854 }
15855
15856 /// Gets the enum value as a string.
15857 ///
15858 /// Returns `None` if the enum contains an unknown value deserialized from
15859 /// the integer representation of enums.
15860 pub fn name(&self) -> std::option::Option<&str> {
15861 match self {
15862 Self::Unspecified => std::option::Option::Some("SOURCE_TYPE_UNSPECIFIED"),
15863 Self::GcpXlb => std::option::Option::Some("GCP_XLB"),
15864 Self::GcpIlb => std::option::Option::Some("GCP_ILB"),
15865 Self::UnknownValue(u) => u.0.name(),
15866 }
15867 }
15868 }
15869
15870 impl std::default::Default for SourceType {
15871 fn default() -> Self {
15872 use std::convert::From;
15873 Self::from(0)
15874 }
15875 }
15876
15877 impl std::fmt::Display for SourceType {
15878 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15879 wkt::internal::display_enum(f, self.name(), self.value())
15880 }
15881 }
15882
15883 impl std::convert::From<i32> for SourceType {
15884 fn from(value: i32) -> Self {
15885 match value {
15886 0 => Self::Unspecified,
15887 1 => Self::GcpXlb,
15888 2 => Self::GcpIlb,
15889 _ => Self::UnknownValue(source_type::UnknownValue(
15890 wkt::internal::UnknownEnumValue::Integer(value),
15891 )),
15892 }
15893 }
15894 }
15895
15896 impl std::convert::From<&str> for SourceType {
15897 fn from(value: &str) -> Self {
15898 use std::string::ToString;
15899 match value {
15900 "SOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
15901 "GCP_XLB" => Self::GcpXlb,
15902 "GCP_ILB" => Self::GcpIlb,
15903 _ => Self::UnknownValue(source_type::UnknownValue(
15904 wkt::internal::UnknownEnumValue::String(value.to_string()),
15905 )),
15906 }
15907 }
15908 }
15909
15910 impl serde::ser::Serialize for SourceType {
15911 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15912 where
15913 S: serde::Serializer,
15914 {
15915 match self {
15916 Self::Unspecified => serializer.serialize_i32(0),
15917 Self::GcpXlb => serializer.serialize_i32(1),
15918 Self::GcpIlb => serializer.serialize_i32(2),
15919 Self::UnknownValue(u) => u.0.serialize(serializer),
15920 }
15921 }
15922 }
15923
15924 impl<'de> serde::de::Deserialize<'de> for SourceType {
15925 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15926 where
15927 D: serde::Deserializer<'de>,
15928 {
15929 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SourceType>::new(
15930 ".google.cloud.apihub.v1.DiscoveredApiObservation.SourceType",
15931 ))
15932 }
15933 }
15934}
15935
15936/// DiscoveredApiOperation represents an API Operation observed in one of the
15937/// sources.
15938#[derive(Clone, Default, PartialEq)]
15939#[non_exhaustive]
15940pub struct DiscoveredApiOperation {
15941 /// Identifier. The name of the discovered API Operation.
15942 ///
15943 /// Format:
15944 /// `projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}/discoveredApiOperations/{discovered_api_operation}`
15945 pub name: std::string::String,
15946
15947 /// Optional. First seen time stamp
15948 pub first_seen_time: std::option::Option<wkt::Timestamp>,
15949
15950 /// Optional. Last seen time stamp
15951 pub last_seen_time: std::option::Option<wkt::Timestamp>,
15952
15953 /// Optional. The number of occurrences of this API Operation.
15954 pub count: i64,
15955
15956 /// Output only. The classification of the discovered API operation.
15957 pub classification: crate::model::discovered_api_operation::Classification,
15958
15959 /// Output only. The list of matched results for the discovered API operation.
15960 /// This will be populated only if the classification is known. The current
15961 /// usecase is for a single match. Keeping it repeated to support multiple
15962 /// matches in future.
15963 pub match_results: std::vec::Vec<crate::model::discovered_api_operation::MatchResult>,
15964
15965 /// Output only. The metadata of the source from which the api operation was
15966 /// collected.
15967 pub source_metadata: std::option::Option<crate::model::SourceMetadata>,
15968
15969 /// Output only. Create time stamp of the discovered API operation in API Hub.
15970 pub create_time: std::option::Option<wkt::Timestamp>,
15971
15972 /// Output only. Update time stamp of the discovered API operation in API Hub.
15973 pub update_time: std::option::Option<wkt::Timestamp>,
15974
15975 /// ApiOperation protocol style
15976 pub operation: std::option::Option<crate::model::discovered_api_operation::Operation>,
15977
15978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15979}
15980
15981impl DiscoveredApiOperation {
15982 pub fn new() -> Self {
15983 std::default::Default::default()
15984 }
15985
15986 /// Sets the value of [name][crate::model::DiscoveredApiOperation::name].
15987 ///
15988 /// # Example
15989 /// ```ignore,no_run
15990 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
15991 /// let x = DiscoveredApiOperation::new().set_name("example");
15992 /// ```
15993 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15994 self.name = v.into();
15995 self
15996 }
15997
15998 /// Sets the value of [first_seen_time][crate::model::DiscoveredApiOperation::first_seen_time].
15999 ///
16000 /// # Example
16001 /// ```ignore,no_run
16002 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16003 /// use wkt::Timestamp;
16004 /// let x = DiscoveredApiOperation::new().set_first_seen_time(Timestamp::default()/* use setters */);
16005 /// ```
16006 pub fn set_first_seen_time<T>(mut self, v: T) -> Self
16007 where
16008 T: std::convert::Into<wkt::Timestamp>,
16009 {
16010 self.first_seen_time = std::option::Option::Some(v.into());
16011 self
16012 }
16013
16014 /// Sets or clears the value of [first_seen_time][crate::model::DiscoveredApiOperation::first_seen_time].
16015 ///
16016 /// # Example
16017 /// ```ignore,no_run
16018 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16019 /// use wkt::Timestamp;
16020 /// let x = DiscoveredApiOperation::new().set_or_clear_first_seen_time(Some(Timestamp::default()/* use setters */));
16021 /// let x = DiscoveredApiOperation::new().set_or_clear_first_seen_time(None::<Timestamp>);
16022 /// ```
16023 pub fn set_or_clear_first_seen_time<T>(mut self, v: std::option::Option<T>) -> Self
16024 where
16025 T: std::convert::Into<wkt::Timestamp>,
16026 {
16027 self.first_seen_time = v.map(|x| x.into());
16028 self
16029 }
16030
16031 /// Sets the value of [last_seen_time][crate::model::DiscoveredApiOperation::last_seen_time].
16032 ///
16033 /// # Example
16034 /// ```ignore,no_run
16035 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16036 /// use wkt::Timestamp;
16037 /// let x = DiscoveredApiOperation::new().set_last_seen_time(Timestamp::default()/* use setters */);
16038 /// ```
16039 pub fn set_last_seen_time<T>(mut self, v: T) -> Self
16040 where
16041 T: std::convert::Into<wkt::Timestamp>,
16042 {
16043 self.last_seen_time = std::option::Option::Some(v.into());
16044 self
16045 }
16046
16047 /// Sets or clears the value of [last_seen_time][crate::model::DiscoveredApiOperation::last_seen_time].
16048 ///
16049 /// # Example
16050 /// ```ignore,no_run
16051 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16052 /// use wkt::Timestamp;
16053 /// let x = DiscoveredApiOperation::new().set_or_clear_last_seen_time(Some(Timestamp::default()/* use setters */));
16054 /// let x = DiscoveredApiOperation::new().set_or_clear_last_seen_time(None::<Timestamp>);
16055 /// ```
16056 pub fn set_or_clear_last_seen_time<T>(mut self, v: std::option::Option<T>) -> Self
16057 where
16058 T: std::convert::Into<wkt::Timestamp>,
16059 {
16060 self.last_seen_time = v.map(|x| x.into());
16061 self
16062 }
16063
16064 /// Sets the value of [count][crate::model::DiscoveredApiOperation::count].
16065 ///
16066 /// # Example
16067 /// ```ignore,no_run
16068 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16069 /// let x = DiscoveredApiOperation::new().set_count(42);
16070 /// ```
16071 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16072 self.count = v.into();
16073 self
16074 }
16075
16076 /// Sets the value of [classification][crate::model::DiscoveredApiOperation::classification].
16077 ///
16078 /// # Example
16079 /// ```ignore,no_run
16080 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16081 /// use google_cloud_apihub_v1::model::discovered_api_operation::Classification;
16082 /// let x0 = DiscoveredApiOperation::new().set_classification(Classification::Known);
16083 /// let x1 = DiscoveredApiOperation::new().set_classification(Classification::Unknown);
16084 /// ```
16085 pub fn set_classification<
16086 T: std::convert::Into<crate::model::discovered_api_operation::Classification>,
16087 >(
16088 mut self,
16089 v: T,
16090 ) -> Self {
16091 self.classification = v.into();
16092 self
16093 }
16094
16095 /// Sets the value of [match_results][crate::model::DiscoveredApiOperation::match_results].
16096 ///
16097 /// # Example
16098 /// ```ignore,no_run
16099 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16100 /// use google_cloud_apihub_v1::model::discovered_api_operation::MatchResult;
16101 /// let x = DiscoveredApiOperation::new()
16102 /// .set_match_results([
16103 /// MatchResult::default()/* use setters */,
16104 /// MatchResult::default()/* use (different) setters */,
16105 /// ]);
16106 /// ```
16107 pub fn set_match_results<T, V>(mut self, v: T) -> Self
16108 where
16109 T: std::iter::IntoIterator<Item = V>,
16110 V: std::convert::Into<crate::model::discovered_api_operation::MatchResult>,
16111 {
16112 use std::iter::Iterator;
16113 self.match_results = v.into_iter().map(|i| i.into()).collect();
16114 self
16115 }
16116
16117 /// Sets the value of [source_metadata][crate::model::DiscoveredApiOperation::source_metadata].
16118 ///
16119 /// # Example
16120 /// ```ignore,no_run
16121 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16122 /// use google_cloud_apihub_v1::model::SourceMetadata;
16123 /// let x = DiscoveredApiOperation::new().set_source_metadata(SourceMetadata::default()/* use setters */);
16124 /// ```
16125 pub fn set_source_metadata<T>(mut self, v: T) -> Self
16126 where
16127 T: std::convert::Into<crate::model::SourceMetadata>,
16128 {
16129 self.source_metadata = std::option::Option::Some(v.into());
16130 self
16131 }
16132
16133 /// Sets or clears the value of [source_metadata][crate::model::DiscoveredApiOperation::source_metadata].
16134 ///
16135 /// # Example
16136 /// ```ignore,no_run
16137 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16138 /// use google_cloud_apihub_v1::model::SourceMetadata;
16139 /// let x = DiscoveredApiOperation::new().set_or_clear_source_metadata(Some(SourceMetadata::default()/* use setters */));
16140 /// let x = DiscoveredApiOperation::new().set_or_clear_source_metadata(None::<SourceMetadata>);
16141 /// ```
16142 pub fn set_or_clear_source_metadata<T>(mut self, v: std::option::Option<T>) -> Self
16143 where
16144 T: std::convert::Into<crate::model::SourceMetadata>,
16145 {
16146 self.source_metadata = v.map(|x| x.into());
16147 self
16148 }
16149
16150 /// Sets the value of [create_time][crate::model::DiscoveredApiOperation::create_time].
16151 ///
16152 /// # Example
16153 /// ```ignore,no_run
16154 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16155 /// use wkt::Timestamp;
16156 /// let x = DiscoveredApiOperation::new().set_create_time(Timestamp::default()/* use setters */);
16157 /// ```
16158 pub fn set_create_time<T>(mut self, v: T) -> Self
16159 where
16160 T: std::convert::Into<wkt::Timestamp>,
16161 {
16162 self.create_time = std::option::Option::Some(v.into());
16163 self
16164 }
16165
16166 /// Sets or clears the value of [create_time][crate::model::DiscoveredApiOperation::create_time].
16167 ///
16168 /// # Example
16169 /// ```ignore,no_run
16170 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16171 /// use wkt::Timestamp;
16172 /// let x = DiscoveredApiOperation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16173 /// let x = DiscoveredApiOperation::new().set_or_clear_create_time(None::<Timestamp>);
16174 /// ```
16175 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16176 where
16177 T: std::convert::Into<wkt::Timestamp>,
16178 {
16179 self.create_time = v.map(|x| x.into());
16180 self
16181 }
16182
16183 /// Sets the value of [update_time][crate::model::DiscoveredApiOperation::update_time].
16184 ///
16185 /// # Example
16186 /// ```ignore,no_run
16187 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16188 /// use wkt::Timestamp;
16189 /// let x = DiscoveredApiOperation::new().set_update_time(Timestamp::default()/* use setters */);
16190 /// ```
16191 pub fn set_update_time<T>(mut self, v: T) -> Self
16192 where
16193 T: std::convert::Into<wkt::Timestamp>,
16194 {
16195 self.update_time = std::option::Option::Some(v.into());
16196 self
16197 }
16198
16199 /// Sets or clears the value of [update_time][crate::model::DiscoveredApiOperation::update_time].
16200 ///
16201 /// # Example
16202 /// ```ignore,no_run
16203 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16204 /// use wkt::Timestamp;
16205 /// let x = DiscoveredApiOperation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16206 /// let x = DiscoveredApiOperation::new().set_or_clear_update_time(None::<Timestamp>);
16207 /// ```
16208 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16209 where
16210 T: std::convert::Into<wkt::Timestamp>,
16211 {
16212 self.update_time = v.map(|x| x.into());
16213 self
16214 }
16215
16216 /// Sets the value of [operation][crate::model::DiscoveredApiOperation::operation].
16217 ///
16218 /// Note that all the setters affecting `operation` are mutually
16219 /// exclusive.
16220 ///
16221 /// # Example
16222 /// ```ignore,no_run
16223 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16224 /// use google_cloud_apihub_v1::model::HttpOperationDetails;
16225 /// let x = DiscoveredApiOperation::new().set_operation(Some(
16226 /// google_cloud_apihub_v1::model::discovered_api_operation::Operation::HttpOperation(HttpOperationDetails::default().into())));
16227 /// ```
16228 pub fn set_operation<
16229 T: std::convert::Into<std::option::Option<crate::model::discovered_api_operation::Operation>>,
16230 >(
16231 mut self,
16232 v: T,
16233 ) -> Self {
16234 self.operation = v.into();
16235 self
16236 }
16237
16238 /// The value of [operation][crate::model::DiscoveredApiOperation::operation]
16239 /// if it holds a `HttpOperation`, `None` if the field is not set or
16240 /// holds a different branch.
16241 pub fn http_operation(
16242 &self,
16243 ) -> std::option::Option<&std::boxed::Box<crate::model::HttpOperationDetails>> {
16244 #[allow(unreachable_patterns)]
16245 self.operation.as_ref().and_then(|v| match v {
16246 crate::model::discovered_api_operation::Operation::HttpOperation(v) => {
16247 std::option::Option::Some(v)
16248 }
16249 _ => std::option::Option::None,
16250 })
16251 }
16252
16253 /// Sets the value of [operation][crate::model::DiscoveredApiOperation::operation]
16254 /// to hold a `HttpOperation`.
16255 ///
16256 /// Note that all the setters affecting `operation` are
16257 /// mutually exclusive.
16258 ///
16259 /// # Example
16260 /// ```ignore,no_run
16261 /// # use google_cloud_apihub_v1::model::DiscoveredApiOperation;
16262 /// use google_cloud_apihub_v1::model::HttpOperationDetails;
16263 /// let x = DiscoveredApiOperation::new().set_http_operation(HttpOperationDetails::default()/* use setters */);
16264 /// assert!(x.http_operation().is_some());
16265 /// ```
16266 pub fn set_http_operation<
16267 T: std::convert::Into<std::boxed::Box<crate::model::HttpOperationDetails>>,
16268 >(
16269 mut self,
16270 v: T,
16271 ) -> Self {
16272 self.operation = std::option::Option::Some(
16273 crate::model::discovered_api_operation::Operation::HttpOperation(v.into()),
16274 );
16275 self
16276 }
16277}
16278
16279impl wkt::message::Message for DiscoveredApiOperation {
16280 fn typename() -> &'static str {
16281 "type.googleapis.com/google.cloud.apihub.v1.DiscoveredApiOperation"
16282 }
16283}
16284
16285/// Defines additional types related to [DiscoveredApiOperation].
16286pub mod discovered_api_operation {
16287 #[allow(unused_imports)]
16288 use super::*;
16289
16290 /// MatchResult represents the result of matching a discovered API operation
16291 /// with a catalog API operation.
16292 #[derive(Clone, Default, PartialEq)]
16293 #[non_exhaustive]
16294 pub struct MatchResult {
16295 /// Output only. The name of the matched API Operation.
16296 ///
16297 /// Format:
16298 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
16299 pub name: std::string::String,
16300
16301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16302 }
16303
16304 impl MatchResult {
16305 pub fn new() -> Self {
16306 std::default::Default::default()
16307 }
16308
16309 /// Sets the value of [name][crate::model::discovered_api_operation::MatchResult::name].
16310 ///
16311 /// # Example
16312 /// ```ignore,no_run
16313 /// # use google_cloud_apihub_v1::model::discovered_api_operation::MatchResult;
16314 /// let x = MatchResult::new().set_name("example");
16315 /// ```
16316 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16317 self.name = v.into();
16318 self
16319 }
16320 }
16321
16322 impl wkt::message::Message for MatchResult {
16323 fn typename() -> &'static str {
16324 "type.googleapis.com/google.cloud.apihub.v1.DiscoveredApiOperation.MatchResult"
16325 }
16326 }
16327
16328 /// The classification of the discovered API operation.
16329 ///
16330 /// # Working with unknown values
16331 ///
16332 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16333 /// additional enum variants at any time. Adding new variants is not considered
16334 /// a breaking change. Applications should write their code in anticipation of:
16335 ///
16336 /// - New values appearing in future releases of the client library, **and**
16337 /// - New values received dynamically, without application changes.
16338 ///
16339 /// Please consult the [Working with enums] section in the user guide for some
16340 /// guidelines.
16341 ///
16342 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16343 #[derive(Clone, Debug, PartialEq)]
16344 #[non_exhaustive]
16345 pub enum Classification {
16346 /// Operation is not classified as known or unknown.
16347 Unspecified,
16348 /// Operation has a matched catalog operation.
16349 Known,
16350 /// Operation does not have a matched catalog operation.
16351 Unknown,
16352 /// If set, the enum was initialized with an unknown value.
16353 ///
16354 /// Applications can examine the value using [Classification::value] or
16355 /// [Classification::name].
16356 UnknownValue(classification::UnknownValue),
16357 }
16358
16359 #[doc(hidden)]
16360 pub mod classification {
16361 #[allow(unused_imports)]
16362 use super::*;
16363 #[derive(Clone, Debug, PartialEq)]
16364 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16365 }
16366
16367 impl Classification {
16368 /// Gets the enum value.
16369 ///
16370 /// Returns `None` if the enum contains an unknown value deserialized from
16371 /// the string representation of enums.
16372 pub fn value(&self) -> std::option::Option<i32> {
16373 match self {
16374 Self::Unspecified => std::option::Option::Some(0),
16375 Self::Known => std::option::Option::Some(1),
16376 Self::Unknown => std::option::Option::Some(2),
16377 Self::UnknownValue(u) => u.0.value(),
16378 }
16379 }
16380
16381 /// Gets the enum value as a string.
16382 ///
16383 /// Returns `None` if the enum contains an unknown value deserialized from
16384 /// the integer representation of enums.
16385 pub fn name(&self) -> std::option::Option<&str> {
16386 match self {
16387 Self::Unspecified => std::option::Option::Some("CLASSIFICATION_UNSPECIFIED"),
16388 Self::Known => std::option::Option::Some("KNOWN"),
16389 Self::Unknown => std::option::Option::Some("UNKNOWN"),
16390 Self::UnknownValue(u) => u.0.name(),
16391 }
16392 }
16393 }
16394
16395 impl std::default::Default for Classification {
16396 fn default() -> Self {
16397 use std::convert::From;
16398 Self::from(0)
16399 }
16400 }
16401
16402 impl std::fmt::Display for Classification {
16403 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16404 wkt::internal::display_enum(f, self.name(), self.value())
16405 }
16406 }
16407
16408 impl std::convert::From<i32> for Classification {
16409 fn from(value: i32) -> Self {
16410 match value {
16411 0 => Self::Unspecified,
16412 1 => Self::Known,
16413 2 => Self::Unknown,
16414 _ => Self::UnknownValue(classification::UnknownValue(
16415 wkt::internal::UnknownEnumValue::Integer(value),
16416 )),
16417 }
16418 }
16419 }
16420
16421 impl std::convert::From<&str> for Classification {
16422 fn from(value: &str) -> Self {
16423 use std::string::ToString;
16424 match value {
16425 "CLASSIFICATION_UNSPECIFIED" => Self::Unspecified,
16426 "KNOWN" => Self::Known,
16427 "UNKNOWN" => Self::Unknown,
16428 _ => Self::UnknownValue(classification::UnknownValue(
16429 wkt::internal::UnknownEnumValue::String(value.to_string()),
16430 )),
16431 }
16432 }
16433 }
16434
16435 impl serde::ser::Serialize for Classification {
16436 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16437 where
16438 S: serde::Serializer,
16439 {
16440 match self {
16441 Self::Unspecified => serializer.serialize_i32(0),
16442 Self::Known => serializer.serialize_i32(1),
16443 Self::Unknown => serializer.serialize_i32(2),
16444 Self::UnknownValue(u) => u.0.serialize(serializer),
16445 }
16446 }
16447 }
16448
16449 impl<'de> serde::de::Deserialize<'de> for Classification {
16450 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16451 where
16452 D: serde::Deserializer<'de>,
16453 {
16454 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Classification>::new(
16455 ".google.cloud.apihub.v1.DiscoveredApiOperation.Classification",
16456 ))
16457 }
16458 }
16459
16460 /// ApiOperation protocol style
16461 #[derive(Clone, Debug, PartialEq)]
16462 #[non_exhaustive]
16463 pub enum Operation {
16464 /// Optional. An HTTP Operation.
16465 HttpOperation(std::boxed::Box<crate::model::HttpOperationDetails>),
16466 }
16467}
16468
16469/// An HTTP-based API Operation, sometimes called a "REST" Operation.
16470#[derive(Clone, Default, PartialEq)]
16471#[non_exhaustive]
16472pub struct HttpOperationDetails {
16473 /// Required. An HTTP Operation.
16474 pub http_operation: std::option::Option<crate::model::HttpOperation>,
16475
16476 /// Optional. Path params of HttpOperation
16477 pub path_params: std::vec::Vec<crate::model::http_operation_details::PathParam>,
16478
16479 /// Optional. Query params of HttpOperation
16480 pub query_params: std::collections::HashMap<
16481 std::string::String,
16482 crate::model::http_operation_details::QueryParam,
16483 >,
16484
16485 /// Optional. Request metadata.
16486 pub request: std::option::Option<crate::model::http_operation_details::HttpRequest>,
16487
16488 /// Optional. Response metadata.
16489 pub response: std::option::Option<crate::model::http_operation_details::HttpResponse>,
16490
16491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16492}
16493
16494impl HttpOperationDetails {
16495 pub fn new() -> Self {
16496 std::default::Default::default()
16497 }
16498
16499 /// Sets the value of [http_operation][crate::model::HttpOperationDetails::http_operation].
16500 ///
16501 /// # Example
16502 /// ```ignore,no_run
16503 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16504 /// use google_cloud_apihub_v1::model::HttpOperation;
16505 /// let x = HttpOperationDetails::new().set_http_operation(HttpOperation::default()/* use setters */);
16506 /// ```
16507 pub fn set_http_operation<T>(mut self, v: T) -> Self
16508 where
16509 T: std::convert::Into<crate::model::HttpOperation>,
16510 {
16511 self.http_operation = std::option::Option::Some(v.into());
16512 self
16513 }
16514
16515 /// Sets or clears the value of [http_operation][crate::model::HttpOperationDetails::http_operation].
16516 ///
16517 /// # Example
16518 /// ```ignore,no_run
16519 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16520 /// use google_cloud_apihub_v1::model::HttpOperation;
16521 /// let x = HttpOperationDetails::new().set_or_clear_http_operation(Some(HttpOperation::default()/* use setters */));
16522 /// let x = HttpOperationDetails::new().set_or_clear_http_operation(None::<HttpOperation>);
16523 /// ```
16524 pub fn set_or_clear_http_operation<T>(mut self, v: std::option::Option<T>) -> Self
16525 where
16526 T: std::convert::Into<crate::model::HttpOperation>,
16527 {
16528 self.http_operation = v.map(|x| x.into());
16529 self
16530 }
16531
16532 /// Sets the value of [path_params][crate::model::HttpOperationDetails::path_params].
16533 ///
16534 /// # Example
16535 /// ```ignore,no_run
16536 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16537 /// use google_cloud_apihub_v1::model::http_operation_details::PathParam;
16538 /// let x = HttpOperationDetails::new()
16539 /// .set_path_params([
16540 /// PathParam::default()/* use setters */,
16541 /// PathParam::default()/* use (different) setters */,
16542 /// ]);
16543 /// ```
16544 pub fn set_path_params<T, V>(mut self, v: T) -> Self
16545 where
16546 T: std::iter::IntoIterator<Item = V>,
16547 V: std::convert::Into<crate::model::http_operation_details::PathParam>,
16548 {
16549 use std::iter::Iterator;
16550 self.path_params = v.into_iter().map(|i| i.into()).collect();
16551 self
16552 }
16553
16554 /// Sets the value of [query_params][crate::model::HttpOperationDetails::query_params].
16555 ///
16556 /// # Example
16557 /// ```ignore,no_run
16558 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16559 /// use google_cloud_apihub_v1::model::http_operation_details::QueryParam;
16560 /// let x = HttpOperationDetails::new().set_query_params([
16561 /// ("key0", QueryParam::default()/* use setters */),
16562 /// ("key1", QueryParam::default()/* use (different) setters */),
16563 /// ]);
16564 /// ```
16565 pub fn set_query_params<T, K, V>(mut self, v: T) -> Self
16566 where
16567 T: std::iter::IntoIterator<Item = (K, V)>,
16568 K: std::convert::Into<std::string::String>,
16569 V: std::convert::Into<crate::model::http_operation_details::QueryParam>,
16570 {
16571 use std::iter::Iterator;
16572 self.query_params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16573 self
16574 }
16575
16576 /// Sets the value of [request][crate::model::HttpOperationDetails::request].
16577 ///
16578 /// # Example
16579 /// ```ignore,no_run
16580 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16581 /// use google_cloud_apihub_v1::model::http_operation_details::HttpRequest;
16582 /// let x = HttpOperationDetails::new().set_request(HttpRequest::default()/* use setters */);
16583 /// ```
16584 pub fn set_request<T>(mut self, v: T) -> Self
16585 where
16586 T: std::convert::Into<crate::model::http_operation_details::HttpRequest>,
16587 {
16588 self.request = std::option::Option::Some(v.into());
16589 self
16590 }
16591
16592 /// Sets or clears the value of [request][crate::model::HttpOperationDetails::request].
16593 ///
16594 /// # Example
16595 /// ```ignore,no_run
16596 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16597 /// use google_cloud_apihub_v1::model::http_operation_details::HttpRequest;
16598 /// let x = HttpOperationDetails::new().set_or_clear_request(Some(HttpRequest::default()/* use setters */));
16599 /// let x = HttpOperationDetails::new().set_or_clear_request(None::<HttpRequest>);
16600 /// ```
16601 pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
16602 where
16603 T: std::convert::Into<crate::model::http_operation_details::HttpRequest>,
16604 {
16605 self.request = v.map(|x| x.into());
16606 self
16607 }
16608
16609 /// Sets the value of [response][crate::model::HttpOperationDetails::response].
16610 ///
16611 /// # Example
16612 /// ```ignore,no_run
16613 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16614 /// use google_cloud_apihub_v1::model::http_operation_details::HttpResponse;
16615 /// let x = HttpOperationDetails::new().set_response(HttpResponse::default()/* use setters */);
16616 /// ```
16617 pub fn set_response<T>(mut self, v: T) -> Self
16618 where
16619 T: std::convert::Into<crate::model::http_operation_details::HttpResponse>,
16620 {
16621 self.response = std::option::Option::Some(v.into());
16622 self
16623 }
16624
16625 /// Sets or clears the value of [response][crate::model::HttpOperationDetails::response].
16626 ///
16627 /// # Example
16628 /// ```ignore,no_run
16629 /// # use google_cloud_apihub_v1::model::HttpOperationDetails;
16630 /// use google_cloud_apihub_v1::model::http_operation_details::HttpResponse;
16631 /// let x = HttpOperationDetails::new().set_or_clear_response(Some(HttpResponse::default()/* use setters */));
16632 /// let x = HttpOperationDetails::new().set_or_clear_response(None::<HttpResponse>);
16633 /// ```
16634 pub fn set_or_clear_response<T>(mut self, v: std::option::Option<T>) -> Self
16635 where
16636 T: std::convert::Into<crate::model::http_operation_details::HttpResponse>,
16637 {
16638 self.response = v.map(|x| x.into());
16639 self
16640 }
16641}
16642
16643impl wkt::message::Message for HttpOperationDetails {
16644 fn typename() -> &'static str {
16645 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails"
16646 }
16647}
16648
16649/// Defines additional types related to [HttpOperationDetails].
16650pub mod http_operation_details {
16651 #[allow(unused_imports)]
16652 use super::*;
16653
16654 /// HTTP Path parameter.
16655 #[derive(Clone, Default, PartialEq)]
16656 #[non_exhaustive]
16657 pub struct PathParam {
16658 /// Optional. Segment location in the path, 1-indexed
16659 pub position: i32,
16660
16661 /// Optional. Data type of path param
16662 pub data_type: crate::model::http_operation_details::DataType,
16663
16664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16665 }
16666
16667 impl PathParam {
16668 pub fn new() -> Self {
16669 std::default::Default::default()
16670 }
16671
16672 /// Sets the value of [position][crate::model::http_operation_details::PathParam::position].
16673 ///
16674 /// # Example
16675 /// ```ignore,no_run
16676 /// # use google_cloud_apihub_v1::model::http_operation_details::PathParam;
16677 /// let x = PathParam::new().set_position(42);
16678 /// ```
16679 pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16680 self.position = v.into();
16681 self
16682 }
16683
16684 /// Sets the value of [data_type][crate::model::http_operation_details::PathParam::data_type].
16685 ///
16686 /// # Example
16687 /// ```ignore,no_run
16688 /// # use google_cloud_apihub_v1::model::http_operation_details::PathParam;
16689 /// use google_cloud_apihub_v1::model::http_operation_details::DataType;
16690 /// let x0 = PathParam::new().set_data_type(DataType::Bool);
16691 /// let x1 = PathParam::new().set_data_type(DataType::Integer);
16692 /// let x2 = PathParam::new().set_data_type(DataType::Float);
16693 /// ```
16694 pub fn set_data_type<
16695 T: std::convert::Into<crate::model::http_operation_details::DataType>,
16696 >(
16697 mut self,
16698 v: T,
16699 ) -> Self {
16700 self.data_type = v.into();
16701 self
16702 }
16703 }
16704
16705 impl wkt::message::Message for PathParam {
16706 fn typename() -> &'static str {
16707 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails.PathParam"
16708 }
16709 }
16710
16711 /// An aggregation of HTTP query parameter occurrences.
16712 #[derive(Clone, Default, PartialEq)]
16713 #[non_exhaustive]
16714 pub struct QueryParam {
16715 /// Required. Name of query param
16716 pub name: std::string::String,
16717
16718 /// Optional. The number of occurrences of this query parameter across
16719 /// transactions.
16720 pub count: i64,
16721
16722 /// Optional. Data type of path param
16723 pub data_type: crate::model::http_operation_details::DataType,
16724
16725 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16726 }
16727
16728 impl QueryParam {
16729 pub fn new() -> Self {
16730 std::default::Default::default()
16731 }
16732
16733 /// Sets the value of [name][crate::model::http_operation_details::QueryParam::name].
16734 ///
16735 /// # Example
16736 /// ```ignore,no_run
16737 /// # use google_cloud_apihub_v1::model::http_operation_details::QueryParam;
16738 /// let x = QueryParam::new().set_name("example");
16739 /// ```
16740 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16741 self.name = v.into();
16742 self
16743 }
16744
16745 /// Sets the value of [count][crate::model::http_operation_details::QueryParam::count].
16746 ///
16747 /// # Example
16748 /// ```ignore,no_run
16749 /// # use google_cloud_apihub_v1::model::http_operation_details::QueryParam;
16750 /// let x = QueryParam::new().set_count(42);
16751 /// ```
16752 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16753 self.count = v.into();
16754 self
16755 }
16756
16757 /// Sets the value of [data_type][crate::model::http_operation_details::QueryParam::data_type].
16758 ///
16759 /// # Example
16760 /// ```ignore,no_run
16761 /// # use google_cloud_apihub_v1::model::http_operation_details::QueryParam;
16762 /// use google_cloud_apihub_v1::model::http_operation_details::DataType;
16763 /// let x0 = QueryParam::new().set_data_type(DataType::Bool);
16764 /// let x1 = QueryParam::new().set_data_type(DataType::Integer);
16765 /// let x2 = QueryParam::new().set_data_type(DataType::Float);
16766 /// ```
16767 pub fn set_data_type<
16768 T: std::convert::Into<crate::model::http_operation_details::DataType>,
16769 >(
16770 mut self,
16771 v: T,
16772 ) -> Self {
16773 self.data_type = v.into();
16774 self
16775 }
16776 }
16777
16778 impl wkt::message::Message for QueryParam {
16779 fn typename() -> &'static str {
16780 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails.QueryParam"
16781 }
16782 }
16783
16784 /// An aggregation of HTTP header occurrences.
16785 #[derive(Clone, Default, PartialEq)]
16786 #[non_exhaustive]
16787 pub struct Header {
16788 /// Header name.
16789 pub name: std::string::String,
16790
16791 /// The number of occurrences of this Header across transactions.
16792 pub count: i64,
16793
16794 /// Data type of header
16795 pub data_type: crate::model::http_operation_details::DataType,
16796
16797 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16798 }
16799
16800 impl Header {
16801 pub fn new() -> Self {
16802 std::default::Default::default()
16803 }
16804
16805 /// Sets the value of [name][crate::model::http_operation_details::Header::name].
16806 ///
16807 /// # Example
16808 /// ```ignore,no_run
16809 /// # use google_cloud_apihub_v1::model::http_operation_details::Header;
16810 /// let x = Header::new().set_name("example");
16811 /// ```
16812 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16813 self.name = v.into();
16814 self
16815 }
16816
16817 /// Sets the value of [count][crate::model::http_operation_details::Header::count].
16818 ///
16819 /// # Example
16820 /// ```ignore,no_run
16821 /// # use google_cloud_apihub_v1::model::http_operation_details::Header;
16822 /// let x = Header::new().set_count(42);
16823 /// ```
16824 pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
16825 self.count = v.into();
16826 self
16827 }
16828
16829 /// Sets the value of [data_type][crate::model::http_operation_details::Header::data_type].
16830 ///
16831 /// # Example
16832 /// ```ignore,no_run
16833 /// # use google_cloud_apihub_v1::model::http_operation_details::Header;
16834 /// use google_cloud_apihub_v1::model::http_operation_details::DataType;
16835 /// let x0 = Header::new().set_data_type(DataType::Bool);
16836 /// let x1 = Header::new().set_data_type(DataType::Integer);
16837 /// let x2 = Header::new().set_data_type(DataType::Float);
16838 /// ```
16839 pub fn set_data_type<
16840 T: std::convert::Into<crate::model::http_operation_details::DataType>,
16841 >(
16842 mut self,
16843 v: T,
16844 ) -> Self {
16845 self.data_type = v.into();
16846 self
16847 }
16848 }
16849
16850 impl wkt::message::Message for Header {
16851 fn typename() -> &'static str {
16852 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails.Header"
16853 }
16854 }
16855
16856 /// An aggregation of HTTP requests.
16857 #[derive(Clone, Default, PartialEq)]
16858 #[non_exhaustive]
16859 pub struct HttpRequest {
16860 /// Optional. Unordered map from header name to header metadata
16861 pub headers: std::collections::HashMap<
16862 std::string::String,
16863 crate::model::http_operation_details::Header,
16864 >,
16865
16866 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16867 }
16868
16869 impl HttpRequest {
16870 pub fn new() -> Self {
16871 std::default::Default::default()
16872 }
16873
16874 /// Sets the value of [headers][crate::model::http_operation_details::HttpRequest::headers].
16875 ///
16876 /// # Example
16877 /// ```ignore,no_run
16878 /// # use google_cloud_apihub_v1::model::http_operation_details::HttpRequest;
16879 /// use google_cloud_apihub_v1::model::http_operation_details::Header;
16880 /// let x = HttpRequest::new().set_headers([
16881 /// ("key0", Header::default()/* use setters */),
16882 /// ("key1", Header::default()/* use (different) setters */),
16883 /// ]);
16884 /// ```
16885 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
16886 where
16887 T: std::iter::IntoIterator<Item = (K, V)>,
16888 K: std::convert::Into<std::string::String>,
16889 V: std::convert::Into<crate::model::http_operation_details::Header>,
16890 {
16891 use std::iter::Iterator;
16892 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16893 self
16894 }
16895 }
16896
16897 impl wkt::message::Message for HttpRequest {
16898 fn typename() -> &'static str {
16899 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails.HttpRequest"
16900 }
16901 }
16902
16903 /// An aggregation of HTTP responses.
16904 #[derive(Clone, Default, PartialEq)]
16905 #[non_exhaustive]
16906 pub struct HttpResponse {
16907 /// Optional. Unordered map from header name to header metadata
16908 pub headers: std::collections::HashMap<
16909 std::string::String,
16910 crate::model::http_operation_details::Header,
16911 >,
16912
16913 /// Optional. Map of status code to observed count
16914 pub response_codes: std::collections::HashMap<i32, i64>,
16915
16916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16917 }
16918
16919 impl HttpResponse {
16920 pub fn new() -> Self {
16921 std::default::Default::default()
16922 }
16923
16924 /// Sets the value of [headers][crate::model::http_operation_details::HttpResponse::headers].
16925 ///
16926 /// # Example
16927 /// ```ignore,no_run
16928 /// # use google_cloud_apihub_v1::model::http_operation_details::HttpResponse;
16929 /// use google_cloud_apihub_v1::model::http_operation_details::Header;
16930 /// let x = HttpResponse::new().set_headers([
16931 /// ("key0", Header::default()/* use setters */),
16932 /// ("key1", Header::default()/* use (different) setters */),
16933 /// ]);
16934 /// ```
16935 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
16936 where
16937 T: std::iter::IntoIterator<Item = (K, V)>,
16938 K: std::convert::Into<std::string::String>,
16939 V: std::convert::Into<crate::model::http_operation_details::Header>,
16940 {
16941 use std::iter::Iterator;
16942 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16943 self
16944 }
16945
16946 /// Sets the value of [response_codes][crate::model::http_operation_details::HttpResponse::response_codes].
16947 ///
16948 /// # Example
16949 /// ```ignore,no_run
16950 /// # use google_cloud_apihub_v1::model::http_operation_details::HttpResponse;
16951 /// let x = HttpResponse::new().set_response_codes([
16952 /// (0, 123),
16953 /// (1, 456),
16954 /// ]);
16955 /// ```
16956 pub fn set_response_codes<T, K, V>(mut self, v: T) -> Self
16957 where
16958 T: std::iter::IntoIterator<Item = (K, V)>,
16959 K: std::convert::Into<i32>,
16960 V: std::convert::Into<i64>,
16961 {
16962 use std::iter::Iterator;
16963 self.response_codes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16964 self
16965 }
16966 }
16967
16968 impl wkt::message::Message for HttpResponse {
16969 fn typename() -> &'static str {
16970 "type.googleapis.com/google.cloud.apihub.v1.HttpOperationDetails.HttpResponse"
16971 }
16972 }
16973
16974 /// Type of data
16975 ///
16976 /// # Working with unknown values
16977 ///
16978 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16979 /// additional enum variants at any time. Adding new variants is not considered
16980 /// a breaking change. Applications should write their code in anticipation of:
16981 ///
16982 /// - New values appearing in future releases of the client library, **and**
16983 /// - New values received dynamically, without application changes.
16984 ///
16985 /// Please consult the [Working with enums] section in the user guide for some
16986 /// guidelines.
16987 ///
16988 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16989 #[derive(Clone, Debug, PartialEq)]
16990 #[non_exhaustive]
16991 pub enum DataType {
16992 /// Unspecified data type
16993 Unspecified,
16994 /// Boolean data type
16995 Bool,
16996 /// Integer data type
16997 Integer,
16998 /// Float data type
16999 Float,
17000 /// String data type
17001 String,
17002 /// UUID data type
17003 Uuid,
17004 /// If set, the enum was initialized with an unknown value.
17005 ///
17006 /// Applications can examine the value using [DataType::value] or
17007 /// [DataType::name].
17008 UnknownValue(data_type::UnknownValue),
17009 }
17010
17011 #[doc(hidden)]
17012 pub mod data_type {
17013 #[allow(unused_imports)]
17014 use super::*;
17015 #[derive(Clone, Debug, PartialEq)]
17016 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17017 }
17018
17019 impl DataType {
17020 /// Gets the enum value.
17021 ///
17022 /// Returns `None` if the enum contains an unknown value deserialized from
17023 /// the string representation of enums.
17024 pub fn value(&self) -> std::option::Option<i32> {
17025 match self {
17026 Self::Unspecified => std::option::Option::Some(0),
17027 Self::Bool => std::option::Option::Some(1),
17028 Self::Integer => std::option::Option::Some(2),
17029 Self::Float => std::option::Option::Some(3),
17030 Self::String => std::option::Option::Some(4),
17031 Self::Uuid => std::option::Option::Some(5),
17032 Self::UnknownValue(u) => u.0.value(),
17033 }
17034 }
17035
17036 /// Gets the enum value as a string.
17037 ///
17038 /// Returns `None` if the enum contains an unknown value deserialized from
17039 /// the integer representation of enums.
17040 pub fn name(&self) -> std::option::Option<&str> {
17041 match self {
17042 Self::Unspecified => std::option::Option::Some("DATA_TYPE_UNSPECIFIED"),
17043 Self::Bool => std::option::Option::Some("BOOL"),
17044 Self::Integer => std::option::Option::Some("INTEGER"),
17045 Self::Float => std::option::Option::Some("FLOAT"),
17046 Self::String => std::option::Option::Some("STRING"),
17047 Self::Uuid => std::option::Option::Some("UUID"),
17048 Self::UnknownValue(u) => u.0.name(),
17049 }
17050 }
17051 }
17052
17053 impl std::default::Default for DataType {
17054 fn default() -> Self {
17055 use std::convert::From;
17056 Self::from(0)
17057 }
17058 }
17059
17060 impl std::fmt::Display for DataType {
17061 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17062 wkt::internal::display_enum(f, self.name(), self.value())
17063 }
17064 }
17065
17066 impl std::convert::From<i32> for DataType {
17067 fn from(value: i32) -> Self {
17068 match value {
17069 0 => Self::Unspecified,
17070 1 => Self::Bool,
17071 2 => Self::Integer,
17072 3 => Self::Float,
17073 4 => Self::String,
17074 5 => Self::Uuid,
17075 _ => Self::UnknownValue(data_type::UnknownValue(
17076 wkt::internal::UnknownEnumValue::Integer(value),
17077 )),
17078 }
17079 }
17080 }
17081
17082 impl std::convert::From<&str> for DataType {
17083 fn from(value: &str) -> Self {
17084 use std::string::ToString;
17085 match value {
17086 "DATA_TYPE_UNSPECIFIED" => Self::Unspecified,
17087 "BOOL" => Self::Bool,
17088 "INTEGER" => Self::Integer,
17089 "FLOAT" => Self::Float,
17090 "STRING" => Self::String,
17091 "UUID" => Self::Uuid,
17092 _ => Self::UnknownValue(data_type::UnknownValue(
17093 wkt::internal::UnknownEnumValue::String(value.to_string()),
17094 )),
17095 }
17096 }
17097 }
17098
17099 impl serde::ser::Serialize for DataType {
17100 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17101 where
17102 S: serde::Serializer,
17103 {
17104 match self {
17105 Self::Unspecified => serializer.serialize_i32(0),
17106 Self::Bool => serializer.serialize_i32(1),
17107 Self::Integer => serializer.serialize_i32(2),
17108 Self::Float => serializer.serialize_i32(3),
17109 Self::String => serializer.serialize_i32(4),
17110 Self::Uuid => serializer.serialize_i32(5),
17111 Self::UnknownValue(u) => u.0.serialize(serializer),
17112 }
17113 }
17114 }
17115
17116 impl<'de> serde::de::Deserialize<'de> for DataType {
17117 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17118 where
17119 D: serde::Deserializer<'de>,
17120 {
17121 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataType>::new(
17122 ".google.cloud.apihub.v1.HttpOperationDetails.DataType",
17123 ))
17124 }
17125 }
17126}
17127
17128/// The [CreateCuration][ApiHub.CreateCuration] method's request.
17129#[derive(Clone, Default, PartialEq)]
17130#[non_exhaustive]
17131pub struct CreateCurationRequest {
17132 /// Required. The parent resource for the curation resource.
17133 /// Format: `projects/{project}/locations/{location}`
17134 pub parent: std::string::String,
17135
17136 /// Optional. The ID to use for the curation resource, which will become the
17137 /// final component of the curations's resource name. This field is optional.
17138 ///
17139 /// * If provided, the same will be used. The service will throw an error if
17140 /// the specified ID is already used by another curation resource in the API
17141 /// hub.
17142 /// * If not provided, a system generated ID will be used.
17143 ///
17144 /// This value should be 4-500 characters, and valid characters
17145 /// are /[a-z][A-Z][0-9]-_/.
17146 pub curation_id: std::string::String,
17147
17148 /// Required. The curation resource to create.
17149 pub curation: std::option::Option<crate::model::Curation>,
17150
17151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17152}
17153
17154impl CreateCurationRequest {
17155 pub fn new() -> Self {
17156 std::default::Default::default()
17157 }
17158
17159 /// Sets the value of [parent][crate::model::CreateCurationRequest::parent].
17160 ///
17161 /// # Example
17162 /// ```ignore,no_run
17163 /// # use google_cloud_apihub_v1::model::CreateCurationRequest;
17164 /// let x = CreateCurationRequest::new().set_parent("example");
17165 /// ```
17166 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17167 self.parent = v.into();
17168 self
17169 }
17170
17171 /// Sets the value of [curation_id][crate::model::CreateCurationRequest::curation_id].
17172 ///
17173 /// # Example
17174 /// ```ignore,no_run
17175 /// # use google_cloud_apihub_v1::model::CreateCurationRequest;
17176 /// let x = CreateCurationRequest::new().set_curation_id("example");
17177 /// ```
17178 pub fn set_curation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17179 self.curation_id = v.into();
17180 self
17181 }
17182
17183 /// Sets the value of [curation][crate::model::CreateCurationRequest::curation].
17184 ///
17185 /// # Example
17186 /// ```ignore,no_run
17187 /// # use google_cloud_apihub_v1::model::CreateCurationRequest;
17188 /// use google_cloud_apihub_v1::model::Curation;
17189 /// let x = CreateCurationRequest::new().set_curation(Curation::default()/* use setters */);
17190 /// ```
17191 pub fn set_curation<T>(mut self, v: T) -> Self
17192 where
17193 T: std::convert::Into<crate::model::Curation>,
17194 {
17195 self.curation = std::option::Option::Some(v.into());
17196 self
17197 }
17198
17199 /// Sets or clears the value of [curation][crate::model::CreateCurationRequest::curation].
17200 ///
17201 /// # Example
17202 /// ```ignore,no_run
17203 /// # use google_cloud_apihub_v1::model::CreateCurationRequest;
17204 /// use google_cloud_apihub_v1::model::Curation;
17205 /// let x = CreateCurationRequest::new().set_or_clear_curation(Some(Curation::default()/* use setters */));
17206 /// let x = CreateCurationRequest::new().set_or_clear_curation(None::<Curation>);
17207 /// ```
17208 pub fn set_or_clear_curation<T>(mut self, v: std::option::Option<T>) -> Self
17209 where
17210 T: std::convert::Into<crate::model::Curation>,
17211 {
17212 self.curation = v.map(|x| x.into());
17213 self
17214 }
17215}
17216
17217impl wkt::message::Message for CreateCurationRequest {
17218 fn typename() -> &'static str {
17219 "type.googleapis.com/google.cloud.apihub.v1.CreateCurationRequest"
17220 }
17221}
17222
17223/// The [GetCuration][ApiHub.GetCuration] method's request.
17224#[derive(Clone, Default, PartialEq)]
17225#[non_exhaustive]
17226pub struct GetCurationRequest {
17227 /// Required. The name of the curation resource to retrieve.
17228 /// Format: `projects/{project}/locations/{location}/curations/{curation}`
17229 pub name: std::string::String,
17230
17231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17232}
17233
17234impl GetCurationRequest {
17235 pub fn new() -> Self {
17236 std::default::Default::default()
17237 }
17238
17239 /// Sets the value of [name][crate::model::GetCurationRequest::name].
17240 ///
17241 /// # Example
17242 /// ```ignore,no_run
17243 /// # use google_cloud_apihub_v1::model::GetCurationRequest;
17244 /// let x = GetCurationRequest::new().set_name("example");
17245 /// ```
17246 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17247 self.name = v.into();
17248 self
17249 }
17250}
17251
17252impl wkt::message::Message for GetCurationRequest {
17253 fn typename() -> &'static str {
17254 "type.googleapis.com/google.cloud.apihub.v1.GetCurationRequest"
17255 }
17256}
17257
17258/// The [UpdateCuration][ApiHub.UpdateCuration] method's request.
17259#[derive(Clone, Default, PartialEq)]
17260#[non_exhaustive]
17261pub struct UpdateCurationRequest {
17262 /// Required. The curation resource to update.
17263 ///
17264 /// The curation resource's `name` field is used to identify the curation
17265 /// resource to update.
17266 /// Format: `projects/{project}/locations/{location}/curations/{curation}`
17267 pub curation: std::option::Option<crate::model::Curation>,
17268
17269 /// Optional. The list of fields to update.
17270 pub update_mask: std::option::Option<wkt::FieldMask>,
17271
17272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17273}
17274
17275impl UpdateCurationRequest {
17276 pub fn new() -> Self {
17277 std::default::Default::default()
17278 }
17279
17280 /// Sets the value of [curation][crate::model::UpdateCurationRequest::curation].
17281 ///
17282 /// # Example
17283 /// ```ignore,no_run
17284 /// # use google_cloud_apihub_v1::model::UpdateCurationRequest;
17285 /// use google_cloud_apihub_v1::model::Curation;
17286 /// let x = UpdateCurationRequest::new().set_curation(Curation::default()/* use setters */);
17287 /// ```
17288 pub fn set_curation<T>(mut self, v: T) -> Self
17289 where
17290 T: std::convert::Into<crate::model::Curation>,
17291 {
17292 self.curation = std::option::Option::Some(v.into());
17293 self
17294 }
17295
17296 /// Sets or clears the value of [curation][crate::model::UpdateCurationRequest::curation].
17297 ///
17298 /// # Example
17299 /// ```ignore,no_run
17300 /// # use google_cloud_apihub_v1::model::UpdateCurationRequest;
17301 /// use google_cloud_apihub_v1::model::Curation;
17302 /// let x = UpdateCurationRequest::new().set_or_clear_curation(Some(Curation::default()/* use setters */));
17303 /// let x = UpdateCurationRequest::new().set_or_clear_curation(None::<Curation>);
17304 /// ```
17305 pub fn set_or_clear_curation<T>(mut self, v: std::option::Option<T>) -> Self
17306 where
17307 T: std::convert::Into<crate::model::Curation>,
17308 {
17309 self.curation = v.map(|x| x.into());
17310 self
17311 }
17312
17313 /// Sets the value of [update_mask][crate::model::UpdateCurationRequest::update_mask].
17314 ///
17315 /// # Example
17316 /// ```ignore,no_run
17317 /// # use google_cloud_apihub_v1::model::UpdateCurationRequest;
17318 /// use wkt::FieldMask;
17319 /// let x = UpdateCurationRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17320 /// ```
17321 pub fn set_update_mask<T>(mut self, v: T) -> Self
17322 where
17323 T: std::convert::Into<wkt::FieldMask>,
17324 {
17325 self.update_mask = std::option::Option::Some(v.into());
17326 self
17327 }
17328
17329 /// Sets or clears the value of [update_mask][crate::model::UpdateCurationRequest::update_mask].
17330 ///
17331 /// # Example
17332 /// ```ignore,no_run
17333 /// # use google_cloud_apihub_v1::model::UpdateCurationRequest;
17334 /// use wkt::FieldMask;
17335 /// let x = UpdateCurationRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17336 /// let x = UpdateCurationRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17337 /// ```
17338 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17339 where
17340 T: std::convert::Into<wkt::FieldMask>,
17341 {
17342 self.update_mask = v.map(|x| x.into());
17343 self
17344 }
17345}
17346
17347impl wkt::message::Message for UpdateCurationRequest {
17348 fn typename() -> &'static str {
17349 "type.googleapis.com/google.cloud.apihub.v1.UpdateCurationRequest"
17350 }
17351}
17352
17353/// The [DeleteCuration][ApiHub.DeleteCuration] method's request.
17354#[derive(Clone, Default, PartialEq)]
17355#[non_exhaustive]
17356pub struct DeleteCurationRequest {
17357 /// Required. The name of the curation resource to delete.
17358 /// Format: `projects/{project}/locations/{location}/curations/{curation}`
17359 pub name: std::string::String,
17360
17361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17362}
17363
17364impl DeleteCurationRequest {
17365 pub fn new() -> Self {
17366 std::default::Default::default()
17367 }
17368
17369 /// Sets the value of [name][crate::model::DeleteCurationRequest::name].
17370 ///
17371 /// # Example
17372 /// ```ignore,no_run
17373 /// # use google_cloud_apihub_v1::model::DeleteCurationRequest;
17374 /// let x = DeleteCurationRequest::new().set_name("example");
17375 /// ```
17376 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17377 self.name = v.into();
17378 self
17379 }
17380}
17381
17382impl wkt::message::Message for DeleteCurationRequest {
17383 fn typename() -> &'static str {
17384 "type.googleapis.com/google.cloud.apihub.v1.DeleteCurationRequest"
17385 }
17386}
17387
17388/// The [ListCurations][ApiHub.ListCurations] method's request.
17389#[derive(Clone, Default, PartialEq)]
17390#[non_exhaustive]
17391pub struct ListCurationsRequest {
17392 /// Required. The parent, which owns this collection of curation resources.
17393 /// Format: `projects/{project}/locations/{location}`
17394 pub parent: std::string::String,
17395
17396 /// Optional. An expression that filters the list of curation resources.
17397 ///
17398 /// A filter expression consists of a field name, a comparison
17399 /// operator, and a value for filtering. The value must be a string. The
17400 /// comparison operator must be one of: `<`, `>`, `:` or `=`. Filters are case
17401 /// insensitive.
17402 ///
17403 /// The following fields in the `curation resource` are eligible for filtering:
17404 ///
17405 /// * `create_time` - The time at which the curation was created.
17406 /// The value should be in the (RFC3339)[<https://tools.ietf.org/html/rfc3339>]
17407 /// format. Allowed comparison operators: `>` and `<`.
17408 /// * `display_name` - The display name of the curation. Allowed
17409 /// comparison operators: `=`.
17410 /// * `state` - The state of the curation. Allowed comparison operators: `=`.
17411 ///
17412 /// Expressions are combined with either `AND` logic operator or `OR` logical
17413 /// operator but not both of them together i.e. only one of the `AND` or `OR`
17414 /// operator can be used throughout the filter string and both the operators
17415 /// cannot be used together. No other logical operators are supported. At most
17416 /// three filter fields are allowed in the filter string and if provided
17417 /// more than that then `INVALID_ARGUMENT` error is returned by the API.
17418 ///
17419 /// Here are a few examples:
17420 ///
17421 /// * `create_time < \"2021-08-15T14:50:00Z\" AND create_time >
17422 /// \"2021-08-10T12:00:00Z\"` -
17423 /// The curation resource was created before _2021-08-15 14:50:00 UTC_ and
17424 /// after _2021-08-10 12:00:00 UTC_.
17425 pub filter: std::string::String,
17426
17427 /// Optional. The maximum number of curation resources to return. The service
17428 /// may return fewer than this value. If unspecified, at most 50 curations will
17429 /// be returned. The maximum value is 1000; values above 1000 will be coerced
17430 /// to 1000.
17431 pub page_size: i32,
17432
17433 /// Optional. A page token, received from a previous `ListCurations` call.
17434 /// Provide this to retrieve the subsequent page.
17435 ///
17436 /// When paginating, all other parameters (except page_size) provided to
17437 /// `ListCurations` must match the call that provided the page token.
17438 pub page_token: std::string::String,
17439
17440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17441}
17442
17443impl ListCurationsRequest {
17444 pub fn new() -> Self {
17445 std::default::Default::default()
17446 }
17447
17448 /// Sets the value of [parent][crate::model::ListCurationsRequest::parent].
17449 ///
17450 /// # Example
17451 /// ```ignore,no_run
17452 /// # use google_cloud_apihub_v1::model::ListCurationsRequest;
17453 /// let x = ListCurationsRequest::new().set_parent("example");
17454 /// ```
17455 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17456 self.parent = v.into();
17457 self
17458 }
17459
17460 /// Sets the value of [filter][crate::model::ListCurationsRequest::filter].
17461 ///
17462 /// # Example
17463 /// ```ignore,no_run
17464 /// # use google_cloud_apihub_v1::model::ListCurationsRequest;
17465 /// let x = ListCurationsRequest::new().set_filter("example");
17466 /// ```
17467 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17468 self.filter = v.into();
17469 self
17470 }
17471
17472 /// Sets the value of [page_size][crate::model::ListCurationsRequest::page_size].
17473 ///
17474 /// # Example
17475 /// ```ignore,no_run
17476 /// # use google_cloud_apihub_v1::model::ListCurationsRequest;
17477 /// let x = ListCurationsRequest::new().set_page_size(42);
17478 /// ```
17479 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17480 self.page_size = v.into();
17481 self
17482 }
17483
17484 /// Sets the value of [page_token][crate::model::ListCurationsRequest::page_token].
17485 ///
17486 /// # Example
17487 /// ```ignore,no_run
17488 /// # use google_cloud_apihub_v1::model::ListCurationsRequest;
17489 /// let x = ListCurationsRequest::new().set_page_token("example");
17490 /// ```
17491 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17492 self.page_token = v.into();
17493 self
17494 }
17495}
17496
17497impl wkt::message::Message for ListCurationsRequest {
17498 fn typename() -> &'static str {
17499 "type.googleapis.com/google.cloud.apihub.v1.ListCurationsRequest"
17500 }
17501}
17502
17503/// The [ListCurations][ApiHub.ListCurations] method's response.
17504#[derive(Clone, Default, PartialEq)]
17505#[non_exhaustive]
17506pub struct ListCurationsResponse {
17507 /// The curation resources present in the API hub.
17508 pub curations: std::vec::Vec<crate::model::Curation>,
17509
17510 /// A token, which can be sent as `page_token` to retrieve the next page.
17511 /// If this field is omitted, there are no subsequent pages.
17512 pub next_page_token: std::string::String,
17513
17514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17515}
17516
17517impl ListCurationsResponse {
17518 pub fn new() -> Self {
17519 std::default::Default::default()
17520 }
17521
17522 /// Sets the value of [curations][crate::model::ListCurationsResponse::curations].
17523 ///
17524 /// # Example
17525 /// ```ignore,no_run
17526 /// # use google_cloud_apihub_v1::model::ListCurationsResponse;
17527 /// use google_cloud_apihub_v1::model::Curation;
17528 /// let x = ListCurationsResponse::new()
17529 /// .set_curations([
17530 /// Curation::default()/* use setters */,
17531 /// Curation::default()/* use (different) setters */,
17532 /// ]);
17533 /// ```
17534 pub fn set_curations<T, V>(mut self, v: T) -> Self
17535 where
17536 T: std::iter::IntoIterator<Item = V>,
17537 V: std::convert::Into<crate::model::Curation>,
17538 {
17539 use std::iter::Iterator;
17540 self.curations = v.into_iter().map(|i| i.into()).collect();
17541 self
17542 }
17543
17544 /// Sets the value of [next_page_token][crate::model::ListCurationsResponse::next_page_token].
17545 ///
17546 /// # Example
17547 /// ```ignore,no_run
17548 /// # use google_cloud_apihub_v1::model::ListCurationsResponse;
17549 /// let x = ListCurationsResponse::new().set_next_page_token("example");
17550 /// ```
17551 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17552 self.next_page_token = v.into();
17553 self
17554 }
17555}
17556
17557impl wkt::message::Message for ListCurationsResponse {
17558 fn typename() -> &'static str {
17559 "type.googleapis.com/google.cloud.apihub.v1.ListCurationsResponse"
17560 }
17561}
17562
17563#[doc(hidden)]
17564impl google_cloud_gax::paginator::internal::PageableResponse for ListCurationsResponse {
17565 type PageItem = crate::model::Curation;
17566
17567 fn items(self) -> std::vec::Vec<Self::PageItem> {
17568 self.curations
17569 }
17570
17571 fn next_page_token(&self) -> std::string::String {
17572 use std::clone::Clone;
17573 self.next_page_token.clone()
17574 }
17575}
17576
17577/// A curation resource in the API Hub.
17578#[derive(Clone, Default, PartialEq)]
17579#[non_exhaustive]
17580pub struct Curation {
17581 /// Identifier. The name of the curation.
17582 ///
17583 /// Format:
17584 /// `projects/{project}/locations/{location}/curations/{curation}`
17585 pub name: std::string::String,
17586
17587 /// Required. The display name of the curation.
17588 pub display_name: std::string::String,
17589
17590 /// Optional. The description of the curation.
17591 pub description: std::string::String,
17592
17593 /// Required. The endpoint to be triggered for curation.
17594 pub endpoint: std::option::Option<crate::model::Endpoint>,
17595
17596 /// Output only. The plugin instances and associated actions that are using the
17597 /// curation. Note: A particular curation could be used by multiple plugin
17598 /// instances or multiple actions in a plugin instance.
17599 pub plugin_instance_actions: std::vec::Vec<crate::model::curation::PluginInstanceActionID>,
17600
17601 /// Output only. The last execution state of the curation.
17602 pub last_execution_state: crate::model::curation::LastExecutionState,
17603
17604 /// Output only. The error code of the last execution of the curation. The
17605 /// error code is populated only when the last execution state is failed.
17606 pub last_execution_error_code: crate::model::curation::ErrorCode,
17607
17608 /// Output only. Error message describing the failure, if any, during the last
17609 /// execution of the curation.
17610 pub last_execution_error_message: std::string::String,
17611
17612 /// Output only. The time at which the curation was created.
17613 pub create_time: std::option::Option<wkt::Timestamp>,
17614
17615 /// Output only. The time at which the curation was last updated.
17616 pub update_time: std::option::Option<wkt::Timestamp>,
17617
17618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17619}
17620
17621impl Curation {
17622 pub fn new() -> Self {
17623 std::default::Default::default()
17624 }
17625
17626 /// Sets the value of [name][crate::model::Curation::name].
17627 ///
17628 /// # Example
17629 /// ```ignore,no_run
17630 /// # use google_cloud_apihub_v1::model::Curation;
17631 /// let x = Curation::new().set_name("example");
17632 /// ```
17633 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17634 self.name = v.into();
17635 self
17636 }
17637
17638 /// Sets the value of [display_name][crate::model::Curation::display_name].
17639 ///
17640 /// # Example
17641 /// ```ignore,no_run
17642 /// # use google_cloud_apihub_v1::model::Curation;
17643 /// let x = Curation::new().set_display_name("example");
17644 /// ```
17645 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17646 self.display_name = v.into();
17647 self
17648 }
17649
17650 /// Sets the value of [description][crate::model::Curation::description].
17651 ///
17652 /// # Example
17653 /// ```ignore,no_run
17654 /// # use google_cloud_apihub_v1::model::Curation;
17655 /// let x = Curation::new().set_description("example");
17656 /// ```
17657 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17658 self.description = v.into();
17659 self
17660 }
17661
17662 /// Sets the value of [endpoint][crate::model::Curation::endpoint].
17663 ///
17664 /// # Example
17665 /// ```ignore,no_run
17666 /// # use google_cloud_apihub_v1::model::Curation;
17667 /// use google_cloud_apihub_v1::model::Endpoint;
17668 /// let x = Curation::new().set_endpoint(Endpoint::default()/* use setters */);
17669 /// ```
17670 pub fn set_endpoint<T>(mut self, v: T) -> Self
17671 where
17672 T: std::convert::Into<crate::model::Endpoint>,
17673 {
17674 self.endpoint = std::option::Option::Some(v.into());
17675 self
17676 }
17677
17678 /// Sets or clears the value of [endpoint][crate::model::Curation::endpoint].
17679 ///
17680 /// # Example
17681 /// ```ignore,no_run
17682 /// # use google_cloud_apihub_v1::model::Curation;
17683 /// use google_cloud_apihub_v1::model::Endpoint;
17684 /// let x = Curation::new().set_or_clear_endpoint(Some(Endpoint::default()/* use setters */));
17685 /// let x = Curation::new().set_or_clear_endpoint(None::<Endpoint>);
17686 /// ```
17687 pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
17688 where
17689 T: std::convert::Into<crate::model::Endpoint>,
17690 {
17691 self.endpoint = v.map(|x| x.into());
17692 self
17693 }
17694
17695 /// Sets the value of [plugin_instance_actions][crate::model::Curation::plugin_instance_actions].
17696 ///
17697 /// # Example
17698 /// ```ignore,no_run
17699 /// # use google_cloud_apihub_v1::model::Curation;
17700 /// use google_cloud_apihub_v1::model::curation::PluginInstanceActionID;
17701 /// let x = Curation::new()
17702 /// .set_plugin_instance_actions([
17703 /// PluginInstanceActionID::default()/* use setters */,
17704 /// PluginInstanceActionID::default()/* use (different) setters */,
17705 /// ]);
17706 /// ```
17707 pub fn set_plugin_instance_actions<T, V>(mut self, v: T) -> Self
17708 where
17709 T: std::iter::IntoIterator<Item = V>,
17710 V: std::convert::Into<crate::model::curation::PluginInstanceActionID>,
17711 {
17712 use std::iter::Iterator;
17713 self.plugin_instance_actions = v.into_iter().map(|i| i.into()).collect();
17714 self
17715 }
17716
17717 /// Sets the value of [last_execution_state][crate::model::Curation::last_execution_state].
17718 ///
17719 /// # Example
17720 /// ```ignore,no_run
17721 /// # use google_cloud_apihub_v1::model::Curation;
17722 /// use google_cloud_apihub_v1::model::curation::LastExecutionState;
17723 /// let x0 = Curation::new().set_last_execution_state(LastExecutionState::Succeeded);
17724 /// let x1 = Curation::new().set_last_execution_state(LastExecutionState::Failed);
17725 /// ```
17726 pub fn set_last_execution_state<
17727 T: std::convert::Into<crate::model::curation::LastExecutionState>,
17728 >(
17729 mut self,
17730 v: T,
17731 ) -> Self {
17732 self.last_execution_state = v.into();
17733 self
17734 }
17735
17736 /// Sets the value of [last_execution_error_code][crate::model::Curation::last_execution_error_code].
17737 ///
17738 /// # Example
17739 /// ```ignore,no_run
17740 /// # use google_cloud_apihub_v1::model::Curation;
17741 /// use google_cloud_apihub_v1::model::curation::ErrorCode;
17742 /// let x0 = Curation::new().set_last_execution_error_code(ErrorCode::InternalError);
17743 /// let x1 = Curation::new().set_last_execution_error_code(ErrorCode::Unauthorized);
17744 /// ```
17745 pub fn set_last_execution_error_code<
17746 T: std::convert::Into<crate::model::curation::ErrorCode>,
17747 >(
17748 mut self,
17749 v: T,
17750 ) -> Self {
17751 self.last_execution_error_code = v.into();
17752 self
17753 }
17754
17755 /// Sets the value of [last_execution_error_message][crate::model::Curation::last_execution_error_message].
17756 ///
17757 /// # Example
17758 /// ```ignore,no_run
17759 /// # use google_cloud_apihub_v1::model::Curation;
17760 /// let x = Curation::new().set_last_execution_error_message("example");
17761 /// ```
17762 pub fn set_last_execution_error_message<T: std::convert::Into<std::string::String>>(
17763 mut self,
17764 v: T,
17765 ) -> Self {
17766 self.last_execution_error_message = v.into();
17767 self
17768 }
17769
17770 /// Sets the value of [create_time][crate::model::Curation::create_time].
17771 ///
17772 /// # Example
17773 /// ```ignore,no_run
17774 /// # use google_cloud_apihub_v1::model::Curation;
17775 /// use wkt::Timestamp;
17776 /// let x = Curation::new().set_create_time(Timestamp::default()/* use setters */);
17777 /// ```
17778 pub fn set_create_time<T>(mut self, v: T) -> Self
17779 where
17780 T: std::convert::Into<wkt::Timestamp>,
17781 {
17782 self.create_time = std::option::Option::Some(v.into());
17783 self
17784 }
17785
17786 /// Sets or clears the value of [create_time][crate::model::Curation::create_time].
17787 ///
17788 /// # Example
17789 /// ```ignore,no_run
17790 /// # use google_cloud_apihub_v1::model::Curation;
17791 /// use wkt::Timestamp;
17792 /// let x = Curation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17793 /// let x = Curation::new().set_or_clear_create_time(None::<Timestamp>);
17794 /// ```
17795 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17796 where
17797 T: std::convert::Into<wkt::Timestamp>,
17798 {
17799 self.create_time = v.map(|x| x.into());
17800 self
17801 }
17802
17803 /// Sets the value of [update_time][crate::model::Curation::update_time].
17804 ///
17805 /// # Example
17806 /// ```ignore,no_run
17807 /// # use google_cloud_apihub_v1::model::Curation;
17808 /// use wkt::Timestamp;
17809 /// let x = Curation::new().set_update_time(Timestamp::default()/* use setters */);
17810 /// ```
17811 pub fn set_update_time<T>(mut self, v: T) -> Self
17812 where
17813 T: std::convert::Into<wkt::Timestamp>,
17814 {
17815 self.update_time = std::option::Option::Some(v.into());
17816 self
17817 }
17818
17819 /// Sets or clears the value of [update_time][crate::model::Curation::update_time].
17820 ///
17821 /// # Example
17822 /// ```ignore,no_run
17823 /// # use google_cloud_apihub_v1::model::Curation;
17824 /// use wkt::Timestamp;
17825 /// let x = Curation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17826 /// let x = Curation::new().set_or_clear_update_time(None::<Timestamp>);
17827 /// ```
17828 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17829 where
17830 T: std::convert::Into<wkt::Timestamp>,
17831 {
17832 self.update_time = v.map(|x| x.into());
17833 self
17834 }
17835}
17836
17837impl wkt::message::Message for Curation {
17838 fn typename() -> &'static str {
17839 "type.googleapis.com/google.cloud.apihub.v1.Curation"
17840 }
17841}
17842
17843/// Defines additional types related to [Curation].
17844pub mod curation {
17845 #[allow(unused_imports)]
17846 use super::*;
17847
17848 /// The plugin instance and associated action that is using the curation.
17849 #[derive(Clone, Default, PartialEq)]
17850 #[non_exhaustive]
17851 pub struct PluginInstanceActionID {
17852 /// Output only. Plugin instance that is using the curation.
17853 /// Format is
17854 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
17855 pub plugin_instance: std::string::String,
17856
17857 /// Output only. The action ID that is using the curation.
17858 /// This should map to one of the action IDs specified
17859 /// in action configs in the plugin.
17860 pub action_id: std::string::String,
17861
17862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17863 }
17864
17865 impl PluginInstanceActionID {
17866 pub fn new() -> Self {
17867 std::default::Default::default()
17868 }
17869
17870 /// Sets the value of [plugin_instance][crate::model::curation::PluginInstanceActionID::plugin_instance].
17871 ///
17872 /// # Example
17873 /// ```ignore,no_run
17874 /// # use google_cloud_apihub_v1::model::curation::PluginInstanceActionID;
17875 /// let x = PluginInstanceActionID::new().set_plugin_instance("example");
17876 /// ```
17877 pub fn set_plugin_instance<T: std::convert::Into<std::string::String>>(
17878 mut self,
17879 v: T,
17880 ) -> Self {
17881 self.plugin_instance = v.into();
17882 self
17883 }
17884
17885 /// Sets the value of [action_id][crate::model::curation::PluginInstanceActionID::action_id].
17886 ///
17887 /// # Example
17888 /// ```ignore,no_run
17889 /// # use google_cloud_apihub_v1::model::curation::PluginInstanceActionID;
17890 /// let x = PluginInstanceActionID::new().set_action_id("example");
17891 /// ```
17892 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17893 self.action_id = v.into();
17894 self
17895 }
17896 }
17897
17898 impl wkt::message::Message for PluginInstanceActionID {
17899 fn typename() -> &'static str {
17900 "type.googleapis.com/google.cloud.apihub.v1.Curation.PluginInstanceActionID"
17901 }
17902 }
17903
17904 /// The state of the last execution of the curation.
17905 ///
17906 /// # Working with unknown values
17907 ///
17908 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17909 /// additional enum variants at any time. Adding new variants is not considered
17910 /// a breaking change. Applications should write their code in anticipation of:
17911 ///
17912 /// - New values appearing in future releases of the client library, **and**
17913 /// - New values received dynamically, without application changes.
17914 ///
17915 /// Please consult the [Working with enums] section in the user guide for some
17916 /// guidelines.
17917 ///
17918 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17919 #[derive(Clone, Debug, PartialEq)]
17920 #[non_exhaustive]
17921 pub enum LastExecutionState {
17922 /// Default unspecified state.
17923 Unspecified,
17924 /// The last curation execution was successful.
17925 Succeeded,
17926 /// The last curation execution failed.
17927 Failed,
17928 /// If set, the enum was initialized with an unknown value.
17929 ///
17930 /// Applications can examine the value using [LastExecutionState::value] or
17931 /// [LastExecutionState::name].
17932 UnknownValue(last_execution_state::UnknownValue),
17933 }
17934
17935 #[doc(hidden)]
17936 pub mod last_execution_state {
17937 #[allow(unused_imports)]
17938 use super::*;
17939 #[derive(Clone, Debug, PartialEq)]
17940 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17941 }
17942
17943 impl LastExecutionState {
17944 /// Gets the enum value.
17945 ///
17946 /// Returns `None` if the enum contains an unknown value deserialized from
17947 /// the string representation of enums.
17948 pub fn value(&self) -> std::option::Option<i32> {
17949 match self {
17950 Self::Unspecified => std::option::Option::Some(0),
17951 Self::Succeeded => std::option::Option::Some(1),
17952 Self::Failed => std::option::Option::Some(2),
17953 Self::UnknownValue(u) => u.0.value(),
17954 }
17955 }
17956
17957 /// Gets the enum value as a string.
17958 ///
17959 /// Returns `None` if the enum contains an unknown value deserialized from
17960 /// the integer representation of enums.
17961 pub fn name(&self) -> std::option::Option<&str> {
17962 match self {
17963 Self::Unspecified => std::option::Option::Some("LAST_EXECUTION_STATE_UNSPECIFIED"),
17964 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
17965 Self::Failed => std::option::Option::Some("FAILED"),
17966 Self::UnknownValue(u) => u.0.name(),
17967 }
17968 }
17969 }
17970
17971 impl std::default::Default for LastExecutionState {
17972 fn default() -> Self {
17973 use std::convert::From;
17974 Self::from(0)
17975 }
17976 }
17977
17978 impl std::fmt::Display for LastExecutionState {
17979 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17980 wkt::internal::display_enum(f, self.name(), self.value())
17981 }
17982 }
17983
17984 impl std::convert::From<i32> for LastExecutionState {
17985 fn from(value: i32) -> Self {
17986 match value {
17987 0 => Self::Unspecified,
17988 1 => Self::Succeeded,
17989 2 => Self::Failed,
17990 _ => Self::UnknownValue(last_execution_state::UnknownValue(
17991 wkt::internal::UnknownEnumValue::Integer(value),
17992 )),
17993 }
17994 }
17995 }
17996
17997 impl std::convert::From<&str> for LastExecutionState {
17998 fn from(value: &str) -> Self {
17999 use std::string::ToString;
18000 match value {
18001 "LAST_EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
18002 "SUCCEEDED" => Self::Succeeded,
18003 "FAILED" => Self::Failed,
18004 _ => Self::UnknownValue(last_execution_state::UnknownValue(
18005 wkt::internal::UnknownEnumValue::String(value.to_string()),
18006 )),
18007 }
18008 }
18009 }
18010
18011 impl serde::ser::Serialize for LastExecutionState {
18012 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18013 where
18014 S: serde::Serializer,
18015 {
18016 match self {
18017 Self::Unspecified => serializer.serialize_i32(0),
18018 Self::Succeeded => serializer.serialize_i32(1),
18019 Self::Failed => serializer.serialize_i32(2),
18020 Self::UnknownValue(u) => u.0.serialize(serializer),
18021 }
18022 }
18023 }
18024
18025 impl<'de> serde::de::Deserialize<'de> for LastExecutionState {
18026 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18027 where
18028 D: serde::Deserializer<'de>,
18029 {
18030 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LastExecutionState>::new(
18031 ".google.cloud.apihub.v1.Curation.LastExecutionState",
18032 ))
18033 }
18034 }
18035
18036 /// The error codes for failed executions.
18037 ///
18038 /// # Working with unknown values
18039 ///
18040 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18041 /// additional enum variants at any time. Adding new variants is not considered
18042 /// a breaking change. Applications should write their code in anticipation of:
18043 ///
18044 /// - New values appearing in future releases of the client library, **and**
18045 /// - New values received dynamically, without application changes.
18046 ///
18047 /// Please consult the [Working with enums] section in the user guide for some
18048 /// guidelines.
18049 ///
18050 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18051 #[derive(Clone, Debug, PartialEq)]
18052 #[non_exhaustive]
18053 pub enum ErrorCode {
18054 /// Default unspecified error code.
18055 Unspecified,
18056 /// The execution failed due to an internal error.
18057 InternalError,
18058 /// The curation is not authorized to trigger the endpoint uri.
18059 Unauthorized,
18060 /// If set, the enum was initialized with an unknown value.
18061 ///
18062 /// Applications can examine the value using [ErrorCode::value] or
18063 /// [ErrorCode::name].
18064 UnknownValue(error_code::UnknownValue),
18065 }
18066
18067 #[doc(hidden)]
18068 pub mod error_code {
18069 #[allow(unused_imports)]
18070 use super::*;
18071 #[derive(Clone, Debug, PartialEq)]
18072 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18073 }
18074
18075 impl ErrorCode {
18076 /// Gets the enum value.
18077 ///
18078 /// Returns `None` if the enum contains an unknown value deserialized from
18079 /// the string representation of enums.
18080 pub fn value(&self) -> std::option::Option<i32> {
18081 match self {
18082 Self::Unspecified => std::option::Option::Some(0),
18083 Self::InternalError => std::option::Option::Some(1),
18084 Self::Unauthorized => std::option::Option::Some(2),
18085 Self::UnknownValue(u) => u.0.value(),
18086 }
18087 }
18088
18089 /// Gets the enum value as a string.
18090 ///
18091 /// Returns `None` if the enum contains an unknown value deserialized from
18092 /// the integer representation of enums.
18093 pub fn name(&self) -> std::option::Option<&str> {
18094 match self {
18095 Self::Unspecified => std::option::Option::Some("ERROR_CODE_UNSPECIFIED"),
18096 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
18097 Self::Unauthorized => std::option::Option::Some("UNAUTHORIZED"),
18098 Self::UnknownValue(u) => u.0.name(),
18099 }
18100 }
18101 }
18102
18103 impl std::default::Default for ErrorCode {
18104 fn default() -> Self {
18105 use std::convert::From;
18106 Self::from(0)
18107 }
18108 }
18109
18110 impl std::fmt::Display for ErrorCode {
18111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18112 wkt::internal::display_enum(f, self.name(), self.value())
18113 }
18114 }
18115
18116 impl std::convert::From<i32> for ErrorCode {
18117 fn from(value: i32) -> Self {
18118 match value {
18119 0 => Self::Unspecified,
18120 1 => Self::InternalError,
18121 2 => Self::Unauthorized,
18122 _ => Self::UnknownValue(error_code::UnknownValue(
18123 wkt::internal::UnknownEnumValue::Integer(value),
18124 )),
18125 }
18126 }
18127 }
18128
18129 impl std::convert::From<&str> for ErrorCode {
18130 fn from(value: &str) -> Self {
18131 use std::string::ToString;
18132 match value {
18133 "ERROR_CODE_UNSPECIFIED" => Self::Unspecified,
18134 "INTERNAL_ERROR" => Self::InternalError,
18135 "UNAUTHORIZED" => Self::Unauthorized,
18136 _ => Self::UnknownValue(error_code::UnknownValue(
18137 wkt::internal::UnknownEnumValue::String(value.to_string()),
18138 )),
18139 }
18140 }
18141 }
18142
18143 impl serde::ser::Serialize for ErrorCode {
18144 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18145 where
18146 S: serde::Serializer,
18147 {
18148 match self {
18149 Self::Unspecified => serializer.serialize_i32(0),
18150 Self::InternalError => serializer.serialize_i32(1),
18151 Self::Unauthorized => serializer.serialize_i32(2),
18152 Self::UnknownValue(u) => u.0.serialize(serializer),
18153 }
18154 }
18155 }
18156
18157 impl<'de> serde::de::Deserialize<'de> for ErrorCode {
18158 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18159 where
18160 D: serde::Deserializer<'de>,
18161 {
18162 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ErrorCode>::new(
18163 ".google.cloud.apihub.v1.Curation.ErrorCode",
18164 ))
18165 }
18166 }
18167}
18168
18169/// The endpoint to be triggered for curation.
18170/// The endpoint will be invoked with a request payload containing
18171/// [ApiMetadata][google.cloud.apihub.v1.ApiHub.ApiMetadata].
18172/// Response should contain curated data in the form of
18173/// [ApiMetadata][google.cloud.apihub.v1.ApiHub.ApiMetadata].
18174#[derive(Clone, Default, PartialEq)]
18175#[non_exhaustive]
18176pub struct Endpoint {
18177 /// The details of the endpoint to be triggered for curation.
18178 pub endpoint_details: std::option::Option<crate::model::endpoint::EndpointDetails>,
18179
18180 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18181}
18182
18183impl Endpoint {
18184 pub fn new() -> Self {
18185 std::default::Default::default()
18186 }
18187
18188 /// Sets the value of [endpoint_details][crate::model::Endpoint::endpoint_details].
18189 ///
18190 /// Note that all the setters affecting `endpoint_details` are mutually
18191 /// exclusive.
18192 ///
18193 /// # Example
18194 /// ```ignore,no_run
18195 /// # use google_cloud_apihub_v1::model::Endpoint;
18196 /// use google_cloud_apihub_v1::model::ApplicationIntegrationEndpointDetails;
18197 /// let x = Endpoint::new().set_endpoint_details(Some(
18198 /// google_cloud_apihub_v1::model::endpoint::EndpointDetails::ApplicationIntegrationEndpointDetails(ApplicationIntegrationEndpointDetails::default().into())));
18199 /// ```
18200 pub fn set_endpoint_details<
18201 T: std::convert::Into<std::option::Option<crate::model::endpoint::EndpointDetails>>,
18202 >(
18203 mut self,
18204 v: T,
18205 ) -> Self {
18206 self.endpoint_details = v.into();
18207 self
18208 }
18209
18210 /// The value of [endpoint_details][crate::model::Endpoint::endpoint_details]
18211 /// if it holds a `ApplicationIntegrationEndpointDetails`, `None` if the field is not set or
18212 /// holds a different branch.
18213 pub fn application_integration_endpoint_details(
18214 &self,
18215 ) -> std::option::Option<&std::boxed::Box<crate::model::ApplicationIntegrationEndpointDetails>>
18216 {
18217 #[allow(unreachable_patterns)]
18218 self.endpoint_details.as_ref().and_then(|v| match v {
18219 crate::model::endpoint::EndpointDetails::ApplicationIntegrationEndpointDetails(v) => {
18220 std::option::Option::Some(v)
18221 }
18222 _ => std::option::Option::None,
18223 })
18224 }
18225
18226 /// Sets the value of [endpoint_details][crate::model::Endpoint::endpoint_details]
18227 /// to hold a `ApplicationIntegrationEndpointDetails`.
18228 ///
18229 /// Note that all the setters affecting `endpoint_details` are
18230 /// mutually exclusive.
18231 ///
18232 /// # Example
18233 /// ```ignore,no_run
18234 /// # use google_cloud_apihub_v1::model::Endpoint;
18235 /// use google_cloud_apihub_v1::model::ApplicationIntegrationEndpointDetails;
18236 /// let x = Endpoint::new().set_application_integration_endpoint_details(ApplicationIntegrationEndpointDetails::default()/* use setters */);
18237 /// assert!(x.application_integration_endpoint_details().is_some());
18238 /// ```
18239 pub fn set_application_integration_endpoint_details<
18240 T: std::convert::Into<std::boxed::Box<crate::model::ApplicationIntegrationEndpointDetails>>,
18241 >(
18242 mut self,
18243 v: T,
18244 ) -> Self {
18245 self.endpoint_details = std::option::Option::Some(
18246 crate::model::endpoint::EndpointDetails::ApplicationIntegrationEndpointDetails(
18247 v.into(),
18248 ),
18249 );
18250 self
18251 }
18252}
18253
18254impl wkt::message::Message for Endpoint {
18255 fn typename() -> &'static str {
18256 "type.googleapis.com/google.cloud.apihub.v1.Endpoint"
18257 }
18258}
18259
18260/// Defines additional types related to [Endpoint].
18261pub mod endpoint {
18262 #[allow(unused_imports)]
18263 use super::*;
18264
18265 /// The details of the endpoint to be triggered for curation.
18266 #[derive(Clone, Debug, PartialEq)]
18267 #[non_exhaustive]
18268 pub enum EndpointDetails {
18269 /// Required. The details of the Application Integration endpoint to be
18270 /// triggered for curation.
18271 ApplicationIntegrationEndpointDetails(
18272 std::boxed::Box<crate::model::ApplicationIntegrationEndpointDetails>,
18273 ),
18274 }
18275}
18276
18277/// The details of the Application Integration endpoint to be triggered for
18278/// curation.
18279#[derive(Clone, Default, PartialEq)]
18280#[non_exhaustive]
18281pub struct ApplicationIntegrationEndpointDetails {
18282 /// Required. The endpoint URI should be a valid REST URI for triggering an
18283 /// Application Integration. Format:
18284 /// `<https://integrations.googleapis.com/v1/{name=projects/>*/locations/*/integrations/*}:execute`
18285 /// or
18286 /// `https://{location}-integrations.googleapis.com/v1/{name=projects/*/locations/*/integrations/*}:execute`
18287 pub uri: std::string::String,
18288
18289 /// Required. The API trigger ID of the Application Integration workflow.
18290 pub trigger_id: std::string::String,
18291
18292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18293}
18294
18295impl ApplicationIntegrationEndpointDetails {
18296 pub fn new() -> Self {
18297 std::default::Default::default()
18298 }
18299
18300 /// Sets the value of [uri][crate::model::ApplicationIntegrationEndpointDetails::uri].
18301 ///
18302 /// # Example
18303 /// ```ignore,no_run
18304 /// # use google_cloud_apihub_v1::model::ApplicationIntegrationEndpointDetails;
18305 /// let x = ApplicationIntegrationEndpointDetails::new().set_uri("example");
18306 /// ```
18307 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18308 self.uri = v.into();
18309 self
18310 }
18311
18312 /// Sets the value of [trigger_id][crate::model::ApplicationIntegrationEndpointDetails::trigger_id].
18313 ///
18314 /// # Example
18315 /// ```ignore,no_run
18316 /// # use google_cloud_apihub_v1::model::ApplicationIntegrationEndpointDetails;
18317 /// let x = ApplicationIntegrationEndpointDetails::new().set_trigger_id("example");
18318 /// ```
18319 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18320 self.trigger_id = v.into();
18321 self
18322 }
18323}
18324
18325impl wkt::message::Message for ApplicationIntegrationEndpointDetails {
18326 fn typename() -> &'static str {
18327 "type.googleapis.com/google.cloud.apihub.v1.ApplicationIntegrationEndpointDetails"
18328 }
18329}
18330
18331/// Message for requesting list of DiscoveredApiObservations
18332#[derive(Clone, Default, PartialEq)]
18333#[non_exhaustive]
18334pub struct ListDiscoveredApiObservationsRequest {
18335 /// Required. The parent, which owns this collection of ApiObservations.
18336 /// Format:
18337 /// projects/{project}/locations/{location}
18338 pub parent: std::string::String,
18339
18340 /// Optional. The maximum number of ApiObservations to return. The service may
18341 /// return fewer than this value. If unspecified, at most 10
18342 /// ApiObservations will be returned. The maximum value is 1000; values
18343 /// above 1000 will be coerced to 1000.
18344 pub page_size: i32,
18345
18346 /// Optional. A page token, received from a previous `ListApiObservations`
18347 /// call. Provide this to retrieve the subsequent page.
18348 ///
18349 /// When paginating, all other parameters provided to
18350 /// `ListApiObservations` must match the call that provided the page
18351 /// token.
18352 pub page_token: std::string::String,
18353
18354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18355}
18356
18357impl ListDiscoveredApiObservationsRequest {
18358 pub fn new() -> Self {
18359 std::default::Default::default()
18360 }
18361
18362 /// Sets the value of [parent][crate::model::ListDiscoveredApiObservationsRequest::parent].
18363 ///
18364 /// # Example
18365 /// ```ignore,no_run
18366 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiObservationsRequest;
18367 /// let x = ListDiscoveredApiObservationsRequest::new().set_parent("example");
18368 /// ```
18369 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18370 self.parent = v.into();
18371 self
18372 }
18373
18374 /// Sets the value of [page_size][crate::model::ListDiscoveredApiObservationsRequest::page_size].
18375 ///
18376 /// # Example
18377 /// ```ignore,no_run
18378 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiObservationsRequest;
18379 /// let x = ListDiscoveredApiObservationsRequest::new().set_page_size(42);
18380 /// ```
18381 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18382 self.page_size = v.into();
18383 self
18384 }
18385
18386 /// Sets the value of [page_token][crate::model::ListDiscoveredApiObservationsRequest::page_token].
18387 ///
18388 /// # Example
18389 /// ```ignore,no_run
18390 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiObservationsRequest;
18391 /// let x = ListDiscoveredApiObservationsRequest::new().set_page_token("example");
18392 /// ```
18393 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18394 self.page_token = v.into();
18395 self
18396 }
18397}
18398
18399impl wkt::message::Message for ListDiscoveredApiObservationsRequest {
18400 fn typename() -> &'static str {
18401 "type.googleapis.com/google.cloud.apihub.v1.ListDiscoveredApiObservationsRequest"
18402 }
18403}
18404
18405/// Message for response to listing DiscoveredApiObservations
18406#[derive(Clone, Default, PartialEq)]
18407#[non_exhaustive]
18408pub struct ListDiscoveredApiObservationsResponse {
18409 /// The DiscoveredApiObservation from the specified project and location.
18410 pub discovered_api_observations: std::vec::Vec<crate::model::DiscoveredApiObservation>,
18411
18412 /// A token, which can be sent as `page_token` to retrieve the next page.
18413 /// If this field is omitted, there are no subsequent pages.
18414 pub next_page_token: std::string::String,
18415
18416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18417}
18418
18419impl ListDiscoveredApiObservationsResponse {
18420 pub fn new() -> Self {
18421 std::default::Default::default()
18422 }
18423
18424 /// Sets the value of [discovered_api_observations][crate::model::ListDiscoveredApiObservationsResponse::discovered_api_observations].
18425 ///
18426 /// # Example
18427 /// ```ignore,no_run
18428 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiObservationsResponse;
18429 /// use google_cloud_apihub_v1::model::DiscoveredApiObservation;
18430 /// let x = ListDiscoveredApiObservationsResponse::new()
18431 /// .set_discovered_api_observations([
18432 /// DiscoveredApiObservation::default()/* use setters */,
18433 /// DiscoveredApiObservation::default()/* use (different) setters */,
18434 /// ]);
18435 /// ```
18436 pub fn set_discovered_api_observations<T, V>(mut self, v: T) -> Self
18437 where
18438 T: std::iter::IntoIterator<Item = V>,
18439 V: std::convert::Into<crate::model::DiscoveredApiObservation>,
18440 {
18441 use std::iter::Iterator;
18442 self.discovered_api_observations = v.into_iter().map(|i| i.into()).collect();
18443 self
18444 }
18445
18446 /// Sets the value of [next_page_token][crate::model::ListDiscoveredApiObservationsResponse::next_page_token].
18447 ///
18448 /// # Example
18449 /// ```ignore,no_run
18450 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiObservationsResponse;
18451 /// let x = ListDiscoveredApiObservationsResponse::new().set_next_page_token("example");
18452 /// ```
18453 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18454 self.next_page_token = v.into();
18455 self
18456 }
18457}
18458
18459impl wkt::message::Message for ListDiscoveredApiObservationsResponse {
18460 fn typename() -> &'static str {
18461 "type.googleapis.com/google.cloud.apihub.v1.ListDiscoveredApiObservationsResponse"
18462 }
18463}
18464
18465#[doc(hidden)]
18466impl google_cloud_gax::paginator::internal::PageableResponse
18467 for ListDiscoveredApiObservationsResponse
18468{
18469 type PageItem = crate::model::DiscoveredApiObservation;
18470
18471 fn items(self) -> std::vec::Vec<Self::PageItem> {
18472 self.discovered_api_observations
18473 }
18474
18475 fn next_page_token(&self) -> std::string::String {
18476 use std::clone::Clone;
18477 self.next_page_token.clone()
18478 }
18479}
18480
18481/// Message for requesting list of DiscoveredApiOperations
18482#[derive(Clone, Default, PartialEq)]
18483#[non_exhaustive]
18484pub struct ListDiscoveredApiOperationsRequest {
18485 /// Required. The parent, which owns this collection of
18486 /// DiscoveredApiOperations. Format:
18487 /// projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
18488 pub parent: std::string::String,
18489
18490 /// Optional. DiscoveredApiOperations will be returned. The maximum value is
18491 /// 1000; values above 1000 will be coerced to 1000.
18492 pub page_size: i32,
18493
18494 /// Optional. A page token, received from a previous
18495 /// `ListDiscoveredApiApiOperations` call. Provide this to retrieve the
18496 /// subsequent page.
18497 ///
18498 /// When paginating, all other parameters provided to
18499 /// `ListDiscoveredApiApiOperations` must match the call that provided the page
18500 /// token.
18501 pub page_token: std::string::String,
18502
18503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18504}
18505
18506impl ListDiscoveredApiOperationsRequest {
18507 pub fn new() -> Self {
18508 std::default::Default::default()
18509 }
18510
18511 /// Sets the value of [parent][crate::model::ListDiscoveredApiOperationsRequest::parent].
18512 ///
18513 /// # Example
18514 /// ```ignore,no_run
18515 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiOperationsRequest;
18516 /// let x = ListDiscoveredApiOperationsRequest::new().set_parent("example");
18517 /// ```
18518 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18519 self.parent = v.into();
18520 self
18521 }
18522
18523 /// Sets the value of [page_size][crate::model::ListDiscoveredApiOperationsRequest::page_size].
18524 ///
18525 /// # Example
18526 /// ```ignore,no_run
18527 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiOperationsRequest;
18528 /// let x = ListDiscoveredApiOperationsRequest::new().set_page_size(42);
18529 /// ```
18530 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18531 self.page_size = v.into();
18532 self
18533 }
18534
18535 /// Sets the value of [page_token][crate::model::ListDiscoveredApiOperationsRequest::page_token].
18536 ///
18537 /// # Example
18538 /// ```ignore,no_run
18539 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiOperationsRequest;
18540 /// let x = ListDiscoveredApiOperationsRequest::new().set_page_token("example");
18541 /// ```
18542 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18543 self.page_token = v.into();
18544 self
18545 }
18546}
18547
18548impl wkt::message::Message for ListDiscoveredApiOperationsRequest {
18549 fn typename() -> &'static str {
18550 "type.googleapis.com/google.cloud.apihub.v1.ListDiscoveredApiOperationsRequest"
18551 }
18552}
18553
18554/// Message for response to listing DiscoveredApiOperations
18555#[derive(Clone, Default, PartialEq)]
18556#[non_exhaustive]
18557pub struct ListDiscoveredApiOperationsResponse {
18558 /// The DiscoveredApiOperations from the specified project, location
18559 /// and DiscoveredApiObservation.
18560 pub discovered_api_operations: std::vec::Vec<crate::model::DiscoveredApiOperation>,
18561
18562 /// A token, which can be sent as `page_token` to retrieve the next page.
18563 /// If this field is omitted, there are no subsequent pages.
18564 pub next_page_token: std::string::String,
18565
18566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18567}
18568
18569impl ListDiscoveredApiOperationsResponse {
18570 pub fn new() -> Self {
18571 std::default::Default::default()
18572 }
18573
18574 /// Sets the value of [discovered_api_operations][crate::model::ListDiscoveredApiOperationsResponse::discovered_api_operations].
18575 ///
18576 /// # Example
18577 /// ```ignore,no_run
18578 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiOperationsResponse;
18579 /// use google_cloud_apihub_v1::model::DiscoveredApiOperation;
18580 /// let x = ListDiscoveredApiOperationsResponse::new()
18581 /// .set_discovered_api_operations([
18582 /// DiscoveredApiOperation::default()/* use setters */,
18583 /// DiscoveredApiOperation::default()/* use (different) setters */,
18584 /// ]);
18585 /// ```
18586 pub fn set_discovered_api_operations<T, V>(mut self, v: T) -> Self
18587 where
18588 T: std::iter::IntoIterator<Item = V>,
18589 V: std::convert::Into<crate::model::DiscoveredApiOperation>,
18590 {
18591 use std::iter::Iterator;
18592 self.discovered_api_operations = v.into_iter().map(|i| i.into()).collect();
18593 self
18594 }
18595
18596 /// Sets the value of [next_page_token][crate::model::ListDiscoveredApiOperationsResponse::next_page_token].
18597 ///
18598 /// # Example
18599 /// ```ignore,no_run
18600 /// # use google_cloud_apihub_v1::model::ListDiscoveredApiOperationsResponse;
18601 /// let x = ListDiscoveredApiOperationsResponse::new().set_next_page_token("example");
18602 /// ```
18603 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18604 self.next_page_token = v.into();
18605 self
18606 }
18607}
18608
18609impl wkt::message::Message for ListDiscoveredApiOperationsResponse {
18610 fn typename() -> &'static str {
18611 "type.googleapis.com/google.cloud.apihub.v1.ListDiscoveredApiOperationsResponse"
18612 }
18613}
18614
18615#[doc(hidden)]
18616impl google_cloud_gax::paginator::internal::PageableResponse
18617 for ListDiscoveredApiOperationsResponse
18618{
18619 type PageItem = crate::model::DiscoveredApiOperation;
18620
18621 fn items(self) -> std::vec::Vec<Self::PageItem> {
18622 self.discovered_api_operations
18623 }
18624
18625 fn next_page_token(&self) -> std::string::String {
18626 use std::clone::Clone;
18627 self.next_page_token.clone()
18628 }
18629}
18630
18631/// Message for requesting a DiscoveredApiObservation
18632#[derive(Clone, Default, PartialEq)]
18633#[non_exhaustive]
18634pub struct GetDiscoveredApiObservationRequest {
18635 /// Required. The name of the DiscoveredApiObservation to retrieve.
18636 /// Format:
18637 /// projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}
18638 pub name: std::string::String,
18639
18640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18641}
18642
18643impl GetDiscoveredApiObservationRequest {
18644 pub fn new() -> Self {
18645 std::default::Default::default()
18646 }
18647
18648 /// Sets the value of [name][crate::model::GetDiscoveredApiObservationRequest::name].
18649 ///
18650 /// # Example
18651 /// ```ignore,no_run
18652 /// # use google_cloud_apihub_v1::model::GetDiscoveredApiObservationRequest;
18653 /// let x = GetDiscoveredApiObservationRequest::new().set_name("example");
18654 /// ```
18655 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18656 self.name = v.into();
18657 self
18658 }
18659}
18660
18661impl wkt::message::Message for GetDiscoveredApiObservationRequest {
18662 fn typename() -> &'static str {
18663 "type.googleapis.com/google.cloud.apihub.v1.GetDiscoveredApiObservationRequest"
18664 }
18665}
18666
18667/// Message for requesting a DiscoveredApiOperation
18668#[derive(Clone, Default, PartialEq)]
18669#[non_exhaustive]
18670pub struct GetDiscoveredApiOperationRequest {
18671 /// Required. The name of the DiscoveredApiOperation to retrieve.
18672 /// Format:
18673 /// projects/{project}/locations/{location}/discoveredApiObservations/{discovered_api_observation}/discoveredApiOperations/{discovered_api_operation}
18674 pub name: std::string::String,
18675
18676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18677}
18678
18679impl GetDiscoveredApiOperationRequest {
18680 pub fn new() -> Self {
18681 std::default::Default::default()
18682 }
18683
18684 /// Sets the value of [name][crate::model::GetDiscoveredApiOperationRequest::name].
18685 ///
18686 /// # Example
18687 /// ```ignore,no_run
18688 /// # use google_cloud_apihub_v1::model::GetDiscoveredApiOperationRequest;
18689 /// let x = GetDiscoveredApiOperationRequest::new().set_name("example");
18690 /// ```
18691 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18692 self.name = v.into();
18693 self
18694 }
18695}
18696
18697impl wkt::message::Message for GetDiscoveredApiOperationRequest {
18698 fn typename() -> &'static str {
18699 "type.googleapis.com/google.cloud.apihub.v1.GetDiscoveredApiOperationRequest"
18700 }
18701}
18702
18703/// The
18704/// [CreateHostProjectRegistration][google.cloud.apihub.v1.HostProjectRegistrationService.CreateHostProjectRegistration]
18705/// method's request.
18706///
18707/// [google.cloud.apihub.v1.HostProjectRegistrationService.CreateHostProjectRegistration]: crate::client::HostProjectRegistrationService::create_host_project_registration
18708#[derive(Clone, Default, PartialEq)]
18709#[non_exhaustive]
18710pub struct CreateHostProjectRegistrationRequest {
18711 /// Required. The parent resource for the host project.
18712 /// Format: `projects/{project}/locations/{location}`
18713 pub parent: std::string::String,
18714
18715 /// Required. The ID to use for the Host Project Registration, which will
18716 /// become the final component of the host project registration's resource
18717 /// name. The ID must be the same as the Google cloud project specified in the
18718 /// host_project_registration.gcp_project field.
18719 pub host_project_registration_id: std::string::String,
18720
18721 /// Required. The host project registration to register.
18722 pub host_project_registration: std::option::Option<crate::model::HostProjectRegistration>,
18723
18724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18725}
18726
18727impl CreateHostProjectRegistrationRequest {
18728 pub fn new() -> Self {
18729 std::default::Default::default()
18730 }
18731
18732 /// Sets the value of [parent][crate::model::CreateHostProjectRegistrationRequest::parent].
18733 ///
18734 /// # Example
18735 /// ```ignore,no_run
18736 /// # use google_cloud_apihub_v1::model::CreateHostProjectRegistrationRequest;
18737 /// let x = CreateHostProjectRegistrationRequest::new().set_parent("example");
18738 /// ```
18739 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18740 self.parent = v.into();
18741 self
18742 }
18743
18744 /// Sets the value of [host_project_registration_id][crate::model::CreateHostProjectRegistrationRequest::host_project_registration_id].
18745 ///
18746 /// # Example
18747 /// ```ignore,no_run
18748 /// # use google_cloud_apihub_v1::model::CreateHostProjectRegistrationRequest;
18749 /// let x = CreateHostProjectRegistrationRequest::new().set_host_project_registration_id("example");
18750 /// ```
18751 pub fn set_host_project_registration_id<T: std::convert::Into<std::string::String>>(
18752 mut self,
18753 v: T,
18754 ) -> Self {
18755 self.host_project_registration_id = v.into();
18756 self
18757 }
18758
18759 /// Sets the value of [host_project_registration][crate::model::CreateHostProjectRegistrationRequest::host_project_registration].
18760 ///
18761 /// # Example
18762 /// ```ignore,no_run
18763 /// # use google_cloud_apihub_v1::model::CreateHostProjectRegistrationRequest;
18764 /// use google_cloud_apihub_v1::model::HostProjectRegistration;
18765 /// let x = CreateHostProjectRegistrationRequest::new().set_host_project_registration(HostProjectRegistration::default()/* use setters */);
18766 /// ```
18767 pub fn set_host_project_registration<T>(mut self, v: T) -> Self
18768 where
18769 T: std::convert::Into<crate::model::HostProjectRegistration>,
18770 {
18771 self.host_project_registration = std::option::Option::Some(v.into());
18772 self
18773 }
18774
18775 /// Sets or clears the value of [host_project_registration][crate::model::CreateHostProjectRegistrationRequest::host_project_registration].
18776 ///
18777 /// # Example
18778 /// ```ignore,no_run
18779 /// # use google_cloud_apihub_v1::model::CreateHostProjectRegistrationRequest;
18780 /// use google_cloud_apihub_v1::model::HostProjectRegistration;
18781 /// let x = CreateHostProjectRegistrationRequest::new().set_or_clear_host_project_registration(Some(HostProjectRegistration::default()/* use setters */));
18782 /// let x = CreateHostProjectRegistrationRequest::new().set_or_clear_host_project_registration(None::<HostProjectRegistration>);
18783 /// ```
18784 pub fn set_or_clear_host_project_registration<T>(mut self, v: std::option::Option<T>) -> Self
18785 where
18786 T: std::convert::Into<crate::model::HostProjectRegistration>,
18787 {
18788 self.host_project_registration = v.map(|x| x.into());
18789 self
18790 }
18791}
18792
18793impl wkt::message::Message for CreateHostProjectRegistrationRequest {
18794 fn typename() -> &'static str {
18795 "type.googleapis.com/google.cloud.apihub.v1.CreateHostProjectRegistrationRequest"
18796 }
18797}
18798
18799/// The
18800/// [GetHostProjectRegistration][google.cloud.apihub.v1.HostProjectRegistrationService.GetHostProjectRegistration]
18801/// method's request.
18802///
18803/// [google.cloud.apihub.v1.HostProjectRegistrationService.GetHostProjectRegistration]: crate::client::HostProjectRegistrationService::get_host_project_registration
18804#[derive(Clone, Default, PartialEq)]
18805#[non_exhaustive]
18806pub struct GetHostProjectRegistrationRequest {
18807 /// Required. Host project registration resource name.
18808 /// projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration_id}
18809 pub name: std::string::String,
18810
18811 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18812}
18813
18814impl GetHostProjectRegistrationRequest {
18815 pub fn new() -> Self {
18816 std::default::Default::default()
18817 }
18818
18819 /// Sets the value of [name][crate::model::GetHostProjectRegistrationRequest::name].
18820 ///
18821 /// # Example
18822 /// ```ignore,no_run
18823 /// # use google_cloud_apihub_v1::model::GetHostProjectRegistrationRequest;
18824 /// let x = GetHostProjectRegistrationRequest::new().set_name("example");
18825 /// ```
18826 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18827 self.name = v.into();
18828 self
18829 }
18830}
18831
18832impl wkt::message::Message for GetHostProjectRegistrationRequest {
18833 fn typename() -> &'static str {
18834 "type.googleapis.com/google.cloud.apihub.v1.GetHostProjectRegistrationRequest"
18835 }
18836}
18837
18838/// The
18839/// [ListHostProjectRegistrations][google.cloud.apihub.v1.HostProjectRegistrationService.ListHostProjectRegistrations]
18840/// method's request.
18841///
18842/// [google.cloud.apihub.v1.HostProjectRegistrationService.ListHostProjectRegistrations]: crate::client::HostProjectRegistrationService::list_host_project_registrations
18843#[derive(Clone, Default, PartialEq)]
18844#[non_exhaustive]
18845pub struct ListHostProjectRegistrationsRequest {
18846 /// Required. The parent, which owns this collection of host projects.
18847 /// Format: `projects/*/locations/*`
18848 pub parent: std::string::String,
18849
18850 /// Optional. The maximum number of host project registrations to return. The
18851 /// service may return fewer than this value. If unspecified, at most 50 host
18852 /// project registrations will be returned. The maximum value is 1000; values
18853 /// above 1000 will be coerced to 1000.
18854 pub page_size: i32,
18855
18856 /// Optional. A page token, received from a previous
18857 /// `ListHostProjectRegistrations` call. Provide this to retrieve the
18858 /// subsequent page.
18859 ///
18860 /// When paginating, all other parameters (except page_size) provided to
18861 /// `ListHostProjectRegistrations` must match the call that provided the page
18862 /// token.
18863 pub page_token: std::string::String,
18864
18865 /// Optional. An expression that filters the list of HostProjectRegistrations.
18866 ///
18867 /// A filter expression consists of a field name, a comparison
18868 /// operator, and a value for filtering. The value must be a string. All
18869 /// standard operators as documented at <https://google.aip.dev/160> are
18870 /// supported.
18871 ///
18872 /// The following fields in the `HostProjectRegistration` are eligible for
18873 /// filtering:
18874 ///
18875 /// * `name` - The name of the HostProjectRegistration.
18876 /// * `create_time` - The time at which the HostProjectRegistration was
18877 /// created. The value should be in the
18878 /// (RFC3339)[<https://tools.ietf.org/html/rfc3339>] format.
18879 /// * `gcp_project` - The Google cloud project associated with the
18880 /// HostProjectRegistration.
18881 pub filter: std::string::String,
18882
18883 /// Optional. Hint for how to order the results.
18884 pub order_by: std::string::String,
18885
18886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18887}
18888
18889impl ListHostProjectRegistrationsRequest {
18890 pub fn new() -> Self {
18891 std::default::Default::default()
18892 }
18893
18894 /// Sets the value of [parent][crate::model::ListHostProjectRegistrationsRequest::parent].
18895 ///
18896 /// # Example
18897 /// ```ignore,no_run
18898 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsRequest;
18899 /// let x = ListHostProjectRegistrationsRequest::new().set_parent("example");
18900 /// ```
18901 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18902 self.parent = v.into();
18903 self
18904 }
18905
18906 /// Sets the value of [page_size][crate::model::ListHostProjectRegistrationsRequest::page_size].
18907 ///
18908 /// # Example
18909 /// ```ignore,no_run
18910 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsRequest;
18911 /// let x = ListHostProjectRegistrationsRequest::new().set_page_size(42);
18912 /// ```
18913 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18914 self.page_size = v.into();
18915 self
18916 }
18917
18918 /// Sets the value of [page_token][crate::model::ListHostProjectRegistrationsRequest::page_token].
18919 ///
18920 /// # Example
18921 /// ```ignore,no_run
18922 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsRequest;
18923 /// let x = ListHostProjectRegistrationsRequest::new().set_page_token("example");
18924 /// ```
18925 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18926 self.page_token = v.into();
18927 self
18928 }
18929
18930 /// Sets the value of [filter][crate::model::ListHostProjectRegistrationsRequest::filter].
18931 ///
18932 /// # Example
18933 /// ```ignore,no_run
18934 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsRequest;
18935 /// let x = ListHostProjectRegistrationsRequest::new().set_filter("example");
18936 /// ```
18937 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18938 self.filter = v.into();
18939 self
18940 }
18941
18942 /// Sets the value of [order_by][crate::model::ListHostProjectRegistrationsRequest::order_by].
18943 ///
18944 /// # Example
18945 /// ```ignore,no_run
18946 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsRequest;
18947 /// let x = ListHostProjectRegistrationsRequest::new().set_order_by("example");
18948 /// ```
18949 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18950 self.order_by = v.into();
18951 self
18952 }
18953}
18954
18955impl wkt::message::Message for ListHostProjectRegistrationsRequest {
18956 fn typename() -> &'static str {
18957 "type.googleapis.com/google.cloud.apihub.v1.ListHostProjectRegistrationsRequest"
18958 }
18959}
18960
18961/// The
18962/// [ListHostProjectRegistrations][google.cloud.apihub.v1.HostProjectRegistrationService.ListHostProjectRegistrations]
18963/// method's response.
18964///
18965/// [google.cloud.apihub.v1.HostProjectRegistrationService.ListHostProjectRegistrations]: crate::client::HostProjectRegistrationService::list_host_project_registrations
18966#[derive(Clone, Default, PartialEq)]
18967#[non_exhaustive]
18968pub struct ListHostProjectRegistrationsResponse {
18969 /// The list of host project registrations.
18970 pub host_project_registrations: std::vec::Vec<crate::model::HostProjectRegistration>,
18971
18972 /// A token, which can be sent as `page_token` to retrieve the next page.
18973 /// If this field is omitted, there are no subsequent pages.
18974 pub next_page_token: std::string::String,
18975
18976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18977}
18978
18979impl ListHostProjectRegistrationsResponse {
18980 pub fn new() -> Self {
18981 std::default::Default::default()
18982 }
18983
18984 /// Sets the value of [host_project_registrations][crate::model::ListHostProjectRegistrationsResponse::host_project_registrations].
18985 ///
18986 /// # Example
18987 /// ```ignore,no_run
18988 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsResponse;
18989 /// use google_cloud_apihub_v1::model::HostProjectRegistration;
18990 /// let x = ListHostProjectRegistrationsResponse::new()
18991 /// .set_host_project_registrations([
18992 /// HostProjectRegistration::default()/* use setters */,
18993 /// HostProjectRegistration::default()/* use (different) setters */,
18994 /// ]);
18995 /// ```
18996 pub fn set_host_project_registrations<T, V>(mut self, v: T) -> Self
18997 where
18998 T: std::iter::IntoIterator<Item = V>,
18999 V: std::convert::Into<crate::model::HostProjectRegistration>,
19000 {
19001 use std::iter::Iterator;
19002 self.host_project_registrations = v.into_iter().map(|i| i.into()).collect();
19003 self
19004 }
19005
19006 /// Sets the value of [next_page_token][crate::model::ListHostProjectRegistrationsResponse::next_page_token].
19007 ///
19008 /// # Example
19009 /// ```ignore,no_run
19010 /// # use google_cloud_apihub_v1::model::ListHostProjectRegistrationsResponse;
19011 /// let x = ListHostProjectRegistrationsResponse::new().set_next_page_token("example");
19012 /// ```
19013 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19014 self.next_page_token = v.into();
19015 self
19016 }
19017}
19018
19019impl wkt::message::Message for ListHostProjectRegistrationsResponse {
19020 fn typename() -> &'static str {
19021 "type.googleapis.com/google.cloud.apihub.v1.ListHostProjectRegistrationsResponse"
19022 }
19023}
19024
19025#[doc(hidden)]
19026impl google_cloud_gax::paginator::internal::PageableResponse
19027 for ListHostProjectRegistrationsResponse
19028{
19029 type PageItem = crate::model::HostProjectRegistration;
19030
19031 fn items(self) -> std::vec::Vec<Self::PageItem> {
19032 self.host_project_registrations
19033 }
19034
19035 fn next_page_token(&self) -> std::string::String {
19036 use std::clone::Clone;
19037 self.next_page_token.clone()
19038 }
19039}
19040
19041/// Host project registration refers to the registration of a Google cloud
19042/// project with Api Hub as a host project. This is the project where Api Hub is
19043/// provisioned. It acts as the consumer project for the Api Hub instance
19044/// provisioned. Multiple runtime projects can be attached to the host project
19045/// and these attachments define the scope of Api Hub.
19046#[derive(Clone, Default, PartialEq)]
19047#[non_exhaustive]
19048pub struct HostProjectRegistration {
19049 /// Identifier. The name of the host project registration.
19050 /// Format:
19051 /// "projects/{project}/locations/{location}/hostProjectRegistrations/{host_project_registration}".
19052 pub name: std::string::String,
19053
19054 /// Required. Immutable. Google cloud project name in the format:
19055 /// "projects/abc" or "projects/123". As input, project name with either
19056 /// project id or number are accepted. As output, this field will contain
19057 /// project number.
19058 pub gcp_project: std::string::String,
19059
19060 /// Output only. The time at which the host project registration was created.
19061 pub create_time: std::option::Option<wkt::Timestamp>,
19062
19063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19064}
19065
19066impl HostProjectRegistration {
19067 pub fn new() -> Self {
19068 std::default::Default::default()
19069 }
19070
19071 /// Sets the value of [name][crate::model::HostProjectRegistration::name].
19072 ///
19073 /// # Example
19074 /// ```ignore,no_run
19075 /// # use google_cloud_apihub_v1::model::HostProjectRegistration;
19076 /// let x = HostProjectRegistration::new().set_name("example");
19077 /// ```
19078 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19079 self.name = v.into();
19080 self
19081 }
19082
19083 /// Sets the value of [gcp_project][crate::model::HostProjectRegistration::gcp_project].
19084 ///
19085 /// # Example
19086 /// ```ignore,no_run
19087 /// # use google_cloud_apihub_v1::model::HostProjectRegistration;
19088 /// let x = HostProjectRegistration::new().set_gcp_project("example");
19089 /// ```
19090 pub fn set_gcp_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19091 self.gcp_project = v.into();
19092 self
19093 }
19094
19095 /// Sets the value of [create_time][crate::model::HostProjectRegistration::create_time].
19096 ///
19097 /// # Example
19098 /// ```ignore,no_run
19099 /// # use google_cloud_apihub_v1::model::HostProjectRegistration;
19100 /// use wkt::Timestamp;
19101 /// let x = HostProjectRegistration::new().set_create_time(Timestamp::default()/* use setters */);
19102 /// ```
19103 pub fn set_create_time<T>(mut self, v: T) -> Self
19104 where
19105 T: std::convert::Into<wkt::Timestamp>,
19106 {
19107 self.create_time = std::option::Option::Some(v.into());
19108 self
19109 }
19110
19111 /// Sets or clears the value of [create_time][crate::model::HostProjectRegistration::create_time].
19112 ///
19113 /// # Example
19114 /// ```ignore,no_run
19115 /// # use google_cloud_apihub_v1::model::HostProjectRegistration;
19116 /// use wkt::Timestamp;
19117 /// let x = HostProjectRegistration::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19118 /// let x = HostProjectRegistration::new().set_or_clear_create_time(None::<Timestamp>);
19119 /// ```
19120 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19121 where
19122 T: std::convert::Into<wkt::Timestamp>,
19123 {
19124 self.create_time = v.map(|x| x.into());
19125 self
19126 }
19127}
19128
19129impl wkt::message::Message for HostProjectRegistration {
19130 fn typename() -> &'static str {
19131 "type.googleapis.com/google.cloud.apihub.v1.HostProjectRegistration"
19132 }
19133}
19134
19135/// The [GetStyleGuide][google.cloud.apihub.v1.LintingService.GetStyleGuide]
19136/// method's request.
19137///
19138/// [google.cloud.apihub.v1.LintingService.GetStyleGuide]: crate::client::LintingService::get_style_guide
19139#[derive(Clone, Default, PartialEq)]
19140#[non_exhaustive]
19141pub struct GetStyleGuideRequest {
19142 /// Required. The name of the spec to retrieve.
19143 /// Format:
19144 /// `projects/{project}/locations/{location}/plugins/{plugin}/styleGuide`.
19145 pub name: std::string::String,
19146
19147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19148}
19149
19150impl GetStyleGuideRequest {
19151 pub fn new() -> Self {
19152 std::default::Default::default()
19153 }
19154
19155 /// Sets the value of [name][crate::model::GetStyleGuideRequest::name].
19156 ///
19157 /// # Example
19158 /// ```ignore,no_run
19159 /// # use google_cloud_apihub_v1::model::GetStyleGuideRequest;
19160 /// let x = GetStyleGuideRequest::new().set_name("example");
19161 /// ```
19162 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19163 self.name = v.into();
19164 self
19165 }
19166}
19167
19168impl wkt::message::Message for GetStyleGuideRequest {
19169 fn typename() -> &'static str {
19170 "type.googleapis.com/google.cloud.apihub.v1.GetStyleGuideRequest"
19171 }
19172}
19173
19174/// The
19175/// [UpdateStyleGuide][google.cloud.apihub.v1.LintingService.UpdateStyleGuide]
19176/// method's request.
19177///
19178/// [google.cloud.apihub.v1.LintingService.UpdateStyleGuide]: crate::client::LintingService::update_style_guide
19179#[derive(Clone, Default, PartialEq)]
19180#[non_exhaustive]
19181pub struct UpdateStyleGuideRequest {
19182 /// Required. The Style guide resource to update.
19183 pub style_guide: std::option::Option<crate::model::StyleGuide>,
19184
19185 /// Optional. The list of fields to update.
19186 pub update_mask: std::option::Option<wkt::FieldMask>,
19187
19188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19189}
19190
19191impl UpdateStyleGuideRequest {
19192 pub fn new() -> Self {
19193 std::default::Default::default()
19194 }
19195
19196 /// Sets the value of [style_guide][crate::model::UpdateStyleGuideRequest::style_guide].
19197 ///
19198 /// # Example
19199 /// ```ignore,no_run
19200 /// # use google_cloud_apihub_v1::model::UpdateStyleGuideRequest;
19201 /// use google_cloud_apihub_v1::model::StyleGuide;
19202 /// let x = UpdateStyleGuideRequest::new().set_style_guide(StyleGuide::default()/* use setters */);
19203 /// ```
19204 pub fn set_style_guide<T>(mut self, v: T) -> Self
19205 where
19206 T: std::convert::Into<crate::model::StyleGuide>,
19207 {
19208 self.style_guide = std::option::Option::Some(v.into());
19209 self
19210 }
19211
19212 /// Sets or clears the value of [style_guide][crate::model::UpdateStyleGuideRequest::style_guide].
19213 ///
19214 /// # Example
19215 /// ```ignore,no_run
19216 /// # use google_cloud_apihub_v1::model::UpdateStyleGuideRequest;
19217 /// use google_cloud_apihub_v1::model::StyleGuide;
19218 /// let x = UpdateStyleGuideRequest::new().set_or_clear_style_guide(Some(StyleGuide::default()/* use setters */));
19219 /// let x = UpdateStyleGuideRequest::new().set_or_clear_style_guide(None::<StyleGuide>);
19220 /// ```
19221 pub fn set_or_clear_style_guide<T>(mut self, v: std::option::Option<T>) -> Self
19222 where
19223 T: std::convert::Into<crate::model::StyleGuide>,
19224 {
19225 self.style_guide = v.map(|x| x.into());
19226 self
19227 }
19228
19229 /// Sets the value of [update_mask][crate::model::UpdateStyleGuideRequest::update_mask].
19230 ///
19231 /// # Example
19232 /// ```ignore,no_run
19233 /// # use google_cloud_apihub_v1::model::UpdateStyleGuideRequest;
19234 /// use wkt::FieldMask;
19235 /// let x = UpdateStyleGuideRequest::new().set_update_mask(FieldMask::default()/* use setters */);
19236 /// ```
19237 pub fn set_update_mask<T>(mut self, v: T) -> Self
19238 where
19239 T: std::convert::Into<wkt::FieldMask>,
19240 {
19241 self.update_mask = std::option::Option::Some(v.into());
19242 self
19243 }
19244
19245 /// Sets or clears the value of [update_mask][crate::model::UpdateStyleGuideRequest::update_mask].
19246 ///
19247 /// # Example
19248 /// ```ignore,no_run
19249 /// # use google_cloud_apihub_v1::model::UpdateStyleGuideRequest;
19250 /// use wkt::FieldMask;
19251 /// let x = UpdateStyleGuideRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
19252 /// let x = UpdateStyleGuideRequest::new().set_or_clear_update_mask(None::<FieldMask>);
19253 /// ```
19254 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19255 where
19256 T: std::convert::Into<wkt::FieldMask>,
19257 {
19258 self.update_mask = v.map(|x| x.into());
19259 self
19260 }
19261}
19262
19263impl wkt::message::Message for UpdateStyleGuideRequest {
19264 fn typename() -> &'static str {
19265 "type.googleapis.com/google.cloud.apihub.v1.UpdateStyleGuideRequest"
19266 }
19267}
19268
19269/// The
19270/// [GetStyleGuideContents][google.cloud.apihub.v1.LintingService.GetStyleGuideContents]
19271/// method's request.
19272///
19273/// [google.cloud.apihub.v1.LintingService.GetStyleGuideContents]: crate::client::LintingService::get_style_guide_contents
19274#[derive(Clone, Default, PartialEq)]
19275#[non_exhaustive]
19276pub struct GetStyleGuideContentsRequest {
19277 /// Required. The name of the StyleGuide whose contents need to be retrieved.
19278 /// There is exactly one style guide resource per project per location.
19279 /// The expected format is
19280 /// `projects/{project}/locations/{location}/plugins/{plugin}/styleGuide`.
19281 pub name: std::string::String,
19282
19283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19284}
19285
19286impl GetStyleGuideContentsRequest {
19287 pub fn new() -> Self {
19288 std::default::Default::default()
19289 }
19290
19291 /// Sets the value of [name][crate::model::GetStyleGuideContentsRequest::name].
19292 ///
19293 /// # Example
19294 /// ```ignore,no_run
19295 /// # use google_cloud_apihub_v1::model::GetStyleGuideContentsRequest;
19296 /// let x = GetStyleGuideContentsRequest::new().set_name("example");
19297 /// ```
19298 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19299 self.name = v.into();
19300 self
19301 }
19302}
19303
19304impl wkt::message::Message for GetStyleGuideContentsRequest {
19305 fn typename() -> &'static str {
19306 "type.googleapis.com/google.cloud.apihub.v1.GetStyleGuideContentsRequest"
19307 }
19308}
19309
19310/// The [LintSpec][google.cloud.apihub.v1.LintingService.LintSpec] method's
19311/// request.
19312///
19313/// [google.cloud.apihub.v1.LintingService.LintSpec]: crate::client::LintingService::lint_spec
19314#[derive(Clone, Default, PartialEq)]
19315#[non_exhaustive]
19316pub struct LintSpecRequest {
19317 /// Required. The name of the spec to be linted.
19318 /// Format:
19319 /// `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
19320 pub name: std::string::String,
19321
19322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19323}
19324
19325impl LintSpecRequest {
19326 pub fn new() -> Self {
19327 std::default::Default::default()
19328 }
19329
19330 /// Sets the value of [name][crate::model::LintSpecRequest::name].
19331 ///
19332 /// # Example
19333 /// ```ignore,no_run
19334 /// # use google_cloud_apihub_v1::model::LintSpecRequest;
19335 /// let x = LintSpecRequest::new().set_name("example");
19336 /// ```
19337 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19338 self.name = v.into();
19339 self
19340 }
19341}
19342
19343impl wkt::message::Message for LintSpecRequest {
19344 fn typename() -> &'static str {
19345 "type.googleapis.com/google.cloud.apihub.v1.LintSpecRequest"
19346 }
19347}
19348
19349/// The style guide contents.
19350#[derive(Clone, Default, PartialEq)]
19351#[non_exhaustive]
19352pub struct StyleGuideContents {
19353 /// Required. The contents of the style guide.
19354 pub contents: ::bytes::Bytes,
19355
19356 /// Required. The mime type of the content.
19357 pub mime_type: std::string::String,
19358
19359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19360}
19361
19362impl StyleGuideContents {
19363 pub fn new() -> Self {
19364 std::default::Default::default()
19365 }
19366
19367 /// Sets the value of [contents][crate::model::StyleGuideContents::contents].
19368 ///
19369 /// # Example
19370 /// ```ignore,no_run
19371 /// # use google_cloud_apihub_v1::model::StyleGuideContents;
19372 /// let x = StyleGuideContents::new().set_contents(bytes::Bytes::from_static(b"example"));
19373 /// ```
19374 pub fn set_contents<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
19375 self.contents = v.into();
19376 self
19377 }
19378
19379 /// Sets the value of [mime_type][crate::model::StyleGuideContents::mime_type].
19380 ///
19381 /// # Example
19382 /// ```ignore,no_run
19383 /// # use google_cloud_apihub_v1::model::StyleGuideContents;
19384 /// let x = StyleGuideContents::new().set_mime_type("example");
19385 /// ```
19386 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19387 self.mime_type = v.into();
19388 self
19389 }
19390}
19391
19392impl wkt::message::Message for StyleGuideContents {
19393 fn typename() -> &'static str {
19394 "type.googleapis.com/google.cloud.apihub.v1.StyleGuideContents"
19395 }
19396}
19397
19398/// Represents a singleton style guide resource to be used for linting Open API
19399/// specs.
19400#[derive(Clone, Default, PartialEq)]
19401#[non_exhaustive]
19402pub struct StyleGuide {
19403 /// Identifier. The name of the style guide.
19404 ///
19405 /// Format:
19406 /// `projects/{project}/locations/{location}/plugins/{plugin}/styleGuide`
19407 pub name: std::string::String,
19408
19409 /// Required. Target linter for the style guide.
19410 pub linter: crate::model::Linter,
19411
19412 /// Required. Input only. The contents of the uploaded style guide.
19413 pub contents: std::option::Option<crate::model::StyleGuideContents>,
19414
19415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19416}
19417
19418impl StyleGuide {
19419 pub fn new() -> Self {
19420 std::default::Default::default()
19421 }
19422
19423 /// Sets the value of [name][crate::model::StyleGuide::name].
19424 ///
19425 /// # Example
19426 /// ```ignore,no_run
19427 /// # use google_cloud_apihub_v1::model::StyleGuide;
19428 /// let x = StyleGuide::new().set_name("example");
19429 /// ```
19430 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19431 self.name = v.into();
19432 self
19433 }
19434
19435 /// Sets the value of [linter][crate::model::StyleGuide::linter].
19436 ///
19437 /// # Example
19438 /// ```ignore,no_run
19439 /// # use google_cloud_apihub_v1::model::StyleGuide;
19440 /// use google_cloud_apihub_v1::model::Linter;
19441 /// let x0 = StyleGuide::new().set_linter(Linter::Spectral);
19442 /// let x1 = StyleGuide::new().set_linter(Linter::Other);
19443 /// ```
19444 pub fn set_linter<T: std::convert::Into<crate::model::Linter>>(mut self, v: T) -> Self {
19445 self.linter = v.into();
19446 self
19447 }
19448
19449 /// Sets the value of [contents][crate::model::StyleGuide::contents].
19450 ///
19451 /// # Example
19452 /// ```ignore,no_run
19453 /// # use google_cloud_apihub_v1::model::StyleGuide;
19454 /// use google_cloud_apihub_v1::model::StyleGuideContents;
19455 /// let x = StyleGuide::new().set_contents(StyleGuideContents::default()/* use setters */);
19456 /// ```
19457 pub fn set_contents<T>(mut self, v: T) -> Self
19458 where
19459 T: std::convert::Into<crate::model::StyleGuideContents>,
19460 {
19461 self.contents = std::option::Option::Some(v.into());
19462 self
19463 }
19464
19465 /// Sets or clears the value of [contents][crate::model::StyleGuide::contents].
19466 ///
19467 /// # Example
19468 /// ```ignore,no_run
19469 /// # use google_cloud_apihub_v1::model::StyleGuide;
19470 /// use google_cloud_apihub_v1::model::StyleGuideContents;
19471 /// let x = StyleGuide::new().set_or_clear_contents(Some(StyleGuideContents::default()/* use setters */));
19472 /// let x = StyleGuide::new().set_or_clear_contents(None::<StyleGuideContents>);
19473 /// ```
19474 pub fn set_or_clear_contents<T>(mut self, v: std::option::Option<T>) -> Self
19475 where
19476 T: std::convert::Into<crate::model::StyleGuideContents>,
19477 {
19478 self.contents = v.map(|x| x.into());
19479 self
19480 }
19481}
19482
19483impl wkt::message::Message for StyleGuide {
19484 fn typename() -> &'static str {
19485 "type.googleapis.com/google.cloud.apihub.v1.StyleGuide"
19486 }
19487}
19488
19489/// A plugin resource in the API Hub.
19490#[derive(Clone, Default, PartialEq)]
19491#[non_exhaustive]
19492pub struct Plugin {
19493 /// Identifier. The name of the plugin.
19494 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`
19495 pub name: std::string::String,
19496
19497 /// Required. The display name of the plugin. Max length is 50 characters
19498 /// (Unicode code points).
19499 pub display_name: std::string::String,
19500
19501 /// Optional. The type of the API.
19502 /// This maps to the following system defined attribute:
19503 /// `projects/{project}/locations/{location}/attributes/system-plugin-type`
19504 /// attribute.
19505 /// The number of allowed values for this attribute will be based on the
19506 /// cardinality of the attribute. The same can be retrieved via GetAttribute
19507 /// API. All values should be from the list of allowed values defined for the
19508 /// attribute.
19509 /// Note this field is not required for plugins developed via plugin framework.
19510 pub r#type: std::option::Option<crate::model::AttributeValues>,
19511
19512 /// Optional. The plugin description. Max length is 2000 characters (Unicode
19513 /// code points).
19514 pub description: std::string::String,
19515
19516 /// Output only. Represents the state of the plugin.
19517 /// Note this field will not be set for plugins developed via plugin
19518 /// framework as the state will be managed at plugin instance level.
19519 pub state: crate::model::plugin::State,
19520
19521 /// Output only. The type of the plugin, indicating whether it is
19522 /// 'SYSTEM_OWNED' or 'USER_OWNED'.
19523 pub ownership_type: crate::model::plugin::OwnershipType,
19524
19525 /// Optional. This field is optional. It is used to notify the plugin hosting
19526 /// service for any lifecycle changes of the plugin instance and trigger
19527 /// execution of plugin instance actions in case of API hub managed actions.
19528 ///
19529 /// This field should be provided if the plugin instance lifecycle of the
19530 /// developed plugin needs to be managed from API hub. Also, in this case the
19531 /// plugin hosting service interface needs to be implemented.
19532 ///
19533 /// This field should not be provided if the plugin wants to manage plugin
19534 /// instance lifecycle events outside of hub interface and use plugin framework
19535 /// for only registering of plugin and plugin instances to capture the source
19536 /// of data into hub. Note, in this case the plugin hosting service interface
19537 /// is not required to be implemented. Also, the plugin instance lifecycle
19538 /// actions will be disabled from API hub's UI.
19539 pub hosting_service: std::option::Option<crate::model::plugin::HostingService>,
19540
19541 /// Optional. The configuration of actions supported by the plugin.
19542 /// **REQUIRED**: This field must be provided when creating or updating a
19543 /// Plugin. The server will reject requests if this field is missing.
19544 pub actions_config: std::vec::Vec<crate::model::PluginActionConfig>,
19545
19546 /// Optional. The documentation of the plugin, that explains how to set up and
19547 /// use the plugin.
19548 pub documentation: std::option::Option<crate::model::Documentation>,
19549
19550 /// Optional. The category of the plugin, identifying its primary category or
19551 /// purpose. This field is required for all plugins.
19552 pub plugin_category: crate::model::PluginCategory,
19553
19554 /// Optional. The configuration template for the plugin.
19555 pub config_template: std::option::Option<crate::model::plugin::ConfigTemplate>,
19556
19557 /// Output only. Timestamp indicating when the plugin was created.
19558 pub create_time: std::option::Option<wkt::Timestamp>,
19559
19560 /// Output only. Timestamp indicating when the plugin was last updated.
19561 pub update_time: std::option::Option<wkt::Timestamp>,
19562
19563 /// Optional. The type of the gateway.
19564 pub gateway_type: crate::model::GatewayType,
19565
19566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19567}
19568
19569impl Plugin {
19570 pub fn new() -> Self {
19571 std::default::Default::default()
19572 }
19573
19574 /// Sets the value of [name][crate::model::Plugin::name].
19575 ///
19576 /// # Example
19577 /// ```ignore,no_run
19578 /// # use google_cloud_apihub_v1::model::Plugin;
19579 /// let x = Plugin::new().set_name("example");
19580 /// ```
19581 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19582 self.name = v.into();
19583 self
19584 }
19585
19586 /// Sets the value of [display_name][crate::model::Plugin::display_name].
19587 ///
19588 /// # Example
19589 /// ```ignore,no_run
19590 /// # use google_cloud_apihub_v1::model::Plugin;
19591 /// let x = Plugin::new().set_display_name("example");
19592 /// ```
19593 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19594 self.display_name = v.into();
19595 self
19596 }
19597
19598 /// Sets the value of [r#type][crate::model::Plugin::type].
19599 ///
19600 /// # Example
19601 /// ```ignore,no_run
19602 /// # use google_cloud_apihub_v1::model::Plugin;
19603 /// use google_cloud_apihub_v1::model::AttributeValues;
19604 /// let x = Plugin::new().set_type(AttributeValues::default()/* use setters */);
19605 /// ```
19606 pub fn set_type<T>(mut self, v: T) -> Self
19607 where
19608 T: std::convert::Into<crate::model::AttributeValues>,
19609 {
19610 self.r#type = std::option::Option::Some(v.into());
19611 self
19612 }
19613
19614 /// Sets or clears the value of [r#type][crate::model::Plugin::type].
19615 ///
19616 /// # Example
19617 /// ```ignore,no_run
19618 /// # use google_cloud_apihub_v1::model::Plugin;
19619 /// use google_cloud_apihub_v1::model::AttributeValues;
19620 /// let x = Plugin::new().set_or_clear_type(Some(AttributeValues::default()/* use setters */));
19621 /// let x = Plugin::new().set_or_clear_type(None::<AttributeValues>);
19622 /// ```
19623 pub fn set_or_clear_type<T>(mut self, v: std::option::Option<T>) -> Self
19624 where
19625 T: std::convert::Into<crate::model::AttributeValues>,
19626 {
19627 self.r#type = v.map(|x| x.into());
19628 self
19629 }
19630
19631 /// Sets the value of [description][crate::model::Plugin::description].
19632 ///
19633 /// # Example
19634 /// ```ignore,no_run
19635 /// # use google_cloud_apihub_v1::model::Plugin;
19636 /// let x = Plugin::new().set_description("example");
19637 /// ```
19638 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19639 self.description = v.into();
19640 self
19641 }
19642
19643 /// Sets the value of [state][crate::model::Plugin::state].
19644 ///
19645 /// # Example
19646 /// ```ignore,no_run
19647 /// # use google_cloud_apihub_v1::model::Plugin;
19648 /// use google_cloud_apihub_v1::model::plugin::State;
19649 /// let x0 = Plugin::new().set_state(State::Enabled);
19650 /// let x1 = Plugin::new().set_state(State::Disabled);
19651 /// ```
19652 pub fn set_state<T: std::convert::Into<crate::model::plugin::State>>(mut self, v: T) -> Self {
19653 self.state = v.into();
19654 self
19655 }
19656
19657 /// Sets the value of [ownership_type][crate::model::Plugin::ownership_type].
19658 ///
19659 /// # Example
19660 /// ```ignore,no_run
19661 /// # use google_cloud_apihub_v1::model::Plugin;
19662 /// use google_cloud_apihub_v1::model::plugin::OwnershipType;
19663 /// let x0 = Plugin::new().set_ownership_type(OwnershipType::SystemOwned);
19664 /// let x1 = Plugin::new().set_ownership_type(OwnershipType::UserOwned);
19665 /// ```
19666 pub fn set_ownership_type<T: std::convert::Into<crate::model::plugin::OwnershipType>>(
19667 mut self,
19668 v: T,
19669 ) -> Self {
19670 self.ownership_type = v.into();
19671 self
19672 }
19673
19674 /// Sets the value of [hosting_service][crate::model::Plugin::hosting_service].
19675 ///
19676 /// # Example
19677 /// ```ignore,no_run
19678 /// # use google_cloud_apihub_v1::model::Plugin;
19679 /// use google_cloud_apihub_v1::model::plugin::HostingService;
19680 /// let x = Plugin::new().set_hosting_service(HostingService::default()/* use setters */);
19681 /// ```
19682 pub fn set_hosting_service<T>(mut self, v: T) -> Self
19683 where
19684 T: std::convert::Into<crate::model::plugin::HostingService>,
19685 {
19686 self.hosting_service = std::option::Option::Some(v.into());
19687 self
19688 }
19689
19690 /// Sets or clears the value of [hosting_service][crate::model::Plugin::hosting_service].
19691 ///
19692 /// # Example
19693 /// ```ignore,no_run
19694 /// # use google_cloud_apihub_v1::model::Plugin;
19695 /// use google_cloud_apihub_v1::model::plugin::HostingService;
19696 /// let x = Plugin::new().set_or_clear_hosting_service(Some(HostingService::default()/* use setters */));
19697 /// let x = Plugin::new().set_or_clear_hosting_service(None::<HostingService>);
19698 /// ```
19699 pub fn set_or_clear_hosting_service<T>(mut self, v: std::option::Option<T>) -> Self
19700 where
19701 T: std::convert::Into<crate::model::plugin::HostingService>,
19702 {
19703 self.hosting_service = v.map(|x| x.into());
19704 self
19705 }
19706
19707 /// Sets the value of [actions_config][crate::model::Plugin::actions_config].
19708 ///
19709 /// # Example
19710 /// ```ignore,no_run
19711 /// # use google_cloud_apihub_v1::model::Plugin;
19712 /// use google_cloud_apihub_v1::model::PluginActionConfig;
19713 /// let x = Plugin::new()
19714 /// .set_actions_config([
19715 /// PluginActionConfig::default()/* use setters */,
19716 /// PluginActionConfig::default()/* use (different) setters */,
19717 /// ]);
19718 /// ```
19719 pub fn set_actions_config<T, V>(mut self, v: T) -> Self
19720 where
19721 T: std::iter::IntoIterator<Item = V>,
19722 V: std::convert::Into<crate::model::PluginActionConfig>,
19723 {
19724 use std::iter::Iterator;
19725 self.actions_config = v.into_iter().map(|i| i.into()).collect();
19726 self
19727 }
19728
19729 /// Sets the value of [documentation][crate::model::Plugin::documentation].
19730 ///
19731 /// # Example
19732 /// ```ignore,no_run
19733 /// # use google_cloud_apihub_v1::model::Plugin;
19734 /// use google_cloud_apihub_v1::model::Documentation;
19735 /// let x = Plugin::new().set_documentation(Documentation::default()/* use setters */);
19736 /// ```
19737 pub fn set_documentation<T>(mut self, v: T) -> Self
19738 where
19739 T: std::convert::Into<crate::model::Documentation>,
19740 {
19741 self.documentation = std::option::Option::Some(v.into());
19742 self
19743 }
19744
19745 /// Sets or clears the value of [documentation][crate::model::Plugin::documentation].
19746 ///
19747 /// # Example
19748 /// ```ignore,no_run
19749 /// # use google_cloud_apihub_v1::model::Plugin;
19750 /// use google_cloud_apihub_v1::model::Documentation;
19751 /// let x = Plugin::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
19752 /// let x = Plugin::new().set_or_clear_documentation(None::<Documentation>);
19753 /// ```
19754 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
19755 where
19756 T: std::convert::Into<crate::model::Documentation>,
19757 {
19758 self.documentation = v.map(|x| x.into());
19759 self
19760 }
19761
19762 /// Sets the value of [plugin_category][crate::model::Plugin::plugin_category].
19763 ///
19764 /// # Example
19765 /// ```ignore,no_run
19766 /// # use google_cloud_apihub_v1::model::Plugin;
19767 /// use google_cloud_apihub_v1::model::PluginCategory;
19768 /// let x0 = Plugin::new().set_plugin_category(PluginCategory::ApiGateway);
19769 /// let x1 = Plugin::new().set_plugin_category(PluginCategory::ApiProducer);
19770 /// ```
19771 pub fn set_plugin_category<T: std::convert::Into<crate::model::PluginCategory>>(
19772 mut self,
19773 v: T,
19774 ) -> Self {
19775 self.plugin_category = v.into();
19776 self
19777 }
19778
19779 /// Sets the value of [config_template][crate::model::Plugin::config_template].
19780 ///
19781 /// # Example
19782 /// ```ignore,no_run
19783 /// # use google_cloud_apihub_v1::model::Plugin;
19784 /// use google_cloud_apihub_v1::model::plugin::ConfigTemplate;
19785 /// let x = Plugin::new().set_config_template(ConfigTemplate::default()/* use setters */);
19786 /// ```
19787 pub fn set_config_template<T>(mut self, v: T) -> Self
19788 where
19789 T: std::convert::Into<crate::model::plugin::ConfigTemplate>,
19790 {
19791 self.config_template = std::option::Option::Some(v.into());
19792 self
19793 }
19794
19795 /// Sets or clears the value of [config_template][crate::model::Plugin::config_template].
19796 ///
19797 /// # Example
19798 /// ```ignore,no_run
19799 /// # use google_cloud_apihub_v1::model::Plugin;
19800 /// use google_cloud_apihub_v1::model::plugin::ConfigTemplate;
19801 /// let x = Plugin::new().set_or_clear_config_template(Some(ConfigTemplate::default()/* use setters */));
19802 /// let x = Plugin::new().set_or_clear_config_template(None::<ConfigTemplate>);
19803 /// ```
19804 pub fn set_or_clear_config_template<T>(mut self, v: std::option::Option<T>) -> Self
19805 where
19806 T: std::convert::Into<crate::model::plugin::ConfigTemplate>,
19807 {
19808 self.config_template = v.map(|x| x.into());
19809 self
19810 }
19811
19812 /// Sets the value of [create_time][crate::model::Plugin::create_time].
19813 ///
19814 /// # Example
19815 /// ```ignore,no_run
19816 /// # use google_cloud_apihub_v1::model::Plugin;
19817 /// use wkt::Timestamp;
19818 /// let x = Plugin::new().set_create_time(Timestamp::default()/* use setters */);
19819 /// ```
19820 pub fn set_create_time<T>(mut self, v: T) -> Self
19821 where
19822 T: std::convert::Into<wkt::Timestamp>,
19823 {
19824 self.create_time = std::option::Option::Some(v.into());
19825 self
19826 }
19827
19828 /// Sets or clears the value of [create_time][crate::model::Plugin::create_time].
19829 ///
19830 /// # Example
19831 /// ```ignore,no_run
19832 /// # use google_cloud_apihub_v1::model::Plugin;
19833 /// use wkt::Timestamp;
19834 /// let x = Plugin::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19835 /// let x = Plugin::new().set_or_clear_create_time(None::<Timestamp>);
19836 /// ```
19837 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19838 where
19839 T: std::convert::Into<wkt::Timestamp>,
19840 {
19841 self.create_time = v.map(|x| x.into());
19842 self
19843 }
19844
19845 /// Sets the value of [update_time][crate::model::Plugin::update_time].
19846 ///
19847 /// # Example
19848 /// ```ignore,no_run
19849 /// # use google_cloud_apihub_v1::model::Plugin;
19850 /// use wkt::Timestamp;
19851 /// let x = Plugin::new().set_update_time(Timestamp::default()/* use setters */);
19852 /// ```
19853 pub fn set_update_time<T>(mut self, v: T) -> Self
19854 where
19855 T: std::convert::Into<wkt::Timestamp>,
19856 {
19857 self.update_time = std::option::Option::Some(v.into());
19858 self
19859 }
19860
19861 /// Sets or clears the value of [update_time][crate::model::Plugin::update_time].
19862 ///
19863 /// # Example
19864 /// ```ignore,no_run
19865 /// # use google_cloud_apihub_v1::model::Plugin;
19866 /// use wkt::Timestamp;
19867 /// let x = Plugin::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19868 /// let x = Plugin::new().set_or_clear_update_time(None::<Timestamp>);
19869 /// ```
19870 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19871 where
19872 T: std::convert::Into<wkt::Timestamp>,
19873 {
19874 self.update_time = v.map(|x| x.into());
19875 self
19876 }
19877
19878 /// Sets the value of [gateway_type][crate::model::Plugin::gateway_type].
19879 ///
19880 /// # Example
19881 /// ```ignore,no_run
19882 /// # use google_cloud_apihub_v1::model::Plugin;
19883 /// use google_cloud_apihub_v1::model::GatewayType;
19884 /// let x0 = Plugin::new().set_gateway_type(GatewayType::ApigeeXAndHybrid);
19885 /// let x1 = Plugin::new().set_gateway_type(GatewayType::ApigeeEdgePublicCloud);
19886 /// let x2 = Plugin::new().set_gateway_type(GatewayType::ApigeeEdgePrivateCloud);
19887 /// ```
19888 pub fn set_gateway_type<T: std::convert::Into<crate::model::GatewayType>>(
19889 mut self,
19890 v: T,
19891 ) -> Self {
19892 self.gateway_type = v.into();
19893 self
19894 }
19895}
19896
19897impl wkt::message::Message for Plugin {
19898 fn typename() -> &'static str {
19899 "type.googleapis.com/google.cloud.apihub.v1.Plugin"
19900 }
19901}
19902
19903/// Defines additional types related to [Plugin].
19904pub mod plugin {
19905 #[allow(unused_imports)]
19906 use super::*;
19907
19908 /// The information related to the service implemented by the plugin
19909 /// developer, used to invoke the plugin's functionality.
19910 #[derive(Clone, Default, PartialEq)]
19911 #[non_exhaustive]
19912 pub struct HostingService {
19913 /// Optional. The URI of the service implemented by the plugin developer,
19914 /// used to invoke the plugin's functionality. This information is only
19915 /// required for user defined plugins.
19916 pub service_uri: std::string::String,
19917
19918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19919 }
19920
19921 impl HostingService {
19922 pub fn new() -> Self {
19923 std::default::Default::default()
19924 }
19925
19926 /// Sets the value of [service_uri][crate::model::plugin::HostingService::service_uri].
19927 ///
19928 /// # Example
19929 /// ```ignore,no_run
19930 /// # use google_cloud_apihub_v1::model::plugin::HostingService;
19931 /// let x = HostingService::new().set_service_uri("example");
19932 /// ```
19933 pub fn set_service_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19934 self.service_uri = v.into();
19935 self
19936 }
19937 }
19938
19939 impl wkt::message::Message for HostingService {
19940 fn typename() -> &'static str {
19941 "type.googleapis.com/google.cloud.apihub.v1.Plugin.HostingService"
19942 }
19943 }
19944
19945 /// ConfigTemplate represents the configuration template for a plugin.
19946 #[derive(Clone, Default, PartialEq)]
19947 #[non_exhaustive]
19948 pub struct ConfigTemplate {
19949 /// Optional. The authentication template for the plugin.
19950 pub auth_config_template:
19951 std::option::Option<crate::model::plugin::config_template::AuthConfigTemplate>,
19952
19953 /// Optional. The list of additional configuration variables for the plugin's
19954 /// configuration.
19955 pub additional_config_template: std::vec::Vec<crate::model::ConfigVariableTemplate>,
19956
19957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19958 }
19959
19960 impl ConfigTemplate {
19961 pub fn new() -> Self {
19962 std::default::Default::default()
19963 }
19964
19965 /// Sets the value of [auth_config_template][crate::model::plugin::ConfigTemplate::auth_config_template].
19966 ///
19967 /// # Example
19968 /// ```ignore,no_run
19969 /// # use google_cloud_apihub_v1::model::plugin::ConfigTemplate;
19970 /// use google_cloud_apihub_v1::model::plugin::config_template::AuthConfigTemplate;
19971 /// let x = ConfigTemplate::new().set_auth_config_template(AuthConfigTemplate::default()/* use setters */);
19972 /// ```
19973 pub fn set_auth_config_template<T>(mut self, v: T) -> Self
19974 where
19975 T: std::convert::Into<crate::model::plugin::config_template::AuthConfigTemplate>,
19976 {
19977 self.auth_config_template = std::option::Option::Some(v.into());
19978 self
19979 }
19980
19981 /// Sets or clears the value of [auth_config_template][crate::model::plugin::ConfigTemplate::auth_config_template].
19982 ///
19983 /// # Example
19984 /// ```ignore,no_run
19985 /// # use google_cloud_apihub_v1::model::plugin::ConfigTemplate;
19986 /// use google_cloud_apihub_v1::model::plugin::config_template::AuthConfigTemplate;
19987 /// let x = ConfigTemplate::new().set_or_clear_auth_config_template(Some(AuthConfigTemplate::default()/* use setters */));
19988 /// let x = ConfigTemplate::new().set_or_clear_auth_config_template(None::<AuthConfigTemplate>);
19989 /// ```
19990 pub fn set_or_clear_auth_config_template<T>(mut self, v: std::option::Option<T>) -> Self
19991 where
19992 T: std::convert::Into<crate::model::plugin::config_template::AuthConfigTemplate>,
19993 {
19994 self.auth_config_template = v.map(|x| x.into());
19995 self
19996 }
19997
19998 /// Sets the value of [additional_config_template][crate::model::plugin::ConfigTemplate::additional_config_template].
19999 ///
20000 /// # Example
20001 /// ```ignore,no_run
20002 /// # use google_cloud_apihub_v1::model::plugin::ConfigTemplate;
20003 /// use google_cloud_apihub_v1::model::ConfigVariableTemplate;
20004 /// let x = ConfigTemplate::new()
20005 /// .set_additional_config_template([
20006 /// ConfigVariableTemplate::default()/* use setters */,
20007 /// ConfigVariableTemplate::default()/* use (different) setters */,
20008 /// ]);
20009 /// ```
20010 pub fn set_additional_config_template<T, V>(mut self, v: T) -> Self
20011 where
20012 T: std::iter::IntoIterator<Item = V>,
20013 V: std::convert::Into<crate::model::ConfigVariableTemplate>,
20014 {
20015 use std::iter::Iterator;
20016 self.additional_config_template = v.into_iter().map(|i| i.into()).collect();
20017 self
20018 }
20019 }
20020
20021 impl wkt::message::Message for ConfigTemplate {
20022 fn typename() -> &'static str {
20023 "type.googleapis.com/google.cloud.apihub.v1.Plugin.ConfigTemplate"
20024 }
20025 }
20026
20027 /// Defines additional types related to [ConfigTemplate].
20028 pub mod config_template {
20029 #[allow(unused_imports)]
20030 use super::*;
20031
20032 /// AuthConfigTemplate represents the authentication template for a plugin.
20033 #[derive(Clone, Default, PartialEq)]
20034 #[non_exhaustive]
20035 pub struct AuthConfigTemplate {
20036 /// Required. The list of authentication types supported by the plugin.
20037 pub supported_auth_types: std::vec::Vec<crate::model::AuthType>,
20038
20039 /// Optional. The service account of the plugin hosting service.
20040 /// This service account should be granted the required permissions on the
20041 /// Auth Config parameters provided while creating the plugin instances
20042 /// corresponding to this plugin.
20043 ///
20044 /// For example, if the plugin instance auth config requires a secret
20045 /// manager secret, the service account should be granted the
20046 /// secretmanager.versions.access permission on the corresponding secret,
20047 /// if the plugin instance auth config contains a service account, the
20048 /// service account should be granted the
20049 /// iam.serviceAccounts.getAccessToken permission on the corresponding
20050 /// service account.
20051 pub service_account: std::option::Option<crate::model::GoogleServiceAccountConfig>,
20052
20053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20054 }
20055
20056 impl AuthConfigTemplate {
20057 pub fn new() -> Self {
20058 std::default::Default::default()
20059 }
20060
20061 /// Sets the value of [supported_auth_types][crate::model::plugin::config_template::AuthConfigTemplate::supported_auth_types].
20062 ///
20063 /// # Example
20064 /// ```ignore,no_run
20065 /// # use google_cloud_apihub_v1::model::plugin::config_template::AuthConfigTemplate;
20066 /// use google_cloud_apihub_v1::model::AuthType;
20067 /// let x = AuthConfigTemplate::new().set_supported_auth_types([
20068 /// AuthType::NoAuth,
20069 /// AuthType::GoogleServiceAccount,
20070 /// AuthType::UserPassword,
20071 /// ]);
20072 /// ```
20073 pub fn set_supported_auth_types<T, V>(mut self, v: T) -> Self
20074 where
20075 T: std::iter::IntoIterator<Item = V>,
20076 V: std::convert::Into<crate::model::AuthType>,
20077 {
20078 use std::iter::Iterator;
20079 self.supported_auth_types = v.into_iter().map(|i| i.into()).collect();
20080 self
20081 }
20082
20083 /// Sets the value of [service_account][crate::model::plugin::config_template::AuthConfigTemplate::service_account].
20084 ///
20085 /// # Example
20086 /// ```ignore,no_run
20087 /// # use google_cloud_apihub_v1::model::plugin::config_template::AuthConfigTemplate;
20088 /// use google_cloud_apihub_v1::model::GoogleServiceAccountConfig;
20089 /// let x = AuthConfigTemplate::new().set_service_account(GoogleServiceAccountConfig::default()/* use setters */);
20090 /// ```
20091 pub fn set_service_account<T>(mut self, v: T) -> Self
20092 where
20093 T: std::convert::Into<crate::model::GoogleServiceAccountConfig>,
20094 {
20095 self.service_account = std::option::Option::Some(v.into());
20096 self
20097 }
20098
20099 /// Sets or clears the value of [service_account][crate::model::plugin::config_template::AuthConfigTemplate::service_account].
20100 ///
20101 /// # Example
20102 /// ```ignore,no_run
20103 /// # use google_cloud_apihub_v1::model::plugin::config_template::AuthConfigTemplate;
20104 /// use google_cloud_apihub_v1::model::GoogleServiceAccountConfig;
20105 /// let x = AuthConfigTemplate::new().set_or_clear_service_account(Some(GoogleServiceAccountConfig::default()/* use setters */));
20106 /// let x = AuthConfigTemplate::new().set_or_clear_service_account(None::<GoogleServiceAccountConfig>);
20107 /// ```
20108 pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
20109 where
20110 T: std::convert::Into<crate::model::GoogleServiceAccountConfig>,
20111 {
20112 self.service_account = v.map(|x| x.into());
20113 self
20114 }
20115 }
20116
20117 impl wkt::message::Message for AuthConfigTemplate {
20118 fn typename() -> &'static str {
20119 "type.googleapis.com/google.cloud.apihub.v1.Plugin.ConfigTemplate.AuthConfigTemplate"
20120 }
20121 }
20122 }
20123
20124 /// Possible states a plugin can have. Note that this enum may receive new
20125 /// values in the future. Consumers are advised to always code against the
20126 /// enum values expecting new states can be added later on.
20127 ///
20128 /// # Working with unknown values
20129 ///
20130 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20131 /// additional enum variants at any time. Adding new variants is not considered
20132 /// a breaking change. Applications should write their code in anticipation of:
20133 ///
20134 /// - New values appearing in future releases of the client library, **and**
20135 /// - New values received dynamically, without application changes.
20136 ///
20137 /// Please consult the [Working with enums] section in the user guide for some
20138 /// guidelines.
20139 ///
20140 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20141 #[derive(Clone, Debug, PartialEq)]
20142 #[non_exhaustive]
20143 pub enum State {
20144 /// The default value. This value is used if the state is omitted.
20145 Unspecified,
20146 /// The plugin is enabled.
20147 Enabled,
20148 /// The plugin is disabled.
20149 Disabled,
20150 /// If set, the enum was initialized with an unknown value.
20151 ///
20152 /// Applications can examine the value using [State::value] or
20153 /// [State::name].
20154 UnknownValue(state::UnknownValue),
20155 }
20156
20157 #[doc(hidden)]
20158 pub mod state {
20159 #[allow(unused_imports)]
20160 use super::*;
20161 #[derive(Clone, Debug, PartialEq)]
20162 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20163 }
20164
20165 impl State {
20166 /// Gets the enum value.
20167 ///
20168 /// Returns `None` if the enum contains an unknown value deserialized from
20169 /// the string representation of enums.
20170 pub fn value(&self) -> std::option::Option<i32> {
20171 match self {
20172 Self::Unspecified => std::option::Option::Some(0),
20173 Self::Enabled => std::option::Option::Some(1),
20174 Self::Disabled => std::option::Option::Some(2),
20175 Self::UnknownValue(u) => u.0.value(),
20176 }
20177 }
20178
20179 /// Gets the enum value as a string.
20180 ///
20181 /// Returns `None` if the enum contains an unknown value deserialized from
20182 /// the integer representation of enums.
20183 pub fn name(&self) -> std::option::Option<&str> {
20184 match self {
20185 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
20186 Self::Enabled => std::option::Option::Some("ENABLED"),
20187 Self::Disabled => std::option::Option::Some("DISABLED"),
20188 Self::UnknownValue(u) => u.0.name(),
20189 }
20190 }
20191 }
20192
20193 impl std::default::Default for State {
20194 fn default() -> Self {
20195 use std::convert::From;
20196 Self::from(0)
20197 }
20198 }
20199
20200 impl std::fmt::Display for State {
20201 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20202 wkt::internal::display_enum(f, self.name(), self.value())
20203 }
20204 }
20205
20206 impl std::convert::From<i32> for State {
20207 fn from(value: i32) -> Self {
20208 match value {
20209 0 => Self::Unspecified,
20210 1 => Self::Enabled,
20211 2 => Self::Disabled,
20212 _ => Self::UnknownValue(state::UnknownValue(
20213 wkt::internal::UnknownEnumValue::Integer(value),
20214 )),
20215 }
20216 }
20217 }
20218
20219 impl std::convert::From<&str> for State {
20220 fn from(value: &str) -> Self {
20221 use std::string::ToString;
20222 match value {
20223 "STATE_UNSPECIFIED" => Self::Unspecified,
20224 "ENABLED" => Self::Enabled,
20225 "DISABLED" => Self::Disabled,
20226 _ => Self::UnknownValue(state::UnknownValue(
20227 wkt::internal::UnknownEnumValue::String(value.to_string()),
20228 )),
20229 }
20230 }
20231 }
20232
20233 impl serde::ser::Serialize for State {
20234 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20235 where
20236 S: serde::Serializer,
20237 {
20238 match self {
20239 Self::Unspecified => serializer.serialize_i32(0),
20240 Self::Enabled => serializer.serialize_i32(1),
20241 Self::Disabled => serializer.serialize_i32(2),
20242 Self::UnknownValue(u) => u.0.serialize(serializer),
20243 }
20244 }
20245 }
20246
20247 impl<'de> serde::de::Deserialize<'de> for State {
20248 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20249 where
20250 D: serde::Deserializer<'de>,
20251 {
20252 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
20253 ".google.cloud.apihub.v1.Plugin.State",
20254 ))
20255 }
20256 }
20257
20258 /// Ownership type of the plugin.
20259 ///
20260 /// # Working with unknown values
20261 ///
20262 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20263 /// additional enum variants at any time. Adding new variants is not considered
20264 /// a breaking change. Applications should write their code in anticipation of:
20265 ///
20266 /// - New values appearing in future releases of the client library, **and**
20267 /// - New values received dynamically, without application changes.
20268 ///
20269 /// Please consult the [Working with enums] section in the user guide for some
20270 /// guidelines.
20271 ///
20272 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20273 #[derive(Clone, Debug, PartialEq)]
20274 #[non_exhaustive]
20275 pub enum OwnershipType {
20276 /// Default unspecified type.
20277 Unspecified,
20278 /// System owned plugins are defined by API hub and are available out of the
20279 /// box in API hub.
20280 SystemOwned,
20281 /// User owned plugins are defined by the user and need to be explicitly
20282 /// added to API hub via
20283 /// [CreatePlugin][google.cloud.apihub.v1.ApiHubPlugin.CreatePlugin] method.
20284 ///
20285 /// [google.cloud.apihub.v1.ApiHubPlugin.CreatePlugin]: crate::client::ApiHubPlugin::create_plugin
20286 UserOwned,
20287 /// If set, the enum was initialized with an unknown value.
20288 ///
20289 /// Applications can examine the value using [OwnershipType::value] or
20290 /// [OwnershipType::name].
20291 UnknownValue(ownership_type::UnknownValue),
20292 }
20293
20294 #[doc(hidden)]
20295 pub mod ownership_type {
20296 #[allow(unused_imports)]
20297 use super::*;
20298 #[derive(Clone, Debug, PartialEq)]
20299 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20300 }
20301
20302 impl OwnershipType {
20303 /// Gets the enum value.
20304 ///
20305 /// Returns `None` if the enum contains an unknown value deserialized from
20306 /// the string representation of enums.
20307 pub fn value(&self) -> std::option::Option<i32> {
20308 match self {
20309 Self::Unspecified => std::option::Option::Some(0),
20310 Self::SystemOwned => std::option::Option::Some(1),
20311 Self::UserOwned => std::option::Option::Some(2),
20312 Self::UnknownValue(u) => u.0.value(),
20313 }
20314 }
20315
20316 /// Gets the enum value as a string.
20317 ///
20318 /// Returns `None` if the enum contains an unknown value deserialized from
20319 /// the integer representation of enums.
20320 pub fn name(&self) -> std::option::Option<&str> {
20321 match self {
20322 Self::Unspecified => std::option::Option::Some("OWNERSHIP_TYPE_UNSPECIFIED"),
20323 Self::SystemOwned => std::option::Option::Some("SYSTEM_OWNED"),
20324 Self::UserOwned => std::option::Option::Some("USER_OWNED"),
20325 Self::UnknownValue(u) => u.0.name(),
20326 }
20327 }
20328 }
20329
20330 impl std::default::Default for OwnershipType {
20331 fn default() -> Self {
20332 use std::convert::From;
20333 Self::from(0)
20334 }
20335 }
20336
20337 impl std::fmt::Display for OwnershipType {
20338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20339 wkt::internal::display_enum(f, self.name(), self.value())
20340 }
20341 }
20342
20343 impl std::convert::From<i32> for OwnershipType {
20344 fn from(value: i32) -> Self {
20345 match value {
20346 0 => Self::Unspecified,
20347 1 => Self::SystemOwned,
20348 2 => Self::UserOwned,
20349 _ => Self::UnknownValue(ownership_type::UnknownValue(
20350 wkt::internal::UnknownEnumValue::Integer(value),
20351 )),
20352 }
20353 }
20354 }
20355
20356 impl std::convert::From<&str> for OwnershipType {
20357 fn from(value: &str) -> Self {
20358 use std::string::ToString;
20359 match value {
20360 "OWNERSHIP_TYPE_UNSPECIFIED" => Self::Unspecified,
20361 "SYSTEM_OWNED" => Self::SystemOwned,
20362 "USER_OWNED" => Self::UserOwned,
20363 _ => Self::UnknownValue(ownership_type::UnknownValue(
20364 wkt::internal::UnknownEnumValue::String(value.to_string()),
20365 )),
20366 }
20367 }
20368 }
20369
20370 impl serde::ser::Serialize for OwnershipType {
20371 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20372 where
20373 S: serde::Serializer,
20374 {
20375 match self {
20376 Self::Unspecified => serializer.serialize_i32(0),
20377 Self::SystemOwned => serializer.serialize_i32(1),
20378 Self::UserOwned => serializer.serialize_i32(2),
20379 Self::UnknownValue(u) => u.0.serialize(serializer),
20380 }
20381 }
20382 }
20383
20384 impl<'de> serde::de::Deserialize<'de> for OwnershipType {
20385 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20386 where
20387 D: serde::Deserializer<'de>,
20388 {
20389 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OwnershipType>::new(
20390 ".google.cloud.apihub.v1.Plugin.OwnershipType",
20391 ))
20392 }
20393 }
20394}
20395
20396/// PluginActionConfig represents the configuration of an action supported by a
20397/// plugin.
20398#[derive(Clone, Default, PartialEq)]
20399#[non_exhaustive]
20400pub struct PluginActionConfig {
20401 /// Required. The id of the action.
20402 pub id: std::string::String,
20403
20404 /// Required. The display name of the action.
20405 pub display_name: std::string::String,
20406
20407 /// Required. The description of the operation performed by the action.
20408 pub description: std::string::String,
20409
20410 /// Required. The trigger mode supported by the action.
20411 pub trigger_mode: crate::model::plugin_action_config::TriggerMode,
20412
20413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20414}
20415
20416impl PluginActionConfig {
20417 pub fn new() -> Self {
20418 std::default::Default::default()
20419 }
20420
20421 /// Sets the value of [id][crate::model::PluginActionConfig::id].
20422 ///
20423 /// # Example
20424 /// ```ignore,no_run
20425 /// # use google_cloud_apihub_v1::model::PluginActionConfig;
20426 /// let x = PluginActionConfig::new().set_id("example");
20427 /// ```
20428 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20429 self.id = v.into();
20430 self
20431 }
20432
20433 /// Sets the value of [display_name][crate::model::PluginActionConfig::display_name].
20434 ///
20435 /// # Example
20436 /// ```ignore,no_run
20437 /// # use google_cloud_apihub_v1::model::PluginActionConfig;
20438 /// let x = PluginActionConfig::new().set_display_name("example");
20439 /// ```
20440 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20441 self.display_name = v.into();
20442 self
20443 }
20444
20445 /// Sets the value of [description][crate::model::PluginActionConfig::description].
20446 ///
20447 /// # Example
20448 /// ```ignore,no_run
20449 /// # use google_cloud_apihub_v1::model::PluginActionConfig;
20450 /// let x = PluginActionConfig::new().set_description("example");
20451 /// ```
20452 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20453 self.description = v.into();
20454 self
20455 }
20456
20457 /// Sets the value of [trigger_mode][crate::model::PluginActionConfig::trigger_mode].
20458 ///
20459 /// # Example
20460 /// ```ignore,no_run
20461 /// # use google_cloud_apihub_v1::model::PluginActionConfig;
20462 /// use google_cloud_apihub_v1::model::plugin_action_config::TriggerMode;
20463 /// let x0 = PluginActionConfig::new().set_trigger_mode(TriggerMode::ApiHubOnDemandTrigger);
20464 /// let x1 = PluginActionConfig::new().set_trigger_mode(TriggerMode::ApiHubScheduleTrigger);
20465 /// let x2 = PluginActionConfig::new().set_trigger_mode(TriggerMode::NonApiHubManaged);
20466 /// ```
20467 pub fn set_trigger_mode<
20468 T: std::convert::Into<crate::model::plugin_action_config::TriggerMode>,
20469 >(
20470 mut self,
20471 v: T,
20472 ) -> Self {
20473 self.trigger_mode = v.into();
20474 self
20475 }
20476}
20477
20478impl wkt::message::Message for PluginActionConfig {
20479 fn typename() -> &'static str {
20480 "type.googleapis.com/google.cloud.apihub.v1.PluginActionConfig"
20481 }
20482}
20483
20484/// Defines additional types related to [PluginActionConfig].
20485pub mod plugin_action_config {
20486 #[allow(unused_imports)]
20487 use super::*;
20488
20489 /// Execution mode of the action.
20490 ///
20491 /// # Working with unknown values
20492 ///
20493 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20494 /// additional enum variants at any time. Adding new variants is not considered
20495 /// a breaking change. Applications should write their code in anticipation of:
20496 ///
20497 /// - New values appearing in future releases of the client library, **and**
20498 /// - New values received dynamically, without application changes.
20499 ///
20500 /// Please consult the [Working with enums] section in the user guide for some
20501 /// guidelines.
20502 ///
20503 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20504 #[derive(Clone, Debug, PartialEq)]
20505 #[non_exhaustive]
20506 pub enum TriggerMode {
20507 /// Default unspecified mode.
20508 Unspecified,
20509 /// This action can be executed by invoking
20510 /// [ExecutePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]
20511 /// API with the given action id. To support this, the plugin hosting service
20512 /// should handle this action id as part of execute call.
20513 ///
20514 /// [google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]: crate::client::ApiHubPlugin::execute_plugin_instance_action
20515 ApiHubOnDemandTrigger,
20516 /// This action will be executed on schedule by invoking
20517 /// [ExecutePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]
20518 /// API with the given action id. To set the schedule, the user can provide
20519 /// the cron expression in the
20520 /// [PluginAction][PluginAction.schedule_cron_expression] field for a given
20521 /// plugin instance. To support this, the plugin hosting service should
20522 /// handle this action id as part of execute call.
20523 /// Note, on demand execution will be supported by default in this trigger
20524 /// mode.
20525 ///
20526 /// [google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]: crate::client::ApiHubPlugin::execute_plugin_instance_action
20527 ApiHubScheduleTrigger,
20528 /// The execution of this plugin is not handled by API hub. In this case,
20529 /// the plugin hosting service need not handle this action id as part of
20530 /// the execute call.
20531 NonApiHubManaged,
20532 /// If set, the enum was initialized with an unknown value.
20533 ///
20534 /// Applications can examine the value using [TriggerMode::value] or
20535 /// [TriggerMode::name].
20536 UnknownValue(trigger_mode::UnknownValue),
20537 }
20538
20539 #[doc(hidden)]
20540 pub mod trigger_mode {
20541 #[allow(unused_imports)]
20542 use super::*;
20543 #[derive(Clone, Debug, PartialEq)]
20544 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20545 }
20546
20547 impl TriggerMode {
20548 /// Gets the enum value.
20549 ///
20550 /// Returns `None` if the enum contains an unknown value deserialized from
20551 /// the string representation of enums.
20552 pub fn value(&self) -> std::option::Option<i32> {
20553 match self {
20554 Self::Unspecified => std::option::Option::Some(0),
20555 Self::ApiHubOnDemandTrigger => std::option::Option::Some(1),
20556 Self::ApiHubScheduleTrigger => std::option::Option::Some(2),
20557 Self::NonApiHubManaged => std::option::Option::Some(3),
20558 Self::UnknownValue(u) => u.0.value(),
20559 }
20560 }
20561
20562 /// Gets the enum value as a string.
20563 ///
20564 /// Returns `None` if the enum contains an unknown value deserialized from
20565 /// the integer representation of enums.
20566 pub fn name(&self) -> std::option::Option<&str> {
20567 match self {
20568 Self::Unspecified => std::option::Option::Some("TRIGGER_MODE_UNSPECIFIED"),
20569 Self::ApiHubOnDemandTrigger => {
20570 std::option::Option::Some("API_HUB_ON_DEMAND_TRIGGER")
20571 }
20572 Self::ApiHubScheduleTrigger => {
20573 std::option::Option::Some("API_HUB_SCHEDULE_TRIGGER")
20574 }
20575 Self::NonApiHubManaged => std::option::Option::Some("NON_API_HUB_MANAGED"),
20576 Self::UnknownValue(u) => u.0.name(),
20577 }
20578 }
20579 }
20580
20581 impl std::default::Default for TriggerMode {
20582 fn default() -> Self {
20583 use std::convert::From;
20584 Self::from(0)
20585 }
20586 }
20587
20588 impl std::fmt::Display for TriggerMode {
20589 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20590 wkt::internal::display_enum(f, self.name(), self.value())
20591 }
20592 }
20593
20594 impl std::convert::From<i32> for TriggerMode {
20595 fn from(value: i32) -> Self {
20596 match value {
20597 0 => Self::Unspecified,
20598 1 => Self::ApiHubOnDemandTrigger,
20599 2 => Self::ApiHubScheduleTrigger,
20600 3 => Self::NonApiHubManaged,
20601 _ => Self::UnknownValue(trigger_mode::UnknownValue(
20602 wkt::internal::UnknownEnumValue::Integer(value),
20603 )),
20604 }
20605 }
20606 }
20607
20608 impl std::convert::From<&str> for TriggerMode {
20609 fn from(value: &str) -> Self {
20610 use std::string::ToString;
20611 match value {
20612 "TRIGGER_MODE_UNSPECIFIED" => Self::Unspecified,
20613 "API_HUB_ON_DEMAND_TRIGGER" => Self::ApiHubOnDemandTrigger,
20614 "API_HUB_SCHEDULE_TRIGGER" => Self::ApiHubScheduleTrigger,
20615 "NON_API_HUB_MANAGED" => Self::NonApiHubManaged,
20616 _ => Self::UnknownValue(trigger_mode::UnknownValue(
20617 wkt::internal::UnknownEnumValue::String(value.to_string()),
20618 )),
20619 }
20620 }
20621 }
20622
20623 impl serde::ser::Serialize for TriggerMode {
20624 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20625 where
20626 S: serde::Serializer,
20627 {
20628 match self {
20629 Self::Unspecified => serializer.serialize_i32(0),
20630 Self::ApiHubOnDemandTrigger => serializer.serialize_i32(1),
20631 Self::ApiHubScheduleTrigger => serializer.serialize_i32(2),
20632 Self::NonApiHubManaged => serializer.serialize_i32(3),
20633 Self::UnknownValue(u) => u.0.serialize(serializer),
20634 }
20635 }
20636 }
20637
20638 impl<'de> serde::de::Deserialize<'de> for TriggerMode {
20639 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20640 where
20641 D: serde::Deserializer<'de>,
20642 {
20643 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TriggerMode>::new(
20644 ".google.cloud.apihub.v1.PluginActionConfig.TriggerMode",
20645 ))
20646 }
20647 }
20648}
20649
20650/// The [GetPlugin][google.cloud.apihub.v1.ApiHubPlugin.GetPlugin] method's
20651/// request.
20652///
20653/// [google.cloud.apihub.v1.ApiHubPlugin.GetPlugin]: crate::client::ApiHubPlugin::get_plugin
20654#[derive(Clone, Default, PartialEq)]
20655#[non_exhaustive]
20656pub struct GetPluginRequest {
20657 /// Required. The name of the plugin to retrieve.
20658 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`.
20659 pub name: std::string::String,
20660
20661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20662}
20663
20664impl GetPluginRequest {
20665 pub fn new() -> Self {
20666 std::default::Default::default()
20667 }
20668
20669 /// Sets the value of [name][crate::model::GetPluginRequest::name].
20670 ///
20671 /// # Example
20672 /// ```ignore,no_run
20673 /// # use google_cloud_apihub_v1::model::GetPluginRequest;
20674 /// let x = GetPluginRequest::new().set_name("example");
20675 /// ```
20676 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20677 self.name = v.into();
20678 self
20679 }
20680}
20681
20682impl wkt::message::Message for GetPluginRequest {
20683 fn typename() -> &'static str {
20684 "type.googleapis.com/google.cloud.apihub.v1.GetPluginRequest"
20685 }
20686}
20687
20688/// The [EnablePlugin][google.cloud.apihub.v1.ApiHubPlugin.EnablePlugin] method's
20689/// request.
20690///
20691/// [google.cloud.apihub.v1.ApiHubPlugin.EnablePlugin]: crate::client::ApiHubPlugin::enable_plugin
20692#[derive(Clone, Default, PartialEq)]
20693#[non_exhaustive]
20694pub struct EnablePluginRequest {
20695 /// Required. The name of the plugin to enable.
20696 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`.
20697 pub name: std::string::String,
20698
20699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20700}
20701
20702impl EnablePluginRequest {
20703 pub fn new() -> Self {
20704 std::default::Default::default()
20705 }
20706
20707 /// Sets the value of [name][crate::model::EnablePluginRequest::name].
20708 ///
20709 /// # Example
20710 /// ```ignore,no_run
20711 /// # use google_cloud_apihub_v1::model::EnablePluginRequest;
20712 /// let x = EnablePluginRequest::new().set_name("example");
20713 /// ```
20714 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20715 self.name = v.into();
20716 self
20717 }
20718}
20719
20720impl wkt::message::Message for EnablePluginRequest {
20721 fn typename() -> &'static str {
20722 "type.googleapis.com/google.cloud.apihub.v1.EnablePluginRequest"
20723 }
20724}
20725
20726/// The [DisablePlugin][google.cloud.apihub.v1.ApiHubPlugin.DisablePlugin]
20727/// method's request.
20728///
20729/// [google.cloud.apihub.v1.ApiHubPlugin.DisablePlugin]: crate::client::ApiHubPlugin::disable_plugin
20730#[derive(Clone, Default, PartialEq)]
20731#[non_exhaustive]
20732pub struct DisablePluginRequest {
20733 /// Required. The name of the plugin to disable.
20734 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`.
20735 pub name: std::string::String,
20736
20737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20738}
20739
20740impl DisablePluginRequest {
20741 pub fn new() -> Self {
20742 std::default::Default::default()
20743 }
20744
20745 /// Sets the value of [name][crate::model::DisablePluginRequest::name].
20746 ///
20747 /// # Example
20748 /// ```ignore,no_run
20749 /// # use google_cloud_apihub_v1::model::DisablePluginRequest;
20750 /// let x = DisablePluginRequest::new().set_name("example");
20751 /// ```
20752 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20753 self.name = v.into();
20754 self
20755 }
20756}
20757
20758impl wkt::message::Message for DisablePluginRequest {
20759 fn typename() -> &'static str {
20760 "type.googleapis.com/google.cloud.apihub.v1.DisablePluginRequest"
20761 }
20762}
20763
20764/// PluginInstanceAction represents an action which can be executed in the plugin
20765/// instance.
20766#[derive(Clone, Default, PartialEq)]
20767#[non_exhaustive]
20768pub struct PluginInstanceAction {
20769 /// Required. This should map to one of the [action
20770 /// id][google.cloud.apihub.v1.PluginActionConfig.id] specified in
20771 /// [actions_config][google.cloud.apihub.v1.Plugin.actions_config] in the
20772 /// plugin.
20773 ///
20774 /// [google.cloud.apihub.v1.Plugin.actions_config]: crate::model::Plugin::actions_config
20775 /// [google.cloud.apihub.v1.PluginActionConfig.id]: crate::model::PluginActionConfig::id
20776 pub action_id: std::string::String,
20777
20778 /// Output only. The current state of the plugin action in the plugin instance.
20779 pub state: crate::model::plugin_instance_action::State,
20780
20781 /// Optional. The schedule for this plugin instance action. This can only be
20782 /// set if the plugin supports API_HUB_SCHEDULE_TRIGGER mode for this action.
20783 pub schedule_cron_expression: std::string::String,
20784
20785 /// Optional. This configuration should be provided if the plugin action is
20786 /// publishing data to API hub curate layer.
20787 pub curation_config: std::option::Option<crate::model::CurationConfig>,
20788
20789 /// Optional. The time zone for the schedule cron expression. If not provided,
20790 /// UTC will be used.
20791 pub schedule_time_zone: std::string::String,
20792
20793 /// Optional. The service account used to publish data. Note, the service
20794 /// account will only be accepted for non GCP plugins like OPDK.
20795 pub service_account: std::string::String,
20796
20797 /// Output only. The configuration of resources created for a given plugin
20798 /// instance action. Note these will be returned only in case of Non-GCP
20799 /// plugins like OPDK.
20800 pub resource_config: std::option::Option<crate::model::plugin_instance_action::ResourceConfig>,
20801
20802 /// The status of the plugin action.
20803 pub action_status: std::option::Option<crate::model::plugin_instance_action::ActionStatus>,
20804
20805 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20806}
20807
20808impl PluginInstanceAction {
20809 pub fn new() -> Self {
20810 std::default::Default::default()
20811 }
20812
20813 /// Sets the value of [action_id][crate::model::PluginInstanceAction::action_id].
20814 ///
20815 /// # Example
20816 /// ```ignore,no_run
20817 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20818 /// let x = PluginInstanceAction::new().set_action_id("example");
20819 /// ```
20820 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20821 self.action_id = v.into();
20822 self
20823 }
20824
20825 /// Sets the value of [state][crate::model::PluginInstanceAction::state].
20826 ///
20827 /// # Example
20828 /// ```ignore,no_run
20829 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20830 /// use google_cloud_apihub_v1::model::plugin_instance_action::State;
20831 /// let x0 = PluginInstanceAction::new().set_state(State::Enabled);
20832 /// let x1 = PluginInstanceAction::new().set_state(State::Disabled);
20833 /// let x2 = PluginInstanceAction::new().set_state(State::Enabling);
20834 /// ```
20835 pub fn set_state<T: std::convert::Into<crate::model::plugin_instance_action::State>>(
20836 mut self,
20837 v: T,
20838 ) -> Self {
20839 self.state = v.into();
20840 self
20841 }
20842
20843 /// Sets the value of [schedule_cron_expression][crate::model::PluginInstanceAction::schedule_cron_expression].
20844 ///
20845 /// # Example
20846 /// ```ignore,no_run
20847 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20848 /// let x = PluginInstanceAction::new().set_schedule_cron_expression("example");
20849 /// ```
20850 pub fn set_schedule_cron_expression<T: std::convert::Into<std::string::String>>(
20851 mut self,
20852 v: T,
20853 ) -> Self {
20854 self.schedule_cron_expression = v.into();
20855 self
20856 }
20857
20858 /// Sets the value of [curation_config][crate::model::PluginInstanceAction::curation_config].
20859 ///
20860 /// # Example
20861 /// ```ignore,no_run
20862 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20863 /// use google_cloud_apihub_v1::model::CurationConfig;
20864 /// let x = PluginInstanceAction::new().set_curation_config(CurationConfig::default()/* use setters */);
20865 /// ```
20866 pub fn set_curation_config<T>(mut self, v: T) -> Self
20867 where
20868 T: std::convert::Into<crate::model::CurationConfig>,
20869 {
20870 self.curation_config = std::option::Option::Some(v.into());
20871 self
20872 }
20873
20874 /// Sets or clears the value of [curation_config][crate::model::PluginInstanceAction::curation_config].
20875 ///
20876 /// # Example
20877 /// ```ignore,no_run
20878 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20879 /// use google_cloud_apihub_v1::model::CurationConfig;
20880 /// let x = PluginInstanceAction::new().set_or_clear_curation_config(Some(CurationConfig::default()/* use setters */));
20881 /// let x = PluginInstanceAction::new().set_or_clear_curation_config(None::<CurationConfig>);
20882 /// ```
20883 pub fn set_or_clear_curation_config<T>(mut self, v: std::option::Option<T>) -> Self
20884 where
20885 T: std::convert::Into<crate::model::CurationConfig>,
20886 {
20887 self.curation_config = v.map(|x| x.into());
20888 self
20889 }
20890
20891 /// Sets the value of [schedule_time_zone][crate::model::PluginInstanceAction::schedule_time_zone].
20892 ///
20893 /// # Example
20894 /// ```ignore,no_run
20895 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20896 /// let x = PluginInstanceAction::new().set_schedule_time_zone("example");
20897 /// ```
20898 pub fn set_schedule_time_zone<T: std::convert::Into<std::string::String>>(
20899 mut self,
20900 v: T,
20901 ) -> Self {
20902 self.schedule_time_zone = v.into();
20903 self
20904 }
20905
20906 /// Sets the value of [service_account][crate::model::PluginInstanceAction::service_account].
20907 ///
20908 /// # Example
20909 /// ```ignore,no_run
20910 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20911 /// let x = PluginInstanceAction::new().set_service_account("example");
20912 /// ```
20913 pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20914 self.service_account = v.into();
20915 self
20916 }
20917
20918 /// Sets the value of [resource_config][crate::model::PluginInstanceAction::resource_config].
20919 ///
20920 /// # Example
20921 /// ```ignore,no_run
20922 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20923 /// use google_cloud_apihub_v1::model::plugin_instance_action::ResourceConfig;
20924 /// let x = PluginInstanceAction::new().set_resource_config(ResourceConfig::default()/* use setters */);
20925 /// ```
20926 pub fn set_resource_config<T>(mut self, v: T) -> Self
20927 where
20928 T: std::convert::Into<crate::model::plugin_instance_action::ResourceConfig>,
20929 {
20930 self.resource_config = std::option::Option::Some(v.into());
20931 self
20932 }
20933
20934 /// Sets or clears the value of [resource_config][crate::model::PluginInstanceAction::resource_config].
20935 ///
20936 /// # Example
20937 /// ```ignore,no_run
20938 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20939 /// use google_cloud_apihub_v1::model::plugin_instance_action::ResourceConfig;
20940 /// let x = PluginInstanceAction::new().set_or_clear_resource_config(Some(ResourceConfig::default()/* use setters */));
20941 /// let x = PluginInstanceAction::new().set_or_clear_resource_config(None::<ResourceConfig>);
20942 /// ```
20943 pub fn set_or_clear_resource_config<T>(mut self, v: std::option::Option<T>) -> Self
20944 where
20945 T: std::convert::Into<crate::model::plugin_instance_action::ResourceConfig>,
20946 {
20947 self.resource_config = v.map(|x| x.into());
20948 self
20949 }
20950
20951 /// Sets the value of [action_status][crate::model::PluginInstanceAction::action_status].
20952 ///
20953 /// Note that all the setters affecting `action_status` are mutually
20954 /// exclusive.
20955 ///
20956 /// # Example
20957 /// ```ignore,no_run
20958 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20959 /// use google_cloud_apihub_v1::model::ExecutionStatus;
20960 /// let x = PluginInstanceAction::new().set_action_status(Some(
20961 /// google_cloud_apihub_v1::model::plugin_instance_action::ActionStatus::HubInstanceAction(ExecutionStatus::default().into())));
20962 /// ```
20963 pub fn set_action_status<
20964 T: std::convert::Into<std::option::Option<crate::model::plugin_instance_action::ActionStatus>>,
20965 >(
20966 mut self,
20967 v: T,
20968 ) -> Self {
20969 self.action_status = v.into();
20970 self
20971 }
20972
20973 /// The value of [action_status][crate::model::PluginInstanceAction::action_status]
20974 /// if it holds a `HubInstanceAction`, `None` if the field is not set or
20975 /// holds a different branch.
20976 pub fn hub_instance_action(
20977 &self,
20978 ) -> std::option::Option<&std::boxed::Box<crate::model::ExecutionStatus>> {
20979 #[allow(unreachable_patterns)]
20980 self.action_status.as_ref().and_then(|v| match v {
20981 crate::model::plugin_instance_action::ActionStatus::HubInstanceAction(v) => {
20982 std::option::Option::Some(v)
20983 }
20984 _ => std::option::Option::None,
20985 })
20986 }
20987
20988 /// Sets the value of [action_status][crate::model::PluginInstanceAction::action_status]
20989 /// to hold a `HubInstanceAction`.
20990 ///
20991 /// Note that all the setters affecting `action_status` are
20992 /// mutually exclusive.
20993 ///
20994 /// # Example
20995 /// ```ignore,no_run
20996 /// # use google_cloud_apihub_v1::model::PluginInstanceAction;
20997 /// use google_cloud_apihub_v1::model::ExecutionStatus;
20998 /// let x = PluginInstanceAction::new().set_hub_instance_action(ExecutionStatus::default()/* use setters */);
20999 /// assert!(x.hub_instance_action().is_some());
21000 /// ```
21001 pub fn set_hub_instance_action<
21002 T: std::convert::Into<std::boxed::Box<crate::model::ExecutionStatus>>,
21003 >(
21004 mut self,
21005 v: T,
21006 ) -> Self {
21007 self.action_status = std::option::Option::Some(
21008 crate::model::plugin_instance_action::ActionStatus::HubInstanceAction(v.into()),
21009 );
21010 self
21011 }
21012}
21013
21014impl wkt::message::Message for PluginInstanceAction {
21015 fn typename() -> &'static str {
21016 "type.googleapis.com/google.cloud.apihub.v1.PluginInstanceAction"
21017 }
21018}
21019
21020/// Defines additional types related to [PluginInstanceAction].
21021pub mod plugin_instance_action {
21022 #[allow(unused_imports)]
21023 use super::*;
21024
21025 /// The configuration of resources created for a given plugin instance action.
21026 #[derive(Clone, Default, PartialEq)]
21027 #[non_exhaustive]
21028 pub struct ResourceConfig {
21029 /// Output only. The type of the action.
21030 pub action_type: crate::model::ActionType,
21031
21032 /// Output only. The pubsub topic to publish the data to. Format is
21033 /// projects/{project}/topics/{topic}
21034 pub pubsub_topic: std::string::String,
21035
21036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21037 }
21038
21039 impl ResourceConfig {
21040 pub fn new() -> Self {
21041 std::default::Default::default()
21042 }
21043
21044 /// Sets the value of [action_type][crate::model::plugin_instance_action::ResourceConfig::action_type].
21045 ///
21046 /// # Example
21047 /// ```ignore,no_run
21048 /// # use google_cloud_apihub_v1::model::plugin_instance_action::ResourceConfig;
21049 /// use google_cloud_apihub_v1::model::ActionType;
21050 /// let x0 = ResourceConfig::new().set_action_type(ActionType::SyncMetadata);
21051 /// let x1 = ResourceConfig::new().set_action_type(ActionType::SyncRuntimeData);
21052 /// ```
21053 pub fn set_action_type<T: std::convert::Into<crate::model::ActionType>>(
21054 mut self,
21055 v: T,
21056 ) -> Self {
21057 self.action_type = v.into();
21058 self
21059 }
21060
21061 /// Sets the value of [pubsub_topic][crate::model::plugin_instance_action::ResourceConfig::pubsub_topic].
21062 ///
21063 /// # Example
21064 /// ```ignore,no_run
21065 /// # use google_cloud_apihub_v1::model::plugin_instance_action::ResourceConfig;
21066 /// let x = ResourceConfig::new().set_pubsub_topic("example");
21067 /// ```
21068 pub fn set_pubsub_topic<T: std::convert::Into<std::string::String>>(
21069 mut self,
21070 v: T,
21071 ) -> Self {
21072 self.pubsub_topic = v.into();
21073 self
21074 }
21075 }
21076
21077 impl wkt::message::Message for ResourceConfig {
21078 fn typename() -> &'static str {
21079 "type.googleapis.com/google.cloud.apihub.v1.PluginInstanceAction.ResourceConfig"
21080 }
21081 }
21082
21083 /// State represents the state of the plugin instance action.
21084 ///
21085 /// # Working with unknown values
21086 ///
21087 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21088 /// additional enum variants at any time. Adding new variants is not considered
21089 /// a breaking change. Applications should write their code in anticipation of:
21090 ///
21091 /// - New values appearing in future releases of the client library, **and**
21092 /// - New values received dynamically, without application changes.
21093 ///
21094 /// Please consult the [Working with enums] section in the user guide for some
21095 /// guidelines.
21096 ///
21097 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21098 #[derive(Clone, Debug, PartialEq)]
21099 #[non_exhaustive]
21100 pub enum State {
21101 /// Default unspecified state.
21102 Unspecified,
21103 /// The action is enabled in the plugin instance i.e., executions can
21104 /// be triggered for this action.
21105 Enabled,
21106 /// The action is disabled in the plugin instance i.e., no executions
21107 /// can be triggered for this action. This state indicates that the user
21108 /// explicitly disabled the instance, and no further action is needed unless
21109 /// the user wants to re-enable it.
21110 Disabled,
21111 /// The action in the plugin instance is being enabled.
21112 Enabling,
21113 /// The action in the plugin instance is being disabled.
21114 Disabling,
21115 /// The ERROR state can come while enabling/disabling plugin instance action.
21116 /// Users can retrigger enable, disable via
21117 /// [EnablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]
21118 /// and
21119 /// [DisablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]
21120 /// to restore the action back to enabled/disabled state. Note enable/disable
21121 /// on actions can only be triggered if plugin instance is in Active state.
21122 ///
21123 /// [google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]: crate::client::ApiHubPlugin::disable_plugin_instance_action
21124 /// [google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]: crate::client::ApiHubPlugin::enable_plugin_instance_action
21125 Error,
21126 /// If set, the enum was initialized with an unknown value.
21127 ///
21128 /// Applications can examine the value using [State::value] or
21129 /// [State::name].
21130 UnknownValue(state::UnknownValue),
21131 }
21132
21133 #[doc(hidden)]
21134 pub mod state {
21135 #[allow(unused_imports)]
21136 use super::*;
21137 #[derive(Clone, Debug, PartialEq)]
21138 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21139 }
21140
21141 impl State {
21142 /// Gets the enum value.
21143 ///
21144 /// Returns `None` if the enum contains an unknown value deserialized from
21145 /// the string representation of enums.
21146 pub fn value(&self) -> std::option::Option<i32> {
21147 match self {
21148 Self::Unspecified => std::option::Option::Some(0),
21149 Self::Enabled => std::option::Option::Some(1),
21150 Self::Disabled => std::option::Option::Some(2),
21151 Self::Enabling => std::option::Option::Some(3),
21152 Self::Disabling => std::option::Option::Some(4),
21153 Self::Error => std::option::Option::Some(5),
21154 Self::UnknownValue(u) => u.0.value(),
21155 }
21156 }
21157
21158 /// Gets the enum value as a string.
21159 ///
21160 /// Returns `None` if the enum contains an unknown value deserialized from
21161 /// the integer representation of enums.
21162 pub fn name(&self) -> std::option::Option<&str> {
21163 match self {
21164 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
21165 Self::Enabled => std::option::Option::Some("ENABLED"),
21166 Self::Disabled => std::option::Option::Some("DISABLED"),
21167 Self::Enabling => std::option::Option::Some("ENABLING"),
21168 Self::Disabling => std::option::Option::Some("DISABLING"),
21169 Self::Error => std::option::Option::Some("ERROR"),
21170 Self::UnknownValue(u) => u.0.name(),
21171 }
21172 }
21173 }
21174
21175 impl std::default::Default for State {
21176 fn default() -> Self {
21177 use std::convert::From;
21178 Self::from(0)
21179 }
21180 }
21181
21182 impl std::fmt::Display for State {
21183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21184 wkt::internal::display_enum(f, self.name(), self.value())
21185 }
21186 }
21187
21188 impl std::convert::From<i32> for State {
21189 fn from(value: i32) -> Self {
21190 match value {
21191 0 => Self::Unspecified,
21192 1 => Self::Enabled,
21193 2 => Self::Disabled,
21194 3 => Self::Enabling,
21195 4 => Self::Disabling,
21196 5 => Self::Error,
21197 _ => Self::UnknownValue(state::UnknownValue(
21198 wkt::internal::UnknownEnumValue::Integer(value),
21199 )),
21200 }
21201 }
21202 }
21203
21204 impl std::convert::From<&str> for State {
21205 fn from(value: &str) -> Self {
21206 use std::string::ToString;
21207 match value {
21208 "STATE_UNSPECIFIED" => Self::Unspecified,
21209 "ENABLED" => Self::Enabled,
21210 "DISABLED" => Self::Disabled,
21211 "ENABLING" => Self::Enabling,
21212 "DISABLING" => Self::Disabling,
21213 "ERROR" => Self::Error,
21214 _ => Self::UnknownValue(state::UnknownValue(
21215 wkt::internal::UnknownEnumValue::String(value.to_string()),
21216 )),
21217 }
21218 }
21219 }
21220
21221 impl serde::ser::Serialize for State {
21222 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21223 where
21224 S: serde::Serializer,
21225 {
21226 match self {
21227 Self::Unspecified => serializer.serialize_i32(0),
21228 Self::Enabled => serializer.serialize_i32(1),
21229 Self::Disabled => serializer.serialize_i32(2),
21230 Self::Enabling => serializer.serialize_i32(3),
21231 Self::Disabling => serializer.serialize_i32(4),
21232 Self::Error => serializer.serialize_i32(5),
21233 Self::UnknownValue(u) => u.0.serialize(serializer),
21234 }
21235 }
21236 }
21237
21238 impl<'de> serde::de::Deserialize<'de> for State {
21239 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21240 where
21241 D: serde::Deserializer<'de>,
21242 {
21243 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
21244 ".google.cloud.apihub.v1.PluginInstanceAction.State",
21245 ))
21246 }
21247 }
21248
21249 /// The status of the plugin action.
21250 #[derive(Clone, Debug, PartialEq)]
21251 #[non_exhaustive]
21252 pub enum ActionStatus {
21253 /// Optional. The execution information for the plugin instance action done
21254 /// corresponding to an API hub instance.
21255 HubInstanceAction(std::boxed::Box<crate::model::ExecutionStatus>),
21256 }
21257}
21258
21259/// Represents a plugin instance resource in the API Hub.
21260/// A PluginInstance is a specific instance of a hub plugin with its own
21261/// configuration, state, and execution details.
21262#[derive(Clone, Default, PartialEq)]
21263#[non_exhaustive]
21264pub struct PluginInstance {
21265 /// Identifier. The unique name of the plugin instance resource.
21266 /// Format:
21267 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
21268 pub name: std::string::String,
21269
21270 /// Required. The display name for this plugin instance. Max length is 255
21271 /// characters.
21272 pub display_name: std::string::String,
21273
21274 /// Optional. The authentication information for this plugin instance.
21275 pub auth_config: std::option::Option<crate::model::AuthConfig>,
21276
21277 /// Optional. The additional information for this plugin instance corresponding
21278 /// to the additional config template of the plugin. This information will be
21279 /// sent to plugin hosting service on each call to plugin hosted service. The
21280 /// key will be the config_variable_template.display_name to uniquely identify
21281 /// the config variable.
21282 pub additional_config:
21283 std::collections::HashMap<std::string::String, crate::model::ConfigVariable>,
21284
21285 /// Output only. The current state of the plugin instance (e.g., enabled,
21286 /// disabled, provisioning).
21287 pub state: crate::model::plugin_instance::State,
21288
21289 /// Output only. Error message describing the failure, if any, during Create,
21290 /// Delete or ApplyConfig operation corresponding to the plugin instance.This
21291 /// field will only be populated if the plugin instance is in the ERROR or
21292 /// FAILED state.
21293 pub error_message: std::string::String,
21294
21295 /// Required. The action status for the plugin instance.
21296 pub actions: std::vec::Vec<crate::model::PluginInstanceAction>,
21297
21298 /// Output only. Timestamp indicating when the plugin instance was created.
21299 pub create_time: std::option::Option<wkt::Timestamp>,
21300
21301 /// Output only. Timestamp indicating when the plugin instance was last
21302 /// updated.
21303 pub update_time: std::option::Option<wkt::Timestamp>,
21304
21305 /// Optional. The source project id of the plugin instance. This will be the id
21306 /// of runtime project in case of gcp based plugins and org id in case of non
21307 /// gcp based plugins. This field will be a required field for Google provided
21308 /// on-ramp plugins.
21309 pub source_project_id: std::string::String,
21310
21311 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21312}
21313
21314impl PluginInstance {
21315 pub fn new() -> Self {
21316 std::default::Default::default()
21317 }
21318
21319 /// Sets the value of [name][crate::model::PluginInstance::name].
21320 ///
21321 /// # Example
21322 /// ```ignore,no_run
21323 /// # use google_cloud_apihub_v1::model::PluginInstance;
21324 /// let x = PluginInstance::new().set_name("example");
21325 /// ```
21326 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21327 self.name = v.into();
21328 self
21329 }
21330
21331 /// Sets the value of [display_name][crate::model::PluginInstance::display_name].
21332 ///
21333 /// # Example
21334 /// ```ignore,no_run
21335 /// # use google_cloud_apihub_v1::model::PluginInstance;
21336 /// let x = PluginInstance::new().set_display_name("example");
21337 /// ```
21338 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21339 self.display_name = v.into();
21340 self
21341 }
21342
21343 /// Sets the value of [auth_config][crate::model::PluginInstance::auth_config].
21344 ///
21345 /// # Example
21346 /// ```ignore,no_run
21347 /// # use google_cloud_apihub_v1::model::PluginInstance;
21348 /// use google_cloud_apihub_v1::model::AuthConfig;
21349 /// let x = PluginInstance::new().set_auth_config(AuthConfig::default()/* use setters */);
21350 /// ```
21351 pub fn set_auth_config<T>(mut self, v: T) -> Self
21352 where
21353 T: std::convert::Into<crate::model::AuthConfig>,
21354 {
21355 self.auth_config = std::option::Option::Some(v.into());
21356 self
21357 }
21358
21359 /// Sets or clears the value of [auth_config][crate::model::PluginInstance::auth_config].
21360 ///
21361 /// # Example
21362 /// ```ignore,no_run
21363 /// # use google_cloud_apihub_v1::model::PluginInstance;
21364 /// use google_cloud_apihub_v1::model::AuthConfig;
21365 /// let x = PluginInstance::new().set_or_clear_auth_config(Some(AuthConfig::default()/* use setters */));
21366 /// let x = PluginInstance::new().set_or_clear_auth_config(None::<AuthConfig>);
21367 /// ```
21368 pub fn set_or_clear_auth_config<T>(mut self, v: std::option::Option<T>) -> Self
21369 where
21370 T: std::convert::Into<crate::model::AuthConfig>,
21371 {
21372 self.auth_config = v.map(|x| x.into());
21373 self
21374 }
21375
21376 /// Sets the value of [additional_config][crate::model::PluginInstance::additional_config].
21377 ///
21378 /// # Example
21379 /// ```ignore,no_run
21380 /// # use google_cloud_apihub_v1::model::PluginInstance;
21381 /// use google_cloud_apihub_v1::model::ConfigVariable;
21382 /// let x = PluginInstance::new().set_additional_config([
21383 /// ("key0", ConfigVariable::default()/* use setters */),
21384 /// ("key1", ConfigVariable::default()/* use (different) setters */),
21385 /// ]);
21386 /// ```
21387 pub fn set_additional_config<T, K, V>(mut self, v: T) -> Self
21388 where
21389 T: std::iter::IntoIterator<Item = (K, V)>,
21390 K: std::convert::Into<std::string::String>,
21391 V: std::convert::Into<crate::model::ConfigVariable>,
21392 {
21393 use std::iter::Iterator;
21394 self.additional_config = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21395 self
21396 }
21397
21398 /// Sets the value of [state][crate::model::PluginInstance::state].
21399 ///
21400 /// # Example
21401 /// ```ignore,no_run
21402 /// # use google_cloud_apihub_v1::model::PluginInstance;
21403 /// use google_cloud_apihub_v1::model::plugin_instance::State;
21404 /// let x0 = PluginInstance::new().set_state(State::Creating);
21405 /// let x1 = PluginInstance::new().set_state(State::Active);
21406 /// let x2 = PluginInstance::new().set_state(State::ApplyingConfig);
21407 /// ```
21408 pub fn set_state<T: std::convert::Into<crate::model::plugin_instance::State>>(
21409 mut self,
21410 v: T,
21411 ) -> Self {
21412 self.state = v.into();
21413 self
21414 }
21415
21416 /// Sets the value of [error_message][crate::model::PluginInstance::error_message].
21417 ///
21418 /// # Example
21419 /// ```ignore,no_run
21420 /// # use google_cloud_apihub_v1::model::PluginInstance;
21421 /// let x = PluginInstance::new().set_error_message("example");
21422 /// ```
21423 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21424 self.error_message = v.into();
21425 self
21426 }
21427
21428 /// Sets the value of [actions][crate::model::PluginInstance::actions].
21429 ///
21430 /// # Example
21431 /// ```ignore,no_run
21432 /// # use google_cloud_apihub_v1::model::PluginInstance;
21433 /// use google_cloud_apihub_v1::model::PluginInstanceAction;
21434 /// let x = PluginInstance::new()
21435 /// .set_actions([
21436 /// PluginInstanceAction::default()/* use setters */,
21437 /// PluginInstanceAction::default()/* use (different) setters */,
21438 /// ]);
21439 /// ```
21440 pub fn set_actions<T, V>(mut self, v: T) -> Self
21441 where
21442 T: std::iter::IntoIterator<Item = V>,
21443 V: std::convert::Into<crate::model::PluginInstanceAction>,
21444 {
21445 use std::iter::Iterator;
21446 self.actions = v.into_iter().map(|i| i.into()).collect();
21447 self
21448 }
21449
21450 /// Sets the value of [create_time][crate::model::PluginInstance::create_time].
21451 ///
21452 /// # Example
21453 /// ```ignore,no_run
21454 /// # use google_cloud_apihub_v1::model::PluginInstance;
21455 /// use wkt::Timestamp;
21456 /// let x = PluginInstance::new().set_create_time(Timestamp::default()/* use setters */);
21457 /// ```
21458 pub fn set_create_time<T>(mut self, v: T) -> Self
21459 where
21460 T: std::convert::Into<wkt::Timestamp>,
21461 {
21462 self.create_time = std::option::Option::Some(v.into());
21463 self
21464 }
21465
21466 /// Sets or clears the value of [create_time][crate::model::PluginInstance::create_time].
21467 ///
21468 /// # Example
21469 /// ```ignore,no_run
21470 /// # use google_cloud_apihub_v1::model::PluginInstance;
21471 /// use wkt::Timestamp;
21472 /// let x = PluginInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
21473 /// let x = PluginInstance::new().set_or_clear_create_time(None::<Timestamp>);
21474 /// ```
21475 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
21476 where
21477 T: std::convert::Into<wkt::Timestamp>,
21478 {
21479 self.create_time = v.map(|x| x.into());
21480 self
21481 }
21482
21483 /// Sets the value of [update_time][crate::model::PluginInstance::update_time].
21484 ///
21485 /// # Example
21486 /// ```ignore,no_run
21487 /// # use google_cloud_apihub_v1::model::PluginInstance;
21488 /// use wkt::Timestamp;
21489 /// let x = PluginInstance::new().set_update_time(Timestamp::default()/* use setters */);
21490 /// ```
21491 pub fn set_update_time<T>(mut self, v: T) -> Self
21492 where
21493 T: std::convert::Into<wkt::Timestamp>,
21494 {
21495 self.update_time = std::option::Option::Some(v.into());
21496 self
21497 }
21498
21499 /// Sets or clears the value of [update_time][crate::model::PluginInstance::update_time].
21500 ///
21501 /// # Example
21502 /// ```ignore,no_run
21503 /// # use google_cloud_apihub_v1::model::PluginInstance;
21504 /// use wkt::Timestamp;
21505 /// let x = PluginInstance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
21506 /// let x = PluginInstance::new().set_or_clear_update_time(None::<Timestamp>);
21507 /// ```
21508 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
21509 where
21510 T: std::convert::Into<wkt::Timestamp>,
21511 {
21512 self.update_time = v.map(|x| x.into());
21513 self
21514 }
21515
21516 /// Sets the value of [source_project_id][crate::model::PluginInstance::source_project_id].
21517 ///
21518 /// # Example
21519 /// ```ignore,no_run
21520 /// # use google_cloud_apihub_v1::model::PluginInstance;
21521 /// let x = PluginInstance::new().set_source_project_id("example");
21522 /// ```
21523 pub fn set_source_project_id<T: std::convert::Into<std::string::String>>(
21524 mut self,
21525 v: T,
21526 ) -> Self {
21527 self.source_project_id = v.into();
21528 self
21529 }
21530}
21531
21532impl wkt::message::Message for PluginInstance {
21533 fn typename() -> &'static str {
21534 "type.googleapis.com/google.cloud.apihub.v1.PluginInstance"
21535 }
21536}
21537
21538/// Defines additional types related to [PluginInstance].
21539pub mod plugin_instance {
21540 #[allow(unused_imports)]
21541 use super::*;
21542
21543 /// State represents the state of the plugin instance.
21544 ///
21545 /// # Working with unknown values
21546 ///
21547 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21548 /// additional enum variants at any time. Adding new variants is not considered
21549 /// a breaking change. Applications should write their code in anticipation of:
21550 ///
21551 /// - New values appearing in future releases of the client library, **and**
21552 /// - New values received dynamically, without application changes.
21553 ///
21554 /// Please consult the [Working with enums] section in the user guide for some
21555 /// guidelines.
21556 ///
21557 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21558 #[derive(Clone, Debug, PartialEq)]
21559 #[non_exhaustive]
21560 pub enum State {
21561 /// Default unspecified state.
21562 Unspecified,
21563 /// The plugin instance is being created.
21564 Creating,
21565 /// The plugin instance is active and ready for executions. This is the only
21566 /// state where executions can run on the plugin instance.
21567 Active,
21568 /// The updated config that contains
21569 /// [additional_config][google.cloud.apihub.v1.PluginInstance.additional_config]
21570 /// and [auth_config][google.cloud.apihub.v1.PluginInstance.auth_config] is
21571 /// being applied.
21572 ///
21573 /// [google.cloud.apihub.v1.PluginInstance.additional_config]: crate::model::PluginInstance::additional_config
21574 /// [google.cloud.apihub.v1.PluginInstance.auth_config]: crate::model::PluginInstance::auth_config
21575 ApplyingConfig,
21576 /// The ERROR state can come while applying config. Users
21577 /// can retrigger
21578 /// [ApplyPluginInstanceConfig][google.cloud.apihub.v1.ApiHubPlugin.ApplyPluginInstanceConfig]
21579 /// to restore the plugin instance back to active state. Note, In case the
21580 /// ERROR state happens while applying config (auth_config,
21581 /// additional_config), the plugin instance will reflect the config which was
21582 /// trying to be applied while error happened. In order to overwrite, trigger
21583 /// ApplyConfig with a new config.
21584 Error,
21585 /// The plugin instance is in a failed state. This indicates that an
21586 /// unrecoverable error occurred during a previous operation (Create,
21587 /// Delete).
21588 Failed,
21589 /// The plugin instance is being deleted. Delete is only possible if there is
21590 /// no other operation running on the plugin instance and plugin instance
21591 /// action.
21592 Deleting,
21593 /// If set, the enum was initialized with an unknown value.
21594 ///
21595 /// Applications can examine the value using [State::value] or
21596 /// [State::name].
21597 UnknownValue(state::UnknownValue),
21598 }
21599
21600 #[doc(hidden)]
21601 pub mod state {
21602 #[allow(unused_imports)]
21603 use super::*;
21604 #[derive(Clone, Debug, PartialEq)]
21605 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21606 }
21607
21608 impl State {
21609 /// Gets the enum value.
21610 ///
21611 /// Returns `None` if the enum contains an unknown value deserialized from
21612 /// the string representation of enums.
21613 pub fn value(&self) -> std::option::Option<i32> {
21614 match self {
21615 Self::Unspecified => std::option::Option::Some(0),
21616 Self::Creating => std::option::Option::Some(1),
21617 Self::Active => std::option::Option::Some(2),
21618 Self::ApplyingConfig => std::option::Option::Some(3),
21619 Self::Error => std::option::Option::Some(4),
21620 Self::Failed => std::option::Option::Some(5),
21621 Self::Deleting => std::option::Option::Some(6),
21622 Self::UnknownValue(u) => u.0.value(),
21623 }
21624 }
21625
21626 /// Gets the enum value as a string.
21627 ///
21628 /// Returns `None` if the enum contains an unknown value deserialized from
21629 /// the integer representation of enums.
21630 pub fn name(&self) -> std::option::Option<&str> {
21631 match self {
21632 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
21633 Self::Creating => std::option::Option::Some("CREATING"),
21634 Self::Active => std::option::Option::Some("ACTIVE"),
21635 Self::ApplyingConfig => std::option::Option::Some("APPLYING_CONFIG"),
21636 Self::Error => std::option::Option::Some("ERROR"),
21637 Self::Failed => std::option::Option::Some("FAILED"),
21638 Self::Deleting => std::option::Option::Some("DELETING"),
21639 Self::UnknownValue(u) => u.0.name(),
21640 }
21641 }
21642 }
21643
21644 impl std::default::Default for State {
21645 fn default() -> Self {
21646 use std::convert::From;
21647 Self::from(0)
21648 }
21649 }
21650
21651 impl std::fmt::Display for State {
21652 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
21653 wkt::internal::display_enum(f, self.name(), self.value())
21654 }
21655 }
21656
21657 impl std::convert::From<i32> for State {
21658 fn from(value: i32) -> Self {
21659 match value {
21660 0 => Self::Unspecified,
21661 1 => Self::Creating,
21662 2 => Self::Active,
21663 3 => Self::ApplyingConfig,
21664 4 => Self::Error,
21665 5 => Self::Failed,
21666 6 => Self::Deleting,
21667 _ => Self::UnknownValue(state::UnknownValue(
21668 wkt::internal::UnknownEnumValue::Integer(value),
21669 )),
21670 }
21671 }
21672 }
21673
21674 impl std::convert::From<&str> for State {
21675 fn from(value: &str) -> Self {
21676 use std::string::ToString;
21677 match value {
21678 "STATE_UNSPECIFIED" => Self::Unspecified,
21679 "CREATING" => Self::Creating,
21680 "ACTIVE" => Self::Active,
21681 "APPLYING_CONFIG" => Self::ApplyingConfig,
21682 "ERROR" => Self::Error,
21683 "FAILED" => Self::Failed,
21684 "DELETING" => Self::Deleting,
21685 _ => Self::UnknownValue(state::UnknownValue(
21686 wkt::internal::UnknownEnumValue::String(value.to_string()),
21687 )),
21688 }
21689 }
21690 }
21691
21692 impl serde::ser::Serialize for State {
21693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21694 where
21695 S: serde::Serializer,
21696 {
21697 match self {
21698 Self::Unspecified => serializer.serialize_i32(0),
21699 Self::Creating => serializer.serialize_i32(1),
21700 Self::Active => serializer.serialize_i32(2),
21701 Self::ApplyingConfig => serializer.serialize_i32(3),
21702 Self::Error => serializer.serialize_i32(4),
21703 Self::Failed => serializer.serialize_i32(5),
21704 Self::Deleting => serializer.serialize_i32(6),
21705 Self::UnknownValue(u) => u.0.serialize(serializer),
21706 }
21707 }
21708 }
21709
21710 impl<'de> serde::de::Deserialize<'de> for State {
21711 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21712 where
21713 D: serde::Deserializer<'de>,
21714 {
21715 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
21716 ".google.cloud.apihub.v1.PluginInstance.State",
21717 ))
21718 }
21719 }
21720}
21721
21722/// The curation information for this plugin instance.
21723#[derive(Clone, Default, PartialEq)]
21724#[non_exhaustive]
21725pub struct CurationConfig {
21726 /// Required. The curation type for this plugin instance.
21727 pub curation_type: crate::model::CurationType,
21728
21729 /// The curation information for this plugin instance.
21730 pub curation_config: std::option::Option<crate::model::curation_config::CurationConfig>,
21731
21732 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21733}
21734
21735impl CurationConfig {
21736 pub fn new() -> Self {
21737 std::default::Default::default()
21738 }
21739
21740 /// Sets the value of [curation_type][crate::model::CurationConfig::curation_type].
21741 ///
21742 /// # Example
21743 /// ```ignore,no_run
21744 /// # use google_cloud_apihub_v1::model::CurationConfig;
21745 /// use google_cloud_apihub_v1::model::CurationType;
21746 /// let x0 = CurationConfig::new().set_curation_type(CurationType::DefaultCurationForApiMetadata);
21747 /// let x1 = CurationConfig::new().set_curation_type(CurationType::CustomCurationForApiMetadata);
21748 /// ```
21749 pub fn set_curation_type<T: std::convert::Into<crate::model::CurationType>>(
21750 mut self,
21751 v: T,
21752 ) -> Self {
21753 self.curation_type = v.into();
21754 self
21755 }
21756
21757 /// Sets the value of [curation_config][crate::model::CurationConfig::curation_config].
21758 ///
21759 /// Note that all the setters affecting `curation_config` are mutually
21760 /// exclusive.
21761 ///
21762 /// # Example
21763 /// ```ignore,no_run
21764 /// # use google_cloud_apihub_v1::model::CurationConfig;
21765 /// use google_cloud_apihub_v1::model::curation_config::CustomCuration;
21766 /// let x = CurationConfig::new().set_curation_config(Some(
21767 /// google_cloud_apihub_v1::model::curation_config::CurationConfig::CustomCuration(CustomCuration::default().into())));
21768 /// ```
21769 pub fn set_curation_config<
21770 T: std::convert::Into<std::option::Option<crate::model::curation_config::CurationConfig>>,
21771 >(
21772 mut self,
21773 v: T,
21774 ) -> Self {
21775 self.curation_config = v.into();
21776 self
21777 }
21778
21779 /// The value of [curation_config][crate::model::CurationConfig::curation_config]
21780 /// if it holds a `CustomCuration`, `None` if the field is not set or
21781 /// holds a different branch.
21782 pub fn custom_curation(
21783 &self,
21784 ) -> std::option::Option<&std::boxed::Box<crate::model::curation_config::CustomCuration>> {
21785 #[allow(unreachable_patterns)]
21786 self.curation_config.as_ref().and_then(|v| match v {
21787 crate::model::curation_config::CurationConfig::CustomCuration(v) => {
21788 std::option::Option::Some(v)
21789 }
21790 _ => std::option::Option::None,
21791 })
21792 }
21793
21794 /// Sets the value of [curation_config][crate::model::CurationConfig::curation_config]
21795 /// to hold a `CustomCuration`.
21796 ///
21797 /// Note that all the setters affecting `curation_config` are
21798 /// mutually exclusive.
21799 ///
21800 /// # Example
21801 /// ```ignore,no_run
21802 /// # use google_cloud_apihub_v1::model::CurationConfig;
21803 /// use google_cloud_apihub_v1::model::curation_config::CustomCuration;
21804 /// let x = CurationConfig::new().set_custom_curation(CustomCuration::default()/* use setters */);
21805 /// assert!(x.custom_curation().is_some());
21806 /// ```
21807 pub fn set_custom_curation<
21808 T: std::convert::Into<std::boxed::Box<crate::model::curation_config::CustomCuration>>,
21809 >(
21810 mut self,
21811 v: T,
21812 ) -> Self {
21813 self.curation_config = std::option::Option::Some(
21814 crate::model::curation_config::CurationConfig::CustomCuration(v.into()),
21815 );
21816 self
21817 }
21818}
21819
21820impl wkt::message::Message for CurationConfig {
21821 fn typename() -> &'static str {
21822 "type.googleapis.com/google.cloud.apihub.v1.CurationConfig"
21823 }
21824}
21825
21826/// Defines additional types related to [CurationConfig].
21827pub mod curation_config {
21828 #[allow(unused_imports)]
21829 use super::*;
21830
21831 /// Custom curation information for this plugin instance.
21832 #[derive(Clone, Default, PartialEq)]
21833 #[non_exhaustive]
21834 pub struct CustomCuration {
21835 /// Required. The unique name of the curation resource. This will be the name
21836 /// of the curation resource in the format:
21837 /// `projects/{project}/locations/{location}/curations/{curation}`
21838 pub curation: std::string::String,
21839
21840 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21841 }
21842
21843 impl CustomCuration {
21844 pub fn new() -> Self {
21845 std::default::Default::default()
21846 }
21847
21848 /// Sets the value of [curation][crate::model::curation_config::CustomCuration::curation].
21849 ///
21850 /// # Example
21851 /// ```ignore,no_run
21852 /// # use google_cloud_apihub_v1::model::curation_config::CustomCuration;
21853 /// let x = CustomCuration::new().set_curation("example");
21854 /// ```
21855 pub fn set_curation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21856 self.curation = v.into();
21857 self
21858 }
21859 }
21860
21861 impl wkt::message::Message for CustomCuration {
21862 fn typename() -> &'static str {
21863 "type.googleapis.com/google.cloud.apihub.v1.CurationConfig.CustomCuration"
21864 }
21865 }
21866
21867 /// The curation information for this plugin instance.
21868 #[derive(Clone, Debug, PartialEq)]
21869 #[non_exhaustive]
21870 pub enum CurationConfig {
21871 /// Optional. Custom curation information for this plugin instance.
21872 CustomCuration(std::boxed::Box<crate::model::curation_config::CustomCuration>),
21873 }
21874}
21875
21876/// The execution status for the plugin instance.
21877#[derive(Clone, Default, PartialEq)]
21878#[non_exhaustive]
21879pub struct ExecutionStatus {
21880 /// Output only. The current state of the execution.
21881 pub current_execution_state: crate::model::execution_status::CurrentExecutionState,
21882
21883 /// Output only. The last execution of the plugin instance.
21884 pub last_execution: std::option::Option<crate::model::execution_status::LastExecution>,
21885
21886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21887}
21888
21889impl ExecutionStatus {
21890 pub fn new() -> Self {
21891 std::default::Default::default()
21892 }
21893
21894 /// Sets the value of [current_execution_state][crate::model::ExecutionStatus::current_execution_state].
21895 ///
21896 /// # Example
21897 /// ```ignore,no_run
21898 /// # use google_cloud_apihub_v1::model::ExecutionStatus;
21899 /// use google_cloud_apihub_v1::model::execution_status::CurrentExecutionState;
21900 /// let x0 = ExecutionStatus::new().set_current_execution_state(CurrentExecutionState::Running);
21901 /// let x1 = ExecutionStatus::new().set_current_execution_state(CurrentExecutionState::NotRunning);
21902 /// ```
21903 pub fn set_current_execution_state<
21904 T: std::convert::Into<crate::model::execution_status::CurrentExecutionState>,
21905 >(
21906 mut self,
21907 v: T,
21908 ) -> Self {
21909 self.current_execution_state = v.into();
21910 self
21911 }
21912
21913 /// Sets the value of [last_execution][crate::model::ExecutionStatus::last_execution].
21914 ///
21915 /// # Example
21916 /// ```ignore,no_run
21917 /// # use google_cloud_apihub_v1::model::ExecutionStatus;
21918 /// use google_cloud_apihub_v1::model::execution_status::LastExecution;
21919 /// let x = ExecutionStatus::new().set_last_execution(LastExecution::default()/* use setters */);
21920 /// ```
21921 pub fn set_last_execution<T>(mut self, v: T) -> Self
21922 where
21923 T: std::convert::Into<crate::model::execution_status::LastExecution>,
21924 {
21925 self.last_execution = std::option::Option::Some(v.into());
21926 self
21927 }
21928
21929 /// Sets or clears the value of [last_execution][crate::model::ExecutionStatus::last_execution].
21930 ///
21931 /// # Example
21932 /// ```ignore,no_run
21933 /// # use google_cloud_apihub_v1::model::ExecutionStatus;
21934 /// use google_cloud_apihub_v1::model::execution_status::LastExecution;
21935 /// let x = ExecutionStatus::new().set_or_clear_last_execution(Some(LastExecution::default()/* use setters */));
21936 /// let x = ExecutionStatus::new().set_or_clear_last_execution(None::<LastExecution>);
21937 /// ```
21938 pub fn set_or_clear_last_execution<T>(mut self, v: std::option::Option<T>) -> Self
21939 where
21940 T: std::convert::Into<crate::model::execution_status::LastExecution>,
21941 {
21942 self.last_execution = v.map(|x| x.into());
21943 self
21944 }
21945}
21946
21947impl wkt::message::Message for ExecutionStatus {
21948 fn typename() -> &'static str {
21949 "type.googleapis.com/google.cloud.apihub.v1.ExecutionStatus"
21950 }
21951}
21952
21953/// Defines additional types related to [ExecutionStatus].
21954pub mod execution_status {
21955 #[allow(unused_imports)]
21956 use super::*;
21957
21958 /// The result of the last execution of the plugin instance.
21959 #[derive(Clone, Default, PartialEq)]
21960 #[non_exhaustive]
21961 pub struct LastExecution {
21962 /// Output only. The result of the last execution of the plugin instance.
21963 pub result: crate::model::execution_status::last_execution::Result,
21964
21965 /// Output only. Error message describing the failure, if any, during the
21966 /// last execution.
21967 pub error_message: std::string::String,
21968
21969 /// Output only. The last execution start time of the plugin instance.
21970 pub start_time: std::option::Option<wkt::Timestamp>,
21971
21972 /// Output only. The last execution end time of the plugin instance.
21973 pub end_time: std::option::Option<wkt::Timestamp>,
21974
21975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21976 }
21977
21978 impl LastExecution {
21979 pub fn new() -> Self {
21980 std::default::Default::default()
21981 }
21982
21983 /// Sets the value of [result][crate::model::execution_status::LastExecution::result].
21984 ///
21985 /// # Example
21986 /// ```ignore,no_run
21987 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
21988 /// use google_cloud_apihub_v1::model::execution_status::last_execution::Result;
21989 /// let x0 = LastExecution::new().set_result(Result::Succeeded);
21990 /// let x1 = LastExecution::new().set_result(Result::Failed);
21991 /// ```
21992 pub fn set_result<
21993 T: std::convert::Into<crate::model::execution_status::last_execution::Result>,
21994 >(
21995 mut self,
21996 v: T,
21997 ) -> Self {
21998 self.result = v.into();
21999 self
22000 }
22001
22002 /// Sets the value of [error_message][crate::model::execution_status::LastExecution::error_message].
22003 ///
22004 /// # Example
22005 /// ```ignore,no_run
22006 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
22007 /// let x = LastExecution::new().set_error_message("example");
22008 /// ```
22009 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
22010 mut self,
22011 v: T,
22012 ) -> Self {
22013 self.error_message = v.into();
22014 self
22015 }
22016
22017 /// Sets the value of [start_time][crate::model::execution_status::LastExecution::start_time].
22018 ///
22019 /// # Example
22020 /// ```ignore,no_run
22021 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
22022 /// use wkt::Timestamp;
22023 /// let x = LastExecution::new().set_start_time(Timestamp::default()/* use setters */);
22024 /// ```
22025 pub fn set_start_time<T>(mut self, v: T) -> Self
22026 where
22027 T: std::convert::Into<wkt::Timestamp>,
22028 {
22029 self.start_time = std::option::Option::Some(v.into());
22030 self
22031 }
22032
22033 /// Sets or clears the value of [start_time][crate::model::execution_status::LastExecution::start_time].
22034 ///
22035 /// # Example
22036 /// ```ignore,no_run
22037 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
22038 /// use wkt::Timestamp;
22039 /// let x = LastExecution::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
22040 /// let x = LastExecution::new().set_or_clear_start_time(None::<Timestamp>);
22041 /// ```
22042 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
22043 where
22044 T: std::convert::Into<wkt::Timestamp>,
22045 {
22046 self.start_time = v.map(|x| x.into());
22047 self
22048 }
22049
22050 /// Sets the value of [end_time][crate::model::execution_status::LastExecution::end_time].
22051 ///
22052 /// # Example
22053 /// ```ignore,no_run
22054 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
22055 /// use wkt::Timestamp;
22056 /// let x = LastExecution::new().set_end_time(Timestamp::default()/* use setters */);
22057 /// ```
22058 pub fn set_end_time<T>(mut self, v: T) -> Self
22059 where
22060 T: std::convert::Into<wkt::Timestamp>,
22061 {
22062 self.end_time = std::option::Option::Some(v.into());
22063 self
22064 }
22065
22066 /// Sets or clears the value of [end_time][crate::model::execution_status::LastExecution::end_time].
22067 ///
22068 /// # Example
22069 /// ```ignore,no_run
22070 /// # use google_cloud_apihub_v1::model::execution_status::LastExecution;
22071 /// use wkt::Timestamp;
22072 /// let x = LastExecution::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
22073 /// let x = LastExecution::new().set_or_clear_end_time(None::<Timestamp>);
22074 /// ```
22075 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
22076 where
22077 T: std::convert::Into<wkt::Timestamp>,
22078 {
22079 self.end_time = v.map(|x| x.into());
22080 self
22081 }
22082 }
22083
22084 impl wkt::message::Message for LastExecution {
22085 fn typename() -> &'static str {
22086 "type.googleapis.com/google.cloud.apihub.v1.ExecutionStatus.LastExecution"
22087 }
22088 }
22089
22090 /// Defines additional types related to [LastExecution].
22091 pub mod last_execution {
22092 #[allow(unused_imports)]
22093 use super::*;
22094
22095 /// Enum for the result of the last execution of the plugin instance.
22096 ///
22097 /// # Working with unknown values
22098 ///
22099 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22100 /// additional enum variants at any time. Adding new variants is not considered
22101 /// a breaking change. Applications should write their code in anticipation of:
22102 ///
22103 /// - New values appearing in future releases of the client library, **and**
22104 /// - New values received dynamically, without application changes.
22105 ///
22106 /// Please consult the [Working with enums] section in the user guide for some
22107 /// guidelines.
22108 ///
22109 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22110 #[derive(Clone, Debug, PartialEq)]
22111 #[non_exhaustive]
22112 pub enum Result {
22113 /// Default unspecified execution result.
22114 Unspecified,
22115 /// The plugin instance executed successfully.
22116 Succeeded,
22117 /// The plugin instance execution failed.
22118 Failed,
22119 /// If set, the enum was initialized with an unknown value.
22120 ///
22121 /// Applications can examine the value using [Result::value] or
22122 /// [Result::name].
22123 UnknownValue(result::UnknownValue),
22124 }
22125
22126 #[doc(hidden)]
22127 pub mod result {
22128 #[allow(unused_imports)]
22129 use super::*;
22130 #[derive(Clone, Debug, PartialEq)]
22131 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22132 }
22133
22134 impl Result {
22135 /// Gets the enum value.
22136 ///
22137 /// Returns `None` if the enum contains an unknown value deserialized from
22138 /// the string representation of enums.
22139 pub fn value(&self) -> std::option::Option<i32> {
22140 match self {
22141 Self::Unspecified => std::option::Option::Some(0),
22142 Self::Succeeded => std::option::Option::Some(1),
22143 Self::Failed => std::option::Option::Some(2),
22144 Self::UnknownValue(u) => u.0.value(),
22145 }
22146 }
22147
22148 /// Gets the enum value as a string.
22149 ///
22150 /// Returns `None` if the enum contains an unknown value deserialized from
22151 /// the integer representation of enums.
22152 pub fn name(&self) -> std::option::Option<&str> {
22153 match self {
22154 Self::Unspecified => std::option::Option::Some("RESULT_UNSPECIFIED"),
22155 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
22156 Self::Failed => std::option::Option::Some("FAILED"),
22157 Self::UnknownValue(u) => u.0.name(),
22158 }
22159 }
22160 }
22161
22162 impl std::default::Default for Result {
22163 fn default() -> Self {
22164 use std::convert::From;
22165 Self::from(0)
22166 }
22167 }
22168
22169 impl std::fmt::Display for Result {
22170 fn fmt(
22171 &self,
22172 f: &mut std::fmt::Formatter<'_>,
22173 ) -> std::result::Result<(), std::fmt::Error> {
22174 wkt::internal::display_enum(f, self.name(), self.value())
22175 }
22176 }
22177
22178 impl std::convert::From<i32> for Result {
22179 fn from(value: i32) -> Self {
22180 match value {
22181 0 => Self::Unspecified,
22182 1 => Self::Succeeded,
22183 2 => Self::Failed,
22184 _ => Self::UnknownValue(result::UnknownValue(
22185 wkt::internal::UnknownEnumValue::Integer(value),
22186 )),
22187 }
22188 }
22189 }
22190
22191 impl std::convert::From<&str> for Result {
22192 fn from(value: &str) -> Self {
22193 use std::string::ToString;
22194 match value {
22195 "RESULT_UNSPECIFIED" => Self::Unspecified,
22196 "SUCCEEDED" => Self::Succeeded,
22197 "FAILED" => Self::Failed,
22198 _ => Self::UnknownValue(result::UnknownValue(
22199 wkt::internal::UnknownEnumValue::String(value.to_string()),
22200 )),
22201 }
22202 }
22203 }
22204
22205 impl serde::ser::Serialize for Result {
22206 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22207 where
22208 S: serde::Serializer,
22209 {
22210 match self {
22211 Self::Unspecified => serializer.serialize_i32(0),
22212 Self::Succeeded => serializer.serialize_i32(1),
22213 Self::Failed => serializer.serialize_i32(2),
22214 Self::UnknownValue(u) => u.0.serialize(serializer),
22215 }
22216 }
22217 }
22218
22219 impl<'de> serde::de::Deserialize<'de> for Result {
22220 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22221 where
22222 D: serde::Deserializer<'de>,
22223 {
22224 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Result>::new(
22225 ".google.cloud.apihub.v1.ExecutionStatus.LastExecution.Result",
22226 ))
22227 }
22228 }
22229 }
22230
22231 /// Enum for the current state of the execution.
22232 ///
22233 /// # Working with unknown values
22234 ///
22235 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22236 /// additional enum variants at any time. Adding new variants is not considered
22237 /// a breaking change. Applications should write their code in anticipation of:
22238 ///
22239 /// - New values appearing in future releases of the client library, **and**
22240 /// - New values received dynamically, without application changes.
22241 ///
22242 /// Please consult the [Working with enums] section in the user guide for some
22243 /// guidelines.
22244 ///
22245 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22246 #[derive(Clone, Debug, PartialEq)]
22247 #[non_exhaustive]
22248 pub enum CurrentExecutionState {
22249 /// Default unspecified execution state.
22250 Unspecified,
22251 /// The plugin instance is executing.
22252 Running,
22253 /// The plugin instance is not running an execution.
22254 NotRunning,
22255 /// If set, the enum was initialized with an unknown value.
22256 ///
22257 /// Applications can examine the value using [CurrentExecutionState::value] or
22258 /// [CurrentExecutionState::name].
22259 UnknownValue(current_execution_state::UnknownValue),
22260 }
22261
22262 #[doc(hidden)]
22263 pub mod current_execution_state {
22264 #[allow(unused_imports)]
22265 use super::*;
22266 #[derive(Clone, Debug, PartialEq)]
22267 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22268 }
22269
22270 impl CurrentExecutionState {
22271 /// Gets the enum value.
22272 ///
22273 /// Returns `None` if the enum contains an unknown value deserialized from
22274 /// the string representation of enums.
22275 pub fn value(&self) -> std::option::Option<i32> {
22276 match self {
22277 Self::Unspecified => std::option::Option::Some(0),
22278 Self::Running => std::option::Option::Some(1),
22279 Self::NotRunning => std::option::Option::Some(2),
22280 Self::UnknownValue(u) => u.0.value(),
22281 }
22282 }
22283
22284 /// Gets the enum value as a string.
22285 ///
22286 /// Returns `None` if the enum contains an unknown value deserialized from
22287 /// the integer representation of enums.
22288 pub fn name(&self) -> std::option::Option<&str> {
22289 match self {
22290 Self::Unspecified => {
22291 std::option::Option::Some("CURRENT_EXECUTION_STATE_UNSPECIFIED")
22292 }
22293 Self::Running => std::option::Option::Some("RUNNING"),
22294 Self::NotRunning => std::option::Option::Some("NOT_RUNNING"),
22295 Self::UnknownValue(u) => u.0.name(),
22296 }
22297 }
22298 }
22299
22300 impl std::default::Default for CurrentExecutionState {
22301 fn default() -> Self {
22302 use std::convert::From;
22303 Self::from(0)
22304 }
22305 }
22306
22307 impl std::fmt::Display for CurrentExecutionState {
22308 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
22309 wkt::internal::display_enum(f, self.name(), self.value())
22310 }
22311 }
22312
22313 impl std::convert::From<i32> for CurrentExecutionState {
22314 fn from(value: i32) -> Self {
22315 match value {
22316 0 => Self::Unspecified,
22317 1 => Self::Running,
22318 2 => Self::NotRunning,
22319 _ => Self::UnknownValue(current_execution_state::UnknownValue(
22320 wkt::internal::UnknownEnumValue::Integer(value),
22321 )),
22322 }
22323 }
22324 }
22325
22326 impl std::convert::From<&str> for CurrentExecutionState {
22327 fn from(value: &str) -> Self {
22328 use std::string::ToString;
22329 match value {
22330 "CURRENT_EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
22331 "RUNNING" => Self::Running,
22332 "NOT_RUNNING" => Self::NotRunning,
22333 _ => Self::UnknownValue(current_execution_state::UnknownValue(
22334 wkt::internal::UnknownEnumValue::String(value.to_string()),
22335 )),
22336 }
22337 }
22338 }
22339
22340 impl serde::ser::Serialize for CurrentExecutionState {
22341 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22342 where
22343 S: serde::Serializer,
22344 {
22345 match self {
22346 Self::Unspecified => serializer.serialize_i32(0),
22347 Self::Running => serializer.serialize_i32(1),
22348 Self::NotRunning => serializer.serialize_i32(2),
22349 Self::UnknownValue(u) => u.0.serialize(serializer),
22350 }
22351 }
22352 }
22353
22354 impl<'de> serde::de::Deserialize<'de> for CurrentExecutionState {
22355 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22356 where
22357 D: serde::Deserializer<'de>,
22358 {
22359 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CurrentExecutionState>::new(
22360 ".google.cloud.apihub.v1.ExecutionStatus.CurrentExecutionState",
22361 ))
22362 }
22363 }
22364}
22365
22366/// The [CreatePlugin][google.cloud.apihub.v1.ApiHubPlugin.CreatePlugin] method's
22367/// request.
22368///
22369/// [google.cloud.apihub.v1.ApiHubPlugin.CreatePlugin]: crate::client::ApiHubPlugin::create_plugin
22370#[derive(Clone, Default, PartialEq)]
22371#[non_exhaustive]
22372pub struct CreatePluginRequest {
22373 /// Required. The parent resource where this plugin will be created.
22374 /// Format: `projects/{project}/locations/{location}`.
22375 pub parent: std::string::String,
22376
22377 /// Optional. The ID to use for the Plugin resource, which will become the
22378 /// final component of the Plugin's resource name. This field is optional.
22379 ///
22380 /// * If provided, the same will be used. The service will throw an error if
22381 /// the specified id is already used by another Plugin resource in the API hub
22382 /// instance.
22383 /// * If not provided, a system generated id will be used.
22384 ///
22385 /// This value should be 4-63 characters, overall resource name which will be
22386 /// of format
22387 /// `projects/{project}/locations/{location}/plugins/{plugin}`,
22388 /// its length is limited to 1000 characters and valid characters are
22389 /// /[a-z][A-Z][0-9]-_/.
22390 pub plugin_id: std::string::String,
22391
22392 /// Required. The plugin to create.
22393 pub plugin: std::option::Option<crate::model::Plugin>,
22394
22395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22396}
22397
22398impl CreatePluginRequest {
22399 pub fn new() -> Self {
22400 std::default::Default::default()
22401 }
22402
22403 /// Sets the value of [parent][crate::model::CreatePluginRequest::parent].
22404 ///
22405 /// # Example
22406 /// ```ignore,no_run
22407 /// # use google_cloud_apihub_v1::model::CreatePluginRequest;
22408 /// let x = CreatePluginRequest::new().set_parent("example");
22409 /// ```
22410 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22411 self.parent = v.into();
22412 self
22413 }
22414
22415 /// Sets the value of [plugin_id][crate::model::CreatePluginRequest::plugin_id].
22416 ///
22417 /// # Example
22418 /// ```ignore,no_run
22419 /// # use google_cloud_apihub_v1::model::CreatePluginRequest;
22420 /// let x = CreatePluginRequest::new().set_plugin_id("example");
22421 /// ```
22422 pub fn set_plugin_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22423 self.plugin_id = v.into();
22424 self
22425 }
22426
22427 /// Sets the value of [plugin][crate::model::CreatePluginRequest::plugin].
22428 ///
22429 /// # Example
22430 /// ```ignore,no_run
22431 /// # use google_cloud_apihub_v1::model::CreatePluginRequest;
22432 /// use google_cloud_apihub_v1::model::Plugin;
22433 /// let x = CreatePluginRequest::new().set_plugin(Plugin::default()/* use setters */);
22434 /// ```
22435 pub fn set_plugin<T>(mut self, v: T) -> Self
22436 where
22437 T: std::convert::Into<crate::model::Plugin>,
22438 {
22439 self.plugin = std::option::Option::Some(v.into());
22440 self
22441 }
22442
22443 /// Sets or clears the value of [plugin][crate::model::CreatePluginRequest::plugin].
22444 ///
22445 /// # Example
22446 /// ```ignore,no_run
22447 /// # use google_cloud_apihub_v1::model::CreatePluginRequest;
22448 /// use google_cloud_apihub_v1::model::Plugin;
22449 /// let x = CreatePluginRequest::new().set_or_clear_plugin(Some(Plugin::default()/* use setters */));
22450 /// let x = CreatePluginRequest::new().set_or_clear_plugin(None::<Plugin>);
22451 /// ```
22452 pub fn set_or_clear_plugin<T>(mut self, v: std::option::Option<T>) -> Self
22453 where
22454 T: std::convert::Into<crate::model::Plugin>,
22455 {
22456 self.plugin = v.map(|x| x.into());
22457 self
22458 }
22459}
22460
22461impl wkt::message::Message for CreatePluginRequest {
22462 fn typename() -> &'static str {
22463 "type.googleapis.com/google.cloud.apihub.v1.CreatePluginRequest"
22464 }
22465}
22466
22467/// The [DeletePlugin][ApiHub.DeletePlugin] method's request.
22468#[derive(Clone, Default, PartialEq)]
22469#[non_exhaustive]
22470pub struct DeletePluginRequest {
22471 /// Required. The name of the Plugin resource to delete.
22472 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`
22473 pub name: std::string::String,
22474
22475 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22476}
22477
22478impl DeletePluginRequest {
22479 pub fn new() -> Self {
22480 std::default::Default::default()
22481 }
22482
22483 /// Sets the value of [name][crate::model::DeletePluginRequest::name].
22484 ///
22485 /// # Example
22486 /// ```ignore,no_run
22487 /// # use google_cloud_apihub_v1::model::DeletePluginRequest;
22488 /// let x = DeletePluginRequest::new().set_name("example");
22489 /// ```
22490 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22491 self.name = v.into();
22492 self
22493 }
22494}
22495
22496impl wkt::message::Message for DeletePluginRequest {
22497 fn typename() -> &'static str {
22498 "type.googleapis.com/google.cloud.apihub.v1.DeletePluginRequest"
22499 }
22500}
22501
22502/// The [ListPlugins][google.cloud.apihub.v1.ApiHubPlugin.ListPlugins] method's
22503/// request.
22504///
22505/// [google.cloud.apihub.v1.ApiHubPlugin.ListPlugins]: crate::client::ApiHubPlugin::list_plugins
22506#[derive(Clone, Default, PartialEq)]
22507#[non_exhaustive]
22508pub struct ListPluginsRequest {
22509 /// Required. The parent resource where this plugin will be created.
22510 /// Format: `projects/{project}/locations/{location}`.
22511 pub parent: std::string::String,
22512
22513 /// Optional. An expression that filters the list of plugins.
22514 ///
22515 /// A filter expression consists of a field name, a comparison
22516 /// operator, and a value for filtering. The value must be a string. The
22517 /// comparison operator must be one of: `<`, `>` or
22518 /// `=`. Filters are not case sensitive.
22519 ///
22520 /// The following fields in the `Plugins` are eligible for filtering:
22521 ///
22522 /// * `plugin_category` - The category of the Plugin. Allowed
22523 /// comparison operators: `=`.
22524 ///
22525 /// Expressions are combined with either `AND` logic operator or `OR` logical
22526 /// operator but not both of them together i.e. only one of the `AND` or `OR`
22527 /// operator can be used throughout the filter string and both the operators
22528 /// cannot be used together. No other logical operators are
22529 /// supported. At most three filter fields are allowed in the filter
22530 /// string and if provided more than that then `INVALID_ARGUMENT` error is
22531 /// returned by the API.
22532 /// Here are a few examples:
22533 ///
22534 /// * `plugin_category = ON_RAMP` - The plugin is of category
22535 /// on ramp.
22536 pub filter: std::string::String,
22537
22538 /// Optional. The maximum number of hub plugins to return. The service may
22539 /// return fewer than this value. If unspecified, at most 50 hub plugins will
22540 /// be returned. The maximum value is 1000; values above 1000 will be coerced
22541 /// to 1000.
22542 pub page_size: i32,
22543
22544 /// Optional. A page token, received from a previous `ListPlugins` call.
22545 /// Provide this to retrieve the subsequent page.
22546 ///
22547 /// When paginating, all other parameters (except page_size) provided to
22548 /// `ListPlugins` must match the call that provided the page token.
22549 pub page_token: std::string::String,
22550
22551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22552}
22553
22554impl ListPluginsRequest {
22555 pub fn new() -> Self {
22556 std::default::Default::default()
22557 }
22558
22559 /// Sets the value of [parent][crate::model::ListPluginsRequest::parent].
22560 ///
22561 /// # Example
22562 /// ```ignore,no_run
22563 /// # use google_cloud_apihub_v1::model::ListPluginsRequest;
22564 /// let x = ListPluginsRequest::new().set_parent("example");
22565 /// ```
22566 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22567 self.parent = v.into();
22568 self
22569 }
22570
22571 /// Sets the value of [filter][crate::model::ListPluginsRequest::filter].
22572 ///
22573 /// # Example
22574 /// ```ignore,no_run
22575 /// # use google_cloud_apihub_v1::model::ListPluginsRequest;
22576 /// let x = ListPluginsRequest::new().set_filter("example");
22577 /// ```
22578 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22579 self.filter = v.into();
22580 self
22581 }
22582
22583 /// Sets the value of [page_size][crate::model::ListPluginsRequest::page_size].
22584 ///
22585 /// # Example
22586 /// ```ignore,no_run
22587 /// # use google_cloud_apihub_v1::model::ListPluginsRequest;
22588 /// let x = ListPluginsRequest::new().set_page_size(42);
22589 /// ```
22590 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
22591 self.page_size = v.into();
22592 self
22593 }
22594
22595 /// Sets the value of [page_token][crate::model::ListPluginsRequest::page_token].
22596 ///
22597 /// # Example
22598 /// ```ignore,no_run
22599 /// # use google_cloud_apihub_v1::model::ListPluginsRequest;
22600 /// let x = ListPluginsRequest::new().set_page_token("example");
22601 /// ```
22602 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22603 self.page_token = v.into();
22604 self
22605 }
22606}
22607
22608impl wkt::message::Message for ListPluginsRequest {
22609 fn typename() -> &'static str {
22610 "type.googleapis.com/google.cloud.apihub.v1.ListPluginsRequest"
22611 }
22612}
22613
22614/// The [ListPlugins][google.cloud.apihub.v1.ApiHubPlugin.ListPlugins] method's
22615/// response.
22616///
22617/// [google.cloud.apihub.v1.ApiHubPlugin.ListPlugins]: crate::client::ApiHubPlugin::list_plugins
22618#[derive(Clone, Default, PartialEq)]
22619#[non_exhaustive]
22620pub struct ListPluginsResponse {
22621 /// The plugins from the specified parent resource.
22622 pub plugins: std::vec::Vec<crate::model::Plugin>,
22623
22624 /// A token, which can be sent as `page_token` to retrieve the next page.
22625 /// If this field is omitted, there are no subsequent pages.
22626 pub next_page_token: std::string::String,
22627
22628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22629}
22630
22631impl ListPluginsResponse {
22632 pub fn new() -> Self {
22633 std::default::Default::default()
22634 }
22635
22636 /// Sets the value of [plugins][crate::model::ListPluginsResponse::plugins].
22637 ///
22638 /// # Example
22639 /// ```ignore,no_run
22640 /// # use google_cloud_apihub_v1::model::ListPluginsResponse;
22641 /// use google_cloud_apihub_v1::model::Plugin;
22642 /// let x = ListPluginsResponse::new()
22643 /// .set_plugins([
22644 /// Plugin::default()/* use setters */,
22645 /// Plugin::default()/* use (different) setters */,
22646 /// ]);
22647 /// ```
22648 pub fn set_plugins<T, V>(mut self, v: T) -> Self
22649 where
22650 T: std::iter::IntoIterator<Item = V>,
22651 V: std::convert::Into<crate::model::Plugin>,
22652 {
22653 use std::iter::Iterator;
22654 self.plugins = v.into_iter().map(|i| i.into()).collect();
22655 self
22656 }
22657
22658 /// Sets the value of [next_page_token][crate::model::ListPluginsResponse::next_page_token].
22659 ///
22660 /// # Example
22661 /// ```ignore,no_run
22662 /// # use google_cloud_apihub_v1::model::ListPluginsResponse;
22663 /// let x = ListPluginsResponse::new().set_next_page_token("example");
22664 /// ```
22665 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22666 self.next_page_token = v.into();
22667 self
22668 }
22669}
22670
22671impl wkt::message::Message for ListPluginsResponse {
22672 fn typename() -> &'static str {
22673 "type.googleapis.com/google.cloud.apihub.v1.ListPluginsResponse"
22674 }
22675}
22676
22677#[doc(hidden)]
22678impl google_cloud_gax::paginator::internal::PageableResponse for ListPluginsResponse {
22679 type PageItem = crate::model::Plugin;
22680
22681 fn items(self) -> std::vec::Vec<Self::PageItem> {
22682 self.plugins
22683 }
22684
22685 fn next_page_token(&self) -> std::string::String {
22686 use std::clone::Clone;
22687 self.next_page_token.clone()
22688 }
22689}
22690
22691/// The
22692/// [CreatePluginInstance][google.cloud.apihub.v1.ApiHubPlugin.CreatePluginInstance]
22693/// method's request.
22694///
22695/// [google.cloud.apihub.v1.ApiHubPlugin.CreatePluginInstance]: crate::client::ApiHubPlugin::create_plugin_instance
22696#[derive(Clone, Default, PartialEq)]
22697#[non_exhaustive]
22698pub struct CreatePluginInstanceRequest {
22699 /// Required. The parent of the plugin instance resource.
22700 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`
22701 pub parent: std::string::String,
22702
22703 /// Optional. The ID to use for the plugin instance, which will become the
22704 /// final component of the plugin instance's resource name. This field is
22705 /// optional.
22706 ///
22707 /// * If provided, the same will be used. The service will throw an error if
22708 /// the specified id is already used by another plugin instance in the plugin
22709 /// resource.
22710 /// * If not provided, a system generated id will be used.
22711 ///
22712 /// This value should be 4-63 characters, and valid characters
22713 /// are /[a-z][A-Z][0-9]-_/.
22714 pub plugin_instance_id: std::string::String,
22715
22716 /// Required. The plugin instance to create.
22717 pub plugin_instance: std::option::Option<crate::model::PluginInstance>,
22718
22719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22720}
22721
22722impl CreatePluginInstanceRequest {
22723 pub fn new() -> Self {
22724 std::default::Default::default()
22725 }
22726
22727 /// Sets the value of [parent][crate::model::CreatePluginInstanceRequest::parent].
22728 ///
22729 /// # Example
22730 /// ```ignore,no_run
22731 /// # use google_cloud_apihub_v1::model::CreatePluginInstanceRequest;
22732 /// let x = CreatePluginInstanceRequest::new().set_parent("example");
22733 /// ```
22734 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22735 self.parent = v.into();
22736 self
22737 }
22738
22739 /// Sets the value of [plugin_instance_id][crate::model::CreatePluginInstanceRequest::plugin_instance_id].
22740 ///
22741 /// # Example
22742 /// ```ignore,no_run
22743 /// # use google_cloud_apihub_v1::model::CreatePluginInstanceRequest;
22744 /// let x = CreatePluginInstanceRequest::new().set_plugin_instance_id("example");
22745 /// ```
22746 pub fn set_plugin_instance_id<T: std::convert::Into<std::string::String>>(
22747 mut self,
22748 v: T,
22749 ) -> Self {
22750 self.plugin_instance_id = v.into();
22751 self
22752 }
22753
22754 /// Sets the value of [plugin_instance][crate::model::CreatePluginInstanceRequest::plugin_instance].
22755 ///
22756 /// # Example
22757 /// ```ignore,no_run
22758 /// # use google_cloud_apihub_v1::model::CreatePluginInstanceRequest;
22759 /// use google_cloud_apihub_v1::model::PluginInstance;
22760 /// let x = CreatePluginInstanceRequest::new().set_plugin_instance(PluginInstance::default()/* use setters */);
22761 /// ```
22762 pub fn set_plugin_instance<T>(mut self, v: T) -> Self
22763 where
22764 T: std::convert::Into<crate::model::PluginInstance>,
22765 {
22766 self.plugin_instance = std::option::Option::Some(v.into());
22767 self
22768 }
22769
22770 /// Sets or clears the value of [plugin_instance][crate::model::CreatePluginInstanceRequest::plugin_instance].
22771 ///
22772 /// # Example
22773 /// ```ignore,no_run
22774 /// # use google_cloud_apihub_v1::model::CreatePluginInstanceRequest;
22775 /// use google_cloud_apihub_v1::model::PluginInstance;
22776 /// let x = CreatePluginInstanceRequest::new().set_or_clear_plugin_instance(Some(PluginInstance::default()/* use setters */));
22777 /// let x = CreatePluginInstanceRequest::new().set_or_clear_plugin_instance(None::<PluginInstance>);
22778 /// ```
22779 pub fn set_or_clear_plugin_instance<T>(mut self, v: std::option::Option<T>) -> Self
22780 where
22781 T: std::convert::Into<crate::model::PluginInstance>,
22782 {
22783 self.plugin_instance = v.map(|x| x.into());
22784 self
22785 }
22786}
22787
22788impl wkt::message::Message for CreatePluginInstanceRequest {
22789 fn typename() -> &'static str {
22790 "type.googleapis.com/google.cloud.apihub.v1.CreatePluginInstanceRequest"
22791 }
22792}
22793
22794/// The
22795/// [ExecutePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]
22796/// method's request.
22797///
22798/// [google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]: crate::client::ApiHubPlugin::execute_plugin_instance_action
22799#[derive(Clone, Default, PartialEq)]
22800#[non_exhaustive]
22801pub struct ExecutePluginInstanceActionRequest {
22802 /// Required. The name of the plugin instance to execute.
22803 /// Format:
22804 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
22805 pub name: std::string::String,
22806
22807 /// Required. The execution details for the action to execute.
22808 pub action_execution_detail: std::option::Option<crate::model::ActionExecutionDetail>,
22809
22810 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22811}
22812
22813impl ExecutePluginInstanceActionRequest {
22814 pub fn new() -> Self {
22815 std::default::Default::default()
22816 }
22817
22818 /// Sets the value of [name][crate::model::ExecutePluginInstanceActionRequest::name].
22819 ///
22820 /// # Example
22821 /// ```ignore,no_run
22822 /// # use google_cloud_apihub_v1::model::ExecutePluginInstanceActionRequest;
22823 /// let x = ExecutePluginInstanceActionRequest::new().set_name("example");
22824 /// ```
22825 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22826 self.name = v.into();
22827 self
22828 }
22829
22830 /// Sets the value of [action_execution_detail][crate::model::ExecutePluginInstanceActionRequest::action_execution_detail].
22831 ///
22832 /// # Example
22833 /// ```ignore,no_run
22834 /// # use google_cloud_apihub_v1::model::ExecutePluginInstanceActionRequest;
22835 /// use google_cloud_apihub_v1::model::ActionExecutionDetail;
22836 /// let x = ExecutePluginInstanceActionRequest::new().set_action_execution_detail(ActionExecutionDetail::default()/* use setters */);
22837 /// ```
22838 pub fn set_action_execution_detail<T>(mut self, v: T) -> Self
22839 where
22840 T: std::convert::Into<crate::model::ActionExecutionDetail>,
22841 {
22842 self.action_execution_detail = std::option::Option::Some(v.into());
22843 self
22844 }
22845
22846 /// Sets or clears the value of [action_execution_detail][crate::model::ExecutePluginInstanceActionRequest::action_execution_detail].
22847 ///
22848 /// # Example
22849 /// ```ignore,no_run
22850 /// # use google_cloud_apihub_v1::model::ExecutePluginInstanceActionRequest;
22851 /// use google_cloud_apihub_v1::model::ActionExecutionDetail;
22852 /// let x = ExecutePluginInstanceActionRequest::new().set_or_clear_action_execution_detail(Some(ActionExecutionDetail::default()/* use setters */));
22853 /// let x = ExecutePluginInstanceActionRequest::new().set_or_clear_action_execution_detail(None::<ActionExecutionDetail>);
22854 /// ```
22855 pub fn set_or_clear_action_execution_detail<T>(mut self, v: std::option::Option<T>) -> Self
22856 where
22857 T: std::convert::Into<crate::model::ActionExecutionDetail>,
22858 {
22859 self.action_execution_detail = v.map(|x| x.into());
22860 self
22861 }
22862}
22863
22864impl wkt::message::Message for ExecutePluginInstanceActionRequest {
22865 fn typename() -> &'static str {
22866 "type.googleapis.com/google.cloud.apihub.v1.ExecutePluginInstanceActionRequest"
22867 }
22868}
22869
22870/// The details for the action to execute.
22871#[derive(Clone, Default, PartialEq)]
22872#[non_exhaustive]
22873pub struct ActionExecutionDetail {
22874 /// Required. The action id of the plugin to execute.
22875 pub action_id: std::string::String,
22876
22877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22878}
22879
22880impl ActionExecutionDetail {
22881 pub fn new() -> Self {
22882 std::default::Default::default()
22883 }
22884
22885 /// Sets the value of [action_id][crate::model::ActionExecutionDetail::action_id].
22886 ///
22887 /// # Example
22888 /// ```ignore,no_run
22889 /// # use google_cloud_apihub_v1::model::ActionExecutionDetail;
22890 /// let x = ActionExecutionDetail::new().set_action_id("example");
22891 /// ```
22892 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22893 self.action_id = v.into();
22894 self
22895 }
22896}
22897
22898impl wkt::message::Message for ActionExecutionDetail {
22899 fn typename() -> &'static str {
22900 "type.googleapis.com/google.cloud.apihub.v1.ActionExecutionDetail"
22901 }
22902}
22903
22904/// The
22905/// [ExecutePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]
22906/// method's response.
22907///
22908/// [google.cloud.apihub.v1.ApiHubPlugin.ExecutePluginInstanceAction]: crate::client::ApiHubPlugin::execute_plugin_instance_action
22909#[derive(Clone, Default, PartialEq)]
22910#[non_exhaustive]
22911pub struct ExecutePluginInstanceActionResponse {
22912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22913}
22914
22915impl ExecutePluginInstanceActionResponse {
22916 pub fn new() -> Self {
22917 std::default::Default::default()
22918 }
22919}
22920
22921impl wkt::message::Message for ExecutePluginInstanceActionResponse {
22922 fn typename() -> &'static str {
22923 "type.googleapis.com/google.cloud.apihub.v1.ExecutePluginInstanceActionResponse"
22924 }
22925}
22926
22927/// The
22928/// [GetPluginInstance][google.cloud.apihub.v1.ApiHubPlugin.GetPluginInstance]
22929/// method's request.
22930///
22931/// [google.cloud.apihub.v1.ApiHubPlugin.GetPluginInstance]: crate::client::ApiHubPlugin::get_plugin_instance
22932#[derive(Clone, Default, PartialEq)]
22933#[non_exhaustive]
22934pub struct GetPluginInstanceRequest {
22935 /// Required. The name of the plugin instance to retrieve.
22936 /// Format:
22937 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
22938 pub name: std::string::String,
22939
22940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22941}
22942
22943impl GetPluginInstanceRequest {
22944 pub fn new() -> Self {
22945 std::default::Default::default()
22946 }
22947
22948 /// Sets the value of [name][crate::model::GetPluginInstanceRequest::name].
22949 ///
22950 /// # Example
22951 /// ```ignore,no_run
22952 /// # use google_cloud_apihub_v1::model::GetPluginInstanceRequest;
22953 /// let x = GetPluginInstanceRequest::new().set_name("example");
22954 /// ```
22955 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22956 self.name = v.into();
22957 self
22958 }
22959}
22960
22961impl wkt::message::Message for GetPluginInstanceRequest {
22962 fn typename() -> &'static str {
22963 "type.googleapis.com/google.cloud.apihub.v1.GetPluginInstanceRequest"
22964 }
22965}
22966
22967/// The
22968/// [ListPluginInstances][google.cloud.apihub.v1.ApiHubPlugin.ListPluginInstances]
22969/// method's request.
22970///
22971/// [google.cloud.apihub.v1.ApiHubPlugin.ListPluginInstances]: crate::client::ApiHubPlugin::list_plugin_instances
22972#[derive(Clone, Default, PartialEq)]
22973#[non_exhaustive]
22974pub struct ListPluginInstancesRequest {
22975 /// Required. The parent resource where this plugin will be created.
22976 /// Format: `projects/{project}/locations/{location}/plugins/{plugin}`.
22977 /// To list plugin instances for multiple plugins,
22978 /// use the - character instead of the plugin ID.
22979 pub parent: std::string::String,
22980
22981 /// Optional. An expression that filters the list of plugin instances.
22982 ///
22983 /// A filter expression consists of a field name, a comparison
22984 /// operator, and a value for filtering. The value must be a string. The
22985 /// comparison operator must be one of: `<`, `>` or
22986 /// `=`. Filters are not case sensitive.
22987 ///
22988 /// The following fields in the `PluginInstances` are eligible for filtering:
22989 ///
22990 /// * `state` - The state of the Plugin Instance. Allowed
22991 /// comparison operators: `=`.
22992 ///
22993 /// A filter function is also supported in the filter string. The filter
22994 /// function is `id(name)`. The `id(name)` function returns the id of the
22995 /// resource name. For example, `id(name) = \"plugin-instance-1\"` is
22996 /// equivalent to `name =
22997 /// \"projects/test-project-id/locations/test-location-id/plugins/plugin-1/instances/plugin-instance-1\"`
22998 /// provided the parent is
22999 /// `projects/test-project-id/locations/test-location-id/plugins/plugin-1`.
23000 ///
23001 /// Expressions are combined with either `AND` logic operator or `OR` logical
23002 /// operator but not both of them together i.e. only one of the `AND` or `OR`
23003 /// operator can be used throughout the filter string and both the operators
23004 /// cannot be used together. No other logical operators are
23005 /// supported. At most three filter fields are allowed in the filter
23006 /// string and if provided more than that then `INVALID_ARGUMENT` error is
23007 /// returned by the API.
23008 /// Here are a few examples:
23009 ///
23010 /// * `state = ENABLED` - The plugin instance is in enabled state.
23011 pub filter: std::string::String,
23012
23013 /// Optional. The maximum number of hub plugins to return. The service may
23014 /// return fewer than this value. If unspecified, at most 50 hub plugins will
23015 /// be returned. The maximum value is 1000; values above 1000 will be coerced
23016 /// to 1000.
23017 pub page_size: i32,
23018
23019 /// Optional. A page token, received from a previous `ListPluginInstances`
23020 /// call. Provide this to retrieve the subsequent page.
23021 ///
23022 /// When paginating, all other parameters provided to `ListPluginInstances`
23023 /// must match the call that provided the page token.
23024 pub page_token: std::string::String,
23025
23026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23027}
23028
23029impl ListPluginInstancesRequest {
23030 pub fn new() -> Self {
23031 std::default::Default::default()
23032 }
23033
23034 /// Sets the value of [parent][crate::model::ListPluginInstancesRequest::parent].
23035 ///
23036 /// # Example
23037 /// ```ignore,no_run
23038 /// # use google_cloud_apihub_v1::model::ListPluginInstancesRequest;
23039 /// let x = ListPluginInstancesRequest::new().set_parent("example");
23040 /// ```
23041 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23042 self.parent = v.into();
23043 self
23044 }
23045
23046 /// Sets the value of [filter][crate::model::ListPluginInstancesRequest::filter].
23047 ///
23048 /// # Example
23049 /// ```ignore,no_run
23050 /// # use google_cloud_apihub_v1::model::ListPluginInstancesRequest;
23051 /// let x = ListPluginInstancesRequest::new().set_filter("example");
23052 /// ```
23053 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23054 self.filter = v.into();
23055 self
23056 }
23057
23058 /// Sets the value of [page_size][crate::model::ListPluginInstancesRequest::page_size].
23059 ///
23060 /// # Example
23061 /// ```ignore,no_run
23062 /// # use google_cloud_apihub_v1::model::ListPluginInstancesRequest;
23063 /// let x = ListPluginInstancesRequest::new().set_page_size(42);
23064 /// ```
23065 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23066 self.page_size = v.into();
23067 self
23068 }
23069
23070 /// Sets the value of [page_token][crate::model::ListPluginInstancesRequest::page_token].
23071 ///
23072 /// # Example
23073 /// ```ignore,no_run
23074 /// # use google_cloud_apihub_v1::model::ListPluginInstancesRequest;
23075 /// let x = ListPluginInstancesRequest::new().set_page_token("example");
23076 /// ```
23077 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23078 self.page_token = v.into();
23079 self
23080 }
23081}
23082
23083impl wkt::message::Message for ListPluginInstancesRequest {
23084 fn typename() -> &'static str {
23085 "type.googleapis.com/google.cloud.apihub.v1.ListPluginInstancesRequest"
23086 }
23087}
23088
23089/// The
23090/// [ListPluginInstances][google.cloud.apihub.v1.ApiHubPlugin.ListPluginInstances]
23091/// method's response.
23092///
23093/// [google.cloud.apihub.v1.ApiHubPlugin.ListPluginInstances]: crate::client::ApiHubPlugin::list_plugin_instances
23094#[derive(Clone, Default, PartialEq)]
23095#[non_exhaustive]
23096pub struct ListPluginInstancesResponse {
23097 /// The plugin instances from the specified parent resource.
23098 pub plugin_instances: std::vec::Vec<crate::model::PluginInstance>,
23099
23100 /// A token, which can be sent as `page_token` to retrieve the next page.
23101 /// If this field is omitted, there are no subsequent pages.
23102 pub next_page_token: std::string::String,
23103
23104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23105}
23106
23107impl ListPluginInstancesResponse {
23108 pub fn new() -> Self {
23109 std::default::Default::default()
23110 }
23111
23112 /// Sets the value of [plugin_instances][crate::model::ListPluginInstancesResponse::plugin_instances].
23113 ///
23114 /// # Example
23115 /// ```ignore,no_run
23116 /// # use google_cloud_apihub_v1::model::ListPluginInstancesResponse;
23117 /// use google_cloud_apihub_v1::model::PluginInstance;
23118 /// let x = ListPluginInstancesResponse::new()
23119 /// .set_plugin_instances([
23120 /// PluginInstance::default()/* use setters */,
23121 /// PluginInstance::default()/* use (different) setters */,
23122 /// ]);
23123 /// ```
23124 pub fn set_plugin_instances<T, V>(mut self, v: T) -> Self
23125 where
23126 T: std::iter::IntoIterator<Item = V>,
23127 V: std::convert::Into<crate::model::PluginInstance>,
23128 {
23129 use std::iter::Iterator;
23130 self.plugin_instances = v.into_iter().map(|i| i.into()).collect();
23131 self
23132 }
23133
23134 /// Sets the value of [next_page_token][crate::model::ListPluginInstancesResponse::next_page_token].
23135 ///
23136 /// # Example
23137 /// ```ignore,no_run
23138 /// # use google_cloud_apihub_v1::model::ListPluginInstancesResponse;
23139 /// let x = ListPluginInstancesResponse::new().set_next_page_token("example");
23140 /// ```
23141 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23142 self.next_page_token = v.into();
23143 self
23144 }
23145}
23146
23147impl wkt::message::Message for ListPluginInstancesResponse {
23148 fn typename() -> &'static str {
23149 "type.googleapis.com/google.cloud.apihub.v1.ListPluginInstancesResponse"
23150 }
23151}
23152
23153#[doc(hidden)]
23154impl google_cloud_gax::paginator::internal::PageableResponse for ListPluginInstancesResponse {
23155 type PageItem = crate::model::PluginInstance;
23156
23157 fn items(self) -> std::vec::Vec<Self::PageItem> {
23158 self.plugin_instances
23159 }
23160
23161 fn next_page_token(&self) -> std::string::String {
23162 use std::clone::Clone;
23163 self.next_page_token.clone()
23164 }
23165}
23166
23167/// The
23168/// [EnablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]
23169/// method's request.
23170///
23171/// [google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]: crate::client::ApiHubPlugin::enable_plugin_instance_action
23172#[derive(Clone, Default, PartialEq)]
23173#[non_exhaustive]
23174pub struct EnablePluginInstanceActionRequest {
23175 /// Required. The name of the plugin instance to enable.
23176 /// Format:
23177 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
23178 pub name: std::string::String,
23179
23180 /// Required. The action id to enable.
23181 pub action_id: std::string::String,
23182
23183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23184}
23185
23186impl EnablePluginInstanceActionRequest {
23187 pub fn new() -> Self {
23188 std::default::Default::default()
23189 }
23190
23191 /// Sets the value of [name][crate::model::EnablePluginInstanceActionRequest::name].
23192 ///
23193 /// # Example
23194 /// ```ignore,no_run
23195 /// # use google_cloud_apihub_v1::model::EnablePluginInstanceActionRequest;
23196 /// let x = EnablePluginInstanceActionRequest::new().set_name("example");
23197 /// ```
23198 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23199 self.name = v.into();
23200 self
23201 }
23202
23203 /// Sets the value of [action_id][crate::model::EnablePluginInstanceActionRequest::action_id].
23204 ///
23205 /// # Example
23206 /// ```ignore,no_run
23207 /// # use google_cloud_apihub_v1::model::EnablePluginInstanceActionRequest;
23208 /// let x = EnablePluginInstanceActionRequest::new().set_action_id("example");
23209 /// ```
23210 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23211 self.action_id = v.into();
23212 self
23213 }
23214}
23215
23216impl wkt::message::Message for EnablePluginInstanceActionRequest {
23217 fn typename() -> &'static str {
23218 "type.googleapis.com/google.cloud.apihub.v1.EnablePluginInstanceActionRequest"
23219 }
23220}
23221
23222/// The
23223/// [EnablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]
23224/// method's response.
23225///
23226/// [google.cloud.apihub.v1.ApiHubPlugin.EnablePluginInstanceAction]: crate::client::ApiHubPlugin::enable_plugin_instance_action
23227#[derive(Clone, Default, PartialEq)]
23228#[non_exhaustive]
23229pub struct EnablePluginInstanceActionResponse {
23230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23231}
23232
23233impl EnablePluginInstanceActionResponse {
23234 pub fn new() -> Self {
23235 std::default::Default::default()
23236 }
23237}
23238
23239impl wkt::message::Message for EnablePluginInstanceActionResponse {
23240 fn typename() -> &'static str {
23241 "type.googleapis.com/google.cloud.apihub.v1.EnablePluginInstanceActionResponse"
23242 }
23243}
23244
23245/// The
23246/// [DisablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]
23247/// method's request.
23248///
23249/// [google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]: crate::client::ApiHubPlugin::disable_plugin_instance_action
23250#[derive(Clone, Default, PartialEq)]
23251#[non_exhaustive]
23252pub struct DisablePluginInstanceActionRequest {
23253 /// Required. The name of the plugin instance to disable.
23254 /// Format:
23255 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
23256 pub name: std::string::String,
23257
23258 /// Required. The action id to disable.
23259 pub action_id: std::string::String,
23260
23261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23262}
23263
23264impl DisablePluginInstanceActionRequest {
23265 pub fn new() -> Self {
23266 std::default::Default::default()
23267 }
23268
23269 /// Sets the value of [name][crate::model::DisablePluginInstanceActionRequest::name].
23270 ///
23271 /// # Example
23272 /// ```ignore,no_run
23273 /// # use google_cloud_apihub_v1::model::DisablePluginInstanceActionRequest;
23274 /// let x = DisablePluginInstanceActionRequest::new().set_name("example");
23275 /// ```
23276 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23277 self.name = v.into();
23278 self
23279 }
23280
23281 /// Sets the value of [action_id][crate::model::DisablePluginInstanceActionRequest::action_id].
23282 ///
23283 /// # Example
23284 /// ```ignore,no_run
23285 /// # use google_cloud_apihub_v1::model::DisablePluginInstanceActionRequest;
23286 /// let x = DisablePluginInstanceActionRequest::new().set_action_id("example");
23287 /// ```
23288 pub fn set_action_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23289 self.action_id = v.into();
23290 self
23291 }
23292}
23293
23294impl wkt::message::Message for DisablePluginInstanceActionRequest {
23295 fn typename() -> &'static str {
23296 "type.googleapis.com/google.cloud.apihub.v1.DisablePluginInstanceActionRequest"
23297 }
23298}
23299
23300/// The
23301/// [DisablePluginInstanceAction][google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]
23302/// method's response.
23303///
23304/// [google.cloud.apihub.v1.ApiHubPlugin.DisablePluginInstanceAction]: crate::client::ApiHubPlugin::disable_plugin_instance_action
23305#[derive(Clone, Default, PartialEq)]
23306#[non_exhaustive]
23307pub struct DisablePluginInstanceActionResponse {
23308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23309}
23310
23311impl DisablePluginInstanceActionResponse {
23312 pub fn new() -> Self {
23313 std::default::Default::default()
23314 }
23315}
23316
23317impl wkt::message::Message for DisablePluginInstanceActionResponse {
23318 fn typename() -> &'static str {
23319 "type.googleapis.com/google.cloud.apihub.v1.DisablePluginInstanceActionResponse"
23320 }
23321}
23322
23323/// The
23324/// [UpdatePluginInstance][google.cloud.apihub.v1.ApiHubPlugin.UpdatePluginInstance]
23325/// method's request.
23326///
23327/// [google.cloud.apihub.v1.ApiHubPlugin.UpdatePluginInstance]: crate::client::ApiHubPlugin::update_plugin_instance
23328#[derive(Clone, Default, PartialEq)]
23329#[non_exhaustive]
23330pub struct UpdatePluginInstanceRequest {
23331 /// Required. The plugin instance to update.
23332 pub plugin_instance: std::option::Option<crate::model::PluginInstance>,
23333
23334 /// Optional. The list of fields to update.
23335 pub update_mask: std::option::Option<wkt::FieldMask>,
23336
23337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23338}
23339
23340impl UpdatePluginInstanceRequest {
23341 pub fn new() -> Self {
23342 std::default::Default::default()
23343 }
23344
23345 /// Sets the value of [plugin_instance][crate::model::UpdatePluginInstanceRequest::plugin_instance].
23346 ///
23347 /// # Example
23348 /// ```ignore,no_run
23349 /// # use google_cloud_apihub_v1::model::UpdatePluginInstanceRequest;
23350 /// use google_cloud_apihub_v1::model::PluginInstance;
23351 /// let x = UpdatePluginInstanceRequest::new().set_plugin_instance(PluginInstance::default()/* use setters */);
23352 /// ```
23353 pub fn set_plugin_instance<T>(mut self, v: T) -> Self
23354 where
23355 T: std::convert::Into<crate::model::PluginInstance>,
23356 {
23357 self.plugin_instance = std::option::Option::Some(v.into());
23358 self
23359 }
23360
23361 /// Sets or clears the value of [plugin_instance][crate::model::UpdatePluginInstanceRequest::plugin_instance].
23362 ///
23363 /// # Example
23364 /// ```ignore,no_run
23365 /// # use google_cloud_apihub_v1::model::UpdatePluginInstanceRequest;
23366 /// use google_cloud_apihub_v1::model::PluginInstance;
23367 /// let x = UpdatePluginInstanceRequest::new().set_or_clear_plugin_instance(Some(PluginInstance::default()/* use setters */));
23368 /// let x = UpdatePluginInstanceRequest::new().set_or_clear_plugin_instance(None::<PluginInstance>);
23369 /// ```
23370 pub fn set_or_clear_plugin_instance<T>(mut self, v: std::option::Option<T>) -> Self
23371 where
23372 T: std::convert::Into<crate::model::PluginInstance>,
23373 {
23374 self.plugin_instance = v.map(|x| x.into());
23375 self
23376 }
23377
23378 /// Sets the value of [update_mask][crate::model::UpdatePluginInstanceRequest::update_mask].
23379 ///
23380 /// # Example
23381 /// ```ignore,no_run
23382 /// # use google_cloud_apihub_v1::model::UpdatePluginInstanceRequest;
23383 /// use wkt::FieldMask;
23384 /// let x = UpdatePluginInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
23385 /// ```
23386 pub fn set_update_mask<T>(mut self, v: T) -> Self
23387 where
23388 T: std::convert::Into<wkt::FieldMask>,
23389 {
23390 self.update_mask = std::option::Option::Some(v.into());
23391 self
23392 }
23393
23394 /// Sets or clears the value of [update_mask][crate::model::UpdatePluginInstanceRequest::update_mask].
23395 ///
23396 /// # Example
23397 /// ```ignore,no_run
23398 /// # use google_cloud_apihub_v1::model::UpdatePluginInstanceRequest;
23399 /// use wkt::FieldMask;
23400 /// let x = UpdatePluginInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
23401 /// let x = UpdatePluginInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
23402 /// ```
23403 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
23404 where
23405 T: std::convert::Into<wkt::FieldMask>,
23406 {
23407 self.update_mask = v.map(|x| x.into());
23408 self
23409 }
23410}
23411
23412impl wkt::message::Message for UpdatePluginInstanceRequest {
23413 fn typename() -> &'static str {
23414 "type.googleapis.com/google.cloud.apihub.v1.UpdatePluginInstanceRequest"
23415 }
23416}
23417
23418/// The
23419/// [DeletePluginInstance][google.cloud.apihub.v1.ApiHubPlugin.DeletePluginInstance]
23420/// method's request.
23421///
23422/// [google.cloud.apihub.v1.ApiHubPlugin.DeletePluginInstance]: crate::client::ApiHubPlugin::delete_plugin_instance
23423#[derive(Clone, Default, PartialEq)]
23424#[non_exhaustive]
23425pub struct DeletePluginInstanceRequest {
23426 /// Required. The name of the plugin instance to delete.
23427 /// Format:
23428 /// `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`.
23429 pub name: std::string::String,
23430
23431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23432}
23433
23434impl DeletePluginInstanceRequest {
23435 pub fn new() -> Self {
23436 std::default::Default::default()
23437 }
23438
23439 /// Sets the value of [name][crate::model::DeletePluginInstanceRequest::name].
23440 ///
23441 /// # Example
23442 /// ```ignore,no_run
23443 /// # use google_cloud_apihub_v1::model::DeletePluginInstanceRequest;
23444 /// let x = DeletePluginInstanceRequest::new().set_name("example");
23445 /// ```
23446 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23447 self.name = v.into();
23448 self
23449 }
23450}
23451
23452impl wkt::message::Message for DeletePluginInstanceRequest {
23453 fn typename() -> &'static str {
23454 "type.googleapis.com/google.cloud.apihub.v1.DeletePluginInstanceRequest"
23455 }
23456}
23457
23458/// The
23459/// [CreateApiHubInstance][google.cloud.apihub.v1.Provisioning.CreateApiHubInstance]
23460/// method's request.
23461///
23462/// [google.cloud.apihub.v1.Provisioning.CreateApiHubInstance]: crate::client::Provisioning::create_api_hub_instance
23463#[derive(Clone, Default, PartialEq)]
23464#[non_exhaustive]
23465pub struct CreateApiHubInstanceRequest {
23466 /// Required. The parent resource for the Api Hub instance resource.
23467 /// Format: `projects/{project}/locations/{location}`
23468 pub parent: std::string::String,
23469
23470 /// Optional. Identifier to assign to the Api Hub instance. Must be unique
23471 /// within scope of the parent resource. If the field is not provided, system
23472 /// generated id will be used.
23473 ///
23474 /// This value should be 4-40 characters, and valid characters
23475 /// are `/[a-z][A-Z][0-9]-_/`.
23476 pub api_hub_instance_id: std::string::String,
23477
23478 /// Required. The ApiHub instance.
23479 pub api_hub_instance: std::option::Option<crate::model::ApiHubInstance>,
23480
23481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23482}
23483
23484impl CreateApiHubInstanceRequest {
23485 pub fn new() -> Self {
23486 std::default::Default::default()
23487 }
23488
23489 /// Sets the value of [parent][crate::model::CreateApiHubInstanceRequest::parent].
23490 ///
23491 /// # Example
23492 /// ```ignore,no_run
23493 /// # use google_cloud_apihub_v1::model::CreateApiHubInstanceRequest;
23494 /// let x = CreateApiHubInstanceRequest::new().set_parent("example");
23495 /// ```
23496 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23497 self.parent = v.into();
23498 self
23499 }
23500
23501 /// Sets the value of [api_hub_instance_id][crate::model::CreateApiHubInstanceRequest::api_hub_instance_id].
23502 ///
23503 /// # Example
23504 /// ```ignore,no_run
23505 /// # use google_cloud_apihub_v1::model::CreateApiHubInstanceRequest;
23506 /// let x = CreateApiHubInstanceRequest::new().set_api_hub_instance_id("example");
23507 /// ```
23508 pub fn set_api_hub_instance_id<T: std::convert::Into<std::string::String>>(
23509 mut self,
23510 v: T,
23511 ) -> Self {
23512 self.api_hub_instance_id = v.into();
23513 self
23514 }
23515
23516 /// Sets the value of [api_hub_instance][crate::model::CreateApiHubInstanceRequest::api_hub_instance].
23517 ///
23518 /// # Example
23519 /// ```ignore,no_run
23520 /// # use google_cloud_apihub_v1::model::CreateApiHubInstanceRequest;
23521 /// use google_cloud_apihub_v1::model::ApiHubInstance;
23522 /// let x = CreateApiHubInstanceRequest::new().set_api_hub_instance(ApiHubInstance::default()/* use setters */);
23523 /// ```
23524 pub fn set_api_hub_instance<T>(mut self, v: T) -> Self
23525 where
23526 T: std::convert::Into<crate::model::ApiHubInstance>,
23527 {
23528 self.api_hub_instance = std::option::Option::Some(v.into());
23529 self
23530 }
23531
23532 /// Sets or clears the value of [api_hub_instance][crate::model::CreateApiHubInstanceRequest::api_hub_instance].
23533 ///
23534 /// # Example
23535 /// ```ignore,no_run
23536 /// # use google_cloud_apihub_v1::model::CreateApiHubInstanceRequest;
23537 /// use google_cloud_apihub_v1::model::ApiHubInstance;
23538 /// let x = CreateApiHubInstanceRequest::new().set_or_clear_api_hub_instance(Some(ApiHubInstance::default()/* use setters */));
23539 /// let x = CreateApiHubInstanceRequest::new().set_or_clear_api_hub_instance(None::<ApiHubInstance>);
23540 /// ```
23541 pub fn set_or_clear_api_hub_instance<T>(mut self, v: std::option::Option<T>) -> Self
23542 where
23543 T: std::convert::Into<crate::model::ApiHubInstance>,
23544 {
23545 self.api_hub_instance = v.map(|x| x.into());
23546 self
23547 }
23548}
23549
23550impl wkt::message::Message for CreateApiHubInstanceRequest {
23551 fn typename() -> &'static str {
23552 "type.googleapis.com/google.cloud.apihub.v1.CreateApiHubInstanceRequest"
23553 }
23554}
23555
23556/// The
23557/// [DeleteApiHubInstance][google.cloud.apihub.v1.Provisioning.DeleteApiHubInstance]
23558/// method's request.
23559///
23560/// [google.cloud.apihub.v1.Provisioning.DeleteApiHubInstance]: crate::client::Provisioning::delete_api_hub_instance
23561#[derive(Clone, Default, PartialEq)]
23562#[non_exhaustive]
23563pub struct DeleteApiHubInstanceRequest {
23564 /// Required. The name of the Api Hub instance to delete.
23565 /// Format:
23566 /// `projects/{project}/locations/{location}/apiHubInstances/{apiHubInstance}`.
23567 pub name: std::string::String,
23568
23569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23570}
23571
23572impl DeleteApiHubInstanceRequest {
23573 pub fn new() -> Self {
23574 std::default::Default::default()
23575 }
23576
23577 /// Sets the value of [name][crate::model::DeleteApiHubInstanceRequest::name].
23578 ///
23579 /// # Example
23580 /// ```ignore,no_run
23581 /// # use google_cloud_apihub_v1::model::DeleteApiHubInstanceRequest;
23582 /// let x = DeleteApiHubInstanceRequest::new().set_name("example");
23583 /// ```
23584 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23585 self.name = v.into();
23586 self
23587 }
23588}
23589
23590impl wkt::message::Message for DeleteApiHubInstanceRequest {
23591 fn typename() -> &'static str {
23592 "type.googleapis.com/google.cloud.apihub.v1.DeleteApiHubInstanceRequest"
23593 }
23594}
23595
23596/// The
23597/// [GetApiHubInstance][google.cloud.apihub.v1.Provisioning.GetApiHubInstance]
23598/// method's request.
23599///
23600/// [google.cloud.apihub.v1.Provisioning.GetApiHubInstance]: crate::client::Provisioning::get_api_hub_instance
23601#[derive(Clone, Default, PartialEq)]
23602#[non_exhaustive]
23603pub struct GetApiHubInstanceRequest {
23604 /// Required. The name of the Api Hub instance to retrieve.
23605 /// Format:
23606 /// `projects/{project}/locations/{location}/apiHubInstances/{apiHubInstance}`.
23607 pub name: std::string::String,
23608
23609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23610}
23611
23612impl GetApiHubInstanceRequest {
23613 pub fn new() -> Self {
23614 std::default::Default::default()
23615 }
23616
23617 /// Sets the value of [name][crate::model::GetApiHubInstanceRequest::name].
23618 ///
23619 /// # Example
23620 /// ```ignore,no_run
23621 /// # use google_cloud_apihub_v1::model::GetApiHubInstanceRequest;
23622 /// let x = GetApiHubInstanceRequest::new().set_name("example");
23623 /// ```
23624 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23625 self.name = v.into();
23626 self
23627 }
23628}
23629
23630impl wkt::message::Message for GetApiHubInstanceRequest {
23631 fn typename() -> &'static str {
23632 "type.googleapis.com/google.cloud.apihub.v1.GetApiHubInstanceRequest"
23633 }
23634}
23635
23636/// The
23637/// [LookupApiHubInstance][google.cloud.apihub.v1.Provisioning.LookupApiHubInstance]
23638/// method's request.
23639///
23640/// [google.cloud.apihub.v1.Provisioning.LookupApiHubInstance]: crate::client::Provisioning::lookup_api_hub_instance
23641#[derive(Clone, Default, PartialEq)]
23642#[non_exhaustive]
23643pub struct LookupApiHubInstanceRequest {
23644 /// Required. There will always be only one Api Hub instance for a GCP project
23645 /// across all locations.
23646 /// The parent resource for the Api Hub instance resource.
23647 /// Format: `projects/{project}/locations/{location}`
23648 pub parent: std::string::String,
23649
23650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23651}
23652
23653impl LookupApiHubInstanceRequest {
23654 pub fn new() -> Self {
23655 std::default::Default::default()
23656 }
23657
23658 /// Sets the value of [parent][crate::model::LookupApiHubInstanceRequest::parent].
23659 ///
23660 /// # Example
23661 /// ```ignore,no_run
23662 /// # use google_cloud_apihub_v1::model::LookupApiHubInstanceRequest;
23663 /// let x = LookupApiHubInstanceRequest::new().set_parent("example");
23664 /// ```
23665 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23666 self.parent = v.into();
23667 self
23668 }
23669}
23670
23671impl wkt::message::Message for LookupApiHubInstanceRequest {
23672 fn typename() -> &'static str {
23673 "type.googleapis.com/google.cloud.apihub.v1.LookupApiHubInstanceRequest"
23674 }
23675}
23676
23677/// The
23678/// [LookupApiHubInstance][google.cloud.apihub.v1.Provisioning.LookupApiHubInstance]
23679/// method's response.`
23680///
23681/// [google.cloud.apihub.v1.Provisioning.LookupApiHubInstance]: crate::client::Provisioning::lookup_api_hub_instance
23682#[derive(Clone, Default, PartialEq)]
23683#[non_exhaustive]
23684pub struct LookupApiHubInstanceResponse {
23685 /// API Hub instance for a project if it exists, empty otherwise.
23686 pub api_hub_instance: std::option::Option<crate::model::ApiHubInstance>,
23687
23688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23689}
23690
23691impl LookupApiHubInstanceResponse {
23692 pub fn new() -> Self {
23693 std::default::Default::default()
23694 }
23695
23696 /// Sets the value of [api_hub_instance][crate::model::LookupApiHubInstanceResponse::api_hub_instance].
23697 ///
23698 /// # Example
23699 /// ```ignore,no_run
23700 /// # use google_cloud_apihub_v1::model::LookupApiHubInstanceResponse;
23701 /// use google_cloud_apihub_v1::model::ApiHubInstance;
23702 /// let x = LookupApiHubInstanceResponse::new().set_api_hub_instance(ApiHubInstance::default()/* use setters */);
23703 /// ```
23704 pub fn set_api_hub_instance<T>(mut self, v: T) -> Self
23705 where
23706 T: std::convert::Into<crate::model::ApiHubInstance>,
23707 {
23708 self.api_hub_instance = std::option::Option::Some(v.into());
23709 self
23710 }
23711
23712 /// Sets or clears the value of [api_hub_instance][crate::model::LookupApiHubInstanceResponse::api_hub_instance].
23713 ///
23714 /// # Example
23715 /// ```ignore,no_run
23716 /// # use google_cloud_apihub_v1::model::LookupApiHubInstanceResponse;
23717 /// use google_cloud_apihub_v1::model::ApiHubInstance;
23718 /// let x = LookupApiHubInstanceResponse::new().set_or_clear_api_hub_instance(Some(ApiHubInstance::default()/* use setters */));
23719 /// let x = LookupApiHubInstanceResponse::new().set_or_clear_api_hub_instance(None::<ApiHubInstance>);
23720 /// ```
23721 pub fn set_or_clear_api_hub_instance<T>(mut self, v: std::option::Option<T>) -> Self
23722 where
23723 T: std::convert::Into<crate::model::ApiHubInstance>,
23724 {
23725 self.api_hub_instance = v.map(|x| x.into());
23726 self
23727 }
23728}
23729
23730impl wkt::message::Message for LookupApiHubInstanceResponse {
23731 fn typename() -> &'static str {
23732 "type.googleapis.com/google.cloud.apihub.v1.LookupApiHubInstanceResponse"
23733 }
23734}
23735
23736/// The
23737/// [CreateRuntimeProjectAttachment][google.cloud.apihub.v1.RuntimeProjectAttachmentService.CreateRuntimeProjectAttachment]
23738/// method's request.
23739///
23740/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.CreateRuntimeProjectAttachment]: crate::client::RuntimeProjectAttachmentService::create_runtime_project_attachment
23741#[derive(Clone, Default, PartialEq)]
23742#[non_exhaustive]
23743pub struct CreateRuntimeProjectAttachmentRequest {
23744 /// Required. The parent resource for the Runtime Project Attachment.
23745 /// Format: `projects/{project}/locations/{location}`
23746 pub parent: std::string::String,
23747
23748 /// Required. The ID to use for the Runtime Project Attachment, which will
23749 /// become the final component of the Runtime Project Attachment's name. The ID
23750 /// must be the same as the project ID of the Google cloud project specified in
23751 /// the runtime_project_attachment.runtime_project field.
23752 pub runtime_project_attachment_id: std::string::String,
23753
23754 /// Required. The Runtime Project Attachment to create.
23755 pub runtime_project_attachment: std::option::Option<crate::model::RuntimeProjectAttachment>,
23756
23757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23758}
23759
23760impl CreateRuntimeProjectAttachmentRequest {
23761 pub fn new() -> Self {
23762 std::default::Default::default()
23763 }
23764
23765 /// Sets the value of [parent][crate::model::CreateRuntimeProjectAttachmentRequest::parent].
23766 ///
23767 /// # Example
23768 /// ```ignore,no_run
23769 /// # use google_cloud_apihub_v1::model::CreateRuntimeProjectAttachmentRequest;
23770 /// let x = CreateRuntimeProjectAttachmentRequest::new().set_parent("example");
23771 /// ```
23772 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23773 self.parent = v.into();
23774 self
23775 }
23776
23777 /// Sets the value of [runtime_project_attachment_id][crate::model::CreateRuntimeProjectAttachmentRequest::runtime_project_attachment_id].
23778 ///
23779 /// # Example
23780 /// ```ignore,no_run
23781 /// # use google_cloud_apihub_v1::model::CreateRuntimeProjectAttachmentRequest;
23782 /// let x = CreateRuntimeProjectAttachmentRequest::new().set_runtime_project_attachment_id("example");
23783 /// ```
23784 pub fn set_runtime_project_attachment_id<T: std::convert::Into<std::string::String>>(
23785 mut self,
23786 v: T,
23787 ) -> Self {
23788 self.runtime_project_attachment_id = v.into();
23789 self
23790 }
23791
23792 /// Sets the value of [runtime_project_attachment][crate::model::CreateRuntimeProjectAttachmentRequest::runtime_project_attachment].
23793 ///
23794 /// # Example
23795 /// ```ignore,no_run
23796 /// # use google_cloud_apihub_v1::model::CreateRuntimeProjectAttachmentRequest;
23797 /// use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
23798 /// let x = CreateRuntimeProjectAttachmentRequest::new().set_runtime_project_attachment(RuntimeProjectAttachment::default()/* use setters */);
23799 /// ```
23800 pub fn set_runtime_project_attachment<T>(mut self, v: T) -> Self
23801 where
23802 T: std::convert::Into<crate::model::RuntimeProjectAttachment>,
23803 {
23804 self.runtime_project_attachment = std::option::Option::Some(v.into());
23805 self
23806 }
23807
23808 /// Sets or clears the value of [runtime_project_attachment][crate::model::CreateRuntimeProjectAttachmentRequest::runtime_project_attachment].
23809 ///
23810 /// # Example
23811 /// ```ignore,no_run
23812 /// # use google_cloud_apihub_v1::model::CreateRuntimeProjectAttachmentRequest;
23813 /// use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
23814 /// let x = CreateRuntimeProjectAttachmentRequest::new().set_or_clear_runtime_project_attachment(Some(RuntimeProjectAttachment::default()/* use setters */));
23815 /// let x = CreateRuntimeProjectAttachmentRequest::new().set_or_clear_runtime_project_attachment(None::<RuntimeProjectAttachment>);
23816 /// ```
23817 pub fn set_or_clear_runtime_project_attachment<T>(mut self, v: std::option::Option<T>) -> Self
23818 where
23819 T: std::convert::Into<crate::model::RuntimeProjectAttachment>,
23820 {
23821 self.runtime_project_attachment = v.map(|x| x.into());
23822 self
23823 }
23824}
23825
23826impl wkt::message::Message for CreateRuntimeProjectAttachmentRequest {
23827 fn typename() -> &'static str {
23828 "type.googleapis.com/google.cloud.apihub.v1.CreateRuntimeProjectAttachmentRequest"
23829 }
23830}
23831
23832/// The
23833/// [GetRuntimeProjectAttachment][google.cloud.apihub.v1.RuntimeProjectAttachmentService.GetRuntimeProjectAttachment]
23834/// method's request.
23835///
23836/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.GetRuntimeProjectAttachment]: crate::client::RuntimeProjectAttachmentService::get_runtime_project_attachment
23837#[derive(Clone, Default, PartialEq)]
23838#[non_exhaustive]
23839pub struct GetRuntimeProjectAttachmentRequest {
23840 /// Required. The name of the API resource to retrieve.
23841 /// Format:
23842 /// `projects/{project}/locations/{location}/runtimeProjectAttachments/{runtime_project_attachment}`
23843 pub name: std::string::String,
23844
23845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23846}
23847
23848impl GetRuntimeProjectAttachmentRequest {
23849 pub fn new() -> Self {
23850 std::default::Default::default()
23851 }
23852
23853 /// Sets the value of [name][crate::model::GetRuntimeProjectAttachmentRequest::name].
23854 ///
23855 /// # Example
23856 /// ```ignore,no_run
23857 /// # use google_cloud_apihub_v1::model::GetRuntimeProjectAttachmentRequest;
23858 /// let x = GetRuntimeProjectAttachmentRequest::new().set_name("example");
23859 /// ```
23860 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23861 self.name = v.into();
23862 self
23863 }
23864}
23865
23866impl wkt::message::Message for GetRuntimeProjectAttachmentRequest {
23867 fn typename() -> &'static str {
23868 "type.googleapis.com/google.cloud.apihub.v1.GetRuntimeProjectAttachmentRequest"
23869 }
23870}
23871
23872/// The
23873/// [ListRuntimeProjectAttachments][google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]
23874/// method's request.
23875///
23876/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]: crate::client::RuntimeProjectAttachmentService::list_runtime_project_attachments
23877#[derive(Clone, Default, PartialEq)]
23878#[non_exhaustive]
23879pub struct ListRuntimeProjectAttachmentsRequest {
23880 /// Required. The parent, which owns this collection of runtime project
23881 /// attachments. Format: `projects/{project}/locations/{location}`
23882 pub parent: std::string::String,
23883
23884 /// Optional. The maximum number of runtime project attachments to return. The
23885 /// service may return fewer than this value. If unspecified, at most 50
23886 /// runtime project attachments will be returned. The maximum value is 1000;
23887 /// values above 1000 will be coerced to 1000.
23888 pub page_size: i32,
23889
23890 /// Optional. A page token, received from a previous
23891 /// `ListRuntimeProjectAttachments` call. Provide this to retrieve the
23892 /// subsequent page.
23893 ///
23894 /// When paginating, all other parameters (except page_size) provided to
23895 /// `ListRuntimeProjectAttachments` must match the call that provided the page
23896 /// token.
23897 pub page_token: std::string::String,
23898
23899 /// Optional. An expression that filters the list of RuntimeProjectAttachments.
23900 ///
23901 /// A filter expression consists of a field name, a comparison
23902 /// operator, and a value for filtering. The value must be a string. All
23903 /// standard operators as documented at <https://google.aip.dev/160> are
23904 /// supported.
23905 ///
23906 /// The following fields in the `RuntimeProjectAttachment` are eligible for
23907 /// filtering:
23908 ///
23909 /// * `name` - The name of the RuntimeProjectAttachment.
23910 /// * `create_time` - The time at which the RuntimeProjectAttachment was
23911 /// created. The value should be in the
23912 /// (RFC3339)[<https://tools.ietf.org/html/rfc3339>] format.
23913 /// * `runtime_project` - The Google cloud project associated with the
23914 /// RuntimeProjectAttachment.
23915 pub filter: std::string::String,
23916
23917 /// Optional. Hint for how to order the results.
23918 pub order_by: std::string::String,
23919
23920 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23921}
23922
23923impl ListRuntimeProjectAttachmentsRequest {
23924 pub fn new() -> Self {
23925 std::default::Default::default()
23926 }
23927
23928 /// Sets the value of [parent][crate::model::ListRuntimeProjectAttachmentsRequest::parent].
23929 ///
23930 /// # Example
23931 /// ```ignore,no_run
23932 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsRequest;
23933 /// let x = ListRuntimeProjectAttachmentsRequest::new().set_parent("example");
23934 /// ```
23935 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23936 self.parent = v.into();
23937 self
23938 }
23939
23940 /// Sets the value of [page_size][crate::model::ListRuntimeProjectAttachmentsRequest::page_size].
23941 ///
23942 /// # Example
23943 /// ```ignore,no_run
23944 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsRequest;
23945 /// let x = ListRuntimeProjectAttachmentsRequest::new().set_page_size(42);
23946 /// ```
23947 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23948 self.page_size = v.into();
23949 self
23950 }
23951
23952 /// Sets the value of [page_token][crate::model::ListRuntimeProjectAttachmentsRequest::page_token].
23953 ///
23954 /// # Example
23955 /// ```ignore,no_run
23956 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsRequest;
23957 /// let x = ListRuntimeProjectAttachmentsRequest::new().set_page_token("example");
23958 /// ```
23959 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23960 self.page_token = v.into();
23961 self
23962 }
23963
23964 /// Sets the value of [filter][crate::model::ListRuntimeProjectAttachmentsRequest::filter].
23965 ///
23966 /// # Example
23967 /// ```ignore,no_run
23968 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsRequest;
23969 /// let x = ListRuntimeProjectAttachmentsRequest::new().set_filter("example");
23970 /// ```
23971 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23972 self.filter = v.into();
23973 self
23974 }
23975
23976 /// Sets the value of [order_by][crate::model::ListRuntimeProjectAttachmentsRequest::order_by].
23977 ///
23978 /// # Example
23979 /// ```ignore,no_run
23980 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsRequest;
23981 /// let x = ListRuntimeProjectAttachmentsRequest::new().set_order_by("example");
23982 /// ```
23983 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23984 self.order_by = v.into();
23985 self
23986 }
23987}
23988
23989impl wkt::message::Message for ListRuntimeProjectAttachmentsRequest {
23990 fn typename() -> &'static str {
23991 "type.googleapis.com/google.cloud.apihub.v1.ListRuntimeProjectAttachmentsRequest"
23992 }
23993}
23994
23995/// The
23996/// [ListRuntimeProjectAttachments][google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]
23997/// method's response.
23998///
23999/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]: crate::client::RuntimeProjectAttachmentService::list_runtime_project_attachments
24000#[derive(Clone, Default, PartialEq)]
24001#[non_exhaustive]
24002pub struct ListRuntimeProjectAttachmentsResponse {
24003 /// List of runtime project attachments.
24004 pub runtime_project_attachments: std::vec::Vec<crate::model::RuntimeProjectAttachment>,
24005
24006 /// A token, which can be sent as `page_token` to retrieve the next page.
24007 /// If this field is omitted, there are no subsequent pages.
24008 pub next_page_token: std::string::String,
24009
24010 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24011}
24012
24013impl ListRuntimeProjectAttachmentsResponse {
24014 pub fn new() -> Self {
24015 std::default::Default::default()
24016 }
24017
24018 /// Sets the value of [runtime_project_attachments][crate::model::ListRuntimeProjectAttachmentsResponse::runtime_project_attachments].
24019 ///
24020 /// # Example
24021 /// ```ignore,no_run
24022 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsResponse;
24023 /// use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24024 /// let x = ListRuntimeProjectAttachmentsResponse::new()
24025 /// .set_runtime_project_attachments([
24026 /// RuntimeProjectAttachment::default()/* use setters */,
24027 /// RuntimeProjectAttachment::default()/* use (different) setters */,
24028 /// ]);
24029 /// ```
24030 pub fn set_runtime_project_attachments<T, V>(mut self, v: T) -> Self
24031 where
24032 T: std::iter::IntoIterator<Item = V>,
24033 V: std::convert::Into<crate::model::RuntimeProjectAttachment>,
24034 {
24035 use std::iter::Iterator;
24036 self.runtime_project_attachments = v.into_iter().map(|i| i.into()).collect();
24037 self
24038 }
24039
24040 /// Sets the value of [next_page_token][crate::model::ListRuntimeProjectAttachmentsResponse::next_page_token].
24041 ///
24042 /// # Example
24043 /// ```ignore,no_run
24044 /// # use google_cloud_apihub_v1::model::ListRuntimeProjectAttachmentsResponse;
24045 /// let x = ListRuntimeProjectAttachmentsResponse::new().set_next_page_token("example");
24046 /// ```
24047 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24048 self.next_page_token = v.into();
24049 self
24050 }
24051}
24052
24053impl wkt::message::Message for ListRuntimeProjectAttachmentsResponse {
24054 fn typename() -> &'static str {
24055 "type.googleapis.com/google.cloud.apihub.v1.ListRuntimeProjectAttachmentsResponse"
24056 }
24057}
24058
24059#[doc(hidden)]
24060impl google_cloud_gax::paginator::internal::PageableResponse
24061 for ListRuntimeProjectAttachmentsResponse
24062{
24063 type PageItem = crate::model::RuntimeProjectAttachment;
24064
24065 fn items(self) -> std::vec::Vec<Self::PageItem> {
24066 self.runtime_project_attachments
24067 }
24068
24069 fn next_page_token(&self) -> std::string::String {
24070 use std::clone::Clone;
24071 self.next_page_token.clone()
24072 }
24073}
24074
24075/// The
24076/// [DeleteRuntimeProjectAttachment][google.cloud.apihub.v1.RuntimeProjectAttachmentService.DeleteRuntimeProjectAttachment]
24077/// method's request.
24078///
24079/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.DeleteRuntimeProjectAttachment]: crate::client::RuntimeProjectAttachmentService::delete_runtime_project_attachment
24080#[derive(Clone, Default, PartialEq)]
24081#[non_exhaustive]
24082pub struct DeleteRuntimeProjectAttachmentRequest {
24083 /// Required. The name of the Runtime Project Attachment to delete.
24084 /// Format:
24085 /// `projects/{project}/locations/{location}/runtimeProjectAttachments/{runtime_project_attachment}`
24086 pub name: std::string::String,
24087
24088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24089}
24090
24091impl DeleteRuntimeProjectAttachmentRequest {
24092 pub fn new() -> Self {
24093 std::default::Default::default()
24094 }
24095
24096 /// Sets the value of [name][crate::model::DeleteRuntimeProjectAttachmentRequest::name].
24097 ///
24098 /// # Example
24099 /// ```ignore,no_run
24100 /// # use google_cloud_apihub_v1::model::DeleteRuntimeProjectAttachmentRequest;
24101 /// let x = DeleteRuntimeProjectAttachmentRequest::new().set_name("example");
24102 /// ```
24103 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24104 self.name = v.into();
24105 self
24106 }
24107}
24108
24109impl wkt::message::Message for DeleteRuntimeProjectAttachmentRequest {
24110 fn typename() -> &'static str {
24111 "type.googleapis.com/google.cloud.apihub.v1.DeleteRuntimeProjectAttachmentRequest"
24112 }
24113}
24114
24115/// The
24116/// [LookupRuntimeProjectAttachment][google.cloud.apihub.v1.RuntimeProjectAttachmentService.LookupRuntimeProjectAttachment]
24117/// method's request.
24118///
24119/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.LookupRuntimeProjectAttachment]: crate::client::RuntimeProjectAttachmentService::lookup_runtime_project_attachment
24120#[derive(Clone, Default, PartialEq)]
24121#[non_exhaustive]
24122pub struct LookupRuntimeProjectAttachmentRequest {
24123 /// Required. Runtime project ID to look up runtime project attachment for.
24124 /// Lookup happens across all regions. Expected format:
24125 /// `projects/{project}/locations/{location}`.
24126 pub name: std::string::String,
24127
24128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24129}
24130
24131impl LookupRuntimeProjectAttachmentRequest {
24132 pub fn new() -> Self {
24133 std::default::Default::default()
24134 }
24135
24136 /// Sets the value of [name][crate::model::LookupRuntimeProjectAttachmentRequest::name].
24137 ///
24138 /// # Example
24139 /// ```ignore,no_run
24140 /// # use google_cloud_apihub_v1::model::LookupRuntimeProjectAttachmentRequest;
24141 /// let x = LookupRuntimeProjectAttachmentRequest::new().set_name("example");
24142 /// ```
24143 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24144 self.name = v.into();
24145 self
24146 }
24147}
24148
24149impl wkt::message::Message for LookupRuntimeProjectAttachmentRequest {
24150 fn typename() -> &'static str {
24151 "type.googleapis.com/google.cloud.apihub.v1.LookupRuntimeProjectAttachmentRequest"
24152 }
24153}
24154
24155/// The
24156/// [ListRuntimeProjectAttachments][google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]
24157/// method's response.
24158///
24159/// [google.cloud.apihub.v1.RuntimeProjectAttachmentService.ListRuntimeProjectAttachments]: crate::client::RuntimeProjectAttachmentService::list_runtime_project_attachments
24160#[derive(Clone, Default, PartialEq)]
24161#[non_exhaustive]
24162pub struct LookupRuntimeProjectAttachmentResponse {
24163 /// Runtime project attachment for a project if exists, empty otherwise.
24164 pub runtime_project_attachment: std::option::Option<crate::model::RuntimeProjectAttachment>,
24165
24166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24167}
24168
24169impl LookupRuntimeProjectAttachmentResponse {
24170 pub fn new() -> Self {
24171 std::default::Default::default()
24172 }
24173
24174 /// Sets the value of [runtime_project_attachment][crate::model::LookupRuntimeProjectAttachmentResponse::runtime_project_attachment].
24175 ///
24176 /// # Example
24177 /// ```ignore,no_run
24178 /// # use google_cloud_apihub_v1::model::LookupRuntimeProjectAttachmentResponse;
24179 /// use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24180 /// let x = LookupRuntimeProjectAttachmentResponse::new().set_runtime_project_attachment(RuntimeProjectAttachment::default()/* use setters */);
24181 /// ```
24182 pub fn set_runtime_project_attachment<T>(mut self, v: T) -> Self
24183 where
24184 T: std::convert::Into<crate::model::RuntimeProjectAttachment>,
24185 {
24186 self.runtime_project_attachment = std::option::Option::Some(v.into());
24187 self
24188 }
24189
24190 /// Sets or clears the value of [runtime_project_attachment][crate::model::LookupRuntimeProjectAttachmentResponse::runtime_project_attachment].
24191 ///
24192 /// # Example
24193 /// ```ignore,no_run
24194 /// # use google_cloud_apihub_v1::model::LookupRuntimeProjectAttachmentResponse;
24195 /// use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24196 /// let x = LookupRuntimeProjectAttachmentResponse::new().set_or_clear_runtime_project_attachment(Some(RuntimeProjectAttachment::default()/* use setters */));
24197 /// let x = LookupRuntimeProjectAttachmentResponse::new().set_or_clear_runtime_project_attachment(None::<RuntimeProjectAttachment>);
24198 /// ```
24199 pub fn set_or_clear_runtime_project_attachment<T>(mut self, v: std::option::Option<T>) -> Self
24200 where
24201 T: std::convert::Into<crate::model::RuntimeProjectAttachment>,
24202 {
24203 self.runtime_project_attachment = v.map(|x| x.into());
24204 self
24205 }
24206}
24207
24208impl wkt::message::Message for LookupRuntimeProjectAttachmentResponse {
24209 fn typename() -> &'static str {
24210 "type.googleapis.com/google.cloud.apihub.v1.LookupRuntimeProjectAttachmentResponse"
24211 }
24212}
24213
24214/// Runtime project attachment represents an attachment from the runtime project
24215/// to the host project. Api Hub looks for deployments in the attached runtime
24216/// projects and creates corresponding resources in Api Hub for the discovered
24217/// deployments.
24218#[derive(Clone, Default, PartialEq)]
24219#[non_exhaustive]
24220pub struct RuntimeProjectAttachment {
24221 /// Identifier. The resource name of a runtime project attachment. Format:
24222 /// "projects/{project}/locations/{location}/runtimeProjectAttachments/{runtime_project_attachment}".
24223 pub name: std::string::String,
24224
24225 /// Required. Immutable. Google cloud project name in the format:
24226 /// "projects/abc" or "projects/123". As input, project name with either
24227 /// project id or number are accepted. As output, this field will contain
24228 /// project number.
24229 pub runtime_project: std::string::String,
24230
24231 /// Output only. Create time.
24232 pub create_time: std::option::Option<wkt::Timestamp>,
24233
24234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24235}
24236
24237impl RuntimeProjectAttachment {
24238 pub fn new() -> Self {
24239 std::default::Default::default()
24240 }
24241
24242 /// Sets the value of [name][crate::model::RuntimeProjectAttachment::name].
24243 ///
24244 /// # Example
24245 /// ```ignore,no_run
24246 /// # use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24247 /// let x = RuntimeProjectAttachment::new().set_name("example");
24248 /// ```
24249 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24250 self.name = v.into();
24251 self
24252 }
24253
24254 /// Sets the value of [runtime_project][crate::model::RuntimeProjectAttachment::runtime_project].
24255 ///
24256 /// # Example
24257 /// ```ignore,no_run
24258 /// # use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24259 /// let x = RuntimeProjectAttachment::new().set_runtime_project("example");
24260 /// ```
24261 pub fn set_runtime_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24262 self.runtime_project = v.into();
24263 self
24264 }
24265
24266 /// Sets the value of [create_time][crate::model::RuntimeProjectAttachment::create_time].
24267 ///
24268 /// # Example
24269 /// ```ignore,no_run
24270 /// # use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24271 /// use wkt::Timestamp;
24272 /// let x = RuntimeProjectAttachment::new().set_create_time(Timestamp::default()/* use setters */);
24273 /// ```
24274 pub fn set_create_time<T>(mut self, v: T) -> Self
24275 where
24276 T: std::convert::Into<wkt::Timestamp>,
24277 {
24278 self.create_time = std::option::Option::Some(v.into());
24279 self
24280 }
24281
24282 /// Sets or clears the value of [create_time][crate::model::RuntimeProjectAttachment::create_time].
24283 ///
24284 /// # Example
24285 /// ```ignore,no_run
24286 /// # use google_cloud_apihub_v1::model::RuntimeProjectAttachment;
24287 /// use wkt::Timestamp;
24288 /// let x = RuntimeProjectAttachment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
24289 /// let x = RuntimeProjectAttachment::new().set_or_clear_create_time(None::<Timestamp>);
24290 /// ```
24291 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
24292 where
24293 T: std::convert::Into<wkt::Timestamp>,
24294 {
24295 self.create_time = v.map(|x| x.into());
24296 self
24297 }
24298}
24299
24300impl wkt::message::Message for RuntimeProjectAttachment {
24301 fn typename() -> &'static str {
24302 "type.googleapis.com/google.cloud.apihub.v1.RuntimeProjectAttachment"
24303 }
24304}
24305
24306/// The type of the collect request.
24307///
24308/// # Working with unknown values
24309///
24310/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24311/// additional enum variants at any time. Adding new variants is not considered
24312/// a breaking change. Applications should write their code in anticipation of:
24313///
24314/// - New values appearing in future releases of the client library, **and**
24315/// - New values received dynamically, without application changes.
24316///
24317/// Please consult the [Working with enums] section in the user guide for some
24318/// guidelines.
24319///
24320/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24321#[derive(Clone, Debug, PartialEq)]
24322#[non_exhaustive]
24323pub enum CollectionType {
24324 /// The default value. This value is used if the collection type is omitted.
24325 Unspecified,
24326 /// The collection type is upsert. This should be used when an API is created
24327 /// or updated at the source.
24328 Upsert,
24329 /// The collection type is delete. This should be used when an API is deleted
24330 /// at the source.
24331 Delete,
24332 /// If set, the enum was initialized with an unknown value.
24333 ///
24334 /// Applications can examine the value using [CollectionType::value] or
24335 /// [CollectionType::name].
24336 UnknownValue(collection_type::UnknownValue),
24337}
24338
24339#[doc(hidden)]
24340pub mod collection_type {
24341 #[allow(unused_imports)]
24342 use super::*;
24343 #[derive(Clone, Debug, PartialEq)]
24344 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24345}
24346
24347impl CollectionType {
24348 /// Gets the enum value.
24349 ///
24350 /// Returns `None` if the enum contains an unknown value deserialized from
24351 /// the string representation of enums.
24352 pub fn value(&self) -> std::option::Option<i32> {
24353 match self {
24354 Self::Unspecified => std::option::Option::Some(0),
24355 Self::Upsert => std::option::Option::Some(1),
24356 Self::Delete => std::option::Option::Some(2),
24357 Self::UnknownValue(u) => u.0.value(),
24358 }
24359 }
24360
24361 /// Gets the enum value as a string.
24362 ///
24363 /// Returns `None` if the enum contains an unknown value deserialized from
24364 /// the integer representation of enums.
24365 pub fn name(&self) -> std::option::Option<&str> {
24366 match self {
24367 Self::Unspecified => std::option::Option::Some("COLLECTION_TYPE_UNSPECIFIED"),
24368 Self::Upsert => std::option::Option::Some("COLLECTION_TYPE_UPSERT"),
24369 Self::Delete => std::option::Option::Some("COLLECTION_TYPE_DELETE"),
24370 Self::UnknownValue(u) => u.0.name(),
24371 }
24372 }
24373}
24374
24375impl std::default::Default for CollectionType {
24376 fn default() -> Self {
24377 use std::convert::From;
24378 Self::from(0)
24379 }
24380}
24381
24382impl std::fmt::Display for CollectionType {
24383 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24384 wkt::internal::display_enum(f, self.name(), self.value())
24385 }
24386}
24387
24388impl std::convert::From<i32> for CollectionType {
24389 fn from(value: i32) -> Self {
24390 match value {
24391 0 => Self::Unspecified,
24392 1 => Self::Upsert,
24393 2 => Self::Delete,
24394 _ => Self::UnknownValue(collection_type::UnknownValue(
24395 wkt::internal::UnknownEnumValue::Integer(value),
24396 )),
24397 }
24398 }
24399}
24400
24401impl std::convert::From<&str> for CollectionType {
24402 fn from(value: &str) -> Self {
24403 use std::string::ToString;
24404 match value {
24405 "COLLECTION_TYPE_UNSPECIFIED" => Self::Unspecified,
24406 "COLLECTION_TYPE_UPSERT" => Self::Upsert,
24407 "COLLECTION_TYPE_DELETE" => Self::Delete,
24408 _ => Self::UnknownValue(collection_type::UnknownValue(
24409 wkt::internal::UnknownEnumValue::String(value.to_string()),
24410 )),
24411 }
24412 }
24413}
24414
24415impl serde::ser::Serialize for CollectionType {
24416 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24417 where
24418 S: serde::Serializer,
24419 {
24420 match self {
24421 Self::Unspecified => serializer.serialize_i32(0),
24422 Self::Upsert => serializer.serialize_i32(1),
24423 Self::Delete => serializer.serialize_i32(2),
24424 Self::UnknownValue(u) => u.0.serialize(serializer),
24425 }
24426 }
24427}
24428
24429impl<'de> serde::de::Deserialize<'de> for CollectionType {
24430 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24431 where
24432 D: serde::Deserializer<'de>,
24433 {
24434 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CollectionType>::new(
24435 ".google.cloud.apihub.v1.CollectionType",
24436 ))
24437 }
24438}
24439
24440/// Lint state represents success or failure for linting.
24441///
24442/// # Working with unknown values
24443///
24444/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24445/// additional enum variants at any time. Adding new variants is not considered
24446/// a breaking change. Applications should write their code in anticipation of:
24447///
24448/// - New values appearing in future releases of the client library, **and**
24449/// - New values received dynamically, without application changes.
24450///
24451/// Please consult the [Working with enums] section in the user guide for some
24452/// guidelines.
24453///
24454/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24455#[derive(Clone, Debug, PartialEq)]
24456#[non_exhaustive]
24457pub enum LintState {
24458 /// Lint state unspecified.
24459 Unspecified,
24460 /// Linting was completed successfully.
24461 Success,
24462 /// Linting encountered errors.
24463 Error,
24464 /// If set, the enum was initialized with an unknown value.
24465 ///
24466 /// Applications can examine the value using [LintState::value] or
24467 /// [LintState::name].
24468 UnknownValue(lint_state::UnknownValue),
24469}
24470
24471#[doc(hidden)]
24472pub mod lint_state {
24473 #[allow(unused_imports)]
24474 use super::*;
24475 #[derive(Clone, Debug, PartialEq)]
24476 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24477}
24478
24479impl LintState {
24480 /// Gets the enum value.
24481 ///
24482 /// Returns `None` if the enum contains an unknown value deserialized from
24483 /// the string representation of enums.
24484 pub fn value(&self) -> std::option::Option<i32> {
24485 match self {
24486 Self::Unspecified => std::option::Option::Some(0),
24487 Self::Success => std::option::Option::Some(1),
24488 Self::Error => std::option::Option::Some(2),
24489 Self::UnknownValue(u) => u.0.value(),
24490 }
24491 }
24492
24493 /// Gets the enum value as a string.
24494 ///
24495 /// Returns `None` if the enum contains an unknown value deserialized from
24496 /// the integer representation of enums.
24497 pub fn name(&self) -> std::option::Option<&str> {
24498 match self {
24499 Self::Unspecified => std::option::Option::Some("LINT_STATE_UNSPECIFIED"),
24500 Self::Success => std::option::Option::Some("LINT_STATE_SUCCESS"),
24501 Self::Error => std::option::Option::Some("LINT_STATE_ERROR"),
24502 Self::UnknownValue(u) => u.0.name(),
24503 }
24504 }
24505}
24506
24507impl std::default::Default for LintState {
24508 fn default() -> Self {
24509 use std::convert::From;
24510 Self::from(0)
24511 }
24512}
24513
24514impl std::fmt::Display for LintState {
24515 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24516 wkt::internal::display_enum(f, self.name(), self.value())
24517 }
24518}
24519
24520impl std::convert::From<i32> for LintState {
24521 fn from(value: i32) -> Self {
24522 match value {
24523 0 => Self::Unspecified,
24524 1 => Self::Success,
24525 2 => Self::Error,
24526 _ => Self::UnknownValue(lint_state::UnknownValue(
24527 wkt::internal::UnknownEnumValue::Integer(value),
24528 )),
24529 }
24530 }
24531}
24532
24533impl std::convert::From<&str> for LintState {
24534 fn from(value: &str) -> Self {
24535 use std::string::ToString;
24536 match value {
24537 "LINT_STATE_UNSPECIFIED" => Self::Unspecified,
24538 "LINT_STATE_SUCCESS" => Self::Success,
24539 "LINT_STATE_ERROR" => Self::Error,
24540 _ => Self::UnknownValue(lint_state::UnknownValue(
24541 wkt::internal::UnknownEnumValue::String(value.to_string()),
24542 )),
24543 }
24544 }
24545}
24546
24547impl serde::ser::Serialize for LintState {
24548 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24549 where
24550 S: serde::Serializer,
24551 {
24552 match self {
24553 Self::Unspecified => serializer.serialize_i32(0),
24554 Self::Success => serializer.serialize_i32(1),
24555 Self::Error => serializer.serialize_i32(2),
24556 Self::UnknownValue(u) => u.0.serialize(serializer),
24557 }
24558 }
24559}
24560
24561impl<'de> serde::de::Deserialize<'de> for LintState {
24562 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24563 where
24564 D: serde::Deserializer<'de>,
24565 {
24566 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LintState>::new(
24567 ".google.cloud.apihub.v1.LintState",
24568 ))
24569 }
24570}
24571
24572/// Enumeration of linter types.
24573///
24574/// # Working with unknown values
24575///
24576/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24577/// additional enum variants at any time. Adding new variants is not considered
24578/// a breaking change. Applications should write their code in anticipation of:
24579///
24580/// - New values appearing in future releases of the client library, **and**
24581/// - New values received dynamically, without application changes.
24582///
24583/// Please consult the [Working with enums] section in the user guide for some
24584/// guidelines.
24585///
24586/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24587#[derive(Clone, Debug, PartialEq)]
24588#[non_exhaustive]
24589pub enum Linter {
24590 /// Linter type unspecified.
24591 Unspecified,
24592 /// Linter type spectral.
24593 Spectral,
24594 /// Linter type other.
24595 Other,
24596 /// If set, the enum was initialized with an unknown value.
24597 ///
24598 /// Applications can examine the value using [Linter::value] or
24599 /// [Linter::name].
24600 UnknownValue(linter::UnknownValue),
24601}
24602
24603#[doc(hidden)]
24604pub mod linter {
24605 #[allow(unused_imports)]
24606 use super::*;
24607 #[derive(Clone, Debug, PartialEq)]
24608 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24609}
24610
24611impl Linter {
24612 /// Gets the enum value.
24613 ///
24614 /// Returns `None` if the enum contains an unknown value deserialized from
24615 /// the string representation of enums.
24616 pub fn value(&self) -> std::option::Option<i32> {
24617 match self {
24618 Self::Unspecified => std::option::Option::Some(0),
24619 Self::Spectral => std::option::Option::Some(1),
24620 Self::Other => std::option::Option::Some(2),
24621 Self::UnknownValue(u) => u.0.value(),
24622 }
24623 }
24624
24625 /// Gets the enum value as a string.
24626 ///
24627 /// Returns `None` if the enum contains an unknown value deserialized from
24628 /// the integer representation of enums.
24629 pub fn name(&self) -> std::option::Option<&str> {
24630 match self {
24631 Self::Unspecified => std::option::Option::Some("LINTER_UNSPECIFIED"),
24632 Self::Spectral => std::option::Option::Some("SPECTRAL"),
24633 Self::Other => std::option::Option::Some("OTHER"),
24634 Self::UnknownValue(u) => u.0.name(),
24635 }
24636 }
24637}
24638
24639impl std::default::Default for Linter {
24640 fn default() -> Self {
24641 use std::convert::From;
24642 Self::from(0)
24643 }
24644}
24645
24646impl std::fmt::Display for Linter {
24647 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24648 wkt::internal::display_enum(f, self.name(), self.value())
24649 }
24650}
24651
24652impl std::convert::From<i32> for Linter {
24653 fn from(value: i32) -> Self {
24654 match value {
24655 0 => Self::Unspecified,
24656 1 => Self::Spectral,
24657 2 => Self::Other,
24658 _ => Self::UnknownValue(linter::UnknownValue(
24659 wkt::internal::UnknownEnumValue::Integer(value),
24660 )),
24661 }
24662 }
24663}
24664
24665impl std::convert::From<&str> for Linter {
24666 fn from(value: &str) -> Self {
24667 use std::string::ToString;
24668 match value {
24669 "LINTER_UNSPECIFIED" => Self::Unspecified,
24670 "SPECTRAL" => Self::Spectral,
24671 "OTHER" => Self::Other,
24672 _ => Self::UnknownValue(linter::UnknownValue(
24673 wkt::internal::UnknownEnumValue::String(value.to_string()),
24674 )),
24675 }
24676 }
24677}
24678
24679impl serde::ser::Serialize for Linter {
24680 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24681 where
24682 S: serde::Serializer,
24683 {
24684 match self {
24685 Self::Unspecified => serializer.serialize_i32(0),
24686 Self::Spectral => serializer.serialize_i32(1),
24687 Self::Other => serializer.serialize_i32(2),
24688 Self::UnknownValue(u) => u.0.serialize(serializer),
24689 }
24690 }
24691}
24692
24693impl<'de> serde::de::Deserialize<'de> for Linter {
24694 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24695 where
24696 D: serde::Deserializer<'de>,
24697 {
24698 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Linter>::new(
24699 ".google.cloud.apihub.v1.Linter",
24700 ))
24701 }
24702}
24703
24704/// Severity of the issue.
24705///
24706/// # Working with unknown values
24707///
24708/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24709/// additional enum variants at any time. Adding new variants is not considered
24710/// a breaking change. Applications should write their code in anticipation of:
24711///
24712/// - New values appearing in future releases of the client library, **and**
24713/// - New values received dynamically, without application changes.
24714///
24715/// Please consult the [Working with enums] section in the user guide for some
24716/// guidelines.
24717///
24718/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24719#[derive(Clone, Debug, PartialEq)]
24720#[non_exhaustive]
24721pub enum Severity {
24722 /// Severity unspecified.
24723 Unspecified,
24724 /// Severity error.
24725 Error,
24726 /// Severity warning.
24727 Warning,
24728 /// Severity info.
24729 Info,
24730 /// Severity hint.
24731 Hint,
24732 /// If set, the enum was initialized with an unknown value.
24733 ///
24734 /// Applications can examine the value using [Severity::value] or
24735 /// [Severity::name].
24736 UnknownValue(severity::UnknownValue),
24737}
24738
24739#[doc(hidden)]
24740pub mod severity {
24741 #[allow(unused_imports)]
24742 use super::*;
24743 #[derive(Clone, Debug, PartialEq)]
24744 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24745}
24746
24747impl Severity {
24748 /// Gets the enum value.
24749 ///
24750 /// Returns `None` if the enum contains an unknown value deserialized from
24751 /// the string representation of enums.
24752 pub fn value(&self) -> std::option::Option<i32> {
24753 match self {
24754 Self::Unspecified => std::option::Option::Some(0),
24755 Self::Error => std::option::Option::Some(1),
24756 Self::Warning => std::option::Option::Some(2),
24757 Self::Info => std::option::Option::Some(3),
24758 Self::Hint => std::option::Option::Some(4),
24759 Self::UnknownValue(u) => u.0.value(),
24760 }
24761 }
24762
24763 /// Gets the enum value as a string.
24764 ///
24765 /// Returns `None` if the enum contains an unknown value deserialized from
24766 /// the integer representation of enums.
24767 pub fn name(&self) -> std::option::Option<&str> {
24768 match self {
24769 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
24770 Self::Error => std::option::Option::Some("SEVERITY_ERROR"),
24771 Self::Warning => std::option::Option::Some("SEVERITY_WARNING"),
24772 Self::Info => std::option::Option::Some("SEVERITY_INFO"),
24773 Self::Hint => std::option::Option::Some("SEVERITY_HINT"),
24774 Self::UnknownValue(u) => u.0.name(),
24775 }
24776 }
24777}
24778
24779impl std::default::Default for Severity {
24780 fn default() -> Self {
24781 use std::convert::From;
24782 Self::from(0)
24783 }
24784}
24785
24786impl std::fmt::Display for Severity {
24787 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24788 wkt::internal::display_enum(f, self.name(), self.value())
24789 }
24790}
24791
24792impl std::convert::From<i32> for Severity {
24793 fn from(value: i32) -> Self {
24794 match value {
24795 0 => Self::Unspecified,
24796 1 => Self::Error,
24797 2 => Self::Warning,
24798 3 => Self::Info,
24799 4 => Self::Hint,
24800 _ => Self::UnknownValue(severity::UnknownValue(
24801 wkt::internal::UnknownEnumValue::Integer(value),
24802 )),
24803 }
24804 }
24805}
24806
24807impl std::convert::From<&str> for Severity {
24808 fn from(value: &str) -> Self {
24809 use std::string::ToString;
24810 match value {
24811 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
24812 "SEVERITY_ERROR" => Self::Error,
24813 "SEVERITY_WARNING" => Self::Warning,
24814 "SEVERITY_INFO" => Self::Info,
24815 "SEVERITY_HINT" => Self::Hint,
24816 _ => Self::UnknownValue(severity::UnknownValue(
24817 wkt::internal::UnknownEnumValue::String(value.to_string()),
24818 )),
24819 }
24820 }
24821}
24822
24823impl serde::ser::Serialize for Severity {
24824 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24825 where
24826 S: serde::Serializer,
24827 {
24828 match self {
24829 Self::Unspecified => serializer.serialize_i32(0),
24830 Self::Error => serializer.serialize_i32(1),
24831 Self::Warning => serializer.serialize_i32(2),
24832 Self::Info => serializer.serialize_i32(3),
24833 Self::Hint => serializer.serialize_i32(4),
24834 Self::UnknownValue(u) => u.0.serialize(serializer),
24835 }
24836 }
24837}
24838
24839impl<'de> serde::de::Deserialize<'de> for Severity {
24840 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24841 where
24842 D: serde::Deserializer<'de>,
24843 {
24844 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
24845 ".google.cloud.apihub.v1.Severity",
24846 ))
24847 }
24848}
24849
24850/// AuthType represents the authentication type.
24851///
24852/// # Working with unknown values
24853///
24854/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24855/// additional enum variants at any time. Adding new variants is not considered
24856/// a breaking change. Applications should write their code in anticipation of:
24857///
24858/// - New values appearing in future releases of the client library, **and**
24859/// - New values received dynamically, without application changes.
24860///
24861/// Please consult the [Working with enums] section in the user guide for some
24862/// guidelines.
24863///
24864/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24865#[derive(Clone, Debug, PartialEq)]
24866#[non_exhaustive]
24867pub enum AuthType {
24868 /// Authentication type not specified.
24869 Unspecified,
24870 /// No authentication.
24871 NoAuth,
24872 /// Google service account authentication.
24873 GoogleServiceAccount,
24874 /// Username and password authentication.
24875 UserPassword,
24876 /// API Key authentication.
24877 ApiKey,
24878 /// Oauth 2.0 client credentials grant authentication.
24879 Oauth2ClientCredentials,
24880 /// If set, the enum was initialized with an unknown value.
24881 ///
24882 /// Applications can examine the value using [AuthType::value] or
24883 /// [AuthType::name].
24884 UnknownValue(auth_type::UnknownValue),
24885}
24886
24887#[doc(hidden)]
24888pub mod auth_type {
24889 #[allow(unused_imports)]
24890 use super::*;
24891 #[derive(Clone, Debug, PartialEq)]
24892 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24893}
24894
24895impl AuthType {
24896 /// Gets the enum value.
24897 ///
24898 /// Returns `None` if the enum contains an unknown value deserialized from
24899 /// the string representation of enums.
24900 pub fn value(&self) -> std::option::Option<i32> {
24901 match self {
24902 Self::Unspecified => std::option::Option::Some(0),
24903 Self::NoAuth => std::option::Option::Some(1),
24904 Self::GoogleServiceAccount => std::option::Option::Some(2),
24905 Self::UserPassword => std::option::Option::Some(3),
24906 Self::ApiKey => std::option::Option::Some(4),
24907 Self::Oauth2ClientCredentials => std::option::Option::Some(5),
24908 Self::UnknownValue(u) => u.0.value(),
24909 }
24910 }
24911
24912 /// Gets the enum value as a string.
24913 ///
24914 /// Returns `None` if the enum contains an unknown value deserialized from
24915 /// the integer representation of enums.
24916 pub fn name(&self) -> std::option::Option<&str> {
24917 match self {
24918 Self::Unspecified => std::option::Option::Some("AUTH_TYPE_UNSPECIFIED"),
24919 Self::NoAuth => std::option::Option::Some("NO_AUTH"),
24920 Self::GoogleServiceAccount => std::option::Option::Some("GOOGLE_SERVICE_ACCOUNT"),
24921 Self::UserPassword => std::option::Option::Some("USER_PASSWORD"),
24922 Self::ApiKey => std::option::Option::Some("API_KEY"),
24923 Self::Oauth2ClientCredentials => std::option::Option::Some("OAUTH2_CLIENT_CREDENTIALS"),
24924 Self::UnknownValue(u) => u.0.name(),
24925 }
24926 }
24927}
24928
24929impl std::default::Default for AuthType {
24930 fn default() -> Self {
24931 use std::convert::From;
24932 Self::from(0)
24933 }
24934}
24935
24936impl std::fmt::Display for AuthType {
24937 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
24938 wkt::internal::display_enum(f, self.name(), self.value())
24939 }
24940}
24941
24942impl std::convert::From<i32> for AuthType {
24943 fn from(value: i32) -> Self {
24944 match value {
24945 0 => Self::Unspecified,
24946 1 => Self::NoAuth,
24947 2 => Self::GoogleServiceAccount,
24948 3 => Self::UserPassword,
24949 4 => Self::ApiKey,
24950 5 => Self::Oauth2ClientCredentials,
24951 _ => Self::UnknownValue(auth_type::UnknownValue(
24952 wkt::internal::UnknownEnumValue::Integer(value),
24953 )),
24954 }
24955 }
24956}
24957
24958impl std::convert::From<&str> for AuthType {
24959 fn from(value: &str) -> Self {
24960 use std::string::ToString;
24961 match value {
24962 "AUTH_TYPE_UNSPECIFIED" => Self::Unspecified,
24963 "NO_AUTH" => Self::NoAuth,
24964 "GOOGLE_SERVICE_ACCOUNT" => Self::GoogleServiceAccount,
24965 "USER_PASSWORD" => Self::UserPassword,
24966 "API_KEY" => Self::ApiKey,
24967 "OAUTH2_CLIENT_CREDENTIALS" => Self::Oauth2ClientCredentials,
24968 _ => Self::UnknownValue(auth_type::UnknownValue(
24969 wkt::internal::UnknownEnumValue::String(value.to_string()),
24970 )),
24971 }
24972 }
24973}
24974
24975impl serde::ser::Serialize for AuthType {
24976 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24977 where
24978 S: serde::Serializer,
24979 {
24980 match self {
24981 Self::Unspecified => serializer.serialize_i32(0),
24982 Self::NoAuth => serializer.serialize_i32(1),
24983 Self::GoogleServiceAccount => serializer.serialize_i32(2),
24984 Self::UserPassword => serializer.serialize_i32(3),
24985 Self::ApiKey => serializer.serialize_i32(4),
24986 Self::Oauth2ClientCredentials => serializer.serialize_i32(5),
24987 Self::UnknownValue(u) => u.0.serialize(serializer),
24988 }
24989 }
24990}
24991
24992impl<'de> serde::de::Deserialize<'de> for AuthType {
24993 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24994 where
24995 D: serde::Deserializer<'de>,
24996 {
24997 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthType>::new(
24998 ".google.cloud.apihub.v1.AuthType",
24999 ))
25000 }
25001}
25002
25003/// Enum for the plugin category.
25004///
25005/// # Working with unknown values
25006///
25007/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25008/// additional enum variants at any time. Adding new variants is not considered
25009/// a breaking change. Applications should write their code in anticipation of:
25010///
25011/// - New values appearing in future releases of the client library, **and**
25012/// - New values received dynamically, without application changes.
25013///
25014/// Please consult the [Working with enums] section in the user guide for some
25015/// guidelines.
25016///
25017/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25018#[derive(Clone, Debug, PartialEq)]
25019#[non_exhaustive]
25020pub enum PluginCategory {
25021 /// Default unspecified plugin type.
25022 Unspecified,
25023 /// API_GATEWAY plugins represent plugins built for API Gateways like Apigee.
25024 ApiGateway,
25025 /// API_PRODUCER plugins represent plugins built for API Producers like
25026 /// Cloud Run, Application Integration etc.
25027 ApiProducer,
25028 /// If set, the enum was initialized with an unknown value.
25029 ///
25030 /// Applications can examine the value using [PluginCategory::value] or
25031 /// [PluginCategory::name].
25032 UnknownValue(plugin_category::UnknownValue),
25033}
25034
25035#[doc(hidden)]
25036pub mod plugin_category {
25037 #[allow(unused_imports)]
25038 use super::*;
25039 #[derive(Clone, Debug, PartialEq)]
25040 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25041}
25042
25043impl PluginCategory {
25044 /// Gets the enum value.
25045 ///
25046 /// Returns `None` if the enum contains an unknown value deserialized from
25047 /// the string representation of enums.
25048 pub fn value(&self) -> std::option::Option<i32> {
25049 match self {
25050 Self::Unspecified => std::option::Option::Some(0),
25051 Self::ApiGateway => std::option::Option::Some(1),
25052 Self::ApiProducer => std::option::Option::Some(2),
25053 Self::UnknownValue(u) => u.0.value(),
25054 }
25055 }
25056
25057 /// Gets the enum value as a string.
25058 ///
25059 /// Returns `None` if the enum contains an unknown value deserialized from
25060 /// the integer representation of enums.
25061 pub fn name(&self) -> std::option::Option<&str> {
25062 match self {
25063 Self::Unspecified => std::option::Option::Some("PLUGIN_CATEGORY_UNSPECIFIED"),
25064 Self::ApiGateway => std::option::Option::Some("API_GATEWAY"),
25065 Self::ApiProducer => std::option::Option::Some("API_PRODUCER"),
25066 Self::UnknownValue(u) => u.0.name(),
25067 }
25068 }
25069}
25070
25071impl std::default::Default for PluginCategory {
25072 fn default() -> Self {
25073 use std::convert::From;
25074 Self::from(0)
25075 }
25076}
25077
25078impl std::fmt::Display for PluginCategory {
25079 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25080 wkt::internal::display_enum(f, self.name(), self.value())
25081 }
25082}
25083
25084impl std::convert::From<i32> for PluginCategory {
25085 fn from(value: i32) -> Self {
25086 match value {
25087 0 => Self::Unspecified,
25088 1 => Self::ApiGateway,
25089 2 => Self::ApiProducer,
25090 _ => Self::UnknownValue(plugin_category::UnknownValue(
25091 wkt::internal::UnknownEnumValue::Integer(value),
25092 )),
25093 }
25094 }
25095}
25096
25097impl std::convert::From<&str> for PluginCategory {
25098 fn from(value: &str) -> Self {
25099 use std::string::ToString;
25100 match value {
25101 "PLUGIN_CATEGORY_UNSPECIFIED" => Self::Unspecified,
25102 "API_GATEWAY" => Self::ApiGateway,
25103 "API_PRODUCER" => Self::ApiProducer,
25104 _ => Self::UnknownValue(plugin_category::UnknownValue(
25105 wkt::internal::UnknownEnumValue::String(value.to_string()),
25106 )),
25107 }
25108 }
25109}
25110
25111impl serde::ser::Serialize for PluginCategory {
25112 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25113 where
25114 S: serde::Serializer,
25115 {
25116 match self {
25117 Self::Unspecified => serializer.serialize_i32(0),
25118 Self::ApiGateway => serializer.serialize_i32(1),
25119 Self::ApiProducer => serializer.serialize_i32(2),
25120 Self::UnknownValue(u) => u.0.serialize(serializer),
25121 }
25122 }
25123}
25124
25125impl<'de> serde::de::Deserialize<'de> for PluginCategory {
25126 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25127 where
25128 D: serde::Deserializer<'de>,
25129 {
25130 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PluginCategory>::new(
25131 ".google.cloud.apihub.v1.PluginCategory",
25132 ))
25133 }
25134}
25135
25136/// Enum for the action type.
25137///
25138/// # Working with unknown values
25139///
25140/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25141/// additional enum variants at any time. Adding new variants is not considered
25142/// a breaking change. Applications should write their code in anticipation of:
25143///
25144/// - New values appearing in future releases of the client library, **and**
25145/// - New values received dynamically, without application changes.
25146///
25147/// Please consult the [Working with enums] section in the user guide for some
25148/// guidelines.
25149///
25150/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25151#[derive(Clone, Debug, PartialEq)]
25152#[non_exhaustive]
25153pub enum ActionType {
25154 /// Default unspecified action type.
25155 Unspecified,
25156 /// Action type for sync metadata.
25157 SyncMetadata,
25158 /// Action type for sync runtime data.
25159 SyncRuntimeData,
25160 /// If set, the enum was initialized with an unknown value.
25161 ///
25162 /// Applications can examine the value using [ActionType::value] or
25163 /// [ActionType::name].
25164 UnknownValue(action_type::UnknownValue),
25165}
25166
25167#[doc(hidden)]
25168pub mod action_type {
25169 #[allow(unused_imports)]
25170 use super::*;
25171 #[derive(Clone, Debug, PartialEq)]
25172 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25173}
25174
25175impl ActionType {
25176 /// Gets the enum value.
25177 ///
25178 /// Returns `None` if the enum contains an unknown value deserialized from
25179 /// the string representation of enums.
25180 pub fn value(&self) -> std::option::Option<i32> {
25181 match self {
25182 Self::Unspecified => std::option::Option::Some(0),
25183 Self::SyncMetadata => std::option::Option::Some(1),
25184 Self::SyncRuntimeData => std::option::Option::Some(2),
25185 Self::UnknownValue(u) => u.0.value(),
25186 }
25187 }
25188
25189 /// Gets the enum value as a string.
25190 ///
25191 /// Returns `None` if the enum contains an unknown value deserialized from
25192 /// the integer representation of enums.
25193 pub fn name(&self) -> std::option::Option<&str> {
25194 match self {
25195 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
25196 Self::SyncMetadata => std::option::Option::Some("SYNC_METADATA"),
25197 Self::SyncRuntimeData => std::option::Option::Some("SYNC_RUNTIME_DATA"),
25198 Self::UnknownValue(u) => u.0.name(),
25199 }
25200 }
25201}
25202
25203impl std::default::Default for ActionType {
25204 fn default() -> Self {
25205 use std::convert::From;
25206 Self::from(0)
25207 }
25208}
25209
25210impl std::fmt::Display for ActionType {
25211 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25212 wkt::internal::display_enum(f, self.name(), self.value())
25213 }
25214}
25215
25216impl std::convert::From<i32> for ActionType {
25217 fn from(value: i32) -> Self {
25218 match value {
25219 0 => Self::Unspecified,
25220 1 => Self::SyncMetadata,
25221 2 => Self::SyncRuntimeData,
25222 _ => Self::UnknownValue(action_type::UnknownValue(
25223 wkt::internal::UnknownEnumValue::Integer(value),
25224 )),
25225 }
25226 }
25227}
25228
25229impl std::convert::From<&str> for ActionType {
25230 fn from(value: &str) -> Self {
25231 use std::string::ToString;
25232 match value {
25233 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
25234 "SYNC_METADATA" => Self::SyncMetadata,
25235 "SYNC_RUNTIME_DATA" => Self::SyncRuntimeData,
25236 _ => Self::UnknownValue(action_type::UnknownValue(
25237 wkt::internal::UnknownEnumValue::String(value.to_string()),
25238 )),
25239 }
25240 }
25241}
25242
25243impl serde::ser::Serialize for ActionType {
25244 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25245 where
25246 S: serde::Serializer,
25247 {
25248 match self {
25249 Self::Unspecified => serializer.serialize_i32(0),
25250 Self::SyncMetadata => serializer.serialize_i32(1),
25251 Self::SyncRuntimeData => serializer.serialize_i32(2),
25252 Self::UnknownValue(u) => u.0.serialize(serializer),
25253 }
25254 }
25255}
25256
25257impl<'de> serde::de::Deserialize<'de> for ActionType {
25258 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25259 where
25260 D: serde::Deserializer<'de>,
25261 {
25262 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
25263 ".google.cloud.apihub.v1.ActionType",
25264 ))
25265 }
25266}
25267
25268/// Enum for the gateway type.
25269///
25270/// # Working with unknown values
25271///
25272/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25273/// additional enum variants at any time. Adding new variants is not considered
25274/// a breaking change. Applications should write their code in anticipation of:
25275///
25276/// - New values appearing in future releases of the client library, **and**
25277/// - New values received dynamically, without application changes.
25278///
25279/// Please consult the [Working with enums] section in the user guide for some
25280/// guidelines.
25281///
25282/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25283#[derive(Clone, Debug, PartialEq)]
25284#[non_exhaustive]
25285pub enum GatewayType {
25286 /// The gateway type is not specified.
25287 Unspecified,
25288 /// The gateway type is Apigee X and Hybrid.
25289 ApigeeXAndHybrid,
25290 /// The gateway type is Apigee Edge Public Cloud.
25291 ApigeeEdgePublicCloud,
25292 /// The gateway type is Apigee Edge Private Cloud.
25293 ApigeeEdgePrivateCloud,
25294 /// The gateway type is Cloud API Gateway.
25295 CloudApiGateway,
25296 /// The gateway type is Cloud Endpoints.
25297 CloudEndpoints,
25298 /// The gateway type is API Discovery.
25299 ApiDiscovery,
25300 /// The gateway type for any other types of gateways.
25301 Others,
25302 /// If set, the enum was initialized with an unknown value.
25303 ///
25304 /// Applications can examine the value using [GatewayType::value] or
25305 /// [GatewayType::name].
25306 UnknownValue(gateway_type::UnknownValue),
25307}
25308
25309#[doc(hidden)]
25310pub mod gateway_type {
25311 #[allow(unused_imports)]
25312 use super::*;
25313 #[derive(Clone, Debug, PartialEq)]
25314 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25315}
25316
25317impl GatewayType {
25318 /// Gets the enum value.
25319 ///
25320 /// Returns `None` if the enum contains an unknown value deserialized from
25321 /// the string representation of enums.
25322 pub fn value(&self) -> std::option::Option<i32> {
25323 match self {
25324 Self::Unspecified => std::option::Option::Some(0),
25325 Self::ApigeeXAndHybrid => std::option::Option::Some(1),
25326 Self::ApigeeEdgePublicCloud => std::option::Option::Some(2),
25327 Self::ApigeeEdgePrivateCloud => std::option::Option::Some(3),
25328 Self::CloudApiGateway => std::option::Option::Some(4),
25329 Self::CloudEndpoints => std::option::Option::Some(5),
25330 Self::ApiDiscovery => std::option::Option::Some(6),
25331 Self::Others => std::option::Option::Some(7),
25332 Self::UnknownValue(u) => u.0.value(),
25333 }
25334 }
25335
25336 /// Gets the enum value as a string.
25337 ///
25338 /// Returns `None` if the enum contains an unknown value deserialized from
25339 /// the integer representation of enums.
25340 pub fn name(&self) -> std::option::Option<&str> {
25341 match self {
25342 Self::Unspecified => std::option::Option::Some("GATEWAY_TYPE_UNSPECIFIED"),
25343 Self::ApigeeXAndHybrid => std::option::Option::Some("APIGEE_X_AND_HYBRID"),
25344 Self::ApigeeEdgePublicCloud => std::option::Option::Some("APIGEE_EDGE_PUBLIC_CLOUD"),
25345 Self::ApigeeEdgePrivateCloud => std::option::Option::Some("APIGEE_EDGE_PRIVATE_CLOUD"),
25346 Self::CloudApiGateway => std::option::Option::Some("CLOUD_API_GATEWAY"),
25347 Self::CloudEndpoints => std::option::Option::Some("CLOUD_ENDPOINTS"),
25348 Self::ApiDiscovery => std::option::Option::Some("API_DISCOVERY"),
25349 Self::Others => std::option::Option::Some("OTHERS"),
25350 Self::UnknownValue(u) => u.0.name(),
25351 }
25352 }
25353}
25354
25355impl std::default::Default for GatewayType {
25356 fn default() -> Self {
25357 use std::convert::From;
25358 Self::from(0)
25359 }
25360}
25361
25362impl std::fmt::Display for GatewayType {
25363 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25364 wkt::internal::display_enum(f, self.name(), self.value())
25365 }
25366}
25367
25368impl std::convert::From<i32> for GatewayType {
25369 fn from(value: i32) -> Self {
25370 match value {
25371 0 => Self::Unspecified,
25372 1 => Self::ApigeeXAndHybrid,
25373 2 => Self::ApigeeEdgePublicCloud,
25374 3 => Self::ApigeeEdgePrivateCloud,
25375 4 => Self::CloudApiGateway,
25376 5 => Self::CloudEndpoints,
25377 6 => Self::ApiDiscovery,
25378 7 => Self::Others,
25379 _ => Self::UnknownValue(gateway_type::UnknownValue(
25380 wkt::internal::UnknownEnumValue::Integer(value),
25381 )),
25382 }
25383 }
25384}
25385
25386impl std::convert::From<&str> for GatewayType {
25387 fn from(value: &str) -> Self {
25388 use std::string::ToString;
25389 match value {
25390 "GATEWAY_TYPE_UNSPECIFIED" => Self::Unspecified,
25391 "APIGEE_X_AND_HYBRID" => Self::ApigeeXAndHybrid,
25392 "APIGEE_EDGE_PUBLIC_CLOUD" => Self::ApigeeEdgePublicCloud,
25393 "APIGEE_EDGE_PRIVATE_CLOUD" => Self::ApigeeEdgePrivateCloud,
25394 "CLOUD_API_GATEWAY" => Self::CloudApiGateway,
25395 "CLOUD_ENDPOINTS" => Self::CloudEndpoints,
25396 "API_DISCOVERY" => Self::ApiDiscovery,
25397 "OTHERS" => Self::Others,
25398 _ => Self::UnknownValue(gateway_type::UnknownValue(
25399 wkt::internal::UnknownEnumValue::String(value.to_string()),
25400 )),
25401 }
25402 }
25403}
25404
25405impl serde::ser::Serialize for GatewayType {
25406 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25407 where
25408 S: serde::Serializer,
25409 {
25410 match self {
25411 Self::Unspecified => serializer.serialize_i32(0),
25412 Self::ApigeeXAndHybrid => serializer.serialize_i32(1),
25413 Self::ApigeeEdgePublicCloud => serializer.serialize_i32(2),
25414 Self::ApigeeEdgePrivateCloud => serializer.serialize_i32(3),
25415 Self::CloudApiGateway => serializer.serialize_i32(4),
25416 Self::CloudEndpoints => serializer.serialize_i32(5),
25417 Self::ApiDiscovery => serializer.serialize_i32(6),
25418 Self::Others => serializer.serialize_i32(7),
25419 Self::UnknownValue(u) => u.0.serialize(serializer),
25420 }
25421 }
25422}
25423
25424impl<'de> serde::de::Deserialize<'de> for GatewayType {
25425 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25426 where
25427 D: serde::Deserializer<'de>,
25428 {
25429 deserializer.deserialize_any(wkt::internal::EnumVisitor::<GatewayType>::new(
25430 ".google.cloud.apihub.v1.GatewayType",
25431 ))
25432 }
25433}
25434
25435/// Enum for the curation type.
25436///
25437/// # Working with unknown values
25438///
25439/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25440/// additional enum variants at any time. Adding new variants is not considered
25441/// a breaking change. Applications should write their code in anticipation of:
25442///
25443/// - New values appearing in future releases of the client library, **and**
25444/// - New values received dynamically, without application changes.
25445///
25446/// Please consult the [Working with enums] section in the user guide for some
25447/// guidelines.
25448///
25449/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25450#[derive(Clone, Debug, PartialEq)]
25451#[non_exhaustive]
25452pub enum CurationType {
25453 /// Default unspecified curation type.
25454 Unspecified,
25455 /// Default curation for API metadata will be used.
25456 DefaultCurationForApiMetadata,
25457 /// Custom curation for API metadata will be used.
25458 CustomCurationForApiMetadata,
25459 /// If set, the enum was initialized with an unknown value.
25460 ///
25461 /// Applications can examine the value using [CurationType::value] or
25462 /// [CurationType::name].
25463 UnknownValue(curation_type::UnknownValue),
25464}
25465
25466#[doc(hidden)]
25467pub mod curation_type {
25468 #[allow(unused_imports)]
25469 use super::*;
25470 #[derive(Clone, Debug, PartialEq)]
25471 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25472}
25473
25474impl CurationType {
25475 /// Gets the enum value.
25476 ///
25477 /// Returns `None` if the enum contains an unknown value deserialized from
25478 /// the string representation of enums.
25479 pub fn value(&self) -> std::option::Option<i32> {
25480 match self {
25481 Self::Unspecified => std::option::Option::Some(0),
25482 Self::DefaultCurationForApiMetadata => std::option::Option::Some(1),
25483 Self::CustomCurationForApiMetadata => std::option::Option::Some(2),
25484 Self::UnknownValue(u) => u.0.value(),
25485 }
25486 }
25487
25488 /// Gets the enum value as a string.
25489 ///
25490 /// Returns `None` if the enum contains an unknown value deserialized from
25491 /// the integer representation of enums.
25492 pub fn name(&self) -> std::option::Option<&str> {
25493 match self {
25494 Self::Unspecified => std::option::Option::Some("CURATION_TYPE_UNSPECIFIED"),
25495 Self::DefaultCurationForApiMetadata => {
25496 std::option::Option::Some("DEFAULT_CURATION_FOR_API_METADATA")
25497 }
25498 Self::CustomCurationForApiMetadata => {
25499 std::option::Option::Some("CUSTOM_CURATION_FOR_API_METADATA")
25500 }
25501 Self::UnknownValue(u) => u.0.name(),
25502 }
25503 }
25504}
25505
25506impl std::default::Default for CurationType {
25507 fn default() -> Self {
25508 use std::convert::From;
25509 Self::from(0)
25510 }
25511}
25512
25513impl std::fmt::Display for CurationType {
25514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25515 wkt::internal::display_enum(f, self.name(), self.value())
25516 }
25517}
25518
25519impl std::convert::From<i32> for CurationType {
25520 fn from(value: i32) -> Self {
25521 match value {
25522 0 => Self::Unspecified,
25523 1 => Self::DefaultCurationForApiMetadata,
25524 2 => Self::CustomCurationForApiMetadata,
25525 _ => Self::UnknownValue(curation_type::UnknownValue(
25526 wkt::internal::UnknownEnumValue::Integer(value),
25527 )),
25528 }
25529 }
25530}
25531
25532impl std::convert::From<&str> for CurationType {
25533 fn from(value: &str) -> Self {
25534 use std::string::ToString;
25535 match value {
25536 "CURATION_TYPE_UNSPECIFIED" => Self::Unspecified,
25537 "DEFAULT_CURATION_FOR_API_METADATA" => Self::DefaultCurationForApiMetadata,
25538 "CUSTOM_CURATION_FOR_API_METADATA" => Self::CustomCurationForApiMetadata,
25539 _ => Self::UnknownValue(curation_type::UnknownValue(
25540 wkt::internal::UnknownEnumValue::String(value.to_string()),
25541 )),
25542 }
25543 }
25544}
25545
25546impl serde::ser::Serialize for CurationType {
25547 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25548 where
25549 S: serde::Serializer,
25550 {
25551 match self {
25552 Self::Unspecified => serializer.serialize_i32(0),
25553 Self::DefaultCurationForApiMetadata => serializer.serialize_i32(1),
25554 Self::CustomCurationForApiMetadata => serializer.serialize_i32(2),
25555 Self::UnknownValue(u) => u.0.serialize(serializer),
25556 }
25557 }
25558}
25559
25560impl<'de> serde::de::Deserialize<'de> for CurationType {
25561 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25562 where
25563 D: serde::Deserializer<'de>,
25564 {
25565 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CurationType>::new(
25566 ".google.cloud.apihub.v1.CurationType",
25567 ))
25568 }
25569}