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