Skip to main content

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