Skip to main content

google_cloud_apigateway_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_longrunning;
25extern crate google_cloud_lro;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// An API that can be served by one or more Gateways.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Api {
41    /// Output only. Resource name of the API.
42    /// Format: projects/{project}/locations/global/apis/{api}
43    pub name: std::string::String,
44
45    /// Output only. Created time.
46    pub create_time: std::option::Option<wkt::Timestamp>,
47
48    /// Output only. Updated time.
49    pub update_time: std::option::Option<wkt::Timestamp>,
50
51    /// Optional. Resource labels to represent user-provided metadata.
52    /// Refer to cloud documentation on labels for more details.
53    /// <https://cloud.google.com/compute/docs/labeling-resources>
54    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
55
56    /// Optional. Display name.
57    pub display_name: std::string::String,
58
59    /// Optional. Immutable. The name of a Google Managed Service (
60    /// <https://cloud.google.com/service-infrastructure/docs/glossary#managed>). If
61    /// not specified, a new Service will automatically be created in the same
62    /// project as this API.
63    pub managed_service: std::string::String,
64
65    /// Output only. State of the API.
66    pub state: crate::model::api::State,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl Api {
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [name][crate::model::Api::name].
77    ///
78    /// # Example
79    /// ```ignore,no_run
80    /// # use google_cloud_apigateway_v1::model::Api;
81    /// let x = Api::new().set_name("example");
82    /// ```
83    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.name = v.into();
85        self
86    }
87
88    /// Sets the value of [create_time][crate::model::Api::create_time].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_apigateway_v1::model::Api;
93    /// use wkt::Timestamp;
94    /// let x = Api::new().set_create_time(Timestamp::default()/* use setters */);
95    /// ```
96    pub fn set_create_time<T>(mut self, v: T) -> Self
97    where
98        T: std::convert::Into<wkt::Timestamp>,
99    {
100        self.create_time = std::option::Option::Some(v.into());
101        self
102    }
103
104    /// Sets or clears the value of [create_time][crate::model::Api::create_time].
105    ///
106    /// # Example
107    /// ```ignore,no_run
108    /// # use google_cloud_apigateway_v1::model::Api;
109    /// use wkt::Timestamp;
110    /// let x = Api::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
111    /// let x = Api::new().set_or_clear_create_time(None::<Timestamp>);
112    /// ```
113    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
114    where
115        T: std::convert::Into<wkt::Timestamp>,
116    {
117        self.create_time = v.map(|x| x.into());
118        self
119    }
120
121    /// Sets the value of [update_time][crate::model::Api::update_time].
122    ///
123    /// # Example
124    /// ```ignore,no_run
125    /// # use google_cloud_apigateway_v1::model::Api;
126    /// use wkt::Timestamp;
127    /// let x = Api::new().set_update_time(Timestamp::default()/* use setters */);
128    /// ```
129    pub fn set_update_time<T>(mut self, v: T) -> Self
130    where
131        T: std::convert::Into<wkt::Timestamp>,
132    {
133        self.update_time = std::option::Option::Some(v.into());
134        self
135    }
136
137    /// Sets or clears the value of [update_time][crate::model::Api::update_time].
138    ///
139    /// # Example
140    /// ```ignore,no_run
141    /// # use google_cloud_apigateway_v1::model::Api;
142    /// use wkt::Timestamp;
143    /// let x = Api::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
144    /// let x = Api::new().set_or_clear_update_time(None::<Timestamp>);
145    /// ```
146    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
147    where
148        T: std::convert::Into<wkt::Timestamp>,
149    {
150        self.update_time = v.map(|x| x.into());
151        self
152    }
153
154    /// Sets the value of [labels][crate::model::Api::labels].
155    ///
156    /// # Example
157    /// ```ignore,no_run
158    /// # use google_cloud_apigateway_v1::model::Api;
159    /// let x = Api::new().set_labels([
160    ///     ("key0", "abc"),
161    ///     ("key1", "xyz"),
162    /// ]);
163    /// ```
164    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
165    where
166        T: std::iter::IntoIterator<Item = (K, V)>,
167        K: std::convert::Into<std::string::String>,
168        V: std::convert::Into<std::string::String>,
169    {
170        use std::iter::Iterator;
171        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
172        self
173    }
174
175    /// Sets the value of [display_name][crate::model::Api::display_name].
176    ///
177    /// # Example
178    /// ```ignore,no_run
179    /// # use google_cloud_apigateway_v1::model::Api;
180    /// let x = Api::new().set_display_name("example");
181    /// ```
182    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
183        self.display_name = v.into();
184        self
185    }
186
187    /// Sets the value of [managed_service][crate::model::Api::managed_service].
188    ///
189    /// # Example
190    /// ```ignore,no_run
191    /// # use google_cloud_apigateway_v1::model::Api;
192    /// let x = Api::new().set_managed_service("example");
193    /// ```
194    pub fn set_managed_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
195        self.managed_service = v.into();
196        self
197    }
198
199    /// Sets the value of [state][crate::model::Api::state].
200    ///
201    /// # Example
202    /// ```ignore,no_run
203    /// # use google_cloud_apigateway_v1::model::Api;
204    /// use google_cloud_apigateway_v1::model::api::State;
205    /// let x0 = Api::new().set_state(State::Creating);
206    /// let x1 = Api::new().set_state(State::Active);
207    /// let x2 = Api::new().set_state(State::Failed);
208    /// ```
209    pub fn set_state<T: std::convert::Into<crate::model::api::State>>(mut self, v: T) -> Self {
210        self.state = v.into();
211        self
212    }
213}
214
215impl wkt::message::Message for Api {
216    fn typename() -> &'static str {
217        "type.googleapis.com/google.cloud.apigateway.v1.Api"
218    }
219}
220
221/// Defines additional types related to [Api].
222pub mod api {
223    #[allow(unused_imports)]
224    use super::*;
225
226    /// All the possible API states.
227    ///
228    /// # Working with unknown values
229    ///
230    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
231    /// additional enum variants at any time. Adding new variants is not considered
232    /// a breaking change. Applications should write their code in anticipation of:
233    ///
234    /// - New values appearing in future releases of the client library, **and**
235    /// - New values received dynamically, without application changes.
236    ///
237    /// Please consult the [Working with enums] section in the user guide for some
238    /// guidelines.
239    ///
240    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
241    #[derive(Clone, Debug, PartialEq)]
242    #[non_exhaustive]
243    pub enum State {
244        /// API does not have a state yet.
245        Unspecified,
246        /// API is being created.
247        Creating,
248        /// API is active.
249        Active,
250        /// API creation failed.
251        Failed,
252        /// API is being deleted.
253        Deleting,
254        /// API is being updated.
255        Updating,
256        /// If set, the enum was initialized with an unknown value.
257        ///
258        /// Applications can examine the value using [State::value] or
259        /// [State::name].
260        UnknownValue(state::UnknownValue),
261    }
262
263    #[doc(hidden)]
264    pub mod state {
265        #[allow(unused_imports)]
266        use super::*;
267        #[derive(Clone, Debug, PartialEq)]
268        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
269    }
270
271    impl State {
272        /// Gets the enum value.
273        ///
274        /// Returns `None` if the enum contains an unknown value deserialized from
275        /// the string representation of enums.
276        pub fn value(&self) -> std::option::Option<i32> {
277            match self {
278                Self::Unspecified => std::option::Option::Some(0),
279                Self::Creating => std::option::Option::Some(1),
280                Self::Active => std::option::Option::Some(2),
281                Self::Failed => std::option::Option::Some(3),
282                Self::Deleting => std::option::Option::Some(4),
283                Self::Updating => std::option::Option::Some(5),
284                Self::UnknownValue(u) => u.0.value(),
285            }
286        }
287
288        /// Gets the enum value as a string.
289        ///
290        /// Returns `None` if the enum contains an unknown value deserialized from
291        /// the integer representation of enums.
292        pub fn name(&self) -> std::option::Option<&str> {
293            match self {
294                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
295                Self::Creating => std::option::Option::Some("CREATING"),
296                Self::Active => std::option::Option::Some("ACTIVE"),
297                Self::Failed => std::option::Option::Some("FAILED"),
298                Self::Deleting => std::option::Option::Some("DELETING"),
299                Self::Updating => std::option::Option::Some("UPDATING"),
300                Self::UnknownValue(u) => u.0.name(),
301            }
302        }
303    }
304
305    impl std::default::Default for State {
306        fn default() -> Self {
307            use std::convert::From;
308            Self::from(0)
309        }
310    }
311
312    impl std::fmt::Display for State {
313        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
314            wkt::internal::display_enum(f, self.name(), self.value())
315        }
316    }
317
318    impl std::convert::From<i32> for State {
319        fn from(value: i32) -> Self {
320            match value {
321                0 => Self::Unspecified,
322                1 => Self::Creating,
323                2 => Self::Active,
324                3 => Self::Failed,
325                4 => Self::Deleting,
326                5 => Self::Updating,
327                _ => Self::UnknownValue(state::UnknownValue(
328                    wkt::internal::UnknownEnumValue::Integer(value),
329                )),
330            }
331        }
332    }
333
334    impl std::convert::From<&str> for State {
335        fn from(value: &str) -> Self {
336            use std::string::ToString;
337            match value {
338                "STATE_UNSPECIFIED" => Self::Unspecified,
339                "CREATING" => Self::Creating,
340                "ACTIVE" => Self::Active,
341                "FAILED" => Self::Failed,
342                "DELETING" => Self::Deleting,
343                "UPDATING" => Self::Updating,
344                _ => Self::UnknownValue(state::UnknownValue(
345                    wkt::internal::UnknownEnumValue::String(value.to_string()),
346                )),
347            }
348        }
349    }
350
351    impl serde::ser::Serialize for State {
352        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
353        where
354            S: serde::Serializer,
355        {
356            match self {
357                Self::Unspecified => serializer.serialize_i32(0),
358                Self::Creating => serializer.serialize_i32(1),
359                Self::Active => serializer.serialize_i32(2),
360                Self::Failed => serializer.serialize_i32(3),
361                Self::Deleting => serializer.serialize_i32(4),
362                Self::Updating => serializer.serialize_i32(5),
363                Self::UnknownValue(u) => u.0.serialize(serializer),
364            }
365        }
366    }
367
368    impl<'de> serde::de::Deserialize<'de> for State {
369        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
370        where
371            D: serde::Deserializer<'de>,
372        {
373            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
374                ".google.cloud.apigateway.v1.Api.State",
375            ))
376        }
377    }
378}
379
380/// An API Configuration is a combination of settings for both the Managed
381/// Service and Gateways serving this API Config.
382#[derive(Clone, Default, PartialEq)]
383#[non_exhaustive]
384pub struct ApiConfig {
385    /// Output only. Resource name of the API Config.
386    /// Format: projects/{project}/locations/global/apis/{api}/configs/{api_config}
387    pub name: std::string::String,
388
389    /// Output only. Created time.
390    pub create_time: std::option::Option<wkt::Timestamp>,
391
392    /// Output only. Updated time.
393    pub update_time: std::option::Option<wkt::Timestamp>,
394
395    /// Optional. Resource labels to represent user-provided metadata.
396    /// Refer to cloud documentation on labels for more details.
397    /// <https://cloud.google.com/compute/docs/labeling-resources>
398    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
399
400    /// Optional. Display name.
401    pub display_name: std::string::String,
402
403    /// Immutable. The Google Cloud IAM Service Account that Gateways serving this config
404    /// should use to authenticate to other services. This may either be the
405    /// Service Account's email
406    /// (`{ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com`) or its full resource
407    /// name (`projects/{PROJECT}/accounts/{UNIQUE_ID}`). This is most often used
408    /// when the service is a GCP resource such as a Cloud Run Service or an
409    /// IAP-secured service.
410    pub gateway_service_account: std::string::String,
411
412    /// Output only. The ID of the associated Service Config (
413    /// <https://cloud.google.com/service-infrastructure/docs/glossary#config>).
414    pub service_config_id: std::string::String,
415
416    /// Output only. State of the API Config.
417    pub state: crate::model::api_config::State,
418
419    /// Optional. OpenAPI specification documents. If specified, grpc_services and
420    /// managed_service_configs must not be included.
421    pub openapi_documents: std::vec::Vec<crate::model::api_config::OpenApiDocument>,
422
423    /// Optional. gRPC service definition files. If specified, openapi_documents must
424    /// not be included.
425    pub grpc_services: std::vec::Vec<crate::model::api_config::GrpcServiceDefinition>,
426
427    /// Optional. Service Configuration files. At least one must be included when using gRPC
428    /// service definitions. See
429    /// <https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview>
430    /// for the expected file contents.
431    ///
432    /// If multiple files are specified, the files are merged with the following
433    /// rules:
434    ///
435    /// * All singular scalar fields are merged using "last one wins" semantics in
436    ///   the order of the files uploaded.
437    /// * Repeated fields are concatenated.
438    /// * Singular embedded messages are merged using these rules for nested
439    ///   fields.
440    pub managed_service_configs: std::vec::Vec<crate::model::api_config::File>,
441
442    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
443}
444
445impl ApiConfig {
446    pub fn new() -> Self {
447        std::default::Default::default()
448    }
449
450    /// Sets the value of [name][crate::model::ApiConfig::name].
451    ///
452    /// # Example
453    /// ```ignore,no_run
454    /// # use google_cloud_apigateway_v1::model::ApiConfig;
455    /// let x = ApiConfig::new().set_name("example");
456    /// ```
457    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
458        self.name = v.into();
459        self
460    }
461
462    /// Sets the value of [create_time][crate::model::ApiConfig::create_time].
463    ///
464    /// # Example
465    /// ```ignore,no_run
466    /// # use google_cloud_apigateway_v1::model::ApiConfig;
467    /// use wkt::Timestamp;
468    /// let x = ApiConfig::new().set_create_time(Timestamp::default()/* use setters */);
469    /// ```
470    pub fn set_create_time<T>(mut self, v: T) -> Self
471    where
472        T: std::convert::Into<wkt::Timestamp>,
473    {
474        self.create_time = std::option::Option::Some(v.into());
475        self
476    }
477
478    /// Sets or clears the value of [create_time][crate::model::ApiConfig::create_time].
479    ///
480    /// # Example
481    /// ```ignore,no_run
482    /// # use google_cloud_apigateway_v1::model::ApiConfig;
483    /// use wkt::Timestamp;
484    /// let x = ApiConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
485    /// let x = ApiConfig::new().set_or_clear_create_time(None::<Timestamp>);
486    /// ```
487    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
488    where
489        T: std::convert::Into<wkt::Timestamp>,
490    {
491        self.create_time = v.map(|x| x.into());
492        self
493    }
494
495    /// Sets the value of [update_time][crate::model::ApiConfig::update_time].
496    ///
497    /// # Example
498    /// ```ignore,no_run
499    /// # use google_cloud_apigateway_v1::model::ApiConfig;
500    /// use wkt::Timestamp;
501    /// let x = ApiConfig::new().set_update_time(Timestamp::default()/* use setters */);
502    /// ```
503    pub fn set_update_time<T>(mut self, v: T) -> Self
504    where
505        T: std::convert::Into<wkt::Timestamp>,
506    {
507        self.update_time = std::option::Option::Some(v.into());
508        self
509    }
510
511    /// Sets or clears the value of [update_time][crate::model::ApiConfig::update_time].
512    ///
513    /// # Example
514    /// ```ignore,no_run
515    /// # use google_cloud_apigateway_v1::model::ApiConfig;
516    /// use wkt::Timestamp;
517    /// let x = ApiConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
518    /// let x = ApiConfig::new().set_or_clear_update_time(None::<Timestamp>);
519    /// ```
520    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
521    where
522        T: std::convert::Into<wkt::Timestamp>,
523    {
524        self.update_time = v.map(|x| x.into());
525        self
526    }
527
528    /// Sets the value of [labels][crate::model::ApiConfig::labels].
529    ///
530    /// # Example
531    /// ```ignore,no_run
532    /// # use google_cloud_apigateway_v1::model::ApiConfig;
533    /// let x = ApiConfig::new().set_labels([
534    ///     ("key0", "abc"),
535    ///     ("key1", "xyz"),
536    /// ]);
537    /// ```
538    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
539    where
540        T: std::iter::IntoIterator<Item = (K, V)>,
541        K: std::convert::Into<std::string::String>,
542        V: std::convert::Into<std::string::String>,
543    {
544        use std::iter::Iterator;
545        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
546        self
547    }
548
549    /// Sets the value of [display_name][crate::model::ApiConfig::display_name].
550    ///
551    /// # Example
552    /// ```ignore,no_run
553    /// # use google_cloud_apigateway_v1::model::ApiConfig;
554    /// let x = ApiConfig::new().set_display_name("example");
555    /// ```
556    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
557        self.display_name = v.into();
558        self
559    }
560
561    /// Sets the value of [gateway_service_account][crate::model::ApiConfig::gateway_service_account].
562    ///
563    /// # Example
564    /// ```ignore,no_run
565    /// # use google_cloud_apigateway_v1::model::ApiConfig;
566    /// let x = ApiConfig::new().set_gateway_service_account("example");
567    /// ```
568    pub fn set_gateway_service_account<T: std::convert::Into<std::string::String>>(
569        mut self,
570        v: T,
571    ) -> Self {
572        self.gateway_service_account = v.into();
573        self
574    }
575
576    /// Sets the value of [service_config_id][crate::model::ApiConfig::service_config_id].
577    ///
578    /// # Example
579    /// ```ignore,no_run
580    /// # use google_cloud_apigateway_v1::model::ApiConfig;
581    /// let x = ApiConfig::new().set_service_config_id("example");
582    /// ```
583    pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
584        mut self,
585        v: T,
586    ) -> Self {
587        self.service_config_id = v.into();
588        self
589    }
590
591    /// Sets the value of [state][crate::model::ApiConfig::state].
592    ///
593    /// # Example
594    /// ```ignore,no_run
595    /// # use google_cloud_apigateway_v1::model::ApiConfig;
596    /// use google_cloud_apigateway_v1::model::api_config::State;
597    /// let x0 = ApiConfig::new().set_state(State::Creating);
598    /// let x1 = ApiConfig::new().set_state(State::Active);
599    /// let x2 = ApiConfig::new().set_state(State::Failed);
600    /// ```
601    pub fn set_state<T: std::convert::Into<crate::model::api_config::State>>(
602        mut self,
603        v: T,
604    ) -> Self {
605        self.state = v.into();
606        self
607    }
608
609    /// Sets the value of [openapi_documents][crate::model::ApiConfig::openapi_documents].
610    ///
611    /// # Example
612    /// ```ignore,no_run
613    /// # use google_cloud_apigateway_v1::model::ApiConfig;
614    /// use google_cloud_apigateway_v1::model::api_config::OpenApiDocument;
615    /// let x = ApiConfig::new()
616    ///     .set_openapi_documents([
617    ///         OpenApiDocument::default()/* use setters */,
618    ///         OpenApiDocument::default()/* use (different) setters */,
619    ///     ]);
620    /// ```
621    pub fn set_openapi_documents<T, V>(mut self, v: T) -> Self
622    where
623        T: std::iter::IntoIterator<Item = V>,
624        V: std::convert::Into<crate::model::api_config::OpenApiDocument>,
625    {
626        use std::iter::Iterator;
627        self.openapi_documents = v.into_iter().map(|i| i.into()).collect();
628        self
629    }
630
631    /// Sets the value of [grpc_services][crate::model::ApiConfig::grpc_services].
632    ///
633    /// # Example
634    /// ```ignore,no_run
635    /// # use google_cloud_apigateway_v1::model::ApiConfig;
636    /// use google_cloud_apigateway_v1::model::api_config::GrpcServiceDefinition;
637    /// let x = ApiConfig::new()
638    ///     .set_grpc_services([
639    ///         GrpcServiceDefinition::default()/* use setters */,
640    ///         GrpcServiceDefinition::default()/* use (different) setters */,
641    ///     ]);
642    /// ```
643    pub fn set_grpc_services<T, V>(mut self, v: T) -> Self
644    where
645        T: std::iter::IntoIterator<Item = V>,
646        V: std::convert::Into<crate::model::api_config::GrpcServiceDefinition>,
647    {
648        use std::iter::Iterator;
649        self.grpc_services = v.into_iter().map(|i| i.into()).collect();
650        self
651    }
652
653    /// Sets the value of [managed_service_configs][crate::model::ApiConfig::managed_service_configs].
654    ///
655    /// # Example
656    /// ```ignore,no_run
657    /// # use google_cloud_apigateway_v1::model::ApiConfig;
658    /// use google_cloud_apigateway_v1::model::api_config::File;
659    /// let x = ApiConfig::new()
660    ///     .set_managed_service_configs([
661    ///         File::default()/* use setters */,
662    ///         File::default()/* use (different) setters */,
663    ///     ]);
664    /// ```
665    pub fn set_managed_service_configs<T, V>(mut self, v: T) -> Self
666    where
667        T: std::iter::IntoIterator<Item = V>,
668        V: std::convert::Into<crate::model::api_config::File>,
669    {
670        use std::iter::Iterator;
671        self.managed_service_configs = v.into_iter().map(|i| i.into()).collect();
672        self
673    }
674}
675
676impl wkt::message::Message for ApiConfig {
677    fn typename() -> &'static str {
678        "type.googleapis.com/google.cloud.apigateway.v1.ApiConfig"
679    }
680}
681
682/// Defines additional types related to [ApiConfig].
683pub mod api_config {
684    #[allow(unused_imports)]
685    use super::*;
686
687    /// A lightweight description of a file.
688    #[derive(Clone, Default, PartialEq)]
689    #[non_exhaustive]
690    pub struct File {
691        /// The file path (full or relative path). This is typically the path of the
692        /// file when it is uploaded.
693        pub path: std::string::String,
694
695        /// The bytes that constitute the file.
696        pub contents: ::bytes::Bytes,
697
698        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
699    }
700
701    impl File {
702        pub fn new() -> Self {
703            std::default::Default::default()
704        }
705
706        /// Sets the value of [path][crate::model::api_config::File::path].
707        ///
708        /// # Example
709        /// ```ignore,no_run
710        /// # use google_cloud_apigateway_v1::model::api_config::File;
711        /// let x = File::new().set_path("example");
712        /// ```
713        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714            self.path = v.into();
715            self
716        }
717
718        /// Sets the value of [contents][crate::model::api_config::File::contents].
719        ///
720        /// # Example
721        /// ```ignore,no_run
722        /// # use google_cloud_apigateway_v1::model::api_config::File;
723        /// let x = File::new().set_contents(bytes::Bytes::from_static(b"example"));
724        /// ```
725        pub fn set_contents<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
726            self.contents = v.into();
727            self
728        }
729    }
730
731    impl wkt::message::Message for File {
732        fn typename() -> &'static str {
733            "type.googleapis.com/google.cloud.apigateway.v1.ApiConfig.File"
734        }
735    }
736
737    /// An OpenAPI Specification Document describing an API.
738    #[derive(Clone, Default, PartialEq)]
739    #[non_exhaustive]
740    pub struct OpenApiDocument {
741        /// The OpenAPI Specification document file.
742        pub document: std::option::Option<crate::model::api_config::File>,
743
744        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
745    }
746
747    impl OpenApiDocument {
748        pub fn new() -> Self {
749            std::default::Default::default()
750        }
751
752        /// Sets the value of [document][crate::model::api_config::OpenApiDocument::document].
753        ///
754        /// # Example
755        /// ```ignore,no_run
756        /// # use google_cloud_apigateway_v1::model::api_config::OpenApiDocument;
757        /// use google_cloud_apigateway_v1::model::api_config::File;
758        /// let x = OpenApiDocument::new().set_document(File::default()/* use setters */);
759        /// ```
760        pub fn set_document<T>(mut self, v: T) -> Self
761        where
762            T: std::convert::Into<crate::model::api_config::File>,
763        {
764            self.document = std::option::Option::Some(v.into());
765            self
766        }
767
768        /// Sets or clears the value of [document][crate::model::api_config::OpenApiDocument::document].
769        ///
770        /// # Example
771        /// ```ignore,no_run
772        /// # use google_cloud_apigateway_v1::model::api_config::OpenApiDocument;
773        /// use google_cloud_apigateway_v1::model::api_config::File;
774        /// let x = OpenApiDocument::new().set_or_clear_document(Some(File::default()/* use setters */));
775        /// let x = OpenApiDocument::new().set_or_clear_document(None::<File>);
776        /// ```
777        pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
778        where
779            T: std::convert::Into<crate::model::api_config::File>,
780        {
781            self.document = v.map(|x| x.into());
782            self
783        }
784    }
785
786    impl wkt::message::Message for OpenApiDocument {
787        fn typename() -> &'static str {
788            "type.googleapis.com/google.cloud.apigateway.v1.ApiConfig.OpenApiDocument"
789        }
790    }
791
792    /// A gRPC service definition.
793    #[derive(Clone, Default, PartialEq)]
794    #[non_exhaustive]
795    pub struct GrpcServiceDefinition {
796        /// Input only. File descriptor set, generated by protoc.
797        ///
798        /// To generate, use protoc with imports and source info included.
799        /// For an example test.proto file, the following command would put the value
800        /// in a new file named out.pb.
801        ///
802        /// $ protoc --include_imports --include_source_info test.proto -o out.pb
803        pub file_descriptor_set: std::option::Option<crate::model::api_config::File>,
804
805        /// Optional. Uncompiled proto files associated with the descriptor set, used for
806        /// display purposes (server-side compilation is not supported). These
807        /// should match the inputs to 'protoc' command used to generate
808        /// file_descriptor_set.
809        pub source: std::vec::Vec<crate::model::api_config::File>,
810
811        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
812    }
813
814    impl GrpcServiceDefinition {
815        pub fn new() -> Self {
816            std::default::Default::default()
817        }
818
819        /// Sets the value of [file_descriptor_set][crate::model::api_config::GrpcServiceDefinition::file_descriptor_set].
820        ///
821        /// # Example
822        /// ```ignore,no_run
823        /// # use google_cloud_apigateway_v1::model::api_config::GrpcServiceDefinition;
824        /// use google_cloud_apigateway_v1::model::api_config::File;
825        /// let x = GrpcServiceDefinition::new().set_file_descriptor_set(File::default()/* use setters */);
826        /// ```
827        pub fn set_file_descriptor_set<T>(mut self, v: T) -> Self
828        where
829            T: std::convert::Into<crate::model::api_config::File>,
830        {
831            self.file_descriptor_set = std::option::Option::Some(v.into());
832            self
833        }
834
835        /// Sets or clears the value of [file_descriptor_set][crate::model::api_config::GrpcServiceDefinition::file_descriptor_set].
836        ///
837        /// # Example
838        /// ```ignore,no_run
839        /// # use google_cloud_apigateway_v1::model::api_config::GrpcServiceDefinition;
840        /// use google_cloud_apigateway_v1::model::api_config::File;
841        /// let x = GrpcServiceDefinition::new().set_or_clear_file_descriptor_set(Some(File::default()/* use setters */));
842        /// let x = GrpcServiceDefinition::new().set_or_clear_file_descriptor_set(None::<File>);
843        /// ```
844        pub fn set_or_clear_file_descriptor_set<T>(mut self, v: std::option::Option<T>) -> Self
845        where
846            T: std::convert::Into<crate::model::api_config::File>,
847        {
848            self.file_descriptor_set = v.map(|x| x.into());
849            self
850        }
851
852        /// Sets the value of [source][crate::model::api_config::GrpcServiceDefinition::source].
853        ///
854        /// # Example
855        /// ```ignore,no_run
856        /// # use google_cloud_apigateway_v1::model::api_config::GrpcServiceDefinition;
857        /// use google_cloud_apigateway_v1::model::api_config::File;
858        /// let x = GrpcServiceDefinition::new()
859        ///     .set_source([
860        ///         File::default()/* use setters */,
861        ///         File::default()/* use (different) setters */,
862        ///     ]);
863        /// ```
864        pub fn set_source<T, V>(mut self, v: T) -> Self
865        where
866            T: std::iter::IntoIterator<Item = V>,
867            V: std::convert::Into<crate::model::api_config::File>,
868        {
869            use std::iter::Iterator;
870            self.source = v.into_iter().map(|i| i.into()).collect();
871            self
872        }
873    }
874
875    impl wkt::message::Message for GrpcServiceDefinition {
876        fn typename() -> &'static str {
877            "type.googleapis.com/google.cloud.apigateway.v1.ApiConfig.GrpcServiceDefinition"
878        }
879    }
880
881    /// All the possible API Config states.
882    ///
883    /// # Working with unknown values
884    ///
885    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
886    /// additional enum variants at any time. Adding new variants is not considered
887    /// a breaking change. Applications should write their code in anticipation of:
888    ///
889    /// - New values appearing in future releases of the client library, **and**
890    /// - New values received dynamically, without application changes.
891    ///
892    /// Please consult the [Working with enums] section in the user guide for some
893    /// guidelines.
894    ///
895    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
896    #[derive(Clone, Debug, PartialEq)]
897    #[non_exhaustive]
898    pub enum State {
899        /// API Config does not have a state yet.
900        Unspecified,
901        /// API Config is being created and deployed to the API Controller.
902        Creating,
903        /// API Config is ready for use by Gateways.
904        Active,
905        /// API Config creation failed.
906        Failed,
907        /// API Config is being deleted.
908        Deleting,
909        /// API Config is being updated.
910        Updating,
911        /// API Config settings are being activated in downstream systems.
912        /// API Configs in this state cannot be used by Gateways.
913        Activating,
914        /// If set, the enum was initialized with an unknown value.
915        ///
916        /// Applications can examine the value using [State::value] or
917        /// [State::name].
918        UnknownValue(state::UnknownValue),
919    }
920
921    #[doc(hidden)]
922    pub mod state {
923        #[allow(unused_imports)]
924        use super::*;
925        #[derive(Clone, Debug, PartialEq)]
926        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
927    }
928
929    impl State {
930        /// Gets the enum value.
931        ///
932        /// Returns `None` if the enum contains an unknown value deserialized from
933        /// the string representation of enums.
934        pub fn value(&self) -> std::option::Option<i32> {
935            match self {
936                Self::Unspecified => std::option::Option::Some(0),
937                Self::Creating => std::option::Option::Some(1),
938                Self::Active => std::option::Option::Some(2),
939                Self::Failed => std::option::Option::Some(3),
940                Self::Deleting => std::option::Option::Some(4),
941                Self::Updating => std::option::Option::Some(5),
942                Self::Activating => std::option::Option::Some(6),
943                Self::UnknownValue(u) => u.0.value(),
944            }
945        }
946
947        /// Gets the enum value as a string.
948        ///
949        /// Returns `None` if the enum contains an unknown value deserialized from
950        /// the integer representation of enums.
951        pub fn name(&self) -> std::option::Option<&str> {
952            match self {
953                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
954                Self::Creating => std::option::Option::Some("CREATING"),
955                Self::Active => std::option::Option::Some("ACTIVE"),
956                Self::Failed => std::option::Option::Some("FAILED"),
957                Self::Deleting => std::option::Option::Some("DELETING"),
958                Self::Updating => std::option::Option::Some("UPDATING"),
959                Self::Activating => std::option::Option::Some("ACTIVATING"),
960                Self::UnknownValue(u) => u.0.name(),
961            }
962        }
963    }
964
965    impl std::default::Default for State {
966        fn default() -> Self {
967            use std::convert::From;
968            Self::from(0)
969        }
970    }
971
972    impl std::fmt::Display for State {
973        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
974            wkt::internal::display_enum(f, self.name(), self.value())
975        }
976    }
977
978    impl std::convert::From<i32> for State {
979        fn from(value: i32) -> Self {
980            match value {
981                0 => Self::Unspecified,
982                1 => Self::Creating,
983                2 => Self::Active,
984                3 => Self::Failed,
985                4 => Self::Deleting,
986                5 => Self::Updating,
987                6 => Self::Activating,
988                _ => Self::UnknownValue(state::UnknownValue(
989                    wkt::internal::UnknownEnumValue::Integer(value),
990                )),
991            }
992        }
993    }
994
995    impl std::convert::From<&str> for State {
996        fn from(value: &str) -> Self {
997            use std::string::ToString;
998            match value {
999                "STATE_UNSPECIFIED" => Self::Unspecified,
1000                "CREATING" => Self::Creating,
1001                "ACTIVE" => Self::Active,
1002                "FAILED" => Self::Failed,
1003                "DELETING" => Self::Deleting,
1004                "UPDATING" => Self::Updating,
1005                "ACTIVATING" => Self::Activating,
1006                _ => Self::UnknownValue(state::UnknownValue(
1007                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1008                )),
1009            }
1010        }
1011    }
1012
1013    impl serde::ser::Serialize for State {
1014        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1015        where
1016            S: serde::Serializer,
1017        {
1018            match self {
1019                Self::Unspecified => serializer.serialize_i32(0),
1020                Self::Creating => serializer.serialize_i32(1),
1021                Self::Active => serializer.serialize_i32(2),
1022                Self::Failed => serializer.serialize_i32(3),
1023                Self::Deleting => serializer.serialize_i32(4),
1024                Self::Updating => serializer.serialize_i32(5),
1025                Self::Activating => serializer.serialize_i32(6),
1026                Self::UnknownValue(u) => u.0.serialize(serializer),
1027            }
1028        }
1029    }
1030
1031    impl<'de> serde::de::Deserialize<'de> for State {
1032        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1033        where
1034            D: serde::Deserializer<'de>,
1035        {
1036            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1037                ".google.cloud.apigateway.v1.ApiConfig.State",
1038            ))
1039        }
1040    }
1041}
1042
1043/// A Gateway is an API-aware HTTP proxy. It performs API-Method and/or
1044/// API-Consumer specific actions based on an API Config such as authentication,
1045/// policy enforcement, and backend selection.
1046#[derive(Clone, Default, PartialEq)]
1047#[non_exhaustive]
1048pub struct Gateway {
1049    /// Output only. Resource name of the Gateway.
1050    /// Format: projects/{project}/locations/{location}/gateways/{gateway}
1051    pub name: std::string::String,
1052
1053    /// Output only. Created time.
1054    pub create_time: std::option::Option<wkt::Timestamp>,
1055
1056    /// Output only. Updated time.
1057    pub update_time: std::option::Option<wkt::Timestamp>,
1058
1059    /// Optional. Resource labels to represent user-provided metadata.
1060    /// Refer to cloud documentation on labels for more details.
1061    /// <https://cloud.google.com/compute/docs/labeling-resources>
1062    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1063
1064    /// Optional. Display name.
1065    pub display_name: std::string::String,
1066
1067    /// Required. Resource name of the API Config for this Gateway.
1068    /// Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
1069    pub api_config: std::string::String,
1070
1071    /// Output only. The current state of the Gateway.
1072    pub state: crate::model::gateway::State,
1073
1074    /// Output only. The default API Gateway host name of the form
1075    /// `{gateway_id}-{hash}.{region_code}.gateway.dev`.
1076    pub default_hostname: std::string::String,
1077
1078    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1079}
1080
1081impl Gateway {
1082    pub fn new() -> Self {
1083        std::default::Default::default()
1084    }
1085
1086    /// Sets the value of [name][crate::model::Gateway::name].
1087    ///
1088    /// # Example
1089    /// ```ignore,no_run
1090    /// # use google_cloud_apigateway_v1::model::Gateway;
1091    /// let x = Gateway::new().set_name("example");
1092    /// ```
1093    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1094        self.name = v.into();
1095        self
1096    }
1097
1098    /// Sets the value of [create_time][crate::model::Gateway::create_time].
1099    ///
1100    /// # Example
1101    /// ```ignore,no_run
1102    /// # use google_cloud_apigateway_v1::model::Gateway;
1103    /// use wkt::Timestamp;
1104    /// let x = Gateway::new().set_create_time(Timestamp::default()/* use setters */);
1105    /// ```
1106    pub fn set_create_time<T>(mut self, v: T) -> Self
1107    where
1108        T: std::convert::Into<wkt::Timestamp>,
1109    {
1110        self.create_time = std::option::Option::Some(v.into());
1111        self
1112    }
1113
1114    /// Sets or clears the value of [create_time][crate::model::Gateway::create_time].
1115    ///
1116    /// # Example
1117    /// ```ignore,no_run
1118    /// # use google_cloud_apigateway_v1::model::Gateway;
1119    /// use wkt::Timestamp;
1120    /// let x = Gateway::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1121    /// let x = Gateway::new().set_or_clear_create_time(None::<Timestamp>);
1122    /// ```
1123    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1124    where
1125        T: std::convert::Into<wkt::Timestamp>,
1126    {
1127        self.create_time = v.map(|x| x.into());
1128        self
1129    }
1130
1131    /// Sets the value of [update_time][crate::model::Gateway::update_time].
1132    ///
1133    /// # Example
1134    /// ```ignore,no_run
1135    /// # use google_cloud_apigateway_v1::model::Gateway;
1136    /// use wkt::Timestamp;
1137    /// let x = Gateway::new().set_update_time(Timestamp::default()/* use setters */);
1138    /// ```
1139    pub fn set_update_time<T>(mut self, v: T) -> Self
1140    where
1141        T: std::convert::Into<wkt::Timestamp>,
1142    {
1143        self.update_time = std::option::Option::Some(v.into());
1144        self
1145    }
1146
1147    /// Sets or clears the value of [update_time][crate::model::Gateway::update_time].
1148    ///
1149    /// # Example
1150    /// ```ignore,no_run
1151    /// # use google_cloud_apigateway_v1::model::Gateway;
1152    /// use wkt::Timestamp;
1153    /// let x = Gateway::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1154    /// let x = Gateway::new().set_or_clear_update_time(None::<Timestamp>);
1155    /// ```
1156    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1157    where
1158        T: std::convert::Into<wkt::Timestamp>,
1159    {
1160        self.update_time = v.map(|x| x.into());
1161        self
1162    }
1163
1164    /// Sets the value of [labels][crate::model::Gateway::labels].
1165    ///
1166    /// # Example
1167    /// ```ignore,no_run
1168    /// # use google_cloud_apigateway_v1::model::Gateway;
1169    /// let x = Gateway::new().set_labels([
1170    ///     ("key0", "abc"),
1171    ///     ("key1", "xyz"),
1172    /// ]);
1173    /// ```
1174    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1175    where
1176        T: std::iter::IntoIterator<Item = (K, V)>,
1177        K: std::convert::Into<std::string::String>,
1178        V: std::convert::Into<std::string::String>,
1179    {
1180        use std::iter::Iterator;
1181        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1182        self
1183    }
1184
1185    /// Sets the value of [display_name][crate::model::Gateway::display_name].
1186    ///
1187    /// # Example
1188    /// ```ignore,no_run
1189    /// # use google_cloud_apigateway_v1::model::Gateway;
1190    /// let x = Gateway::new().set_display_name("example");
1191    /// ```
1192    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1193        self.display_name = v.into();
1194        self
1195    }
1196
1197    /// Sets the value of [api_config][crate::model::Gateway::api_config].
1198    ///
1199    /// # Example
1200    /// ```ignore,no_run
1201    /// # use google_cloud_apigateway_v1::model::Gateway;
1202    /// let x = Gateway::new().set_api_config("example");
1203    /// ```
1204    pub fn set_api_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1205        self.api_config = v.into();
1206        self
1207    }
1208
1209    /// Sets the value of [state][crate::model::Gateway::state].
1210    ///
1211    /// # Example
1212    /// ```ignore,no_run
1213    /// # use google_cloud_apigateway_v1::model::Gateway;
1214    /// use google_cloud_apigateway_v1::model::gateway::State;
1215    /// let x0 = Gateway::new().set_state(State::Creating);
1216    /// let x1 = Gateway::new().set_state(State::Active);
1217    /// let x2 = Gateway::new().set_state(State::Failed);
1218    /// ```
1219    pub fn set_state<T: std::convert::Into<crate::model::gateway::State>>(mut self, v: T) -> Self {
1220        self.state = v.into();
1221        self
1222    }
1223
1224    /// Sets the value of [default_hostname][crate::model::Gateway::default_hostname].
1225    ///
1226    /// # Example
1227    /// ```ignore,no_run
1228    /// # use google_cloud_apigateway_v1::model::Gateway;
1229    /// let x = Gateway::new().set_default_hostname("example");
1230    /// ```
1231    pub fn set_default_hostname<T: std::convert::Into<std::string::String>>(
1232        mut self,
1233        v: T,
1234    ) -> Self {
1235        self.default_hostname = v.into();
1236        self
1237    }
1238}
1239
1240impl wkt::message::Message for Gateway {
1241    fn typename() -> &'static str {
1242        "type.googleapis.com/google.cloud.apigateway.v1.Gateway"
1243    }
1244}
1245
1246/// Defines additional types related to [Gateway].
1247pub mod gateway {
1248    #[allow(unused_imports)]
1249    use super::*;
1250
1251    /// All the possible Gateway states.
1252    ///
1253    /// # Working with unknown values
1254    ///
1255    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1256    /// additional enum variants at any time. Adding new variants is not considered
1257    /// a breaking change. Applications should write their code in anticipation of:
1258    ///
1259    /// - New values appearing in future releases of the client library, **and**
1260    /// - New values received dynamically, without application changes.
1261    ///
1262    /// Please consult the [Working with enums] section in the user guide for some
1263    /// guidelines.
1264    ///
1265    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1266    #[derive(Clone, Debug, PartialEq)]
1267    #[non_exhaustive]
1268    pub enum State {
1269        /// Gateway does not have a state yet.
1270        Unspecified,
1271        /// Gateway is being created.
1272        Creating,
1273        /// Gateway is running and ready for requests.
1274        Active,
1275        /// Gateway creation failed.
1276        Failed,
1277        /// Gateway is being deleted.
1278        Deleting,
1279        /// Gateway is being updated.
1280        Updating,
1281        /// If set, the enum was initialized with an unknown value.
1282        ///
1283        /// Applications can examine the value using [State::value] or
1284        /// [State::name].
1285        UnknownValue(state::UnknownValue),
1286    }
1287
1288    #[doc(hidden)]
1289    pub mod state {
1290        #[allow(unused_imports)]
1291        use super::*;
1292        #[derive(Clone, Debug, PartialEq)]
1293        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1294    }
1295
1296    impl State {
1297        /// Gets the enum value.
1298        ///
1299        /// Returns `None` if the enum contains an unknown value deserialized from
1300        /// the string representation of enums.
1301        pub fn value(&self) -> std::option::Option<i32> {
1302            match self {
1303                Self::Unspecified => std::option::Option::Some(0),
1304                Self::Creating => std::option::Option::Some(1),
1305                Self::Active => std::option::Option::Some(2),
1306                Self::Failed => std::option::Option::Some(3),
1307                Self::Deleting => std::option::Option::Some(4),
1308                Self::Updating => std::option::Option::Some(5),
1309                Self::UnknownValue(u) => u.0.value(),
1310            }
1311        }
1312
1313        /// Gets the enum value as a string.
1314        ///
1315        /// Returns `None` if the enum contains an unknown value deserialized from
1316        /// the integer representation of enums.
1317        pub fn name(&self) -> std::option::Option<&str> {
1318            match self {
1319                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1320                Self::Creating => std::option::Option::Some("CREATING"),
1321                Self::Active => std::option::Option::Some("ACTIVE"),
1322                Self::Failed => std::option::Option::Some("FAILED"),
1323                Self::Deleting => std::option::Option::Some("DELETING"),
1324                Self::Updating => std::option::Option::Some("UPDATING"),
1325                Self::UnknownValue(u) => u.0.name(),
1326            }
1327        }
1328    }
1329
1330    impl std::default::Default for State {
1331        fn default() -> Self {
1332            use std::convert::From;
1333            Self::from(0)
1334        }
1335    }
1336
1337    impl std::fmt::Display for State {
1338        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1339            wkt::internal::display_enum(f, self.name(), self.value())
1340        }
1341    }
1342
1343    impl std::convert::From<i32> for State {
1344        fn from(value: i32) -> Self {
1345            match value {
1346                0 => Self::Unspecified,
1347                1 => Self::Creating,
1348                2 => Self::Active,
1349                3 => Self::Failed,
1350                4 => Self::Deleting,
1351                5 => Self::Updating,
1352                _ => Self::UnknownValue(state::UnknownValue(
1353                    wkt::internal::UnknownEnumValue::Integer(value),
1354                )),
1355            }
1356        }
1357    }
1358
1359    impl std::convert::From<&str> for State {
1360        fn from(value: &str) -> Self {
1361            use std::string::ToString;
1362            match value {
1363                "STATE_UNSPECIFIED" => Self::Unspecified,
1364                "CREATING" => Self::Creating,
1365                "ACTIVE" => Self::Active,
1366                "FAILED" => Self::Failed,
1367                "DELETING" => Self::Deleting,
1368                "UPDATING" => Self::Updating,
1369                _ => Self::UnknownValue(state::UnknownValue(
1370                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1371                )),
1372            }
1373        }
1374    }
1375
1376    impl serde::ser::Serialize for State {
1377        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1378        where
1379            S: serde::Serializer,
1380        {
1381            match self {
1382                Self::Unspecified => serializer.serialize_i32(0),
1383                Self::Creating => serializer.serialize_i32(1),
1384                Self::Active => serializer.serialize_i32(2),
1385                Self::Failed => serializer.serialize_i32(3),
1386                Self::Deleting => serializer.serialize_i32(4),
1387                Self::Updating => serializer.serialize_i32(5),
1388                Self::UnknownValue(u) => u.0.serialize(serializer),
1389            }
1390        }
1391    }
1392
1393    impl<'de> serde::de::Deserialize<'de> for State {
1394        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1395        where
1396            D: serde::Deserializer<'de>,
1397        {
1398            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1399                ".google.cloud.apigateway.v1.Gateway.State",
1400            ))
1401        }
1402    }
1403}
1404
1405/// Request message for ApiGatewayService.ListGateways
1406#[derive(Clone, Default, PartialEq)]
1407#[non_exhaustive]
1408pub struct ListGatewaysRequest {
1409    /// Required. Parent resource of the Gateway, of the form:
1410    /// `projects/*/locations/*`
1411    pub parent: std::string::String,
1412
1413    /// Page size.
1414    pub page_size: i32,
1415
1416    /// Page token.
1417    pub page_token: std::string::String,
1418
1419    /// Filter.
1420    pub filter: std::string::String,
1421
1422    /// Order by parameters.
1423    pub order_by: std::string::String,
1424
1425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1426}
1427
1428impl ListGatewaysRequest {
1429    pub fn new() -> Self {
1430        std::default::Default::default()
1431    }
1432
1433    /// Sets the value of [parent][crate::model::ListGatewaysRequest::parent].
1434    ///
1435    /// # Example
1436    /// ```ignore,no_run
1437    /// # use google_cloud_apigateway_v1::model::ListGatewaysRequest;
1438    /// let x = ListGatewaysRequest::new().set_parent("example");
1439    /// ```
1440    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1441        self.parent = v.into();
1442        self
1443    }
1444
1445    /// Sets the value of [page_size][crate::model::ListGatewaysRequest::page_size].
1446    ///
1447    /// # Example
1448    /// ```ignore,no_run
1449    /// # use google_cloud_apigateway_v1::model::ListGatewaysRequest;
1450    /// let x = ListGatewaysRequest::new().set_page_size(42);
1451    /// ```
1452    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1453        self.page_size = v.into();
1454        self
1455    }
1456
1457    /// Sets the value of [page_token][crate::model::ListGatewaysRequest::page_token].
1458    ///
1459    /// # Example
1460    /// ```ignore,no_run
1461    /// # use google_cloud_apigateway_v1::model::ListGatewaysRequest;
1462    /// let x = ListGatewaysRequest::new().set_page_token("example");
1463    /// ```
1464    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1465        self.page_token = v.into();
1466        self
1467    }
1468
1469    /// Sets the value of [filter][crate::model::ListGatewaysRequest::filter].
1470    ///
1471    /// # Example
1472    /// ```ignore,no_run
1473    /// # use google_cloud_apigateway_v1::model::ListGatewaysRequest;
1474    /// let x = ListGatewaysRequest::new().set_filter("example");
1475    /// ```
1476    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1477        self.filter = v.into();
1478        self
1479    }
1480
1481    /// Sets the value of [order_by][crate::model::ListGatewaysRequest::order_by].
1482    ///
1483    /// # Example
1484    /// ```ignore,no_run
1485    /// # use google_cloud_apigateway_v1::model::ListGatewaysRequest;
1486    /// let x = ListGatewaysRequest::new().set_order_by("example");
1487    /// ```
1488    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1489        self.order_by = v.into();
1490        self
1491    }
1492}
1493
1494impl wkt::message::Message for ListGatewaysRequest {
1495    fn typename() -> &'static str {
1496        "type.googleapis.com/google.cloud.apigateway.v1.ListGatewaysRequest"
1497    }
1498}
1499
1500/// Response message for ApiGatewayService.ListGateways
1501#[derive(Clone, Default, PartialEq)]
1502#[non_exhaustive]
1503pub struct ListGatewaysResponse {
1504    /// Gateways.
1505    pub gateways: std::vec::Vec<crate::model::Gateway>,
1506
1507    /// Next page token.
1508    pub next_page_token: std::string::String,
1509
1510    /// Locations that could not be reached.
1511    pub unreachable_locations: std::vec::Vec<std::string::String>,
1512
1513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1514}
1515
1516impl ListGatewaysResponse {
1517    pub fn new() -> Self {
1518        std::default::Default::default()
1519    }
1520
1521    /// Sets the value of [gateways][crate::model::ListGatewaysResponse::gateways].
1522    ///
1523    /// # Example
1524    /// ```ignore,no_run
1525    /// # use google_cloud_apigateway_v1::model::ListGatewaysResponse;
1526    /// use google_cloud_apigateway_v1::model::Gateway;
1527    /// let x = ListGatewaysResponse::new()
1528    ///     .set_gateways([
1529    ///         Gateway::default()/* use setters */,
1530    ///         Gateway::default()/* use (different) setters */,
1531    ///     ]);
1532    /// ```
1533    pub fn set_gateways<T, V>(mut self, v: T) -> Self
1534    where
1535        T: std::iter::IntoIterator<Item = V>,
1536        V: std::convert::Into<crate::model::Gateway>,
1537    {
1538        use std::iter::Iterator;
1539        self.gateways = v.into_iter().map(|i| i.into()).collect();
1540        self
1541    }
1542
1543    /// Sets the value of [next_page_token][crate::model::ListGatewaysResponse::next_page_token].
1544    ///
1545    /// # Example
1546    /// ```ignore,no_run
1547    /// # use google_cloud_apigateway_v1::model::ListGatewaysResponse;
1548    /// let x = ListGatewaysResponse::new().set_next_page_token("example");
1549    /// ```
1550    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1551        self.next_page_token = v.into();
1552        self
1553    }
1554
1555    /// Sets the value of [unreachable_locations][crate::model::ListGatewaysResponse::unreachable_locations].
1556    ///
1557    /// # Example
1558    /// ```ignore,no_run
1559    /// # use google_cloud_apigateway_v1::model::ListGatewaysResponse;
1560    /// let x = ListGatewaysResponse::new().set_unreachable_locations(["a", "b", "c"]);
1561    /// ```
1562    pub fn set_unreachable_locations<T, V>(mut self, v: T) -> Self
1563    where
1564        T: std::iter::IntoIterator<Item = V>,
1565        V: std::convert::Into<std::string::String>,
1566    {
1567        use std::iter::Iterator;
1568        self.unreachable_locations = v.into_iter().map(|i| i.into()).collect();
1569        self
1570    }
1571}
1572
1573impl wkt::message::Message for ListGatewaysResponse {
1574    fn typename() -> &'static str {
1575        "type.googleapis.com/google.cloud.apigateway.v1.ListGatewaysResponse"
1576    }
1577}
1578
1579#[doc(hidden)]
1580impl google_cloud_gax::paginator::internal::PageableResponse for ListGatewaysResponse {
1581    type PageItem = crate::model::Gateway;
1582
1583    fn items(self) -> std::vec::Vec<Self::PageItem> {
1584        self.gateways
1585    }
1586
1587    fn next_page_token(&self) -> std::string::String {
1588        use std::clone::Clone;
1589        self.next_page_token.clone()
1590    }
1591}
1592
1593/// Request message for ApiGatewayService.GetGateway
1594#[derive(Clone, Default, PartialEq)]
1595#[non_exhaustive]
1596pub struct GetGatewayRequest {
1597    /// Required. Resource name of the form:
1598    /// `projects/*/locations/*/gateways/*`
1599    pub name: std::string::String,
1600
1601    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1602}
1603
1604impl GetGatewayRequest {
1605    pub fn new() -> Self {
1606        std::default::Default::default()
1607    }
1608
1609    /// Sets the value of [name][crate::model::GetGatewayRequest::name].
1610    ///
1611    /// # Example
1612    /// ```ignore,no_run
1613    /// # use google_cloud_apigateway_v1::model::GetGatewayRequest;
1614    /// let x = GetGatewayRequest::new().set_name("example");
1615    /// ```
1616    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1617        self.name = v.into();
1618        self
1619    }
1620}
1621
1622impl wkt::message::Message for GetGatewayRequest {
1623    fn typename() -> &'static str {
1624        "type.googleapis.com/google.cloud.apigateway.v1.GetGatewayRequest"
1625    }
1626}
1627
1628/// Request message for ApiGatewayService.CreateGateway
1629#[derive(Clone, Default, PartialEq)]
1630#[non_exhaustive]
1631pub struct CreateGatewayRequest {
1632    /// Required. Parent resource of the Gateway, of the form:
1633    /// `projects/*/locations/*`
1634    pub parent: std::string::String,
1635
1636    /// Required. Identifier to assign to the Gateway. Must be unique within scope of
1637    /// the parent resource.
1638    pub gateway_id: std::string::String,
1639
1640    /// Required. Gateway resource.
1641    pub gateway: std::option::Option<crate::model::Gateway>,
1642
1643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1644}
1645
1646impl CreateGatewayRequest {
1647    pub fn new() -> Self {
1648        std::default::Default::default()
1649    }
1650
1651    /// Sets the value of [parent][crate::model::CreateGatewayRequest::parent].
1652    ///
1653    /// # Example
1654    /// ```ignore,no_run
1655    /// # use google_cloud_apigateway_v1::model::CreateGatewayRequest;
1656    /// let x = CreateGatewayRequest::new().set_parent("example");
1657    /// ```
1658    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1659        self.parent = v.into();
1660        self
1661    }
1662
1663    /// Sets the value of [gateway_id][crate::model::CreateGatewayRequest::gateway_id].
1664    ///
1665    /// # Example
1666    /// ```ignore,no_run
1667    /// # use google_cloud_apigateway_v1::model::CreateGatewayRequest;
1668    /// let x = CreateGatewayRequest::new().set_gateway_id("example");
1669    /// ```
1670    pub fn set_gateway_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1671        self.gateway_id = v.into();
1672        self
1673    }
1674
1675    /// Sets the value of [gateway][crate::model::CreateGatewayRequest::gateway].
1676    ///
1677    /// # Example
1678    /// ```ignore,no_run
1679    /// # use google_cloud_apigateway_v1::model::CreateGatewayRequest;
1680    /// use google_cloud_apigateway_v1::model::Gateway;
1681    /// let x = CreateGatewayRequest::new().set_gateway(Gateway::default()/* use setters */);
1682    /// ```
1683    pub fn set_gateway<T>(mut self, v: T) -> Self
1684    where
1685        T: std::convert::Into<crate::model::Gateway>,
1686    {
1687        self.gateway = std::option::Option::Some(v.into());
1688        self
1689    }
1690
1691    /// Sets or clears the value of [gateway][crate::model::CreateGatewayRequest::gateway].
1692    ///
1693    /// # Example
1694    /// ```ignore,no_run
1695    /// # use google_cloud_apigateway_v1::model::CreateGatewayRequest;
1696    /// use google_cloud_apigateway_v1::model::Gateway;
1697    /// let x = CreateGatewayRequest::new().set_or_clear_gateway(Some(Gateway::default()/* use setters */));
1698    /// let x = CreateGatewayRequest::new().set_or_clear_gateway(None::<Gateway>);
1699    /// ```
1700    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
1701    where
1702        T: std::convert::Into<crate::model::Gateway>,
1703    {
1704        self.gateway = v.map(|x| x.into());
1705        self
1706    }
1707}
1708
1709impl wkt::message::Message for CreateGatewayRequest {
1710    fn typename() -> &'static str {
1711        "type.googleapis.com/google.cloud.apigateway.v1.CreateGatewayRequest"
1712    }
1713}
1714
1715/// Request message for ApiGatewayService.UpdateGateway
1716#[derive(Clone, Default, PartialEq)]
1717#[non_exhaustive]
1718pub struct UpdateGatewayRequest {
1719    /// Field mask is used to specify the fields to be overwritten in the
1720    /// Gateway resource by the update.
1721    /// The fields specified in the update_mask are relative to the resource, not
1722    /// the full request. A field will be overwritten if it is in the mask. If the
1723    /// user does not provide a mask then all fields will be overwritten.
1724    pub update_mask: std::option::Option<wkt::FieldMask>,
1725
1726    /// Required. Gateway resource.
1727    pub gateway: std::option::Option<crate::model::Gateway>,
1728
1729    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1730}
1731
1732impl UpdateGatewayRequest {
1733    pub fn new() -> Self {
1734        std::default::Default::default()
1735    }
1736
1737    /// Sets the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
1738    ///
1739    /// # Example
1740    /// ```ignore,no_run
1741    /// # use google_cloud_apigateway_v1::model::UpdateGatewayRequest;
1742    /// use wkt::FieldMask;
1743    /// let x = UpdateGatewayRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1744    /// ```
1745    pub fn set_update_mask<T>(mut self, v: T) -> Self
1746    where
1747        T: std::convert::Into<wkt::FieldMask>,
1748    {
1749        self.update_mask = std::option::Option::Some(v.into());
1750        self
1751    }
1752
1753    /// Sets or clears the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
1754    ///
1755    /// # Example
1756    /// ```ignore,no_run
1757    /// # use google_cloud_apigateway_v1::model::UpdateGatewayRequest;
1758    /// use wkt::FieldMask;
1759    /// let x = UpdateGatewayRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1760    /// let x = UpdateGatewayRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1761    /// ```
1762    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1763    where
1764        T: std::convert::Into<wkt::FieldMask>,
1765    {
1766        self.update_mask = v.map(|x| x.into());
1767        self
1768    }
1769
1770    /// Sets the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
1771    ///
1772    /// # Example
1773    /// ```ignore,no_run
1774    /// # use google_cloud_apigateway_v1::model::UpdateGatewayRequest;
1775    /// use google_cloud_apigateway_v1::model::Gateway;
1776    /// let x = UpdateGatewayRequest::new().set_gateway(Gateway::default()/* use setters */);
1777    /// ```
1778    pub fn set_gateway<T>(mut self, v: T) -> Self
1779    where
1780        T: std::convert::Into<crate::model::Gateway>,
1781    {
1782        self.gateway = std::option::Option::Some(v.into());
1783        self
1784    }
1785
1786    /// Sets or clears the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
1787    ///
1788    /// # Example
1789    /// ```ignore,no_run
1790    /// # use google_cloud_apigateway_v1::model::UpdateGatewayRequest;
1791    /// use google_cloud_apigateway_v1::model::Gateway;
1792    /// let x = UpdateGatewayRequest::new().set_or_clear_gateway(Some(Gateway::default()/* use setters */));
1793    /// let x = UpdateGatewayRequest::new().set_or_clear_gateway(None::<Gateway>);
1794    /// ```
1795    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
1796    where
1797        T: std::convert::Into<crate::model::Gateway>,
1798    {
1799        self.gateway = v.map(|x| x.into());
1800        self
1801    }
1802}
1803
1804impl wkt::message::Message for UpdateGatewayRequest {
1805    fn typename() -> &'static str {
1806        "type.googleapis.com/google.cloud.apigateway.v1.UpdateGatewayRequest"
1807    }
1808}
1809
1810/// Request message for ApiGatewayService.DeleteGateway
1811#[derive(Clone, Default, PartialEq)]
1812#[non_exhaustive]
1813pub struct DeleteGatewayRequest {
1814    /// Required. Resource name of the form:
1815    /// `projects/*/locations/*/gateways/*`
1816    pub name: std::string::String,
1817
1818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1819}
1820
1821impl DeleteGatewayRequest {
1822    pub fn new() -> Self {
1823        std::default::Default::default()
1824    }
1825
1826    /// Sets the value of [name][crate::model::DeleteGatewayRequest::name].
1827    ///
1828    /// # Example
1829    /// ```ignore,no_run
1830    /// # use google_cloud_apigateway_v1::model::DeleteGatewayRequest;
1831    /// let x = DeleteGatewayRequest::new().set_name("example");
1832    /// ```
1833    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1834        self.name = v.into();
1835        self
1836    }
1837}
1838
1839impl wkt::message::Message for DeleteGatewayRequest {
1840    fn typename() -> &'static str {
1841        "type.googleapis.com/google.cloud.apigateway.v1.DeleteGatewayRequest"
1842    }
1843}
1844
1845/// Request message for ApiGatewayService.ListApis
1846#[derive(Clone, Default, PartialEq)]
1847#[non_exhaustive]
1848pub struct ListApisRequest {
1849    /// Required. Parent resource of the API, of the form:
1850    /// `projects/*/locations/global`
1851    pub parent: std::string::String,
1852
1853    /// Page size.
1854    pub page_size: i32,
1855
1856    /// Page token.
1857    pub page_token: std::string::String,
1858
1859    /// Filter.
1860    pub filter: std::string::String,
1861
1862    /// Order by parameters.
1863    pub order_by: std::string::String,
1864
1865    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1866}
1867
1868impl ListApisRequest {
1869    pub fn new() -> Self {
1870        std::default::Default::default()
1871    }
1872
1873    /// Sets the value of [parent][crate::model::ListApisRequest::parent].
1874    ///
1875    /// # Example
1876    /// ```ignore,no_run
1877    /// # use google_cloud_apigateway_v1::model::ListApisRequest;
1878    /// let x = ListApisRequest::new().set_parent("example");
1879    /// ```
1880    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1881        self.parent = v.into();
1882        self
1883    }
1884
1885    /// Sets the value of [page_size][crate::model::ListApisRequest::page_size].
1886    ///
1887    /// # Example
1888    /// ```ignore,no_run
1889    /// # use google_cloud_apigateway_v1::model::ListApisRequest;
1890    /// let x = ListApisRequest::new().set_page_size(42);
1891    /// ```
1892    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1893        self.page_size = v.into();
1894        self
1895    }
1896
1897    /// Sets the value of [page_token][crate::model::ListApisRequest::page_token].
1898    ///
1899    /// # Example
1900    /// ```ignore,no_run
1901    /// # use google_cloud_apigateway_v1::model::ListApisRequest;
1902    /// let x = ListApisRequest::new().set_page_token("example");
1903    /// ```
1904    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1905        self.page_token = v.into();
1906        self
1907    }
1908
1909    /// Sets the value of [filter][crate::model::ListApisRequest::filter].
1910    ///
1911    /// # Example
1912    /// ```ignore,no_run
1913    /// # use google_cloud_apigateway_v1::model::ListApisRequest;
1914    /// let x = ListApisRequest::new().set_filter("example");
1915    /// ```
1916    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1917        self.filter = v.into();
1918        self
1919    }
1920
1921    /// Sets the value of [order_by][crate::model::ListApisRequest::order_by].
1922    ///
1923    /// # Example
1924    /// ```ignore,no_run
1925    /// # use google_cloud_apigateway_v1::model::ListApisRequest;
1926    /// let x = ListApisRequest::new().set_order_by("example");
1927    /// ```
1928    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1929        self.order_by = v.into();
1930        self
1931    }
1932}
1933
1934impl wkt::message::Message for ListApisRequest {
1935    fn typename() -> &'static str {
1936        "type.googleapis.com/google.cloud.apigateway.v1.ListApisRequest"
1937    }
1938}
1939
1940/// Response message for ApiGatewayService.ListApis
1941#[derive(Clone, Default, PartialEq)]
1942#[non_exhaustive]
1943pub struct ListApisResponse {
1944    /// APIs.
1945    pub apis: std::vec::Vec<crate::model::Api>,
1946
1947    /// Next page token.
1948    pub next_page_token: std::string::String,
1949
1950    /// Locations that could not be reached.
1951    pub unreachable_locations: std::vec::Vec<std::string::String>,
1952
1953    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1954}
1955
1956impl ListApisResponse {
1957    pub fn new() -> Self {
1958        std::default::Default::default()
1959    }
1960
1961    /// Sets the value of [apis][crate::model::ListApisResponse::apis].
1962    ///
1963    /// # Example
1964    /// ```ignore,no_run
1965    /// # use google_cloud_apigateway_v1::model::ListApisResponse;
1966    /// use google_cloud_apigateway_v1::model::Api;
1967    /// let x = ListApisResponse::new()
1968    ///     .set_apis([
1969    ///         Api::default()/* use setters */,
1970    ///         Api::default()/* use (different) setters */,
1971    ///     ]);
1972    /// ```
1973    pub fn set_apis<T, V>(mut self, v: T) -> Self
1974    where
1975        T: std::iter::IntoIterator<Item = V>,
1976        V: std::convert::Into<crate::model::Api>,
1977    {
1978        use std::iter::Iterator;
1979        self.apis = v.into_iter().map(|i| i.into()).collect();
1980        self
1981    }
1982
1983    /// Sets the value of [next_page_token][crate::model::ListApisResponse::next_page_token].
1984    ///
1985    /// # Example
1986    /// ```ignore,no_run
1987    /// # use google_cloud_apigateway_v1::model::ListApisResponse;
1988    /// let x = ListApisResponse::new().set_next_page_token("example");
1989    /// ```
1990    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1991        self.next_page_token = v.into();
1992        self
1993    }
1994
1995    /// Sets the value of [unreachable_locations][crate::model::ListApisResponse::unreachable_locations].
1996    ///
1997    /// # Example
1998    /// ```ignore,no_run
1999    /// # use google_cloud_apigateway_v1::model::ListApisResponse;
2000    /// let x = ListApisResponse::new().set_unreachable_locations(["a", "b", "c"]);
2001    /// ```
2002    pub fn set_unreachable_locations<T, V>(mut self, v: T) -> Self
2003    where
2004        T: std::iter::IntoIterator<Item = V>,
2005        V: std::convert::Into<std::string::String>,
2006    {
2007        use std::iter::Iterator;
2008        self.unreachable_locations = v.into_iter().map(|i| i.into()).collect();
2009        self
2010    }
2011}
2012
2013impl wkt::message::Message for ListApisResponse {
2014    fn typename() -> &'static str {
2015        "type.googleapis.com/google.cloud.apigateway.v1.ListApisResponse"
2016    }
2017}
2018
2019#[doc(hidden)]
2020impl google_cloud_gax::paginator::internal::PageableResponse for ListApisResponse {
2021    type PageItem = crate::model::Api;
2022
2023    fn items(self) -> std::vec::Vec<Self::PageItem> {
2024        self.apis
2025    }
2026
2027    fn next_page_token(&self) -> std::string::String {
2028        use std::clone::Clone;
2029        self.next_page_token.clone()
2030    }
2031}
2032
2033/// Request message for ApiGatewayService.GetApi
2034#[derive(Clone, Default, PartialEq)]
2035#[non_exhaustive]
2036pub struct GetApiRequest {
2037    /// Required. Resource name of the form:
2038    /// `projects/*/locations/global/apis/*`
2039    pub name: std::string::String,
2040
2041    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2042}
2043
2044impl GetApiRequest {
2045    pub fn new() -> Self {
2046        std::default::Default::default()
2047    }
2048
2049    /// Sets the value of [name][crate::model::GetApiRequest::name].
2050    ///
2051    /// # Example
2052    /// ```ignore,no_run
2053    /// # use google_cloud_apigateway_v1::model::GetApiRequest;
2054    /// let x = GetApiRequest::new().set_name("example");
2055    /// ```
2056    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2057        self.name = v.into();
2058        self
2059    }
2060}
2061
2062impl wkt::message::Message for GetApiRequest {
2063    fn typename() -> &'static str {
2064        "type.googleapis.com/google.cloud.apigateway.v1.GetApiRequest"
2065    }
2066}
2067
2068/// Request message for ApiGatewayService.CreateApi
2069#[derive(Clone, Default, PartialEq)]
2070#[non_exhaustive]
2071pub struct CreateApiRequest {
2072    /// Required. Parent resource of the API, of the form:
2073    /// `projects/*/locations/global`
2074    pub parent: std::string::String,
2075
2076    /// Required. Identifier to assign to the API. Must be unique within scope of
2077    /// the parent resource.
2078    pub api_id: std::string::String,
2079
2080    /// Required. API resource.
2081    pub api: std::option::Option<crate::model::Api>,
2082
2083    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2084}
2085
2086impl CreateApiRequest {
2087    pub fn new() -> Self {
2088        std::default::Default::default()
2089    }
2090
2091    /// Sets the value of [parent][crate::model::CreateApiRequest::parent].
2092    ///
2093    /// # Example
2094    /// ```ignore,no_run
2095    /// # use google_cloud_apigateway_v1::model::CreateApiRequest;
2096    /// let x = CreateApiRequest::new().set_parent("example");
2097    /// ```
2098    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2099        self.parent = v.into();
2100        self
2101    }
2102
2103    /// Sets the value of [api_id][crate::model::CreateApiRequest::api_id].
2104    ///
2105    /// # Example
2106    /// ```ignore,no_run
2107    /// # use google_cloud_apigateway_v1::model::CreateApiRequest;
2108    /// let x = CreateApiRequest::new().set_api_id("example");
2109    /// ```
2110    pub fn set_api_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2111        self.api_id = v.into();
2112        self
2113    }
2114
2115    /// Sets the value of [api][crate::model::CreateApiRequest::api].
2116    ///
2117    /// # Example
2118    /// ```ignore,no_run
2119    /// # use google_cloud_apigateway_v1::model::CreateApiRequest;
2120    /// use google_cloud_apigateway_v1::model::Api;
2121    /// let x = CreateApiRequest::new().set_api(Api::default()/* use setters */);
2122    /// ```
2123    pub fn set_api<T>(mut self, v: T) -> Self
2124    where
2125        T: std::convert::Into<crate::model::Api>,
2126    {
2127        self.api = std::option::Option::Some(v.into());
2128        self
2129    }
2130
2131    /// Sets or clears the value of [api][crate::model::CreateApiRequest::api].
2132    ///
2133    /// # Example
2134    /// ```ignore,no_run
2135    /// # use google_cloud_apigateway_v1::model::CreateApiRequest;
2136    /// use google_cloud_apigateway_v1::model::Api;
2137    /// let x = CreateApiRequest::new().set_or_clear_api(Some(Api::default()/* use setters */));
2138    /// let x = CreateApiRequest::new().set_or_clear_api(None::<Api>);
2139    /// ```
2140    pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
2141    where
2142        T: std::convert::Into<crate::model::Api>,
2143    {
2144        self.api = v.map(|x| x.into());
2145        self
2146    }
2147}
2148
2149impl wkt::message::Message for CreateApiRequest {
2150    fn typename() -> &'static str {
2151        "type.googleapis.com/google.cloud.apigateway.v1.CreateApiRequest"
2152    }
2153}
2154
2155/// Request message for ApiGatewayService.UpdateApi
2156#[derive(Clone, Default, PartialEq)]
2157#[non_exhaustive]
2158pub struct UpdateApiRequest {
2159    /// Field mask is used to specify the fields to be overwritten in the
2160    /// Api resource by the update.
2161    /// The fields specified in the update_mask are relative to the resource, not
2162    /// the full request. A field will be overwritten if it is in the mask. If the
2163    /// user does not provide a mask then all fields will be overwritten.
2164    pub update_mask: std::option::Option<wkt::FieldMask>,
2165
2166    /// Required. API resource.
2167    pub api: std::option::Option<crate::model::Api>,
2168
2169    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2170}
2171
2172impl UpdateApiRequest {
2173    pub fn new() -> Self {
2174        std::default::Default::default()
2175    }
2176
2177    /// Sets the value of [update_mask][crate::model::UpdateApiRequest::update_mask].
2178    ///
2179    /// # Example
2180    /// ```ignore,no_run
2181    /// # use google_cloud_apigateway_v1::model::UpdateApiRequest;
2182    /// use wkt::FieldMask;
2183    /// let x = UpdateApiRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2184    /// ```
2185    pub fn set_update_mask<T>(mut self, v: T) -> Self
2186    where
2187        T: std::convert::Into<wkt::FieldMask>,
2188    {
2189        self.update_mask = std::option::Option::Some(v.into());
2190        self
2191    }
2192
2193    /// Sets or clears the value of [update_mask][crate::model::UpdateApiRequest::update_mask].
2194    ///
2195    /// # Example
2196    /// ```ignore,no_run
2197    /// # use google_cloud_apigateway_v1::model::UpdateApiRequest;
2198    /// use wkt::FieldMask;
2199    /// let x = UpdateApiRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2200    /// let x = UpdateApiRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2201    /// ```
2202    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2203    where
2204        T: std::convert::Into<wkt::FieldMask>,
2205    {
2206        self.update_mask = v.map(|x| x.into());
2207        self
2208    }
2209
2210    /// Sets the value of [api][crate::model::UpdateApiRequest::api].
2211    ///
2212    /// # Example
2213    /// ```ignore,no_run
2214    /// # use google_cloud_apigateway_v1::model::UpdateApiRequest;
2215    /// use google_cloud_apigateway_v1::model::Api;
2216    /// let x = UpdateApiRequest::new().set_api(Api::default()/* use setters */);
2217    /// ```
2218    pub fn set_api<T>(mut self, v: T) -> Self
2219    where
2220        T: std::convert::Into<crate::model::Api>,
2221    {
2222        self.api = std::option::Option::Some(v.into());
2223        self
2224    }
2225
2226    /// Sets or clears the value of [api][crate::model::UpdateApiRequest::api].
2227    ///
2228    /// # Example
2229    /// ```ignore,no_run
2230    /// # use google_cloud_apigateway_v1::model::UpdateApiRequest;
2231    /// use google_cloud_apigateway_v1::model::Api;
2232    /// let x = UpdateApiRequest::new().set_or_clear_api(Some(Api::default()/* use setters */));
2233    /// let x = UpdateApiRequest::new().set_or_clear_api(None::<Api>);
2234    /// ```
2235    pub fn set_or_clear_api<T>(mut self, v: std::option::Option<T>) -> Self
2236    where
2237        T: std::convert::Into<crate::model::Api>,
2238    {
2239        self.api = v.map(|x| x.into());
2240        self
2241    }
2242}
2243
2244impl wkt::message::Message for UpdateApiRequest {
2245    fn typename() -> &'static str {
2246        "type.googleapis.com/google.cloud.apigateway.v1.UpdateApiRequest"
2247    }
2248}
2249
2250/// Request message for ApiGatewayService.DeleteApi
2251#[derive(Clone, Default, PartialEq)]
2252#[non_exhaustive]
2253pub struct DeleteApiRequest {
2254    /// Required. Resource name of the form:
2255    /// `projects/*/locations/global/apis/*`
2256    pub name: std::string::String,
2257
2258    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2259}
2260
2261impl DeleteApiRequest {
2262    pub fn new() -> Self {
2263        std::default::Default::default()
2264    }
2265
2266    /// Sets the value of [name][crate::model::DeleteApiRequest::name].
2267    ///
2268    /// # Example
2269    /// ```ignore,no_run
2270    /// # use google_cloud_apigateway_v1::model::DeleteApiRequest;
2271    /// let x = DeleteApiRequest::new().set_name("example");
2272    /// ```
2273    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2274        self.name = v.into();
2275        self
2276    }
2277}
2278
2279impl wkt::message::Message for DeleteApiRequest {
2280    fn typename() -> &'static str {
2281        "type.googleapis.com/google.cloud.apigateway.v1.DeleteApiRequest"
2282    }
2283}
2284
2285/// Request message for ApiGatewayService.ListApiConfigs
2286#[derive(Clone, Default, PartialEq)]
2287#[non_exhaustive]
2288pub struct ListApiConfigsRequest {
2289    /// Required. Parent resource of the API Config, of the form:
2290    /// `projects/*/locations/global/apis/*`
2291    pub parent: std::string::String,
2292
2293    /// Page size.
2294    pub page_size: i32,
2295
2296    /// Page token.
2297    pub page_token: std::string::String,
2298
2299    /// Filter.
2300    pub filter: std::string::String,
2301
2302    /// Order by parameters.
2303    pub order_by: std::string::String,
2304
2305    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2306}
2307
2308impl ListApiConfigsRequest {
2309    pub fn new() -> Self {
2310        std::default::Default::default()
2311    }
2312
2313    /// Sets the value of [parent][crate::model::ListApiConfigsRequest::parent].
2314    ///
2315    /// # Example
2316    /// ```ignore,no_run
2317    /// # use google_cloud_apigateway_v1::model::ListApiConfigsRequest;
2318    /// let x = ListApiConfigsRequest::new().set_parent("example");
2319    /// ```
2320    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2321        self.parent = v.into();
2322        self
2323    }
2324
2325    /// Sets the value of [page_size][crate::model::ListApiConfigsRequest::page_size].
2326    ///
2327    /// # Example
2328    /// ```ignore,no_run
2329    /// # use google_cloud_apigateway_v1::model::ListApiConfigsRequest;
2330    /// let x = ListApiConfigsRequest::new().set_page_size(42);
2331    /// ```
2332    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2333        self.page_size = v.into();
2334        self
2335    }
2336
2337    /// Sets the value of [page_token][crate::model::ListApiConfigsRequest::page_token].
2338    ///
2339    /// # Example
2340    /// ```ignore,no_run
2341    /// # use google_cloud_apigateway_v1::model::ListApiConfigsRequest;
2342    /// let x = ListApiConfigsRequest::new().set_page_token("example");
2343    /// ```
2344    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2345        self.page_token = v.into();
2346        self
2347    }
2348
2349    /// Sets the value of [filter][crate::model::ListApiConfigsRequest::filter].
2350    ///
2351    /// # Example
2352    /// ```ignore,no_run
2353    /// # use google_cloud_apigateway_v1::model::ListApiConfigsRequest;
2354    /// let x = ListApiConfigsRequest::new().set_filter("example");
2355    /// ```
2356    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2357        self.filter = v.into();
2358        self
2359    }
2360
2361    /// Sets the value of [order_by][crate::model::ListApiConfigsRequest::order_by].
2362    ///
2363    /// # Example
2364    /// ```ignore,no_run
2365    /// # use google_cloud_apigateway_v1::model::ListApiConfigsRequest;
2366    /// let x = ListApiConfigsRequest::new().set_order_by("example");
2367    /// ```
2368    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2369        self.order_by = v.into();
2370        self
2371    }
2372}
2373
2374impl wkt::message::Message for ListApiConfigsRequest {
2375    fn typename() -> &'static str {
2376        "type.googleapis.com/google.cloud.apigateway.v1.ListApiConfigsRequest"
2377    }
2378}
2379
2380/// Response message for ApiGatewayService.ListApiConfigs
2381#[derive(Clone, Default, PartialEq)]
2382#[non_exhaustive]
2383pub struct ListApiConfigsResponse {
2384    /// API Configs.
2385    pub api_configs: std::vec::Vec<crate::model::ApiConfig>,
2386
2387    /// Next page token.
2388    pub next_page_token: std::string::String,
2389
2390    /// Locations that could not be reached.
2391    pub unreachable_locations: std::vec::Vec<std::string::String>,
2392
2393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2394}
2395
2396impl ListApiConfigsResponse {
2397    pub fn new() -> Self {
2398        std::default::Default::default()
2399    }
2400
2401    /// Sets the value of [api_configs][crate::model::ListApiConfigsResponse::api_configs].
2402    ///
2403    /// # Example
2404    /// ```ignore,no_run
2405    /// # use google_cloud_apigateway_v1::model::ListApiConfigsResponse;
2406    /// use google_cloud_apigateway_v1::model::ApiConfig;
2407    /// let x = ListApiConfigsResponse::new()
2408    ///     .set_api_configs([
2409    ///         ApiConfig::default()/* use setters */,
2410    ///         ApiConfig::default()/* use (different) setters */,
2411    ///     ]);
2412    /// ```
2413    pub fn set_api_configs<T, V>(mut self, v: T) -> Self
2414    where
2415        T: std::iter::IntoIterator<Item = V>,
2416        V: std::convert::Into<crate::model::ApiConfig>,
2417    {
2418        use std::iter::Iterator;
2419        self.api_configs = v.into_iter().map(|i| i.into()).collect();
2420        self
2421    }
2422
2423    /// Sets the value of [next_page_token][crate::model::ListApiConfigsResponse::next_page_token].
2424    ///
2425    /// # Example
2426    /// ```ignore,no_run
2427    /// # use google_cloud_apigateway_v1::model::ListApiConfigsResponse;
2428    /// let x = ListApiConfigsResponse::new().set_next_page_token("example");
2429    /// ```
2430    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2431        self.next_page_token = v.into();
2432        self
2433    }
2434
2435    /// Sets the value of [unreachable_locations][crate::model::ListApiConfigsResponse::unreachable_locations].
2436    ///
2437    /// # Example
2438    /// ```ignore,no_run
2439    /// # use google_cloud_apigateway_v1::model::ListApiConfigsResponse;
2440    /// let x = ListApiConfigsResponse::new().set_unreachable_locations(["a", "b", "c"]);
2441    /// ```
2442    pub fn set_unreachable_locations<T, V>(mut self, v: T) -> Self
2443    where
2444        T: std::iter::IntoIterator<Item = V>,
2445        V: std::convert::Into<std::string::String>,
2446    {
2447        use std::iter::Iterator;
2448        self.unreachable_locations = v.into_iter().map(|i| i.into()).collect();
2449        self
2450    }
2451}
2452
2453impl wkt::message::Message for ListApiConfigsResponse {
2454    fn typename() -> &'static str {
2455        "type.googleapis.com/google.cloud.apigateway.v1.ListApiConfigsResponse"
2456    }
2457}
2458
2459#[doc(hidden)]
2460impl google_cloud_gax::paginator::internal::PageableResponse for ListApiConfigsResponse {
2461    type PageItem = crate::model::ApiConfig;
2462
2463    fn items(self) -> std::vec::Vec<Self::PageItem> {
2464        self.api_configs
2465    }
2466
2467    fn next_page_token(&self) -> std::string::String {
2468        use std::clone::Clone;
2469        self.next_page_token.clone()
2470    }
2471}
2472
2473/// Request message for ApiGatewayService.GetApiConfig
2474#[derive(Clone, Default, PartialEq)]
2475#[non_exhaustive]
2476pub struct GetApiConfigRequest {
2477    /// Required. Resource name of the form:
2478    /// `projects/*/locations/global/apis/*/configs/*`
2479    pub name: std::string::String,
2480
2481    /// Specifies which fields of the API Config are returned in the response.
2482    /// Defaults to `BASIC` view.
2483    pub view: crate::model::get_api_config_request::ConfigView,
2484
2485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2486}
2487
2488impl GetApiConfigRequest {
2489    pub fn new() -> Self {
2490        std::default::Default::default()
2491    }
2492
2493    /// Sets the value of [name][crate::model::GetApiConfigRequest::name].
2494    ///
2495    /// # Example
2496    /// ```ignore,no_run
2497    /// # use google_cloud_apigateway_v1::model::GetApiConfigRequest;
2498    /// let x = GetApiConfigRequest::new().set_name("example");
2499    /// ```
2500    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2501        self.name = v.into();
2502        self
2503    }
2504
2505    /// Sets the value of [view][crate::model::GetApiConfigRequest::view].
2506    ///
2507    /// # Example
2508    /// ```ignore,no_run
2509    /// # use google_cloud_apigateway_v1::model::GetApiConfigRequest;
2510    /// use google_cloud_apigateway_v1::model::get_api_config_request::ConfigView;
2511    /// let x0 = GetApiConfigRequest::new().set_view(ConfigView::Basic);
2512    /// let x1 = GetApiConfigRequest::new().set_view(ConfigView::Full);
2513    /// ```
2514    pub fn set_view<T: std::convert::Into<crate::model::get_api_config_request::ConfigView>>(
2515        mut self,
2516        v: T,
2517    ) -> Self {
2518        self.view = v.into();
2519        self
2520    }
2521}
2522
2523impl wkt::message::Message for GetApiConfigRequest {
2524    fn typename() -> &'static str {
2525        "type.googleapis.com/google.cloud.apigateway.v1.GetApiConfigRequest"
2526    }
2527}
2528
2529/// Defines additional types related to [GetApiConfigRequest].
2530pub mod get_api_config_request {
2531    #[allow(unused_imports)]
2532    use super::*;
2533
2534    /// Enum to control which fields should be included in the response.
2535    ///
2536    /// # Working with unknown values
2537    ///
2538    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2539    /// additional enum variants at any time. Adding new variants is not considered
2540    /// a breaking change. Applications should write their code in anticipation of:
2541    ///
2542    /// - New values appearing in future releases of the client library, **and**
2543    /// - New values received dynamically, without application changes.
2544    ///
2545    /// Please consult the [Working with enums] section in the user guide for some
2546    /// guidelines.
2547    ///
2548    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2549    #[derive(Clone, Debug, PartialEq)]
2550    #[non_exhaustive]
2551    pub enum ConfigView {
2552        Unspecified,
2553        /// Do not include configuration source files.
2554        Basic,
2555        /// Include configuration source files.
2556        Full,
2557        /// If set, the enum was initialized with an unknown value.
2558        ///
2559        /// Applications can examine the value using [ConfigView::value] or
2560        /// [ConfigView::name].
2561        UnknownValue(config_view::UnknownValue),
2562    }
2563
2564    #[doc(hidden)]
2565    pub mod config_view {
2566        #[allow(unused_imports)]
2567        use super::*;
2568        #[derive(Clone, Debug, PartialEq)]
2569        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2570    }
2571
2572    impl ConfigView {
2573        /// Gets the enum value.
2574        ///
2575        /// Returns `None` if the enum contains an unknown value deserialized from
2576        /// the string representation of enums.
2577        pub fn value(&self) -> std::option::Option<i32> {
2578            match self {
2579                Self::Unspecified => std::option::Option::Some(0),
2580                Self::Basic => std::option::Option::Some(1),
2581                Self::Full => std::option::Option::Some(2),
2582                Self::UnknownValue(u) => u.0.value(),
2583            }
2584        }
2585
2586        /// Gets the enum value as a string.
2587        ///
2588        /// Returns `None` if the enum contains an unknown value deserialized from
2589        /// the integer representation of enums.
2590        pub fn name(&self) -> std::option::Option<&str> {
2591            match self {
2592                Self::Unspecified => std::option::Option::Some("CONFIG_VIEW_UNSPECIFIED"),
2593                Self::Basic => std::option::Option::Some("BASIC"),
2594                Self::Full => std::option::Option::Some("FULL"),
2595                Self::UnknownValue(u) => u.0.name(),
2596            }
2597        }
2598    }
2599
2600    impl std::default::Default for ConfigView {
2601        fn default() -> Self {
2602            use std::convert::From;
2603            Self::from(0)
2604        }
2605    }
2606
2607    impl std::fmt::Display for ConfigView {
2608        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2609            wkt::internal::display_enum(f, self.name(), self.value())
2610        }
2611    }
2612
2613    impl std::convert::From<i32> for ConfigView {
2614        fn from(value: i32) -> Self {
2615            match value {
2616                0 => Self::Unspecified,
2617                1 => Self::Basic,
2618                2 => Self::Full,
2619                _ => Self::UnknownValue(config_view::UnknownValue(
2620                    wkt::internal::UnknownEnumValue::Integer(value),
2621                )),
2622            }
2623        }
2624    }
2625
2626    impl std::convert::From<&str> for ConfigView {
2627        fn from(value: &str) -> Self {
2628            use std::string::ToString;
2629            match value {
2630                "CONFIG_VIEW_UNSPECIFIED" => Self::Unspecified,
2631                "BASIC" => Self::Basic,
2632                "FULL" => Self::Full,
2633                _ => Self::UnknownValue(config_view::UnknownValue(
2634                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2635                )),
2636            }
2637        }
2638    }
2639
2640    impl serde::ser::Serialize for ConfigView {
2641        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2642        where
2643            S: serde::Serializer,
2644        {
2645            match self {
2646                Self::Unspecified => serializer.serialize_i32(0),
2647                Self::Basic => serializer.serialize_i32(1),
2648                Self::Full => serializer.serialize_i32(2),
2649                Self::UnknownValue(u) => u.0.serialize(serializer),
2650            }
2651        }
2652    }
2653
2654    impl<'de> serde::de::Deserialize<'de> for ConfigView {
2655        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2656        where
2657            D: serde::Deserializer<'de>,
2658        {
2659            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConfigView>::new(
2660                ".google.cloud.apigateway.v1.GetApiConfigRequest.ConfigView",
2661            ))
2662        }
2663    }
2664}
2665
2666/// Request message for ApiGatewayService.CreateApiConfig
2667#[derive(Clone, Default, PartialEq)]
2668#[non_exhaustive]
2669pub struct CreateApiConfigRequest {
2670    /// Required. Parent resource of the API Config, of the form:
2671    /// `projects/*/locations/global/apis/*`
2672    pub parent: std::string::String,
2673
2674    /// Required. Identifier to assign to the API Config. Must be unique within scope of
2675    /// the parent resource.
2676    pub api_config_id: std::string::String,
2677
2678    /// Required. API resource.
2679    pub api_config: std::option::Option<crate::model::ApiConfig>,
2680
2681    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2682}
2683
2684impl CreateApiConfigRequest {
2685    pub fn new() -> Self {
2686        std::default::Default::default()
2687    }
2688
2689    /// Sets the value of [parent][crate::model::CreateApiConfigRequest::parent].
2690    ///
2691    /// # Example
2692    /// ```ignore,no_run
2693    /// # use google_cloud_apigateway_v1::model::CreateApiConfigRequest;
2694    /// let x = CreateApiConfigRequest::new().set_parent("example");
2695    /// ```
2696    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2697        self.parent = v.into();
2698        self
2699    }
2700
2701    /// Sets the value of [api_config_id][crate::model::CreateApiConfigRequest::api_config_id].
2702    ///
2703    /// # Example
2704    /// ```ignore,no_run
2705    /// # use google_cloud_apigateway_v1::model::CreateApiConfigRequest;
2706    /// let x = CreateApiConfigRequest::new().set_api_config_id("example");
2707    /// ```
2708    pub fn set_api_config_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2709        self.api_config_id = v.into();
2710        self
2711    }
2712
2713    /// Sets the value of [api_config][crate::model::CreateApiConfigRequest::api_config].
2714    ///
2715    /// # Example
2716    /// ```ignore,no_run
2717    /// # use google_cloud_apigateway_v1::model::CreateApiConfigRequest;
2718    /// use google_cloud_apigateway_v1::model::ApiConfig;
2719    /// let x = CreateApiConfigRequest::new().set_api_config(ApiConfig::default()/* use setters */);
2720    /// ```
2721    pub fn set_api_config<T>(mut self, v: T) -> Self
2722    where
2723        T: std::convert::Into<crate::model::ApiConfig>,
2724    {
2725        self.api_config = std::option::Option::Some(v.into());
2726        self
2727    }
2728
2729    /// Sets or clears the value of [api_config][crate::model::CreateApiConfigRequest::api_config].
2730    ///
2731    /// # Example
2732    /// ```ignore,no_run
2733    /// # use google_cloud_apigateway_v1::model::CreateApiConfigRequest;
2734    /// use google_cloud_apigateway_v1::model::ApiConfig;
2735    /// let x = CreateApiConfigRequest::new().set_or_clear_api_config(Some(ApiConfig::default()/* use setters */));
2736    /// let x = CreateApiConfigRequest::new().set_or_clear_api_config(None::<ApiConfig>);
2737    /// ```
2738    pub fn set_or_clear_api_config<T>(mut self, v: std::option::Option<T>) -> Self
2739    where
2740        T: std::convert::Into<crate::model::ApiConfig>,
2741    {
2742        self.api_config = v.map(|x| x.into());
2743        self
2744    }
2745}
2746
2747impl wkt::message::Message for CreateApiConfigRequest {
2748    fn typename() -> &'static str {
2749        "type.googleapis.com/google.cloud.apigateway.v1.CreateApiConfigRequest"
2750    }
2751}
2752
2753/// Request message for ApiGatewayService.UpdateApiConfig
2754#[derive(Clone, Default, PartialEq)]
2755#[non_exhaustive]
2756pub struct UpdateApiConfigRequest {
2757    /// Field mask is used to specify the fields to be overwritten in the
2758    /// ApiConfig resource by the update.
2759    /// The fields specified in the update_mask are relative to the resource, not
2760    /// the full request. A field will be overwritten if it is in the mask. If the
2761    /// user does not provide a mask then all fields will be overwritten.
2762    pub update_mask: std::option::Option<wkt::FieldMask>,
2763
2764    /// Required. API Config resource.
2765    pub api_config: std::option::Option<crate::model::ApiConfig>,
2766
2767    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2768}
2769
2770impl UpdateApiConfigRequest {
2771    pub fn new() -> Self {
2772        std::default::Default::default()
2773    }
2774
2775    /// Sets the value of [update_mask][crate::model::UpdateApiConfigRequest::update_mask].
2776    ///
2777    /// # Example
2778    /// ```ignore,no_run
2779    /// # use google_cloud_apigateway_v1::model::UpdateApiConfigRequest;
2780    /// use wkt::FieldMask;
2781    /// let x = UpdateApiConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2782    /// ```
2783    pub fn set_update_mask<T>(mut self, v: T) -> Self
2784    where
2785        T: std::convert::Into<wkt::FieldMask>,
2786    {
2787        self.update_mask = std::option::Option::Some(v.into());
2788        self
2789    }
2790
2791    /// Sets or clears the value of [update_mask][crate::model::UpdateApiConfigRequest::update_mask].
2792    ///
2793    /// # Example
2794    /// ```ignore,no_run
2795    /// # use google_cloud_apigateway_v1::model::UpdateApiConfigRequest;
2796    /// use wkt::FieldMask;
2797    /// let x = UpdateApiConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2798    /// let x = UpdateApiConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2799    /// ```
2800    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2801    where
2802        T: std::convert::Into<wkt::FieldMask>,
2803    {
2804        self.update_mask = v.map(|x| x.into());
2805        self
2806    }
2807
2808    /// Sets the value of [api_config][crate::model::UpdateApiConfigRequest::api_config].
2809    ///
2810    /// # Example
2811    /// ```ignore,no_run
2812    /// # use google_cloud_apigateway_v1::model::UpdateApiConfigRequest;
2813    /// use google_cloud_apigateway_v1::model::ApiConfig;
2814    /// let x = UpdateApiConfigRequest::new().set_api_config(ApiConfig::default()/* use setters */);
2815    /// ```
2816    pub fn set_api_config<T>(mut self, v: T) -> Self
2817    where
2818        T: std::convert::Into<crate::model::ApiConfig>,
2819    {
2820        self.api_config = std::option::Option::Some(v.into());
2821        self
2822    }
2823
2824    /// Sets or clears the value of [api_config][crate::model::UpdateApiConfigRequest::api_config].
2825    ///
2826    /// # Example
2827    /// ```ignore,no_run
2828    /// # use google_cloud_apigateway_v1::model::UpdateApiConfigRequest;
2829    /// use google_cloud_apigateway_v1::model::ApiConfig;
2830    /// let x = UpdateApiConfigRequest::new().set_or_clear_api_config(Some(ApiConfig::default()/* use setters */));
2831    /// let x = UpdateApiConfigRequest::new().set_or_clear_api_config(None::<ApiConfig>);
2832    /// ```
2833    pub fn set_or_clear_api_config<T>(mut self, v: std::option::Option<T>) -> Self
2834    where
2835        T: std::convert::Into<crate::model::ApiConfig>,
2836    {
2837        self.api_config = v.map(|x| x.into());
2838        self
2839    }
2840}
2841
2842impl wkt::message::Message for UpdateApiConfigRequest {
2843    fn typename() -> &'static str {
2844        "type.googleapis.com/google.cloud.apigateway.v1.UpdateApiConfigRequest"
2845    }
2846}
2847
2848/// Request message for ApiGatewayService.DeleteApiConfig
2849#[derive(Clone, Default, PartialEq)]
2850#[non_exhaustive]
2851pub struct DeleteApiConfigRequest {
2852    /// Required. Resource name of the form:
2853    /// `projects/*/locations/global/apis/*/configs/*`
2854    pub name: std::string::String,
2855
2856    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2857}
2858
2859impl DeleteApiConfigRequest {
2860    pub fn new() -> Self {
2861        std::default::Default::default()
2862    }
2863
2864    /// Sets the value of [name][crate::model::DeleteApiConfigRequest::name].
2865    ///
2866    /// # Example
2867    /// ```ignore,no_run
2868    /// # use google_cloud_apigateway_v1::model::DeleteApiConfigRequest;
2869    /// let x = DeleteApiConfigRequest::new().set_name("example");
2870    /// ```
2871    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2872        self.name = v.into();
2873        self
2874    }
2875}
2876
2877impl wkt::message::Message for DeleteApiConfigRequest {
2878    fn typename() -> &'static str {
2879        "type.googleapis.com/google.cloud.apigateway.v1.DeleteApiConfigRequest"
2880    }
2881}
2882
2883/// Represents the metadata of the long-running operation.
2884#[derive(Clone, Default, PartialEq)]
2885#[non_exhaustive]
2886pub struct OperationMetadata {
2887    /// Output only. The time the operation was created.
2888    pub create_time: std::option::Option<wkt::Timestamp>,
2889
2890    /// Output only. The time the operation finished running.
2891    pub end_time: std::option::Option<wkt::Timestamp>,
2892
2893    /// Output only. Server-defined resource path for the target of the operation.
2894    pub target: std::string::String,
2895
2896    /// Output only. Name of the verb executed by the operation.
2897    pub verb: std::string::String,
2898
2899    /// Output only. Human-readable status of the operation, if any.
2900    pub status_message: std::string::String,
2901
2902    /// Output only. Identifies whether the user has requested cancellation
2903    /// of the operation. Operations that have successfully been cancelled
2904    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
2905    /// corresponding to `Code.CANCELLED`.
2906    ///
2907    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
2908    pub requested_cancellation: bool,
2909
2910    /// Output only. API version used to start the operation.
2911    pub api_version: std::string::String,
2912
2913    /// Output only. Diagnostics generated during processing of configuration source files.
2914    pub diagnostics: std::vec::Vec<crate::model::operation_metadata::Diagnostic>,
2915
2916    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2917}
2918
2919impl OperationMetadata {
2920    pub fn new() -> Self {
2921        std::default::Default::default()
2922    }
2923
2924    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
2925    ///
2926    /// # Example
2927    /// ```ignore,no_run
2928    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
2929    /// use wkt::Timestamp;
2930    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2931    /// ```
2932    pub fn set_create_time<T>(mut self, v: T) -> Self
2933    where
2934        T: std::convert::Into<wkt::Timestamp>,
2935    {
2936        self.create_time = std::option::Option::Some(v.into());
2937        self
2938    }
2939
2940    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
2941    ///
2942    /// # Example
2943    /// ```ignore,no_run
2944    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
2945    /// use wkt::Timestamp;
2946    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2947    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2948    /// ```
2949    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2950    where
2951        T: std::convert::Into<wkt::Timestamp>,
2952    {
2953        self.create_time = v.map(|x| x.into());
2954        self
2955    }
2956
2957    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
2958    ///
2959    /// # Example
2960    /// ```ignore,no_run
2961    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
2962    /// use wkt::Timestamp;
2963    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
2964    /// ```
2965    pub fn set_end_time<T>(mut self, v: T) -> Self
2966    where
2967        T: std::convert::Into<wkt::Timestamp>,
2968    {
2969        self.end_time = std::option::Option::Some(v.into());
2970        self
2971    }
2972
2973    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
2974    ///
2975    /// # Example
2976    /// ```ignore,no_run
2977    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
2978    /// use wkt::Timestamp;
2979    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2980    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
2981    /// ```
2982    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2983    where
2984        T: std::convert::Into<wkt::Timestamp>,
2985    {
2986        self.end_time = v.map(|x| x.into());
2987        self
2988    }
2989
2990    /// Sets the value of [target][crate::model::OperationMetadata::target].
2991    ///
2992    /// # Example
2993    /// ```ignore,no_run
2994    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
2995    /// let x = OperationMetadata::new().set_target("example");
2996    /// ```
2997    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2998        self.target = v.into();
2999        self
3000    }
3001
3002    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
3003    ///
3004    /// # Example
3005    /// ```ignore,no_run
3006    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
3007    /// let x = OperationMetadata::new().set_verb("example");
3008    /// ```
3009    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3010        self.verb = v.into();
3011        self
3012    }
3013
3014    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
3015    ///
3016    /// # Example
3017    /// ```ignore,no_run
3018    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
3019    /// let x = OperationMetadata::new().set_status_message("example");
3020    /// ```
3021    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3022        self.status_message = v.into();
3023        self
3024    }
3025
3026    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
3027    ///
3028    /// # Example
3029    /// ```ignore,no_run
3030    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
3031    /// let x = OperationMetadata::new().set_requested_cancellation(true);
3032    /// ```
3033    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3034        self.requested_cancellation = v.into();
3035        self
3036    }
3037
3038    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
3039    ///
3040    /// # Example
3041    /// ```ignore,no_run
3042    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
3043    /// let x = OperationMetadata::new().set_api_version("example");
3044    /// ```
3045    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3046        self.api_version = v.into();
3047        self
3048    }
3049
3050    /// Sets the value of [diagnostics][crate::model::OperationMetadata::diagnostics].
3051    ///
3052    /// # Example
3053    /// ```ignore,no_run
3054    /// # use google_cloud_apigateway_v1::model::OperationMetadata;
3055    /// use google_cloud_apigateway_v1::model::operation_metadata::Diagnostic;
3056    /// let x = OperationMetadata::new()
3057    ///     .set_diagnostics([
3058    ///         Diagnostic::default()/* use setters */,
3059    ///         Diagnostic::default()/* use (different) setters */,
3060    ///     ]);
3061    /// ```
3062    pub fn set_diagnostics<T, V>(mut self, v: T) -> Self
3063    where
3064        T: std::iter::IntoIterator<Item = V>,
3065        V: std::convert::Into<crate::model::operation_metadata::Diagnostic>,
3066    {
3067        use std::iter::Iterator;
3068        self.diagnostics = v.into_iter().map(|i| i.into()).collect();
3069        self
3070    }
3071}
3072
3073impl wkt::message::Message for OperationMetadata {
3074    fn typename() -> &'static str {
3075        "type.googleapis.com/google.cloud.apigateway.v1.OperationMetadata"
3076    }
3077}
3078
3079/// Defines additional types related to [OperationMetadata].
3080pub mod operation_metadata {
3081    #[allow(unused_imports)]
3082    use super::*;
3083
3084    /// Diagnostic information from configuration processing.
3085    #[derive(Clone, Default, PartialEq)]
3086    #[non_exhaustive]
3087    pub struct Diagnostic {
3088        /// Location of the diagnostic.
3089        pub location: std::string::String,
3090
3091        /// The diagnostic message.
3092        pub message: std::string::String,
3093
3094        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3095    }
3096
3097    impl Diagnostic {
3098        pub fn new() -> Self {
3099            std::default::Default::default()
3100        }
3101
3102        /// Sets the value of [location][crate::model::operation_metadata::Diagnostic::location].
3103        ///
3104        /// # Example
3105        /// ```ignore,no_run
3106        /// # use google_cloud_apigateway_v1::model::operation_metadata::Diagnostic;
3107        /// let x = Diagnostic::new().set_location("example");
3108        /// ```
3109        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3110            self.location = v.into();
3111            self
3112        }
3113
3114        /// Sets the value of [message][crate::model::operation_metadata::Diagnostic::message].
3115        ///
3116        /// # Example
3117        /// ```ignore,no_run
3118        /// # use google_cloud_apigateway_v1::model::operation_metadata::Diagnostic;
3119        /// let x = Diagnostic::new().set_message("example");
3120        /// ```
3121        pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3122            self.message = v.into();
3123            self
3124        }
3125    }
3126
3127    impl wkt::message::Message for Diagnostic {
3128        fn typename() -> &'static str {
3129            "type.googleapis.com/google.cloud.apigateway.v1.OperationMetadata.Diagnostic"
3130        }
3131    }
3132}