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