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