google_cloud_api_serviceusage_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 api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// A service that is available for use by the consumer.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Service {
44    /// The resource name of the consumer and service.
45    ///
46    /// A valid name would be:
47    ///
48    /// - projects/123/services/serviceusage.googleapis.com
49    pub name: std::string::String,
50
51    /// The resource name of the consumer.
52    ///
53    /// A valid name would be:
54    ///
55    /// - projects/123
56    pub parent: std::string::String,
57
58    /// The service configuration of the available service.
59    /// Some fields may be filtered out of the configuration in responses to
60    /// the `ListServices` method. These fields are present only in responses to
61    /// the `GetService` method.
62    pub config: std::option::Option<crate::model::ServiceConfig>,
63
64    /// Whether or not the service has been enabled for use by the consumer.
65    pub state: crate::model::State,
66
67    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl Service {
71    pub fn new() -> Self {
72        std::default::Default::default()
73    }
74
75    /// Sets the value of [name][crate::model::Service::name].
76    ///
77    /// # Example
78    /// ```ignore,no_run
79    /// # use google_cloud_api_serviceusage_v1::model::Service;
80    /// let x = Service::new().set_name("example");
81    /// ```
82    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83        self.name = v.into();
84        self
85    }
86
87    /// Sets the value of [parent][crate::model::Service::parent].
88    ///
89    /// # Example
90    /// ```ignore,no_run
91    /// # use google_cloud_api_serviceusage_v1::model::Service;
92    /// let x = Service::new().set_parent("example");
93    /// ```
94    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
95        self.parent = v.into();
96        self
97    }
98
99    /// Sets the value of [config][crate::model::Service::config].
100    ///
101    /// # Example
102    /// ```ignore,no_run
103    /// # use google_cloud_api_serviceusage_v1::model::Service;
104    /// use google_cloud_api_serviceusage_v1::model::ServiceConfig;
105    /// let x = Service::new().set_config(ServiceConfig::default()/* use setters */);
106    /// ```
107    pub fn set_config<T>(mut self, v: T) -> Self
108    where
109        T: std::convert::Into<crate::model::ServiceConfig>,
110    {
111        self.config = std::option::Option::Some(v.into());
112        self
113    }
114
115    /// Sets or clears the value of [config][crate::model::Service::config].
116    ///
117    /// # Example
118    /// ```ignore,no_run
119    /// # use google_cloud_api_serviceusage_v1::model::Service;
120    /// use google_cloud_api_serviceusage_v1::model::ServiceConfig;
121    /// let x = Service::new().set_or_clear_config(Some(ServiceConfig::default()/* use setters */));
122    /// let x = Service::new().set_or_clear_config(None::<ServiceConfig>);
123    /// ```
124    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
125    where
126        T: std::convert::Into<crate::model::ServiceConfig>,
127    {
128        self.config = v.map(|x| x.into());
129        self
130    }
131
132    /// Sets the value of [state][crate::model::Service::state].
133    ///
134    /// # Example
135    /// ```ignore,no_run
136    /// # use google_cloud_api_serviceusage_v1::model::Service;
137    /// use google_cloud_api_serviceusage_v1::model::State;
138    /// let x0 = Service::new().set_state(State::Disabled);
139    /// let x1 = Service::new().set_state(State::Enabled);
140    /// ```
141    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
142        self.state = v.into();
143        self
144    }
145}
146
147impl wkt::message::Message for Service {
148    fn typename() -> &'static str {
149        "type.googleapis.com/google.api.serviceusage.v1.Service"
150    }
151}
152
153/// The configuration of the service.
154#[derive(Clone, Default, PartialEq)]
155#[non_exhaustive]
156pub struct ServiceConfig {
157    /// The DNS address at which this service is available.
158    ///
159    /// An example DNS address would be:
160    /// `calendar.googleapis.com`.
161    pub name: std::string::String,
162
163    /// The product title for this service.
164    pub title: std::string::String,
165
166    /// A list of API interfaces exported by this service. Contains only the names,
167    /// versions, and method names of the interfaces.
168    pub apis: std::vec::Vec<wkt::Api>,
169
170    /// Additional API documentation. Contains only the summary and the
171    /// documentation URL.
172    pub documentation: std::option::Option<api::model::Documentation>,
173
174    /// Quota configuration.
175    pub quota: std::option::Option<api::model::Quota>,
176
177    /// Auth configuration. Contains only the OAuth rules.
178    pub authentication: std::option::Option<api::model::Authentication>,
179
180    /// Configuration controlling usage of this service.
181    pub usage: std::option::Option<api::model::Usage>,
182
183    /// Configuration for network endpoints. Contains only the names and aliases
184    /// of the endpoints.
185    pub endpoints: std::vec::Vec<api::model::Endpoint>,
186
187    /// Defines the monitored resources used by this service. This is required
188    /// by the [Service.monitoring][google.api.Service.monitoring] and
189    /// [Service.logging][google.api.Service.logging] configurations.
190    pub monitored_resources: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
191
192    /// Monitoring configuration.
193    /// This should not include the 'producer_destinations' field.
194    pub monitoring: std::option::Option<api::model::Monitoring>,
195
196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
197}
198
199impl ServiceConfig {
200    pub fn new() -> Self {
201        std::default::Default::default()
202    }
203
204    /// Sets the value of [name][crate::model::ServiceConfig::name].
205    ///
206    /// # Example
207    /// ```ignore,no_run
208    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
209    /// let x = ServiceConfig::new().set_name("example");
210    /// ```
211    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
212        self.name = v.into();
213        self
214    }
215
216    /// Sets the value of [title][crate::model::ServiceConfig::title].
217    ///
218    /// # Example
219    /// ```ignore,no_run
220    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
221    /// let x = ServiceConfig::new().set_title("example");
222    /// ```
223    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
224        self.title = v.into();
225        self
226    }
227
228    /// Sets the value of [apis][crate::model::ServiceConfig::apis].
229    ///
230    /// # Example
231    /// ```ignore,no_run
232    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
233    /// use wkt::Api;
234    /// let x = ServiceConfig::new()
235    ///     .set_apis([
236    ///         Api::default()/* use setters */,
237    ///         Api::default()/* use (different) setters */,
238    ///     ]);
239    /// ```
240    pub fn set_apis<T, V>(mut self, v: T) -> Self
241    where
242        T: std::iter::IntoIterator<Item = V>,
243        V: std::convert::Into<wkt::Api>,
244    {
245        use std::iter::Iterator;
246        self.apis = v.into_iter().map(|i| i.into()).collect();
247        self
248    }
249
250    /// Sets the value of [documentation][crate::model::ServiceConfig::documentation].
251    ///
252    /// # Example
253    /// ```ignore,no_run
254    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
255    /// use api::model::Documentation;
256    /// let x = ServiceConfig::new().set_documentation(Documentation::default()/* use setters */);
257    /// ```
258    pub fn set_documentation<T>(mut self, v: T) -> Self
259    where
260        T: std::convert::Into<api::model::Documentation>,
261    {
262        self.documentation = std::option::Option::Some(v.into());
263        self
264    }
265
266    /// Sets or clears the value of [documentation][crate::model::ServiceConfig::documentation].
267    ///
268    /// # Example
269    /// ```ignore,no_run
270    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
271    /// use api::model::Documentation;
272    /// let x = ServiceConfig::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
273    /// let x = ServiceConfig::new().set_or_clear_documentation(None::<Documentation>);
274    /// ```
275    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
276    where
277        T: std::convert::Into<api::model::Documentation>,
278    {
279        self.documentation = v.map(|x| x.into());
280        self
281    }
282
283    /// Sets the value of [quota][crate::model::ServiceConfig::quota].
284    ///
285    /// # Example
286    /// ```ignore,no_run
287    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
288    /// use api::model::Quota;
289    /// let x = ServiceConfig::new().set_quota(Quota::default()/* use setters */);
290    /// ```
291    pub fn set_quota<T>(mut self, v: T) -> Self
292    where
293        T: std::convert::Into<api::model::Quota>,
294    {
295        self.quota = std::option::Option::Some(v.into());
296        self
297    }
298
299    /// Sets or clears the value of [quota][crate::model::ServiceConfig::quota].
300    ///
301    /// # Example
302    /// ```ignore,no_run
303    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
304    /// use api::model::Quota;
305    /// let x = ServiceConfig::new().set_or_clear_quota(Some(Quota::default()/* use setters */));
306    /// let x = ServiceConfig::new().set_or_clear_quota(None::<Quota>);
307    /// ```
308    pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
309    where
310        T: std::convert::Into<api::model::Quota>,
311    {
312        self.quota = v.map(|x| x.into());
313        self
314    }
315
316    /// Sets the value of [authentication][crate::model::ServiceConfig::authentication].
317    ///
318    /// # Example
319    /// ```ignore,no_run
320    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
321    /// use api::model::Authentication;
322    /// let x = ServiceConfig::new().set_authentication(Authentication::default()/* use setters */);
323    /// ```
324    pub fn set_authentication<T>(mut self, v: T) -> Self
325    where
326        T: std::convert::Into<api::model::Authentication>,
327    {
328        self.authentication = std::option::Option::Some(v.into());
329        self
330    }
331
332    /// Sets or clears the value of [authentication][crate::model::ServiceConfig::authentication].
333    ///
334    /// # Example
335    /// ```ignore,no_run
336    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
337    /// use api::model::Authentication;
338    /// let x = ServiceConfig::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
339    /// let x = ServiceConfig::new().set_or_clear_authentication(None::<Authentication>);
340    /// ```
341    pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
342    where
343        T: std::convert::Into<api::model::Authentication>,
344    {
345        self.authentication = v.map(|x| x.into());
346        self
347    }
348
349    /// Sets the value of [usage][crate::model::ServiceConfig::usage].
350    ///
351    /// # Example
352    /// ```ignore,no_run
353    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
354    /// use api::model::Usage;
355    /// let x = ServiceConfig::new().set_usage(Usage::default()/* use setters */);
356    /// ```
357    pub fn set_usage<T>(mut self, v: T) -> Self
358    where
359        T: std::convert::Into<api::model::Usage>,
360    {
361        self.usage = std::option::Option::Some(v.into());
362        self
363    }
364
365    /// Sets or clears the value of [usage][crate::model::ServiceConfig::usage].
366    ///
367    /// # Example
368    /// ```ignore,no_run
369    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
370    /// use api::model::Usage;
371    /// let x = ServiceConfig::new().set_or_clear_usage(Some(Usage::default()/* use setters */));
372    /// let x = ServiceConfig::new().set_or_clear_usage(None::<Usage>);
373    /// ```
374    pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
375    where
376        T: std::convert::Into<api::model::Usage>,
377    {
378        self.usage = v.map(|x| x.into());
379        self
380    }
381
382    /// Sets the value of [endpoints][crate::model::ServiceConfig::endpoints].
383    ///
384    /// # Example
385    /// ```ignore,no_run
386    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
387    /// use api::model::Endpoint;
388    /// let x = ServiceConfig::new()
389    ///     .set_endpoints([
390    ///         Endpoint::default()/* use setters */,
391    ///         Endpoint::default()/* use (different) setters */,
392    ///     ]);
393    /// ```
394    pub fn set_endpoints<T, V>(mut self, v: T) -> Self
395    where
396        T: std::iter::IntoIterator<Item = V>,
397        V: std::convert::Into<api::model::Endpoint>,
398    {
399        use std::iter::Iterator;
400        self.endpoints = v.into_iter().map(|i| i.into()).collect();
401        self
402    }
403
404    /// Sets the value of [monitored_resources][crate::model::ServiceConfig::monitored_resources].
405    ///
406    /// # Example
407    /// ```ignore,no_run
408    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
409    /// use api::model::MonitoredResourceDescriptor;
410    /// let x = ServiceConfig::new()
411    ///     .set_monitored_resources([
412    ///         MonitoredResourceDescriptor::default()/* use setters */,
413    ///         MonitoredResourceDescriptor::default()/* use (different) setters */,
414    ///     ]);
415    /// ```
416    pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
417    where
418        T: std::iter::IntoIterator<Item = V>,
419        V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
420    {
421        use std::iter::Iterator;
422        self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
423        self
424    }
425
426    /// Sets the value of [monitoring][crate::model::ServiceConfig::monitoring].
427    ///
428    /// # Example
429    /// ```ignore,no_run
430    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
431    /// use api::model::Monitoring;
432    /// let x = ServiceConfig::new().set_monitoring(Monitoring::default()/* use setters */);
433    /// ```
434    pub fn set_monitoring<T>(mut self, v: T) -> Self
435    where
436        T: std::convert::Into<api::model::Monitoring>,
437    {
438        self.monitoring = std::option::Option::Some(v.into());
439        self
440    }
441
442    /// Sets or clears the value of [monitoring][crate::model::ServiceConfig::monitoring].
443    ///
444    /// # Example
445    /// ```ignore,no_run
446    /// # use google_cloud_api_serviceusage_v1::model::ServiceConfig;
447    /// use api::model::Monitoring;
448    /// let x = ServiceConfig::new().set_or_clear_monitoring(Some(Monitoring::default()/* use setters */));
449    /// let x = ServiceConfig::new().set_or_clear_monitoring(None::<Monitoring>);
450    /// ```
451    pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
452    where
453        T: std::convert::Into<api::model::Monitoring>,
454    {
455        self.monitoring = v.map(|x| x.into());
456        self
457    }
458}
459
460impl wkt::message::Message for ServiceConfig {
461    fn typename() -> &'static str {
462        "type.googleapis.com/google.api.serviceusage.v1.ServiceConfig"
463    }
464}
465
466/// The operation metadata returned for the batchend services operation.
467#[derive(Clone, Default, PartialEq)]
468#[non_exhaustive]
469pub struct OperationMetadata {
470    /// The full name of the resources that this operation is directly
471    /// associated with.
472    pub resource_names: std::vec::Vec<std::string::String>,
473
474    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
475}
476
477impl OperationMetadata {
478    pub fn new() -> Self {
479        std::default::Default::default()
480    }
481
482    /// Sets the value of [resource_names][crate::model::OperationMetadata::resource_names].
483    ///
484    /// # Example
485    /// ```ignore,no_run
486    /// # use google_cloud_api_serviceusage_v1::model::OperationMetadata;
487    /// let x = OperationMetadata::new().set_resource_names(["a", "b", "c"]);
488    /// ```
489    pub fn set_resource_names<T, V>(mut self, v: T) -> Self
490    where
491        T: std::iter::IntoIterator<Item = V>,
492        V: std::convert::Into<std::string::String>,
493    {
494        use std::iter::Iterator;
495        self.resource_names = v.into_iter().map(|i| i.into()).collect();
496        self
497    }
498}
499
500impl wkt::message::Message for OperationMetadata {
501    fn typename() -> &'static str {
502        "type.googleapis.com/google.api.serviceusage.v1.OperationMetadata"
503    }
504}
505
506/// Request message for the `EnableService` method.
507#[derive(Clone, Default, PartialEq)]
508#[non_exhaustive]
509pub struct EnableServiceRequest {
510    /// Name of the consumer and service to enable the service on.
511    ///
512    /// The `EnableService` and `DisableService` methods currently only support
513    /// projects.
514    ///
515    /// Enabling a service requires that the service is public or is shared with
516    /// the user enabling the service.
517    ///
518    /// An example name would be:
519    /// `projects/123/services/serviceusage.googleapis.com` where `123` is the
520    /// project number.
521    pub name: std::string::String,
522
523    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
524}
525
526impl EnableServiceRequest {
527    pub fn new() -> Self {
528        std::default::Default::default()
529    }
530
531    /// Sets the value of [name][crate::model::EnableServiceRequest::name].
532    ///
533    /// # Example
534    /// ```ignore,no_run
535    /// # use google_cloud_api_serviceusage_v1::model::EnableServiceRequest;
536    /// let x = EnableServiceRequest::new().set_name("example");
537    /// ```
538    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
539        self.name = v.into();
540        self
541    }
542}
543
544impl wkt::message::Message for EnableServiceRequest {
545    fn typename() -> &'static str {
546        "type.googleapis.com/google.api.serviceusage.v1.EnableServiceRequest"
547    }
548}
549
550/// Response message for the `EnableService` method.
551/// This response message is assigned to the `response` field of the returned
552/// Operation when that operation is done.
553#[derive(Clone, Default, PartialEq)]
554#[non_exhaustive]
555pub struct EnableServiceResponse {
556    /// The new state of the service after enabling.
557    pub service: std::option::Option<crate::model::Service>,
558
559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
560}
561
562impl EnableServiceResponse {
563    pub fn new() -> Self {
564        std::default::Default::default()
565    }
566
567    /// Sets the value of [service][crate::model::EnableServiceResponse::service].
568    ///
569    /// # Example
570    /// ```ignore,no_run
571    /// # use google_cloud_api_serviceusage_v1::model::EnableServiceResponse;
572    /// use google_cloud_api_serviceusage_v1::model::Service;
573    /// let x = EnableServiceResponse::new().set_service(Service::default()/* use setters */);
574    /// ```
575    pub fn set_service<T>(mut self, v: T) -> Self
576    where
577        T: std::convert::Into<crate::model::Service>,
578    {
579        self.service = std::option::Option::Some(v.into());
580        self
581    }
582
583    /// Sets or clears the value of [service][crate::model::EnableServiceResponse::service].
584    ///
585    /// # Example
586    /// ```ignore,no_run
587    /// # use google_cloud_api_serviceusage_v1::model::EnableServiceResponse;
588    /// use google_cloud_api_serviceusage_v1::model::Service;
589    /// let x = EnableServiceResponse::new().set_or_clear_service(Some(Service::default()/* use setters */));
590    /// let x = EnableServiceResponse::new().set_or_clear_service(None::<Service>);
591    /// ```
592    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
593    where
594        T: std::convert::Into<crate::model::Service>,
595    {
596        self.service = v.map(|x| x.into());
597        self
598    }
599}
600
601impl wkt::message::Message for EnableServiceResponse {
602    fn typename() -> &'static str {
603        "type.googleapis.com/google.api.serviceusage.v1.EnableServiceResponse"
604    }
605}
606
607/// Request message for the `DisableService` method.
608#[derive(Clone, Default, PartialEq)]
609#[non_exhaustive]
610pub struct DisableServiceRequest {
611    /// Name of the consumer and service to disable the service on.
612    ///
613    /// The enable and disable methods currently only support projects.
614    ///
615    /// An example name would be:
616    /// `projects/123/services/serviceusage.googleapis.com` where `123` is the
617    /// project number.
618    pub name: std::string::String,
619
620    /// Indicates if services that are enabled and which depend on this service
621    /// should also be disabled. If not set, an error will be generated if any
622    /// enabled services depend on the service to be disabled. When set, the
623    /// service, and any enabled services that depend on it, will be disabled
624    /// together.
625    pub disable_dependent_services: bool,
626
627    /// Defines the behavior for checking service usage when disabling a service.
628    pub check_if_service_has_usage: crate::model::disable_service_request::CheckIfServiceHasUsage,
629
630    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
631}
632
633impl DisableServiceRequest {
634    pub fn new() -> Self {
635        std::default::Default::default()
636    }
637
638    /// Sets the value of [name][crate::model::DisableServiceRequest::name].
639    ///
640    /// # Example
641    /// ```ignore,no_run
642    /// # use google_cloud_api_serviceusage_v1::model::DisableServiceRequest;
643    /// let x = DisableServiceRequest::new().set_name("example");
644    /// ```
645    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
646        self.name = v.into();
647        self
648    }
649
650    /// Sets the value of [disable_dependent_services][crate::model::DisableServiceRequest::disable_dependent_services].
651    ///
652    /// # Example
653    /// ```ignore,no_run
654    /// # use google_cloud_api_serviceusage_v1::model::DisableServiceRequest;
655    /// let x = DisableServiceRequest::new().set_disable_dependent_services(true);
656    /// ```
657    pub fn set_disable_dependent_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
658        self.disable_dependent_services = v.into();
659        self
660    }
661
662    /// Sets the value of [check_if_service_has_usage][crate::model::DisableServiceRequest::check_if_service_has_usage].
663    ///
664    /// # Example
665    /// ```ignore,no_run
666    /// # use google_cloud_api_serviceusage_v1::model::DisableServiceRequest;
667    /// use google_cloud_api_serviceusage_v1::model::disable_service_request::CheckIfServiceHasUsage;
668    /// let x0 = DisableServiceRequest::new().set_check_if_service_has_usage(CheckIfServiceHasUsage::Skip);
669    /// let x1 = DisableServiceRequest::new().set_check_if_service_has_usage(CheckIfServiceHasUsage::Check);
670    /// ```
671    pub fn set_check_if_service_has_usage<
672        T: std::convert::Into<crate::model::disable_service_request::CheckIfServiceHasUsage>,
673    >(
674        mut self,
675        v: T,
676    ) -> Self {
677        self.check_if_service_has_usage = v.into();
678        self
679    }
680}
681
682impl wkt::message::Message for DisableServiceRequest {
683    fn typename() -> &'static str {
684        "type.googleapis.com/google.api.serviceusage.v1.DisableServiceRequest"
685    }
686}
687
688/// Defines additional types related to [DisableServiceRequest].
689pub mod disable_service_request {
690    #[allow(unused_imports)]
691    use super::*;
692
693    /// Enum to determine if service usage should be checked when disabling a
694    /// service.
695    ///
696    /// # Working with unknown values
697    ///
698    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
699    /// additional enum variants at any time. Adding new variants is not considered
700    /// a breaking change. Applications should write their code in anticipation of:
701    ///
702    /// - New values appearing in future releases of the client library, **and**
703    /// - New values received dynamically, without application changes.
704    ///
705    /// Please consult the [Working with enums] section in the user guide for some
706    /// guidelines.
707    ///
708    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
709    #[derive(Clone, Debug, PartialEq)]
710    #[non_exhaustive]
711    pub enum CheckIfServiceHasUsage {
712        /// When unset, the default behavior is used, which is SKIP.
713        Unspecified,
714        /// If set, skip checking service usage when disabling a service.
715        Skip,
716        /// If set, service usage is checked when disabling the service. If a
717        /// service, or its dependents, has usage in the last 30 days, the request
718        /// returns a FAILED_PRECONDITION error.
719        Check,
720        /// If set, the enum was initialized with an unknown value.
721        ///
722        /// Applications can examine the value using [CheckIfServiceHasUsage::value] or
723        /// [CheckIfServiceHasUsage::name].
724        UnknownValue(check_if_service_has_usage::UnknownValue),
725    }
726
727    #[doc(hidden)]
728    pub mod check_if_service_has_usage {
729        #[allow(unused_imports)]
730        use super::*;
731        #[derive(Clone, Debug, PartialEq)]
732        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
733    }
734
735    impl CheckIfServiceHasUsage {
736        /// Gets the enum value.
737        ///
738        /// Returns `None` if the enum contains an unknown value deserialized from
739        /// the string representation of enums.
740        pub fn value(&self) -> std::option::Option<i32> {
741            match self {
742                Self::Unspecified => std::option::Option::Some(0),
743                Self::Skip => std::option::Option::Some(1),
744                Self::Check => std::option::Option::Some(2),
745                Self::UnknownValue(u) => u.0.value(),
746            }
747        }
748
749        /// Gets the enum value as a string.
750        ///
751        /// Returns `None` if the enum contains an unknown value deserialized from
752        /// the integer representation of enums.
753        pub fn name(&self) -> std::option::Option<&str> {
754            match self {
755                Self::Unspecified => {
756                    std::option::Option::Some("CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED")
757                }
758                Self::Skip => std::option::Option::Some("SKIP"),
759                Self::Check => std::option::Option::Some("CHECK"),
760                Self::UnknownValue(u) => u.0.name(),
761            }
762        }
763    }
764
765    impl std::default::Default for CheckIfServiceHasUsage {
766        fn default() -> Self {
767            use std::convert::From;
768            Self::from(0)
769        }
770    }
771
772    impl std::fmt::Display for CheckIfServiceHasUsage {
773        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
774            wkt::internal::display_enum(f, self.name(), self.value())
775        }
776    }
777
778    impl std::convert::From<i32> for CheckIfServiceHasUsage {
779        fn from(value: i32) -> Self {
780            match value {
781                0 => Self::Unspecified,
782                1 => Self::Skip,
783                2 => Self::Check,
784                _ => Self::UnknownValue(check_if_service_has_usage::UnknownValue(
785                    wkt::internal::UnknownEnumValue::Integer(value),
786                )),
787            }
788        }
789    }
790
791    impl std::convert::From<&str> for CheckIfServiceHasUsage {
792        fn from(value: &str) -> Self {
793            use std::string::ToString;
794            match value {
795                "CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED" => Self::Unspecified,
796                "SKIP" => Self::Skip,
797                "CHECK" => Self::Check,
798                _ => Self::UnknownValue(check_if_service_has_usage::UnknownValue(
799                    wkt::internal::UnknownEnumValue::String(value.to_string()),
800                )),
801            }
802        }
803    }
804
805    impl serde::ser::Serialize for CheckIfServiceHasUsage {
806        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
807        where
808            S: serde::Serializer,
809        {
810            match self {
811                Self::Unspecified => serializer.serialize_i32(0),
812                Self::Skip => serializer.serialize_i32(1),
813                Self::Check => serializer.serialize_i32(2),
814                Self::UnknownValue(u) => u.0.serialize(serializer),
815            }
816        }
817    }
818
819    impl<'de> serde::de::Deserialize<'de> for CheckIfServiceHasUsage {
820        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
821        where
822            D: serde::Deserializer<'de>,
823        {
824            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CheckIfServiceHasUsage>::new(
825                ".google.api.serviceusage.v1.DisableServiceRequest.CheckIfServiceHasUsage",
826            ))
827        }
828    }
829}
830
831/// Response message for the `DisableService` method.
832/// This response message is assigned to the `response` field of the returned
833/// Operation when that operation is done.
834#[derive(Clone, Default, PartialEq)]
835#[non_exhaustive]
836pub struct DisableServiceResponse {
837    /// The new state of the service after disabling.
838    pub service: std::option::Option<crate::model::Service>,
839
840    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
841}
842
843impl DisableServiceResponse {
844    pub fn new() -> Self {
845        std::default::Default::default()
846    }
847
848    /// Sets the value of [service][crate::model::DisableServiceResponse::service].
849    ///
850    /// # Example
851    /// ```ignore,no_run
852    /// # use google_cloud_api_serviceusage_v1::model::DisableServiceResponse;
853    /// use google_cloud_api_serviceusage_v1::model::Service;
854    /// let x = DisableServiceResponse::new().set_service(Service::default()/* use setters */);
855    /// ```
856    pub fn set_service<T>(mut self, v: T) -> Self
857    where
858        T: std::convert::Into<crate::model::Service>,
859    {
860        self.service = std::option::Option::Some(v.into());
861        self
862    }
863
864    /// Sets or clears the value of [service][crate::model::DisableServiceResponse::service].
865    ///
866    /// # Example
867    /// ```ignore,no_run
868    /// # use google_cloud_api_serviceusage_v1::model::DisableServiceResponse;
869    /// use google_cloud_api_serviceusage_v1::model::Service;
870    /// let x = DisableServiceResponse::new().set_or_clear_service(Some(Service::default()/* use setters */));
871    /// let x = DisableServiceResponse::new().set_or_clear_service(None::<Service>);
872    /// ```
873    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
874    where
875        T: std::convert::Into<crate::model::Service>,
876    {
877        self.service = v.map(|x| x.into());
878        self
879    }
880}
881
882impl wkt::message::Message for DisableServiceResponse {
883    fn typename() -> &'static str {
884        "type.googleapis.com/google.api.serviceusage.v1.DisableServiceResponse"
885    }
886}
887
888/// Request message for the `GetService` method.
889#[derive(Clone, Default, PartialEq)]
890#[non_exhaustive]
891pub struct GetServiceRequest {
892    /// Name of the consumer and service to get the `ConsumerState` for.
893    ///
894    /// An example name would be:
895    /// `projects/123/services/serviceusage.googleapis.com` where `123` is the
896    /// project number.
897    pub name: std::string::String,
898
899    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
900}
901
902impl GetServiceRequest {
903    pub fn new() -> Self {
904        std::default::Default::default()
905    }
906
907    /// Sets the value of [name][crate::model::GetServiceRequest::name].
908    ///
909    /// # Example
910    /// ```ignore,no_run
911    /// # use google_cloud_api_serviceusage_v1::model::GetServiceRequest;
912    /// let x = GetServiceRequest::new().set_name("example");
913    /// ```
914    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915        self.name = v.into();
916        self
917    }
918}
919
920impl wkt::message::Message for GetServiceRequest {
921    fn typename() -> &'static str {
922        "type.googleapis.com/google.api.serviceusage.v1.GetServiceRequest"
923    }
924}
925
926/// Request message for the `ListServices` method.
927#[derive(Clone, Default, PartialEq)]
928#[non_exhaustive]
929pub struct ListServicesRequest {
930    /// Parent to search for services on.
931    ///
932    /// An example name would be:
933    /// `projects/123` where `123` is the project number.
934    pub parent: std::string::String,
935
936    /// Requested size of the next page of data.
937    /// Requested page size cannot exceed 200.
938    /// If not set, the default page size is 50.
939    pub page_size: i32,
940
941    /// Token identifying which result to start with, which is returned by a
942    /// previous list call.
943    pub page_token: std::string::String,
944
945    /// Only list services that conform to the given filter.
946    /// The allowed filter strings are `state:ENABLED` and `state:DISABLED`.
947    pub filter: std::string::String,
948
949    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
950}
951
952impl ListServicesRequest {
953    pub fn new() -> Self {
954        std::default::Default::default()
955    }
956
957    /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
958    ///
959    /// # Example
960    /// ```ignore,no_run
961    /// # use google_cloud_api_serviceusage_v1::model::ListServicesRequest;
962    /// let x = ListServicesRequest::new().set_parent("example");
963    /// ```
964    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
965        self.parent = v.into();
966        self
967    }
968
969    /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
970    ///
971    /// # Example
972    /// ```ignore,no_run
973    /// # use google_cloud_api_serviceusage_v1::model::ListServicesRequest;
974    /// let x = ListServicesRequest::new().set_page_size(42);
975    /// ```
976    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
977        self.page_size = v.into();
978        self
979    }
980
981    /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
982    ///
983    /// # Example
984    /// ```ignore,no_run
985    /// # use google_cloud_api_serviceusage_v1::model::ListServicesRequest;
986    /// let x = ListServicesRequest::new().set_page_token("example");
987    /// ```
988    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
989        self.page_token = v.into();
990        self
991    }
992
993    /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
994    ///
995    /// # Example
996    /// ```ignore,no_run
997    /// # use google_cloud_api_serviceusage_v1::model::ListServicesRequest;
998    /// let x = ListServicesRequest::new().set_filter("example");
999    /// ```
1000    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1001        self.filter = v.into();
1002        self
1003    }
1004}
1005
1006impl wkt::message::Message for ListServicesRequest {
1007    fn typename() -> &'static str {
1008        "type.googleapis.com/google.api.serviceusage.v1.ListServicesRequest"
1009    }
1010}
1011
1012/// Response message for the `ListServices` method.
1013#[derive(Clone, Default, PartialEq)]
1014#[non_exhaustive]
1015pub struct ListServicesResponse {
1016    /// The available services for the requested project.
1017    pub services: std::vec::Vec<crate::model::Service>,
1018
1019    /// Token that can be passed to `ListServices` to resume a paginated
1020    /// query.
1021    pub next_page_token: std::string::String,
1022
1023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1024}
1025
1026impl ListServicesResponse {
1027    pub fn new() -> Self {
1028        std::default::Default::default()
1029    }
1030
1031    /// Sets the value of [services][crate::model::ListServicesResponse::services].
1032    ///
1033    /// # Example
1034    /// ```ignore,no_run
1035    /// # use google_cloud_api_serviceusage_v1::model::ListServicesResponse;
1036    /// use google_cloud_api_serviceusage_v1::model::Service;
1037    /// let x = ListServicesResponse::new()
1038    ///     .set_services([
1039    ///         Service::default()/* use setters */,
1040    ///         Service::default()/* use (different) setters */,
1041    ///     ]);
1042    /// ```
1043    pub fn set_services<T, V>(mut self, v: T) -> Self
1044    where
1045        T: std::iter::IntoIterator<Item = V>,
1046        V: std::convert::Into<crate::model::Service>,
1047    {
1048        use std::iter::Iterator;
1049        self.services = v.into_iter().map(|i| i.into()).collect();
1050        self
1051    }
1052
1053    /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
1054    ///
1055    /// # Example
1056    /// ```ignore,no_run
1057    /// # use google_cloud_api_serviceusage_v1::model::ListServicesResponse;
1058    /// let x = ListServicesResponse::new().set_next_page_token("example");
1059    /// ```
1060    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1061        self.next_page_token = v.into();
1062        self
1063    }
1064}
1065
1066impl wkt::message::Message for ListServicesResponse {
1067    fn typename() -> &'static str {
1068        "type.googleapis.com/google.api.serviceusage.v1.ListServicesResponse"
1069    }
1070}
1071
1072#[doc(hidden)]
1073impl gax::paginator::internal::PageableResponse for ListServicesResponse {
1074    type PageItem = crate::model::Service;
1075
1076    fn items(self) -> std::vec::Vec<Self::PageItem> {
1077        self.services
1078    }
1079
1080    fn next_page_token(&self) -> std::string::String {
1081        use std::clone::Clone;
1082        self.next_page_token.clone()
1083    }
1084}
1085
1086/// Request message for the `BatchEnableServices` method.
1087#[derive(Clone, Default, PartialEq)]
1088#[non_exhaustive]
1089pub struct BatchEnableServicesRequest {
1090    /// Parent to enable services on.
1091    ///
1092    /// An example name would be:
1093    /// `projects/123` where `123` is the project number.
1094    ///
1095    /// The `BatchEnableServices` method currently only supports projects.
1096    pub parent: std::string::String,
1097
1098    /// The identifiers of the services to enable on the project.
1099    ///
1100    /// A valid identifier would be:
1101    /// serviceusage.googleapis.com
1102    ///
1103    /// Enabling services requires that each service is public or is shared with
1104    /// the user enabling the service.
1105    ///
1106    /// A single request can enable a maximum of 20 services at a time. If more
1107    /// than 20 services are specified, the request will fail, and no state changes
1108    /// will occur.
1109    pub service_ids: std::vec::Vec<std::string::String>,
1110
1111    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1112}
1113
1114impl BatchEnableServicesRequest {
1115    pub fn new() -> Self {
1116        std::default::Default::default()
1117    }
1118
1119    /// Sets the value of [parent][crate::model::BatchEnableServicesRequest::parent].
1120    ///
1121    /// # Example
1122    /// ```ignore,no_run
1123    /// # use google_cloud_api_serviceusage_v1::model::BatchEnableServicesRequest;
1124    /// let x = BatchEnableServicesRequest::new().set_parent("example");
1125    /// ```
1126    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1127        self.parent = v.into();
1128        self
1129    }
1130
1131    /// Sets the value of [service_ids][crate::model::BatchEnableServicesRequest::service_ids].
1132    ///
1133    /// # Example
1134    /// ```ignore,no_run
1135    /// # use google_cloud_api_serviceusage_v1::model::BatchEnableServicesRequest;
1136    /// let x = BatchEnableServicesRequest::new().set_service_ids(["a", "b", "c"]);
1137    /// ```
1138    pub fn set_service_ids<T, V>(mut self, v: T) -> Self
1139    where
1140        T: std::iter::IntoIterator<Item = V>,
1141        V: std::convert::Into<std::string::String>,
1142    {
1143        use std::iter::Iterator;
1144        self.service_ids = v.into_iter().map(|i| i.into()).collect();
1145        self
1146    }
1147}
1148
1149impl wkt::message::Message for BatchEnableServicesRequest {
1150    fn typename() -> &'static str {
1151        "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesRequest"
1152    }
1153}
1154
1155/// Response message for the `BatchEnableServices` method.
1156/// This response message is assigned to the `response` field of the returned
1157/// Operation when that operation is done.
1158#[derive(Clone, Default, PartialEq)]
1159#[non_exhaustive]
1160pub struct BatchEnableServicesResponse {
1161    /// The new state of the services after enabling.
1162    pub services: std::vec::Vec<crate::model::Service>,
1163
1164    /// If allow_partial_success is true, and one or more services could not be
1165    /// enabled, this field contains the details about each failure.
1166    pub failures: std::vec::Vec<crate::model::batch_enable_services_response::EnableFailure>,
1167
1168    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1169}
1170
1171impl BatchEnableServicesResponse {
1172    pub fn new() -> Self {
1173        std::default::Default::default()
1174    }
1175
1176    /// Sets the value of [services][crate::model::BatchEnableServicesResponse::services].
1177    ///
1178    /// # Example
1179    /// ```ignore,no_run
1180    /// # use google_cloud_api_serviceusage_v1::model::BatchEnableServicesResponse;
1181    /// use google_cloud_api_serviceusage_v1::model::Service;
1182    /// let x = BatchEnableServicesResponse::new()
1183    ///     .set_services([
1184    ///         Service::default()/* use setters */,
1185    ///         Service::default()/* use (different) setters */,
1186    ///     ]);
1187    /// ```
1188    pub fn set_services<T, V>(mut self, v: T) -> Self
1189    where
1190        T: std::iter::IntoIterator<Item = V>,
1191        V: std::convert::Into<crate::model::Service>,
1192    {
1193        use std::iter::Iterator;
1194        self.services = v.into_iter().map(|i| i.into()).collect();
1195        self
1196    }
1197
1198    /// Sets the value of [failures][crate::model::BatchEnableServicesResponse::failures].
1199    ///
1200    /// # Example
1201    /// ```ignore,no_run
1202    /// # use google_cloud_api_serviceusage_v1::model::BatchEnableServicesResponse;
1203    /// use google_cloud_api_serviceusage_v1::model::batch_enable_services_response::EnableFailure;
1204    /// let x = BatchEnableServicesResponse::new()
1205    ///     .set_failures([
1206    ///         EnableFailure::default()/* use setters */,
1207    ///         EnableFailure::default()/* use (different) setters */,
1208    ///     ]);
1209    /// ```
1210    pub fn set_failures<T, V>(mut self, v: T) -> Self
1211    where
1212        T: std::iter::IntoIterator<Item = V>,
1213        V: std::convert::Into<crate::model::batch_enable_services_response::EnableFailure>,
1214    {
1215        use std::iter::Iterator;
1216        self.failures = v.into_iter().map(|i| i.into()).collect();
1217        self
1218    }
1219}
1220
1221impl wkt::message::Message for BatchEnableServicesResponse {
1222    fn typename() -> &'static str {
1223        "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse"
1224    }
1225}
1226
1227/// Defines additional types related to [BatchEnableServicesResponse].
1228pub mod batch_enable_services_response {
1229    #[allow(unused_imports)]
1230    use super::*;
1231
1232    /// Provides error messages for the failing services.
1233    #[derive(Clone, Default, PartialEq)]
1234    #[non_exhaustive]
1235    pub struct EnableFailure {
1236        /// The service id of a service that could not be enabled.
1237        pub service_id: std::string::String,
1238
1239        /// An error message describing why the service could not be enabled.
1240        pub error_message: std::string::String,
1241
1242        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1243    }
1244
1245    impl EnableFailure {
1246        pub fn new() -> Self {
1247            std::default::Default::default()
1248        }
1249
1250        /// Sets the value of [service_id][crate::model::batch_enable_services_response::EnableFailure::service_id].
1251        ///
1252        /// # Example
1253        /// ```ignore,no_run
1254        /// # use google_cloud_api_serviceusage_v1::model::batch_enable_services_response::EnableFailure;
1255        /// let x = EnableFailure::new().set_service_id("example");
1256        /// ```
1257        pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1258            self.service_id = v.into();
1259            self
1260        }
1261
1262        /// Sets the value of [error_message][crate::model::batch_enable_services_response::EnableFailure::error_message].
1263        ///
1264        /// # Example
1265        /// ```ignore,no_run
1266        /// # use google_cloud_api_serviceusage_v1::model::batch_enable_services_response::EnableFailure;
1267        /// let x = EnableFailure::new().set_error_message("example");
1268        /// ```
1269        pub fn set_error_message<T: std::convert::Into<std::string::String>>(
1270            mut self,
1271            v: T,
1272        ) -> Self {
1273            self.error_message = v.into();
1274            self
1275        }
1276    }
1277
1278    impl wkt::message::Message for EnableFailure {
1279        fn typename() -> &'static str {
1280            "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse.EnableFailure"
1281        }
1282    }
1283}
1284
1285/// Request message for the `BatchGetServices` method.
1286#[derive(Clone, Default, PartialEq)]
1287#[non_exhaustive]
1288pub struct BatchGetServicesRequest {
1289    /// Parent to retrieve services from.
1290    /// If this is set, the parent of all of the services specified in `names` must
1291    /// match this field. An example name would be: `projects/123` where `123` is
1292    /// the project number. The `BatchGetServices` method currently only supports
1293    /// projects.
1294    pub parent: std::string::String,
1295
1296    /// Names of the services to retrieve.
1297    ///
1298    /// An example name would be:
1299    /// `projects/123/services/serviceusage.googleapis.com` where `123` is the
1300    /// project number.
1301    /// A single request can get a maximum of 30 services at a time.
1302    pub names: std::vec::Vec<std::string::String>,
1303
1304    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1305}
1306
1307impl BatchGetServicesRequest {
1308    pub fn new() -> Self {
1309        std::default::Default::default()
1310    }
1311
1312    /// Sets the value of [parent][crate::model::BatchGetServicesRequest::parent].
1313    ///
1314    /// # Example
1315    /// ```ignore,no_run
1316    /// # use google_cloud_api_serviceusage_v1::model::BatchGetServicesRequest;
1317    /// let x = BatchGetServicesRequest::new().set_parent("example");
1318    /// ```
1319    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1320        self.parent = v.into();
1321        self
1322    }
1323
1324    /// Sets the value of [names][crate::model::BatchGetServicesRequest::names].
1325    ///
1326    /// # Example
1327    /// ```ignore,no_run
1328    /// # use google_cloud_api_serviceusage_v1::model::BatchGetServicesRequest;
1329    /// let x = BatchGetServicesRequest::new().set_names(["a", "b", "c"]);
1330    /// ```
1331    pub fn set_names<T, V>(mut self, v: T) -> Self
1332    where
1333        T: std::iter::IntoIterator<Item = V>,
1334        V: std::convert::Into<std::string::String>,
1335    {
1336        use std::iter::Iterator;
1337        self.names = v.into_iter().map(|i| i.into()).collect();
1338        self
1339    }
1340}
1341
1342impl wkt::message::Message for BatchGetServicesRequest {
1343    fn typename() -> &'static str {
1344        "type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesRequest"
1345    }
1346}
1347
1348/// Response message for the `BatchGetServices` method.
1349#[derive(Clone, Default, PartialEq)]
1350#[non_exhaustive]
1351pub struct BatchGetServicesResponse {
1352    /// The requested Service states.
1353    pub services: std::vec::Vec<crate::model::Service>,
1354
1355    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1356}
1357
1358impl BatchGetServicesResponse {
1359    pub fn new() -> Self {
1360        std::default::Default::default()
1361    }
1362
1363    /// Sets the value of [services][crate::model::BatchGetServicesResponse::services].
1364    ///
1365    /// # Example
1366    /// ```ignore,no_run
1367    /// # use google_cloud_api_serviceusage_v1::model::BatchGetServicesResponse;
1368    /// use google_cloud_api_serviceusage_v1::model::Service;
1369    /// let x = BatchGetServicesResponse::new()
1370    ///     .set_services([
1371    ///         Service::default()/* use setters */,
1372    ///         Service::default()/* use (different) setters */,
1373    ///     ]);
1374    /// ```
1375    pub fn set_services<T, V>(mut self, v: T) -> Self
1376    where
1377        T: std::iter::IntoIterator<Item = V>,
1378        V: std::convert::Into<crate::model::Service>,
1379    {
1380        use std::iter::Iterator;
1381        self.services = v.into_iter().map(|i| i.into()).collect();
1382        self
1383    }
1384}
1385
1386impl wkt::message::Message for BatchGetServicesResponse {
1387    fn typename() -> &'static str {
1388        "type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesResponse"
1389    }
1390}
1391
1392/// Whether or not a service has been enabled for use by a consumer.
1393///
1394/// # Working with unknown values
1395///
1396/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1397/// additional enum variants at any time. Adding new variants is not considered
1398/// a breaking change. Applications should write their code in anticipation of:
1399///
1400/// - New values appearing in future releases of the client library, **and**
1401/// - New values received dynamically, without application changes.
1402///
1403/// Please consult the [Working with enums] section in the user guide for some
1404/// guidelines.
1405///
1406/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1407#[derive(Clone, Debug, PartialEq)]
1408#[non_exhaustive]
1409pub enum State {
1410    /// The default value, which indicates that the enabled state of the service
1411    /// is unspecified or not meaningful. Currently, all consumers other than
1412    /// projects (such as folders and organizations) are always in this state.
1413    Unspecified,
1414    /// The service cannot be used by this consumer. It has either been explicitly
1415    /// disabled, or has never been enabled.
1416    Disabled,
1417    /// The service has been explicitly enabled for use by this consumer.
1418    Enabled,
1419    /// If set, the enum was initialized with an unknown value.
1420    ///
1421    /// Applications can examine the value using [State::value] or
1422    /// [State::name].
1423    UnknownValue(state::UnknownValue),
1424}
1425
1426#[doc(hidden)]
1427pub mod state {
1428    #[allow(unused_imports)]
1429    use super::*;
1430    #[derive(Clone, Debug, PartialEq)]
1431    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1432}
1433
1434impl State {
1435    /// Gets the enum value.
1436    ///
1437    /// Returns `None` if the enum contains an unknown value deserialized from
1438    /// the string representation of enums.
1439    pub fn value(&self) -> std::option::Option<i32> {
1440        match self {
1441            Self::Unspecified => std::option::Option::Some(0),
1442            Self::Disabled => std::option::Option::Some(1),
1443            Self::Enabled => std::option::Option::Some(2),
1444            Self::UnknownValue(u) => u.0.value(),
1445        }
1446    }
1447
1448    /// Gets the enum value as a string.
1449    ///
1450    /// Returns `None` if the enum contains an unknown value deserialized from
1451    /// the integer representation of enums.
1452    pub fn name(&self) -> std::option::Option<&str> {
1453        match self {
1454            Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1455            Self::Disabled => std::option::Option::Some("DISABLED"),
1456            Self::Enabled => std::option::Option::Some("ENABLED"),
1457            Self::UnknownValue(u) => u.0.name(),
1458        }
1459    }
1460}
1461
1462impl std::default::Default for State {
1463    fn default() -> Self {
1464        use std::convert::From;
1465        Self::from(0)
1466    }
1467}
1468
1469impl std::fmt::Display for State {
1470    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1471        wkt::internal::display_enum(f, self.name(), self.value())
1472    }
1473}
1474
1475impl std::convert::From<i32> for State {
1476    fn from(value: i32) -> Self {
1477        match value {
1478            0 => Self::Unspecified,
1479            1 => Self::Disabled,
1480            2 => Self::Enabled,
1481            _ => Self::UnknownValue(state::UnknownValue(
1482                wkt::internal::UnknownEnumValue::Integer(value),
1483            )),
1484        }
1485    }
1486}
1487
1488impl std::convert::From<&str> for State {
1489    fn from(value: &str) -> Self {
1490        use std::string::ToString;
1491        match value {
1492            "STATE_UNSPECIFIED" => Self::Unspecified,
1493            "DISABLED" => Self::Disabled,
1494            "ENABLED" => Self::Enabled,
1495            _ => Self::UnknownValue(state::UnknownValue(
1496                wkt::internal::UnknownEnumValue::String(value.to_string()),
1497            )),
1498        }
1499    }
1500}
1501
1502impl serde::ser::Serialize for State {
1503    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1504    where
1505        S: serde::Serializer,
1506    {
1507        match self {
1508            Self::Unspecified => serializer.serialize_i32(0),
1509            Self::Disabled => serializer.serialize_i32(1),
1510            Self::Enabled => serializer.serialize_i32(2),
1511            Self::UnknownValue(u) => u.0.serialize(serializer),
1512        }
1513    }
1514}
1515
1516impl<'de> serde::de::Deserialize<'de> for State {
1517    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1518    where
1519        D: serde::Deserializer<'de>,
1520    {
1521        deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1522            ".google.api.serviceusage.v1.State",
1523        ))
1524    }
1525}