1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
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#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Service {
44 pub name: std::string::String,
50
51 pub parent: std::string::String,
57
58 pub config: std::option::Option<crate::model::ServiceConfig>,
63
64 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 pub fn new() -> Self {
72 std::default::Default::default()
73 }
74
75 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
77 self.name = v.into();
78 self
79 }
80
81 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83 self.parent = v.into();
84 self
85 }
86
87 pub fn set_config<T>(mut self, v: T) -> Self
89 where
90 T: std::convert::Into<crate::model::ServiceConfig>,
91 {
92 self.config = std::option::Option::Some(v.into());
93 self
94 }
95
96 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
98 where
99 T: std::convert::Into<crate::model::ServiceConfig>,
100 {
101 self.config = v.map(|x| x.into());
102 self
103 }
104
105 pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
107 self.state = v.into();
108 self
109 }
110}
111
112impl wkt::message::Message for Service {
113 fn typename() -> &'static str {
114 "type.googleapis.com/google.api.serviceusage.v1.Service"
115 }
116}
117
118#[derive(Clone, Default, PartialEq)]
120#[non_exhaustive]
121pub struct ServiceConfig {
122 pub name: std::string::String,
127
128 pub title: std::string::String,
130
131 pub apis: std::vec::Vec<wkt::Api>,
134
135 pub documentation: std::option::Option<api::model::Documentation>,
138
139 pub quota: std::option::Option<api::model::Quota>,
141
142 pub authentication: std::option::Option<api::model::Authentication>,
144
145 pub usage: std::option::Option<api::model::Usage>,
147
148 pub endpoints: std::vec::Vec<api::model::Endpoint>,
151
152 pub monitored_resources: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
156
157 pub monitoring: std::option::Option<api::model::Monitoring>,
160
161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
162}
163
164impl ServiceConfig {
165 pub fn new() -> Self {
166 std::default::Default::default()
167 }
168
169 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
171 self.name = v.into();
172 self
173 }
174
175 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
177 self.title = v.into();
178 self
179 }
180
181 pub fn set_apis<T, V>(mut self, v: T) -> Self
183 where
184 T: std::iter::IntoIterator<Item = V>,
185 V: std::convert::Into<wkt::Api>,
186 {
187 use std::iter::Iterator;
188 self.apis = v.into_iter().map(|i| i.into()).collect();
189 self
190 }
191
192 pub fn set_documentation<T>(mut self, v: T) -> Self
194 where
195 T: std::convert::Into<api::model::Documentation>,
196 {
197 self.documentation = std::option::Option::Some(v.into());
198 self
199 }
200
201 pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
203 where
204 T: std::convert::Into<api::model::Documentation>,
205 {
206 self.documentation = v.map(|x| x.into());
207 self
208 }
209
210 pub fn set_quota<T>(mut self, v: T) -> Self
212 where
213 T: std::convert::Into<api::model::Quota>,
214 {
215 self.quota = std::option::Option::Some(v.into());
216 self
217 }
218
219 pub fn set_or_clear_quota<T>(mut self, v: std::option::Option<T>) -> Self
221 where
222 T: std::convert::Into<api::model::Quota>,
223 {
224 self.quota = v.map(|x| x.into());
225 self
226 }
227
228 pub fn set_authentication<T>(mut self, v: T) -> Self
230 where
231 T: std::convert::Into<api::model::Authentication>,
232 {
233 self.authentication = std::option::Option::Some(v.into());
234 self
235 }
236
237 pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
239 where
240 T: std::convert::Into<api::model::Authentication>,
241 {
242 self.authentication = v.map(|x| x.into());
243 self
244 }
245
246 pub fn set_usage<T>(mut self, v: T) -> Self
248 where
249 T: std::convert::Into<api::model::Usage>,
250 {
251 self.usage = std::option::Option::Some(v.into());
252 self
253 }
254
255 pub fn set_or_clear_usage<T>(mut self, v: std::option::Option<T>) -> Self
257 where
258 T: std::convert::Into<api::model::Usage>,
259 {
260 self.usage = v.map(|x| x.into());
261 self
262 }
263
264 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
266 where
267 T: std::iter::IntoIterator<Item = V>,
268 V: std::convert::Into<api::model::Endpoint>,
269 {
270 use std::iter::Iterator;
271 self.endpoints = v.into_iter().map(|i| i.into()).collect();
272 self
273 }
274
275 pub fn set_monitored_resources<T, V>(mut self, v: T) -> Self
277 where
278 T: std::iter::IntoIterator<Item = V>,
279 V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
280 {
281 use std::iter::Iterator;
282 self.monitored_resources = v.into_iter().map(|i| i.into()).collect();
283 self
284 }
285
286 pub fn set_monitoring<T>(mut self, v: T) -> Self
288 where
289 T: std::convert::Into<api::model::Monitoring>,
290 {
291 self.monitoring = std::option::Option::Some(v.into());
292 self
293 }
294
295 pub fn set_or_clear_monitoring<T>(mut self, v: std::option::Option<T>) -> Self
297 where
298 T: std::convert::Into<api::model::Monitoring>,
299 {
300 self.monitoring = v.map(|x| x.into());
301 self
302 }
303}
304
305impl wkt::message::Message for ServiceConfig {
306 fn typename() -> &'static str {
307 "type.googleapis.com/google.api.serviceusage.v1.ServiceConfig"
308 }
309}
310
311#[derive(Clone, Default, PartialEq)]
313#[non_exhaustive]
314pub struct OperationMetadata {
315 pub resource_names: std::vec::Vec<std::string::String>,
318
319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
320}
321
322impl OperationMetadata {
323 pub fn new() -> Self {
324 std::default::Default::default()
325 }
326
327 pub fn set_resource_names<T, V>(mut self, v: T) -> Self
329 where
330 T: std::iter::IntoIterator<Item = V>,
331 V: std::convert::Into<std::string::String>,
332 {
333 use std::iter::Iterator;
334 self.resource_names = v.into_iter().map(|i| i.into()).collect();
335 self
336 }
337}
338
339impl wkt::message::Message for OperationMetadata {
340 fn typename() -> &'static str {
341 "type.googleapis.com/google.api.serviceusage.v1.OperationMetadata"
342 }
343}
344
345#[derive(Clone, Default, PartialEq)]
347#[non_exhaustive]
348pub struct EnableServiceRequest {
349 pub name: std::string::String,
361
362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
363}
364
365impl EnableServiceRequest {
366 pub fn new() -> Self {
367 std::default::Default::default()
368 }
369
370 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
372 self.name = v.into();
373 self
374 }
375}
376
377impl wkt::message::Message for EnableServiceRequest {
378 fn typename() -> &'static str {
379 "type.googleapis.com/google.api.serviceusage.v1.EnableServiceRequest"
380 }
381}
382
383#[derive(Clone, Default, PartialEq)]
387#[non_exhaustive]
388pub struct EnableServiceResponse {
389 pub service: std::option::Option<crate::model::Service>,
391
392 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
393}
394
395impl EnableServiceResponse {
396 pub fn new() -> Self {
397 std::default::Default::default()
398 }
399
400 pub fn set_service<T>(mut self, v: T) -> Self
402 where
403 T: std::convert::Into<crate::model::Service>,
404 {
405 self.service = std::option::Option::Some(v.into());
406 self
407 }
408
409 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
411 where
412 T: std::convert::Into<crate::model::Service>,
413 {
414 self.service = v.map(|x| x.into());
415 self
416 }
417}
418
419impl wkt::message::Message for EnableServiceResponse {
420 fn typename() -> &'static str {
421 "type.googleapis.com/google.api.serviceusage.v1.EnableServiceResponse"
422 }
423}
424
425#[derive(Clone, Default, PartialEq)]
427#[non_exhaustive]
428pub struct DisableServiceRequest {
429 pub name: std::string::String,
437
438 pub disable_dependent_services: bool,
444
445 pub check_if_service_has_usage: crate::model::disable_service_request::CheckIfServiceHasUsage,
447
448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
449}
450
451impl DisableServiceRequest {
452 pub fn new() -> Self {
453 std::default::Default::default()
454 }
455
456 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
458 self.name = v.into();
459 self
460 }
461
462 pub fn set_disable_dependent_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
464 self.disable_dependent_services = v.into();
465 self
466 }
467
468 pub fn set_check_if_service_has_usage<
470 T: std::convert::Into<crate::model::disable_service_request::CheckIfServiceHasUsage>,
471 >(
472 mut self,
473 v: T,
474 ) -> Self {
475 self.check_if_service_has_usage = v.into();
476 self
477 }
478}
479
480impl wkt::message::Message for DisableServiceRequest {
481 fn typename() -> &'static str {
482 "type.googleapis.com/google.api.serviceusage.v1.DisableServiceRequest"
483 }
484}
485
486pub mod disable_service_request {
488 #[allow(unused_imports)]
489 use super::*;
490
491 #[derive(Clone, Debug, PartialEq)]
508 #[non_exhaustive]
509 pub enum CheckIfServiceHasUsage {
510 Unspecified,
512 Skip,
514 Check,
518 UnknownValue(check_if_service_has_usage::UnknownValue),
523 }
524
525 #[doc(hidden)]
526 pub mod check_if_service_has_usage {
527 #[allow(unused_imports)]
528 use super::*;
529 #[derive(Clone, Debug, PartialEq)]
530 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
531 }
532
533 impl CheckIfServiceHasUsage {
534 pub fn value(&self) -> std::option::Option<i32> {
539 match self {
540 Self::Unspecified => std::option::Option::Some(0),
541 Self::Skip => std::option::Option::Some(1),
542 Self::Check => std::option::Option::Some(2),
543 Self::UnknownValue(u) => u.0.value(),
544 }
545 }
546
547 pub fn name(&self) -> std::option::Option<&str> {
552 match self {
553 Self::Unspecified => {
554 std::option::Option::Some("CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED")
555 }
556 Self::Skip => std::option::Option::Some("SKIP"),
557 Self::Check => std::option::Option::Some("CHECK"),
558 Self::UnknownValue(u) => u.0.name(),
559 }
560 }
561 }
562
563 impl std::default::Default for CheckIfServiceHasUsage {
564 fn default() -> Self {
565 use std::convert::From;
566 Self::from(0)
567 }
568 }
569
570 impl std::fmt::Display for CheckIfServiceHasUsage {
571 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
572 wkt::internal::display_enum(f, self.name(), self.value())
573 }
574 }
575
576 impl std::convert::From<i32> for CheckIfServiceHasUsage {
577 fn from(value: i32) -> Self {
578 match value {
579 0 => Self::Unspecified,
580 1 => Self::Skip,
581 2 => Self::Check,
582 _ => Self::UnknownValue(check_if_service_has_usage::UnknownValue(
583 wkt::internal::UnknownEnumValue::Integer(value),
584 )),
585 }
586 }
587 }
588
589 impl std::convert::From<&str> for CheckIfServiceHasUsage {
590 fn from(value: &str) -> Self {
591 use std::string::ToString;
592 match value {
593 "CHECK_IF_SERVICE_HAS_USAGE_UNSPECIFIED" => Self::Unspecified,
594 "SKIP" => Self::Skip,
595 "CHECK" => Self::Check,
596 _ => Self::UnknownValue(check_if_service_has_usage::UnknownValue(
597 wkt::internal::UnknownEnumValue::String(value.to_string()),
598 )),
599 }
600 }
601 }
602
603 impl serde::ser::Serialize for CheckIfServiceHasUsage {
604 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
605 where
606 S: serde::Serializer,
607 {
608 match self {
609 Self::Unspecified => serializer.serialize_i32(0),
610 Self::Skip => serializer.serialize_i32(1),
611 Self::Check => serializer.serialize_i32(2),
612 Self::UnknownValue(u) => u.0.serialize(serializer),
613 }
614 }
615 }
616
617 impl<'de> serde::de::Deserialize<'de> for CheckIfServiceHasUsage {
618 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
619 where
620 D: serde::Deserializer<'de>,
621 {
622 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CheckIfServiceHasUsage>::new(
623 ".google.api.serviceusage.v1.DisableServiceRequest.CheckIfServiceHasUsage",
624 ))
625 }
626 }
627}
628
629#[derive(Clone, Default, PartialEq)]
633#[non_exhaustive]
634pub struct DisableServiceResponse {
635 pub service: std::option::Option<crate::model::Service>,
637
638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
639}
640
641impl DisableServiceResponse {
642 pub fn new() -> Self {
643 std::default::Default::default()
644 }
645
646 pub fn set_service<T>(mut self, v: T) -> Self
648 where
649 T: std::convert::Into<crate::model::Service>,
650 {
651 self.service = std::option::Option::Some(v.into());
652 self
653 }
654
655 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
657 where
658 T: std::convert::Into<crate::model::Service>,
659 {
660 self.service = v.map(|x| x.into());
661 self
662 }
663}
664
665impl wkt::message::Message for DisableServiceResponse {
666 fn typename() -> &'static str {
667 "type.googleapis.com/google.api.serviceusage.v1.DisableServiceResponse"
668 }
669}
670
671#[derive(Clone, Default, PartialEq)]
673#[non_exhaustive]
674pub struct GetServiceRequest {
675 pub name: std::string::String,
681
682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
683}
684
685impl GetServiceRequest {
686 pub fn new() -> Self {
687 std::default::Default::default()
688 }
689
690 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
692 self.name = v.into();
693 self
694 }
695}
696
697impl wkt::message::Message for GetServiceRequest {
698 fn typename() -> &'static str {
699 "type.googleapis.com/google.api.serviceusage.v1.GetServiceRequest"
700 }
701}
702
703#[derive(Clone, Default, PartialEq)]
705#[non_exhaustive]
706pub struct ListServicesRequest {
707 pub parent: std::string::String,
712
713 pub page_size: i32,
717
718 pub page_token: std::string::String,
721
722 pub filter: std::string::String,
725
726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
727}
728
729impl ListServicesRequest {
730 pub fn new() -> Self {
731 std::default::Default::default()
732 }
733
734 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
736 self.parent = v.into();
737 self
738 }
739
740 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
742 self.page_size = v.into();
743 self
744 }
745
746 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
748 self.page_token = v.into();
749 self
750 }
751
752 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
754 self.filter = v.into();
755 self
756 }
757}
758
759impl wkt::message::Message for ListServicesRequest {
760 fn typename() -> &'static str {
761 "type.googleapis.com/google.api.serviceusage.v1.ListServicesRequest"
762 }
763}
764
765#[derive(Clone, Default, PartialEq)]
767#[non_exhaustive]
768pub struct ListServicesResponse {
769 pub services: std::vec::Vec<crate::model::Service>,
771
772 pub next_page_token: std::string::String,
775
776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl ListServicesResponse {
780 pub fn new() -> Self {
781 std::default::Default::default()
782 }
783
784 pub fn set_services<T, V>(mut self, v: T) -> Self
786 where
787 T: std::iter::IntoIterator<Item = V>,
788 V: std::convert::Into<crate::model::Service>,
789 {
790 use std::iter::Iterator;
791 self.services = v.into_iter().map(|i| i.into()).collect();
792 self
793 }
794
795 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
797 self.next_page_token = v.into();
798 self
799 }
800}
801
802impl wkt::message::Message for ListServicesResponse {
803 fn typename() -> &'static str {
804 "type.googleapis.com/google.api.serviceusage.v1.ListServicesResponse"
805 }
806}
807
808#[doc(hidden)]
809impl gax::paginator::internal::PageableResponse for ListServicesResponse {
810 type PageItem = crate::model::Service;
811
812 fn items(self) -> std::vec::Vec<Self::PageItem> {
813 self.services
814 }
815
816 fn next_page_token(&self) -> std::string::String {
817 use std::clone::Clone;
818 self.next_page_token.clone()
819 }
820}
821
822#[derive(Clone, Default, PartialEq)]
824#[non_exhaustive]
825pub struct BatchEnableServicesRequest {
826 pub parent: std::string::String,
833
834 pub service_ids: std::vec::Vec<std::string::String>,
846
847 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
848}
849
850impl BatchEnableServicesRequest {
851 pub fn new() -> Self {
852 std::default::Default::default()
853 }
854
855 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
857 self.parent = v.into();
858 self
859 }
860
861 pub fn set_service_ids<T, V>(mut self, v: T) -> Self
863 where
864 T: std::iter::IntoIterator<Item = V>,
865 V: std::convert::Into<std::string::String>,
866 {
867 use std::iter::Iterator;
868 self.service_ids = v.into_iter().map(|i| i.into()).collect();
869 self
870 }
871}
872
873impl wkt::message::Message for BatchEnableServicesRequest {
874 fn typename() -> &'static str {
875 "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesRequest"
876 }
877}
878
879#[derive(Clone, Default, PartialEq)]
883#[non_exhaustive]
884pub struct BatchEnableServicesResponse {
885 pub services: std::vec::Vec<crate::model::Service>,
887
888 pub failures: std::vec::Vec<crate::model::batch_enable_services_response::EnableFailure>,
891
892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
893}
894
895impl BatchEnableServicesResponse {
896 pub fn new() -> Self {
897 std::default::Default::default()
898 }
899
900 pub fn set_services<T, V>(mut self, v: T) -> Self
902 where
903 T: std::iter::IntoIterator<Item = V>,
904 V: std::convert::Into<crate::model::Service>,
905 {
906 use std::iter::Iterator;
907 self.services = v.into_iter().map(|i| i.into()).collect();
908 self
909 }
910
911 pub fn set_failures<T, V>(mut self, v: T) -> Self
913 where
914 T: std::iter::IntoIterator<Item = V>,
915 V: std::convert::Into<crate::model::batch_enable_services_response::EnableFailure>,
916 {
917 use std::iter::Iterator;
918 self.failures = v.into_iter().map(|i| i.into()).collect();
919 self
920 }
921}
922
923impl wkt::message::Message for BatchEnableServicesResponse {
924 fn typename() -> &'static str {
925 "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse"
926 }
927}
928
929pub mod batch_enable_services_response {
931 #[allow(unused_imports)]
932 use super::*;
933
934 #[derive(Clone, Default, PartialEq)]
936 #[non_exhaustive]
937 pub struct EnableFailure {
938 pub service_id: std::string::String,
940
941 pub error_message: std::string::String,
943
944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
945 }
946
947 impl EnableFailure {
948 pub fn new() -> Self {
949 std::default::Default::default()
950 }
951
952 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
954 self.service_id = v.into();
955 self
956 }
957
958 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
960 mut self,
961 v: T,
962 ) -> Self {
963 self.error_message = v.into();
964 self
965 }
966 }
967
968 impl wkt::message::Message for EnableFailure {
969 fn typename() -> &'static str {
970 "type.googleapis.com/google.api.serviceusage.v1.BatchEnableServicesResponse.EnableFailure"
971 }
972 }
973}
974
975#[derive(Clone, Default, PartialEq)]
977#[non_exhaustive]
978pub struct BatchGetServicesRequest {
979 pub parent: std::string::String,
985
986 pub names: std::vec::Vec<std::string::String>,
993
994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
995}
996
997impl BatchGetServicesRequest {
998 pub fn new() -> Self {
999 std::default::Default::default()
1000 }
1001
1002 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1004 self.parent = v.into();
1005 self
1006 }
1007
1008 pub fn set_names<T, V>(mut self, v: T) -> Self
1010 where
1011 T: std::iter::IntoIterator<Item = V>,
1012 V: std::convert::Into<std::string::String>,
1013 {
1014 use std::iter::Iterator;
1015 self.names = v.into_iter().map(|i| i.into()).collect();
1016 self
1017 }
1018}
1019
1020impl wkt::message::Message for BatchGetServicesRequest {
1021 fn typename() -> &'static str {
1022 "type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesRequest"
1023 }
1024}
1025
1026#[derive(Clone, Default, PartialEq)]
1028#[non_exhaustive]
1029pub struct BatchGetServicesResponse {
1030 pub services: std::vec::Vec<crate::model::Service>,
1032
1033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1034}
1035
1036impl BatchGetServicesResponse {
1037 pub fn new() -> Self {
1038 std::default::Default::default()
1039 }
1040
1041 pub fn set_services<T, V>(mut self, v: T) -> Self
1043 where
1044 T: std::iter::IntoIterator<Item = V>,
1045 V: std::convert::Into<crate::model::Service>,
1046 {
1047 use std::iter::Iterator;
1048 self.services = v.into_iter().map(|i| i.into()).collect();
1049 self
1050 }
1051}
1052
1053impl wkt::message::Message for BatchGetServicesResponse {
1054 fn typename() -> &'static str {
1055 "type.googleapis.com/google.api.serviceusage.v1.BatchGetServicesResponse"
1056 }
1057}
1058
1059#[derive(Clone, Debug, PartialEq)]
1075#[non_exhaustive]
1076pub enum State {
1077 Unspecified,
1081 Disabled,
1084 Enabled,
1086 UnknownValue(state::UnknownValue),
1091}
1092
1093#[doc(hidden)]
1094pub mod state {
1095 #[allow(unused_imports)]
1096 use super::*;
1097 #[derive(Clone, Debug, PartialEq)]
1098 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1099}
1100
1101impl State {
1102 pub fn value(&self) -> std::option::Option<i32> {
1107 match self {
1108 Self::Unspecified => std::option::Option::Some(0),
1109 Self::Disabled => std::option::Option::Some(1),
1110 Self::Enabled => std::option::Option::Some(2),
1111 Self::UnknownValue(u) => u.0.value(),
1112 }
1113 }
1114
1115 pub fn name(&self) -> std::option::Option<&str> {
1120 match self {
1121 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1122 Self::Disabled => std::option::Option::Some("DISABLED"),
1123 Self::Enabled => std::option::Option::Some("ENABLED"),
1124 Self::UnknownValue(u) => u.0.name(),
1125 }
1126 }
1127}
1128
1129impl std::default::Default for State {
1130 fn default() -> Self {
1131 use std::convert::From;
1132 Self::from(0)
1133 }
1134}
1135
1136impl std::fmt::Display for State {
1137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1138 wkt::internal::display_enum(f, self.name(), self.value())
1139 }
1140}
1141
1142impl std::convert::From<i32> for State {
1143 fn from(value: i32) -> Self {
1144 match value {
1145 0 => Self::Unspecified,
1146 1 => Self::Disabled,
1147 2 => Self::Enabled,
1148 _ => Self::UnknownValue(state::UnknownValue(
1149 wkt::internal::UnknownEnumValue::Integer(value),
1150 )),
1151 }
1152 }
1153}
1154
1155impl std::convert::From<&str> for State {
1156 fn from(value: &str) -> Self {
1157 use std::string::ToString;
1158 match value {
1159 "STATE_UNSPECIFIED" => Self::Unspecified,
1160 "DISABLED" => Self::Disabled,
1161 "ENABLED" => Self::Enabled,
1162 _ => Self::UnknownValue(state::UnknownValue(
1163 wkt::internal::UnknownEnumValue::String(value.to_string()),
1164 )),
1165 }
1166 }
1167}
1168
1169impl serde::ser::Serialize for State {
1170 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1171 where
1172 S: serde::Serializer,
1173 {
1174 match self {
1175 Self::Unspecified => serializer.serialize_i32(0),
1176 Self::Disabled => serializer.serialize_i32(1),
1177 Self::Enabled => serializer.serialize_i32(2),
1178 Self::UnknownValue(u) => u.0.serialize(serializer),
1179 }
1180 }
1181}
1182
1183impl<'de> serde::de::Deserialize<'de> for State {
1184 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1185 where
1186 D: serde::Deserializer<'de>,
1187 {
1188 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1189 ".google.api.serviceusage.v1.State",
1190 ))
1191 }
1192}