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