google_cloud_monitoring_v3/
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 api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate gtype;
26extern crate lazy_static;
27extern crate reqwest;
28extern crate rpc;
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 description of the conditions under which some aspect of your system is
41/// considered to be "unhealthy" and the ways to notify people or services about
42/// this state. For an overview of alerting policies, see
43/// [Introduction to Alerting](https://cloud.google.com/monitoring/alerts/).
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct AlertPolicy {
47    /// Identifier. Required if the policy exists. The resource name for this
48    /// policy. The format is:
49    ///
50    /// ```norust
51    /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
52    /// ```
53    ///
54    /// `[ALERT_POLICY_ID]` is assigned by Cloud Monitoring when the policy
55    /// is created. When calling the
56    /// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
57    /// method, do not include the `name` field in the alerting policy passed as
58    /// part of the request.
59    ///
60    /// [google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]: crate::client::AlertPolicyService::create_alert_policy
61    pub name: std::string::String,
62
63    /// A short name or phrase used to identify the policy in dashboards,
64    /// notifications, and incidents. To avoid confusion, don't use the same
65    /// display name for multiple policies in the same project. The name is
66    /// limited to 512 Unicode characters.
67    ///
68    /// The convention for the display_name of a PrometheusQueryLanguageCondition
69    /// is "{rule group name}/{alert name}", where the {rule group name} and
70    /// {alert name} should be taken from the corresponding Prometheus
71    /// configuration file. This convention is not enforced.
72    /// In any case the display_name is not a unique key of the AlertPolicy.
73    pub display_name: std::string::String,
74
75    /// Documentation that is included with notifications and incidents related to
76    /// this policy. Best practice is for the documentation to include information
77    /// to help responders understand, mitigate, escalate, and correct the
78    /// underlying problems detected by the alerting policy. Notification channels
79    /// that have limited capacity might not show this documentation.
80    pub documentation: std::option::Option<crate::model::alert_policy::Documentation>,
81
82    /// User-supplied key/value data to be used for organizing and
83    /// identifying the `AlertPolicy` objects.
84    ///
85    /// The field can contain up to 64 entries. Each key and value is limited to
86    /// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
87    /// values can contain only lowercase letters, numerals, underscores, and
88    /// dashes. Keys must begin with a letter.
89    ///
90    /// Note that Prometheus {alert name} is a
91    /// [valid Prometheus label
92    /// names](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels),
93    /// whereas Prometheus {rule group} is an unrestricted UTF-8 string.
94    /// This means that they cannot be stored as-is in user labels, because
95    /// they may contain characters that are not allowed in user-label values.
96    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
97
98    /// A list of conditions for the policy. The conditions are combined by AND or
99    /// OR according to the `combiner` field. If the combined conditions evaluate
100    /// to true, then an incident is created. A policy can have from one to six
101    /// conditions.
102    /// If `condition_time_series_query_language` is present, it must be the only
103    /// `condition`.
104    /// If `condition_monitoring_query_language` is present, it must be the only
105    /// `condition`.
106    pub conditions: std::vec::Vec<crate::model::alert_policy::Condition>,
107
108    /// How to combine the results of multiple conditions to determine if an
109    /// incident should be opened.
110    /// If `condition_time_series_query_language` is present, this must be
111    /// `COMBINE_UNSPECIFIED`.
112    pub combiner: crate::model::alert_policy::ConditionCombinerType,
113
114    /// Whether or not the policy is enabled. On write, the default interpretation
115    /// if unset is that the policy is enabled. On read, clients should not make
116    /// any assumption about the state if it has not been populated. The
117    /// field should always be populated on List and Get operations, unless
118    /// a field projection has been specified that strips it out.
119    pub enabled: std::option::Option<wkt::BoolValue>,
120
121    /// Read-only description of how the alerting policy is invalid. This field is
122    /// only set when the alerting policy is invalid. An invalid alerting policy
123    /// will not generate incidents.
124    pub validity: std::option::Option<rpc::model::Status>,
125
126    /// Identifies the notification channels to which notifications should be sent
127    /// when incidents are opened or closed or when new violations occur on
128    /// an already opened incident. Each element of this array corresponds to
129    /// the `name` field in each of the
130    /// [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
131    /// objects that are returned from the [`ListNotificationChannels`]
132    /// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
133    /// method. The format of the entries in this field is:
134    ///
135    /// ```norust
136    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
137    /// ```
138    ///
139    /// [google.monitoring.v3.NotificationChannel]: crate::model::NotificationChannel
140    pub notification_channels: std::vec::Vec<std::string::String>,
141
142    /// A read-only record of the creation of the alerting policy. If provided
143    /// in a call to create or update, this field will be ignored.
144    pub creation_record: std::option::Option<crate::model::MutationRecord>,
145
146    /// A read-only record of the most recent change to the alerting policy. If
147    /// provided in a call to create or update, this field will be ignored.
148    pub mutation_record: std::option::Option<crate::model::MutationRecord>,
149
150    /// Control over how this alerting policy's notification channels are notified.
151    pub alert_strategy: std::option::Option<crate::model::alert_policy::AlertStrategy>,
152
153    /// Optional. The severity of an alerting policy indicates how important
154    /// incidents generated by that policy are. The severity level will be
155    /// displayed on the Incident detail page and in notifications.
156    pub severity: crate::model::alert_policy::Severity,
157
158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
159}
160
161impl AlertPolicy {
162    pub fn new() -> Self {
163        std::default::Default::default()
164    }
165
166    /// Sets the value of [name][crate::model::AlertPolicy::name].
167    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168        self.name = v.into();
169        self
170    }
171
172    /// Sets the value of [display_name][crate::model::AlertPolicy::display_name].
173    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
174        self.display_name = v.into();
175        self
176    }
177
178    /// Sets the value of [documentation][crate::model::AlertPolicy::documentation].
179    pub fn set_documentation<T>(mut self, v: T) -> Self
180    where
181        T: std::convert::Into<crate::model::alert_policy::Documentation>,
182    {
183        self.documentation = std::option::Option::Some(v.into());
184        self
185    }
186
187    /// Sets or clears the value of [documentation][crate::model::AlertPolicy::documentation].
188    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
189    where
190        T: std::convert::Into<crate::model::alert_policy::Documentation>,
191    {
192        self.documentation = v.map(|x| x.into());
193        self
194    }
195
196    /// Sets the value of [user_labels][crate::model::AlertPolicy::user_labels].
197    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
198    where
199        T: std::iter::IntoIterator<Item = (K, V)>,
200        K: std::convert::Into<std::string::String>,
201        V: std::convert::Into<std::string::String>,
202    {
203        use std::iter::Iterator;
204        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
205        self
206    }
207
208    /// Sets the value of [conditions][crate::model::AlertPolicy::conditions].
209    pub fn set_conditions<T, V>(mut self, v: T) -> Self
210    where
211        T: std::iter::IntoIterator<Item = V>,
212        V: std::convert::Into<crate::model::alert_policy::Condition>,
213    {
214        use std::iter::Iterator;
215        self.conditions = v.into_iter().map(|i| i.into()).collect();
216        self
217    }
218
219    /// Sets the value of [combiner][crate::model::AlertPolicy::combiner].
220    pub fn set_combiner<
221        T: std::convert::Into<crate::model::alert_policy::ConditionCombinerType>,
222    >(
223        mut self,
224        v: T,
225    ) -> Self {
226        self.combiner = v.into();
227        self
228    }
229
230    /// Sets the value of [enabled][crate::model::AlertPolicy::enabled].
231    pub fn set_enabled<T>(mut self, v: T) -> Self
232    where
233        T: std::convert::Into<wkt::BoolValue>,
234    {
235        self.enabled = std::option::Option::Some(v.into());
236        self
237    }
238
239    /// Sets or clears the value of [enabled][crate::model::AlertPolicy::enabled].
240    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
241    where
242        T: std::convert::Into<wkt::BoolValue>,
243    {
244        self.enabled = v.map(|x| x.into());
245        self
246    }
247
248    /// Sets the value of [validity][crate::model::AlertPolicy::validity].
249    pub fn set_validity<T>(mut self, v: T) -> Self
250    where
251        T: std::convert::Into<rpc::model::Status>,
252    {
253        self.validity = std::option::Option::Some(v.into());
254        self
255    }
256
257    /// Sets or clears the value of [validity][crate::model::AlertPolicy::validity].
258    pub fn set_or_clear_validity<T>(mut self, v: std::option::Option<T>) -> Self
259    where
260        T: std::convert::Into<rpc::model::Status>,
261    {
262        self.validity = v.map(|x| x.into());
263        self
264    }
265
266    /// Sets the value of [notification_channels][crate::model::AlertPolicy::notification_channels].
267    pub fn set_notification_channels<T, V>(mut self, v: T) -> Self
268    where
269        T: std::iter::IntoIterator<Item = V>,
270        V: std::convert::Into<std::string::String>,
271    {
272        use std::iter::Iterator;
273        self.notification_channels = v.into_iter().map(|i| i.into()).collect();
274        self
275    }
276
277    /// Sets the value of [creation_record][crate::model::AlertPolicy::creation_record].
278    pub fn set_creation_record<T>(mut self, v: T) -> Self
279    where
280        T: std::convert::Into<crate::model::MutationRecord>,
281    {
282        self.creation_record = std::option::Option::Some(v.into());
283        self
284    }
285
286    /// Sets or clears the value of [creation_record][crate::model::AlertPolicy::creation_record].
287    pub fn set_or_clear_creation_record<T>(mut self, v: std::option::Option<T>) -> Self
288    where
289        T: std::convert::Into<crate::model::MutationRecord>,
290    {
291        self.creation_record = v.map(|x| x.into());
292        self
293    }
294
295    /// Sets the value of [mutation_record][crate::model::AlertPolicy::mutation_record].
296    pub fn set_mutation_record<T>(mut self, v: T) -> Self
297    where
298        T: std::convert::Into<crate::model::MutationRecord>,
299    {
300        self.mutation_record = std::option::Option::Some(v.into());
301        self
302    }
303
304    /// Sets or clears the value of [mutation_record][crate::model::AlertPolicy::mutation_record].
305    pub fn set_or_clear_mutation_record<T>(mut self, v: std::option::Option<T>) -> Self
306    where
307        T: std::convert::Into<crate::model::MutationRecord>,
308    {
309        self.mutation_record = v.map(|x| x.into());
310        self
311    }
312
313    /// Sets the value of [alert_strategy][crate::model::AlertPolicy::alert_strategy].
314    pub fn set_alert_strategy<T>(mut self, v: T) -> Self
315    where
316        T: std::convert::Into<crate::model::alert_policy::AlertStrategy>,
317    {
318        self.alert_strategy = std::option::Option::Some(v.into());
319        self
320    }
321
322    /// Sets or clears the value of [alert_strategy][crate::model::AlertPolicy::alert_strategy].
323    pub fn set_or_clear_alert_strategy<T>(mut self, v: std::option::Option<T>) -> Self
324    where
325        T: std::convert::Into<crate::model::alert_policy::AlertStrategy>,
326    {
327        self.alert_strategy = v.map(|x| x.into());
328        self
329    }
330
331    /// Sets the value of [severity][crate::model::AlertPolicy::severity].
332    pub fn set_severity<T: std::convert::Into<crate::model::alert_policy::Severity>>(
333        mut self,
334        v: T,
335    ) -> Self {
336        self.severity = v.into();
337        self
338    }
339}
340
341impl wkt::message::Message for AlertPolicy {
342    fn typename() -> &'static str {
343        "type.googleapis.com/google.monitoring.v3.AlertPolicy"
344    }
345}
346
347/// Defines additional types related to [AlertPolicy].
348pub mod alert_policy {
349    #[allow(unused_imports)]
350    use super::*;
351
352    /// Documentation that is included in the notifications and incidents
353    /// pertaining to this policy.
354    #[derive(Clone, Default, PartialEq)]
355    #[non_exhaustive]
356    pub struct Documentation {
357        /// The body of the documentation, interpreted according to `mime_type`.
358        /// The content may not exceed 8,192 Unicode characters and may not exceed
359        /// more than 10,240 bytes when encoded in UTF-8 format, whichever is
360        /// smaller. This text can be [templatized by using
361        /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
362        pub content: std::string::String,
363
364        /// The format of the `content` field. Presently, only the value
365        /// `"text/markdown"` is supported. See
366        /// [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
367        pub mime_type: std::string::String,
368
369        /// Optional. The subject line of the notification. The subject line may not
370        /// exceed 10,240 bytes. In notifications generated by this policy, the
371        /// contents of the subject line after variable expansion will be truncated
372        /// to 255 bytes or shorter at the latest UTF-8 character boundary. The
373        /// 255-byte limit is recommended by [this
374        /// thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
375        /// It is both the limit imposed by some third-party ticketing products and
376        /// it is common to define textual fields in databases as VARCHAR(255).
377        ///
378        /// The contents of the subject line can be [templatized by using
379        /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
380        /// If this field is missing or empty, a default subject line will be
381        /// generated.
382        pub subject: std::string::String,
383
384        /// Optional. Links to content such as playbooks, repositories, and other
385        /// resources. This field can contain up to 3 entries.
386        pub links: std::vec::Vec<crate::model::alert_policy::documentation::Link>,
387
388        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
389    }
390
391    impl Documentation {
392        pub fn new() -> Self {
393            std::default::Default::default()
394        }
395
396        /// Sets the value of [content][crate::model::alert_policy::Documentation::content].
397        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
398            self.content = v.into();
399            self
400        }
401
402        /// Sets the value of [mime_type][crate::model::alert_policy::Documentation::mime_type].
403        pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404            self.mime_type = v.into();
405            self
406        }
407
408        /// Sets the value of [subject][crate::model::alert_policy::Documentation::subject].
409        pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
410            self.subject = v.into();
411            self
412        }
413
414        /// Sets the value of [links][crate::model::alert_policy::Documentation::links].
415        pub fn set_links<T, V>(mut self, v: T) -> Self
416        where
417            T: std::iter::IntoIterator<Item = V>,
418            V: std::convert::Into<crate::model::alert_policy::documentation::Link>,
419        {
420            use std::iter::Iterator;
421            self.links = v.into_iter().map(|i| i.into()).collect();
422            self
423        }
424    }
425
426    impl wkt::message::Message for Documentation {
427        fn typename() -> &'static str {
428            "type.googleapis.com/google.monitoring.v3.AlertPolicy.Documentation"
429        }
430    }
431
432    /// Defines additional types related to [Documentation].
433    pub mod documentation {
434        #[allow(unused_imports)]
435        use super::*;
436
437        /// Links to content such as playbooks, repositories, and other resources.
438        #[derive(Clone, Default, PartialEq)]
439        #[non_exhaustive]
440        pub struct Link {
441            /// A short display name for the link. The display name must not be empty
442            /// or exceed 63 characters. Example: "playbook".
443            pub display_name: std::string::String,
444
445            /// The url of a webpage.
446            /// A url can be templatized by using variables
447            /// in the path or the query parameters. The total length of a URL should
448            /// not exceed 2083 characters before and after variable expansion.
449            /// Example: `https://my_domain.com/playbook?name=${resource.name}`
450            pub url: std::string::String,
451
452            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
453        }
454
455        impl Link {
456            pub fn new() -> Self {
457                std::default::Default::default()
458            }
459
460            /// Sets the value of [display_name][crate::model::alert_policy::documentation::Link::display_name].
461            pub fn set_display_name<T: std::convert::Into<std::string::String>>(
462                mut self,
463                v: T,
464            ) -> Self {
465                self.display_name = v.into();
466                self
467            }
468
469            /// Sets the value of [url][crate::model::alert_policy::documentation::Link::url].
470            pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
471                self.url = v.into();
472                self
473            }
474        }
475
476        impl wkt::message::Message for Link {
477            fn typename() -> &'static str {
478                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Documentation.Link"
479            }
480        }
481    }
482
483    /// A condition is a true/false test that determines when an alerting policy
484    /// should open an incident. If a condition evaluates to true, it signifies
485    /// that something is wrong.
486    #[derive(Clone, Default, PartialEq)]
487    #[non_exhaustive]
488    pub struct Condition {
489        /// Required if the condition exists. The unique resource name for this
490        /// condition. Its format is:
491        ///
492        /// ```norust
493        /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
494        /// ```
495        ///
496        /// `[CONDITION_ID]` is assigned by Cloud Monitoring when the
497        /// condition is created as part of a new or updated alerting policy.
498        ///
499        /// When calling the
500        /// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
501        /// method, do not include the `name` field in the conditions of the
502        /// requested alerting policy. Cloud Monitoring creates the
503        /// condition identifiers and includes them in the new policy.
504        ///
505        /// When calling the
506        /// [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
507        /// method to update a policy, including a condition `name` causes the
508        /// existing condition to be updated. Conditions without names are added to
509        /// the updated policy. Existing conditions are deleted if they are not
510        /// updated.
511        ///
512        /// Best practice is to preserve `[CONDITION_ID]` if you make only small
513        /// changes, such as those to condition thresholds, durations, or trigger
514        /// values.  Otherwise, treat the change as a new condition and let the
515        /// existing condition be deleted.
516        ///
517        /// [google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]: crate::client::AlertPolicyService::create_alert_policy
518        /// [google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]: crate::client::AlertPolicyService::update_alert_policy
519        pub name: std::string::String,
520
521        /// A short name or phrase used to identify the condition in dashboards,
522        /// notifications, and incidents. To avoid confusion, don't use the same
523        /// display name for multiple conditions in the same policy.
524        pub display_name: std::string::String,
525
526        /// Only one of the following condition types will be specified.
527        pub condition: std::option::Option<crate::model::alert_policy::condition::Condition>,
528
529        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
530    }
531
532    impl Condition {
533        pub fn new() -> Self {
534            std::default::Default::default()
535        }
536
537        /// Sets the value of [name][crate::model::alert_policy::Condition::name].
538        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
539            self.name = v.into();
540            self
541        }
542
543        /// Sets the value of [display_name][crate::model::alert_policy::Condition::display_name].
544        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
545            mut self,
546            v: T,
547        ) -> Self {
548            self.display_name = v.into();
549            self
550        }
551
552        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition].
553        ///
554        /// Note that all the setters affecting `condition` are mutually
555        /// exclusive.
556        pub fn set_condition<
557            T: std::convert::Into<
558                    std::option::Option<crate::model::alert_policy::condition::Condition>,
559                >,
560        >(
561            mut self,
562            v: T,
563        ) -> Self {
564            self.condition = v.into();
565            self
566        }
567
568        /// The value of [condition][crate::model::alert_policy::Condition::condition]
569        /// if it holds a `ConditionThreshold`, `None` if the field is not set or
570        /// holds a different branch.
571        pub fn condition_threshold(
572            &self,
573        ) -> std::option::Option<
574            &std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
575        > {
576            #[allow(unreachable_patterns)]
577            self.condition.as_ref().and_then(|v| match v {
578                crate::model::alert_policy::condition::Condition::ConditionThreshold(v) => {
579                    std::option::Option::Some(v)
580                }
581                _ => std::option::Option::None,
582            })
583        }
584
585        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
586        /// to hold a `ConditionThreshold`.
587        ///
588        /// Note that all the setters affecting `condition` are
589        /// mutually exclusive.
590        pub fn set_condition_threshold<
591            T: std::convert::Into<
592                    std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
593                >,
594        >(
595            mut self,
596            v: T,
597        ) -> Self {
598            self.condition = std::option::Option::Some(
599                crate::model::alert_policy::condition::Condition::ConditionThreshold(v.into()),
600            );
601            self
602        }
603
604        /// The value of [condition][crate::model::alert_policy::Condition::condition]
605        /// if it holds a `ConditionAbsent`, `None` if the field is not set or
606        /// holds a different branch.
607        pub fn condition_absent(
608            &self,
609        ) -> std::option::Option<
610            &std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>,
611        > {
612            #[allow(unreachable_patterns)]
613            self.condition.as_ref().and_then(|v| match v {
614                crate::model::alert_policy::condition::Condition::ConditionAbsent(v) => {
615                    std::option::Option::Some(v)
616                }
617                _ => std::option::Option::None,
618            })
619        }
620
621        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
622        /// to hold a `ConditionAbsent`.
623        ///
624        /// Note that all the setters affecting `condition` are
625        /// mutually exclusive.
626        pub fn set_condition_absent<
627            T: std::convert::Into<
628                    std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>,
629                >,
630        >(
631            mut self,
632            v: T,
633        ) -> Self {
634            self.condition = std::option::Option::Some(
635                crate::model::alert_policy::condition::Condition::ConditionAbsent(v.into()),
636            );
637            self
638        }
639
640        /// The value of [condition][crate::model::alert_policy::Condition::condition]
641        /// if it holds a `ConditionMatchedLog`, `None` if the field is not set or
642        /// holds a different branch.
643        pub fn condition_matched_log(
644            &self,
645        ) -> std::option::Option<&std::boxed::Box<crate::model::alert_policy::condition::LogMatch>>
646        {
647            #[allow(unreachable_patterns)]
648            self.condition.as_ref().and_then(|v| match v {
649                crate::model::alert_policy::condition::Condition::ConditionMatchedLog(v) => {
650                    std::option::Option::Some(v)
651                }
652                _ => std::option::Option::None,
653            })
654        }
655
656        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
657        /// to hold a `ConditionMatchedLog`.
658        ///
659        /// Note that all the setters affecting `condition` are
660        /// mutually exclusive.
661        pub fn set_condition_matched_log<
662            T: std::convert::Into<std::boxed::Box<crate::model::alert_policy::condition::LogMatch>>,
663        >(
664            mut self,
665            v: T,
666        ) -> Self {
667            self.condition = std::option::Option::Some(
668                crate::model::alert_policy::condition::Condition::ConditionMatchedLog(v.into()),
669            );
670            self
671        }
672
673        /// The value of [condition][crate::model::alert_policy::Condition::condition]
674        /// if it holds a `ConditionMonitoringQueryLanguage`, `None` if the field is not set or
675        /// holds a different branch.
676        pub fn condition_monitoring_query_language(
677            &self,
678        ) -> std::option::Option<
679            &std::boxed::Box<
680                crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
681            >,
682        > {
683            #[allow(unreachable_patterns)]
684            self.condition.as_ref().and_then(|v| match v {
685                crate::model::alert_policy::condition::Condition::ConditionMonitoringQueryLanguage(v) => std::option::Option::Some(v),
686                _ => std::option::Option::None,
687            })
688        }
689
690        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
691        /// to hold a `ConditionMonitoringQueryLanguage`.
692        ///
693        /// Note that all the setters affecting `condition` are
694        /// mutually exclusive.
695        pub fn set_condition_monitoring_query_language<
696            T: std::convert::Into<
697                    std::boxed::Box<
698                        crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
699                    >,
700                >,
701        >(
702            mut self,
703            v: T,
704        ) -> Self {
705            self.condition = std::option::Option::Some(
706                crate::model::alert_policy::condition::Condition::ConditionMonitoringQueryLanguage(
707                    v.into(),
708                ),
709            );
710            self
711        }
712
713        /// The value of [condition][crate::model::alert_policy::Condition::condition]
714        /// if it holds a `ConditionPrometheusQueryLanguage`, `None` if the field is not set or
715        /// holds a different branch.
716        pub fn condition_prometheus_query_language(
717            &self,
718        ) -> std::option::Option<
719            &std::boxed::Box<
720                crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
721            >,
722        > {
723            #[allow(unreachable_patterns)]
724            self.condition.as_ref().and_then(|v| match v {
725                crate::model::alert_policy::condition::Condition::ConditionPrometheusQueryLanguage(v) => std::option::Option::Some(v),
726                _ => std::option::Option::None,
727            })
728        }
729
730        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
731        /// to hold a `ConditionPrometheusQueryLanguage`.
732        ///
733        /// Note that all the setters affecting `condition` are
734        /// mutually exclusive.
735        pub fn set_condition_prometheus_query_language<
736            T: std::convert::Into<
737                    std::boxed::Box<
738                        crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
739                    >,
740                >,
741        >(
742            mut self,
743            v: T,
744        ) -> Self {
745            self.condition = std::option::Option::Some(
746                crate::model::alert_policy::condition::Condition::ConditionPrometheusQueryLanguage(
747                    v.into(),
748                ),
749            );
750            self
751        }
752
753        /// The value of [condition][crate::model::alert_policy::Condition::condition]
754        /// if it holds a `ConditionSql`, `None` if the field is not set or
755        /// holds a different branch.
756        pub fn condition_sql(
757            &self,
758        ) -> std::option::Option<
759            &std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>,
760        > {
761            #[allow(unreachable_patterns)]
762            self.condition.as_ref().and_then(|v| match v {
763                crate::model::alert_policy::condition::Condition::ConditionSql(v) => {
764                    std::option::Option::Some(v)
765                }
766                _ => std::option::Option::None,
767            })
768        }
769
770        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
771        /// to hold a `ConditionSql`.
772        ///
773        /// Note that all the setters affecting `condition` are
774        /// mutually exclusive.
775        pub fn set_condition_sql<
776            T: std::convert::Into<
777                    std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>,
778                >,
779        >(
780            mut self,
781            v: T,
782        ) -> Self {
783            self.condition = std::option::Option::Some(
784                crate::model::alert_policy::condition::Condition::ConditionSql(v.into()),
785            );
786            self
787        }
788    }
789
790    impl wkt::message::Message for Condition {
791        fn typename() -> &'static str {
792            "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition"
793        }
794    }
795
796    /// Defines additional types related to [Condition].
797    pub mod condition {
798        #[allow(unused_imports)]
799        use super::*;
800
801        /// Specifies how many time series must fail a predicate to trigger a
802        /// condition. If not specified, then a `{count: 1}` trigger is used.
803        #[derive(Clone, Default, PartialEq)]
804        #[non_exhaustive]
805        pub struct Trigger {
806            /// A type of trigger.
807            pub r#type: std::option::Option<crate::model::alert_policy::condition::trigger::Type>,
808
809            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
810        }
811
812        impl Trigger {
813            pub fn new() -> Self {
814                std::default::Default::default()
815            }
816
817            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::type].
818            ///
819            /// Note that all the setters affecting `r#type` are mutually
820            /// exclusive.
821            pub fn set_type<
822                T: std::convert::Into<
823                        std::option::Option<crate::model::alert_policy::condition::trigger::Type>,
824                    >,
825            >(
826                mut self,
827                v: T,
828            ) -> Self {
829                self.r#type = v.into();
830                self
831            }
832
833            /// The value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
834            /// if it holds a `Count`, `None` if the field is not set or
835            /// holds a different branch.
836            pub fn count(&self) -> std::option::Option<&i32> {
837                #[allow(unreachable_patterns)]
838                self.r#type.as_ref().and_then(|v| match v {
839                    crate::model::alert_policy::condition::trigger::Type::Count(v) => {
840                        std::option::Option::Some(v)
841                    }
842                    _ => std::option::Option::None,
843                })
844            }
845
846            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
847            /// to hold a `Count`.
848            ///
849            /// Note that all the setters affecting `r#type` are
850            /// mutually exclusive.
851            pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
852                self.r#type = std::option::Option::Some(
853                    crate::model::alert_policy::condition::trigger::Type::Count(v.into()),
854                );
855                self
856            }
857
858            /// The value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
859            /// if it holds a `Percent`, `None` if the field is not set or
860            /// holds a different branch.
861            pub fn percent(&self) -> std::option::Option<&f64> {
862                #[allow(unreachable_patterns)]
863                self.r#type.as_ref().and_then(|v| match v {
864                    crate::model::alert_policy::condition::trigger::Type::Percent(v) => {
865                        std::option::Option::Some(v)
866                    }
867                    _ => std::option::Option::None,
868                })
869            }
870
871            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
872            /// to hold a `Percent`.
873            ///
874            /// Note that all the setters affecting `r#type` are
875            /// mutually exclusive.
876            pub fn set_percent<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
877                self.r#type = std::option::Option::Some(
878                    crate::model::alert_policy::condition::trigger::Type::Percent(v.into()),
879                );
880                self
881            }
882        }
883
884        impl wkt::message::Message for Trigger {
885            fn typename() -> &'static str {
886                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.Trigger"
887            }
888        }
889
890        /// Defines additional types related to [Trigger].
891        pub mod trigger {
892            #[allow(unused_imports)]
893            use super::*;
894
895            /// A type of trigger.
896            #[derive(Clone, Debug, PartialEq)]
897            #[non_exhaustive]
898            pub enum Type {
899                /// The absolute number of time series that must fail
900                /// the predicate for the condition to be triggered.
901                Count(i32),
902                /// The percentage of time series that must fail the
903                /// predicate for the condition to be triggered.
904                Percent(f64),
905            }
906        }
907
908        /// A condition type that compares a collection of time series
909        /// against a threshold.
910        #[derive(Clone, Default, PartialEq)]
911        #[non_exhaustive]
912        pub struct MetricThreshold {
913            /// Required. A
914            /// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
915            /// identifies which time series should be compared with the threshold.
916            ///
917            /// The filter is similar to the one that is specified in the
918            /// [`ListTimeSeries`
919            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
920            /// (that call is useful to verify the time series that will be retrieved /
921            /// processed). The filter must specify the metric type and the resource
922            /// type. Optionally, it can specify resource labels and metric labels.
923            /// This field must not exceed 2048 Unicode characters in length.
924            pub filter: std::string::String,
925
926            /// Specifies the alignment of data points in individual time series as
927            /// well as how to combine the retrieved time series together (such as
928            /// when aggregating multiple streams on each resource to a single
929            /// stream for each resource or when aggregating streams across all
930            /// members of a group of resources). Multiple aggregations
931            /// are applied in the order specified.
932            ///
933            /// This field is similar to the one in the [`ListTimeSeries`
934            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
935            /// It is advisable to use the `ListTimeSeries` method when debugging this
936            /// field.
937            pub aggregations: std::vec::Vec<crate::model::Aggregation>,
938
939            /// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
940            /// identifies a time series that should be used as the denominator of a
941            /// ratio that will be compared with the threshold. If a
942            /// `denominator_filter` is specified, the time series specified by the
943            /// `filter` field will be used as the numerator.
944            ///
945            /// The filter must specify the metric type and optionally may contain
946            /// restrictions on resource type, resource labels, and metric labels.
947            /// This field may not exceed 2048 Unicode characters in length.
948            pub denominator_filter: std::string::String,
949
950            /// Specifies the alignment of data points in individual time series
951            /// selected by `denominatorFilter` as
952            /// well as how to combine the retrieved time series together (such as
953            /// when aggregating multiple streams on each resource to a single
954            /// stream for each resource or when aggregating streams across all
955            /// members of a group of resources).
956            ///
957            /// When computing ratios, the `aggregations` and
958            /// `denominator_aggregations` fields must use the same alignment period
959            /// and produce time series that have the same periodicity and labels.
960            pub denominator_aggregations: std::vec::Vec<crate::model::Aggregation>,
961
962            /// When this field is present, the `MetricThreshold` condition forecasts
963            /// whether the time series is predicted to violate the threshold within
964            /// the `forecast_horizon`. When this field is not set, the
965            /// `MetricThreshold` tests the current value of the timeseries against the
966            /// threshold.
967            pub forecast_options: std::option::Option<
968                crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
969            >,
970
971            /// The comparison to apply between the time series (indicated by `filter`
972            /// and `aggregation`) and the threshold (indicated by `threshold_value`).
973            /// The comparison is applied on each time series, with the time series
974            /// on the left-hand side and the threshold on the right-hand side.
975            ///
976            /// Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
977            pub comparison: crate::model::ComparisonType,
978
979            /// A value against which to compare the time series.
980            pub threshold_value: f64,
981
982            /// The amount of time that a time series must violate the
983            /// threshold to be considered failing. Currently, only values
984            /// that are a multiple of a minute--e.g., 0, 60, 120, or 300
985            /// seconds--are supported. If an invalid value is given, an
986            /// error will be returned. When choosing a duration, it is useful to
987            /// keep in mind the frequency of the underlying time series data
988            /// (which may also be affected by any alignments specified in the
989            /// `aggregations` field); a good duration is long enough so that a single
990            /// outlier does not generate spurious alerts, but short enough that
991            /// unhealthy states are detected and alerted on quickly.
992            pub duration: std::option::Option<wkt::Duration>,
993
994            /// The number/percent of time series for which the comparison must hold
995            /// in order for the condition to trigger. If unspecified, then the
996            /// condition will trigger if the comparison is true for any of the
997            /// time series that have been identified by `filter` and `aggregations`,
998            /// or by the ratio, if `denominator_filter` and `denominator_aggregations`
999            /// are specified.
1000            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1001
1002            /// A condition control that determines how metric-threshold conditions
1003            /// are evaluated when data stops arriving. To use this control, the value
1004            /// of the `duration` field must be greater than or equal to 60 seconds.
1005            pub evaluation_missing_data:
1006                crate::model::alert_policy::condition::EvaluationMissingData,
1007
1008            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1009        }
1010
1011        impl MetricThreshold {
1012            pub fn new() -> Self {
1013                std::default::Default::default()
1014            }
1015
1016            /// Sets the value of [filter][crate::model::alert_policy::condition::MetricThreshold::filter].
1017            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1018                self.filter = v.into();
1019                self
1020            }
1021
1022            /// Sets the value of [aggregations][crate::model::alert_policy::condition::MetricThreshold::aggregations].
1023            pub fn set_aggregations<T, V>(mut self, v: T) -> Self
1024            where
1025                T: std::iter::IntoIterator<Item = V>,
1026                V: std::convert::Into<crate::model::Aggregation>,
1027            {
1028                use std::iter::Iterator;
1029                self.aggregations = v.into_iter().map(|i| i.into()).collect();
1030                self
1031            }
1032
1033            /// Sets the value of [denominator_filter][crate::model::alert_policy::condition::MetricThreshold::denominator_filter].
1034            pub fn set_denominator_filter<T: std::convert::Into<std::string::String>>(
1035                mut self,
1036                v: T,
1037            ) -> Self {
1038                self.denominator_filter = v.into();
1039                self
1040            }
1041
1042            /// Sets the value of [denominator_aggregations][crate::model::alert_policy::condition::MetricThreshold::denominator_aggregations].
1043            pub fn set_denominator_aggregations<T, V>(mut self, v: T) -> Self
1044            where
1045                T: std::iter::IntoIterator<Item = V>,
1046                V: std::convert::Into<crate::model::Aggregation>,
1047            {
1048                use std::iter::Iterator;
1049                self.denominator_aggregations = v.into_iter().map(|i| i.into()).collect();
1050                self
1051            }
1052
1053            /// Sets the value of [forecast_options][crate::model::alert_policy::condition::MetricThreshold::forecast_options].
1054            pub fn set_forecast_options<T>(mut self, v: T) -> Self
1055            where
1056                T: std::convert::Into<
1057                        crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
1058                    >,
1059            {
1060                self.forecast_options = std::option::Option::Some(v.into());
1061                self
1062            }
1063
1064            /// Sets or clears the value of [forecast_options][crate::model::alert_policy::condition::MetricThreshold::forecast_options].
1065            pub fn set_or_clear_forecast_options<T>(mut self, v: std::option::Option<T>) -> Self
1066            where
1067                T: std::convert::Into<
1068                        crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
1069                    >,
1070            {
1071                self.forecast_options = v.map(|x| x.into());
1072                self
1073            }
1074
1075            /// Sets the value of [comparison][crate::model::alert_policy::condition::MetricThreshold::comparison].
1076            pub fn set_comparison<T: std::convert::Into<crate::model::ComparisonType>>(
1077                mut self,
1078                v: T,
1079            ) -> Self {
1080                self.comparison = v.into();
1081                self
1082            }
1083
1084            /// Sets the value of [threshold_value][crate::model::alert_policy::condition::MetricThreshold::threshold_value].
1085            pub fn set_threshold_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1086                self.threshold_value = v.into();
1087                self
1088            }
1089
1090            /// Sets the value of [duration][crate::model::alert_policy::condition::MetricThreshold::duration].
1091            pub fn set_duration<T>(mut self, v: T) -> Self
1092            where
1093                T: std::convert::Into<wkt::Duration>,
1094            {
1095                self.duration = std::option::Option::Some(v.into());
1096                self
1097            }
1098
1099            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MetricThreshold::duration].
1100            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1101            where
1102                T: std::convert::Into<wkt::Duration>,
1103            {
1104                self.duration = v.map(|x| x.into());
1105                self
1106            }
1107
1108            /// Sets the value of [trigger][crate::model::alert_policy::condition::MetricThreshold::trigger].
1109            pub fn set_trigger<T>(mut self, v: T) -> Self
1110            where
1111                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1112            {
1113                self.trigger = std::option::Option::Some(v.into());
1114                self
1115            }
1116
1117            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MetricThreshold::trigger].
1118            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1119            where
1120                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1121            {
1122                self.trigger = v.map(|x| x.into());
1123                self
1124            }
1125
1126            /// Sets the value of [evaluation_missing_data][crate::model::alert_policy::condition::MetricThreshold::evaluation_missing_data].
1127            pub fn set_evaluation_missing_data<
1128                T: std::convert::Into<crate::model::alert_policy::condition::EvaluationMissingData>,
1129            >(
1130                mut self,
1131                v: T,
1132            ) -> Self {
1133                self.evaluation_missing_data = v.into();
1134                self
1135            }
1136        }
1137
1138        impl wkt::message::Message for MetricThreshold {
1139            fn typename() -> &'static str {
1140                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricThreshold"
1141            }
1142        }
1143
1144        /// Defines additional types related to [MetricThreshold].
1145        pub mod metric_threshold {
1146            #[allow(unused_imports)]
1147            use super::*;
1148
1149            /// Options used when forecasting the time series and testing
1150            /// the predicted value against the threshold.
1151            #[derive(Clone, Default, PartialEq)]
1152            #[non_exhaustive]
1153            pub struct ForecastOptions {
1154                /// Required. The length of time into the future to forecast whether a
1155                /// time series will violate the threshold. If the predicted value is
1156                /// found to violate the threshold, and the violation is observed in all
1157                /// forecasts made for the configured `duration`, then the time series is
1158                /// considered to be failing.
1159                /// The forecast horizon can range from 1 hour to 60 hours.
1160                pub forecast_horizon: std::option::Option<wkt::Duration>,
1161
1162                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1163            }
1164
1165            impl ForecastOptions {
1166                pub fn new() -> Self {
1167                    std::default::Default::default()
1168                }
1169
1170                /// Sets the value of [forecast_horizon][crate::model::alert_policy::condition::metric_threshold::ForecastOptions::forecast_horizon].
1171                pub fn set_forecast_horizon<T>(mut self, v: T) -> Self
1172                where
1173                    T: std::convert::Into<wkt::Duration>,
1174                {
1175                    self.forecast_horizon = std::option::Option::Some(v.into());
1176                    self
1177                }
1178
1179                /// Sets or clears the value of [forecast_horizon][crate::model::alert_policy::condition::metric_threshold::ForecastOptions::forecast_horizon].
1180                pub fn set_or_clear_forecast_horizon<T>(mut self, v: std::option::Option<T>) -> Self
1181                where
1182                    T: std::convert::Into<wkt::Duration>,
1183                {
1184                    self.forecast_horizon = v.map(|x| x.into());
1185                    self
1186                }
1187            }
1188
1189            impl wkt::message::Message for ForecastOptions {
1190                fn typename() -> &'static str {
1191                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions"
1192                }
1193            }
1194        }
1195
1196        /// A condition type that checks that monitored resources
1197        /// are reporting data. The configuration defines a metric and
1198        /// a set of monitored resources. The predicate is considered in violation
1199        /// when a time series for the specified metric of a monitored
1200        /// resource does not include any data in the specified `duration`.
1201        #[derive(Clone, Default, PartialEq)]
1202        #[non_exhaustive]
1203        pub struct MetricAbsence {
1204            /// Required. A
1205            /// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
1206            /// identifies which time series should be compared with the threshold.
1207            ///
1208            /// The filter is similar to the one that is specified in the
1209            /// [`ListTimeSeries`
1210            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
1211            /// (that call is useful to verify the time series that will be retrieved /
1212            /// processed). The filter must specify the metric type and the resource
1213            /// type. Optionally, it can specify resource labels and metric labels.
1214            /// This field must not exceed 2048 Unicode characters in length.
1215            pub filter: std::string::String,
1216
1217            /// Specifies the alignment of data points in individual time series as
1218            /// well as how to combine the retrieved time series together (such as
1219            /// when aggregating multiple streams on each resource to a single
1220            /// stream for each resource or when aggregating streams across all
1221            /// members of a group of resources). Multiple aggregations
1222            /// are applied in the order specified.
1223            ///
1224            /// This field is similar to the one in the [`ListTimeSeries`
1225            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
1226            /// It is advisable to use the `ListTimeSeries` method when debugging this
1227            /// field.
1228            pub aggregations: std::vec::Vec<crate::model::Aggregation>,
1229
1230            /// The amount of time that a time series must fail to report new
1231            /// data to be considered failing. The minimum value of this field
1232            /// is 120 seconds. Larger values that are a multiple of a
1233            /// minute--for example, 240 or 300 seconds--are supported.
1234            /// If an invalid value is given, an
1235            /// error will be returned. The `Duration.nanos` field is
1236            /// ignored.
1237            pub duration: std::option::Option<wkt::Duration>,
1238
1239            /// The number/percent of time series for which the comparison must hold
1240            /// in order for the condition to trigger. If unspecified, then the
1241            /// condition will trigger if the comparison is true for any of the
1242            /// time series that have been identified by `filter` and `aggregations`.
1243            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1244
1245            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1246        }
1247
1248        impl MetricAbsence {
1249            pub fn new() -> Self {
1250                std::default::Default::default()
1251            }
1252
1253            /// Sets the value of [filter][crate::model::alert_policy::condition::MetricAbsence::filter].
1254            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255                self.filter = v.into();
1256                self
1257            }
1258
1259            /// Sets the value of [aggregations][crate::model::alert_policy::condition::MetricAbsence::aggregations].
1260            pub fn set_aggregations<T, V>(mut self, v: T) -> Self
1261            where
1262                T: std::iter::IntoIterator<Item = V>,
1263                V: std::convert::Into<crate::model::Aggregation>,
1264            {
1265                use std::iter::Iterator;
1266                self.aggregations = v.into_iter().map(|i| i.into()).collect();
1267                self
1268            }
1269
1270            /// Sets the value of [duration][crate::model::alert_policy::condition::MetricAbsence::duration].
1271            pub fn set_duration<T>(mut self, v: T) -> Self
1272            where
1273                T: std::convert::Into<wkt::Duration>,
1274            {
1275                self.duration = std::option::Option::Some(v.into());
1276                self
1277            }
1278
1279            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MetricAbsence::duration].
1280            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1281            where
1282                T: std::convert::Into<wkt::Duration>,
1283            {
1284                self.duration = v.map(|x| x.into());
1285                self
1286            }
1287
1288            /// Sets the value of [trigger][crate::model::alert_policy::condition::MetricAbsence::trigger].
1289            pub fn set_trigger<T>(mut self, v: T) -> Self
1290            where
1291                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1292            {
1293                self.trigger = std::option::Option::Some(v.into());
1294                self
1295            }
1296
1297            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MetricAbsence::trigger].
1298            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1299            where
1300                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1301            {
1302                self.trigger = v.map(|x| x.into());
1303                self
1304            }
1305        }
1306
1307        impl wkt::message::Message for MetricAbsence {
1308            fn typename() -> &'static str {
1309                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricAbsence"
1310            }
1311        }
1312
1313        /// A condition type that checks whether a log message in the [scoping
1314        /// project](https://cloud.google.com/monitoring/api/v3#project_name)
1315        /// satisfies the given filter. Logs from other projects in the metrics
1316        /// scope are not evaluated.
1317        #[derive(Clone, Default, PartialEq)]
1318        #[non_exhaustive]
1319        pub struct LogMatch {
1320            /// Required. A logs-based filter. See [Advanced Logs
1321            /// Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
1322            /// for how this filter should be constructed.
1323            pub filter: std::string::String,
1324
1325            /// Optional. A map from a label key to an extractor expression, which is
1326            /// used to extract the value for this label key. Each entry in this map is
1327            /// a specification for how data should be extracted from log entries that
1328            /// match `filter`. Each combination of extracted values is treated as a
1329            /// separate rule for the purposes of triggering notifications. Label keys
1330            /// and corresponding values can be used in notifications generated by this
1331            /// condition.
1332            ///
1333            /// Please see [the documentation on logs-based metric
1334            /// `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
1335            /// for syntax and examples.
1336            pub label_extractors:
1337                std::collections::HashMap<std::string::String, std::string::String>,
1338
1339            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1340        }
1341
1342        impl LogMatch {
1343            pub fn new() -> Self {
1344                std::default::Default::default()
1345            }
1346
1347            /// Sets the value of [filter][crate::model::alert_policy::condition::LogMatch::filter].
1348            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1349                self.filter = v.into();
1350                self
1351            }
1352
1353            /// Sets the value of [label_extractors][crate::model::alert_policy::condition::LogMatch::label_extractors].
1354            pub fn set_label_extractors<T, K, V>(mut self, v: T) -> Self
1355            where
1356                T: std::iter::IntoIterator<Item = (K, V)>,
1357                K: std::convert::Into<std::string::String>,
1358                V: std::convert::Into<std::string::String>,
1359            {
1360                use std::iter::Iterator;
1361                self.label_extractors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1362                self
1363            }
1364        }
1365
1366        impl wkt::message::Message for LogMatch {
1367            fn typename() -> &'static str {
1368                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.LogMatch"
1369            }
1370        }
1371
1372        /// A condition type that allows alerting policies to be defined using
1373        /// [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
1374        #[derive(Clone, Default, PartialEq)]
1375        #[non_exhaustive]
1376        pub struct MonitoringQueryLanguageCondition {
1377            /// [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
1378            /// query that outputs a boolean stream.
1379            pub query: std::string::String,
1380
1381            /// The amount of time that a time series must violate the
1382            /// threshold to be considered failing. Currently, only values
1383            /// that are a multiple of a minute--e.g., 0, 60, 120, or 300
1384            /// seconds--are supported. If an invalid value is given, an
1385            /// error will be returned. When choosing a duration, it is useful to
1386            /// keep in mind the frequency of the underlying time series data
1387            /// (which may also be affected by any alignments specified in the
1388            /// `aggregations` field); a good duration is long enough so that a single
1389            /// outlier does not generate spurious alerts, but short enough that
1390            /// unhealthy states are detected and alerted on quickly.
1391            pub duration: std::option::Option<wkt::Duration>,
1392
1393            /// The number/percent of time series for which the comparison must hold
1394            /// in order for the condition to trigger. If unspecified, then the
1395            /// condition will trigger if the comparison is true for any of the
1396            /// time series that have been identified by `filter` and `aggregations`,
1397            /// or by the ratio, if `denominator_filter` and `denominator_aggregations`
1398            /// are specified.
1399            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1400
1401            /// A condition control that determines how metric-threshold conditions
1402            /// are evaluated when data stops arriving.
1403            pub evaluation_missing_data:
1404                crate::model::alert_policy::condition::EvaluationMissingData,
1405
1406            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1407        }
1408
1409        impl MonitoringQueryLanguageCondition {
1410            pub fn new() -> Self {
1411                std::default::Default::default()
1412            }
1413
1414            /// Sets the value of [query][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::query].
1415            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1416                self.query = v.into();
1417                self
1418            }
1419
1420            /// Sets the value of [duration][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::duration].
1421            pub fn set_duration<T>(mut self, v: T) -> Self
1422            where
1423                T: std::convert::Into<wkt::Duration>,
1424            {
1425                self.duration = std::option::Option::Some(v.into());
1426                self
1427            }
1428
1429            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::duration].
1430            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1431            where
1432                T: std::convert::Into<wkt::Duration>,
1433            {
1434                self.duration = v.map(|x| x.into());
1435                self
1436            }
1437
1438            /// Sets the value of [trigger][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::trigger].
1439            pub fn set_trigger<T>(mut self, v: T) -> Self
1440            where
1441                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1442            {
1443                self.trigger = std::option::Option::Some(v.into());
1444                self
1445            }
1446
1447            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::trigger].
1448            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1449            where
1450                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1451            {
1452                self.trigger = v.map(|x| x.into());
1453                self
1454            }
1455
1456            /// Sets the value of [evaluation_missing_data][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::evaluation_missing_data].
1457            pub fn set_evaluation_missing_data<
1458                T: std::convert::Into<crate::model::alert_policy::condition::EvaluationMissingData>,
1459            >(
1460                mut self,
1461                v: T,
1462            ) -> Self {
1463                self.evaluation_missing_data = v.into();
1464                self
1465            }
1466        }
1467
1468        impl wkt::message::Message for MonitoringQueryLanguageCondition {
1469            fn typename() -> &'static str {
1470                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition"
1471            }
1472        }
1473
1474        /// A condition type that allows alerting policies to be defined using
1475        /// [Prometheus Query Language
1476        /// (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
1477        ///
1478        /// The PrometheusQueryLanguageCondition message contains information
1479        /// from a Prometheus alerting rule and its associated rule group.
1480        ///
1481        /// A Prometheus alerting rule is described
1482        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
1483        /// The semantics of a Prometheus alerting rule is described
1484        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
1485        ///
1486        /// A Prometheus rule group is described
1487        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
1488        /// The semantics of a Prometheus rule group is described
1489        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
1490        ///
1491        /// Because Cloud Alerting has no representation of a Prometheus rule
1492        /// group resource, we must embed the information of the parent rule
1493        /// group inside each of the conditions that refer to it. We must also
1494        /// update the contents of all Prometheus alerts in case the information
1495        /// of their rule group changes.
1496        ///
1497        /// The PrometheusQueryLanguageCondition protocol buffer combines the
1498        /// information of the corresponding rule group and alerting rule.
1499        /// The structure of the PrometheusQueryLanguageCondition protocol buffer
1500        /// does NOT mimic the structure of the Prometheus rule group and alerting
1501        /// rule YAML declarations. The PrometheusQueryLanguageCondition protocol
1502        /// buffer may change in the future to support future rule group and/or
1503        /// alerting rule features. There are no new such features at the present
1504        /// time (2023-06-26).
1505        #[derive(Clone, Default, PartialEq)]
1506        #[non_exhaustive]
1507        pub struct PrometheusQueryLanguageCondition {
1508            /// Required. The PromQL expression to evaluate. Every evaluation cycle
1509            /// this expression is evaluated at the current time, and all resultant
1510            /// time series become pending/firing alerts. This field must not be empty.
1511            pub query: std::string::String,
1512
1513            /// Optional. Alerts are considered firing once their PromQL expression was
1514            /// evaluated to be "true" for this long.
1515            /// Alerts whose PromQL expression was not evaluated to be "true" for
1516            /// long enough are considered pending.
1517            /// Must be a non-negative duration or missing.
1518            /// This field is optional. Its default value is zero.
1519            pub duration: std::option::Option<wkt::Duration>,
1520
1521            /// Optional. How often this rule should be evaluated.
1522            /// Must be a positive multiple of 30 seconds or missing.
1523            /// This field is optional. Its default value is 30 seconds.
1524            /// If this PrometheusQueryLanguageCondition was generated from a
1525            /// Prometheus alerting rule, then this value should be taken from the
1526            /// enclosing rule group.
1527            pub evaluation_interval: std::option::Option<wkt::Duration>,
1528
1529            /// Optional. Labels to add to or overwrite in the PromQL query result.
1530            /// Label names [must be
1531            /// valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
1532            /// Label values can be [templatized by using
1533            /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
1534            /// The only available variable names are the names of the labels in the
1535            /// PromQL result, including "__name__" and "value". "labels" may be empty.
1536            pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1537
1538            /// Optional. The rule group name of this alert in the corresponding
1539            /// Prometheus configuration file.
1540            ///
1541            /// Some external tools may require this field to be populated correctly
1542            /// in order to refer to the original Prometheus configuration file.
1543            /// The rule group name and the alert name are necessary to update the
1544            /// relevant AlertPolicies in case the definition of the rule group changes
1545            /// in the future.
1546            ///
1547            /// This field is optional. If this field is not empty, then it must
1548            /// contain a valid UTF-8 string.
1549            /// This field may not exceed 2048 Unicode characters in length.
1550            pub rule_group: std::string::String,
1551
1552            /// Optional. The alerting rule name of this alert in the corresponding
1553            /// Prometheus configuration file.
1554            ///
1555            /// Some external tools may require this field to be populated correctly
1556            /// in order to refer to the original Prometheus configuration file.
1557            /// The rule group name and the alert name are necessary to update the
1558            /// relevant AlertPolicies in case the definition of the rule group changes
1559            /// in the future.
1560            ///
1561            /// This field is optional. If this field is not empty, then it must be a
1562            /// [valid Prometheus label
1563            /// name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
1564            /// This field may not exceed 2048 Unicode characters in length.
1565            pub alert_rule: std::string::String,
1566
1567            /// Optional. Whether to disable metric existence validation for this
1568            /// condition.
1569            ///
1570            /// This allows alerting policies to be defined on metrics that do not yet
1571            /// exist, improving advanced customer workflows such as configuring
1572            /// alerting policies using Terraform.
1573            ///
1574            /// Users with the `monitoring.alertPolicyViewer` role are able to see the
1575            /// name of the non-existent metric in the alerting policy condition.
1576            pub disable_metric_validation: bool,
1577
1578            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1579        }
1580
1581        impl PrometheusQueryLanguageCondition {
1582            pub fn new() -> Self {
1583                std::default::Default::default()
1584            }
1585
1586            /// Sets the value of [query][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::query].
1587            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1588                self.query = v.into();
1589                self
1590            }
1591
1592            /// Sets the value of [duration][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::duration].
1593            pub fn set_duration<T>(mut self, v: T) -> Self
1594            where
1595                T: std::convert::Into<wkt::Duration>,
1596            {
1597                self.duration = std::option::Option::Some(v.into());
1598                self
1599            }
1600
1601            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::duration].
1602            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1603            where
1604                T: std::convert::Into<wkt::Duration>,
1605            {
1606                self.duration = v.map(|x| x.into());
1607                self
1608            }
1609
1610            /// Sets the value of [evaluation_interval][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::evaluation_interval].
1611            pub fn set_evaluation_interval<T>(mut self, v: T) -> Self
1612            where
1613                T: std::convert::Into<wkt::Duration>,
1614            {
1615                self.evaluation_interval = std::option::Option::Some(v.into());
1616                self
1617            }
1618
1619            /// Sets or clears the value of [evaluation_interval][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::evaluation_interval].
1620            pub fn set_or_clear_evaluation_interval<T>(mut self, v: std::option::Option<T>) -> Self
1621            where
1622                T: std::convert::Into<wkt::Duration>,
1623            {
1624                self.evaluation_interval = v.map(|x| x.into());
1625                self
1626            }
1627
1628            /// Sets the value of [labels][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::labels].
1629            pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1630            where
1631                T: std::iter::IntoIterator<Item = (K, V)>,
1632                K: std::convert::Into<std::string::String>,
1633                V: std::convert::Into<std::string::String>,
1634            {
1635                use std::iter::Iterator;
1636                self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1637                self
1638            }
1639
1640            /// Sets the value of [rule_group][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::rule_group].
1641            pub fn set_rule_group<T: std::convert::Into<std::string::String>>(
1642                mut self,
1643                v: T,
1644            ) -> Self {
1645                self.rule_group = v.into();
1646                self
1647            }
1648
1649            /// Sets the value of [alert_rule][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::alert_rule].
1650            pub fn set_alert_rule<T: std::convert::Into<std::string::String>>(
1651                mut self,
1652                v: T,
1653            ) -> Self {
1654                self.alert_rule = v.into();
1655                self
1656            }
1657
1658            /// Sets the value of [disable_metric_validation][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::disable_metric_validation].
1659            pub fn set_disable_metric_validation<T: std::convert::Into<bool>>(
1660                mut self,
1661                v: T,
1662            ) -> Self {
1663                self.disable_metric_validation = v.into();
1664                self
1665            }
1666        }
1667
1668        impl wkt::message::Message for PrometheusQueryLanguageCondition {
1669            fn typename() -> &'static str {
1670                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition"
1671            }
1672        }
1673
1674        /// A condition that allows alerting policies to be defined using GoogleSQL.
1675        /// SQL conditions examine a sliding window of logs using GoogleSQL.
1676        /// Alert policies with SQL conditions may incur additional billing.
1677        #[derive(Clone, Default, PartialEq)]
1678        #[non_exhaustive]
1679        pub struct SqlCondition {
1680            /// Required. The Log Analytics SQL query to run, as a string.  The query
1681            /// must conform to the required shape. Specifically, the query must not
1682            /// try to filter the input by time.  A filter will automatically be
1683            /// applied to filter the input so that the query receives all rows
1684            /// received since the last time the query was run.
1685            ///
1686            /// For example, the following query extracts all log entries containing an
1687            /// HTTP request:
1688            ///
1689            /// ```norust
1690            /// SELECT
1691            ///   timestamp, log_name, severity, http_request, resource, labels
1692            /// FROM
1693            ///   my-project.global._Default._AllLogs
1694            /// WHERE
1695            ///   http_request IS NOT NULL
1696            /// ```
1697            pub query: std::string::String,
1698
1699            /// The schedule indicates how often the query should be run.
1700            pub schedule:
1701                std::option::Option<crate::model::alert_policy::condition::sql_condition::Schedule>,
1702
1703            /// The test to be run against the SQL result set.
1704            pub evaluate:
1705                std::option::Option<crate::model::alert_policy::condition::sql_condition::Evaluate>,
1706
1707            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1708        }
1709
1710        impl SqlCondition {
1711            pub fn new() -> Self {
1712                std::default::Default::default()
1713            }
1714
1715            /// Sets the value of [query][crate::model::alert_policy::condition::SqlCondition::query].
1716            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1717                self.query = v.into();
1718                self
1719            }
1720
1721            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule].
1722            ///
1723            /// Note that all the setters affecting `schedule` are mutually
1724            /// exclusive.
1725            pub fn set_schedule<
1726                T: std::convert::Into<
1727                        std::option::Option<
1728                            crate::model::alert_policy::condition::sql_condition::Schedule,
1729                        >,
1730                    >,
1731            >(
1732                mut self,
1733                v: T,
1734            ) -> Self {
1735                self.schedule = v.into();
1736                self
1737            }
1738
1739            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1740            /// if it holds a `Minutes`, `None` if the field is not set or
1741            /// holds a different branch.
1742            pub fn minutes(
1743                &self,
1744            ) -> std::option::Option<
1745                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Minutes>,
1746            > {
1747                #[allow(unreachable_patterns)]
1748                self.schedule.as_ref().and_then(|v| match v {
1749                    crate::model::alert_policy::condition::sql_condition::Schedule::Minutes(v) => {
1750                        std::option::Option::Some(v)
1751                    }
1752                    _ => std::option::Option::None,
1753                })
1754            }
1755
1756            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1757            /// to hold a `Minutes`.
1758            ///
1759            /// Note that all the setters affecting `schedule` are
1760            /// mutually exclusive.
1761            pub fn set_minutes<
1762                T: std::convert::Into<
1763                        std::boxed::Box<
1764                            crate::model::alert_policy::condition::sql_condition::Minutes,
1765                        >,
1766                    >,
1767            >(
1768                mut self,
1769                v: T,
1770            ) -> Self {
1771                self.schedule = std::option::Option::Some(
1772                    crate::model::alert_policy::condition::sql_condition::Schedule::Minutes(
1773                        v.into(),
1774                    ),
1775                );
1776                self
1777            }
1778
1779            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1780            /// if it holds a `Hourly`, `None` if the field is not set or
1781            /// holds a different branch.
1782            pub fn hourly(
1783                &self,
1784            ) -> std::option::Option<
1785                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Hourly>,
1786            > {
1787                #[allow(unreachable_patterns)]
1788                self.schedule.as_ref().and_then(|v| match v {
1789                    crate::model::alert_policy::condition::sql_condition::Schedule::Hourly(v) => {
1790                        std::option::Option::Some(v)
1791                    }
1792                    _ => std::option::Option::None,
1793                })
1794            }
1795
1796            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1797            /// to hold a `Hourly`.
1798            ///
1799            /// Note that all the setters affecting `schedule` are
1800            /// mutually exclusive.
1801            pub fn set_hourly<
1802                T: std::convert::Into<
1803                        std::boxed::Box<
1804                            crate::model::alert_policy::condition::sql_condition::Hourly,
1805                        >,
1806                    >,
1807            >(
1808                mut self,
1809                v: T,
1810            ) -> Self {
1811                self.schedule = std::option::Option::Some(
1812                    crate::model::alert_policy::condition::sql_condition::Schedule::Hourly(
1813                        v.into(),
1814                    ),
1815                );
1816                self
1817            }
1818
1819            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1820            /// if it holds a `Daily`, `None` if the field is not set or
1821            /// holds a different branch.
1822            pub fn daily(
1823                &self,
1824            ) -> std::option::Option<
1825                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Daily>,
1826            > {
1827                #[allow(unreachable_patterns)]
1828                self.schedule.as_ref().and_then(|v| match v {
1829                    crate::model::alert_policy::condition::sql_condition::Schedule::Daily(v) => {
1830                        std::option::Option::Some(v)
1831                    }
1832                    _ => std::option::Option::None,
1833                })
1834            }
1835
1836            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
1837            /// to hold a `Daily`.
1838            ///
1839            /// Note that all the setters affecting `schedule` are
1840            /// mutually exclusive.
1841            pub fn set_daily<
1842                T: std::convert::Into<
1843                        std::boxed::Box<
1844                            crate::model::alert_policy::condition::sql_condition::Daily,
1845                        >,
1846                    >,
1847            >(
1848                mut self,
1849                v: T,
1850            ) -> Self {
1851                self.schedule = std::option::Option::Some(
1852                    crate::model::alert_policy::condition::sql_condition::Schedule::Daily(v.into()),
1853                );
1854                self
1855            }
1856
1857            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate].
1858            ///
1859            /// Note that all the setters affecting `evaluate` are mutually
1860            /// exclusive.
1861            pub fn set_evaluate<
1862                T: std::convert::Into<
1863                        std::option::Option<
1864                            crate::model::alert_policy::condition::sql_condition::Evaluate,
1865                        >,
1866                    >,
1867            >(
1868                mut self,
1869                v: T,
1870            ) -> Self {
1871                self.evaluate = v.into();
1872                self
1873            }
1874
1875            /// The value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
1876            /// if it holds a `RowCountTest`, `None` if the field is not set or
1877            /// holds a different branch.
1878            pub fn row_count_test(
1879                &self,
1880            ) -> std::option::Option<
1881                &std::boxed::Box<
1882                    crate::model::alert_policy::condition::sql_condition::RowCountTest,
1883                >,
1884            > {
1885                #[allow(unreachable_patterns)]
1886                self.evaluate.as_ref().and_then(|v| match v {
1887                    crate::model::alert_policy::condition::sql_condition::Evaluate::RowCountTest(v) => std::option::Option::Some(v),
1888                    _ => std::option::Option::None,
1889                })
1890            }
1891
1892            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
1893            /// to hold a `RowCountTest`.
1894            ///
1895            /// Note that all the setters affecting `evaluate` are
1896            /// mutually exclusive.
1897            pub fn set_row_count_test<
1898                T: std::convert::Into<
1899                        std::boxed::Box<
1900                            crate::model::alert_policy::condition::sql_condition::RowCountTest,
1901                        >,
1902                    >,
1903            >(
1904                mut self,
1905                v: T,
1906            ) -> Self {
1907                self.evaluate = std::option::Option::Some(
1908                    crate::model::alert_policy::condition::sql_condition::Evaluate::RowCountTest(
1909                        v.into(),
1910                    ),
1911                );
1912                self
1913            }
1914
1915            /// The value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
1916            /// if it holds a `BooleanTest`, `None` if the field is not set or
1917            /// holds a different branch.
1918            pub fn boolean_test(
1919                &self,
1920            ) -> std::option::Option<
1921                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::BooleanTest>,
1922            > {
1923                #[allow(unreachable_patterns)]
1924                self.evaluate.as_ref().and_then(|v| match v {
1925                    crate::model::alert_policy::condition::sql_condition::Evaluate::BooleanTest(
1926                        v,
1927                    ) => std::option::Option::Some(v),
1928                    _ => std::option::Option::None,
1929                })
1930            }
1931
1932            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
1933            /// to hold a `BooleanTest`.
1934            ///
1935            /// Note that all the setters affecting `evaluate` are
1936            /// mutually exclusive.
1937            pub fn set_boolean_test<
1938                T: std::convert::Into<
1939                        std::boxed::Box<
1940                            crate::model::alert_policy::condition::sql_condition::BooleanTest,
1941                        >,
1942                    >,
1943            >(
1944                mut self,
1945                v: T,
1946            ) -> Self {
1947                self.evaluate = std::option::Option::Some(
1948                    crate::model::alert_policy::condition::sql_condition::Evaluate::BooleanTest(
1949                        v.into(),
1950                    ),
1951                );
1952                self
1953            }
1954        }
1955
1956        impl wkt::message::Message for SqlCondition {
1957            fn typename() -> &'static str {
1958                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition"
1959            }
1960        }
1961
1962        /// Defines additional types related to [SqlCondition].
1963        pub mod sql_condition {
1964            #[allow(unused_imports)]
1965            use super::*;
1966
1967            /// Used to schedule the query to run every so many minutes.
1968            #[derive(Clone, Default, PartialEq)]
1969            #[non_exhaustive]
1970            pub struct Minutes {
1971                /// Required. Number of minutes between runs. The interval must be
1972                /// greater than or equal to 5 minutes and less than or equal to 1440
1973                /// minutes.
1974                pub periodicity: i32,
1975
1976                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1977            }
1978
1979            impl Minutes {
1980                pub fn new() -> Self {
1981                    std::default::Default::default()
1982                }
1983
1984                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Minutes::periodicity].
1985                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1986                    self.periodicity = v.into();
1987                    self
1988                }
1989            }
1990
1991            impl wkt::message::Message for Minutes {
1992                fn typename() -> &'static str {
1993                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes"
1994                }
1995            }
1996
1997            /// Used to schedule the query to run every so many hours.
1998            #[derive(Clone, Default, PartialEq)]
1999            #[non_exhaustive]
2000            pub struct Hourly {
2001                /// Required. The number of hours between runs. Must be greater than or
2002                /// equal to 1 hour and less than or equal to 48 hours.
2003                pub periodicity: i32,
2004
2005                /// Optional. The number of minutes after the hour (in UTC) to run the
2006                /// query. Must be greater than or equal to 0 minutes and less than or
2007                /// equal to 59 minutes.  If left unspecified, then an arbitrary offset
2008                /// is used.
2009                pub minute_offset: std::option::Option<i32>,
2010
2011                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2012            }
2013
2014            impl Hourly {
2015                pub fn new() -> Self {
2016                    std::default::Default::default()
2017                }
2018
2019                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Hourly::periodicity].
2020                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2021                    self.periodicity = v.into();
2022                    self
2023                }
2024
2025                /// Sets the value of [minute_offset][crate::model::alert_policy::condition::sql_condition::Hourly::minute_offset].
2026                pub fn set_minute_offset<T>(mut self, v: T) -> Self
2027                where
2028                    T: std::convert::Into<i32>,
2029                {
2030                    self.minute_offset = std::option::Option::Some(v.into());
2031                    self
2032                }
2033
2034                /// Sets or clears the value of [minute_offset][crate::model::alert_policy::condition::sql_condition::Hourly::minute_offset].
2035                pub fn set_or_clear_minute_offset<T>(mut self, v: std::option::Option<T>) -> Self
2036                where
2037                    T: std::convert::Into<i32>,
2038                {
2039                    self.minute_offset = v.map(|x| x.into());
2040                    self
2041                }
2042            }
2043
2044            impl wkt::message::Message for Hourly {
2045                fn typename() -> &'static str {
2046                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly"
2047                }
2048            }
2049
2050            /// Used to schedule the query to run every so many days.
2051            #[derive(Clone, Default, PartialEq)]
2052            #[non_exhaustive]
2053            pub struct Daily {
2054                /// Required. The number of days between runs. Must be greater than or
2055                /// equal to 1 day and less than or equal to 31 days.
2056                pub periodicity: i32,
2057
2058                /// Optional. The time of day (in UTC) at which the query should run. If
2059                /// left unspecified, the server picks an arbitrary time of day and runs
2060                /// the query at the same time each day.
2061                pub execution_time: std::option::Option<gtype::model::TimeOfDay>,
2062
2063                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2064            }
2065
2066            impl Daily {
2067                pub fn new() -> Self {
2068                    std::default::Default::default()
2069                }
2070
2071                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Daily::periodicity].
2072                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2073                    self.periodicity = v.into();
2074                    self
2075                }
2076
2077                /// Sets the value of [execution_time][crate::model::alert_policy::condition::sql_condition::Daily::execution_time].
2078                pub fn set_execution_time<T>(mut self, v: T) -> Self
2079                where
2080                    T: std::convert::Into<gtype::model::TimeOfDay>,
2081                {
2082                    self.execution_time = std::option::Option::Some(v.into());
2083                    self
2084                }
2085
2086                /// Sets or clears the value of [execution_time][crate::model::alert_policy::condition::sql_condition::Daily::execution_time].
2087                pub fn set_or_clear_execution_time<T>(mut self, v: std::option::Option<T>) -> Self
2088                where
2089                    T: std::convert::Into<gtype::model::TimeOfDay>,
2090                {
2091                    self.execution_time = v.map(|x| x.into());
2092                    self
2093                }
2094            }
2095
2096            impl wkt::message::Message for Daily {
2097                fn typename() -> &'static str {
2098                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily"
2099                }
2100            }
2101
2102            /// A test that checks if the number of rows in the result set
2103            /// violates some threshold.
2104            #[derive(Clone, Default, PartialEq)]
2105            #[non_exhaustive]
2106            pub struct RowCountTest {
2107                /// Required. The comparison to apply between the number of rows returned
2108                /// by the query and the threshold.
2109                pub comparison: crate::model::ComparisonType,
2110
2111                /// Required. The value against which to compare the row count.
2112                pub threshold: i64,
2113
2114                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2115            }
2116
2117            impl RowCountTest {
2118                pub fn new() -> Self {
2119                    std::default::Default::default()
2120                }
2121
2122                /// Sets the value of [comparison][crate::model::alert_policy::condition::sql_condition::RowCountTest::comparison].
2123                pub fn set_comparison<T: std::convert::Into<crate::model::ComparisonType>>(
2124                    mut self,
2125                    v: T,
2126                ) -> Self {
2127                    self.comparison = v.into();
2128                    self
2129                }
2130
2131                /// Sets the value of [threshold][crate::model::alert_policy::condition::sql_condition::RowCountTest::threshold].
2132                pub fn set_threshold<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2133                    self.threshold = v.into();
2134                    self
2135                }
2136            }
2137
2138            impl wkt::message::Message for RowCountTest {
2139                fn typename() -> &'static str {
2140                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest"
2141                }
2142            }
2143
2144            /// A test that uses an alerting result in a boolean column produced by
2145            /// the SQL query.
2146            #[derive(Clone, Default, PartialEq)]
2147            #[non_exhaustive]
2148            pub struct BooleanTest {
2149                /// Required. The name of the column containing the boolean value. If the
2150                /// value in a row is NULL, that row is ignored.
2151                pub column: std::string::String,
2152
2153                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2154            }
2155
2156            impl BooleanTest {
2157                pub fn new() -> Self {
2158                    std::default::Default::default()
2159                }
2160
2161                /// Sets the value of [column][crate::model::alert_policy::condition::sql_condition::BooleanTest::column].
2162                pub fn set_column<T: std::convert::Into<std::string::String>>(
2163                    mut self,
2164                    v: T,
2165                ) -> Self {
2166                    self.column = v.into();
2167                    self
2168                }
2169            }
2170
2171            impl wkt::message::Message for BooleanTest {
2172                fn typename() -> &'static str {
2173                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest"
2174                }
2175            }
2176
2177            /// The schedule indicates how often the query should be run.
2178            #[derive(Clone, Debug, PartialEq)]
2179            #[non_exhaustive]
2180            pub enum Schedule {
2181                /// Schedule the query to execute every so many minutes.
2182                Minutes(
2183                    std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Minutes>,
2184                ),
2185                /// Schedule the query to execute every so many hours.
2186                Hourly(
2187                    std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Hourly>,
2188                ),
2189                /// Schedule the query to execute every so many days.
2190                Daily(std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Daily>),
2191            }
2192
2193            /// The test to be run against the SQL result set.
2194            #[derive(Clone, Debug, PartialEq)]
2195            #[non_exhaustive]
2196            pub enum Evaluate {
2197                /// Test the row count against a threshold.
2198                RowCountTest(
2199                    std::boxed::Box<
2200                        crate::model::alert_policy::condition::sql_condition::RowCountTest,
2201                    >,
2202                ),
2203                /// Test the boolean value in the indicated column.
2204                BooleanTest(
2205                    std::boxed::Box<
2206                        crate::model::alert_policy::condition::sql_condition::BooleanTest,
2207                    >,
2208                ),
2209            }
2210        }
2211
2212        /// A condition control that determines how metric-threshold conditions
2213        /// are evaluated when data stops arriving.
2214        /// This control doesn't affect metric-absence policies.
2215        ///
2216        /// # Working with unknown values
2217        ///
2218        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2219        /// additional enum variants at any time. Adding new variants is not considered
2220        /// a breaking change. Applications should write their code in anticipation of:
2221        ///
2222        /// - New values appearing in future releases of the client library, **and**
2223        /// - New values received dynamically, without application changes.
2224        ///
2225        /// Please consult the [Working with enums] section in the user guide for some
2226        /// guidelines.
2227        ///
2228        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2229        #[derive(Clone, Debug, PartialEq)]
2230        #[non_exhaustive]
2231        pub enum EvaluationMissingData {
2232            /// An unspecified evaluation missing data option.  Equivalent to
2233            /// EVALUATION_MISSING_DATA_NO_OP.
2234            Unspecified,
2235            /// If there is no data to evaluate the condition, then evaluate the
2236            /// condition as false.
2237            Inactive,
2238            /// If there is no data to evaluate the condition, then evaluate the
2239            /// condition as true.
2240            Active,
2241            /// Do not evaluate the condition to any value if there is no data.
2242            NoOp,
2243            /// If set, the enum was initialized with an unknown value.
2244            ///
2245            /// Applications can examine the value using [EvaluationMissingData::value] or
2246            /// [EvaluationMissingData::name].
2247            UnknownValue(evaluation_missing_data::UnknownValue),
2248        }
2249
2250        #[doc(hidden)]
2251        pub mod evaluation_missing_data {
2252            #[allow(unused_imports)]
2253            use super::*;
2254            #[derive(Clone, Debug, PartialEq)]
2255            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2256        }
2257
2258        impl EvaluationMissingData {
2259            /// Gets the enum value.
2260            ///
2261            /// Returns `None` if the enum contains an unknown value deserialized from
2262            /// the string representation of enums.
2263            pub fn value(&self) -> std::option::Option<i32> {
2264                match self {
2265                    Self::Unspecified => std::option::Option::Some(0),
2266                    Self::Inactive => std::option::Option::Some(1),
2267                    Self::Active => std::option::Option::Some(2),
2268                    Self::NoOp => std::option::Option::Some(3),
2269                    Self::UnknownValue(u) => u.0.value(),
2270                }
2271            }
2272
2273            /// Gets the enum value as a string.
2274            ///
2275            /// Returns `None` if the enum contains an unknown value deserialized from
2276            /// the integer representation of enums.
2277            pub fn name(&self) -> std::option::Option<&str> {
2278                match self {
2279                    Self::Unspecified => {
2280                        std::option::Option::Some("EVALUATION_MISSING_DATA_UNSPECIFIED")
2281                    }
2282                    Self::Inactive => std::option::Option::Some("EVALUATION_MISSING_DATA_INACTIVE"),
2283                    Self::Active => std::option::Option::Some("EVALUATION_MISSING_DATA_ACTIVE"),
2284                    Self::NoOp => std::option::Option::Some("EVALUATION_MISSING_DATA_NO_OP"),
2285                    Self::UnknownValue(u) => u.0.name(),
2286                }
2287            }
2288        }
2289
2290        impl std::default::Default for EvaluationMissingData {
2291            fn default() -> Self {
2292                use std::convert::From;
2293                Self::from(0)
2294            }
2295        }
2296
2297        impl std::fmt::Display for EvaluationMissingData {
2298            fn fmt(
2299                &self,
2300                f: &mut std::fmt::Formatter<'_>,
2301            ) -> std::result::Result<(), std::fmt::Error> {
2302                wkt::internal::display_enum(f, self.name(), self.value())
2303            }
2304        }
2305
2306        impl std::convert::From<i32> for EvaluationMissingData {
2307            fn from(value: i32) -> Self {
2308                match value {
2309                    0 => Self::Unspecified,
2310                    1 => Self::Inactive,
2311                    2 => Self::Active,
2312                    3 => Self::NoOp,
2313                    _ => Self::UnknownValue(evaluation_missing_data::UnknownValue(
2314                        wkt::internal::UnknownEnumValue::Integer(value),
2315                    )),
2316                }
2317            }
2318        }
2319
2320        impl std::convert::From<&str> for EvaluationMissingData {
2321            fn from(value: &str) -> Self {
2322                use std::string::ToString;
2323                match value {
2324                    "EVALUATION_MISSING_DATA_UNSPECIFIED" => Self::Unspecified,
2325                    "EVALUATION_MISSING_DATA_INACTIVE" => Self::Inactive,
2326                    "EVALUATION_MISSING_DATA_ACTIVE" => Self::Active,
2327                    "EVALUATION_MISSING_DATA_NO_OP" => Self::NoOp,
2328                    _ => Self::UnknownValue(evaluation_missing_data::UnknownValue(
2329                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2330                    )),
2331                }
2332            }
2333        }
2334
2335        impl serde::ser::Serialize for EvaluationMissingData {
2336            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2337            where
2338                S: serde::Serializer,
2339            {
2340                match self {
2341                    Self::Unspecified => serializer.serialize_i32(0),
2342                    Self::Inactive => serializer.serialize_i32(1),
2343                    Self::Active => serializer.serialize_i32(2),
2344                    Self::NoOp => serializer.serialize_i32(3),
2345                    Self::UnknownValue(u) => u.0.serialize(serializer),
2346                }
2347            }
2348        }
2349
2350        impl<'de> serde::de::Deserialize<'de> for EvaluationMissingData {
2351            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2352            where
2353                D: serde::Deserializer<'de>,
2354            {
2355                deserializer.deserialize_any(
2356                    wkt::internal::EnumVisitor::<EvaluationMissingData>::new(
2357                        ".google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData",
2358                    ),
2359                )
2360            }
2361        }
2362
2363        /// Only one of the following condition types will be specified.
2364        #[derive(Clone, Debug, PartialEq)]
2365        #[non_exhaustive]
2366        pub enum Condition {
2367            /// A condition that compares a time series against a threshold.
2368            ConditionThreshold(
2369                std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
2370            ),
2371            /// A condition that checks that a time series continues to
2372            /// receive new data points.
2373            ConditionAbsent(std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>),
2374            /// A condition that checks for log messages matching given constraints. If
2375            /// set, no other conditions can be present.
2376            ConditionMatchedLog(std::boxed::Box<crate::model::alert_policy::condition::LogMatch>),
2377            /// A condition that uses the Monitoring Query Language to define
2378            /// alerts.
2379            ConditionMonitoringQueryLanguage(
2380                std::boxed::Box<
2381                    crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
2382                >,
2383            ),
2384            /// A condition that uses the Prometheus query language to define alerts.
2385            ConditionPrometheusQueryLanguage(
2386                std::boxed::Box<
2387                    crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
2388                >,
2389            ),
2390            /// A condition that periodically evaluates a SQL query result.
2391            ConditionSql(std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>),
2392        }
2393    }
2394
2395    /// Control over how the notification channels in `notification_channels`
2396    /// are notified when this alert fires.
2397    #[derive(Clone, Default, PartialEq)]
2398    #[non_exhaustive]
2399    pub struct AlertStrategy {
2400        /// Required for log-based alerting policies, i.e. policies with a `LogMatch`
2401        /// condition.
2402        ///
2403        /// This limit is not implemented for alerting policies that do not have
2404        /// a LogMatch condition.
2405        pub notification_rate_limit:
2406            std::option::Option<crate::model::alert_policy::alert_strategy::NotificationRateLimit>,
2407
2408        /// For log-based alert policies, the notification prompts is always
2409        /// [OPENED]. For non log-based alert policies, the notification prompts can
2410        /// be [OPENED] or [OPENED, CLOSED].
2411        pub notification_prompts:
2412            std::vec::Vec<crate::model::alert_policy::alert_strategy::NotificationPrompt>,
2413
2414        /// If an alerting policy that was active has no data for this long, any open
2415        /// incidents will close
2416        pub auto_close: std::option::Option<wkt::Duration>,
2417
2418        /// Control how notifications will be sent out, on a per-channel basis.
2419        pub notification_channel_strategy:
2420            std::vec::Vec<crate::model::alert_policy::alert_strategy::NotificationChannelStrategy>,
2421
2422        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2423    }
2424
2425    impl AlertStrategy {
2426        pub fn new() -> Self {
2427            std::default::Default::default()
2428        }
2429
2430        /// Sets the value of [notification_rate_limit][crate::model::alert_policy::AlertStrategy::notification_rate_limit].
2431        pub fn set_notification_rate_limit<T>(mut self, v: T) -> Self
2432        where
2433            T: std::convert::Into<
2434                    crate::model::alert_policy::alert_strategy::NotificationRateLimit,
2435                >,
2436        {
2437            self.notification_rate_limit = std::option::Option::Some(v.into());
2438            self
2439        }
2440
2441        /// Sets or clears the value of [notification_rate_limit][crate::model::alert_policy::AlertStrategy::notification_rate_limit].
2442        pub fn set_or_clear_notification_rate_limit<T>(mut self, v: std::option::Option<T>) -> Self
2443        where
2444            T: std::convert::Into<
2445                    crate::model::alert_policy::alert_strategy::NotificationRateLimit,
2446                >,
2447        {
2448            self.notification_rate_limit = v.map(|x| x.into());
2449            self
2450        }
2451
2452        /// Sets the value of [notification_prompts][crate::model::alert_policy::AlertStrategy::notification_prompts].
2453        pub fn set_notification_prompts<T, V>(mut self, v: T) -> Self
2454        where
2455            T: std::iter::IntoIterator<Item = V>,
2456            V: std::convert::Into<crate::model::alert_policy::alert_strategy::NotificationPrompt>,
2457        {
2458            use std::iter::Iterator;
2459            self.notification_prompts = v.into_iter().map(|i| i.into()).collect();
2460            self
2461        }
2462
2463        /// Sets the value of [auto_close][crate::model::alert_policy::AlertStrategy::auto_close].
2464        pub fn set_auto_close<T>(mut self, v: T) -> Self
2465        where
2466            T: std::convert::Into<wkt::Duration>,
2467        {
2468            self.auto_close = std::option::Option::Some(v.into());
2469            self
2470        }
2471
2472        /// Sets or clears the value of [auto_close][crate::model::alert_policy::AlertStrategy::auto_close].
2473        pub fn set_or_clear_auto_close<T>(mut self, v: std::option::Option<T>) -> Self
2474        where
2475            T: std::convert::Into<wkt::Duration>,
2476        {
2477            self.auto_close = v.map(|x| x.into());
2478            self
2479        }
2480
2481        /// Sets the value of [notification_channel_strategy][crate::model::alert_policy::AlertStrategy::notification_channel_strategy].
2482        pub fn set_notification_channel_strategy<T, V>(mut self, v: T) -> Self
2483        where
2484            T: std::iter::IntoIterator<Item = V>,
2485            V: std::convert::Into<
2486                    crate::model::alert_policy::alert_strategy::NotificationChannelStrategy,
2487                >,
2488        {
2489            use std::iter::Iterator;
2490            self.notification_channel_strategy = v.into_iter().map(|i| i.into()).collect();
2491            self
2492        }
2493    }
2494
2495    impl wkt::message::Message for AlertStrategy {
2496        fn typename() -> &'static str {
2497            "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy"
2498        }
2499    }
2500
2501    /// Defines additional types related to [AlertStrategy].
2502    pub mod alert_strategy {
2503        #[allow(unused_imports)]
2504        use super::*;
2505
2506        /// Control over the rate of notifications sent to this alerting policy's
2507        /// notification channels.
2508        #[derive(Clone, Default, PartialEq)]
2509        #[non_exhaustive]
2510        pub struct NotificationRateLimit {
2511            /// Not more than one notification per `period`.
2512            pub period: std::option::Option<wkt::Duration>,
2513
2514            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2515        }
2516
2517        impl NotificationRateLimit {
2518            pub fn new() -> Self {
2519                std::default::Default::default()
2520            }
2521
2522            /// Sets the value of [period][crate::model::alert_policy::alert_strategy::NotificationRateLimit::period].
2523            pub fn set_period<T>(mut self, v: T) -> Self
2524            where
2525                T: std::convert::Into<wkt::Duration>,
2526            {
2527                self.period = std::option::Option::Some(v.into());
2528                self
2529            }
2530
2531            /// Sets or clears the value of [period][crate::model::alert_policy::alert_strategy::NotificationRateLimit::period].
2532            pub fn set_or_clear_period<T>(mut self, v: std::option::Option<T>) -> Self
2533            where
2534                T: std::convert::Into<wkt::Duration>,
2535            {
2536                self.period = v.map(|x| x.into());
2537                self
2538            }
2539        }
2540
2541        impl wkt::message::Message for NotificationRateLimit {
2542            fn typename() -> &'static str {
2543                "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit"
2544            }
2545        }
2546
2547        /// Control over how the notification channels in `notification_channels`
2548        /// are notified when this alert fires, on a per-channel basis.
2549        #[derive(Clone, Default, PartialEq)]
2550        #[non_exhaustive]
2551        pub struct NotificationChannelStrategy {
2552            /// The full REST resource name for the notification channels that these
2553            /// settings apply to. Each of these correspond to the name field in one
2554            /// of the NotificationChannel objects referenced in the
2555            /// notification_channels field of this AlertPolicy.
2556            /// The format is:
2557            ///
2558            /// ```norust
2559            /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
2560            /// ```
2561            pub notification_channel_names: std::vec::Vec<std::string::String>,
2562
2563            /// The frequency at which to send reminder notifications for open
2564            /// incidents.
2565            pub renotify_interval: std::option::Option<wkt::Duration>,
2566
2567            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2568        }
2569
2570        impl NotificationChannelStrategy {
2571            pub fn new() -> Self {
2572                std::default::Default::default()
2573            }
2574
2575            /// Sets the value of [notification_channel_names][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::notification_channel_names].
2576            pub fn set_notification_channel_names<T, V>(mut self, v: T) -> Self
2577            where
2578                T: std::iter::IntoIterator<Item = V>,
2579                V: std::convert::Into<std::string::String>,
2580            {
2581                use std::iter::Iterator;
2582                self.notification_channel_names = v.into_iter().map(|i| i.into()).collect();
2583                self
2584            }
2585
2586            /// Sets the value of [renotify_interval][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::renotify_interval].
2587            pub fn set_renotify_interval<T>(mut self, v: T) -> Self
2588            where
2589                T: std::convert::Into<wkt::Duration>,
2590            {
2591                self.renotify_interval = std::option::Option::Some(v.into());
2592                self
2593            }
2594
2595            /// Sets or clears the value of [renotify_interval][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::renotify_interval].
2596            pub fn set_or_clear_renotify_interval<T>(mut self, v: std::option::Option<T>) -> Self
2597            where
2598                T: std::convert::Into<wkt::Duration>,
2599            {
2600                self.renotify_interval = v.map(|x| x.into());
2601                self
2602            }
2603        }
2604
2605        impl wkt::message::Message for NotificationChannelStrategy {
2606            fn typename() -> &'static str {
2607                "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy"
2608            }
2609        }
2610
2611        /// Control when notifications will be sent out.
2612        ///
2613        /// # Working with unknown values
2614        ///
2615        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2616        /// additional enum variants at any time. Adding new variants is not considered
2617        /// a breaking change. Applications should write their code in anticipation of:
2618        ///
2619        /// - New values appearing in future releases of the client library, **and**
2620        /// - New values received dynamically, without application changes.
2621        ///
2622        /// Please consult the [Working with enums] section in the user guide for some
2623        /// guidelines.
2624        ///
2625        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2626        #[derive(Clone, Debug, PartialEq)]
2627        #[non_exhaustive]
2628        pub enum NotificationPrompt {
2629            /// No strategy specified. Treated as error.
2630            Unspecified,
2631            /// Notify when an incident is opened.
2632            Opened,
2633            /// Notify when an incident is closed.
2634            Closed,
2635            /// If set, the enum was initialized with an unknown value.
2636            ///
2637            /// Applications can examine the value using [NotificationPrompt::value] or
2638            /// [NotificationPrompt::name].
2639            UnknownValue(notification_prompt::UnknownValue),
2640        }
2641
2642        #[doc(hidden)]
2643        pub mod notification_prompt {
2644            #[allow(unused_imports)]
2645            use super::*;
2646            #[derive(Clone, Debug, PartialEq)]
2647            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2648        }
2649
2650        impl NotificationPrompt {
2651            /// Gets the enum value.
2652            ///
2653            /// Returns `None` if the enum contains an unknown value deserialized from
2654            /// the string representation of enums.
2655            pub fn value(&self) -> std::option::Option<i32> {
2656                match self {
2657                    Self::Unspecified => std::option::Option::Some(0),
2658                    Self::Opened => std::option::Option::Some(1),
2659                    Self::Closed => std::option::Option::Some(3),
2660                    Self::UnknownValue(u) => u.0.value(),
2661                }
2662            }
2663
2664            /// Gets the enum value as a string.
2665            ///
2666            /// Returns `None` if the enum contains an unknown value deserialized from
2667            /// the integer representation of enums.
2668            pub fn name(&self) -> std::option::Option<&str> {
2669                match self {
2670                    Self::Unspecified => {
2671                        std::option::Option::Some("NOTIFICATION_PROMPT_UNSPECIFIED")
2672                    }
2673                    Self::Opened => std::option::Option::Some("OPENED"),
2674                    Self::Closed => std::option::Option::Some("CLOSED"),
2675                    Self::UnknownValue(u) => u.0.name(),
2676                }
2677            }
2678        }
2679
2680        impl std::default::Default for NotificationPrompt {
2681            fn default() -> Self {
2682                use std::convert::From;
2683                Self::from(0)
2684            }
2685        }
2686
2687        impl std::fmt::Display for NotificationPrompt {
2688            fn fmt(
2689                &self,
2690                f: &mut std::fmt::Formatter<'_>,
2691            ) -> std::result::Result<(), std::fmt::Error> {
2692                wkt::internal::display_enum(f, self.name(), self.value())
2693            }
2694        }
2695
2696        impl std::convert::From<i32> for NotificationPrompt {
2697            fn from(value: i32) -> Self {
2698                match value {
2699                    0 => Self::Unspecified,
2700                    1 => Self::Opened,
2701                    3 => Self::Closed,
2702                    _ => Self::UnknownValue(notification_prompt::UnknownValue(
2703                        wkt::internal::UnknownEnumValue::Integer(value),
2704                    )),
2705                }
2706            }
2707        }
2708
2709        impl std::convert::From<&str> for NotificationPrompt {
2710            fn from(value: &str) -> Self {
2711                use std::string::ToString;
2712                match value {
2713                    "NOTIFICATION_PROMPT_UNSPECIFIED" => Self::Unspecified,
2714                    "OPENED" => Self::Opened,
2715                    "CLOSED" => Self::Closed,
2716                    _ => Self::UnknownValue(notification_prompt::UnknownValue(
2717                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2718                    )),
2719                }
2720            }
2721        }
2722
2723        impl serde::ser::Serialize for NotificationPrompt {
2724            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2725            where
2726                S: serde::Serializer,
2727            {
2728                match self {
2729                    Self::Unspecified => serializer.serialize_i32(0),
2730                    Self::Opened => serializer.serialize_i32(1),
2731                    Self::Closed => serializer.serialize_i32(3),
2732                    Self::UnknownValue(u) => u.0.serialize(serializer),
2733                }
2734            }
2735        }
2736
2737        impl<'de> serde::de::Deserialize<'de> for NotificationPrompt {
2738            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2739            where
2740                D: serde::Deserializer<'de>,
2741            {
2742                deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationPrompt>::new(
2743                    ".google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt",
2744                ))
2745            }
2746        }
2747    }
2748
2749    /// Operators for combining conditions.
2750    ///
2751    /// # Working with unknown values
2752    ///
2753    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2754    /// additional enum variants at any time. Adding new variants is not considered
2755    /// a breaking change. Applications should write their code in anticipation of:
2756    ///
2757    /// - New values appearing in future releases of the client library, **and**
2758    /// - New values received dynamically, without application changes.
2759    ///
2760    /// Please consult the [Working with enums] section in the user guide for some
2761    /// guidelines.
2762    ///
2763    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2764    #[derive(Clone, Debug, PartialEq)]
2765    #[non_exhaustive]
2766    pub enum ConditionCombinerType {
2767        /// An unspecified combiner.
2768        CombineUnspecified,
2769        /// Combine conditions using the logical `AND` operator. An
2770        /// incident is created only if all the conditions are met
2771        /// simultaneously. This combiner is satisfied if all conditions are
2772        /// met, even if they are met on completely different resources.
2773        And,
2774        /// Combine conditions using the logical `OR` operator. An incident
2775        /// is created if any of the listed conditions is met.
2776        Or,
2777        /// Combine conditions using logical `AND` operator, but unlike the regular
2778        /// `AND` option, an incident is created only if all conditions are met
2779        /// simultaneously on at least one resource.
2780        AndWithMatchingResource,
2781        /// If set, the enum was initialized with an unknown value.
2782        ///
2783        /// Applications can examine the value using [ConditionCombinerType::value] or
2784        /// [ConditionCombinerType::name].
2785        UnknownValue(condition_combiner_type::UnknownValue),
2786    }
2787
2788    #[doc(hidden)]
2789    pub mod condition_combiner_type {
2790        #[allow(unused_imports)]
2791        use super::*;
2792        #[derive(Clone, Debug, PartialEq)]
2793        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2794    }
2795
2796    impl ConditionCombinerType {
2797        /// Gets the enum value.
2798        ///
2799        /// Returns `None` if the enum contains an unknown value deserialized from
2800        /// the string representation of enums.
2801        pub fn value(&self) -> std::option::Option<i32> {
2802            match self {
2803                Self::CombineUnspecified => std::option::Option::Some(0),
2804                Self::And => std::option::Option::Some(1),
2805                Self::Or => std::option::Option::Some(2),
2806                Self::AndWithMatchingResource => std::option::Option::Some(3),
2807                Self::UnknownValue(u) => u.0.value(),
2808            }
2809        }
2810
2811        /// Gets the enum value as a string.
2812        ///
2813        /// Returns `None` if the enum contains an unknown value deserialized from
2814        /// the integer representation of enums.
2815        pub fn name(&self) -> std::option::Option<&str> {
2816            match self {
2817                Self::CombineUnspecified => std::option::Option::Some("COMBINE_UNSPECIFIED"),
2818                Self::And => std::option::Option::Some("AND"),
2819                Self::Or => std::option::Option::Some("OR"),
2820                Self::AndWithMatchingResource => {
2821                    std::option::Option::Some("AND_WITH_MATCHING_RESOURCE")
2822                }
2823                Self::UnknownValue(u) => u.0.name(),
2824            }
2825        }
2826    }
2827
2828    impl std::default::Default for ConditionCombinerType {
2829        fn default() -> Self {
2830            use std::convert::From;
2831            Self::from(0)
2832        }
2833    }
2834
2835    impl std::fmt::Display for ConditionCombinerType {
2836        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2837            wkt::internal::display_enum(f, self.name(), self.value())
2838        }
2839    }
2840
2841    impl std::convert::From<i32> for ConditionCombinerType {
2842        fn from(value: i32) -> Self {
2843            match value {
2844                0 => Self::CombineUnspecified,
2845                1 => Self::And,
2846                2 => Self::Or,
2847                3 => Self::AndWithMatchingResource,
2848                _ => Self::UnknownValue(condition_combiner_type::UnknownValue(
2849                    wkt::internal::UnknownEnumValue::Integer(value),
2850                )),
2851            }
2852        }
2853    }
2854
2855    impl std::convert::From<&str> for ConditionCombinerType {
2856        fn from(value: &str) -> Self {
2857            use std::string::ToString;
2858            match value {
2859                "COMBINE_UNSPECIFIED" => Self::CombineUnspecified,
2860                "AND" => Self::And,
2861                "OR" => Self::Or,
2862                "AND_WITH_MATCHING_RESOURCE" => Self::AndWithMatchingResource,
2863                _ => Self::UnknownValue(condition_combiner_type::UnknownValue(
2864                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2865                )),
2866            }
2867        }
2868    }
2869
2870    impl serde::ser::Serialize for ConditionCombinerType {
2871        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2872        where
2873            S: serde::Serializer,
2874        {
2875            match self {
2876                Self::CombineUnspecified => serializer.serialize_i32(0),
2877                Self::And => serializer.serialize_i32(1),
2878                Self::Or => serializer.serialize_i32(2),
2879                Self::AndWithMatchingResource => serializer.serialize_i32(3),
2880                Self::UnknownValue(u) => u.0.serialize(serializer),
2881            }
2882        }
2883    }
2884
2885    impl<'de> serde::de::Deserialize<'de> for ConditionCombinerType {
2886        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2887        where
2888            D: serde::Deserializer<'de>,
2889        {
2890            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConditionCombinerType>::new(
2891                ".google.monitoring.v3.AlertPolicy.ConditionCombinerType",
2892            ))
2893        }
2894    }
2895
2896    /// An enumeration of possible severity level for an alerting policy.
2897    ///
2898    /// # Working with unknown values
2899    ///
2900    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2901    /// additional enum variants at any time. Adding new variants is not considered
2902    /// a breaking change. Applications should write their code in anticipation of:
2903    ///
2904    /// - New values appearing in future releases of the client library, **and**
2905    /// - New values received dynamically, without application changes.
2906    ///
2907    /// Please consult the [Working with enums] section in the user guide for some
2908    /// guidelines.
2909    ///
2910    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2911    #[derive(Clone, Debug, PartialEq)]
2912    #[non_exhaustive]
2913    pub enum Severity {
2914        /// No severity is specified. This is the default value.
2915        Unspecified,
2916        /// This is the highest severity level. Use this if the problem could
2917        /// cause significant damage or downtime.
2918        Critical,
2919        /// This is the medium severity level. Use this if the problem could
2920        /// cause minor damage or downtime.
2921        Error,
2922        /// This is the lowest severity level. Use this if the problem is not causing
2923        /// any damage or downtime, but could potentially lead to a problem in the
2924        /// future.
2925        Warning,
2926        /// If set, the enum was initialized with an unknown value.
2927        ///
2928        /// Applications can examine the value using [Severity::value] or
2929        /// [Severity::name].
2930        UnknownValue(severity::UnknownValue),
2931    }
2932
2933    #[doc(hidden)]
2934    pub mod severity {
2935        #[allow(unused_imports)]
2936        use super::*;
2937        #[derive(Clone, Debug, PartialEq)]
2938        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2939    }
2940
2941    impl Severity {
2942        /// Gets the enum value.
2943        ///
2944        /// Returns `None` if the enum contains an unknown value deserialized from
2945        /// the string representation of enums.
2946        pub fn value(&self) -> std::option::Option<i32> {
2947            match self {
2948                Self::Unspecified => std::option::Option::Some(0),
2949                Self::Critical => std::option::Option::Some(1),
2950                Self::Error => std::option::Option::Some(2),
2951                Self::Warning => std::option::Option::Some(3),
2952                Self::UnknownValue(u) => u.0.value(),
2953            }
2954        }
2955
2956        /// Gets the enum value as a string.
2957        ///
2958        /// Returns `None` if the enum contains an unknown value deserialized from
2959        /// the integer representation of enums.
2960        pub fn name(&self) -> std::option::Option<&str> {
2961            match self {
2962                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
2963                Self::Critical => std::option::Option::Some("CRITICAL"),
2964                Self::Error => std::option::Option::Some("ERROR"),
2965                Self::Warning => std::option::Option::Some("WARNING"),
2966                Self::UnknownValue(u) => u.0.name(),
2967            }
2968        }
2969    }
2970
2971    impl std::default::Default for Severity {
2972        fn default() -> Self {
2973            use std::convert::From;
2974            Self::from(0)
2975        }
2976    }
2977
2978    impl std::fmt::Display for Severity {
2979        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2980            wkt::internal::display_enum(f, self.name(), self.value())
2981        }
2982    }
2983
2984    impl std::convert::From<i32> for Severity {
2985        fn from(value: i32) -> Self {
2986            match value {
2987                0 => Self::Unspecified,
2988                1 => Self::Critical,
2989                2 => Self::Error,
2990                3 => Self::Warning,
2991                _ => Self::UnknownValue(severity::UnknownValue(
2992                    wkt::internal::UnknownEnumValue::Integer(value),
2993                )),
2994            }
2995        }
2996    }
2997
2998    impl std::convert::From<&str> for Severity {
2999        fn from(value: &str) -> Self {
3000            use std::string::ToString;
3001            match value {
3002                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
3003                "CRITICAL" => Self::Critical,
3004                "ERROR" => Self::Error,
3005                "WARNING" => Self::Warning,
3006                _ => Self::UnknownValue(severity::UnknownValue(
3007                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3008                )),
3009            }
3010        }
3011    }
3012
3013    impl serde::ser::Serialize for Severity {
3014        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3015        where
3016            S: serde::Serializer,
3017        {
3018            match self {
3019                Self::Unspecified => serializer.serialize_i32(0),
3020                Self::Critical => serializer.serialize_i32(1),
3021                Self::Error => serializer.serialize_i32(2),
3022                Self::Warning => serializer.serialize_i32(3),
3023                Self::UnknownValue(u) => u.0.serialize(serializer),
3024            }
3025        }
3026    }
3027
3028    impl<'de> serde::de::Deserialize<'de> for Severity {
3029        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3030        where
3031            D: serde::Deserializer<'de>,
3032        {
3033            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
3034                ".google.monitoring.v3.AlertPolicy.Severity",
3035            ))
3036        }
3037    }
3038}
3039
3040/// The protocol for the `CreateAlertPolicy` request.
3041#[derive(Clone, Default, PartialEq)]
3042#[non_exhaustive]
3043pub struct CreateAlertPolicyRequest {
3044    /// Required. The
3045    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
3046    /// to create the alerting policy. The format is:
3047    ///
3048    /// ```norust
3049    /// projects/[PROJECT_ID_OR_NUMBER]
3050    /// ```
3051    ///
3052    /// Note that this field names the parent container in which the alerting
3053    /// policy will be written, not the name of the created policy. |name| must be
3054    /// a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will
3055    /// return. The alerting policy that is returned will have a name that contains
3056    /// a normalized representation of this name as a prefix but adds a suffix of
3057    /// the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
3058    /// container.
3059    pub name: std::string::String,
3060
3061    /// Required. The requested alerting policy. You should omit the `name` field
3062    /// in this policy. The name will be returned in the new policy, including a
3063    /// new `[ALERT_POLICY_ID]` value.
3064    pub alert_policy: std::option::Option<crate::model::AlertPolicy>,
3065
3066    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3067}
3068
3069impl CreateAlertPolicyRequest {
3070    pub fn new() -> Self {
3071        std::default::Default::default()
3072    }
3073
3074    /// Sets the value of [name][crate::model::CreateAlertPolicyRequest::name].
3075    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3076        self.name = v.into();
3077        self
3078    }
3079
3080    /// Sets the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
3081    pub fn set_alert_policy<T>(mut self, v: T) -> Self
3082    where
3083        T: std::convert::Into<crate::model::AlertPolicy>,
3084    {
3085        self.alert_policy = std::option::Option::Some(v.into());
3086        self
3087    }
3088
3089    /// Sets or clears the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
3090    pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
3091    where
3092        T: std::convert::Into<crate::model::AlertPolicy>,
3093    {
3094        self.alert_policy = v.map(|x| x.into());
3095        self
3096    }
3097}
3098
3099impl wkt::message::Message for CreateAlertPolicyRequest {
3100    fn typename() -> &'static str {
3101        "type.googleapis.com/google.monitoring.v3.CreateAlertPolicyRequest"
3102    }
3103}
3104
3105/// The protocol for the `GetAlertPolicy` request.
3106#[derive(Clone, Default, PartialEq)]
3107#[non_exhaustive]
3108pub struct GetAlertPolicyRequest {
3109    /// Required. The alerting policy to retrieve. The format is:
3110    ///
3111    /// ```norust
3112    /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
3113    /// ```
3114    pub name: std::string::String,
3115
3116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3117}
3118
3119impl GetAlertPolicyRequest {
3120    pub fn new() -> Self {
3121        std::default::Default::default()
3122    }
3123
3124    /// Sets the value of [name][crate::model::GetAlertPolicyRequest::name].
3125    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3126        self.name = v.into();
3127        self
3128    }
3129}
3130
3131impl wkt::message::Message for GetAlertPolicyRequest {
3132    fn typename() -> &'static str {
3133        "type.googleapis.com/google.monitoring.v3.GetAlertPolicyRequest"
3134    }
3135}
3136
3137/// The protocol for the `ListAlertPolicies` request.
3138#[derive(Clone, Default, PartialEq)]
3139#[non_exhaustive]
3140pub struct ListAlertPoliciesRequest {
3141    /// Required. The
3142    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
3143    /// alert policies are to be listed. The format is:
3144    ///
3145    /// ```norust
3146    /// projects/[PROJECT_ID_OR_NUMBER]
3147    /// ```
3148    ///
3149    /// Note that this field names the parent container in which the alerting
3150    /// policies to be listed are stored. To retrieve a single alerting policy
3151    /// by name, use the
3152    /// [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
3153    /// operation, instead.
3154    ///
3155    /// [google.monitoring.v3.AlertPolicyService.GetAlertPolicy]: crate::client::AlertPolicyService::get_alert_policy
3156    pub name: std::string::String,
3157
3158    /// Optional. If provided, this field specifies the criteria that must be met
3159    /// by alert policies to be included in the response.
3160    ///
3161    /// For more details, see [sorting and
3162    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
3163    pub filter: std::string::String,
3164
3165    /// Optional. A comma-separated list of fields by which to sort the result.
3166    /// Supports the same set of field references as the `filter` field. Entries
3167    /// can be prefixed with a minus sign to sort by the field in descending order.
3168    ///
3169    /// For more details, see [sorting and
3170    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
3171    pub order_by: std::string::String,
3172
3173    /// Optional. The maximum number of results to return in a single response.
3174    pub page_size: i32,
3175
3176    /// Optional. If this field is not empty then it must contain the
3177    /// `nextPageToken` value returned by a previous call to this method.  Using
3178    /// this field causes the method to return more results from the previous
3179    /// method call.
3180    pub page_token: std::string::String,
3181
3182    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3183}
3184
3185impl ListAlertPoliciesRequest {
3186    pub fn new() -> Self {
3187        std::default::Default::default()
3188    }
3189
3190    /// Sets the value of [name][crate::model::ListAlertPoliciesRequest::name].
3191    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3192        self.name = v.into();
3193        self
3194    }
3195
3196    /// Sets the value of [filter][crate::model::ListAlertPoliciesRequest::filter].
3197    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3198        self.filter = v.into();
3199        self
3200    }
3201
3202    /// Sets the value of [order_by][crate::model::ListAlertPoliciesRequest::order_by].
3203    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3204        self.order_by = v.into();
3205        self
3206    }
3207
3208    /// Sets the value of [page_size][crate::model::ListAlertPoliciesRequest::page_size].
3209    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3210        self.page_size = v.into();
3211        self
3212    }
3213
3214    /// Sets the value of [page_token][crate::model::ListAlertPoliciesRequest::page_token].
3215    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3216        self.page_token = v.into();
3217        self
3218    }
3219}
3220
3221impl wkt::message::Message for ListAlertPoliciesRequest {
3222    fn typename() -> &'static str {
3223        "type.googleapis.com/google.monitoring.v3.ListAlertPoliciesRequest"
3224    }
3225}
3226
3227/// The protocol for the `ListAlertPolicies` response.
3228#[derive(Clone, Default, PartialEq)]
3229#[non_exhaustive]
3230pub struct ListAlertPoliciesResponse {
3231    /// The returned alert policies.
3232    pub alert_policies: std::vec::Vec<crate::model::AlertPolicy>,
3233
3234    /// If there might be more results than were returned, then this field is set
3235    /// to a non-empty value. To see the additional results,
3236    /// use that value as `page_token` in the next call to this method.
3237    pub next_page_token: std::string::String,
3238
3239    /// The total number of alert policies in all pages. This number is only an
3240    /// estimate, and may change in subsequent pages. <https://aip.dev/158>
3241    pub total_size: i32,
3242
3243    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3244}
3245
3246impl ListAlertPoliciesResponse {
3247    pub fn new() -> Self {
3248        std::default::Default::default()
3249    }
3250
3251    /// Sets the value of [alert_policies][crate::model::ListAlertPoliciesResponse::alert_policies].
3252    pub fn set_alert_policies<T, V>(mut self, v: T) -> Self
3253    where
3254        T: std::iter::IntoIterator<Item = V>,
3255        V: std::convert::Into<crate::model::AlertPolicy>,
3256    {
3257        use std::iter::Iterator;
3258        self.alert_policies = v.into_iter().map(|i| i.into()).collect();
3259        self
3260    }
3261
3262    /// Sets the value of [next_page_token][crate::model::ListAlertPoliciesResponse::next_page_token].
3263    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3264        self.next_page_token = v.into();
3265        self
3266    }
3267
3268    /// Sets the value of [total_size][crate::model::ListAlertPoliciesResponse::total_size].
3269    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3270        self.total_size = v.into();
3271        self
3272    }
3273}
3274
3275impl wkt::message::Message for ListAlertPoliciesResponse {
3276    fn typename() -> &'static str {
3277        "type.googleapis.com/google.monitoring.v3.ListAlertPoliciesResponse"
3278    }
3279}
3280
3281#[doc(hidden)]
3282impl gax::paginator::internal::PageableResponse for ListAlertPoliciesResponse {
3283    type PageItem = crate::model::AlertPolicy;
3284
3285    fn items(self) -> std::vec::Vec<Self::PageItem> {
3286        self.alert_policies
3287    }
3288
3289    fn next_page_token(&self) -> std::string::String {
3290        use std::clone::Clone;
3291        self.next_page_token.clone()
3292    }
3293}
3294
3295/// The protocol for the `UpdateAlertPolicy` request.
3296#[derive(Clone, Default, PartialEq)]
3297#[non_exhaustive]
3298pub struct UpdateAlertPolicyRequest {
3299    /// Optional. A list of alerting policy field names. If this field is not
3300    /// empty, each listed field in the existing alerting policy is set to the
3301    /// value of the corresponding field in the supplied policy (`alert_policy`),
3302    /// or to the field's default value if the field is not in the supplied
3303    /// alerting policy.  Fields not listed retain their previous value.
3304    ///
3305    /// Examples of valid field masks include `display_name`, `documentation`,
3306    /// `documentation.content`, `documentation.mime_type`, `user_labels`,
3307    /// `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
3308    ///
3309    /// If this field is empty, then the supplied alerting policy replaces the
3310    /// existing policy. It is the same as deleting the existing policy and
3311    /// adding the supplied policy, except for the following:
3312    ///
3313    /// + The new policy will have the same `[ALERT_POLICY_ID]` as the former
3314    ///   policy. This gives you continuity with the former policy in your
3315    ///   notifications and incidents.
3316    /// + Conditions in the new policy will keep their former `[CONDITION_ID]` if
3317    ///   the supplied condition includes the `name` field with that
3318    ///   `[CONDITION_ID]`. If the supplied condition omits the `name` field,
3319    ///   then a new `[CONDITION_ID]` is created.
3320    pub update_mask: std::option::Option<wkt::FieldMask>,
3321
3322    /// Required. The updated alerting policy or the updated values for the
3323    /// fields listed in `update_mask`.
3324    /// If `update_mask` is not empty, any fields in this policy that are
3325    /// not in `update_mask` are ignored.
3326    pub alert_policy: std::option::Option<crate::model::AlertPolicy>,
3327
3328    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3329}
3330
3331impl UpdateAlertPolicyRequest {
3332    pub fn new() -> Self {
3333        std::default::Default::default()
3334    }
3335
3336    /// Sets the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
3337    pub fn set_update_mask<T>(mut self, v: T) -> Self
3338    where
3339        T: std::convert::Into<wkt::FieldMask>,
3340    {
3341        self.update_mask = std::option::Option::Some(v.into());
3342        self
3343    }
3344
3345    /// Sets or clears the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
3346    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3347    where
3348        T: std::convert::Into<wkt::FieldMask>,
3349    {
3350        self.update_mask = v.map(|x| x.into());
3351        self
3352    }
3353
3354    /// Sets the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
3355    pub fn set_alert_policy<T>(mut self, v: T) -> Self
3356    where
3357        T: std::convert::Into<crate::model::AlertPolicy>,
3358    {
3359        self.alert_policy = std::option::Option::Some(v.into());
3360        self
3361    }
3362
3363    /// Sets or clears the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
3364    pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
3365    where
3366        T: std::convert::Into<crate::model::AlertPolicy>,
3367    {
3368        self.alert_policy = v.map(|x| x.into());
3369        self
3370    }
3371}
3372
3373impl wkt::message::Message for UpdateAlertPolicyRequest {
3374    fn typename() -> &'static str {
3375        "type.googleapis.com/google.monitoring.v3.UpdateAlertPolicyRequest"
3376    }
3377}
3378
3379/// The protocol for the `DeleteAlertPolicy` request.
3380#[derive(Clone, Default, PartialEq)]
3381#[non_exhaustive]
3382pub struct DeleteAlertPolicyRequest {
3383    /// Required. The alerting policy to delete. The format is:
3384    ///
3385    /// ```norust
3386    /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
3387    /// ```
3388    ///
3389    /// For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
3390    ///
3391    /// [google.monitoring.v3.AlertPolicy]: crate::model::AlertPolicy
3392    pub name: std::string::String,
3393
3394    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3395}
3396
3397impl DeleteAlertPolicyRequest {
3398    pub fn new() -> Self {
3399        std::default::Default::default()
3400    }
3401
3402    /// Sets the value of [name][crate::model::DeleteAlertPolicyRequest::name].
3403    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3404        self.name = v.into();
3405        self
3406    }
3407}
3408
3409impl wkt::message::Message for DeleteAlertPolicyRequest {
3410    fn typename() -> &'static str {
3411        "type.googleapis.com/google.monitoring.v3.DeleteAlertPolicyRequest"
3412    }
3413}
3414
3415/// A single strongly-typed value.
3416#[derive(Clone, Default, PartialEq)]
3417#[non_exhaustive]
3418pub struct TypedValue {
3419    /// The typed value field.
3420    pub value: std::option::Option<crate::model::typed_value::Value>,
3421
3422    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3423}
3424
3425impl TypedValue {
3426    pub fn new() -> Self {
3427        std::default::Default::default()
3428    }
3429
3430    /// Sets the value of [value][crate::model::TypedValue::value].
3431    ///
3432    /// Note that all the setters affecting `value` are mutually
3433    /// exclusive.
3434    pub fn set_value<
3435        T: std::convert::Into<std::option::Option<crate::model::typed_value::Value>>,
3436    >(
3437        mut self,
3438        v: T,
3439    ) -> Self {
3440        self.value = v.into();
3441        self
3442    }
3443
3444    /// The value of [value][crate::model::TypedValue::value]
3445    /// if it holds a `BoolValue`, `None` if the field is not set or
3446    /// holds a different branch.
3447    pub fn bool_value(&self) -> std::option::Option<&bool> {
3448        #[allow(unreachable_patterns)]
3449        self.value.as_ref().and_then(|v| match v {
3450            crate::model::typed_value::Value::BoolValue(v) => std::option::Option::Some(v),
3451            _ => std::option::Option::None,
3452        })
3453    }
3454
3455    /// Sets the value of [value][crate::model::TypedValue::value]
3456    /// to hold a `BoolValue`.
3457    ///
3458    /// Note that all the setters affecting `value` are
3459    /// mutually exclusive.
3460    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3461        self.value =
3462            std::option::Option::Some(crate::model::typed_value::Value::BoolValue(v.into()));
3463        self
3464    }
3465
3466    /// The value of [value][crate::model::TypedValue::value]
3467    /// if it holds a `Int64Value`, `None` if the field is not set or
3468    /// holds a different branch.
3469    pub fn int64_value(&self) -> std::option::Option<&i64> {
3470        #[allow(unreachable_patterns)]
3471        self.value.as_ref().and_then(|v| match v {
3472            crate::model::typed_value::Value::Int64Value(v) => std::option::Option::Some(v),
3473            _ => std::option::Option::None,
3474        })
3475    }
3476
3477    /// Sets the value of [value][crate::model::TypedValue::value]
3478    /// to hold a `Int64Value`.
3479    ///
3480    /// Note that all the setters affecting `value` are
3481    /// mutually exclusive.
3482    pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3483        self.value =
3484            std::option::Option::Some(crate::model::typed_value::Value::Int64Value(v.into()));
3485        self
3486    }
3487
3488    /// The value of [value][crate::model::TypedValue::value]
3489    /// if it holds a `DoubleValue`, `None` if the field is not set or
3490    /// holds a different branch.
3491    pub fn double_value(&self) -> std::option::Option<&f64> {
3492        #[allow(unreachable_patterns)]
3493        self.value.as_ref().and_then(|v| match v {
3494            crate::model::typed_value::Value::DoubleValue(v) => std::option::Option::Some(v),
3495            _ => std::option::Option::None,
3496        })
3497    }
3498
3499    /// Sets the value of [value][crate::model::TypedValue::value]
3500    /// to hold a `DoubleValue`.
3501    ///
3502    /// Note that all the setters affecting `value` are
3503    /// mutually exclusive.
3504    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3505        self.value =
3506            std::option::Option::Some(crate::model::typed_value::Value::DoubleValue(v.into()));
3507        self
3508    }
3509
3510    /// The value of [value][crate::model::TypedValue::value]
3511    /// if it holds a `StringValue`, `None` if the field is not set or
3512    /// holds a different branch.
3513    pub fn string_value(&self) -> std::option::Option<&std::string::String> {
3514        #[allow(unreachable_patterns)]
3515        self.value.as_ref().and_then(|v| match v {
3516            crate::model::typed_value::Value::StringValue(v) => std::option::Option::Some(v),
3517            _ => std::option::Option::None,
3518        })
3519    }
3520
3521    /// Sets the value of [value][crate::model::TypedValue::value]
3522    /// to hold a `StringValue`.
3523    ///
3524    /// Note that all the setters affecting `value` are
3525    /// mutually exclusive.
3526    pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3527        self.value =
3528            std::option::Option::Some(crate::model::typed_value::Value::StringValue(v.into()));
3529        self
3530    }
3531
3532    /// The value of [value][crate::model::TypedValue::value]
3533    /// if it holds a `DistributionValue`, `None` if the field is not set or
3534    /// holds a different branch.
3535    pub fn distribution_value(
3536        &self,
3537    ) -> std::option::Option<&std::boxed::Box<api::model::Distribution>> {
3538        #[allow(unreachable_patterns)]
3539        self.value.as_ref().and_then(|v| match v {
3540            crate::model::typed_value::Value::DistributionValue(v) => std::option::Option::Some(v),
3541            _ => std::option::Option::None,
3542        })
3543    }
3544
3545    /// Sets the value of [value][crate::model::TypedValue::value]
3546    /// to hold a `DistributionValue`.
3547    ///
3548    /// Note that all the setters affecting `value` are
3549    /// mutually exclusive.
3550    pub fn set_distribution_value<
3551        T: std::convert::Into<std::boxed::Box<api::model::Distribution>>,
3552    >(
3553        mut self,
3554        v: T,
3555    ) -> Self {
3556        self.value = std::option::Option::Some(
3557            crate::model::typed_value::Value::DistributionValue(v.into()),
3558        );
3559        self
3560    }
3561}
3562
3563impl wkt::message::Message for TypedValue {
3564    fn typename() -> &'static str {
3565        "type.googleapis.com/google.monitoring.v3.TypedValue"
3566    }
3567}
3568
3569/// Defines additional types related to [TypedValue].
3570pub mod typed_value {
3571    #[allow(unused_imports)]
3572    use super::*;
3573
3574    /// The typed value field.
3575    #[derive(Clone, Debug, PartialEq)]
3576    #[non_exhaustive]
3577    pub enum Value {
3578        /// A Boolean value: `true` or `false`.
3579        BoolValue(bool),
3580        /// A 64-bit integer. Its range is approximately &plusmn;9.2x10\<sup\>18\</sup\>.
3581        Int64Value(i64),
3582        /// A 64-bit double-precision floating-point number. Its magnitude
3583        /// is approximately &plusmn;10\<sup\>&plusmn;300\</sup\> and it has 16
3584        /// significant digits of precision.
3585        DoubleValue(f64),
3586        /// A variable-length string value.
3587        StringValue(std::string::String),
3588        /// A distribution value.
3589        DistributionValue(std::boxed::Box<api::model::Distribution>),
3590    }
3591}
3592
3593/// Describes a time interval:
3594///
3595/// * Reads: A half-open time interval. It includes the end time but
3596///   excludes the start time: `(startTime, endTime]`. The start time
3597///   must be specified, must be earlier than the end time, and should be
3598///   no older than the data retention period for the metric.
3599/// * Writes: A closed time interval. It extends from the start time to the end
3600///   time,
3601///   and includes both: `[startTime, endTime]`. Valid time intervals
3602///   depend on the
3603///   [`MetricKind`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind)
3604///   of the metric value. The end time must not be earlier than the start
3605///   time, and the end time must not be more than 25 hours in the past or more
3606///   than five minutes in the future.
3607///   * For `GAUGE` metrics, the `startTime` value is technically optional; if
3608///     no value is specified, the start time defaults to the value of the
3609///     end time, and the interval represents a single point in time. If both
3610///     start and end times are specified, they must be identical. Such an
3611///     interval is valid only for `GAUGE` metrics, which are point-in-time
3612///     measurements. The end time of a new interval must be at least a
3613///     millisecond after the end time of the previous interval.
3614///   * For `DELTA` metrics, the start time and end time must specify a
3615///     non-zero interval, with subsequent points specifying contiguous and
3616///     non-overlapping intervals. For `DELTA` metrics, the start time of
3617///     the next interval must be at least a millisecond after the end time
3618///     of the previous interval.
3619///   * For `CUMULATIVE` metrics, the start time and end time must specify a
3620///     non-zero interval, with subsequent points specifying the same
3621///     start time and increasing end times, until an event resets the
3622///     cumulative value to zero and sets a new start time for the following
3623///     points. The new start time must be at least a millisecond after the
3624///     end time of the previous interval.
3625///   * The start time of a new interval must be at least a millisecond after
3626///     the
3627///     end time of the previous interval because intervals are closed. If the
3628///     start time of a new interval is the same as the end time of the
3629///     previous interval, then data written at the new start time could
3630///     overwrite data written at the previous end time.
3631#[derive(Clone, Default, PartialEq)]
3632#[non_exhaustive]
3633pub struct TimeInterval {
3634    /// Required. The end of the time interval.
3635    pub end_time: std::option::Option<wkt::Timestamp>,
3636
3637    /// Optional. The beginning of the time interval.  The default value
3638    /// for the start time is the end time. The start time must not be
3639    /// later than the end time.
3640    pub start_time: std::option::Option<wkt::Timestamp>,
3641
3642    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3643}
3644
3645impl TimeInterval {
3646    pub fn new() -> Self {
3647        std::default::Default::default()
3648    }
3649
3650    /// Sets the value of [end_time][crate::model::TimeInterval::end_time].
3651    pub fn set_end_time<T>(mut self, v: T) -> Self
3652    where
3653        T: std::convert::Into<wkt::Timestamp>,
3654    {
3655        self.end_time = std::option::Option::Some(v.into());
3656        self
3657    }
3658
3659    /// Sets or clears the value of [end_time][crate::model::TimeInterval::end_time].
3660    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3661    where
3662        T: std::convert::Into<wkt::Timestamp>,
3663    {
3664        self.end_time = v.map(|x| x.into());
3665        self
3666    }
3667
3668    /// Sets the value of [start_time][crate::model::TimeInterval::start_time].
3669    pub fn set_start_time<T>(mut self, v: T) -> Self
3670    where
3671        T: std::convert::Into<wkt::Timestamp>,
3672    {
3673        self.start_time = std::option::Option::Some(v.into());
3674        self
3675    }
3676
3677    /// Sets or clears the value of [start_time][crate::model::TimeInterval::start_time].
3678    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3679    where
3680        T: std::convert::Into<wkt::Timestamp>,
3681    {
3682        self.start_time = v.map(|x| x.into());
3683        self
3684    }
3685}
3686
3687impl wkt::message::Message for TimeInterval {
3688    fn typename() -> &'static str {
3689        "type.googleapis.com/google.monitoring.v3.TimeInterval"
3690    }
3691}
3692
3693/// Describes how to combine multiple time series to provide a different view of
3694/// the data.  Aggregation of time series is done in two steps. First, each time
3695/// series in the set is _aligned_ to the same time interval boundaries, then the
3696/// set of time series is optionally _reduced_ in number.
3697///
3698/// Alignment consists of applying the `per_series_aligner` operation
3699/// to each time series after its data has been divided into regular
3700/// `alignment_period` time intervals. This process takes _all_ of the data
3701/// points in an alignment period, applies a mathematical transformation such as
3702/// averaging, minimum, maximum, delta, etc., and converts them into a single
3703/// data point per period.
3704///
3705/// Reduction is when the aligned and transformed time series can optionally be
3706/// combined, reducing the number of time series through similar mathematical
3707/// transformations. Reduction involves applying a `cross_series_reducer` to
3708/// all the time series, optionally sorting the time series into subsets with
3709/// `group_by_fields`, and applying the reducer to each subset.
3710///
3711/// The raw time series data can contain a huge amount of information from
3712/// multiple sources. Alignment and reduction transforms this mass of data into
3713/// a more manageable and representative collection of data, for example "the
3714/// 95% latency across the average of all tasks in a cluster". This
3715/// representative data can be more easily graphed and comprehended, and the
3716/// individual time series data is still available for later drilldown. For more
3717/// details, see [Filtering and
3718/// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation).
3719#[derive(Clone, Default, PartialEq)]
3720#[non_exhaustive]
3721pub struct Aggregation {
3722    /// The `alignment_period` specifies a time interval, in seconds, that is used
3723    /// to divide the data in all the
3724    /// [time series][google.monitoring.v3.TimeSeries] into consistent blocks of
3725    /// time. This will be done before the per-series aligner can be applied to
3726    /// the data.
3727    ///
3728    /// The value must be at least 60 seconds. If a per-series
3729    /// aligner other than `ALIGN_NONE` is specified, this field is required or an
3730    /// error is returned. If no per-series aligner is specified, or the aligner
3731    /// `ALIGN_NONE` is specified, then this field is ignored.
3732    ///
3733    /// The maximum value of the `alignment_period` is 104 weeks (2 years) for
3734    /// charts, and 90,000 seconds (25 hours) for alerting policies.
3735    ///
3736    /// [google.monitoring.v3.TimeSeries]: crate::model::TimeSeries
3737    pub alignment_period: std::option::Option<wkt::Duration>,
3738
3739    /// An `Aligner` describes how to bring the data points in a single
3740    /// time series into temporal alignment. Except for `ALIGN_NONE`, all
3741    /// alignments cause all the data points in an `alignment_period` to be
3742    /// mathematically grouped together, resulting in a single data point for
3743    /// each `alignment_period` with end timestamp at the end of the period.
3744    ///
3745    /// Not all alignment operations may be applied to all time series. The valid
3746    /// choices depend on the `metric_kind` and `value_type` of the original time
3747    /// series. Alignment can change the `metric_kind` or the `value_type` of
3748    /// the time series.
3749    ///
3750    /// Time series data must be aligned in order to perform cross-time
3751    /// series reduction. If `cross_series_reducer` is specified, then
3752    /// `per_series_aligner` must be specified and not equal to `ALIGN_NONE`
3753    /// and `alignment_period` must be specified; otherwise, an error is
3754    /// returned.
3755    pub per_series_aligner: crate::model::aggregation::Aligner,
3756
3757    /// The reduction operation to be used to combine time series into a single
3758    /// time series, where the value of each data point in the resulting series is
3759    /// a function of all the already aligned values in the input time series.
3760    ///
3761    /// Not all reducer operations can be applied to all time series. The valid
3762    /// choices depend on the `metric_kind` and the `value_type` of the original
3763    /// time series. Reduction can yield a time series with a different
3764    /// `metric_kind` or `value_type` than the input time series.
3765    ///
3766    /// Time series data must first be aligned (see `per_series_aligner`) in order
3767    /// to perform cross-time series reduction. If `cross_series_reducer` is
3768    /// specified, then `per_series_aligner` must be specified, and must not be
3769    /// `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an
3770    /// error is returned.
3771    pub cross_series_reducer: crate::model::aggregation::Reducer,
3772
3773    /// The set of fields to preserve when `cross_series_reducer` is
3774    /// specified. The `group_by_fields` determine how the time series are
3775    /// partitioned into subsets prior to applying the aggregation
3776    /// operation. Each subset contains time series that have the same
3777    /// value for each of the grouping fields. Each individual time
3778    /// series is a member of exactly one subset. The
3779    /// `cross_series_reducer` is applied to each subset of time series.
3780    /// It is not possible to reduce across different resource types, so
3781    /// this field implicitly contains `resource.type`.  Fields not
3782    /// specified in `group_by_fields` are aggregated away.  If
3783    /// `group_by_fields` is not specified and all the time series have
3784    /// the same resource type, then the time series are aggregated into
3785    /// a single output time series. If `cross_series_reducer` is not
3786    /// defined, this field is ignored.
3787    pub group_by_fields: std::vec::Vec<std::string::String>,
3788
3789    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3790}
3791
3792impl Aggregation {
3793    pub fn new() -> Self {
3794        std::default::Default::default()
3795    }
3796
3797    /// Sets the value of [alignment_period][crate::model::Aggregation::alignment_period].
3798    pub fn set_alignment_period<T>(mut self, v: T) -> Self
3799    where
3800        T: std::convert::Into<wkt::Duration>,
3801    {
3802        self.alignment_period = std::option::Option::Some(v.into());
3803        self
3804    }
3805
3806    /// Sets or clears the value of [alignment_period][crate::model::Aggregation::alignment_period].
3807    pub fn set_or_clear_alignment_period<T>(mut self, v: std::option::Option<T>) -> Self
3808    where
3809        T: std::convert::Into<wkt::Duration>,
3810    {
3811        self.alignment_period = v.map(|x| x.into());
3812        self
3813    }
3814
3815    /// Sets the value of [per_series_aligner][crate::model::Aggregation::per_series_aligner].
3816    pub fn set_per_series_aligner<T: std::convert::Into<crate::model::aggregation::Aligner>>(
3817        mut self,
3818        v: T,
3819    ) -> Self {
3820        self.per_series_aligner = v.into();
3821        self
3822    }
3823
3824    /// Sets the value of [cross_series_reducer][crate::model::Aggregation::cross_series_reducer].
3825    pub fn set_cross_series_reducer<T: std::convert::Into<crate::model::aggregation::Reducer>>(
3826        mut self,
3827        v: T,
3828    ) -> Self {
3829        self.cross_series_reducer = v.into();
3830        self
3831    }
3832
3833    /// Sets the value of [group_by_fields][crate::model::Aggregation::group_by_fields].
3834    pub fn set_group_by_fields<T, V>(mut self, v: T) -> Self
3835    where
3836        T: std::iter::IntoIterator<Item = V>,
3837        V: std::convert::Into<std::string::String>,
3838    {
3839        use std::iter::Iterator;
3840        self.group_by_fields = v.into_iter().map(|i| i.into()).collect();
3841        self
3842    }
3843}
3844
3845impl wkt::message::Message for Aggregation {
3846    fn typename() -> &'static str {
3847        "type.googleapis.com/google.monitoring.v3.Aggregation"
3848    }
3849}
3850
3851/// Defines additional types related to [Aggregation].
3852pub mod aggregation {
3853    #[allow(unused_imports)]
3854    use super::*;
3855
3856    /// The `Aligner` specifies the operation that will be applied to the data
3857    /// points in each alignment period in a time series. Except for
3858    /// `ALIGN_NONE`, which specifies that no operation be applied, each alignment
3859    /// operation replaces the set of data values in each alignment period with
3860    /// a single value: the result of applying the operation to the data values.
3861    /// An aligned time series has a single data value at the end of each
3862    /// `alignment_period`.
3863    ///
3864    /// An alignment operation can change the data type of the values, too. For
3865    /// example, if you apply a counting operation to boolean values, the data
3866    /// `value_type` in the original time series is `BOOLEAN`, but the `value_type`
3867    /// in the aligned result is `INT64`.
3868    ///
3869    /// # Working with unknown values
3870    ///
3871    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3872    /// additional enum variants at any time. Adding new variants is not considered
3873    /// a breaking change. Applications should write their code in anticipation of:
3874    ///
3875    /// - New values appearing in future releases of the client library, **and**
3876    /// - New values received dynamically, without application changes.
3877    ///
3878    /// Please consult the [Working with enums] section in the user guide for some
3879    /// guidelines.
3880    ///
3881    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3882    #[derive(Clone, Debug, PartialEq)]
3883    #[non_exhaustive]
3884    pub enum Aligner {
3885        /// No alignment. Raw data is returned. Not valid if cross-series reduction
3886        /// is requested. The `value_type` of the result is the same as the
3887        /// `value_type` of the input.
3888        AlignNone,
3889        /// Align and convert to
3890        /// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA].
3891        /// The output is `delta = y1 - y0`.
3892        ///
3893        /// This alignment is valid for
3894        /// [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and
3895        /// `DELTA` metrics. If the selected alignment period results in periods
3896        /// with no data, then the aligned value for such a period is created by
3897        /// interpolation. The `value_type`  of the aligned result is the same as
3898        /// the `value_type` of the input.
3899        ///
3900        /// [google.api.MetricDescriptor.MetricKind.CUMULATIVE]: api::model::metric_descriptor::MetricKind::Cumulative
3901        /// [google.api.MetricDescriptor.MetricKind.DELTA]: api::model::metric_descriptor::MetricKind::Delta
3902        AlignDelta,
3903        /// Align and convert to a rate. The result is computed as
3904        /// `rate = (y1 - y0)/(t1 - t0)`, or "delta over time".
3905        /// Think of this aligner as providing the slope of the line that passes
3906        /// through the value at the start and at the end of the `alignment_period`.
3907        ///
3908        /// This aligner is valid for `CUMULATIVE`
3909        /// and `DELTA` metrics with numeric values. If the selected alignment
3910        /// period results in periods with no data, then the aligned value for
3911        /// such a period is created by interpolation. The output is a `GAUGE`
3912        /// metric with `value_type` `DOUBLE`.
3913        ///
3914        /// If, by "rate", you mean "percentage change", see the
3915        /// `ALIGN_PERCENT_CHANGE` aligner instead.
3916        AlignRate,
3917        /// Align by interpolating between adjacent points around the alignment
3918        /// period boundary. This aligner is valid for `GAUGE` metrics with
3919        /// numeric values. The `value_type` of the aligned result is the same as the
3920        /// `value_type` of the input.
3921        AlignInterpolate,
3922        /// Align by moving the most recent data point before the end of the
3923        /// alignment period to the boundary at the end of the alignment
3924        /// period. This aligner is valid for `GAUGE` metrics. The `value_type` of
3925        /// the aligned result is the same as the `value_type` of the input.
3926        AlignNextOlder,
3927        /// Align the time series by returning the minimum value in each alignment
3928        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
3929        /// numeric values. The `value_type` of the aligned result is the same as
3930        /// the `value_type` of the input.
3931        AlignMin,
3932        /// Align the time series by returning the maximum value in each alignment
3933        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
3934        /// numeric values. The `value_type` of the aligned result is the same as
3935        /// the `value_type` of the input.
3936        AlignMax,
3937        /// Align the time series by returning the mean value in each alignment
3938        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
3939        /// numeric values. The `value_type` of the aligned result is `DOUBLE`.
3940        AlignMean,
3941        /// Align the time series by returning the number of values in each alignment
3942        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
3943        /// numeric or Boolean values. The `value_type` of the aligned result is
3944        /// `INT64`.
3945        AlignCount,
3946        /// Align the time series by returning the sum of the values in each
3947        /// alignment period. This aligner is valid for `GAUGE` and `DELTA`
3948        /// metrics with numeric and distribution values. The `value_type` of the
3949        /// aligned result is the same as the `value_type` of the input.
3950        AlignSum,
3951        /// Align the time series by returning the standard deviation of the values
3952        /// in each alignment period. This aligner is valid for `GAUGE` and
3953        /// `DELTA` metrics with numeric values. The `value_type` of the output is
3954        /// `DOUBLE`.
3955        AlignStddev,
3956        /// Align the time series by returning the number of `True` values in
3957        /// each alignment period. This aligner is valid for `GAUGE` metrics with
3958        /// Boolean values. The `value_type` of the output is `INT64`.
3959        AlignCountTrue,
3960        /// Align the time series by returning the number of `False` values in
3961        /// each alignment period. This aligner is valid for `GAUGE` metrics with
3962        /// Boolean values. The `value_type` of the output is `INT64`.
3963        AlignCountFalse,
3964        /// Align the time series by returning the ratio of the number of `True`
3965        /// values to the total number of values in each alignment period. This
3966        /// aligner is valid for `GAUGE` metrics with Boolean values. The output
3967        /// value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`.
3968        AlignFractionTrue,
3969        /// Align the time series by using [percentile
3970        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
3971        /// data point in each alignment period is the 99th percentile of all data
3972        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
3973        /// metrics with distribution values. The output is a `GAUGE` metric with
3974        /// `value_type` `DOUBLE`.
3975        AlignPercentile99,
3976        /// Align the time series by using [percentile
3977        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
3978        /// data point in each alignment period is the 95th percentile of all data
3979        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
3980        /// metrics with distribution values. The output is a `GAUGE` metric with
3981        /// `value_type` `DOUBLE`.
3982        AlignPercentile95,
3983        /// Align the time series by using [percentile
3984        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
3985        /// data point in each alignment period is the 50th percentile of all data
3986        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
3987        /// metrics with distribution values. The output is a `GAUGE` metric with
3988        /// `value_type` `DOUBLE`.
3989        AlignPercentile50,
3990        /// Align the time series by using [percentile
3991        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
3992        /// data point in each alignment period is the 5th percentile of all data
3993        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
3994        /// metrics with distribution values. The output is a `GAUGE` metric with
3995        /// `value_type` `DOUBLE`.
3996        AlignPercentile05,
3997        /// Align and convert to a percentage change. This aligner is valid for
3998        /// `GAUGE` and `DELTA` metrics with numeric values. This alignment returns
3999        /// `((current - previous)/previous) * 100`, where the value of `previous` is
4000        /// determined based on the `alignment_period`.
4001        ///
4002        /// If the values of `current` and `previous` are both 0, then the returned
4003        /// value is 0. If only `previous` is 0, the returned value is infinity.
4004        ///
4005        /// A 10-minute moving mean is computed at each point of the alignment period
4006        /// prior to the above calculation to smooth the metric and prevent false
4007        /// positives from very short-lived spikes. The moving mean is only
4008        /// applicable for data whose values are `>= 0`. Any values `< 0` are
4009        /// treated as a missing datapoint, and are ignored. While `DELTA`
4010        /// metrics are accepted by this alignment, special care should be taken that
4011        /// the values for the metric will always be positive. The output is a
4012        /// `GAUGE` metric with `value_type` `DOUBLE`.
4013        AlignPercentChange,
4014        /// If set, the enum was initialized with an unknown value.
4015        ///
4016        /// Applications can examine the value using [Aligner::value] or
4017        /// [Aligner::name].
4018        UnknownValue(aligner::UnknownValue),
4019    }
4020
4021    #[doc(hidden)]
4022    pub mod aligner {
4023        #[allow(unused_imports)]
4024        use super::*;
4025        #[derive(Clone, Debug, PartialEq)]
4026        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4027    }
4028
4029    impl Aligner {
4030        /// Gets the enum value.
4031        ///
4032        /// Returns `None` if the enum contains an unknown value deserialized from
4033        /// the string representation of enums.
4034        pub fn value(&self) -> std::option::Option<i32> {
4035            match self {
4036                Self::AlignNone => std::option::Option::Some(0),
4037                Self::AlignDelta => std::option::Option::Some(1),
4038                Self::AlignRate => std::option::Option::Some(2),
4039                Self::AlignInterpolate => std::option::Option::Some(3),
4040                Self::AlignNextOlder => std::option::Option::Some(4),
4041                Self::AlignMin => std::option::Option::Some(10),
4042                Self::AlignMax => std::option::Option::Some(11),
4043                Self::AlignMean => std::option::Option::Some(12),
4044                Self::AlignCount => std::option::Option::Some(13),
4045                Self::AlignSum => std::option::Option::Some(14),
4046                Self::AlignStddev => std::option::Option::Some(15),
4047                Self::AlignCountTrue => std::option::Option::Some(16),
4048                Self::AlignCountFalse => std::option::Option::Some(24),
4049                Self::AlignFractionTrue => std::option::Option::Some(17),
4050                Self::AlignPercentile99 => std::option::Option::Some(18),
4051                Self::AlignPercentile95 => std::option::Option::Some(19),
4052                Self::AlignPercentile50 => std::option::Option::Some(20),
4053                Self::AlignPercentile05 => std::option::Option::Some(21),
4054                Self::AlignPercentChange => std::option::Option::Some(23),
4055                Self::UnknownValue(u) => u.0.value(),
4056            }
4057        }
4058
4059        /// Gets the enum value as a string.
4060        ///
4061        /// Returns `None` if the enum contains an unknown value deserialized from
4062        /// the integer representation of enums.
4063        pub fn name(&self) -> std::option::Option<&str> {
4064            match self {
4065                Self::AlignNone => std::option::Option::Some("ALIGN_NONE"),
4066                Self::AlignDelta => std::option::Option::Some("ALIGN_DELTA"),
4067                Self::AlignRate => std::option::Option::Some("ALIGN_RATE"),
4068                Self::AlignInterpolate => std::option::Option::Some("ALIGN_INTERPOLATE"),
4069                Self::AlignNextOlder => std::option::Option::Some("ALIGN_NEXT_OLDER"),
4070                Self::AlignMin => std::option::Option::Some("ALIGN_MIN"),
4071                Self::AlignMax => std::option::Option::Some("ALIGN_MAX"),
4072                Self::AlignMean => std::option::Option::Some("ALIGN_MEAN"),
4073                Self::AlignCount => std::option::Option::Some("ALIGN_COUNT"),
4074                Self::AlignSum => std::option::Option::Some("ALIGN_SUM"),
4075                Self::AlignStddev => std::option::Option::Some("ALIGN_STDDEV"),
4076                Self::AlignCountTrue => std::option::Option::Some("ALIGN_COUNT_TRUE"),
4077                Self::AlignCountFalse => std::option::Option::Some("ALIGN_COUNT_FALSE"),
4078                Self::AlignFractionTrue => std::option::Option::Some("ALIGN_FRACTION_TRUE"),
4079                Self::AlignPercentile99 => std::option::Option::Some("ALIGN_PERCENTILE_99"),
4080                Self::AlignPercentile95 => std::option::Option::Some("ALIGN_PERCENTILE_95"),
4081                Self::AlignPercentile50 => std::option::Option::Some("ALIGN_PERCENTILE_50"),
4082                Self::AlignPercentile05 => std::option::Option::Some("ALIGN_PERCENTILE_05"),
4083                Self::AlignPercentChange => std::option::Option::Some("ALIGN_PERCENT_CHANGE"),
4084                Self::UnknownValue(u) => u.0.name(),
4085            }
4086        }
4087    }
4088
4089    impl std::default::Default for Aligner {
4090        fn default() -> Self {
4091            use std::convert::From;
4092            Self::from(0)
4093        }
4094    }
4095
4096    impl std::fmt::Display for Aligner {
4097        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4098            wkt::internal::display_enum(f, self.name(), self.value())
4099        }
4100    }
4101
4102    impl std::convert::From<i32> for Aligner {
4103        fn from(value: i32) -> Self {
4104            match value {
4105                0 => Self::AlignNone,
4106                1 => Self::AlignDelta,
4107                2 => Self::AlignRate,
4108                3 => Self::AlignInterpolate,
4109                4 => Self::AlignNextOlder,
4110                10 => Self::AlignMin,
4111                11 => Self::AlignMax,
4112                12 => Self::AlignMean,
4113                13 => Self::AlignCount,
4114                14 => Self::AlignSum,
4115                15 => Self::AlignStddev,
4116                16 => Self::AlignCountTrue,
4117                17 => Self::AlignFractionTrue,
4118                18 => Self::AlignPercentile99,
4119                19 => Self::AlignPercentile95,
4120                20 => Self::AlignPercentile50,
4121                21 => Self::AlignPercentile05,
4122                23 => Self::AlignPercentChange,
4123                24 => Self::AlignCountFalse,
4124                _ => Self::UnknownValue(aligner::UnknownValue(
4125                    wkt::internal::UnknownEnumValue::Integer(value),
4126                )),
4127            }
4128        }
4129    }
4130
4131    impl std::convert::From<&str> for Aligner {
4132        fn from(value: &str) -> Self {
4133            use std::string::ToString;
4134            match value {
4135                "ALIGN_NONE" => Self::AlignNone,
4136                "ALIGN_DELTA" => Self::AlignDelta,
4137                "ALIGN_RATE" => Self::AlignRate,
4138                "ALIGN_INTERPOLATE" => Self::AlignInterpolate,
4139                "ALIGN_NEXT_OLDER" => Self::AlignNextOlder,
4140                "ALIGN_MIN" => Self::AlignMin,
4141                "ALIGN_MAX" => Self::AlignMax,
4142                "ALIGN_MEAN" => Self::AlignMean,
4143                "ALIGN_COUNT" => Self::AlignCount,
4144                "ALIGN_SUM" => Self::AlignSum,
4145                "ALIGN_STDDEV" => Self::AlignStddev,
4146                "ALIGN_COUNT_TRUE" => Self::AlignCountTrue,
4147                "ALIGN_COUNT_FALSE" => Self::AlignCountFalse,
4148                "ALIGN_FRACTION_TRUE" => Self::AlignFractionTrue,
4149                "ALIGN_PERCENTILE_99" => Self::AlignPercentile99,
4150                "ALIGN_PERCENTILE_95" => Self::AlignPercentile95,
4151                "ALIGN_PERCENTILE_50" => Self::AlignPercentile50,
4152                "ALIGN_PERCENTILE_05" => Self::AlignPercentile05,
4153                "ALIGN_PERCENT_CHANGE" => Self::AlignPercentChange,
4154                _ => Self::UnknownValue(aligner::UnknownValue(
4155                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4156                )),
4157            }
4158        }
4159    }
4160
4161    impl serde::ser::Serialize for Aligner {
4162        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4163        where
4164            S: serde::Serializer,
4165        {
4166            match self {
4167                Self::AlignNone => serializer.serialize_i32(0),
4168                Self::AlignDelta => serializer.serialize_i32(1),
4169                Self::AlignRate => serializer.serialize_i32(2),
4170                Self::AlignInterpolate => serializer.serialize_i32(3),
4171                Self::AlignNextOlder => serializer.serialize_i32(4),
4172                Self::AlignMin => serializer.serialize_i32(10),
4173                Self::AlignMax => serializer.serialize_i32(11),
4174                Self::AlignMean => serializer.serialize_i32(12),
4175                Self::AlignCount => serializer.serialize_i32(13),
4176                Self::AlignSum => serializer.serialize_i32(14),
4177                Self::AlignStddev => serializer.serialize_i32(15),
4178                Self::AlignCountTrue => serializer.serialize_i32(16),
4179                Self::AlignCountFalse => serializer.serialize_i32(24),
4180                Self::AlignFractionTrue => serializer.serialize_i32(17),
4181                Self::AlignPercentile99 => serializer.serialize_i32(18),
4182                Self::AlignPercentile95 => serializer.serialize_i32(19),
4183                Self::AlignPercentile50 => serializer.serialize_i32(20),
4184                Self::AlignPercentile05 => serializer.serialize_i32(21),
4185                Self::AlignPercentChange => serializer.serialize_i32(23),
4186                Self::UnknownValue(u) => u.0.serialize(serializer),
4187            }
4188        }
4189    }
4190
4191    impl<'de> serde::de::Deserialize<'de> for Aligner {
4192        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4193        where
4194            D: serde::Deserializer<'de>,
4195        {
4196            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Aligner>::new(
4197                ".google.monitoring.v3.Aggregation.Aligner",
4198            ))
4199        }
4200    }
4201
4202    /// A Reducer operation describes how to aggregate data points from multiple
4203    /// time series into a single time series, where the value of each data point
4204    /// in the resulting series is a function of all the already aligned values in
4205    /// the input time series.
4206    ///
4207    /// # Working with unknown values
4208    ///
4209    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4210    /// additional enum variants at any time. Adding new variants is not considered
4211    /// a breaking change. Applications should write their code in anticipation of:
4212    ///
4213    /// - New values appearing in future releases of the client library, **and**
4214    /// - New values received dynamically, without application changes.
4215    ///
4216    /// Please consult the [Working with enums] section in the user guide for some
4217    /// guidelines.
4218    ///
4219    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4220    #[derive(Clone, Debug, PartialEq)]
4221    #[non_exhaustive]
4222    pub enum Reducer {
4223        /// No cross-time series reduction. The output of the `Aligner` is
4224        /// returned.
4225        ReduceNone,
4226        /// Reduce by computing the mean value across time series for each
4227        /// alignment period. This reducer is valid for
4228        /// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and
4229        /// [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with
4230        /// numeric or distribution values. The `value_type` of the output is
4231        /// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
4232        ///
4233        /// [google.api.MetricDescriptor.MetricKind.DELTA]: api::model::metric_descriptor::MetricKind::Delta
4234        /// [google.api.MetricDescriptor.MetricKind.GAUGE]: api::model::metric_descriptor::MetricKind::Gauge
4235        /// [google.api.MetricDescriptor.ValueType.DOUBLE]: api::model::metric_descriptor::ValueType::Double
4236        ReduceMean,
4237        /// Reduce by computing the minimum value across time series for each
4238        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
4239        /// with numeric values. The `value_type` of the output is the same as the
4240        /// `value_type` of the input.
4241        ReduceMin,
4242        /// Reduce by computing the maximum value across time series for each
4243        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
4244        /// with numeric values. The `value_type` of the output is the same as the
4245        /// `value_type` of the input.
4246        ReduceMax,
4247        /// Reduce by computing the sum across time series for each
4248        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
4249        /// with numeric and distribution values. The `value_type` of the output is
4250        /// the same as the `value_type` of the input.
4251        ReduceSum,
4252        /// Reduce by computing the standard deviation across time series
4253        /// for each alignment period. This reducer is valid for `DELTA` and
4254        /// `GAUGE` metrics with numeric or distribution values. The `value_type`
4255        /// of the output is `DOUBLE`.
4256        ReduceStddev,
4257        /// Reduce by computing the number of data points across time series
4258        /// for each alignment period. This reducer is valid for `DELTA` and
4259        /// `GAUGE` metrics of numeric, Boolean, distribution, and string
4260        /// `value_type`. The `value_type` of the output is `INT64`.
4261        ReduceCount,
4262        /// Reduce by computing the number of `True`-valued data points across time
4263        /// series for each alignment period. This reducer is valid for `DELTA` and
4264        /// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
4265        /// is `INT64`.
4266        ReduceCountTrue,
4267        /// Reduce by computing the number of `False`-valued data points across time
4268        /// series for each alignment period. This reducer is valid for `DELTA` and
4269        /// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
4270        /// is `INT64`.
4271        ReduceCountFalse,
4272        /// Reduce by computing the ratio of the number of `True`-valued data points
4273        /// to the total number of data points for each alignment period. This
4274        /// reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`.
4275        /// The output value is in the range [0.0, 1.0] and has `value_type`
4276        /// `DOUBLE`.
4277        ReduceFractionTrue,
4278        /// Reduce by computing the [99th
4279        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
4280        /// across time series for each alignment period. This reducer is valid for
4281        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
4282        /// of the output is `DOUBLE`.
4283        ReducePercentile99,
4284        /// Reduce by computing the [95th
4285        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
4286        /// across time series for each alignment period. This reducer is valid for
4287        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
4288        /// of the output is `DOUBLE`.
4289        ReducePercentile95,
4290        /// Reduce by computing the [50th
4291        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
4292        /// across time series for each alignment period. This reducer is valid for
4293        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
4294        /// of the output is `DOUBLE`.
4295        ReducePercentile50,
4296        /// Reduce by computing the [5th
4297        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
4298        /// across time series for each alignment period. This reducer is valid for
4299        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
4300        /// of the output is `DOUBLE`.
4301        ReducePercentile05,
4302        /// If set, the enum was initialized with an unknown value.
4303        ///
4304        /// Applications can examine the value using [Reducer::value] or
4305        /// [Reducer::name].
4306        UnknownValue(reducer::UnknownValue),
4307    }
4308
4309    #[doc(hidden)]
4310    pub mod reducer {
4311        #[allow(unused_imports)]
4312        use super::*;
4313        #[derive(Clone, Debug, PartialEq)]
4314        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4315    }
4316
4317    impl Reducer {
4318        /// Gets the enum value.
4319        ///
4320        /// Returns `None` if the enum contains an unknown value deserialized from
4321        /// the string representation of enums.
4322        pub fn value(&self) -> std::option::Option<i32> {
4323            match self {
4324                Self::ReduceNone => std::option::Option::Some(0),
4325                Self::ReduceMean => std::option::Option::Some(1),
4326                Self::ReduceMin => std::option::Option::Some(2),
4327                Self::ReduceMax => std::option::Option::Some(3),
4328                Self::ReduceSum => std::option::Option::Some(4),
4329                Self::ReduceStddev => std::option::Option::Some(5),
4330                Self::ReduceCount => std::option::Option::Some(6),
4331                Self::ReduceCountTrue => std::option::Option::Some(7),
4332                Self::ReduceCountFalse => std::option::Option::Some(15),
4333                Self::ReduceFractionTrue => std::option::Option::Some(8),
4334                Self::ReducePercentile99 => std::option::Option::Some(9),
4335                Self::ReducePercentile95 => std::option::Option::Some(10),
4336                Self::ReducePercentile50 => std::option::Option::Some(11),
4337                Self::ReducePercentile05 => std::option::Option::Some(12),
4338                Self::UnknownValue(u) => u.0.value(),
4339            }
4340        }
4341
4342        /// Gets the enum value as a string.
4343        ///
4344        /// Returns `None` if the enum contains an unknown value deserialized from
4345        /// the integer representation of enums.
4346        pub fn name(&self) -> std::option::Option<&str> {
4347            match self {
4348                Self::ReduceNone => std::option::Option::Some("REDUCE_NONE"),
4349                Self::ReduceMean => std::option::Option::Some("REDUCE_MEAN"),
4350                Self::ReduceMin => std::option::Option::Some("REDUCE_MIN"),
4351                Self::ReduceMax => std::option::Option::Some("REDUCE_MAX"),
4352                Self::ReduceSum => std::option::Option::Some("REDUCE_SUM"),
4353                Self::ReduceStddev => std::option::Option::Some("REDUCE_STDDEV"),
4354                Self::ReduceCount => std::option::Option::Some("REDUCE_COUNT"),
4355                Self::ReduceCountTrue => std::option::Option::Some("REDUCE_COUNT_TRUE"),
4356                Self::ReduceCountFalse => std::option::Option::Some("REDUCE_COUNT_FALSE"),
4357                Self::ReduceFractionTrue => std::option::Option::Some("REDUCE_FRACTION_TRUE"),
4358                Self::ReducePercentile99 => std::option::Option::Some("REDUCE_PERCENTILE_99"),
4359                Self::ReducePercentile95 => std::option::Option::Some("REDUCE_PERCENTILE_95"),
4360                Self::ReducePercentile50 => std::option::Option::Some("REDUCE_PERCENTILE_50"),
4361                Self::ReducePercentile05 => std::option::Option::Some("REDUCE_PERCENTILE_05"),
4362                Self::UnknownValue(u) => u.0.name(),
4363            }
4364        }
4365    }
4366
4367    impl std::default::Default for Reducer {
4368        fn default() -> Self {
4369            use std::convert::From;
4370            Self::from(0)
4371        }
4372    }
4373
4374    impl std::fmt::Display for Reducer {
4375        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4376            wkt::internal::display_enum(f, self.name(), self.value())
4377        }
4378    }
4379
4380    impl std::convert::From<i32> for Reducer {
4381        fn from(value: i32) -> Self {
4382            match value {
4383                0 => Self::ReduceNone,
4384                1 => Self::ReduceMean,
4385                2 => Self::ReduceMin,
4386                3 => Self::ReduceMax,
4387                4 => Self::ReduceSum,
4388                5 => Self::ReduceStddev,
4389                6 => Self::ReduceCount,
4390                7 => Self::ReduceCountTrue,
4391                8 => Self::ReduceFractionTrue,
4392                9 => Self::ReducePercentile99,
4393                10 => Self::ReducePercentile95,
4394                11 => Self::ReducePercentile50,
4395                12 => Self::ReducePercentile05,
4396                15 => Self::ReduceCountFalse,
4397                _ => Self::UnknownValue(reducer::UnknownValue(
4398                    wkt::internal::UnknownEnumValue::Integer(value),
4399                )),
4400            }
4401        }
4402    }
4403
4404    impl std::convert::From<&str> for Reducer {
4405        fn from(value: &str) -> Self {
4406            use std::string::ToString;
4407            match value {
4408                "REDUCE_NONE" => Self::ReduceNone,
4409                "REDUCE_MEAN" => Self::ReduceMean,
4410                "REDUCE_MIN" => Self::ReduceMin,
4411                "REDUCE_MAX" => Self::ReduceMax,
4412                "REDUCE_SUM" => Self::ReduceSum,
4413                "REDUCE_STDDEV" => Self::ReduceStddev,
4414                "REDUCE_COUNT" => Self::ReduceCount,
4415                "REDUCE_COUNT_TRUE" => Self::ReduceCountTrue,
4416                "REDUCE_COUNT_FALSE" => Self::ReduceCountFalse,
4417                "REDUCE_FRACTION_TRUE" => Self::ReduceFractionTrue,
4418                "REDUCE_PERCENTILE_99" => Self::ReducePercentile99,
4419                "REDUCE_PERCENTILE_95" => Self::ReducePercentile95,
4420                "REDUCE_PERCENTILE_50" => Self::ReducePercentile50,
4421                "REDUCE_PERCENTILE_05" => Self::ReducePercentile05,
4422                _ => Self::UnknownValue(reducer::UnknownValue(
4423                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4424                )),
4425            }
4426        }
4427    }
4428
4429    impl serde::ser::Serialize for Reducer {
4430        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4431        where
4432            S: serde::Serializer,
4433        {
4434            match self {
4435                Self::ReduceNone => serializer.serialize_i32(0),
4436                Self::ReduceMean => serializer.serialize_i32(1),
4437                Self::ReduceMin => serializer.serialize_i32(2),
4438                Self::ReduceMax => serializer.serialize_i32(3),
4439                Self::ReduceSum => serializer.serialize_i32(4),
4440                Self::ReduceStddev => serializer.serialize_i32(5),
4441                Self::ReduceCount => serializer.serialize_i32(6),
4442                Self::ReduceCountTrue => serializer.serialize_i32(7),
4443                Self::ReduceCountFalse => serializer.serialize_i32(15),
4444                Self::ReduceFractionTrue => serializer.serialize_i32(8),
4445                Self::ReducePercentile99 => serializer.serialize_i32(9),
4446                Self::ReducePercentile95 => serializer.serialize_i32(10),
4447                Self::ReducePercentile50 => serializer.serialize_i32(11),
4448                Self::ReducePercentile05 => serializer.serialize_i32(12),
4449                Self::UnknownValue(u) => u.0.serialize(serializer),
4450            }
4451        }
4452    }
4453
4454    impl<'de> serde::de::Deserialize<'de> for Reducer {
4455        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4456        where
4457            D: serde::Deserializer<'de>,
4458        {
4459            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reducer>::new(
4460                ".google.monitoring.v3.Aggregation.Reducer",
4461            ))
4462        }
4463    }
4464}
4465
4466/// A set of (label, value) pairs that were removed from a Distribution
4467/// time series during aggregation and then added as an attachment to a
4468/// Distribution.Exemplar.
4469///
4470/// The full label set for the exemplars is constructed by using the dropped
4471/// pairs in combination with the label values that remain on the aggregated
4472/// Distribution time series. The constructed full label set can be used to
4473/// identify the specific entity, such as the instance or job, which might be
4474/// contributing to a long-tail. However, with dropped labels, the storage
4475/// requirements are reduced because only the aggregated distribution values for
4476/// a large group of time series are stored.
4477///
4478/// Note that there are no guarantees on ordering of the labels from
4479/// exemplar-to-exemplar and from distribution-to-distribution in the same
4480/// stream, and there may be duplicates.  It is up to clients to resolve any
4481/// ambiguities.
4482#[derive(Clone, Default, PartialEq)]
4483#[non_exhaustive]
4484pub struct DroppedLabels {
4485    /// Map from label to its value, for all labels dropped in any aggregation.
4486    pub label: std::collections::HashMap<std::string::String, std::string::String>,
4487
4488    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4489}
4490
4491impl DroppedLabels {
4492    pub fn new() -> Self {
4493        std::default::Default::default()
4494    }
4495
4496    /// Sets the value of [label][crate::model::DroppedLabels::label].
4497    pub fn set_label<T, K, V>(mut self, v: T) -> Self
4498    where
4499        T: std::iter::IntoIterator<Item = (K, V)>,
4500        K: std::convert::Into<std::string::String>,
4501        V: std::convert::Into<std::string::String>,
4502    {
4503        use std::iter::Iterator;
4504        self.label = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4505        self
4506    }
4507}
4508
4509impl wkt::message::Message for DroppedLabels {
4510    fn typename() -> &'static str {
4511        "type.googleapis.com/google.monitoring.v3.DroppedLabels"
4512    }
4513}
4514
4515/// The description of a dynamic collection of monitored resources. Each group
4516/// has a filter that is matched against monitored resources and their associated
4517/// metadata. If a group's filter matches an available monitored resource, then
4518/// that resource is a member of that group.  Groups can contain any number of
4519/// monitored resources, and each monitored resource can be a member of any
4520/// number of groups.
4521///
4522/// Groups can be nested in parent-child hierarchies. The `parentName` field
4523/// identifies an optional parent for each group.  If a group has a parent, then
4524/// the only monitored resources available to be matched by the group's filter
4525/// are the resources contained in the parent group.  In other words, a group
4526/// contains the monitored resources that match its filter and the filters of all
4527/// the group's ancestors.  A group without a parent can contain any monitored
4528/// resource.
4529///
4530/// For example, consider an infrastructure running a set of instances with two
4531/// user-defined tags: `"environment"` and `"role"`. A parent group has a filter,
4532/// `environment="production"`.  A child of that parent group has a filter,
4533/// `role="transcoder"`.  The parent group contains all instances in the
4534/// production environment, regardless of their roles.  The child group contains
4535/// instances that have the transcoder role *and* are in the production
4536/// environment.
4537///
4538/// The monitored resources contained in a group can change at any moment,
4539/// depending on what resources exist and what filters are associated with the
4540/// group and its ancestors.
4541#[derive(Clone, Default, PartialEq)]
4542#[non_exhaustive]
4543pub struct Group {
4544    /// Output only. The name of this group. The format is:
4545    ///
4546    /// ```norust
4547    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4548    /// ```
4549    ///
4550    /// When creating a group, this field is ignored and a new name is created
4551    /// consisting of the project specified in the call to `CreateGroup`
4552    /// and a unique `[GROUP_ID]` that is generated automatically.
4553    pub name: std::string::String,
4554
4555    /// A user-assigned name for this group, used only for display purposes.
4556    pub display_name: std::string::String,
4557
4558    /// The name of the group's parent, if it has one. The format is:
4559    ///
4560    /// ```norust
4561    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4562    /// ```
4563    ///
4564    /// For groups with no parent, `parent_name` is the empty string, `""`.
4565    pub parent_name: std::string::String,
4566
4567    /// The filter used to determine which monitored resources belong to this
4568    /// group.
4569    pub filter: std::string::String,
4570
4571    /// If true, the members of this group are considered to be a cluster.
4572    /// The system can perform additional analysis on groups that are clusters.
4573    pub is_cluster: bool,
4574
4575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4576}
4577
4578impl Group {
4579    pub fn new() -> Self {
4580        std::default::Default::default()
4581    }
4582
4583    /// Sets the value of [name][crate::model::Group::name].
4584    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4585        self.name = v.into();
4586        self
4587    }
4588
4589    /// Sets the value of [display_name][crate::model::Group::display_name].
4590    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4591        self.display_name = v.into();
4592        self
4593    }
4594
4595    /// Sets the value of [parent_name][crate::model::Group::parent_name].
4596    pub fn set_parent_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4597        self.parent_name = v.into();
4598        self
4599    }
4600
4601    /// Sets the value of [filter][crate::model::Group::filter].
4602    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4603        self.filter = v.into();
4604        self
4605    }
4606
4607    /// Sets the value of [is_cluster][crate::model::Group::is_cluster].
4608    pub fn set_is_cluster<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4609        self.is_cluster = v.into();
4610        self
4611    }
4612}
4613
4614impl wkt::message::Message for Group {
4615    fn typename() -> &'static str {
4616        "type.googleapis.com/google.monitoring.v3.Group"
4617    }
4618}
4619
4620/// The `ListGroup` request.
4621#[derive(Clone, Default, PartialEq)]
4622#[non_exhaustive]
4623pub struct ListGroupsRequest {
4624    /// Required. The
4625    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
4626    /// groups are to be listed. The format is:
4627    ///
4628    /// ```norust
4629    /// projects/[PROJECT_ID_OR_NUMBER]
4630    /// ```
4631    pub name: std::string::String,
4632
4633    /// A positive number that is the maximum number of results to return.
4634    pub page_size: i32,
4635
4636    /// If this field is not empty then it must contain the `next_page_token` value
4637    /// returned by a previous call to this method.  Using this field causes the
4638    /// method to return additional results from the previous method call.
4639    pub page_token: std::string::String,
4640
4641    /// An optional filter consisting of a single group name.  The filters limit
4642    /// the groups returned based on their parent-child relationship with the
4643    /// specified group. If no filter is specified, all groups are returned.
4644    pub filter: std::option::Option<crate::model::list_groups_request::Filter>,
4645
4646    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4647}
4648
4649impl ListGroupsRequest {
4650    pub fn new() -> Self {
4651        std::default::Default::default()
4652    }
4653
4654    /// Sets the value of [name][crate::model::ListGroupsRequest::name].
4655    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4656        self.name = v.into();
4657        self
4658    }
4659
4660    /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
4661    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4662        self.page_size = v.into();
4663        self
4664    }
4665
4666    /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
4667    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4668        self.page_token = v.into();
4669        self
4670    }
4671
4672    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
4673    ///
4674    /// Note that all the setters affecting `filter` are mutually
4675    /// exclusive.
4676    pub fn set_filter<
4677        T: std::convert::Into<std::option::Option<crate::model::list_groups_request::Filter>>,
4678    >(
4679        mut self,
4680        v: T,
4681    ) -> Self {
4682        self.filter = v.into();
4683        self
4684    }
4685
4686    /// The value of [filter][crate::model::ListGroupsRequest::filter]
4687    /// if it holds a `ChildrenOfGroup`, `None` if the field is not set or
4688    /// holds a different branch.
4689    pub fn children_of_group(&self) -> std::option::Option<&std::string::String> {
4690        #[allow(unreachable_patterns)]
4691        self.filter.as_ref().and_then(|v| match v {
4692            crate::model::list_groups_request::Filter::ChildrenOfGroup(v) => {
4693                std::option::Option::Some(v)
4694            }
4695            _ => std::option::Option::None,
4696        })
4697    }
4698
4699    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
4700    /// to hold a `ChildrenOfGroup`.
4701    ///
4702    /// Note that all the setters affecting `filter` are
4703    /// mutually exclusive.
4704    pub fn set_children_of_group<T: std::convert::Into<std::string::String>>(
4705        mut self,
4706        v: T,
4707    ) -> Self {
4708        self.filter = std::option::Option::Some(
4709            crate::model::list_groups_request::Filter::ChildrenOfGroup(v.into()),
4710        );
4711        self
4712    }
4713
4714    /// The value of [filter][crate::model::ListGroupsRequest::filter]
4715    /// if it holds a `AncestorsOfGroup`, `None` if the field is not set or
4716    /// holds a different branch.
4717    pub fn ancestors_of_group(&self) -> std::option::Option<&std::string::String> {
4718        #[allow(unreachable_patterns)]
4719        self.filter.as_ref().and_then(|v| match v {
4720            crate::model::list_groups_request::Filter::AncestorsOfGroup(v) => {
4721                std::option::Option::Some(v)
4722            }
4723            _ => std::option::Option::None,
4724        })
4725    }
4726
4727    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
4728    /// to hold a `AncestorsOfGroup`.
4729    ///
4730    /// Note that all the setters affecting `filter` are
4731    /// mutually exclusive.
4732    pub fn set_ancestors_of_group<T: std::convert::Into<std::string::String>>(
4733        mut self,
4734        v: T,
4735    ) -> Self {
4736        self.filter = std::option::Option::Some(
4737            crate::model::list_groups_request::Filter::AncestorsOfGroup(v.into()),
4738        );
4739        self
4740    }
4741
4742    /// The value of [filter][crate::model::ListGroupsRequest::filter]
4743    /// if it holds a `DescendantsOfGroup`, `None` if the field is not set or
4744    /// holds a different branch.
4745    pub fn descendants_of_group(&self) -> std::option::Option<&std::string::String> {
4746        #[allow(unreachable_patterns)]
4747        self.filter.as_ref().and_then(|v| match v {
4748            crate::model::list_groups_request::Filter::DescendantsOfGroup(v) => {
4749                std::option::Option::Some(v)
4750            }
4751            _ => std::option::Option::None,
4752        })
4753    }
4754
4755    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
4756    /// to hold a `DescendantsOfGroup`.
4757    ///
4758    /// Note that all the setters affecting `filter` are
4759    /// mutually exclusive.
4760    pub fn set_descendants_of_group<T: std::convert::Into<std::string::String>>(
4761        mut self,
4762        v: T,
4763    ) -> Self {
4764        self.filter = std::option::Option::Some(
4765            crate::model::list_groups_request::Filter::DescendantsOfGroup(v.into()),
4766        );
4767        self
4768    }
4769}
4770
4771impl wkt::message::Message for ListGroupsRequest {
4772    fn typename() -> &'static str {
4773        "type.googleapis.com/google.monitoring.v3.ListGroupsRequest"
4774    }
4775}
4776
4777/// Defines additional types related to [ListGroupsRequest].
4778pub mod list_groups_request {
4779    #[allow(unused_imports)]
4780    use super::*;
4781
4782    /// An optional filter consisting of a single group name.  The filters limit
4783    /// the groups returned based on their parent-child relationship with the
4784    /// specified group. If no filter is specified, all groups are returned.
4785    #[derive(Clone, Debug, PartialEq)]
4786    #[non_exhaustive]
4787    pub enum Filter {
4788        /// A group name. The format is:
4789        ///
4790        /// ```norust
4791        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4792        /// ```
4793        ///
4794        /// Returns groups whose `parent_name` field contains the group
4795        /// name.  If no groups have this parent, the results are empty.
4796        ChildrenOfGroup(std::string::String),
4797        /// A group name. The format is:
4798        ///
4799        /// ```norust
4800        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4801        /// ```
4802        ///
4803        /// Returns groups that are ancestors of the specified group.
4804        /// The groups are returned in order, starting with the immediate parent and
4805        /// ending with the most distant ancestor.  If the specified group has no
4806        /// immediate parent, the results are empty.
4807        AncestorsOfGroup(std::string::String),
4808        /// A group name. The format is:
4809        ///
4810        /// ```norust
4811        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4812        /// ```
4813        ///
4814        /// Returns the descendants of the specified group.  This is a superset of
4815        /// the results returned by the `children_of_group` filter, and includes
4816        /// children-of-children, and so forth.
4817        DescendantsOfGroup(std::string::String),
4818    }
4819}
4820
4821/// The `ListGroups` response.
4822#[derive(Clone, Default, PartialEq)]
4823#[non_exhaustive]
4824pub struct ListGroupsResponse {
4825    /// The groups that match the specified filters.
4826    pub group: std::vec::Vec<crate::model::Group>,
4827
4828    /// If there are more results than have been returned, then this field is set
4829    /// to a non-empty value.  To see the additional results,
4830    /// use that value as `page_token` in the next call to this method.
4831    pub next_page_token: std::string::String,
4832
4833    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4834}
4835
4836impl ListGroupsResponse {
4837    pub fn new() -> Self {
4838        std::default::Default::default()
4839    }
4840
4841    /// Sets the value of [group][crate::model::ListGroupsResponse::group].
4842    pub fn set_group<T, V>(mut self, v: T) -> Self
4843    where
4844        T: std::iter::IntoIterator<Item = V>,
4845        V: std::convert::Into<crate::model::Group>,
4846    {
4847        use std::iter::Iterator;
4848        self.group = v.into_iter().map(|i| i.into()).collect();
4849        self
4850    }
4851
4852    /// Sets the value of [next_page_token][crate::model::ListGroupsResponse::next_page_token].
4853    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4854        self.next_page_token = v.into();
4855        self
4856    }
4857}
4858
4859impl wkt::message::Message for ListGroupsResponse {
4860    fn typename() -> &'static str {
4861        "type.googleapis.com/google.monitoring.v3.ListGroupsResponse"
4862    }
4863}
4864
4865#[doc(hidden)]
4866impl gax::paginator::internal::PageableResponse for ListGroupsResponse {
4867    type PageItem = crate::model::Group;
4868
4869    fn items(self) -> std::vec::Vec<Self::PageItem> {
4870        self.group
4871    }
4872
4873    fn next_page_token(&self) -> std::string::String {
4874        use std::clone::Clone;
4875        self.next_page_token.clone()
4876    }
4877}
4878
4879/// The `GetGroup` request.
4880#[derive(Clone, Default, PartialEq)]
4881#[non_exhaustive]
4882pub struct GetGroupRequest {
4883    /// Required. The group to retrieve. The format is:
4884    ///
4885    /// ```norust
4886    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
4887    /// ```
4888    pub name: std::string::String,
4889
4890    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4891}
4892
4893impl GetGroupRequest {
4894    pub fn new() -> Self {
4895        std::default::Default::default()
4896    }
4897
4898    /// Sets the value of [name][crate::model::GetGroupRequest::name].
4899    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4900        self.name = v.into();
4901        self
4902    }
4903}
4904
4905impl wkt::message::Message for GetGroupRequest {
4906    fn typename() -> &'static str {
4907        "type.googleapis.com/google.monitoring.v3.GetGroupRequest"
4908    }
4909}
4910
4911/// The `CreateGroup` request.
4912#[derive(Clone, Default, PartialEq)]
4913#[non_exhaustive]
4914pub struct CreateGroupRequest {
4915    /// Required. The
4916    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
4917    /// to create the group. The format is:
4918    ///
4919    /// ```norust
4920    /// projects/[PROJECT_ID_OR_NUMBER]
4921    /// ```
4922    pub name: std::string::String,
4923
4924    /// Required. A group definition. It is an error to define the `name` field
4925    /// because the system assigns the name.
4926    pub group: std::option::Option<crate::model::Group>,
4927
4928    /// If true, validate this request but do not create the group.
4929    pub validate_only: bool,
4930
4931    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4932}
4933
4934impl CreateGroupRequest {
4935    pub fn new() -> Self {
4936        std::default::Default::default()
4937    }
4938
4939    /// Sets the value of [name][crate::model::CreateGroupRequest::name].
4940    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4941        self.name = v.into();
4942        self
4943    }
4944
4945    /// Sets the value of [group][crate::model::CreateGroupRequest::group].
4946    pub fn set_group<T>(mut self, v: T) -> Self
4947    where
4948        T: std::convert::Into<crate::model::Group>,
4949    {
4950        self.group = std::option::Option::Some(v.into());
4951        self
4952    }
4953
4954    /// Sets or clears the value of [group][crate::model::CreateGroupRequest::group].
4955    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
4956    where
4957        T: std::convert::Into<crate::model::Group>,
4958    {
4959        self.group = v.map(|x| x.into());
4960        self
4961    }
4962
4963    /// Sets the value of [validate_only][crate::model::CreateGroupRequest::validate_only].
4964    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4965        self.validate_only = v.into();
4966        self
4967    }
4968}
4969
4970impl wkt::message::Message for CreateGroupRequest {
4971    fn typename() -> &'static str {
4972        "type.googleapis.com/google.monitoring.v3.CreateGroupRequest"
4973    }
4974}
4975
4976/// The `UpdateGroup` request.
4977#[derive(Clone, Default, PartialEq)]
4978#[non_exhaustive]
4979pub struct UpdateGroupRequest {
4980    /// Required. The new definition of the group.  All fields of the existing
4981    /// group, excepting `name`, are replaced with the corresponding fields of this
4982    /// group.
4983    pub group: std::option::Option<crate::model::Group>,
4984
4985    /// If true, validate this request but do not update the existing group.
4986    pub validate_only: bool,
4987
4988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4989}
4990
4991impl UpdateGroupRequest {
4992    pub fn new() -> Self {
4993        std::default::Default::default()
4994    }
4995
4996    /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
4997    pub fn set_group<T>(mut self, v: T) -> Self
4998    where
4999        T: std::convert::Into<crate::model::Group>,
5000    {
5001        self.group = std::option::Option::Some(v.into());
5002        self
5003    }
5004
5005    /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
5006    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
5007    where
5008        T: std::convert::Into<crate::model::Group>,
5009    {
5010        self.group = v.map(|x| x.into());
5011        self
5012    }
5013
5014    /// Sets the value of [validate_only][crate::model::UpdateGroupRequest::validate_only].
5015    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5016        self.validate_only = v.into();
5017        self
5018    }
5019}
5020
5021impl wkt::message::Message for UpdateGroupRequest {
5022    fn typename() -> &'static str {
5023        "type.googleapis.com/google.monitoring.v3.UpdateGroupRequest"
5024    }
5025}
5026
5027/// The `DeleteGroup` request. The default behavior is to be able to delete a
5028/// single group without any descendants.
5029#[derive(Clone, Default, PartialEq)]
5030#[non_exhaustive]
5031pub struct DeleteGroupRequest {
5032    /// Required. The group to delete. The format is:
5033    ///
5034    /// ```norust
5035    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5036    /// ```
5037    pub name: std::string::String,
5038
5039    /// If this field is true, then the request means to delete a group with all
5040    /// its descendants. Otherwise, the request means to delete a group only when
5041    /// it has no descendants. The default value is false.
5042    pub recursive: bool,
5043
5044    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5045}
5046
5047impl DeleteGroupRequest {
5048    pub fn new() -> Self {
5049        std::default::Default::default()
5050    }
5051
5052    /// Sets the value of [name][crate::model::DeleteGroupRequest::name].
5053    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5054        self.name = v.into();
5055        self
5056    }
5057
5058    /// Sets the value of [recursive][crate::model::DeleteGroupRequest::recursive].
5059    pub fn set_recursive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5060        self.recursive = v.into();
5061        self
5062    }
5063}
5064
5065impl wkt::message::Message for DeleteGroupRequest {
5066    fn typename() -> &'static str {
5067        "type.googleapis.com/google.monitoring.v3.DeleteGroupRequest"
5068    }
5069}
5070
5071/// The `ListGroupMembers` request.
5072#[derive(Clone, Default, PartialEq)]
5073#[non_exhaustive]
5074pub struct ListGroupMembersRequest {
5075    /// Required. The group whose members are listed. The format is:
5076    ///
5077    /// ```norust
5078    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5079    /// ```
5080    pub name: std::string::String,
5081
5082    /// A positive number that is the maximum number of results to return.
5083    pub page_size: i32,
5084
5085    /// If this field is not empty then it must contain the `next_page_token` value
5086    /// returned by a previous call to this method.  Using this field causes the
5087    /// method to return additional results from the previous method call.
5088    pub page_token: std::string::String,
5089
5090    /// An optional [list
5091    /// filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
5092    /// describing the members to be returned.  The filter may reference the type,
5093    /// labels, and metadata of monitored resources that comprise the group. For
5094    /// example, to return only resources representing Compute Engine VM instances,
5095    /// use this filter:
5096    ///
5097    /// ```norust
5098    /// `resource.type = "gce_instance"`
5099    /// ```
5100    pub filter: std::string::String,
5101
5102    /// An optional time interval for which results should be returned. Only
5103    /// members that were part of the group during the specified interval are
5104    /// included in the response.  If no interval is provided then the group
5105    /// membership over the last minute is returned.
5106    pub interval: std::option::Option<crate::model::TimeInterval>,
5107
5108    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5109}
5110
5111impl ListGroupMembersRequest {
5112    pub fn new() -> Self {
5113        std::default::Default::default()
5114    }
5115
5116    /// Sets the value of [name][crate::model::ListGroupMembersRequest::name].
5117    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5118        self.name = v.into();
5119        self
5120    }
5121
5122    /// Sets the value of [page_size][crate::model::ListGroupMembersRequest::page_size].
5123    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5124        self.page_size = v.into();
5125        self
5126    }
5127
5128    /// Sets the value of [page_token][crate::model::ListGroupMembersRequest::page_token].
5129    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5130        self.page_token = v.into();
5131        self
5132    }
5133
5134    /// Sets the value of [filter][crate::model::ListGroupMembersRequest::filter].
5135    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5136        self.filter = v.into();
5137        self
5138    }
5139
5140    /// Sets the value of [interval][crate::model::ListGroupMembersRequest::interval].
5141    pub fn set_interval<T>(mut self, v: T) -> Self
5142    where
5143        T: std::convert::Into<crate::model::TimeInterval>,
5144    {
5145        self.interval = std::option::Option::Some(v.into());
5146        self
5147    }
5148
5149    /// Sets or clears the value of [interval][crate::model::ListGroupMembersRequest::interval].
5150    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
5151    where
5152        T: std::convert::Into<crate::model::TimeInterval>,
5153    {
5154        self.interval = v.map(|x| x.into());
5155        self
5156    }
5157}
5158
5159impl wkt::message::Message for ListGroupMembersRequest {
5160    fn typename() -> &'static str {
5161        "type.googleapis.com/google.monitoring.v3.ListGroupMembersRequest"
5162    }
5163}
5164
5165/// The `ListGroupMembers` response.
5166#[derive(Clone, Default, PartialEq)]
5167#[non_exhaustive]
5168pub struct ListGroupMembersResponse {
5169    /// A set of monitored resources in the group.
5170    pub members: std::vec::Vec<api::model::MonitoredResource>,
5171
5172    /// If there are more results than have been returned, then this field is
5173    /// set to a non-empty value.  To see the additional results, use that value as
5174    /// `page_token` in the next call to this method.
5175    pub next_page_token: std::string::String,
5176
5177    /// The total number of elements matching this request.
5178    pub total_size: i32,
5179
5180    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5181}
5182
5183impl ListGroupMembersResponse {
5184    pub fn new() -> Self {
5185        std::default::Default::default()
5186    }
5187
5188    /// Sets the value of [members][crate::model::ListGroupMembersResponse::members].
5189    pub fn set_members<T, V>(mut self, v: T) -> Self
5190    where
5191        T: std::iter::IntoIterator<Item = V>,
5192        V: std::convert::Into<api::model::MonitoredResource>,
5193    {
5194        use std::iter::Iterator;
5195        self.members = v.into_iter().map(|i| i.into()).collect();
5196        self
5197    }
5198
5199    /// Sets the value of [next_page_token][crate::model::ListGroupMembersResponse::next_page_token].
5200    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5201        self.next_page_token = v.into();
5202        self
5203    }
5204
5205    /// Sets the value of [total_size][crate::model::ListGroupMembersResponse::total_size].
5206    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5207        self.total_size = v.into();
5208        self
5209    }
5210}
5211
5212impl wkt::message::Message for ListGroupMembersResponse {
5213    fn typename() -> &'static str {
5214        "type.googleapis.com/google.monitoring.v3.ListGroupMembersResponse"
5215    }
5216}
5217
5218#[doc(hidden)]
5219impl gax::paginator::internal::PageableResponse for ListGroupMembersResponse {
5220    type PageItem = api::model::MonitoredResource;
5221
5222    fn items(self) -> std::vec::Vec<Self::PageItem> {
5223        self.members
5224    }
5225
5226    fn next_page_token(&self) -> std::string::String {
5227        use std::clone::Clone;
5228        self.next_page_token.clone()
5229    }
5230}
5231
5232/// A single data point in a time series.
5233#[derive(Clone, Default, PartialEq)]
5234#[non_exhaustive]
5235pub struct Point {
5236    /// The time interval to which the data point applies.  For `GAUGE` metrics,
5237    /// the start time is optional, but if it is supplied, it must equal the
5238    /// end time.  For `DELTA` metrics, the start
5239    /// and end time should specify a non-zero interval, with subsequent points
5240    /// specifying contiguous and non-overlapping intervals.  For `CUMULATIVE`
5241    /// metrics, the start and end time should specify a non-zero interval, with
5242    /// subsequent points specifying the same start time and increasing end times,
5243    /// until an event resets the cumulative value to zero and sets a new start
5244    /// time for the following points.
5245    pub interval: std::option::Option<crate::model::TimeInterval>,
5246
5247    /// The value of the data point.
5248    pub value: std::option::Option<crate::model::TypedValue>,
5249
5250    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5251}
5252
5253impl Point {
5254    pub fn new() -> Self {
5255        std::default::Default::default()
5256    }
5257
5258    /// Sets the value of [interval][crate::model::Point::interval].
5259    pub fn set_interval<T>(mut self, v: T) -> Self
5260    where
5261        T: std::convert::Into<crate::model::TimeInterval>,
5262    {
5263        self.interval = std::option::Option::Some(v.into());
5264        self
5265    }
5266
5267    /// Sets or clears the value of [interval][crate::model::Point::interval].
5268    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
5269    where
5270        T: std::convert::Into<crate::model::TimeInterval>,
5271    {
5272        self.interval = v.map(|x| x.into());
5273        self
5274    }
5275
5276    /// Sets the value of [value][crate::model::Point::value].
5277    pub fn set_value<T>(mut self, v: T) -> Self
5278    where
5279        T: std::convert::Into<crate::model::TypedValue>,
5280    {
5281        self.value = std::option::Option::Some(v.into());
5282        self
5283    }
5284
5285    /// Sets or clears the value of [value][crate::model::Point::value].
5286    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
5287    where
5288        T: std::convert::Into<crate::model::TypedValue>,
5289    {
5290        self.value = v.map(|x| x.into());
5291        self
5292    }
5293}
5294
5295impl wkt::message::Message for Point {
5296    fn typename() -> &'static str {
5297        "type.googleapis.com/google.monitoring.v3.Point"
5298    }
5299}
5300
5301/// A collection of data points that describes the time-varying values
5302/// of a metric. A time series is identified by a combination of a
5303/// fully-specified monitored resource and a fully-specified metric.
5304/// This type is used for both listing and creating time series.
5305#[derive(Clone, Default, PartialEq)]
5306#[non_exhaustive]
5307pub struct TimeSeries {
5308    /// The associated metric. A fully-specified metric used to identify the time
5309    /// series.
5310    pub metric: std::option::Option<api::model::Metric>,
5311
5312    /// The associated monitored resource.  Custom metrics can use only certain
5313    /// monitored resource types in their time series data. For more information,
5314    /// see [Monitored resources for custom
5315    /// metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
5316    pub resource: std::option::Option<api::model::MonitoredResource>,
5317
5318    /// Output only. The associated monitored resource metadata. When reading a
5319    /// time series, this field will include metadata labels that are explicitly
5320    /// named in the reduction. When creating a time series, this field is ignored.
5321    pub metadata: std::option::Option<api::model::MonitoredResourceMetadata>,
5322
5323    /// The metric kind of the time series. When listing time series, this metric
5324    /// kind might be different from the metric kind of the associated metric if
5325    /// this time series is an alignment or reduction of other time series.
5326    ///
5327    /// When creating a time series, this field is optional. If present, it must be
5328    /// the same as the metric kind of the associated metric. If the associated
5329    /// metric's descriptor must be auto-created, then this field specifies the
5330    /// metric kind of the new descriptor and must be either `GAUGE` (the default)
5331    /// or `CUMULATIVE`.
5332    pub metric_kind: api::model::metric_descriptor::MetricKind,
5333
5334    /// The value type of the time series. When listing time series, this value
5335    /// type might be different from the value type of the associated metric if
5336    /// this time series is an alignment or reduction of other time series.
5337    ///
5338    /// When creating a time series, this field is optional. If present, it must be
5339    /// the same as the type of the data in the `points` field.
5340    pub value_type: api::model::metric_descriptor::ValueType,
5341
5342    /// The data points of this time series. When listing time series, points are
5343    /// returned in reverse time order.
5344    ///
5345    /// When creating a time series, this field must contain exactly one point and
5346    /// the point's type must be the same as the value type of the associated
5347    /// metric. If the associated metric's descriptor must be auto-created, then
5348    /// the value type of the descriptor is determined by the point's type, which
5349    /// must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
5350    pub points: std::vec::Vec<crate::model::Point>,
5351
5352    /// The units in which the metric value is reported. It is only applicable
5353    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
5354    /// defines the representation of the stored metric values. This field can only
5355    /// be changed through CreateTimeSeries when it is empty.
5356    pub unit: std::string::String,
5357
5358    /// Input only. A detailed description of the time series that will be
5359    /// associated with the
5360    /// [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric.
5361    /// Once set, this field cannot be changed through CreateTimeSeries.
5362    ///
5363    /// [google.api.MetricDescriptor]: api::model::MetricDescriptor
5364    pub description: std::string::String,
5365
5366    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5367}
5368
5369impl TimeSeries {
5370    pub fn new() -> Self {
5371        std::default::Default::default()
5372    }
5373
5374    /// Sets the value of [metric][crate::model::TimeSeries::metric].
5375    pub fn set_metric<T>(mut self, v: T) -> Self
5376    where
5377        T: std::convert::Into<api::model::Metric>,
5378    {
5379        self.metric = std::option::Option::Some(v.into());
5380        self
5381    }
5382
5383    /// Sets or clears the value of [metric][crate::model::TimeSeries::metric].
5384    pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
5385    where
5386        T: std::convert::Into<api::model::Metric>,
5387    {
5388        self.metric = v.map(|x| x.into());
5389        self
5390    }
5391
5392    /// Sets the value of [resource][crate::model::TimeSeries::resource].
5393    pub fn set_resource<T>(mut self, v: T) -> Self
5394    where
5395        T: std::convert::Into<api::model::MonitoredResource>,
5396    {
5397        self.resource = std::option::Option::Some(v.into());
5398        self
5399    }
5400
5401    /// Sets or clears the value of [resource][crate::model::TimeSeries::resource].
5402    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
5403    where
5404        T: std::convert::Into<api::model::MonitoredResource>,
5405    {
5406        self.resource = v.map(|x| x.into());
5407        self
5408    }
5409
5410    /// Sets the value of [metadata][crate::model::TimeSeries::metadata].
5411    pub fn set_metadata<T>(mut self, v: T) -> Self
5412    where
5413        T: std::convert::Into<api::model::MonitoredResourceMetadata>,
5414    {
5415        self.metadata = std::option::Option::Some(v.into());
5416        self
5417    }
5418
5419    /// Sets or clears the value of [metadata][crate::model::TimeSeries::metadata].
5420    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
5421    where
5422        T: std::convert::Into<api::model::MonitoredResourceMetadata>,
5423    {
5424        self.metadata = v.map(|x| x.into());
5425        self
5426    }
5427
5428    /// Sets the value of [metric_kind][crate::model::TimeSeries::metric_kind].
5429    pub fn set_metric_kind<T: std::convert::Into<api::model::metric_descriptor::MetricKind>>(
5430        mut self,
5431        v: T,
5432    ) -> Self {
5433        self.metric_kind = v.into();
5434        self
5435    }
5436
5437    /// Sets the value of [value_type][crate::model::TimeSeries::value_type].
5438    pub fn set_value_type<T: std::convert::Into<api::model::metric_descriptor::ValueType>>(
5439        mut self,
5440        v: T,
5441    ) -> Self {
5442        self.value_type = v.into();
5443        self
5444    }
5445
5446    /// Sets the value of [points][crate::model::TimeSeries::points].
5447    pub fn set_points<T, V>(mut self, v: T) -> Self
5448    where
5449        T: std::iter::IntoIterator<Item = V>,
5450        V: std::convert::Into<crate::model::Point>,
5451    {
5452        use std::iter::Iterator;
5453        self.points = v.into_iter().map(|i| i.into()).collect();
5454        self
5455    }
5456
5457    /// Sets the value of [unit][crate::model::TimeSeries::unit].
5458    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5459        self.unit = v.into();
5460        self
5461    }
5462
5463    /// Sets the value of [description][crate::model::TimeSeries::description].
5464    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5465        self.description = v.into();
5466        self
5467    }
5468}
5469
5470impl wkt::message::Message for TimeSeries {
5471    fn typename() -> &'static str {
5472        "type.googleapis.com/google.monitoring.v3.TimeSeries"
5473    }
5474}
5475
5476/// A descriptor for the labels and points in a time series.
5477#[derive(Clone, Default, PartialEq)]
5478#[non_exhaustive]
5479pub struct TimeSeriesDescriptor {
5480    /// Descriptors for the labels.
5481    pub label_descriptors: std::vec::Vec<api::model::LabelDescriptor>,
5482
5483    /// Descriptors for the point data value columns.
5484    pub point_descriptors: std::vec::Vec<crate::model::time_series_descriptor::ValueDescriptor>,
5485
5486    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5487}
5488
5489impl TimeSeriesDescriptor {
5490    pub fn new() -> Self {
5491        std::default::Default::default()
5492    }
5493
5494    /// Sets the value of [label_descriptors][crate::model::TimeSeriesDescriptor::label_descriptors].
5495    pub fn set_label_descriptors<T, V>(mut self, v: T) -> Self
5496    where
5497        T: std::iter::IntoIterator<Item = V>,
5498        V: std::convert::Into<api::model::LabelDescriptor>,
5499    {
5500        use std::iter::Iterator;
5501        self.label_descriptors = v.into_iter().map(|i| i.into()).collect();
5502        self
5503    }
5504
5505    /// Sets the value of [point_descriptors][crate::model::TimeSeriesDescriptor::point_descriptors].
5506    pub fn set_point_descriptors<T, V>(mut self, v: T) -> Self
5507    where
5508        T: std::iter::IntoIterator<Item = V>,
5509        V: std::convert::Into<crate::model::time_series_descriptor::ValueDescriptor>,
5510    {
5511        use std::iter::Iterator;
5512        self.point_descriptors = v.into_iter().map(|i| i.into()).collect();
5513        self
5514    }
5515}
5516
5517impl wkt::message::Message for TimeSeriesDescriptor {
5518    fn typename() -> &'static str {
5519        "type.googleapis.com/google.monitoring.v3.TimeSeriesDescriptor"
5520    }
5521}
5522
5523/// Defines additional types related to [TimeSeriesDescriptor].
5524pub mod time_series_descriptor {
5525    #[allow(unused_imports)]
5526    use super::*;
5527
5528    /// A descriptor for the value columns in a data point.
5529    #[derive(Clone, Default, PartialEq)]
5530    #[non_exhaustive]
5531    pub struct ValueDescriptor {
5532        /// The value key.
5533        pub key: std::string::String,
5534
5535        /// The value type.
5536        pub value_type: api::model::metric_descriptor::ValueType,
5537
5538        /// The value stream kind.
5539        pub metric_kind: api::model::metric_descriptor::MetricKind,
5540
5541        /// The unit in which `time_series` point values are reported. `unit`
5542        /// follows the UCUM format for units as seen in
5543        /// <https://unitsofmeasure.org/ucum.html>.
5544        /// `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION.
5545        pub unit: std::string::String,
5546
5547        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5548    }
5549
5550    impl ValueDescriptor {
5551        pub fn new() -> Self {
5552            std::default::Default::default()
5553        }
5554
5555        /// Sets the value of [key][crate::model::time_series_descriptor::ValueDescriptor::key].
5556        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5557            self.key = v.into();
5558            self
5559        }
5560
5561        /// Sets the value of [value_type][crate::model::time_series_descriptor::ValueDescriptor::value_type].
5562        pub fn set_value_type<T: std::convert::Into<api::model::metric_descriptor::ValueType>>(
5563            mut self,
5564            v: T,
5565        ) -> Self {
5566            self.value_type = v.into();
5567            self
5568        }
5569
5570        /// Sets the value of [metric_kind][crate::model::time_series_descriptor::ValueDescriptor::metric_kind].
5571        pub fn set_metric_kind<T: std::convert::Into<api::model::metric_descriptor::MetricKind>>(
5572            mut self,
5573            v: T,
5574        ) -> Self {
5575            self.metric_kind = v.into();
5576            self
5577        }
5578
5579        /// Sets the value of [unit][crate::model::time_series_descriptor::ValueDescriptor::unit].
5580        pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5581            self.unit = v.into();
5582            self
5583        }
5584    }
5585
5586    impl wkt::message::Message for ValueDescriptor {
5587        fn typename() -> &'static str {
5588            "type.googleapis.com/google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor"
5589        }
5590    }
5591}
5592
5593/// Represents the values of a time series associated with a
5594/// TimeSeriesDescriptor.
5595#[derive(Clone, Default, PartialEq)]
5596#[non_exhaustive]
5597pub struct TimeSeriesData {
5598    /// The values of the labels in the time series identifier, given in the same
5599    /// order as the `label_descriptors` field of the TimeSeriesDescriptor
5600    /// associated with this object. Each value must have a value of the type
5601    /// given in the corresponding entry of `label_descriptors`.
5602    pub label_values: std::vec::Vec<crate::model::LabelValue>,
5603
5604    /// The points in the time series.
5605    pub point_data: std::vec::Vec<crate::model::time_series_data::PointData>,
5606
5607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5608}
5609
5610impl TimeSeriesData {
5611    pub fn new() -> Self {
5612        std::default::Default::default()
5613    }
5614
5615    /// Sets the value of [label_values][crate::model::TimeSeriesData::label_values].
5616    pub fn set_label_values<T, V>(mut self, v: T) -> Self
5617    where
5618        T: std::iter::IntoIterator<Item = V>,
5619        V: std::convert::Into<crate::model::LabelValue>,
5620    {
5621        use std::iter::Iterator;
5622        self.label_values = v.into_iter().map(|i| i.into()).collect();
5623        self
5624    }
5625
5626    /// Sets the value of [point_data][crate::model::TimeSeriesData::point_data].
5627    pub fn set_point_data<T, V>(mut self, v: T) -> Self
5628    where
5629        T: std::iter::IntoIterator<Item = V>,
5630        V: std::convert::Into<crate::model::time_series_data::PointData>,
5631    {
5632        use std::iter::Iterator;
5633        self.point_data = v.into_iter().map(|i| i.into()).collect();
5634        self
5635    }
5636}
5637
5638impl wkt::message::Message for TimeSeriesData {
5639    fn typename() -> &'static str {
5640        "type.googleapis.com/google.monitoring.v3.TimeSeriesData"
5641    }
5642}
5643
5644/// Defines additional types related to [TimeSeriesData].
5645pub mod time_series_data {
5646    #[allow(unused_imports)]
5647    use super::*;
5648
5649    /// A point's value columns and time interval. Each point has one or more
5650    /// point values corresponding to the entries in `point_descriptors` field in
5651    /// the TimeSeriesDescriptor associated with this object.
5652    #[derive(Clone, Default, PartialEq)]
5653    #[non_exhaustive]
5654    pub struct PointData {
5655        /// The values that make up the point.
5656        pub values: std::vec::Vec<crate::model::TypedValue>,
5657
5658        /// The time interval associated with the point.
5659        pub time_interval: std::option::Option<crate::model::TimeInterval>,
5660
5661        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5662    }
5663
5664    impl PointData {
5665        pub fn new() -> Self {
5666            std::default::Default::default()
5667        }
5668
5669        /// Sets the value of [values][crate::model::time_series_data::PointData::values].
5670        pub fn set_values<T, V>(mut self, v: T) -> Self
5671        where
5672            T: std::iter::IntoIterator<Item = V>,
5673            V: std::convert::Into<crate::model::TypedValue>,
5674        {
5675            use std::iter::Iterator;
5676            self.values = v.into_iter().map(|i| i.into()).collect();
5677            self
5678        }
5679
5680        /// Sets the value of [time_interval][crate::model::time_series_data::PointData::time_interval].
5681        pub fn set_time_interval<T>(mut self, v: T) -> Self
5682        where
5683            T: std::convert::Into<crate::model::TimeInterval>,
5684        {
5685            self.time_interval = std::option::Option::Some(v.into());
5686            self
5687        }
5688
5689        /// Sets or clears the value of [time_interval][crate::model::time_series_data::PointData::time_interval].
5690        pub fn set_or_clear_time_interval<T>(mut self, v: std::option::Option<T>) -> Self
5691        where
5692            T: std::convert::Into<crate::model::TimeInterval>,
5693        {
5694            self.time_interval = v.map(|x| x.into());
5695            self
5696        }
5697    }
5698
5699    impl wkt::message::Message for PointData {
5700        fn typename() -> &'static str {
5701            "type.googleapis.com/google.monitoring.v3.TimeSeriesData.PointData"
5702        }
5703    }
5704}
5705
5706/// A label value.
5707#[derive(Clone, Default, PartialEq)]
5708#[non_exhaustive]
5709pub struct LabelValue {
5710    /// The label value can be a bool, int64, or string.
5711    pub value: std::option::Option<crate::model::label_value::Value>,
5712
5713    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5714}
5715
5716impl LabelValue {
5717    pub fn new() -> Self {
5718        std::default::Default::default()
5719    }
5720
5721    /// Sets the value of [value][crate::model::LabelValue::value].
5722    ///
5723    /// Note that all the setters affecting `value` are mutually
5724    /// exclusive.
5725    pub fn set_value<
5726        T: std::convert::Into<std::option::Option<crate::model::label_value::Value>>,
5727    >(
5728        mut self,
5729        v: T,
5730    ) -> Self {
5731        self.value = v.into();
5732        self
5733    }
5734
5735    /// The value of [value][crate::model::LabelValue::value]
5736    /// if it holds a `BoolValue`, `None` if the field is not set or
5737    /// holds a different branch.
5738    pub fn bool_value(&self) -> std::option::Option<&bool> {
5739        #[allow(unreachable_patterns)]
5740        self.value.as_ref().and_then(|v| match v {
5741            crate::model::label_value::Value::BoolValue(v) => std::option::Option::Some(v),
5742            _ => std::option::Option::None,
5743        })
5744    }
5745
5746    /// Sets the value of [value][crate::model::LabelValue::value]
5747    /// to hold a `BoolValue`.
5748    ///
5749    /// Note that all the setters affecting `value` are
5750    /// mutually exclusive.
5751    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5752        self.value =
5753            std::option::Option::Some(crate::model::label_value::Value::BoolValue(v.into()));
5754        self
5755    }
5756
5757    /// The value of [value][crate::model::LabelValue::value]
5758    /// if it holds a `Int64Value`, `None` if the field is not set or
5759    /// holds a different branch.
5760    pub fn int64_value(&self) -> std::option::Option<&i64> {
5761        #[allow(unreachable_patterns)]
5762        self.value.as_ref().and_then(|v| match v {
5763            crate::model::label_value::Value::Int64Value(v) => std::option::Option::Some(v),
5764            _ => std::option::Option::None,
5765        })
5766    }
5767
5768    /// Sets the value of [value][crate::model::LabelValue::value]
5769    /// to hold a `Int64Value`.
5770    ///
5771    /// Note that all the setters affecting `value` are
5772    /// mutually exclusive.
5773    pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5774        self.value =
5775            std::option::Option::Some(crate::model::label_value::Value::Int64Value(v.into()));
5776        self
5777    }
5778
5779    /// The value of [value][crate::model::LabelValue::value]
5780    /// if it holds a `StringValue`, `None` if the field is not set or
5781    /// holds a different branch.
5782    pub fn string_value(&self) -> std::option::Option<&std::string::String> {
5783        #[allow(unreachable_patterns)]
5784        self.value.as_ref().and_then(|v| match v {
5785            crate::model::label_value::Value::StringValue(v) => std::option::Option::Some(v),
5786            _ => std::option::Option::None,
5787        })
5788    }
5789
5790    /// Sets the value of [value][crate::model::LabelValue::value]
5791    /// to hold a `StringValue`.
5792    ///
5793    /// Note that all the setters affecting `value` are
5794    /// mutually exclusive.
5795    pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5796        self.value =
5797            std::option::Option::Some(crate::model::label_value::Value::StringValue(v.into()));
5798        self
5799    }
5800}
5801
5802impl wkt::message::Message for LabelValue {
5803    fn typename() -> &'static str {
5804        "type.googleapis.com/google.monitoring.v3.LabelValue"
5805    }
5806}
5807
5808/// Defines additional types related to [LabelValue].
5809pub mod label_value {
5810    #[allow(unused_imports)]
5811    use super::*;
5812
5813    /// The label value can be a bool, int64, or string.
5814    #[derive(Clone, Debug, PartialEq)]
5815    #[non_exhaustive]
5816    pub enum Value {
5817        /// A bool label value.
5818        BoolValue(bool),
5819        /// An int64 label value.
5820        Int64Value(i64),
5821        /// A string label value.
5822        StringValue(std::string::String),
5823    }
5824}
5825
5826/// An error associated with a query in the time series query language format.
5827#[derive(Clone, Default, PartialEq)]
5828#[non_exhaustive]
5829pub struct QueryError {
5830    /// The location of the time series query language text that this error applies
5831    /// to.
5832    pub locator: std::option::Option<crate::model::TextLocator>,
5833
5834    /// The error message.
5835    pub message: std::string::String,
5836
5837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5838}
5839
5840impl QueryError {
5841    pub fn new() -> Self {
5842        std::default::Default::default()
5843    }
5844
5845    /// Sets the value of [locator][crate::model::QueryError::locator].
5846    pub fn set_locator<T>(mut self, v: T) -> Self
5847    where
5848        T: std::convert::Into<crate::model::TextLocator>,
5849    {
5850        self.locator = std::option::Option::Some(v.into());
5851        self
5852    }
5853
5854    /// Sets or clears the value of [locator][crate::model::QueryError::locator].
5855    pub fn set_or_clear_locator<T>(mut self, v: std::option::Option<T>) -> Self
5856    where
5857        T: std::convert::Into<crate::model::TextLocator>,
5858    {
5859        self.locator = v.map(|x| x.into());
5860        self
5861    }
5862
5863    /// Sets the value of [message][crate::model::QueryError::message].
5864    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5865        self.message = v.into();
5866        self
5867    }
5868}
5869
5870impl wkt::message::Message for QueryError {
5871    fn typename() -> &'static str {
5872        "type.googleapis.com/google.monitoring.v3.QueryError"
5873    }
5874}
5875
5876/// A locator for text. Indicates a particular part of the text of a request or
5877/// of an object referenced in the request.
5878///
5879/// For example, suppose the request field `text` contains:
5880///
5881/// text: "The quick brown fox jumps over the lazy dog."
5882///
5883/// Then the locator:
5884///
5885/// source: "text"
5886/// start_position {
5887/// line: 1
5888/// column: 17
5889/// }
5890/// end_position {
5891/// line: 1
5892/// column: 19
5893/// }
5894///
5895/// refers to the part of the text: "fox".
5896#[derive(Clone, Default, PartialEq)]
5897#[non_exhaustive]
5898pub struct TextLocator {
5899    /// The source of the text. The source may be a field in the request, in which
5900    /// case its format is the format of the
5901    /// google.rpc.BadRequest.FieldViolation.field field in
5902    /// <https://cloud.google.com/apis/design/errors#error_details>. It may also be
5903    /// be a source other than the request field (e.g. a macro definition
5904    /// referenced in the text of the query), in which case this is the name of
5905    /// the source (e.g. the macro name).
5906    pub source: std::string::String,
5907
5908    /// The position of the first byte within the text.
5909    pub start_position: std::option::Option<crate::model::text_locator::Position>,
5910
5911    /// The position of the last byte within the text.
5912    pub end_position: std::option::Option<crate::model::text_locator::Position>,
5913
5914    /// If `source`, `start_position`, and `end_position` describe a call on
5915    /// some object (e.g. a macro in the time series query language text) and a
5916    /// location is to be designated in that object's text, `nested_locator`
5917    /// identifies the location within that object.
5918    pub nested_locator: std::option::Option<std::boxed::Box<crate::model::TextLocator>>,
5919
5920    /// When `nested_locator` is set, this field gives the reason for the nesting.
5921    /// Usually, the reason is a macro invocation. In that case, the macro name
5922    /// (including the leading '@') signals the location of the macro call
5923    /// in the text and a macro argument name (including the leading '$') signals
5924    /// the location of the macro argument inside the macro body that got
5925    /// substituted away.
5926    pub nesting_reason: std::string::String,
5927
5928    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5929}
5930
5931impl TextLocator {
5932    pub fn new() -> Self {
5933        std::default::Default::default()
5934    }
5935
5936    /// Sets the value of [source][crate::model::TextLocator::source].
5937    pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5938        self.source = v.into();
5939        self
5940    }
5941
5942    /// Sets the value of [start_position][crate::model::TextLocator::start_position].
5943    pub fn set_start_position<T>(mut self, v: T) -> Self
5944    where
5945        T: std::convert::Into<crate::model::text_locator::Position>,
5946    {
5947        self.start_position = std::option::Option::Some(v.into());
5948        self
5949    }
5950
5951    /// Sets or clears the value of [start_position][crate::model::TextLocator::start_position].
5952    pub fn set_or_clear_start_position<T>(mut self, v: std::option::Option<T>) -> Self
5953    where
5954        T: std::convert::Into<crate::model::text_locator::Position>,
5955    {
5956        self.start_position = v.map(|x| x.into());
5957        self
5958    }
5959
5960    /// Sets the value of [end_position][crate::model::TextLocator::end_position].
5961    pub fn set_end_position<T>(mut self, v: T) -> Self
5962    where
5963        T: std::convert::Into<crate::model::text_locator::Position>,
5964    {
5965        self.end_position = std::option::Option::Some(v.into());
5966        self
5967    }
5968
5969    /// Sets or clears the value of [end_position][crate::model::TextLocator::end_position].
5970    pub fn set_or_clear_end_position<T>(mut self, v: std::option::Option<T>) -> Self
5971    where
5972        T: std::convert::Into<crate::model::text_locator::Position>,
5973    {
5974        self.end_position = v.map(|x| x.into());
5975        self
5976    }
5977
5978    /// Sets the value of [nested_locator][crate::model::TextLocator::nested_locator].
5979    pub fn set_nested_locator<T>(mut self, v: T) -> Self
5980    where
5981        T: std::convert::Into<crate::model::TextLocator>,
5982    {
5983        self.nested_locator = std::option::Option::Some(std::boxed::Box::new(v.into()));
5984        self
5985    }
5986
5987    /// Sets or clears the value of [nested_locator][crate::model::TextLocator::nested_locator].
5988    pub fn set_or_clear_nested_locator<T>(mut self, v: std::option::Option<T>) -> Self
5989    where
5990        T: std::convert::Into<crate::model::TextLocator>,
5991    {
5992        self.nested_locator = v.map(|x| std::boxed::Box::new(x.into()));
5993        self
5994    }
5995
5996    /// Sets the value of [nesting_reason][crate::model::TextLocator::nesting_reason].
5997    pub fn set_nesting_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5998        self.nesting_reason = v.into();
5999        self
6000    }
6001}
6002
6003impl wkt::message::Message for TextLocator {
6004    fn typename() -> &'static str {
6005        "type.googleapis.com/google.monitoring.v3.TextLocator"
6006    }
6007}
6008
6009/// Defines additional types related to [TextLocator].
6010pub mod text_locator {
6011    #[allow(unused_imports)]
6012    use super::*;
6013
6014    /// The position of a byte within the text.
6015    #[derive(Clone, Default, PartialEq)]
6016    #[non_exhaustive]
6017    pub struct Position {
6018        /// The line, starting with 1, where the byte is positioned.
6019        pub line: i32,
6020
6021        /// The column within the line, starting with 1, where the byte is
6022        /// positioned. This is a byte index even though the text is UTF-8.
6023        pub column: i32,
6024
6025        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6026    }
6027
6028    impl Position {
6029        pub fn new() -> Self {
6030            std::default::Default::default()
6031        }
6032
6033        /// Sets the value of [line][crate::model::text_locator::Position::line].
6034        pub fn set_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6035            self.line = v.into();
6036            self
6037        }
6038
6039        /// Sets the value of [column][crate::model::text_locator::Position::column].
6040        pub fn set_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6041            self.column = v.into();
6042            self
6043        }
6044    }
6045
6046    impl wkt::message::Message for Position {
6047        fn typename() -> &'static str {
6048            "type.googleapis.com/google.monitoring.v3.TextLocator.Position"
6049        }
6050    }
6051}
6052
6053/// The `ListMonitoredResourceDescriptors` request.
6054#[derive(Clone, Default, PartialEq)]
6055#[non_exhaustive]
6056pub struct ListMonitoredResourceDescriptorsRequest {
6057    /// Required. The
6058    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
6059    /// to execute the request. The format is:
6060    ///
6061    /// ```norust
6062    /// projects/[PROJECT_ID_OR_NUMBER]
6063    /// ```
6064    pub name: std::string::String,
6065
6066    /// An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
6067    /// describing the descriptors to be returned.  The filter can reference the
6068    /// descriptor's type and labels. For example, the following filter returns
6069    /// only Google Compute Engine descriptors that have an `id` label:
6070    ///
6071    /// ```norust
6072    /// resource.type = starts_with("gce_") AND resource.label:id
6073    /// ```
6074    pub filter: std::string::String,
6075
6076    /// A positive number that is the maximum number of results to return.
6077    pub page_size: i32,
6078
6079    /// If this field is not empty then it must contain the `nextPageToken` value
6080    /// returned by a previous call to this method.  Using this field causes the
6081    /// method to return additional results from the previous method call.
6082    pub page_token: std::string::String,
6083
6084    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6085}
6086
6087impl ListMonitoredResourceDescriptorsRequest {
6088    pub fn new() -> Self {
6089        std::default::Default::default()
6090    }
6091
6092    /// Sets the value of [name][crate::model::ListMonitoredResourceDescriptorsRequest::name].
6093    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6094        self.name = v.into();
6095        self
6096    }
6097
6098    /// Sets the value of [filter][crate::model::ListMonitoredResourceDescriptorsRequest::filter].
6099    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6100        self.filter = v.into();
6101        self
6102    }
6103
6104    /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
6105    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6106        self.page_size = v.into();
6107        self
6108    }
6109
6110    /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
6111    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6112        self.page_token = v.into();
6113        self
6114    }
6115}
6116
6117impl wkt::message::Message for ListMonitoredResourceDescriptorsRequest {
6118    fn typename() -> &'static str {
6119        "type.googleapis.com/google.monitoring.v3.ListMonitoredResourceDescriptorsRequest"
6120    }
6121}
6122
6123/// The `ListMonitoredResourceDescriptors` response.
6124#[derive(Clone, Default, PartialEq)]
6125#[non_exhaustive]
6126pub struct ListMonitoredResourceDescriptorsResponse {
6127    /// The monitored resource descriptors that are available to this project
6128    /// and that match `filter`, if present.
6129    pub resource_descriptors: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
6130
6131    /// If there are more results than have been returned, then this field is set
6132    /// to a non-empty value.  To see the additional results,
6133    /// use that value as `page_token` in the next call to this method.
6134    pub next_page_token: std::string::String,
6135
6136    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6137}
6138
6139impl ListMonitoredResourceDescriptorsResponse {
6140    pub fn new() -> Self {
6141        std::default::Default::default()
6142    }
6143
6144    /// Sets the value of [resource_descriptors][crate::model::ListMonitoredResourceDescriptorsResponse::resource_descriptors].
6145    pub fn set_resource_descriptors<T, V>(mut self, v: T) -> Self
6146    where
6147        T: std::iter::IntoIterator<Item = V>,
6148        V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
6149    {
6150        use std::iter::Iterator;
6151        self.resource_descriptors = v.into_iter().map(|i| i.into()).collect();
6152        self
6153    }
6154
6155    /// Sets the value of [next_page_token][crate::model::ListMonitoredResourceDescriptorsResponse::next_page_token].
6156    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6157        self.next_page_token = v.into();
6158        self
6159    }
6160}
6161
6162impl wkt::message::Message for ListMonitoredResourceDescriptorsResponse {
6163    fn typename() -> &'static str {
6164        "type.googleapis.com/google.monitoring.v3.ListMonitoredResourceDescriptorsResponse"
6165    }
6166}
6167
6168#[doc(hidden)]
6169impl gax::paginator::internal::PageableResponse for ListMonitoredResourceDescriptorsResponse {
6170    type PageItem = api::model::MonitoredResourceDescriptor;
6171
6172    fn items(self) -> std::vec::Vec<Self::PageItem> {
6173        self.resource_descriptors
6174    }
6175
6176    fn next_page_token(&self) -> std::string::String {
6177        use std::clone::Clone;
6178        self.next_page_token.clone()
6179    }
6180}
6181
6182/// The `GetMonitoredResourceDescriptor` request.
6183#[derive(Clone, Default, PartialEq)]
6184#[non_exhaustive]
6185pub struct GetMonitoredResourceDescriptorRequest {
6186    /// Required. The monitored resource descriptor to get.  The format is:
6187    ///
6188    /// ```norust
6189    /// projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
6190    /// ```
6191    ///
6192    /// The `[RESOURCE_TYPE]` is a predefined type, such as
6193    /// `cloudsql_database`.
6194    pub name: std::string::String,
6195
6196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6197}
6198
6199impl GetMonitoredResourceDescriptorRequest {
6200    pub fn new() -> Self {
6201        std::default::Default::default()
6202    }
6203
6204    /// Sets the value of [name][crate::model::GetMonitoredResourceDescriptorRequest::name].
6205    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6206        self.name = v.into();
6207        self
6208    }
6209}
6210
6211impl wkt::message::Message for GetMonitoredResourceDescriptorRequest {
6212    fn typename() -> &'static str {
6213        "type.googleapis.com/google.monitoring.v3.GetMonitoredResourceDescriptorRequest"
6214    }
6215}
6216
6217/// The `ListMetricDescriptors` request.
6218#[derive(Clone, Default, PartialEq)]
6219#[non_exhaustive]
6220pub struct ListMetricDescriptorsRequest {
6221    /// Required. The
6222    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
6223    /// to execute the request. The format is:
6224    ///
6225    /// ```norust
6226    /// projects/[PROJECT_ID_OR_NUMBER]
6227    /// ```
6228    pub name: std::string::String,
6229
6230    /// Optional. If this field is empty, all custom and
6231    /// system-defined metric descriptors are returned.
6232    /// Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
6233    /// specifies which metric descriptors are to be
6234    /// returned. For example, the following filter matches all
6235    /// [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
6236    ///
6237    /// ```norust
6238    /// metric.type = starts_with("custom.googleapis.com/")
6239    /// ```
6240    pub filter: std::string::String,
6241
6242    /// Optional. A positive number that is the maximum number of results to
6243    /// return. The default and maximum value is 10,000. If a page_size <= 0 or >
6244    /// 10,000 is submitted, will instead return a maximum of 10,000 results.
6245    pub page_size: i32,
6246
6247    /// Optional. If this field is not empty then it must contain the
6248    /// `nextPageToken` value returned by a previous call to this method.  Using
6249    /// this field causes the method to return additional results from the previous
6250    /// method call.
6251    pub page_token: std::string::String,
6252
6253    /// Optional. If true, only metrics and monitored resource types that have
6254    /// recent data (within roughly 25 hours) will be included in the response.
6255    ///
6256    /// - If a metric descriptor enumerates monitored resource types, only the
6257    ///   monitored resource types for which the metric type has recent data will
6258    ///   be included in the returned metric descriptor, and if none of them have
6259    ///   recent data, the metric descriptor will not be returned.
6260    /// - If a metric descriptor does not enumerate the compatible monitored
6261    ///   resource types, it will be returned only if the metric type has recent
6262    ///   data for some monitored resource type. The returned descriptor will not
6263    ///   enumerate any monitored resource types.
6264    pub active_only: bool,
6265
6266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6267}
6268
6269impl ListMetricDescriptorsRequest {
6270    pub fn new() -> Self {
6271        std::default::Default::default()
6272    }
6273
6274    /// Sets the value of [name][crate::model::ListMetricDescriptorsRequest::name].
6275    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6276        self.name = v.into();
6277        self
6278    }
6279
6280    /// Sets the value of [filter][crate::model::ListMetricDescriptorsRequest::filter].
6281    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6282        self.filter = v.into();
6283        self
6284    }
6285
6286    /// Sets the value of [page_size][crate::model::ListMetricDescriptorsRequest::page_size].
6287    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6288        self.page_size = v.into();
6289        self
6290    }
6291
6292    /// Sets the value of [page_token][crate::model::ListMetricDescriptorsRequest::page_token].
6293    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6294        self.page_token = v.into();
6295        self
6296    }
6297
6298    /// Sets the value of [active_only][crate::model::ListMetricDescriptorsRequest::active_only].
6299    pub fn set_active_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6300        self.active_only = v.into();
6301        self
6302    }
6303}
6304
6305impl wkt::message::Message for ListMetricDescriptorsRequest {
6306    fn typename() -> &'static str {
6307        "type.googleapis.com/google.monitoring.v3.ListMetricDescriptorsRequest"
6308    }
6309}
6310
6311/// The `ListMetricDescriptors` response.
6312#[derive(Clone, Default, PartialEq)]
6313#[non_exhaustive]
6314pub struct ListMetricDescriptorsResponse {
6315    /// The metric descriptors that are available to the project
6316    /// and that match the value of `filter`, if present.
6317    pub metric_descriptors: std::vec::Vec<api::model::MetricDescriptor>,
6318
6319    /// If there are more results than have been returned, then this field is set
6320    /// to a non-empty value.  To see the additional results,
6321    /// use that value as `page_token` in the next call to this method.
6322    pub next_page_token: std::string::String,
6323
6324    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6325}
6326
6327impl ListMetricDescriptorsResponse {
6328    pub fn new() -> Self {
6329        std::default::Default::default()
6330    }
6331
6332    /// Sets the value of [metric_descriptors][crate::model::ListMetricDescriptorsResponse::metric_descriptors].
6333    pub fn set_metric_descriptors<T, V>(mut self, v: T) -> Self
6334    where
6335        T: std::iter::IntoIterator<Item = V>,
6336        V: std::convert::Into<api::model::MetricDescriptor>,
6337    {
6338        use std::iter::Iterator;
6339        self.metric_descriptors = v.into_iter().map(|i| i.into()).collect();
6340        self
6341    }
6342
6343    /// Sets the value of [next_page_token][crate::model::ListMetricDescriptorsResponse::next_page_token].
6344    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6345        self.next_page_token = v.into();
6346        self
6347    }
6348}
6349
6350impl wkt::message::Message for ListMetricDescriptorsResponse {
6351    fn typename() -> &'static str {
6352        "type.googleapis.com/google.monitoring.v3.ListMetricDescriptorsResponse"
6353    }
6354}
6355
6356#[doc(hidden)]
6357impl gax::paginator::internal::PageableResponse for ListMetricDescriptorsResponse {
6358    type PageItem = api::model::MetricDescriptor;
6359
6360    fn items(self) -> std::vec::Vec<Self::PageItem> {
6361        self.metric_descriptors
6362    }
6363
6364    fn next_page_token(&self) -> std::string::String {
6365        use std::clone::Clone;
6366        self.next_page_token.clone()
6367    }
6368}
6369
6370/// The `GetMetricDescriptor` request.
6371#[derive(Clone, Default, PartialEq)]
6372#[non_exhaustive]
6373pub struct GetMetricDescriptorRequest {
6374    /// Required. The metric descriptor on which to execute the request. The format
6375    /// is:
6376    ///
6377    /// ```norust
6378    /// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
6379    /// ```
6380    ///
6381    /// An example value of `[METRIC_ID]` is
6382    /// `"compute.googleapis.com/instance/disk/read_bytes_count"`.
6383    pub name: std::string::String,
6384
6385    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6386}
6387
6388impl GetMetricDescriptorRequest {
6389    pub fn new() -> Self {
6390        std::default::Default::default()
6391    }
6392
6393    /// Sets the value of [name][crate::model::GetMetricDescriptorRequest::name].
6394    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6395        self.name = v.into();
6396        self
6397    }
6398}
6399
6400impl wkt::message::Message for GetMetricDescriptorRequest {
6401    fn typename() -> &'static str {
6402        "type.googleapis.com/google.monitoring.v3.GetMetricDescriptorRequest"
6403    }
6404}
6405
6406/// The `CreateMetricDescriptor` request.
6407#[derive(Clone, Default, PartialEq)]
6408#[non_exhaustive]
6409pub struct CreateMetricDescriptorRequest {
6410    /// Required. The
6411    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
6412    /// to execute the request. The format is:
6413    /// 4
6414    /// projects/[PROJECT_ID_OR_NUMBER]
6415    pub name: std::string::String,
6416
6417    /// Required. The new [custom
6418    /// metric](https://cloud.google.com/monitoring/custom-metrics) descriptor.
6419    pub metric_descriptor: std::option::Option<api::model::MetricDescriptor>,
6420
6421    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6422}
6423
6424impl CreateMetricDescriptorRequest {
6425    pub fn new() -> Self {
6426        std::default::Default::default()
6427    }
6428
6429    /// Sets the value of [name][crate::model::CreateMetricDescriptorRequest::name].
6430    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6431        self.name = v.into();
6432        self
6433    }
6434
6435    /// Sets the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
6436    pub fn set_metric_descriptor<T>(mut self, v: T) -> Self
6437    where
6438        T: std::convert::Into<api::model::MetricDescriptor>,
6439    {
6440        self.metric_descriptor = std::option::Option::Some(v.into());
6441        self
6442    }
6443
6444    /// Sets or clears the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
6445    pub fn set_or_clear_metric_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
6446    where
6447        T: std::convert::Into<api::model::MetricDescriptor>,
6448    {
6449        self.metric_descriptor = v.map(|x| x.into());
6450        self
6451    }
6452}
6453
6454impl wkt::message::Message for CreateMetricDescriptorRequest {
6455    fn typename() -> &'static str {
6456        "type.googleapis.com/google.monitoring.v3.CreateMetricDescriptorRequest"
6457    }
6458}
6459
6460/// The `DeleteMetricDescriptor` request.
6461#[derive(Clone, Default, PartialEq)]
6462#[non_exhaustive]
6463pub struct DeleteMetricDescriptorRequest {
6464    /// Required. The metric descriptor on which to execute the request. The format
6465    /// is:
6466    ///
6467    /// ```norust
6468    /// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
6469    /// ```
6470    ///
6471    /// An example of `[METRIC_ID]` is:
6472    /// `"custom.googleapis.com/my_test_metric"`.
6473    pub name: std::string::String,
6474
6475    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6476}
6477
6478impl DeleteMetricDescriptorRequest {
6479    pub fn new() -> Self {
6480        std::default::Default::default()
6481    }
6482
6483    /// Sets the value of [name][crate::model::DeleteMetricDescriptorRequest::name].
6484    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6485        self.name = v.into();
6486        self
6487    }
6488}
6489
6490impl wkt::message::Message for DeleteMetricDescriptorRequest {
6491    fn typename() -> &'static str {
6492        "type.googleapis.com/google.monitoring.v3.DeleteMetricDescriptorRequest"
6493    }
6494}
6495
6496/// The `ListTimeSeries` request.
6497#[derive(Clone, Default, PartialEq)]
6498#[non_exhaustive]
6499pub struct ListTimeSeriesRequest {
6500    /// Required. The
6501    /// [project](https://cloud.google.com/monitoring/api/v3#project_name),
6502    /// organization or folder on which to execute the request. The format is:
6503    ///
6504    /// ```norust
6505    /// projects/[PROJECT_ID_OR_NUMBER]
6506    /// organizations/[ORGANIZATION_ID]
6507    /// folders/[FOLDER_ID]
6508    /// ```
6509    pub name: std::string::String,
6510
6511    /// Required. A [monitoring
6512    /// filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies
6513    /// which time series should be returned.  The filter must specify a single
6514    /// metric type, and can additionally specify metric labels and other
6515    /// information. For example:
6516    ///
6517    /// ```norust
6518    /// metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
6519    ///     metric.labels.instance_name = "my-instance-name"
6520    /// ```
6521    pub filter: std::string::String,
6522
6523    /// Required. The time interval for which results should be returned. Only time
6524    /// series that contain data points in the specified interval are included in
6525    /// the response.
6526    pub interval: std::option::Option<crate::model::TimeInterval>,
6527
6528    /// Specifies the alignment of data points in individual time series as
6529    /// well as how to combine the retrieved time series across specified labels.
6530    ///
6531    /// By default (if no `aggregation` is explicitly specified), the raw time
6532    /// series data is returned.
6533    pub aggregation: std::option::Option<crate::model::Aggregation>,
6534
6535    /// Apply a second aggregation after `aggregation` is applied. May only be
6536    /// specified if `aggregation` is specified.
6537    pub secondary_aggregation: std::option::Option<crate::model::Aggregation>,
6538
6539    /// Unsupported: must be left blank. The points in each time series are
6540    /// currently returned in reverse time order (most recent to oldest).
6541    pub order_by: std::string::String,
6542
6543    /// Required. Specifies which information is returned about the time series.
6544    pub view: crate::model::list_time_series_request::TimeSeriesView,
6545
6546    /// A positive number that is the maximum number of results to return. If
6547    /// `page_size` is empty or more than 100,000 results, the effective
6548    /// `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
6549    /// maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
6550    /// the maximum number of `TimeSeries` returned.
6551    pub page_size: i32,
6552
6553    /// If this field is not empty then it must contain the `nextPageToken` value
6554    /// returned by a previous call to this method.  Using this field causes the
6555    /// method to return additional results from the previous method call.
6556    pub page_token: std::string::String,
6557
6558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6559}
6560
6561impl ListTimeSeriesRequest {
6562    pub fn new() -> Self {
6563        std::default::Default::default()
6564    }
6565
6566    /// Sets the value of [name][crate::model::ListTimeSeriesRequest::name].
6567    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6568        self.name = v.into();
6569        self
6570    }
6571
6572    /// Sets the value of [filter][crate::model::ListTimeSeriesRequest::filter].
6573    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6574        self.filter = v.into();
6575        self
6576    }
6577
6578    /// Sets the value of [interval][crate::model::ListTimeSeriesRequest::interval].
6579    pub fn set_interval<T>(mut self, v: T) -> Self
6580    where
6581        T: std::convert::Into<crate::model::TimeInterval>,
6582    {
6583        self.interval = std::option::Option::Some(v.into());
6584        self
6585    }
6586
6587    /// Sets or clears the value of [interval][crate::model::ListTimeSeriesRequest::interval].
6588    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
6589    where
6590        T: std::convert::Into<crate::model::TimeInterval>,
6591    {
6592        self.interval = v.map(|x| x.into());
6593        self
6594    }
6595
6596    /// Sets the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
6597    pub fn set_aggregation<T>(mut self, v: T) -> Self
6598    where
6599        T: std::convert::Into<crate::model::Aggregation>,
6600    {
6601        self.aggregation = std::option::Option::Some(v.into());
6602        self
6603    }
6604
6605    /// Sets or clears the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
6606    pub fn set_or_clear_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
6607    where
6608        T: std::convert::Into<crate::model::Aggregation>,
6609    {
6610        self.aggregation = v.map(|x| x.into());
6611        self
6612    }
6613
6614    /// Sets the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
6615    pub fn set_secondary_aggregation<T>(mut self, v: T) -> Self
6616    where
6617        T: std::convert::Into<crate::model::Aggregation>,
6618    {
6619        self.secondary_aggregation = std::option::Option::Some(v.into());
6620        self
6621    }
6622
6623    /// Sets or clears the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
6624    pub fn set_or_clear_secondary_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
6625    where
6626        T: std::convert::Into<crate::model::Aggregation>,
6627    {
6628        self.secondary_aggregation = v.map(|x| x.into());
6629        self
6630    }
6631
6632    /// Sets the value of [order_by][crate::model::ListTimeSeriesRequest::order_by].
6633    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6634        self.order_by = v.into();
6635        self
6636    }
6637
6638    /// Sets the value of [view][crate::model::ListTimeSeriesRequest::view].
6639    pub fn set_view<
6640        T: std::convert::Into<crate::model::list_time_series_request::TimeSeriesView>,
6641    >(
6642        mut self,
6643        v: T,
6644    ) -> Self {
6645        self.view = v.into();
6646        self
6647    }
6648
6649    /// Sets the value of [page_size][crate::model::ListTimeSeriesRequest::page_size].
6650    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6651        self.page_size = v.into();
6652        self
6653    }
6654
6655    /// Sets the value of [page_token][crate::model::ListTimeSeriesRequest::page_token].
6656    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6657        self.page_token = v.into();
6658        self
6659    }
6660}
6661
6662impl wkt::message::Message for ListTimeSeriesRequest {
6663    fn typename() -> &'static str {
6664        "type.googleapis.com/google.monitoring.v3.ListTimeSeriesRequest"
6665    }
6666}
6667
6668/// Defines additional types related to [ListTimeSeriesRequest].
6669pub mod list_time_series_request {
6670    #[allow(unused_imports)]
6671    use super::*;
6672
6673    /// Controls which fields are returned by `ListTimeSeries*`.
6674    ///
6675    /// # Working with unknown values
6676    ///
6677    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6678    /// additional enum variants at any time. Adding new variants is not considered
6679    /// a breaking change. Applications should write their code in anticipation of:
6680    ///
6681    /// - New values appearing in future releases of the client library, **and**
6682    /// - New values received dynamically, without application changes.
6683    ///
6684    /// Please consult the [Working with enums] section in the user guide for some
6685    /// guidelines.
6686    ///
6687    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6688    #[derive(Clone, Debug, PartialEq)]
6689    #[non_exhaustive]
6690    pub enum TimeSeriesView {
6691        /// Returns the identity of the metric(s), the time series,
6692        /// and the time series data.
6693        Full,
6694        /// Returns the identity of the metric and the time series resource,
6695        /// but not the time series data.
6696        Headers,
6697        /// If set, the enum was initialized with an unknown value.
6698        ///
6699        /// Applications can examine the value using [TimeSeriesView::value] or
6700        /// [TimeSeriesView::name].
6701        UnknownValue(time_series_view::UnknownValue),
6702    }
6703
6704    #[doc(hidden)]
6705    pub mod time_series_view {
6706        #[allow(unused_imports)]
6707        use super::*;
6708        #[derive(Clone, Debug, PartialEq)]
6709        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6710    }
6711
6712    impl TimeSeriesView {
6713        /// Gets the enum value.
6714        ///
6715        /// Returns `None` if the enum contains an unknown value deserialized from
6716        /// the string representation of enums.
6717        pub fn value(&self) -> std::option::Option<i32> {
6718            match self {
6719                Self::Full => std::option::Option::Some(0),
6720                Self::Headers => std::option::Option::Some(1),
6721                Self::UnknownValue(u) => u.0.value(),
6722            }
6723        }
6724
6725        /// Gets the enum value as a string.
6726        ///
6727        /// Returns `None` if the enum contains an unknown value deserialized from
6728        /// the integer representation of enums.
6729        pub fn name(&self) -> std::option::Option<&str> {
6730            match self {
6731                Self::Full => std::option::Option::Some("FULL"),
6732                Self::Headers => std::option::Option::Some("HEADERS"),
6733                Self::UnknownValue(u) => u.0.name(),
6734            }
6735        }
6736    }
6737
6738    impl std::default::Default for TimeSeriesView {
6739        fn default() -> Self {
6740            use std::convert::From;
6741            Self::from(0)
6742        }
6743    }
6744
6745    impl std::fmt::Display for TimeSeriesView {
6746        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6747            wkt::internal::display_enum(f, self.name(), self.value())
6748        }
6749    }
6750
6751    impl std::convert::From<i32> for TimeSeriesView {
6752        fn from(value: i32) -> Self {
6753            match value {
6754                0 => Self::Full,
6755                1 => Self::Headers,
6756                _ => Self::UnknownValue(time_series_view::UnknownValue(
6757                    wkt::internal::UnknownEnumValue::Integer(value),
6758                )),
6759            }
6760        }
6761    }
6762
6763    impl std::convert::From<&str> for TimeSeriesView {
6764        fn from(value: &str) -> Self {
6765            use std::string::ToString;
6766            match value {
6767                "FULL" => Self::Full,
6768                "HEADERS" => Self::Headers,
6769                _ => Self::UnknownValue(time_series_view::UnknownValue(
6770                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6771                )),
6772            }
6773        }
6774    }
6775
6776    impl serde::ser::Serialize for TimeSeriesView {
6777        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6778        where
6779            S: serde::Serializer,
6780        {
6781            match self {
6782                Self::Full => serializer.serialize_i32(0),
6783                Self::Headers => serializer.serialize_i32(1),
6784                Self::UnknownValue(u) => u.0.serialize(serializer),
6785            }
6786        }
6787    }
6788
6789    impl<'de> serde::de::Deserialize<'de> for TimeSeriesView {
6790        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6791        where
6792            D: serde::Deserializer<'de>,
6793        {
6794            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesView>::new(
6795                ".google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView",
6796            ))
6797        }
6798    }
6799}
6800
6801/// The `ListTimeSeries` response.
6802#[derive(Clone, Default, PartialEq)]
6803#[non_exhaustive]
6804pub struct ListTimeSeriesResponse {
6805    /// One or more time series that match the filter included in the request.
6806    pub time_series: std::vec::Vec<crate::model::TimeSeries>,
6807
6808    /// If there are more results than have been returned, then this field is set
6809    /// to a non-empty value.  To see the additional results,
6810    /// use that value as `page_token` in the next call to this method.
6811    pub next_page_token: std::string::String,
6812
6813    /// Query execution errors that may have caused the time series data returned
6814    /// to be incomplete.
6815    pub execution_errors: std::vec::Vec<rpc::model::Status>,
6816
6817    /// The unit in which all `time_series` point values are reported. `unit`
6818    /// follows the UCUM format for units as seen in
6819    /// <https://unitsofmeasure.org/ucum.html>.
6820    /// If different `time_series` have different units (for example, because they
6821    /// come from different metric types, or a unit is absent), then `unit` will be
6822    /// "{not_a_unit}".
6823    pub unit: std::string::String,
6824
6825    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6826}
6827
6828impl ListTimeSeriesResponse {
6829    pub fn new() -> Self {
6830        std::default::Default::default()
6831    }
6832
6833    /// Sets the value of [time_series][crate::model::ListTimeSeriesResponse::time_series].
6834    pub fn set_time_series<T, V>(mut self, v: T) -> Self
6835    where
6836        T: std::iter::IntoIterator<Item = V>,
6837        V: std::convert::Into<crate::model::TimeSeries>,
6838    {
6839        use std::iter::Iterator;
6840        self.time_series = v.into_iter().map(|i| i.into()).collect();
6841        self
6842    }
6843
6844    /// Sets the value of [next_page_token][crate::model::ListTimeSeriesResponse::next_page_token].
6845    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6846        self.next_page_token = v.into();
6847        self
6848    }
6849
6850    /// Sets the value of [execution_errors][crate::model::ListTimeSeriesResponse::execution_errors].
6851    pub fn set_execution_errors<T, V>(mut self, v: T) -> Self
6852    where
6853        T: std::iter::IntoIterator<Item = V>,
6854        V: std::convert::Into<rpc::model::Status>,
6855    {
6856        use std::iter::Iterator;
6857        self.execution_errors = v.into_iter().map(|i| i.into()).collect();
6858        self
6859    }
6860
6861    /// Sets the value of [unit][crate::model::ListTimeSeriesResponse::unit].
6862    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6863        self.unit = v.into();
6864        self
6865    }
6866}
6867
6868impl wkt::message::Message for ListTimeSeriesResponse {
6869    fn typename() -> &'static str {
6870        "type.googleapis.com/google.monitoring.v3.ListTimeSeriesResponse"
6871    }
6872}
6873
6874#[doc(hidden)]
6875impl gax::paginator::internal::PageableResponse for ListTimeSeriesResponse {
6876    type PageItem = crate::model::TimeSeries;
6877
6878    fn items(self) -> std::vec::Vec<Self::PageItem> {
6879        self.time_series
6880    }
6881
6882    fn next_page_token(&self) -> std::string::String {
6883        use std::clone::Clone;
6884        self.next_page_token.clone()
6885    }
6886}
6887
6888/// The `CreateTimeSeries` request.
6889#[derive(Clone, Default, PartialEq)]
6890#[non_exhaustive]
6891pub struct CreateTimeSeriesRequest {
6892    /// Required. The
6893    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
6894    /// to execute the request. The format is:
6895    ///
6896    /// ```norust
6897    /// projects/[PROJECT_ID_OR_NUMBER]
6898    /// ```
6899    pub name: std::string::String,
6900
6901    /// Required. The new data to be added to a list of time series.
6902    /// Adds at most one data point to each of several time series.  The new data
6903    /// point must be more recent than any other point in its time series.  Each
6904    /// `TimeSeries` value must fully specify a unique time series by supplying
6905    /// all label values for the metric and the monitored resource.
6906    ///
6907    /// The maximum number of `TimeSeries` objects per `Create` request is 200.
6908    pub time_series: std::vec::Vec<crate::model::TimeSeries>,
6909
6910    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6911}
6912
6913impl CreateTimeSeriesRequest {
6914    pub fn new() -> Self {
6915        std::default::Default::default()
6916    }
6917
6918    /// Sets the value of [name][crate::model::CreateTimeSeriesRequest::name].
6919    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6920        self.name = v.into();
6921        self
6922    }
6923
6924    /// Sets the value of [time_series][crate::model::CreateTimeSeriesRequest::time_series].
6925    pub fn set_time_series<T, V>(mut self, v: T) -> Self
6926    where
6927        T: std::iter::IntoIterator<Item = V>,
6928        V: std::convert::Into<crate::model::TimeSeries>,
6929    {
6930        use std::iter::Iterator;
6931        self.time_series = v.into_iter().map(|i| i.into()).collect();
6932        self
6933    }
6934}
6935
6936impl wkt::message::Message for CreateTimeSeriesRequest {
6937    fn typename() -> &'static str {
6938        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesRequest"
6939    }
6940}
6941
6942/// DEPRECATED. Used to hold per-time-series error status.
6943#[derive(Clone, Default, PartialEq)]
6944#[non_exhaustive]
6945pub struct CreateTimeSeriesError {
6946    /// DEPRECATED. Time series ID that resulted in the `status` error.
6947    #[deprecated]
6948    pub time_series: std::option::Option<crate::model::TimeSeries>,
6949
6950    /// DEPRECATED. The status of the requested write operation for `time_series`.
6951    #[deprecated]
6952    pub status: std::option::Option<rpc::model::Status>,
6953
6954    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6955}
6956
6957impl CreateTimeSeriesError {
6958    pub fn new() -> Self {
6959        std::default::Default::default()
6960    }
6961
6962    /// Sets the value of [time_series][crate::model::CreateTimeSeriesError::time_series].
6963    #[deprecated]
6964    pub fn set_time_series<T>(mut self, v: T) -> Self
6965    where
6966        T: std::convert::Into<crate::model::TimeSeries>,
6967    {
6968        self.time_series = std::option::Option::Some(v.into());
6969        self
6970    }
6971
6972    /// Sets or clears the value of [time_series][crate::model::CreateTimeSeriesError::time_series].
6973    #[deprecated]
6974    pub fn set_or_clear_time_series<T>(mut self, v: std::option::Option<T>) -> Self
6975    where
6976        T: std::convert::Into<crate::model::TimeSeries>,
6977    {
6978        self.time_series = v.map(|x| x.into());
6979        self
6980    }
6981
6982    /// Sets the value of [status][crate::model::CreateTimeSeriesError::status].
6983    #[deprecated]
6984    pub fn set_status<T>(mut self, v: T) -> Self
6985    where
6986        T: std::convert::Into<rpc::model::Status>,
6987    {
6988        self.status = std::option::Option::Some(v.into());
6989        self
6990    }
6991
6992    /// Sets or clears the value of [status][crate::model::CreateTimeSeriesError::status].
6993    #[deprecated]
6994    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
6995    where
6996        T: std::convert::Into<rpc::model::Status>,
6997    {
6998        self.status = v.map(|x| x.into());
6999        self
7000    }
7001}
7002
7003impl wkt::message::Message for CreateTimeSeriesError {
7004    fn typename() -> &'static str {
7005        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesError"
7006    }
7007}
7008
7009/// Summary of the result of a failed request to write data to a time series.
7010#[derive(Clone, Default, PartialEq)]
7011#[non_exhaustive]
7012pub struct CreateTimeSeriesSummary {
7013    /// The number of points in the request.
7014    pub total_point_count: i32,
7015
7016    /// The number of points that were successfully written.
7017    pub success_point_count: i32,
7018
7019    /// The number of points that failed to be written. Order is not guaranteed.
7020    pub errors: std::vec::Vec<crate::model::create_time_series_summary::Error>,
7021
7022    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7023}
7024
7025impl CreateTimeSeriesSummary {
7026    pub fn new() -> Self {
7027        std::default::Default::default()
7028    }
7029
7030    /// Sets the value of [total_point_count][crate::model::CreateTimeSeriesSummary::total_point_count].
7031    pub fn set_total_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7032        self.total_point_count = v.into();
7033        self
7034    }
7035
7036    /// Sets the value of [success_point_count][crate::model::CreateTimeSeriesSummary::success_point_count].
7037    pub fn set_success_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7038        self.success_point_count = v.into();
7039        self
7040    }
7041
7042    /// Sets the value of [errors][crate::model::CreateTimeSeriesSummary::errors].
7043    pub fn set_errors<T, V>(mut self, v: T) -> Self
7044    where
7045        T: std::iter::IntoIterator<Item = V>,
7046        V: std::convert::Into<crate::model::create_time_series_summary::Error>,
7047    {
7048        use std::iter::Iterator;
7049        self.errors = v.into_iter().map(|i| i.into()).collect();
7050        self
7051    }
7052}
7053
7054impl wkt::message::Message for CreateTimeSeriesSummary {
7055    fn typename() -> &'static str {
7056        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesSummary"
7057    }
7058}
7059
7060/// Defines additional types related to [CreateTimeSeriesSummary].
7061pub mod create_time_series_summary {
7062    #[allow(unused_imports)]
7063    use super::*;
7064
7065    /// Detailed information about an error category.
7066    #[derive(Clone, Default, PartialEq)]
7067    #[non_exhaustive]
7068    pub struct Error {
7069        /// The status of the requested write operation.
7070        pub status: std::option::Option<rpc::model::Status>,
7071
7072        /// The number of points that couldn't be written because of `status`.
7073        pub point_count: i32,
7074
7075        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7076    }
7077
7078    impl Error {
7079        pub fn new() -> Self {
7080            std::default::Default::default()
7081        }
7082
7083        /// Sets the value of [status][crate::model::create_time_series_summary::Error::status].
7084        pub fn set_status<T>(mut self, v: T) -> Self
7085        where
7086            T: std::convert::Into<rpc::model::Status>,
7087        {
7088            self.status = std::option::Option::Some(v.into());
7089            self
7090        }
7091
7092        /// Sets or clears the value of [status][crate::model::create_time_series_summary::Error::status].
7093        pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
7094        where
7095            T: std::convert::Into<rpc::model::Status>,
7096        {
7097            self.status = v.map(|x| x.into());
7098            self
7099        }
7100
7101        /// Sets the value of [point_count][crate::model::create_time_series_summary::Error::point_count].
7102        pub fn set_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7103            self.point_count = v.into();
7104            self
7105        }
7106    }
7107
7108    impl wkt::message::Message for Error {
7109        fn typename() -> &'static str {
7110            "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesSummary.Error"
7111        }
7112    }
7113}
7114
7115/// The `QueryTimeSeries` request. For information about the status of
7116/// Monitoring Query Language (MQL), see the [MQL deprecation
7117/// notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
7118#[derive(Clone, Default, PartialEq)]
7119#[non_exhaustive]
7120#[deprecated]
7121pub struct QueryTimeSeriesRequest {
7122    /// Required. The
7123    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
7124    /// to execute the request. The format is:
7125    ///
7126    /// ```norust
7127    /// projects/[PROJECT_ID_OR_NUMBER]
7128    /// ```
7129    pub name: std::string::String,
7130
7131    /// Required. The query in the [Monitoring Query
7132    /// Language](https://cloud.google.com/monitoring/mql/reference) format.
7133    /// The default time zone is in UTC.
7134    pub query: std::string::String,
7135
7136    /// A positive number that is the maximum number of time_series_data to return.
7137    pub page_size: i32,
7138
7139    /// If this field is not empty then it must contain the `nextPageToken` value
7140    /// returned by a previous call to this method.  Using this field causes the
7141    /// method to return additional results from the previous method call.
7142    pub page_token: std::string::String,
7143
7144    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7145}
7146
7147impl QueryTimeSeriesRequest {
7148    pub fn new() -> Self {
7149        std::default::Default::default()
7150    }
7151
7152    /// Sets the value of [name][crate::model::QueryTimeSeriesRequest::name].
7153    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7154        self.name = v.into();
7155        self
7156    }
7157
7158    /// Sets the value of [query][crate::model::QueryTimeSeriesRequest::query].
7159    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7160        self.query = v.into();
7161        self
7162    }
7163
7164    /// Sets the value of [page_size][crate::model::QueryTimeSeriesRequest::page_size].
7165    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7166        self.page_size = v.into();
7167        self
7168    }
7169
7170    /// Sets the value of [page_token][crate::model::QueryTimeSeriesRequest::page_token].
7171    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7172        self.page_token = v.into();
7173        self
7174    }
7175}
7176
7177impl wkt::message::Message for QueryTimeSeriesRequest {
7178    fn typename() -> &'static str {
7179        "type.googleapis.com/google.monitoring.v3.QueryTimeSeriesRequest"
7180    }
7181}
7182
7183/// The `QueryTimeSeries` response. For information about the status of
7184/// Monitoring Query Language (MQL), see the [MQL deprecation
7185/// notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
7186#[derive(Clone, Default, PartialEq)]
7187#[non_exhaustive]
7188#[deprecated]
7189pub struct QueryTimeSeriesResponse {
7190    /// The descriptor for the time series data.
7191    pub time_series_descriptor: std::option::Option<crate::model::TimeSeriesDescriptor>,
7192
7193    /// The time series data.
7194    pub time_series_data: std::vec::Vec<crate::model::TimeSeriesData>,
7195
7196    /// If there are more results than have been returned, then this field is set
7197    /// to a non-empty value.  To see the additional results, use that value as
7198    /// `page_token` in the next call to this method.
7199    pub next_page_token: std::string::String,
7200
7201    /// Query execution errors that may have caused the time series data returned
7202    /// to be incomplete. The available data will be available in the
7203    /// response.
7204    pub partial_errors: std::vec::Vec<rpc::model::Status>,
7205
7206    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7207}
7208
7209impl QueryTimeSeriesResponse {
7210    pub fn new() -> Self {
7211        std::default::Default::default()
7212    }
7213
7214    /// Sets the value of [time_series_descriptor][crate::model::QueryTimeSeriesResponse::time_series_descriptor].
7215    pub fn set_time_series_descriptor<T>(mut self, v: T) -> Self
7216    where
7217        T: std::convert::Into<crate::model::TimeSeriesDescriptor>,
7218    {
7219        self.time_series_descriptor = std::option::Option::Some(v.into());
7220        self
7221    }
7222
7223    /// Sets or clears the value of [time_series_descriptor][crate::model::QueryTimeSeriesResponse::time_series_descriptor].
7224    pub fn set_or_clear_time_series_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
7225    where
7226        T: std::convert::Into<crate::model::TimeSeriesDescriptor>,
7227    {
7228        self.time_series_descriptor = v.map(|x| x.into());
7229        self
7230    }
7231
7232    /// Sets the value of [time_series_data][crate::model::QueryTimeSeriesResponse::time_series_data].
7233    pub fn set_time_series_data<T, V>(mut self, v: T) -> Self
7234    where
7235        T: std::iter::IntoIterator<Item = V>,
7236        V: std::convert::Into<crate::model::TimeSeriesData>,
7237    {
7238        use std::iter::Iterator;
7239        self.time_series_data = v.into_iter().map(|i| i.into()).collect();
7240        self
7241    }
7242
7243    /// Sets the value of [next_page_token][crate::model::QueryTimeSeriesResponse::next_page_token].
7244    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7245        self.next_page_token = v.into();
7246        self
7247    }
7248
7249    /// Sets the value of [partial_errors][crate::model::QueryTimeSeriesResponse::partial_errors].
7250    pub fn set_partial_errors<T, V>(mut self, v: T) -> Self
7251    where
7252        T: std::iter::IntoIterator<Item = V>,
7253        V: std::convert::Into<rpc::model::Status>,
7254    {
7255        use std::iter::Iterator;
7256        self.partial_errors = v.into_iter().map(|i| i.into()).collect();
7257        self
7258    }
7259}
7260
7261impl wkt::message::Message for QueryTimeSeriesResponse {
7262    fn typename() -> &'static str {
7263        "type.googleapis.com/google.monitoring.v3.QueryTimeSeriesResponse"
7264    }
7265}
7266
7267#[doc(hidden)]
7268impl gax::paginator::internal::PageableResponse for QueryTimeSeriesResponse {
7269    type PageItem = crate::model::TimeSeriesData;
7270
7271    fn items(self) -> std::vec::Vec<Self::PageItem> {
7272        self.time_series_data
7273    }
7274
7275    fn next_page_token(&self) -> std::string::String {
7276        use std::clone::Clone;
7277        self.next_page_token.clone()
7278    }
7279}
7280
7281/// This is an error detail intended to be used with INVALID_ARGUMENT errors.
7282#[derive(Clone, Default, PartialEq)]
7283#[non_exhaustive]
7284pub struct QueryErrorList {
7285    /// Errors in parsing the time series query language text. The number of errors
7286    /// in the response may be limited.
7287    pub errors: std::vec::Vec<crate::model::QueryError>,
7288
7289    /// A summary of all the errors.
7290    pub error_summary: std::string::String,
7291
7292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7293}
7294
7295impl QueryErrorList {
7296    pub fn new() -> Self {
7297        std::default::Default::default()
7298    }
7299
7300    /// Sets the value of [errors][crate::model::QueryErrorList::errors].
7301    pub fn set_errors<T, V>(mut self, v: T) -> Self
7302    where
7303        T: std::iter::IntoIterator<Item = V>,
7304        V: std::convert::Into<crate::model::QueryError>,
7305    {
7306        use std::iter::Iterator;
7307        self.errors = v.into_iter().map(|i| i.into()).collect();
7308        self
7309    }
7310
7311    /// Sets the value of [error_summary][crate::model::QueryErrorList::error_summary].
7312    pub fn set_error_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7313        self.error_summary = v.into();
7314        self
7315    }
7316}
7317
7318impl wkt::message::Message for QueryErrorList {
7319    fn typename() -> &'static str {
7320        "type.googleapis.com/google.monitoring.v3.QueryErrorList"
7321    }
7322}
7323
7324/// Describes a change made to a configuration.
7325#[derive(Clone, Default, PartialEq)]
7326#[non_exhaustive]
7327pub struct MutationRecord {
7328    /// When the change occurred.
7329    pub mutate_time: std::option::Option<wkt::Timestamp>,
7330
7331    /// The email address of the user making the change.
7332    pub mutated_by: std::string::String,
7333
7334    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7335}
7336
7337impl MutationRecord {
7338    pub fn new() -> Self {
7339        std::default::Default::default()
7340    }
7341
7342    /// Sets the value of [mutate_time][crate::model::MutationRecord::mutate_time].
7343    pub fn set_mutate_time<T>(mut self, v: T) -> Self
7344    where
7345        T: std::convert::Into<wkt::Timestamp>,
7346    {
7347        self.mutate_time = std::option::Option::Some(v.into());
7348        self
7349    }
7350
7351    /// Sets or clears the value of [mutate_time][crate::model::MutationRecord::mutate_time].
7352    pub fn set_or_clear_mutate_time<T>(mut self, v: std::option::Option<T>) -> Self
7353    where
7354        T: std::convert::Into<wkt::Timestamp>,
7355    {
7356        self.mutate_time = v.map(|x| x.into());
7357        self
7358    }
7359
7360    /// Sets the value of [mutated_by][crate::model::MutationRecord::mutated_by].
7361    pub fn set_mutated_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7362        self.mutated_by = v.into();
7363        self
7364    }
7365}
7366
7367impl wkt::message::Message for MutationRecord {
7368    fn typename() -> &'static str {
7369        "type.googleapis.com/google.monitoring.v3.MutationRecord"
7370    }
7371}
7372
7373/// A description of a notification channel. The descriptor includes
7374/// the properties of the channel and the set of labels or fields that
7375/// must be specified to configure channels of a given type.
7376#[derive(Clone, Default, PartialEq)]
7377#[non_exhaustive]
7378pub struct NotificationChannelDescriptor {
7379    /// The full REST resource name for this descriptor. The format is:
7380    ///
7381    /// ```norust
7382    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE]
7383    /// ```
7384    ///
7385    /// In the above, `[TYPE]` is the value of the `type` field.
7386    pub name: std::string::String,
7387
7388    /// The type of notification channel, such as "email" and "sms". To view the
7389    /// full list of channels, see
7390    /// [Channel
7391    /// descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd).
7392    /// Notification channel types are globally unique.
7393    pub r#type: std::string::String,
7394
7395    /// A human-readable name for the notification channel type.  This
7396    /// form of the name is suitable for a user interface.
7397    pub display_name: std::string::String,
7398
7399    /// A human-readable description of the notification channel
7400    /// type. The description may include a description of the properties
7401    /// of the channel and pointers to external documentation.
7402    pub description: std::string::String,
7403
7404    /// The set of labels that must be defined to identify a particular
7405    /// channel of the corresponding type. Each label includes a
7406    /// description for how that field should be populated.
7407    pub labels: std::vec::Vec<api::model::LabelDescriptor>,
7408
7409    /// The tiers that support this notification channel; the project service tier
7410    /// must be one of the supported_tiers.
7411    #[deprecated]
7412    pub supported_tiers: std::vec::Vec<crate::model::ServiceTier>,
7413
7414    /// The product launch stage for channels of this type.
7415    pub launch_stage: api::model::LaunchStage,
7416
7417    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7418}
7419
7420impl NotificationChannelDescriptor {
7421    pub fn new() -> Self {
7422        std::default::Default::default()
7423    }
7424
7425    /// Sets the value of [name][crate::model::NotificationChannelDescriptor::name].
7426    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7427        self.name = v.into();
7428        self
7429    }
7430
7431    /// Sets the value of [r#type][crate::model::NotificationChannelDescriptor::type].
7432    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7433        self.r#type = v.into();
7434        self
7435    }
7436
7437    /// Sets the value of [display_name][crate::model::NotificationChannelDescriptor::display_name].
7438    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7439        self.display_name = v.into();
7440        self
7441    }
7442
7443    /// Sets the value of [description][crate::model::NotificationChannelDescriptor::description].
7444    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7445        self.description = v.into();
7446        self
7447    }
7448
7449    /// Sets the value of [labels][crate::model::NotificationChannelDescriptor::labels].
7450    pub fn set_labels<T, V>(mut self, v: T) -> Self
7451    where
7452        T: std::iter::IntoIterator<Item = V>,
7453        V: std::convert::Into<api::model::LabelDescriptor>,
7454    {
7455        use std::iter::Iterator;
7456        self.labels = v.into_iter().map(|i| i.into()).collect();
7457        self
7458    }
7459
7460    /// Sets the value of [supported_tiers][crate::model::NotificationChannelDescriptor::supported_tiers].
7461    #[deprecated]
7462    pub fn set_supported_tiers<T, V>(mut self, v: T) -> Self
7463    where
7464        T: std::iter::IntoIterator<Item = V>,
7465        V: std::convert::Into<crate::model::ServiceTier>,
7466    {
7467        use std::iter::Iterator;
7468        self.supported_tiers = v.into_iter().map(|i| i.into()).collect();
7469        self
7470    }
7471
7472    /// Sets the value of [launch_stage][crate::model::NotificationChannelDescriptor::launch_stage].
7473    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
7474        mut self,
7475        v: T,
7476    ) -> Self {
7477        self.launch_stage = v.into();
7478        self
7479    }
7480}
7481
7482impl wkt::message::Message for NotificationChannelDescriptor {
7483    fn typename() -> &'static str {
7484        "type.googleapis.com/google.monitoring.v3.NotificationChannelDescriptor"
7485    }
7486}
7487
7488/// A `NotificationChannel` is a medium through which an alert is
7489/// delivered when a policy violation is detected. Examples of channels
7490/// include email, SMS, and third-party messaging applications. Fields
7491/// containing sensitive information like authentication tokens or
7492/// contact info are only partially populated on retrieval.
7493#[derive(Clone, Default, PartialEq)]
7494#[non_exhaustive]
7495pub struct NotificationChannel {
7496    /// The type of the notification channel. This field matches the
7497    /// value of the
7498    /// [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type]
7499    /// field.
7500    ///
7501    /// [google.monitoring.v3.NotificationChannelDescriptor.type]: crate::model::NotificationChannelDescriptor::type
7502    pub r#type: std::string::String,
7503
7504    /// Identifier. The full REST resource name for this channel. The format is:
7505    ///
7506    /// ```norust
7507    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
7508    /// ```
7509    ///
7510    /// The `[CHANNEL_ID]` is automatically assigned by the server on creation.
7511    pub name: std::string::String,
7512
7513    /// An optional human-readable name for this notification channel. It is
7514    /// recommended that you specify a non-empty and unique name in order to
7515    /// make it easier to identify the channels in your project, though this is
7516    /// not enforced. The display name is limited to 512 Unicode characters.
7517    pub display_name: std::string::String,
7518
7519    /// An optional human-readable description of this notification channel. This
7520    /// description may provide additional details, beyond the display
7521    /// name, for the channel. This may not exceed 1024 Unicode characters.
7522    pub description: std::string::String,
7523
7524    /// Configuration fields that define the channel and its behavior. The
7525    /// permissible and required labels are specified in the
7526    /// [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels]
7527    /// of the `NotificationChannelDescriptor` corresponding to the `type` field.
7528    ///
7529    /// [google.monitoring.v3.NotificationChannelDescriptor.labels]: crate::model::NotificationChannelDescriptor::labels
7530    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7531
7532    /// User-supplied key/value data that does not need to conform to
7533    /// the corresponding `NotificationChannelDescriptor`'s schema, unlike
7534    /// the `labels` field. This field is intended to be used for organizing
7535    /// and identifying the `NotificationChannel` objects.
7536    ///
7537    /// The field can contain up to 64 entries. Each key and value is limited to
7538    /// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
7539    /// values can contain only lowercase letters, numerals, underscores, and
7540    /// dashes. Keys must begin with a letter.
7541    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
7542
7543    /// Indicates whether this channel has been verified or not. On a
7544    /// [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
7545    /// or
7546    /// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
7547    /// operation, this field is expected to be populated.
7548    ///
7549    /// If the value is `UNVERIFIED`, then it indicates that the channel is
7550    /// non-functioning (it both requires verification and lacks verification);
7551    /// otherwise, it is assumed that the channel works.
7552    ///
7553    /// If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that
7554    /// the channel is of a type that does not require verification or that
7555    /// this specific channel has been exempted from verification because it was
7556    /// created prior to verification being required for channels of this type.
7557    ///
7558    /// This field cannot be modified using a standard
7559    /// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
7560    /// operation. To change the value of this field, you must call
7561    /// [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel].
7562    ///
7563    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannel]: crate::client::NotificationChannelService::get_notification_channel
7564    /// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]: crate::client::NotificationChannelService::list_notification_channels
7565    /// [google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]: crate::client::NotificationChannelService::update_notification_channel
7566    /// [google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]: crate::client::NotificationChannelService::verify_notification_channel
7567    pub verification_status: crate::model::notification_channel::VerificationStatus,
7568
7569    /// Whether notifications are forwarded to the described channel. This makes
7570    /// it possible to disable delivery of notifications to a particular channel
7571    /// without removing the channel from all alerting policies that reference
7572    /// the channel. This is a more convenient approach when the change is
7573    /// temporary and you want to receive notifications from the same set
7574    /// of alerting policies on the channel at some point in the future.
7575    pub enabled: std::option::Option<wkt::BoolValue>,
7576
7577    /// Record of the creation of this channel.
7578    pub creation_record: std::option::Option<crate::model::MutationRecord>,
7579
7580    /// Records of the modification of this channel.
7581    pub mutation_records: std::vec::Vec<crate::model::MutationRecord>,
7582
7583    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7584}
7585
7586impl NotificationChannel {
7587    pub fn new() -> Self {
7588        std::default::Default::default()
7589    }
7590
7591    /// Sets the value of [r#type][crate::model::NotificationChannel::type].
7592    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7593        self.r#type = v.into();
7594        self
7595    }
7596
7597    /// Sets the value of [name][crate::model::NotificationChannel::name].
7598    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7599        self.name = v.into();
7600        self
7601    }
7602
7603    /// Sets the value of [display_name][crate::model::NotificationChannel::display_name].
7604    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7605        self.display_name = v.into();
7606        self
7607    }
7608
7609    /// Sets the value of [description][crate::model::NotificationChannel::description].
7610    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7611        self.description = v.into();
7612        self
7613    }
7614
7615    /// Sets the value of [labels][crate::model::NotificationChannel::labels].
7616    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7617    where
7618        T: std::iter::IntoIterator<Item = (K, V)>,
7619        K: std::convert::Into<std::string::String>,
7620        V: std::convert::Into<std::string::String>,
7621    {
7622        use std::iter::Iterator;
7623        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7624        self
7625    }
7626
7627    /// Sets the value of [user_labels][crate::model::NotificationChannel::user_labels].
7628    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7629    where
7630        T: std::iter::IntoIterator<Item = (K, V)>,
7631        K: std::convert::Into<std::string::String>,
7632        V: std::convert::Into<std::string::String>,
7633    {
7634        use std::iter::Iterator;
7635        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7636        self
7637    }
7638
7639    /// Sets the value of [verification_status][crate::model::NotificationChannel::verification_status].
7640    pub fn set_verification_status<
7641        T: std::convert::Into<crate::model::notification_channel::VerificationStatus>,
7642    >(
7643        mut self,
7644        v: T,
7645    ) -> Self {
7646        self.verification_status = v.into();
7647        self
7648    }
7649
7650    /// Sets the value of [enabled][crate::model::NotificationChannel::enabled].
7651    pub fn set_enabled<T>(mut self, v: T) -> Self
7652    where
7653        T: std::convert::Into<wkt::BoolValue>,
7654    {
7655        self.enabled = std::option::Option::Some(v.into());
7656        self
7657    }
7658
7659    /// Sets or clears the value of [enabled][crate::model::NotificationChannel::enabled].
7660    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
7661    where
7662        T: std::convert::Into<wkt::BoolValue>,
7663    {
7664        self.enabled = v.map(|x| x.into());
7665        self
7666    }
7667
7668    /// Sets the value of [creation_record][crate::model::NotificationChannel::creation_record].
7669    pub fn set_creation_record<T>(mut self, v: T) -> Self
7670    where
7671        T: std::convert::Into<crate::model::MutationRecord>,
7672    {
7673        self.creation_record = std::option::Option::Some(v.into());
7674        self
7675    }
7676
7677    /// Sets or clears the value of [creation_record][crate::model::NotificationChannel::creation_record].
7678    pub fn set_or_clear_creation_record<T>(mut self, v: std::option::Option<T>) -> Self
7679    where
7680        T: std::convert::Into<crate::model::MutationRecord>,
7681    {
7682        self.creation_record = v.map(|x| x.into());
7683        self
7684    }
7685
7686    /// Sets the value of [mutation_records][crate::model::NotificationChannel::mutation_records].
7687    pub fn set_mutation_records<T, V>(mut self, v: T) -> Self
7688    where
7689        T: std::iter::IntoIterator<Item = V>,
7690        V: std::convert::Into<crate::model::MutationRecord>,
7691    {
7692        use std::iter::Iterator;
7693        self.mutation_records = v.into_iter().map(|i| i.into()).collect();
7694        self
7695    }
7696}
7697
7698impl wkt::message::Message for NotificationChannel {
7699    fn typename() -> &'static str {
7700        "type.googleapis.com/google.monitoring.v3.NotificationChannel"
7701    }
7702}
7703
7704/// Defines additional types related to [NotificationChannel].
7705pub mod notification_channel {
7706    #[allow(unused_imports)]
7707    use super::*;
7708
7709    /// Indicates whether the channel has been verified or not. It is illegal
7710    /// to specify this field in a
7711    /// [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]
7712    /// or an
7713    /// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
7714    /// operation.
7715    ///
7716    /// [google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]: crate::client::NotificationChannelService::create_notification_channel
7717    /// [google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]: crate::client::NotificationChannelService::update_notification_channel
7718    ///
7719    /// # Working with unknown values
7720    ///
7721    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7722    /// additional enum variants at any time. Adding new variants is not considered
7723    /// a breaking change. Applications should write their code in anticipation of:
7724    ///
7725    /// - New values appearing in future releases of the client library, **and**
7726    /// - New values received dynamically, without application changes.
7727    ///
7728    /// Please consult the [Working with enums] section in the user guide for some
7729    /// guidelines.
7730    ///
7731    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7732    #[derive(Clone, Debug, PartialEq)]
7733    #[non_exhaustive]
7734    pub enum VerificationStatus {
7735        /// Sentinel value used to indicate that the state is unknown, omitted, or
7736        /// is not applicable (as in the case of channels that neither support
7737        /// nor require verification in order to function).
7738        Unspecified,
7739        /// The channel has yet to be verified and requires verification to function.
7740        /// Note that this state also applies to the case where the verification
7741        /// process has been initiated by sending a verification code but where
7742        /// the verification code has not been submitted to complete the process.
7743        Unverified,
7744        /// It has been proven that notifications can be received on this
7745        /// notification channel and that someone on the project has access
7746        /// to messages that are delivered to that channel.
7747        Verified,
7748        /// If set, the enum was initialized with an unknown value.
7749        ///
7750        /// Applications can examine the value using [VerificationStatus::value] or
7751        /// [VerificationStatus::name].
7752        UnknownValue(verification_status::UnknownValue),
7753    }
7754
7755    #[doc(hidden)]
7756    pub mod verification_status {
7757        #[allow(unused_imports)]
7758        use super::*;
7759        #[derive(Clone, Debug, PartialEq)]
7760        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7761    }
7762
7763    impl VerificationStatus {
7764        /// Gets the enum value.
7765        ///
7766        /// Returns `None` if the enum contains an unknown value deserialized from
7767        /// the string representation of enums.
7768        pub fn value(&self) -> std::option::Option<i32> {
7769            match self {
7770                Self::Unspecified => std::option::Option::Some(0),
7771                Self::Unverified => std::option::Option::Some(1),
7772                Self::Verified => std::option::Option::Some(2),
7773                Self::UnknownValue(u) => u.0.value(),
7774            }
7775        }
7776
7777        /// Gets the enum value as a string.
7778        ///
7779        /// Returns `None` if the enum contains an unknown value deserialized from
7780        /// the integer representation of enums.
7781        pub fn name(&self) -> std::option::Option<&str> {
7782            match self {
7783                Self::Unspecified => std::option::Option::Some("VERIFICATION_STATUS_UNSPECIFIED"),
7784                Self::Unverified => std::option::Option::Some("UNVERIFIED"),
7785                Self::Verified => std::option::Option::Some("VERIFIED"),
7786                Self::UnknownValue(u) => u.0.name(),
7787            }
7788        }
7789    }
7790
7791    impl std::default::Default for VerificationStatus {
7792        fn default() -> Self {
7793            use std::convert::From;
7794            Self::from(0)
7795        }
7796    }
7797
7798    impl std::fmt::Display for VerificationStatus {
7799        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7800            wkt::internal::display_enum(f, self.name(), self.value())
7801        }
7802    }
7803
7804    impl std::convert::From<i32> for VerificationStatus {
7805        fn from(value: i32) -> Self {
7806            match value {
7807                0 => Self::Unspecified,
7808                1 => Self::Unverified,
7809                2 => Self::Verified,
7810                _ => Self::UnknownValue(verification_status::UnknownValue(
7811                    wkt::internal::UnknownEnumValue::Integer(value),
7812                )),
7813            }
7814        }
7815    }
7816
7817    impl std::convert::From<&str> for VerificationStatus {
7818        fn from(value: &str) -> Self {
7819            use std::string::ToString;
7820            match value {
7821                "VERIFICATION_STATUS_UNSPECIFIED" => Self::Unspecified,
7822                "UNVERIFIED" => Self::Unverified,
7823                "VERIFIED" => Self::Verified,
7824                _ => Self::UnknownValue(verification_status::UnknownValue(
7825                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7826                )),
7827            }
7828        }
7829    }
7830
7831    impl serde::ser::Serialize for VerificationStatus {
7832        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7833        where
7834            S: serde::Serializer,
7835        {
7836            match self {
7837                Self::Unspecified => serializer.serialize_i32(0),
7838                Self::Unverified => serializer.serialize_i32(1),
7839                Self::Verified => serializer.serialize_i32(2),
7840                Self::UnknownValue(u) => u.0.serialize(serializer),
7841            }
7842        }
7843    }
7844
7845    impl<'de> serde::de::Deserialize<'de> for VerificationStatus {
7846        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7847        where
7848            D: serde::Deserializer<'de>,
7849        {
7850            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerificationStatus>::new(
7851                ".google.monitoring.v3.NotificationChannel.VerificationStatus",
7852            ))
7853        }
7854    }
7855}
7856
7857/// The `ListNotificationChannelDescriptors` request.
7858#[derive(Clone, Default, PartialEq)]
7859#[non_exhaustive]
7860pub struct ListNotificationChannelDescriptorsRequest {
7861    /// Required. The REST resource name of the parent from which to retrieve
7862    /// the notification channel descriptors. The expected syntax is:
7863    ///
7864    /// ```norust
7865    /// projects/[PROJECT_ID_OR_NUMBER]
7866    /// ```
7867    ///
7868    /// Note that this
7869    /// [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent
7870    /// container in which to look for the descriptors; to retrieve a single
7871    /// descriptor by name, use the
7872    /// [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
7873    /// operation, instead.
7874    ///
7875    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]: crate::client::NotificationChannelService::get_notification_channel_descriptor
7876    pub name: std::string::String,
7877
7878    /// The maximum number of results to return in a single response. If
7879    /// not set to a positive number, a reasonable value will be chosen by the
7880    /// service.
7881    pub page_size: i32,
7882
7883    /// If non-empty, `page_token` must contain a value returned as the
7884    /// `next_page_token` in a previous response to request the next set
7885    /// of results.
7886    pub page_token: std::string::String,
7887
7888    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7889}
7890
7891impl ListNotificationChannelDescriptorsRequest {
7892    pub fn new() -> Self {
7893        std::default::Default::default()
7894    }
7895
7896    /// Sets the value of [name][crate::model::ListNotificationChannelDescriptorsRequest::name].
7897    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7898        self.name = v.into();
7899        self
7900    }
7901
7902    /// Sets the value of [page_size][crate::model::ListNotificationChannelDescriptorsRequest::page_size].
7903    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7904        self.page_size = v.into();
7905        self
7906    }
7907
7908    /// Sets the value of [page_token][crate::model::ListNotificationChannelDescriptorsRequest::page_token].
7909    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7910        self.page_token = v.into();
7911        self
7912    }
7913}
7914
7915impl wkt::message::Message for ListNotificationChannelDescriptorsRequest {
7916    fn typename() -> &'static str {
7917        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelDescriptorsRequest"
7918    }
7919}
7920
7921/// The `ListNotificationChannelDescriptors` response.
7922#[derive(Clone, Default, PartialEq)]
7923#[non_exhaustive]
7924pub struct ListNotificationChannelDescriptorsResponse {
7925    /// The monitored resource descriptors supported for the specified
7926    /// project, optionally filtered.
7927    pub channel_descriptors: std::vec::Vec<crate::model::NotificationChannelDescriptor>,
7928
7929    /// If not empty, indicates that there may be more results that match
7930    /// the request. Use the value in the `page_token` field in a
7931    /// subsequent request to fetch the next set of results. If empty,
7932    /// all results have been returned.
7933    pub next_page_token: std::string::String,
7934
7935    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7936}
7937
7938impl ListNotificationChannelDescriptorsResponse {
7939    pub fn new() -> Self {
7940        std::default::Default::default()
7941    }
7942
7943    /// Sets the value of [channel_descriptors][crate::model::ListNotificationChannelDescriptorsResponse::channel_descriptors].
7944    pub fn set_channel_descriptors<T, V>(mut self, v: T) -> Self
7945    where
7946        T: std::iter::IntoIterator<Item = V>,
7947        V: std::convert::Into<crate::model::NotificationChannelDescriptor>,
7948    {
7949        use std::iter::Iterator;
7950        self.channel_descriptors = v.into_iter().map(|i| i.into()).collect();
7951        self
7952    }
7953
7954    /// Sets the value of [next_page_token][crate::model::ListNotificationChannelDescriptorsResponse::next_page_token].
7955    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7956        self.next_page_token = v.into();
7957        self
7958    }
7959}
7960
7961impl wkt::message::Message for ListNotificationChannelDescriptorsResponse {
7962    fn typename() -> &'static str {
7963        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelDescriptorsResponse"
7964    }
7965}
7966
7967#[doc(hidden)]
7968impl gax::paginator::internal::PageableResponse for ListNotificationChannelDescriptorsResponse {
7969    type PageItem = crate::model::NotificationChannelDescriptor;
7970
7971    fn items(self) -> std::vec::Vec<Self::PageItem> {
7972        self.channel_descriptors
7973    }
7974
7975    fn next_page_token(&self) -> std::string::String {
7976        use std::clone::Clone;
7977        self.next_page_token.clone()
7978    }
7979}
7980
7981/// The `GetNotificationChannelDescriptor` response.
7982#[derive(Clone, Default, PartialEq)]
7983#[non_exhaustive]
7984pub struct GetNotificationChannelDescriptorRequest {
7985    /// Required. The channel type for which to execute the request. The format is:
7986    ///
7987    /// ```norust
7988    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
7989    /// ```
7990    pub name: std::string::String,
7991
7992    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7993}
7994
7995impl GetNotificationChannelDescriptorRequest {
7996    pub fn new() -> Self {
7997        std::default::Default::default()
7998    }
7999
8000    /// Sets the value of [name][crate::model::GetNotificationChannelDescriptorRequest::name].
8001    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8002        self.name = v.into();
8003        self
8004    }
8005}
8006
8007impl wkt::message::Message for GetNotificationChannelDescriptorRequest {
8008    fn typename() -> &'static str {
8009        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelDescriptorRequest"
8010    }
8011}
8012
8013/// The `CreateNotificationChannel` request.
8014#[derive(Clone, Default, PartialEq)]
8015#[non_exhaustive]
8016pub struct CreateNotificationChannelRequest {
8017    /// Required. The
8018    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
8019    /// to execute the request. The format is:
8020    ///
8021    /// ```norust
8022    /// projects/[PROJECT_ID_OR_NUMBER]
8023    /// ```
8024    ///
8025    /// This names the container into which the channel will be
8026    /// written, this does not name the newly created channel. The resulting
8027    /// channel's name will have a normalized version of this field as a prefix,
8028    /// but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
8029    pub name: std::string::String,
8030
8031    /// Required. The definition of the `NotificationChannel` to create.
8032    pub notification_channel: std::option::Option<crate::model::NotificationChannel>,
8033
8034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8035}
8036
8037impl CreateNotificationChannelRequest {
8038    pub fn new() -> Self {
8039        std::default::Default::default()
8040    }
8041
8042    /// Sets the value of [name][crate::model::CreateNotificationChannelRequest::name].
8043    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8044        self.name = v.into();
8045        self
8046    }
8047
8048    /// Sets the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
8049    pub fn set_notification_channel<T>(mut self, v: T) -> Self
8050    where
8051        T: std::convert::Into<crate::model::NotificationChannel>,
8052    {
8053        self.notification_channel = std::option::Option::Some(v.into());
8054        self
8055    }
8056
8057    /// Sets or clears the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
8058    pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
8059    where
8060        T: std::convert::Into<crate::model::NotificationChannel>,
8061    {
8062        self.notification_channel = v.map(|x| x.into());
8063        self
8064    }
8065}
8066
8067impl wkt::message::Message for CreateNotificationChannelRequest {
8068    fn typename() -> &'static str {
8069        "type.googleapis.com/google.monitoring.v3.CreateNotificationChannelRequest"
8070    }
8071}
8072
8073/// The `ListNotificationChannels` request.
8074#[derive(Clone, Default, PartialEq)]
8075#[non_exhaustive]
8076pub struct ListNotificationChannelsRequest {
8077    /// Required. The
8078    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
8079    /// to execute the request. The format is:
8080    ///
8081    /// ```norust
8082    /// projects/[PROJECT_ID_OR_NUMBER]
8083    /// ```
8084    ///
8085    /// This names the container
8086    /// in which to look for the notification channels; it does not name a
8087    /// specific channel. To query a specific channel by REST resource name, use
8088    /// the
8089    /// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
8090    /// operation.
8091    ///
8092    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannel]: crate::client::NotificationChannelService::get_notification_channel
8093    pub name: std::string::String,
8094
8095    /// Optional. If provided, this field specifies the criteria that must be met
8096    /// by notification channels to be included in the response.
8097    ///
8098    /// For more details, see [sorting and
8099    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
8100    pub filter: std::string::String,
8101
8102    /// Optional. A comma-separated list of fields by which to sort the result.
8103    /// Supports the same set of fields as in `filter`. Entries can be prefixed
8104    /// with a minus sign to sort in descending rather than ascending order.
8105    ///
8106    /// For more details, see [sorting and
8107    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
8108    pub order_by: std::string::String,
8109
8110    /// Optional. The maximum number of results to return in a single response. If
8111    /// not set to a positive number, a reasonable value will be chosen by the
8112    /// service.
8113    pub page_size: i32,
8114
8115    /// Optional. If non-empty, `page_token` must contain a value returned as the
8116    /// `next_page_token` in a previous response to request the next set
8117    /// of results.
8118    pub page_token: std::string::String,
8119
8120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8121}
8122
8123impl ListNotificationChannelsRequest {
8124    pub fn new() -> Self {
8125        std::default::Default::default()
8126    }
8127
8128    /// Sets the value of [name][crate::model::ListNotificationChannelsRequest::name].
8129    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8130        self.name = v.into();
8131        self
8132    }
8133
8134    /// Sets the value of [filter][crate::model::ListNotificationChannelsRequest::filter].
8135    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8136        self.filter = v.into();
8137        self
8138    }
8139
8140    /// Sets the value of [order_by][crate::model::ListNotificationChannelsRequest::order_by].
8141    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8142        self.order_by = v.into();
8143        self
8144    }
8145
8146    /// Sets the value of [page_size][crate::model::ListNotificationChannelsRequest::page_size].
8147    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8148        self.page_size = v.into();
8149        self
8150    }
8151
8152    /// Sets the value of [page_token][crate::model::ListNotificationChannelsRequest::page_token].
8153    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8154        self.page_token = v.into();
8155        self
8156    }
8157}
8158
8159impl wkt::message::Message for ListNotificationChannelsRequest {
8160    fn typename() -> &'static str {
8161        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelsRequest"
8162    }
8163}
8164
8165/// The `ListNotificationChannels` response.
8166#[derive(Clone, Default, PartialEq)]
8167#[non_exhaustive]
8168pub struct ListNotificationChannelsResponse {
8169    /// The notification channels defined for the specified project.
8170    pub notification_channels: std::vec::Vec<crate::model::NotificationChannel>,
8171
8172    /// If not empty, indicates that there may be more results that match
8173    /// the request. Use the value in the `page_token` field in a
8174    /// subsequent request to fetch the next set of results. If empty,
8175    /// all results have been returned.
8176    pub next_page_token: std::string::String,
8177
8178    /// The total number of notification channels in all pages. This number is only
8179    /// an estimate, and may change in subsequent pages. <https://aip.dev/158>
8180    pub total_size: i32,
8181
8182    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8183}
8184
8185impl ListNotificationChannelsResponse {
8186    pub fn new() -> Self {
8187        std::default::Default::default()
8188    }
8189
8190    /// Sets the value of [notification_channels][crate::model::ListNotificationChannelsResponse::notification_channels].
8191    pub fn set_notification_channels<T, V>(mut self, v: T) -> Self
8192    where
8193        T: std::iter::IntoIterator<Item = V>,
8194        V: std::convert::Into<crate::model::NotificationChannel>,
8195    {
8196        use std::iter::Iterator;
8197        self.notification_channels = v.into_iter().map(|i| i.into()).collect();
8198        self
8199    }
8200
8201    /// Sets the value of [next_page_token][crate::model::ListNotificationChannelsResponse::next_page_token].
8202    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8203        self.next_page_token = v.into();
8204        self
8205    }
8206
8207    /// Sets the value of [total_size][crate::model::ListNotificationChannelsResponse::total_size].
8208    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8209        self.total_size = v.into();
8210        self
8211    }
8212}
8213
8214impl wkt::message::Message for ListNotificationChannelsResponse {
8215    fn typename() -> &'static str {
8216        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelsResponse"
8217    }
8218}
8219
8220#[doc(hidden)]
8221impl gax::paginator::internal::PageableResponse for ListNotificationChannelsResponse {
8222    type PageItem = crate::model::NotificationChannel;
8223
8224    fn items(self) -> std::vec::Vec<Self::PageItem> {
8225        self.notification_channels
8226    }
8227
8228    fn next_page_token(&self) -> std::string::String {
8229        use std::clone::Clone;
8230        self.next_page_token.clone()
8231    }
8232}
8233
8234/// The `GetNotificationChannel` request.
8235#[derive(Clone, Default, PartialEq)]
8236#[non_exhaustive]
8237pub struct GetNotificationChannelRequest {
8238    /// Required. The channel for which to execute the request. The format is:
8239    ///
8240    /// ```norust
8241    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
8242    /// ```
8243    pub name: std::string::String,
8244
8245    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8246}
8247
8248impl GetNotificationChannelRequest {
8249    pub fn new() -> Self {
8250        std::default::Default::default()
8251    }
8252
8253    /// Sets the value of [name][crate::model::GetNotificationChannelRequest::name].
8254    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8255        self.name = v.into();
8256        self
8257    }
8258}
8259
8260impl wkt::message::Message for GetNotificationChannelRequest {
8261    fn typename() -> &'static str {
8262        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelRequest"
8263    }
8264}
8265
8266/// The `UpdateNotificationChannel` request.
8267#[derive(Clone, Default, PartialEq)]
8268#[non_exhaustive]
8269pub struct UpdateNotificationChannelRequest {
8270    /// Optional. The fields to update.
8271    pub update_mask: std::option::Option<wkt::FieldMask>,
8272
8273    /// Required. A description of the changes to be applied to the specified
8274    /// notification channel. The description must provide a definition for
8275    /// fields to be updated; the names of these fields should also be
8276    /// included in the `update_mask`.
8277    pub notification_channel: std::option::Option<crate::model::NotificationChannel>,
8278
8279    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8280}
8281
8282impl UpdateNotificationChannelRequest {
8283    pub fn new() -> Self {
8284        std::default::Default::default()
8285    }
8286
8287    /// Sets the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
8288    pub fn set_update_mask<T>(mut self, v: T) -> Self
8289    where
8290        T: std::convert::Into<wkt::FieldMask>,
8291    {
8292        self.update_mask = std::option::Option::Some(v.into());
8293        self
8294    }
8295
8296    /// Sets or clears the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
8297    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8298    where
8299        T: std::convert::Into<wkt::FieldMask>,
8300    {
8301        self.update_mask = v.map(|x| x.into());
8302        self
8303    }
8304
8305    /// Sets the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
8306    pub fn set_notification_channel<T>(mut self, v: T) -> Self
8307    where
8308        T: std::convert::Into<crate::model::NotificationChannel>,
8309    {
8310        self.notification_channel = std::option::Option::Some(v.into());
8311        self
8312    }
8313
8314    /// Sets or clears the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
8315    pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
8316    where
8317        T: std::convert::Into<crate::model::NotificationChannel>,
8318    {
8319        self.notification_channel = v.map(|x| x.into());
8320        self
8321    }
8322}
8323
8324impl wkt::message::Message for UpdateNotificationChannelRequest {
8325    fn typename() -> &'static str {
8326        "type.googleapis.com/google.monitoring.v3.UpdateNotificationChannelRequest"
8327    }
8328}
8329
8330/// The `DeleteNotificationChannel` request.
8331#[derive(Clone, Default, PartialEq)]
8332#[non_exhaustive]
8333pub struct DeleteNotificationChannelRequest {
8334    /// Required. The channel for which to execute the request. The format is:
8335    ///
8336    /// ```norust
8337    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
8338    /// ```
8339    pub name: std::string::String,
8340
8341    /// If true, the notification channel will be deleted regardless of its
8342    /// use in alert policies (the policies will be updated to remove the
8343    /// channel). If false, this operation will fail if the notification channel
8344    /// is referenced by existing alerting policies.
8345    pub force: bool,
8346
8347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8348}
8349
8350impl DeleteNotificationChannelRequest {
8351    pub fn new() -> Self {
8352        std::default::Default::default()
8353    }
8354
8355    /// Sets the value of [name][crate::model::DeleteNotificationChannelRequest::name].
8356    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8357        self.name = v.into();
8358        self
8359    }
8360
8361    /// Sets the value of [force][crate::model::DeleteNotificationChannelRequest::force].
8362    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8363        self.force = v.into();
8364        self
8365    }
8366}
8367
8368impl wkt::message::Message for DeleteNotificationChannelRequest {
8369    fn typename() -> &'static str {
8370        "type.googleapis.com/google.monitoring.v3.DeleteNotificationChannelRequest"
8371    }
8372}
8373
8374/// The `SendNotificationChannelVerificationCode` request.
8375#[derive(Clone, Default, PartialEq)]
8376#[non_exhaustive]
8377pub struct SendNotificationChannelVerificationCodeRequest {
8378    /// Required. The notification channel to which to send a verification code.
8379    pub name: std::string::String,
8380
8381    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8382}
8383
8384impl SendNotificationChannelVerificationCodeRequest {
8385    pub fn new() -> Self {
8386        std::default::Default::default()
8387    }
8388
8389    /// Sets the value of [name][crate::model::SendNotificationChannelVerificationCodeRequest::name].
8390    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8391        self.name = v.into();
8392        self
8393    }
8394}
8395
8396impl wkt::message::Message for SendNotificationChannelVerificationCodeRequest {
8397    fn typename() -> &'static str {
8398        "type.googleapis.com/google.monitoring.v3.SendNotificationChannelVerificationCodeRequest"
8399    }
8400}
8401
8402/// The `GetNotificationChannelVerificationCode` request.
8403#[derive(Clone, Default, PartialEq)]
8404#[non_exhaustive]
8405pub struct GetNotificationChannelVerificationCodeRequest {
8406    /// Required. The notification channel for which a verification code is to be
8407    /// generated and retrieved. This must name a channel that is already verified;
8408    /// if the specified channel is not verified, the request will fail.
8409    pub name: std::string::String,
8410
8411    /// The desired expiration time. If specified, the API will guarantee that
8412    /// the returned code will not be valid after the specified timestamp;
8413    /// however, the API cannot guarantee that the returned code will be
8414    /// valid for at least as long as the requested time (the API puts an upper
8415    /// bound on the amount of time for which a code may be valid). If omitted,
8416    /// a default expiration will be used, which may be less than the max
8417    /// permissible expiration (so specifying an expiration may extend the
8418    /// code's lifetime over omitting an expiration, even though the API does
8419    /// impose an upper limit on the maximum expiration that is permitted).
8420    pub expire_time: std::option::Option<wkt::Timestamp>,
8421
8422    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8423}
8424
8425impl GetNotificationChannelVerificationCodeRequest {
8426    pub fn new() -> Self {
8427        std::default::Default::default()
8428    }
8429
8430    /// Sets the value of [name][crate::model::GetNotificationChannelVerificationCodeRequest::name].
8431    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8432        self.name = v.into();
8433        self
8434    }
8435
8436    /// Sets the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
8437    pub fn set_expire_time<T>(mut self, v: T) -> Self
8438    where
8439        T: std::convert::Into<wkt::Timestamp>,
8440    {
8441        self.expire_time = std::option::Option::Some(v.into());
8442        self
8443    }
8444
8445    /// Sets or clears the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
8446    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8447    where
8448        T: std::convert::Into<wkt::Timestamp>,
8449    {
8450        self.expire_time = v.map(|x| x.into());
8451        self
8452    }
8453}
8454
8455impl wkt::message::Message for GetNotificationChannelVerificationCodeRequest {
8456    fn typename() -> &'static str {
8457        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelVerificationCodeRequest"
8458    }
8459}
8460
8461/// The `GetNotificationChannelVerificationCode` request.
8462#[derive(Clone, Default, PartialEq)]
8463#[non_exhaustive]
8464pub struct GetNotificationChannelVerificationCodeResponse {
8465    /// The verification code, which may be used to verify other channels
8466    /// that have an equivalent identity (i.e. other channels of the same
8467    /// type with the same fingerprint such as other email channels with
8468    /// the same email address or other sms channels with the same number).
8469    pub code: std::string::String,
8470
8471    /// The expiration time associated with the code that was returned. If
8472    /// an expiration was provided in the request, this is the minimum of the
8473    /// requested expiration in the request and the max permitted expiration.
8474    pub expire_time: std::option::Option<wkt::Timestamp>,
8475
8476    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8477}
8478
8479impl GetNotificationChannelVerificationCodeResponse {
8480    pub fn new() -> Self {
8481        std::default::Default::default()
8482    }
8483
8484    /// Sets the value of [code][crate::model::GetNotificationChannelVerificationCodeResponse::code].
8485    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8486        self.code = v.into();
8487        self
8488    }
8489
8490    /// Sets the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeResponse::expire_time].
8491    pub fn set_expire_time<T>(mut self, v: T) -> Self
8492    where
8493        T: std::convert::Into<wkt::Timestamp>,
8494    {
8495        self.expire_time = std::option::Option::Some(v.into());
8496        self
8497    }
8498
8499    /// Sets or clears the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeResponse::expire_time].
8500    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8501    where
8502        T: std::convert::Into<wkt::Timestamp>,
8503    {
8504        self.expire_time = v.map(|x| x.into());
8505        self
8506    }
8507}
8508
8509impl wkt::message::Message for GetNotificationChannelVerificationCodeResponse {
8510    fn typename() -> &'static str {
8511        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelVerificationCodeResponse"
8512    }
8513}
8514
8515/// The `VerifyNotificationChannel` request.
8516#[derive(Clone, Default, PartialEq)]
8517#[non_exhaustive]
8518pub struct VerifyNotificationChannelRequest {
8519    /// Required. The notification channel to verify.
8520    pub name: std::string::String,
8521
8522    /// Required. The verification code that was delivered to the channel as
8523    /// a result of invoking the `SendNotificationChannelVerificationCode` API
8524    /// method or that was retrieved from a verified channel via
8525    /// `GetNotificationChannelVerificationCode`. For example, one might have
8526    /// "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
8527    /// guaranteed that the code is valid UTF-8; one should not
8528    /// make any assumptions regarding the structure or format of the code).
8529    pub code: std::string::String,
8530
8531    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8532}
8533
8534impl VerifyNotificationChannelRequest {
8535    pub fn new() -> Self {
8536        std::default::Default::default()
8537    }
8538
8539    /// Sets the value of [name][crate::model::VerifyNotificationChannelRequest::name].
8540    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8541        self.name = v.into();
8542        self
8543    }
8544
8545    /// Sets the value of [code][crate::model::VerifyNotificationChannelRequest::code].
8546    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8547        self.code = v.into();
8548        self
8549    }
8550}
8551
8552impl wkt::message::Message for VerifyNotificationChannelRequest {
8553    fn typename() -> &'static str {
8554        "type.googleapis.com/google.monitoring.v3.VerifyNotificationChannelRequest"
8555    }
8556}
8557
8558/// A `Service` is a discrete, autonomous, and network-accessible unit, designed
8559/// to solve an individual concern
8560/// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In
8561/// Cloud Monitoring, a `Service` acts as the root resource under which
8562/// operational aspects of the service are accessible.
8563#[derive(Clone, Default, PartialEq)]
8564#[non_exhaustive]
8565pub struct Service {
8566    /// Identifier. Resource name for this Service. The format is:
8567    ///
8568    /// ```norust
8569    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
8570    /// ```
8571    pub name: std::string::String,
8572
8573    /// Name used for UI elements listing this Service.
8574    pub display_name: std::string::String,
8575
8576    /// Message that contains the service type and service labels of this service
8577    /// if it is a basic service.
8578    /// Documentation and examples
8579    /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
8580    pub basic_service: std::option::Option<crate::model::service::BasicService>,
8581
8582    /// Configuration for how to query telemetry on a Service.
8583    pub telemetry: std::option::Option<crate::model::service::Telemetry>,
8584
8585    /// Labels which have been used to annotate the service. Label keys must start
8586    /// with a letter. Label keys and values may contain lowercase letters,
8587    /// numbers, underscores, and dashes. Label keys and values have a maximum
8588    /// length of 63 characters, and must be less than 128 bytes in size. Up to 64
8589    /// label entries may be stored. For labels which do not have a semantic value,
8590    /// the empty string may be supplied for the label value.
8591    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8592
8593    /// REQUIRED. Service-identifying atoms specifying the underlying service.
8594    pub identifier: std::option::Option<crate::model::service::Identifier>,
8595
8596    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8597}
8598
8599impl Service {
8600    pub fn new() -> Self {
8601        std::default::Default::default()
8602    }
8603
8604    /// Sets the value of [name][crate::model::Service::name].
8605    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8606        self.name = v.into();
8607        self
8608    }
8609
8610    /// Sets the value of [display_name][crate::model::Service::display_name].
8611    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8612        self.display_name = v.into();
8613        self
8614    }
8615
8616    /// Sets the value of [basic_service][crate::model::Service::basic_service].
8617    pub fn set_basic_service<T>(mut self, v: T) -> Self
8618    where
8619        T: std::convert::Into<crate::model::service::BasicService>,
8620    {
8621        self.basic_service = std::option::Option::Some(v.into());
8622        self
8623    }
8624
8625    /// Sets or clears the value of [basic_service][crate::model::Service::basic_service].
8626    pub fn set_or_clear_basic_service<T>(mut self, v: std::option::Option<T>) -> Self
8627    where
8628        T: std::convert::Into<crate::model::service::BasicService>,
8629    {
8630        self.basic_service = v.map(|x| x.into());
8631        self
8632    }
8633
8634    /// Sets the value of [telemetry][crate::model::Service::telemetry].
8635    pub fn set_telemetry<T>(mut self, v: T) -> Self
8636    where
8637        T: std::convert::Into<crate::model::service::Telemetry>,
8638    {
8639        self.telemetry = std::option::Option::Some(v.into());
8640        self
8641    }
8642
8643    /// Sets or clears the value of [telemetry][crate::model::Service::telemetry].
8644    pub fn set_or_clear_telemetry<T>(mut self, v: std::option::Option<T>) -> Self
8645    where
8646        T: std::convert::Into<crate::model::service::Telemetry>,
8647    {
8648        self.telemetry = v.map(|x| x.into());
8649        self
8650    }
8651
8652    /// Sets the value of [user_labels][crate::model::Service::user_labels].
8653    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8654    where
8655        T: std::iter::IntoIterator<Item = (K, V)>,
8656        K: std::convert::Into<std::string::String>,
8657        V: std::convert::Into<std::string::String>,
8658    {
8659        use std::iter::Iterator;
8660        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8661        self
8662    }
8663
8664    /// Sets the value of [identifier][crate::model::Service::identifier].
8665    ///
8666    /// Note that all the setters affecting `identifier` are mutually
8667    /// exclusive.
8668    pub fn set_identifier<
8669        T: std::convert::Into<std::option::Option<crate::model::service::Identifier>>,
8670    >(
8671        mut self,
8672        v: T,
8673    ) -> Self {
8674        self.identifier = v.into();
8675        self
8676    }
8677
8678    /// The value of [identifier][crate::model::Service::identifier]
8679    /// if it holds a `Custom`, `None` if the field is not set or
8680    /// holds a different branch.
8681    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::service::Custom>> {
8682        #[allow(unreachable_patterns)]
8683        self.identifier.as_ref().and_then(|v| match v {
8684            crate::model::service::Identifier::Custom(v) => std::option::Option::Some(v),
8685            _ => std::option::Option::None,
8686        })
8687    }
8688
8689    /// Sets the value of [identifier][crate::model::Service::identifier]
8690    /// to hold a `Custom`.
8691    ///
8692    /// Note that all the setters affecting `identifier` are
8693    /// mutually exclusive.
8694    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::service::Custom>>>(
8695        mut self,
8696        v: T,
8697    ) -> Self {
8698        self.identifier =
8699            std::option::Option::Some(crate::model::service::Identifier::Custom(v.into()));
8700        self
8701    }
8702
8703    /// The value of [identifier][crate::model::Service::identifier]
8704    /// if it holds a `AppEngine`, `None` if the field is not set or
8705    /// holds a different branch.
8706    pub fn app_engine(
8707        &self,
8708    ) -> std::option::Option<&std::boxed::Box<crate::model::service::AppEngine>> {
8709        #[allow(unreachable_patterns)]
8710        self.identifier.as_ref().and_then(|v| match v {
8711            crate::model::service::Identifier::AppEngine(v) => std::option::Option::Some(v),
8712            _ => std::option::Option::None,
8713        })
8714    }
8715
8716    /// Sets the value of [identifier][crate::model::Service::identifier]
8717    /// to hold a `AppEngine`.
8718    ///
8719    /// Note that all the setters affecting `identifier` are
8720    /// mutually exclusive.
8721    pub fn set_app_engine<
8722        T: std::convert::Into<std::boxed::Box<crate::model::service::AppEngine>>,
8723    >(
8724        mut self,
8725        v: T,
8726    ) -> Self {
8727        self.identifier =
8728            std::option::Option::Some(crate::model::service::Identifier::AppEngine(v.into()));
8729        self
8730    }
8731
8732    /// The value of [identifier][crate::model::Service::identifier]
8733    /// if it holds a `CloudEndpoints`, `None` if the field is not set or
8734    /// holds a different branch.
8735    pub fn cloud_endpoints(
8736        &self,
8737    ) -> std::option::Option<&std::boxed::Box<crate::model::service::CloudEndpoints>> {
8738        #[allow(unreachable_patterns)]
8739        self.identifier.as_ref().and_then(|v| match v {
8740            crate::model::service::Identifier::CloudEndpoints(v) => std::option::Option::Some(v),
8741            _ => std::option::Option::None,
8742        })
8743    }
8744
8745    /// Sets the value of [identifier][crate::model::Service::identifier]
8746    /// to hold a `CloudEndpoints`.
8747    ///
8748    /// Note that all the setters affecting `identifier` are
8749    /// mutually exclusive.
8750    pub fn set_cloud_endpoints<
8751        T: std::convert::Into<std::boxed::Box<crate::model::service::CloudEndpoints>>,
8752    >(
8753        mut self,
8754        v: T,
8755    ) -> Self {
8756        self.identifier =
8757            std::option::Option::Some(crate::model::service::Identifier::CloudEndpoints(v.into()));
8758        self
8759    }
8760
8761    /// The value of [identifier][crate::model::Service::identifier]
8762    /// if it holds a `ClusterIstio`, `None` if the field is not set or
8763    /// holds a different branch.
8764    pub fn cluster_istio(
8765        &self,
8766    ) -> std::option::Option<&std::boxed::Box<crate::model::service::ClusterIstio>> {
8767        #[allow(unreachable_patterns)]
8768        self.identifier.as_ref().and_then(|v| match v {
8769            crate::model::service::Identifier::ClusterIstio(v) => std::option::Option::Some(v),
8770            _ => std::option::Option::None,
8771        })
8772    }
8773
8774    /// Sets the value of [identifier][crate::model::Service::identifier]
8775    /// to hold a `ClusterIstio`.
8776    ///
8777    /// Note that all the setters affecting `identifier` are
8778    /// mutually exclusive.
8779    pub fn set_cluster_istio<
8780        T: std::convert::Into<std::boxed::Box<crate::model::service::ClusterIstio>>,
8781    >(
8782        mut self,
8783        v: T,
8784    ) -> Self {
8785        self.identifier =
8786            std::option::Option::Some(crate::model::service::Identifier::ClusterIstio(v.into()));
8787        self
8788    }
8789
8790    /// The value of [identifier][crate::model::Service::identifier]
8791    /// if it holds a `MeshIstio`, `None` if the field is not set or
8792    /// holds a different branch.
8793    pub fn mesh_istio(
8794        &self,
8795    ) -> std::option::Option<&std::boxed::Box<crate::model::service::MeshIstio>> {
8796        #[allow(unreachable_patterns)]
8797        self.identifier.as_ref().and_then(|v| match v {
8798            crate::model::service::Identifier::MeshIstio(v) => std::option::Option::Some(v),
8799            _ => std::option::Option::None,
8800        })
8801    }
8802
8803    /// Sets the value of [identifier][crate::model::Service::identifier]
8804    /// to hold a `MeshIstio`.
8805    ///
8806    /// Note that all the setters affecting `identifier` are
8807    /// mutually exclusive.
8808    pub fn set_mesh_istio<
8809        T: std::convert::Into<std::boxed::Box<crate::model::service::MeshIstio>>,
8810    >(
8811        mut self,
8812        v: T,
8813    ) -> Self {
8814        self.identifier =
8815            std::option::Option::Some(crate::model::service::Identifier::MeshIstio(v.into()));
8816        self
8817    }
8818
8819    /// The value of [identifier][crate::model::Service::identifier]
8820    /// if it holds a `IstioCanonicalService`, `None` if the field is not set or
8821    /// holds a different branch.
8822    pub fn istio_canonical_service(
8823        &self,
8824    ) -> std::option::Option<&std::boxed::Box<crate::model::service::IstioCanonicalService>> {
8825        #[allow(unreachable_patterns)]
8826        self.identifier.as_ref().and_then(|v| match v {
8827            crate::model::service::Identifier::IstioCanonicalService(v) => {
8828                std::option::Option::Some(v)
8829            }
8830            _ => std::option::Option::None,
8831        })
8832    }
8833
8834    /// Sets the value of [identifier][crate::model::Service::identifier]
8835    /// to hold a `IstioCanonicalService`.
8836    ///
8837    /// Note that all the setters affecting `identifier` are
8838    /// mutually exclusive.
8839    pub fn set_istio_canonical_service<
8840        T: std::convert::Into<std::boxed::Box<crate::model::service::IstioCanonicalService>>,
8841    >(
8842        mut self,
8843        v: T,
8844    ) -> Self {
8845        self.identifier = std::option::Option::Some(
8846            crate::model::service::Identifier::IstioCanonicalService(v.into()),
8847        );
8848        self
8849    }
8850
8851    /// The value of [identifier][crate::model::Service::identifier]
8852    /// if it holds a `CloudRun`, `None` if the field is not set or
8853    /// holds a different branch.
8854    pub fn cloud_run(
8855        &self,
8856    ) -> std::option::Option<&std::boxed::Box<crate::model::service::CloudRun>> {
8857        #[allow(unreachable_patterns)]
8858        self.identifier.as_ref().and_then(|v| match v {
8859            crate::model::service::Identifier::CloudRun(v) => std::option::Option::Some(v),
8860            _ => std::option::Option::None,
8861        })
8862    }
8863
8864    /// Sets the value of [identifier][crate::model::Service::identifier]
8865    /// to hold a `CloudRun`.
8866    ///
8867    /// Note that all the setters affecting `identifier` are
8868    /// mutually exclusive.
8869    pub fn set_cloud_run<
8870        T: std::convert::Into<std::boxed::Box<crate::model::service::CloudRun>>,
8871    >(
8872        mut self,
8873        v: T,
8874    ) -> Self {
8875        self.identifier =
8876            std::option::Option::Some(crate::model::service::Identifier::CloudRun(v.into()));
8877        self
8878    }
8879
8880    /// The value of [identifier][crate::model::Service::identifier]
8881    /// if it holds a `GkeNamespace`, `None` if the field is not set or
8882    /// holds a different branch.
8883    pub fn gke_namespace(
8884        &self,
8885    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeNamespace>> {
8886        #[allow(unreachable_patterns)]
8887        self.identifier.as_ref().and_then(|v| match v {
8888            crate::model::service::Identifier::GkeNamespace(v) => std::option::Option::Some(v),
8889            _ => std::option::Option::None,
8890        })
8891    }
8892
8893    /// Sets the value of [identifier][crate::model::Service::identifier]
8894    /// to hold a `GkeNamespace`.
8895    ///
8896    /// Note that all the setters affecting `identifier` are
8897    /// mutually exclusive.
8898    pub fn set_gke_namespace<
8899        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeNamespace>>,
8900    >(
8901        mut self,
8902        v: T,
8903    ) -> Self {
8904        self.identifier =
8905            std::option::Option::Some(crate::model::service::Identifier::GkeNamespace(v.into()));
8906        self
8907    }
8908
8909    /// The value of [identifier][crate::model::Service::identifier]
8910    /// if it holds a `GkeWorkload`, `None` if the field is not set or
8911    /// holds a different branch.
8912    pub fn gke_workload(
8913        &self,
8914    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeWorkload>> {
8915        #[allow(unreachable_patterns)]
8916        self.identifier.as_ref().and_then(|v| match v {
8917            crate::model::service::Identifier::GkeWorkload(v) => std::option::Option::Some(v),
8918            _ => std::option::Option::None,
8919        })
8920    }
8921
8922    /// Sets the value of [identifier][crate::model::Service::identifier]
8923    /// to hold a `GkeWorkload`.
8924    ///
8925    /// Note that all the setters affecting `identifier` are
8926    /// mutually exclusive.
8927    pub fn set_gke_workload<
8928        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeWorkload>>,
8929    >(
8930        mut self,
8931        v: T,
8932    ) -> Self {
8933        self.identifier =
8934            std::option::Option::Some(crate::model::service::Identifier::GkeWorkload(v.into()));
8935        self
8936    }
8937
8938    /// The value of [identifier][crate::model::Service::identifier]
8939    /// if it holds a `GkeService`, `None` if the field is not set or
8940    /// holds a different branch.
8941    pub fn gke_service(
8942        &self,
8943    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeService>> {
8944        #[allow(unreachable_patterns)]
8945        self.identifier.as_ref().and_then(|v| match v {
8946            crate::model::service::Identifier::GkeService(v) => std::option::Option::Some(v),
8947            _ => std::option::Option::None,
8948        })
8949    }
8950
8951    /// Sets the value of [identifier][crate::model::Service::identifier]
8952    /// to hold a `GkeService`.
8953    ///
8954    /// Note that all the setters affecting `identifier` are
8955    /// mutually exclusive.
8956    pub fn set_gke_service<
8957        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeService>>,
8958    >(
8959        mut self,
8960        v: T,
8961    ) -> Self {
8962        self.identifier =
8963            std::option::Option::Some(crate::model::service::Identifier::GkeService(v.into()));
8964        self
8965    }
8966}
8967
8968impl wkt::message::Message for Service {
8969    fn typename() -> &'static str {
8970        "type.googleapis.com/google.monitoring.v3.Service"
8971    }
8972}
8973
8974/// Defines additional types related to [Service].
8975pub mod service {
8976    #[allow(unused_imports)]
8977    use super::*;
8978
8979    /// Use a custom service to designate a service that you want to monitor
8980    /// when none of the other service types (like App Engine, Cloud Run, or
8981    /// a GKE type) matches your intended service.
8982    #[derive(Clone, Default, PartialEq)]
8983    #[non_exhaustive]
8984    pub struct Custom {
8985        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8986    }
8987
8988    impl Custom {
8989        pub fn new() -> Self {
8990            std::default::Default::default()
8991        }
8992    }
8993
8994    impl wkt::message::Message for Custom {
8995        fn typename() -> &'static str {
8996            "type.googleapis.com/google.monitoring.v3.Service.Custom"
8997        }
8998    }
8999
9000    /// App Engine service. Learn more at <https://cloud.google.com/appengine>.
9001    #[derive(Clone, Default, PartialEq)]
9002    #[non_exhaustive]
9003    pub struct AppEngine {
9004        /// The ID of the App Engine module underlying this service. Corresponds to
9005        /// the `module_id` resource label in the [`gae_app` monitored
9006        /// resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app).
9007        pub module_id: std::string::String,
9008
9009        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9010    }
9011
9012    impl AppEngine {
9013        pub fn new() -> Self {
9014            std::default::Default::default()
9015        }
9016
9017        /// Sets the value of [module_id][crate::model::service::AppEngine::module_id].
9018        pub fn set_module_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9019            self.module_id = v.into();
9020            self
9021        }
9022    }
9023
9024    impl wkt::message::Message for AppEngine {
9025        fn typename() -> &'static str {
9026            "type.googleapis.com/google.monitoring.v3.Service.AppEngine"
9027        }
9028    }
9029
9030    /// Cloud Endpoints service. Learn more at <https://cloud.google.com/endpoints>.
9031    #[derive(Clone, Default, PartialEq)]
9032    #[non_exhaustive]
9033    pub struct CloudEndpoints {
9034        /// The name of the Cloud Endpoints service underlying this service.
9035        /// Corresponds to the `service` resource label in the [`api` monitored
9036        /// resource](https://cloud.google.com/monitoring/api/resources#tag_api).
9037        pub service: std::string::String,
9038
9039        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9040    }
9041
9042    impl CloudEndpoints {
9043        pub fn new() -> Self {
9044            std::default::Default::default()
9045        }
9046
9047        /// Sets the value of [service][crate::model::service::CloudEndpoints::service].
9048        pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9049            self.service = v.into();
9050            self
9051        }
9052    }
9053
9054    impl wkt::message::Message for CloudEndpoints {
9055        fn typename() -> &'static str {
9056            "type.googleapis.com/google.monitoring.v3.Service.CloudEndpoints"
9057        }
9058    }
9059
9060    /// Istio service scoped to a single Kubernetes cluster. Learn more at
9061    /// <https://istio.io>. Clusters running OSS Istio will have their services
9062    /// ingested as this type.
9063    #[derive(Clone, Default, PartialEq)]
9064    #[non_exhaustive]
9065    pub struct ClusterIstio {
9066        /// The location of the Kubernetes cluster in which this Istio service is
9067        /// defined. Corresponds to the `location` resource label in `k8s_cluster`
9068        /// resources.
9069        pub location: std::string::String,
9070
9071        /// The name of the Kubernetes cluster in which this Istio service is
9072        /// defined. Corresponds to the `cluster_name` resource label in
9073        /// `k8s_cluster` resources.
9074        pub cluster_name: std::string::String,
9075
9076        /// The namespace of the Istio service underlying this service. Corresponds
9077        /// to the `destination_service_namespace` metric label in Istio metrics.
9078        pub service_namespace: std::string::String,
9079
9080        /// The name of the Istio service underlying this service. Corresponds to the
9081        /// `destination_service_name` metric label in Istio metrics.
9082        pub service_name: std::string::String,
9083
9084        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9085    }
9086
9087    impl ClusterIstio {
9088        pub fn new() -> Self {
9089            std::default::Default::default()
9090        }
9091
9092        /// Sets the value of [location][crate::model::service::ClusterIstio::location].
9093        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9094            self.location = v.into();
9095            self
9096        }
9097
9098        /// Sets the value of [cluster_name][crate::model::service::ClusterIstio::cluster_name].
9099        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
9100            mut self,
9101            v: T,
9102        ) -> Self {
9103            self.cluster_name = v.into();
9104            self
9105        }
9106
9107        /// Sets the value of [service_namespace][crate::model::service::ClusterIstio::service_namespace].
9108        pub fn set_service_namespace<T: std::convert::Into<std::string::String>>(
9109            mut self,
9110            v: T,
9111        ) -> Self {
9112            self.service_namespace = v.into();
9113            self
9114        }
9115
9116        /// Sets the value of [service_name][crate::model::service::ClusterIstio::service_name].
9117        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
9118            mut self,
9119            v: T,
9120        ) -> Self {
9121            self.service_name = v.into();
9122            self
9123        }
9124    }
9125
9126    impl wkt::message::Message for ClusterIstio {
9127        fn typename() -> &'static str {
9128            "type.googleapis.com/google.monitoring.v3.Service.ClusterIstio"
9129        }
9130    }
9131
9132    /// Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8
9133    /// will have their services ingested as this type.
9134    #[derive(Clone, Default, PartialEq)]
9135    #[non_exhaustive]
9136    pub struct MeshIstio {
9137        /// Identifier for the mesh in which this Istio service is defined.
9138        /// Corresponds to the `mesh_uid` metric label in Istio metrics.
9139        pub mesh_uid: std::string::String,
9140
9141        /// The namespace of the Istio service underlying this service. Corresponds
9142        /// to the `destination_service_namespace` metric label in Istio metrics.
9143        pub service_namespace: std::string::String,
9144
9145        /// The name of the Istio service underlying this service. Corresponds to the
9146        /// `destination_service_name` metric label in Istio metrics.
9147        pub service_name: std::string::String,
9148
9149        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9150    }
9151
9152    impl MeshIstio {
9153        pub fn new() -> Self {
9154            std::default::Default::default()
9155        }
9156
9157        /// Sets the value of [mesh_uid][crate::model::service::MeshIstio::mesh_uid].
9158        pub fn set_mesh_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9159            self.mesh_uid = v.into();
9160            self
9161        }
9162
9163        /// Sets the value of [service_namespace][crate::model::service::MeshIstio::service_namespace].
9164        pub fn set_service_namespace<T: std::convert::Into<std::string::String>>(
9165            mut self,
9166            v: T,
9167        ) -> Self {
9168            self.service_namespace = v.into();
9169            self
9170        }
9171
9172        /// Sets the value of [service_name][crate::model::service::MeshIstio::service_name].
9173        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
9174            mut self,
9175            v: T,
9176        ) -> Self {
9177            self.service_name = v.into();
9178            self
9179        }
9180    }
9181
9182    impl wkt::message::Message for MeshIstio {
9183        fn typename() -> &'static str {
9184            "type.googleapis.com/google.monitoring.v3.Service.MeshIstio"
9185        }
9186    }
9187
9188    /// Canonical service scoped to an Istio mesh. Anthos clusters running ASM >=
9189    /// 1.6.8 will have their services ingested as this type.
9190    #[derive(Clone, Default, PartialEq)]
9191    #[non_exhaustive]
9192    pub struct IstioCanonicalService {
9193        /// Identifier for the Istio mesh in which this canonical service is defined.
9194        /// Corresponds to the `mesh_uid` metric label in
9195        /// [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio).
9196        pub mesh_uid: std::string::String,
9197
9198        /// The namespace of the canonical service underlying this service.
9199        /// Corresponds to the `destination_canonical_service_namespace` metric
9200        /// label in [Istio
9201        /// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
9202        pub canonical_service_namespace: std::string::String,
9203
9204        /// The name of the canonical service underlying this service.
9205        /// Corresponds to the `destination_canonical_service_name` metric label in
9206        /// label in [Istio
9207        /// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
9208        pub canonical_service: std::string::String,
9209
9210        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9211    }
9212
9213    impl IstioCanonicalService {
9214        pub fn new() -> Self {
9215            std::default::Default::default()
9216        }
9217
9218        /// Sets the value of [mesh_uid][crate::model::service::IstioCanonicalService::mesh_uid].
9219        pub fn set_mesh_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9220            self.mesh_uid = v.into();
9221            self
9222        }
9223
9224        /// Sets the value of [canonical_service_namespace][crate::model::service::IstioCanonicalService::canonical_service_namespace].
9225        pub fn set_canonical_service_namespace<T: std::convert::Into<std::string::String>>(
9226            mut self,
9227            v: T,
9228        ) -> Self {
9229            self.canonical_service_namespace = v.into();
9230            self
9231        }
9232
9233        /// Sets the value of [canonical_service][crate::model::service::IstioCanonicalService::canonical_service].
9234        pub fn set_canonical_service<T: std::convert::Into<std::string::String>>(
9235            mut self,
9236            v: T,
9237        ) -> Self {
9238            self.canonical_service = v.into();
9239            self
9240        }
9241    }
9242
9243    impl wkt::message::Message for IstioCanonicalService {
9244        fn typename() -> &'static str {
9245            "type.googleapis.com/google.monitoring.v3.Service.IstioCanonicalService"
9246        }
9247    }
9248
9249    /// Cloud Run service. Learn more at <https://cloud.google.com/run>.
9250    #[derive(Clone, Default, PartialEq)]
9251    #[non_exhaustive]
9252    pub struct CloudRun {
9253        /// The name of the Cloud Run service. Corresponds to the `service_name`
9254        /// resource label in the [`cloud_run_revision` monitored
9255        /// resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
9256        pub service_name: std::string::String,
9257
9258        /// The location the service is run. Corresponds to the `location`
9259        /// resource label in the [`cloud_run_revision` monitored
9260        /// resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
9261        pub location: std::string::String,
9262
9263        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9264    }
9265
9266    impl CloudRun {
9267        pub fn new() -> Self {
9268            std::default::Default::default()
9269        }
9270
9271        /// Sets the value of [service_name][crate::model::service::CloudRun::service_name].
9272        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
9273            mut self,
9274            v: T,
9275        ) -> Self {
9276            self.service_name = v.into();
9277            self
9278        }
9279
9280        /// Sets the value of [location][crate::model::service::CloudRun::location].
9281        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9282            self.location = v.into();
9283            self
9284        }
9285    }
9286
9287    impl wkt::message::Message for CloudRun {
9288        fn typename() -> &'static str {
9289            "type.googleapis.com/google.monitoring.v3.Service.CloudRun"
9290        }
9291    }
9292
9293    /// GKE Namespace. The field names correspond to the resource metadata labels
9294    /// on monitored resources that fall under a namespace (for example,
9295    /// `k8s_container` or `k8s_pod`).
9296    #[derive(Clone, Default, PartialEq)]
9297    #[non_exhaustive]
9298    pub struct GkeNamespace {
9299        /// Output only. The project this resource lives in. For legacy services
9300        /// migrated from the `Custom` type, this may be a distinct project from the
9301        /// one parenting the service itself.
9302        pub project_id: std::string::String,
9303
9304        /// The location of the parent cluster. This may be a zone or region.
9305        pub location: std::string::String,
9306
9307        /// The name of the parent cluster.
9308        pub cluster_name: std::string::String,
9309
9310        /// The name of this namespace.
9311        pub namespace_name: std::string::String,
9312
9313        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9314    }
9315
9316    impl GkeNamespace {
9317        pub fn new() -> Self {
9318            std::default::Default::default()
9319        }
9320
9321        /// Sets the value of [project_id][crate::model::service::GkeNamespace::project_id].
9322        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9323            self.project_id = v.into();
9324            self
9325        }
9326
9327        /// Sets the value of [location][crate::model::service::GkeNamespace::location].
9328        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9329            self.location = v.into();
9330            self
9331        }
9332
9333        /// Sets the value of [cluster_name][crate::model::service::GkeNamespace::cluster_name].
9334        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
9335            mut self,
9336            v: T,
9337        ) -> Self {
9338            self.cluster_name = v.into();
9339            self
9340        }
9341
9342        /// Sets the value of [namespace_name][crate::model::service::GkeNamespace::namespace_name].
9343        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
9344            mut self,
9345            v: T,
9346        ) -> Self {
9347            self.namespace_name = v.into();
9348            self
9349        }
9350    }
9351
9352    impl wkt::message::Message for GkeNamespace {
9353        fn typename() -> &'static str {
9354            "type.googleapis.com/google.monitoring.v3.Service.GkeNamespace"
9355        }
9356    }
9357
9358    /// A GKE Workload (Deployment, StatefulSet, etc). The field names correspond
9359    /// to the metadata labels on monitored resources that fall under a workload
9360    /// (for example, `k8s_container` or `k8s_pod`).
9361    #[derive(Clone, Default, PartialEq)]
9362    #[non_exhaustive]
9363    pub struct GkeWorkload {
9364        /// Output only. The project this resource lives in. For legacy services
9365        /// migrated from the `Custom` type, this may be a distinct project from the
9366        /// one parenting the service itself.
9367        pub project_id: std::string::String,
9368
9369        /// The location of the parent cluster. This may be a zone or region.
9370        pub location: std::string::String,
9371
9372        /// The name of the parent cluster.
9373        pub cluster_name: std::string::String,
9374
9375        /// The name of the parent namespace.
9376        pub namespace_name: std::string::String,
9377
9378        /// The type of this workload (for example, "Deployment" or "DaemonSet")
9379        pub top_level_controller_type: std::string::String,
9380
9381        /// The name of this workload.
9382        pub top_level_controller_name: std::string::String,
9383
9384        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9385    }
9386
9387    impl GkeWorkload {
9388        pub fn new() -> Self {
9389            std::default::Default::default()
9390        }
9391
9392        /// Sets the value of [project_id][crate::model::service::GkeWorkload::project_id].
9393        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9394            self.project_id = v.into();
9395            self
9396        }
9397
9398        /// Sets the value of [location][crate::model::service::GkeWorkload::location].
9399        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9400            self.location = v.into();
9401            self
9402        }
9403
9404        /// Sets the value of [cluster_name][crate::model::service::GkeWorkload::cluster_name].
9405        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
9406            mut self,
9407            v: T,
9408        ) -> Self {
9409            self.cluster_name = v.into();
9410            self
9411        }
9412
9413        /// Sets the value of [namespace_name][crate::model::service::GkeWorkload::namespace_name].
9414        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
9415            mut self,
9416            v: T,
9417        ) -> Self {
9418            self.namespace_name = v.into();
9419            self
9420        }
9421
9422        /// Sets the value of [top_level_controller_type][crate::model::service::GkeWorkload::top_level_controller_type].
9423        pub fn set_top_level_controller_type<T: std::convert::Into<std::string::String>>(
9424            mut self,
9425            v: T,
9426        ) -> Self {
9427            self.top_level_controller_type = v.into();
9428            self
9429        }
9430
9431        /// Sets the value of [top_level_controller_name][crate::model::service::GkeWorkload::top_level_controller_name].
9432        pub fn set_top_level_controller_name<T: std::convert::Into<std::string::String>>(
9433            mut self,
9434            v: T,
9435        ) -> Self {
9436            self.top_level_controller_name = v.into();
9437            self
9438        }
9439    }
9440
9441    impl wkt::message::Message for GkeWorkload {
9442        fn typename() -> &'static str {
9443            "type.googleapis.com/google.monitoring.v3.Service.GkeWorkload"
9444        }
9445    }
9446
9447    /// GKE Service. The "service" here represents a
9448    /// [Kubernetes service
9449    /// object](https://kubernetes.io/docs/concepts/services-networking/service).
9450    /// The field names correspond to the resource labels on [`k8s_service`
9451    /// monitored
9452    /// resources](https://cloud.google.com/monitoring/api/resources#tag_k8s_service).
9453    #[derive(Clone, Default, PartialEq)]
9454    #[non_exhaustive]
9455    pub struct GkeService {
9456        /// Output only. The project this resource lives in. For legacy services
9457        /// migrated from the `Custom` type, this may be a distinct project from the
9458        /// one parenting the service itself.
9459        pub project_id: std::string::String,
9460
9461        /// The location of the parent cluster. This may be a zone or region.
9462        pub location: std::string::String,
9463
9464        /// The name of the parent cluster.
9465        pub cluster_name: std::string::String,
9466
9467        /// The name of the parent namespace.
9468        pub namespace_name: std::string::String,
9469
9470        /// The name of this service.
9471        pub service_name: std::string::String,
9472
9473        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9474    }
9475
9476    impl GkeService {
9477        pub fn new() -> Self {
9478            std::default::Default::default()
9479        }
9480
9481        /// Sets the value of [project_id][crate::model::service::GkeService::project_id].
9482        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9483            self.project_id = v.into();
9484            self
9485        }
9486
9487        /// Sets the value of [location][crate::model::service::GkeService::location].
9488        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9489            self.location = v.into();
9490            self
9491        }
9492
9493        /// Sets the value of [cluster_name][crate::model::service::GkeService::cluster_name].
9494        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
9495            mut self,
9496            v: T,
9497        ) -> Self {
9498            self.cluster_name = v.into();
9499            self
9500        }
9501
9502        /// Sets the value of [namespace_name][crate::model::service::GkeService::namespace_name].
9503        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
9504            mut self,
9505            v: T,
9506        ) -> Self {
9507            self.namespace_name = v.into();
9508            self
9509        }
9510
9511        /// Sets the value of [service_name][crate::model::service::GkeService::service_name].
9512        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
9513            mut self,
9514            v: T,
9515        ) -> Self {
9516            self.service_name = v.into();
9517            self
9518        }
9519    }
9520
9521    impl wkt::message::Message for GkeService {
9522        fn typename() -> &'static str {
9523            "type.googleapis.com/google.monitoring.v3.Service.GkeService"
9524        }
9525    }
9526
9527    /// A well-known service type, defined by its service type and service labels.
9528    /// Documentation and examples
9529    /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
9530    #[derive(Clone, Default, PartialEq)]
9531    #[non_exhaustive]
9532    pub struct BasicService {
9533        /// The type of service that this basic service defines, e.g.
9534        /// APP_ENGINE service type.
9535        /// Documentation and valid values
9536        /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
9537        pub service_type: std::string::String,
9538
9539        /// Labels that specify the resource that emits the monitoring data which
9540        /// is used for SLO reporting of this `Service`.
9541        /// Documentation and valid values for given service types
9542        /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
9543        pub service_labels: std::collections::HashMap<std::string::String, std::string::String>,
9544
9545        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9546    }
9547
9548    impl BasicService {
9549        pub fn new() -> Self {
9550            std::default::Default::default()
9551        }
9552
9553        /// Sets the value of [service_type][crate::model::service::BasicService::service_type].
9554        pub fn set_service_type<T: std::convert::Into<std::string::String>>(
9555            mut self,
9556            v: T,
9557        ) -> Self {
9558            self.service_type = v.into();
9559            self
9560        }
9561
9562        /// Sets the value of [service_labels][crate::model::service::BasicService::service_labels].
9563        pub fn set_service_labels<T, K, V>(mut self, v: T) -> Self
9564        where
9565            T: std::iter::IntoIterator<Item = (K, V)>,
9566            K: std::convert::Into<std::string::String>,
9567            V: std::convert::Into<std::string::String>,
9568        {
9569            use std::iter::Iterator;
9570            self.service_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9571            self
9572        }
9573    }
9574
9575    impl wkt::message::Message for BasicService {
9576        fn typename() -> &'static str {
9577            "type.googleapis.com/google.monitoring.v3.Service.BasicService"
9578        }
9579    }
9580
9581    /// Configuration for how to query telemetry on a Service.
9582    #[derive(Clone, Default, PartialEq)]
9583    #[non_exhaustive]
9584    pub struct Telemetry {
9585        /// The full name of the resource that defines this service. Formatted as
9586        /// described in <https://cloud.google.com/apis/design/resource_names>.
9587        pub resource_name: std::string::String,
9588
9589        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9590    }
9591
9592    impl Telemetry {
9593        pub fn new() -> Self {
9594            std::default::Default::default()
9595        }
9596
9597        /// Sets the value of [resource_name][crate::model::service::Telemetry::resource_name].
9598        pub fn set_resource_name<T: std::convert::Into<std::string::String>>(
9599            mut self,
9600            v: T,
9601        ) -> Self {
9602            self.resource_name = v.into();
9603            self
9604        }
9605    }
9606
9607    impl wkt::message::Message for Telemetry {
9608        fn typename() -> &'static str {
9609            "type.googleapis.com/google.monitoring.v3.Service.Telemetry"
9610        }
9611    }
9612
9613    /// REQUIRED. Service-identifying atoms specifying the underlying service.
9614    #[derive(Clone, Debug, PartialEq)]
9615    #[non_exhaustive]
9616    pub enum Identifier {
9617        /// Custom service type.
9618        Custom(std::boxed::Box<crate::model::service::Custom>),
9619        /// Type used for App Engine services.
9620        AppEngine(std::boxed::Box<crate::model::service::AppEngine>),
9621        /// Type used for Cloud Endpoints services.
9622        CloudEndpoints(std::boxed::Box<crate::model::service::CloudEndpoints>),
9623        /// Type used for Istio services that live in a Kubernetes cluster.
9624        ClusterIstio(std::boxed::Box<crate::model::service::ClusterIstio>),
9625        /// Type used for Istio services scoped to an Istio mesh.
9626        MeshIstio(std::boxed::Box<crate::model::service::MeshIstio>),
9627        /// Type used for canonical services scoped to an Istio mesh.
9628        /// Metrics for Istio are
9629        /// [documented here](https://istio.io/latest/docs/reference/config/metrics/)
9630        IstioCanonicalService(std::boxed::Box<crate::model::service::IstioCanonicalService>),
9631        /// Type used for Cloud Run services.
9632        CloudRun(std::boxed::Box<crate::model::service::CloudRun>),
9633        /// Type used for GKE Namespaces.
9634        GkeNamespace(std::boxed::Box<crate::model::service::GkeNamespace>),
9635        /// Type used for GKE Workloads.
9636        GkeWorkload(std::boxed::Box<crate::model::service::GkeWorkload>),
9637        /// Type used for GKE Services (the Kubernetes concept of a service).
9638        GkeService(std::boxed::Box<crate::model::service::GkeService>),
9639    }
9640}
9641
9642/// A Service-Level Objective (SLO) describes a level of desired good service. It
9643/// consists of a service-level indicator (SLI), a performance goal, and a period
9644/// over which the objective is to be evaluated against that goal. The SLO can
9645/// use SLIs defined in a number of different manners. Typical SLOs might include
9646/// "99% of requests in each rolling week have latency below 200 milliseconds" or
9647/// "99.5% of requests in each calendar month return successfully."
9648#[derive(Clone, Default, PartialEq)]
9649#[non_exhaustive]
9650pub struct ServiceLevelObjective {
9651    /// Identifier. Resource name for this `ServiceLevelObjective`. The format is:
9652    ///
9653    /// ```norust
9654    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
9655    /// ```
9656    pub name: std::string::String,
9657
9658    /// Name used for UI elements listing this SLO.
9659    pub display_name: std::string::String,
9660
9661    /// The definition of good service, used to measure and calculate the quality
9662    /// of the `Service`'s performance with respect to a single aspect of service
9663    /// quality.
9664    pub service_level_indicator: std::option::Option<crate::model::ServiceLevelIndicator>,
9665
9666    /// The fraction of service that must be good in order for this objective to be
9667    /// met. `0 < goal <= 0.9999`.
9668    pub goal: f64,
9669
9670    /// Labels which have been used to annotate the service-level objective. Label
9671    /// keys must start with a letter. Label keys and values may contain lowercase
9672    /// letters, numbers, underscores, and dashes. Label keys and values have a
9673    /// maximum length of 63 characters, and must be less than 128 bytes in size.
9674    /// Up to 64 label entries may be stored. For labels which do not have a
9675    /// semantic value, the empty string may be supplied for the label value.
9676    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
9677
9678    /// The time period over which the objective will be evaluated.
9679    pub period: std::option::Option<crate::model::service_level_objective::Period>,
9680
9681    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9682}
9683
9684impl ServiceLevelObjective {
9685    pub fn new() -> Self {
9686        std::default::Default::default()
9687    }
9688
9689    /// Sets the value of [name][crate::model::ServiceLevelObjective::name].
9690    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9691        self.name = v.into();
9692        self
9693    }
9694
9695    /// Sets the value of [display_name][crate::model::ServiceLevelObjective::display_name].
9696    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9697        self.display_name = v.into();
9698        self
9699    }
9700
9701    /// Sets the value of [service_level_indicator][crate::model::ServiceLevelObjective::service_level_indicator].
9702    pub fn set_service_level_indicator<T>(mut self, v: T) -> Self
9703    where
9704        T: std::convert::Into<crate::model::ServiceLevelIndicator>,
9705    {
9706        self.service_level_indicator = std::option::Option::Some(v.into());
9707        self
9708    }
9709
9710    /// Sets or clears the value of [service_level_indicator][crate::model::ServiceLevelObjective::service_level_indicator].
9711    pub fn set_or_clear_service_level_indicator<T>(mut self, v: std::option::Option<T>) -> Self
9712    where
9713        T: std::convert::Into<crate::model::ServiceLevelIndicator>,
9714    {
9715        self.service_level_indicator = v.map(|x| x.into());
9716        self
9717    }
9718
9719    /// Sets the value of [goal][crate::model::ServiceLevelObjective::goal].
9720    pub fn set_goal<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
9721        self.goal = v.into();
9722        self
9723    }
9724
9725    /// Sets the value of [user_labels][crate::model::ServiceLevelObjective::user_labels].
9726    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9727    where
9728        T: std::iter::IntoIterator<Item = (K, V)>,
9729        K: std::convert::Into<std::string::String>,
9730        V: std::convert::Into<std::string::String>,
9731    {
9732        use std::iter::Iterator;
9733        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9734        self
9735    }
9736
9737    /// Sets the value of [period][crate::model::ServiceLevelObjective::period].
9738    ///
9739    /// Note that all the setters affecting `period` are mutually
9740    /// exclusive.
9741    pub fn set_period<
9742        T: std::convert::Into<std::option::Option<crate::model::service_level_objective::Period>>,
9743    >(
9744        mut self,
9745        v: T,
9746    ) -> Self {
9747        self.period = v.into();
9748        self
9749    }
9750
9751    /// The value of [period][crate::model::ServiceLevelObjective::period]
9752    /// if it holds a `RollingPeriod`, `None` if the field is not set or
9753    /// holds a different branch.
9754    pub fn rolling_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
9755        #[allow(unreachable_patterns)]
9756        self.period.as_ref().and_then(|v| match v {
9757            crate::model::service_level_objective::Period::RollingPeriod(v) => {
9758                std::option::Option::Some(v)
9759            }
9760            _ => std::option::Option::None,
9761        })
9762    }
9763
9764    /// Sets the value of [period][crate::model::ServiceLevelObjective::period]
9765    /// to hold a `RollingPeriod`.
9766    ///
9767    /// Note that all the setters affecting `period` are
9768    /// mutually exclusive.
9769    pub fn set_rolling_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
9770        mut self,
9771        v: T,
9772    ) -> Self {
9773        self.period = std::option::Option::Some(
9774            crate::model::service_level_objective::Period::RollingPeriod(v.into()),
9775        );
9776        self
9777    }
9778
9779    /// The value of [period][crate::model::ServiceLevelObjective::period]
9780    /// if it holds a `CalendarPeriod`, `None` if the field is not set or
9781    /// holds a different branch.
9782    pub fn calendar_period(&self) -> std::option::Option<&gtype::model::CalendarPeriod> {
9783        #[allow(unreachable_patterns)]
9784        self.period.as_ref().and_then(|v| match v {
9785            crate::model::service_level_objective::Period::CalendarPeriod(v) => {
9786                std::option::Option::Some(v)
9787            }
9788            _ => std::option::Option::None,
9789        })
9790    }
9791
9792    /// Sets the value of [period][crate::model::ServiceLevelObjective::period]
9793    /// to hold a `CalendarPeriod`.
9794    ///
9795    /// Note that all the setters affecting `period` are
9796    /// mutually exclusive.
9797    pub fn set_calendar_period<T: std::convert::Into<gtype::model::CalendarPeriod>>(
9798        mut self,
9799        v: T,
9800    ) -> Self {
9801        self.period = std::option::Option::Some(
9802            crate::model::service_level_objective::Period::CalendarPeriod(v.into()),
9803        );
9804        self
9805    }
9806}
9807
9808impl wkt::message::Message for ServiceLevelObjective {
9809    fn typename() -> &'static str {
9810        "type.googleapis.com/google.monitoring.v3.ServiceLevelObjective"
9811    }
9812}
9813
9814/// Defines additional types related to [ServiceLevelObjective].
9815pub mod service_level_objective {
9816    #[allow(unused_imports)]
9817    use super::*;
9818
9819    /// `ServiceLevelObjective.View` determines what form of
9820    /// `ServiceLevelObjective` is returned from `GetServiceLevelObjective`,
9821    /// `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs.
9822    ///
9823    /// # Working with unknown values
9824    ///
9825    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9826    /// additional enum variants at any time. Adding new variants is not considered
9827    /// a breaking change. Applications should write their code in anticipation of:
9828    ///
9829    /// - New values appearing in future releases of the client library, **and**
9830    /// - New values received dynamically, without application changes.
9831    ///
9832    /// Please consult the [Working with enums] section in the user guide for some
9833    /// guidelines.
9834    ///
9835    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9836    #[derive(Clone, Debug, PartialEq)]
9837    #[non_exhaustive]
9838    pub enum View {
9839        /// Same as FULL.
9840        Unspecified,
9841        /// Return the embedded `ServiceLevelIndicator` in the form in which it was
9842        /// defined. If it was defined using a `BasicSli`, return that `BasicSli`.
9843        Full,
9844        /// For `ServiceLevelIndicator`s using `BasicSli` articulation, instead
9845        /// return the `ServiceLevelIndicator` with its mode of computation fully
9846        /// spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using
9847        /// `RequestBasedSli` or `WindowsBasedSli`, return the
9848        /// `ServiceLevelIndicator` as it was provided.
9849        Explicit,
9850        /// If set, the enum was initialized with an unknown value.
9851        ///
9852        /// Applications can examine the value using [View::value] or
9853        /// [View::name].
9854        UnknownValue(view::UnknownValue),
9855    }
9856
9857    #[doc(hidden)]
9858    pub mod view {
9859        #[allow(unused_imports)]
9860        use super::*;
9861        #[derive(Clone, Debug, PartialEq)]
9862        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9863    }
9864
9865    impl View {
9866        /// Gets the enum value.
9867        ///
9868        /// Returns `None` if the enum contains an unknown value deserialized from
9869        /// the string representation of enums.
9870        pub fn value(&self) -> std::option::Option<i32> {
9871            match self {
9872                Self::Unspecified => std::option::Option::Some(0),
9873                Self::Full => std::option::Option::Some(2),
9874                Self::Explicit => std::option::Option::Some(1),
9875                Self::UnknownValue(u) => u.0.value(),
9876            }
9877        }
9878
9879        /// Gets the enum value as a string.
9880        ///
9881        /// Returns `None` if the enum contains an unknown value deserialized from
9882        /// the integer representation of enums.
9883        pub fn name(&self) -> std::option::Option<&str> {
9884            match self {
9885                Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
9886                Self::Full => std::option::Option::Some("FULL"),
9887                Self::Explicit => std::option::Option::Some("EXPLICIT"),
9888                Self::UnknownValue(u) => u.0.name(),
9889            }
9890        }
9891    }
9892
9893    impl std::default::Default for View {
9894        fn default() -> Self {
9895            use std::convert::From;
9896            Self::from(0)
9897        }
9898    }
9899
9900    impl std::fmt::Display for View {
9901        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9902            wkt::internal::display_enum(f, self.name(), self.value())
9903        }
9904    }
9905
9906    impl std::convert::From<i32> for View {
9907        fn from(value: i32) -> Self {
9908            match value {
9909                0 => Self::Unspecified,
9910                1 => Self::Explicit,
9911                2 => Self::Full,
9912                _ => Self::UnknownValue(view::UnknownValue(
9913                    wkt::internal::UnknownEnumValue::Integer(value),
9914                )),
9915            }
9916        }
9917    }
9918
9919    impl std::convert::From<&str> for View {
9920        fn from(value: &str) -> Self {
9921            use std::string::ToString;
9922            match value {
9923                "VIEW_UNSPECIFIED" => Self::Unspecified,
9924                "FULL" => Self::Full,
9925                "EXPLICIT" => Self::Explicit,
9926                _ => Self::UnknownValue(view::UnknownValue(
9927                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9928                )),
9929            }
9930        }
9931    }
9932
9933    impl serde::ser::Serialize for View {
9934        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9935        where
9936            S: serde::Serializer,
9937        {
9938            match self {
9939                Self::Unspecified => serializer.serialize_i32(0),
9940                Self::Full => serializer.serialize_i32(2),
9941                Self::Explicit => serializer.serialize_i32(1),
9942                Self::UnknownValue(u) => u.0.serialize(serializer),
9943            }
9944        }
9945    }
9946
9947    impl<'de> serde::de::Deserialize<'de> for View {
9948        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9949        where
9950            D: serde::Deserializer<'de>,
9951        {
9952            deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
9953                ".google.monitoring.v3.ServiceLevelObjective.View",
9954            ))
9955        }
9956    }
9957
9958    /// The time period over which the objective will be evaluated.
9959    #[derive(Clone, Debug, PartialEq)]
9960    #[non_exhaustive]
9961    pub enum Period {
9962        /// A rolling time period, semantically "in the past `<rolling_period>`".
9963        /// Must be an integer multiple of 1 day no larger than 30 days.
9964        RollingPeriod(std::boxed::Box<wkt::Duration>),
9965        /// A calendar period, semantically "since the start of the current
9966        /// `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
9967        /// `MONTH` are supported.
9968        CalendarPeriod(gtype::model::CalendarPeriod),
9969    }
9970}
9971
9972/// A Service-Level Indicator (SLI) describes the "performance" of a service. For
9973/// some services, the SLI is well-defined. In such cases, the SLI can be
9974/// described easily by referencing the well-known SLI and providing the needed
9975/// parameters. Alternatively, a "custom" SLI can be defined with a query to the
9976/// underlying metric store. An SLI is defined to be `good_service /
9977/// total_service` over any queried time interval. The value of performance
9978/// always falls into the range `0 <= performance <= 1`. A custom SLI describes
9979/// how to compute this ratio, whether this is by dividing values from a pair of
9980/// time series, cutting a `Distribution` into good and bad counts, or counting
9981/// time windows in which the service complies with a criterion. For separation
9982/// of concerns, a single Service-Level Indicator measures performance for only
9983/// one aspect of service quality, such as fraction of successful queries or
9984/// fast-enough queries.
9985#[derive(Clone, Default, PartialEq)]
9986#[non_exhaustive]
9987pub struct ServiceLevelIndicator {
9988    /// Service level indicators can be grouped by whether the "unit" of service
9989    /// being measured is based on counts of good requests or on counts of good
9990    /// time windows
9991    pub r#type: std::option::Option<crate::model::service_level_indicator::Type>,
9992
9993    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9994}
9995
9996impl ServiceLevelIndicator {
9997    pub fn new() -> Self {
9998        std::default::Default::default()
9999    }
10000
10001    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::type].
10002    ///
10003    /// Note that all the setters affecting `r#type` are mutually
10004    /// exclusive.
10005    pub fn set_type<
10006        T: std::convert::Into<std::option::Option<crate::model::service_level_indicator::Type>>,
10007    >(
10008        mut self,
10009        v: T,
10010    ) -> Self {
10011        self.r#type = v.into();
10012        self
10013    }
10014
10015    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10016    /// if it holds a `BasicSli`, `None` if the field is not set or
10017    /// holds a different branch.
10018    pub fn basic_sli(&self) -> std::option::Option<&std::boxed::Box<crate::model::BasicSli>> {
10019        #[allow(unreachable_patterns)]
10020        self.r#type.as_ref().and_then(|v| match v {
10021            crate::model::service_level_indicator::Type::BasicSli(v) => {
10022                std::option::Option::Some(v)
10023            }
10024            _ => std::option::Option::None,
10025        })
10026    }
10027
10028    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10029    /// to hold a `BasicSli`.
10030    ///
10031    /// Note that all the setters affecting `r#type` are
10032    /// mutually exclusive.
10033    pub fn set_basic_sli<T: std::convert::Into<std::boxed::Box<crate::model::BasicSli>>>(
10034        mut self,
10035        v: T,
10036    ) -> Self {
10037        self.r#type = std::option::Option::Some(
10038            crate::model::service_level_indicator::Type::BasicSli(v.into()),
10039        );
10040        self
10041    }
10042
10043    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10044    /// if it holds a `RequestBased`, `None` if the field is not set or
10045    /// holds a different branch.
10046    pub fn request_based(
10047        &self,
10048    ) -> std::option::Option<&std::boxed::Box<crate::model::RequestBasedSli>> {
10049        #[allow(unreachable_patterns)]
10050        self.r#type.as_ref().and_then(|v| match v {
10051            crate::model::service_level_indicator::Type::RequestBased(v) => {
10052                std::option::Option::Some(v)
10053            }
10054            _ => std::option::Option::None,
10055        })
10056    }
10057
10058    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10059    /// to hold a `RequestBased`.
10060    ///
10061    /// Note that all the setters affecting `r#type` are
10062    /// mutually exclusive.
10063    pub fn set_request_based<
10064        T: std::convert::Into<std::boxed::Box<crate::model::RequestBasedSli>>,
10065    >(
10066        mut self,
10067        v: T,
10068    ) -> Self {
10069        self.r#type = std::option::Option::Some(
10070            crate::model::service_level_indicator::Type::RequestBased(v.into()),
10071        );
10072        self
10073    }
10074
10075    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10076    /// if it holds a `WindowsBased`, `None` if the field is not set or
10077    /// holds a different branch.
10078    pub fn windows_based(
10079        &self,
10080    ) -> std::option::Option<&std::boxed::Box<crate::model::WindowsBasedSli>> {
10081        #[allow(unreachable_patterns)]
10082        self.r#type.as_ref().and_then(|v| match v {
10083            crate::model::service_level_indicator::Type::WindowsBased(v) => {
10084                std::option::Option::Some(v)
10085            }
10086            _ => std::option::Option::None,
10087        })
10088    }
10089
10090    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
10091    /// to hold a `WindowsBased`.
10092    ///
10093    /// Note that all the setters affecting `r#type` are
10094    /// mutually exclusive.
10095    pub fn set_windows_based<
10096        T: std::convert::Into<std::boxed::Box<crate::model::WindowsBasedSli>>,
10097    >(
10098        mut self,
10099        v: T,
10100    ) -> Self {
10101        self.r#type = std::option::Option::Some(
10102            crate::model::service_level_indicator::Type::WindowsBased(v.into()),
10103        );
10104        self
10105    }
10106}
10107
10108impl wkt::message::Message for ServiceLevelIndicator {
10109    fn typename() -> &'static str {
10110        "type.googleapis.com/google.monitoring.v3.ServiceLevelIndicator"
10111    }
10112}
10113
10114/// Defines additional types related to [ServiceLevelIndicator].
10115pub mod service_level_indicator {
10116    #[allow(unused_imports)]
10117    use super::*;
10118
10119    /// Service level indicators can be grouped by whether the "unit" of service
10120    /// being measured is based on counts of good requests or on counts of good
10121    /// time windows
10122    #[derive(Clone, Debug, PartialEq)]
10123    #[non_exhaustive]
10124    pub enum Type {
10125        /// Basic SLI on a well-known service type.
10126        BasicSli(std::boxed::Box<crate::model::BasicSli>),
10127        /// Request-based SLIs
10128        RequestBased(std::boxed::Box<crate::model::RequestBasedSli>),
10129        /// Windows-based SLIs
10130        WindowsBased(std::boxed::Box<crate::model::WindowsBasedSli>),
10131    }
10132}
10133
10134/// An SLI measuring performance on a well-known service type. Performance will
10135/// be computed on the basis of pre-defined metrics. The type of the
10136/// `service_resource` determines the metrics to use and the
10137/// `service_resource.labels` and `metric_labels` are used to construct a
10138/// monitoring filter to filter that metric down to just the data relevant to
10139/// this service.
10140#[derive(Clone, Default, PartialEq)]
10141#[non_exhaustive]
10142pub struct BasicSli {
10143    /// OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from
10144    /// other methods will not be used to calculate performance for this SLI. If
10145    /// omitted, this SLI applies to all the Service's methods. For service types
10146    /// that don't support breaking down by method, setting this field will result
10147    /// in an error.
10148    pub method: std::vec::Vec<std::string::String>,
10149
10150    /// OPTIONAL: The set of locations to which this SLI is relevant. Telemetry
10151    /// from other locations will not be used to calculate performance for this
10152    /// SLI. If omitted, this SLI applies to all locations in which the Service has
10153    /// activity. For service types that don't support breaking down by location,
10154    /// setting this field will result in an error.
10155    pub location: std::vec::Vec<std::string::String>,
10156
10157    /// OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry
10158    /// from other API versions will not be used to calculate performance for this
10159    /// SLI. If omitted, this SLI applies to all API versions. For service types
10160    /// that don't support breaking down by version, setting this field will result
10161    /// in an error.
10162    pub version: std::vec::Vec<std::string::String>,
10163
10164    /// This SLI can be evaluated on the basis of availability or latency.
10165    pub sli_criteria: std::option::Option<crate::model::basic_sli::SliCriteria>,
10166
10167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10168}
10169
10170impl BasicSli {
10171    pub fn new() -> Self {
10172        std::default::Default::default()
10173    }
10174
10175    /// Sets the value of [method][crate::model::BasicSli::method].
10176    pub fn set_method<T, V>(mut self, v: T) -> Self
10177    where
10178        T: std::iter::IntoIterator<Item = V>,
10179        V: std::convert::Into<std::string::String>,
10180    {
10181        use std::iter::Iterator;
10182        self.method = v.into_iter().map(|i| i.into()).collect();
10183        self
10184    }
10185
10186    /// Sets the value of [location][crate::model::BasicSli::location].
10187    pub fn set_location<T, V>(mut self, v: T) -> Self
10188    where
10189        T: std::iter::IntoIterator<Item = V>,
10190        V: std::convert::Into<std::string::String>,
10191    {
10192        use std::iter::Iterator;
10193        self.location = v.into_iter().map(|i| i.into()).collect();
10194        self
10195    }
10196
10197    /// Sets the value of [version][crate::model::BasicSli::version].
10198    pub fn set_version<T, V>(mut self, v: T) -> Self
10199    where
10200        T: std::iter::IntoIterator<Item = V>,
10201        V: std::convert::Into<std::string::String>,
10202    {
10203        use std::iter::Iterator;
10204        self.version = v.into_iter().map(|i| i.into()).collect();
10205        self
10206    }
10207
10208    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria].
10209    ///
10210    /// Note that all the setters affecting `sli_criteria` are mutually
10211    /// exclusive.
10212    pub fn set_sli_criteria<
10213        T: std::convert::Into<std::option::Option<crate::model::basic_sli::SliCriteria>>,
10214    >(
10215        mut self,
10216        v: T,
10217    ) -> Self {
10218        self.sli_criteria = v.into();
10219        self
10220    }
10221
10222    /// The value of [sli_criteria][crate::model::BasicSli::sli_criteria]
10223    /// if it holds a `Availability`, `None` if the field is not set or
10224    /// holds a different branch.
10225    pub fn availability(
10226        &self,
10227    ) -> std::option::Option<&std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>> {
10228        #[allow(unreachable_patterns)]
10229        self.sli_criteria.as_ref().and_then(|v| match v {
10230            crate::model::basic_sli::SliCriteria::Availability(v) => std::option::Option::Some(v),
10231            _ => std::option::Option::None,
10232        })
10233    }
10234
10235    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria]
10236    /// to hold a `Availability`.
10237    ///
10238    /// Note that all the setters affecting `sli_criteria` are
10239    /// mutually exclusive.
10240    pub fn set_availability<
10241        T: std::convert::Into<std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>>,
10242    >(
10243        mut self,
10244        v: T,
10245    ) -> Self {
10246        self.sli_criteria =
10247            std::option::Option::Some(crate::model::basic_sli::SliCriteria::Availability(v.into()));
10248        self
10249    }
10250
10251    /// The value of [sli_criteria][crate::model::BasicSli::sli_criteria]
10252    /// if it holds a `Latency`, `None` if the field is not set or
10253    /// holds a different branch.
10254    pub fn latency(
10255        &self,
10256    ) -> std::option::Option<&std::boxed::Box<crate::model::basic_sli::LatencyCriteria>> {
10257        #[allow(unreachable_patterns)]
10258        self.sli_criteria.as_ref().and_then(|v| match v {
10259            crate::model::basic_sli::SliCriteria::Latency(v) => std::option::Option::Some(v),
10260            _ => std::option::Option::None,
10261        })
10262    }
10263
10264    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria]
10265    /// to hold a `Latency`.
10266    ///
10267    /// Note that all the setters affecting `sli_criteria` are
10268    /// mutually exclusive.
10269    pub fn set_latency<
10270        T: std::convert::Into<std::boxed::Box<crate::model::basic_sli::LatencyCriteria>>,
10271    >(
10272        mut self,
10273        v: T,
10274    ) -> Self {
10275        self.sli_criteria =
10276            std::option::Option::Some(crate::model::basic_sli::SliCriteria::Latency(v.into()));
10277        self
10278    }
10279}
10280
10281impl wkt::message::Message for BasicSli {
10282    fn typename() -> &'static str {
10283        "type.googleapis.com/google.monitoring.v3.BasicSli"
10284    }
10285}
10286
10287/// Defines additional types related to [BasicSli].
10288pub mod basic_sli {
10289    #[allow(unused_imports)]
10290    use super::*;
10291
10292    /// Future parameters for the availability SLI.
10293    #[derive(Clone, Default, PartialEq)]
10294    #[non_exhaustive]
10295    pub struct AvailabilityCriteria {
10296        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10297    }
10298
10299    impl AvailabilityCriteria {
10300        pub fn new() -> Self {
10301            std::default::Default::default()
10302        }
10303    }
10304
10305    impl wkt::message::Message for AvailabilityCriteria {
10306        fn typename() -> &'static str {
10307            "type.googleapis.com/google.monitoring.v3.BasicSli.AvailabilityCriteria"
10308        }
10309    }
10310
10311    /// Parameters for a latency threshold SLI.
10312    #[derive(Clone, Default, PartialEq)]
10313    #[non_exhaustive]
10314    pub struct LatencyCriteria {
10315        /// Good service is defined to be the count of requests made to this service
10316        /// that return in no more than `threshold`.
10317        pub threshold: std::option::Option<wkt::Duration>,
10318
10319        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10320    }
10321
10322    impl LatencyCriteria {
10323        pub fn new() -> Self {
10324            std::default::Default::default()
10325        }
10326
10327        /// Sets the value of [threshold][crate::model::basic_sli::LatencyCriteria::threshold].
10328        pub fn set_threshold<T>(mut self, v: T) -> Self
10329        where
10330            T: std::convert::Into<wkt::Duration>,
10331        {
10332            self.threshold = std::option::Option::Some(v.into());
10333            self
10334        }
10335
10336        /// Sets or clears the value of [threshold][crate::model::basic_sli::LatencyCriteria::threshold].
10337        pub fn set_or_clear_threshold<T>(mut self, v: std::option::Option<T>) -> Self
10338        where
10339            T: std::convert::Into<wkt::Duration>,
10340        {
10341            self.threshold = v.map(|x| x.into());
10342            self
10343        }
10344    }
10345
10346    impl wkt::message::Message for LatencyCriteria {
10347        fn typename() -> &'static str {
10348            "type.googleapis.com/google.monitoring.v3.BasicSli.LatencyCriteria"
10349        }
10350    }
10351
10352    /// This SLI can be evaluated on the basis of availability or latency.
10353    #[derive(Clone, Debug, PartialEq)]
10354    #[non_exhaustive]
10355    pub enum SliCriteria {
10356        /// Good service is defined to be the count of requests made to this service
10357        /// that return successfully.
10358        Availability(std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>),
10359        /// Good service is defined to be the count of requests made to this service
10360        /// that are fast enough with respect to `latency.threshold`.
10361        Latency(std::boxed::Box<crate::model::basic_sli::LatencyCriteria>),
10362    }
10363}
10364
10365/// Range of numerical values within `min` and `max`.
10366#[derive(Clone, Default, PartialEq)]
10367#[non_exhaustive]
10368pub struct Range {
10369    /// Range minimum.
10370    pub min: f64,
10371
10372    /// Range maximum.
10373    pub max: f64,
10374
10375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10376}
10377
10378impl Range {
10379    pub fn new() -> Self {
10380        std::default::Default::default()
10381    }
10382
10383    /// Sets the value of [min][crate::model::Range::min].
10384    pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
10385        self.min = v.into();
10386        self
10387    }
10388
10389    /// Sets the value of [max][crate::model::Range::max].
10390    pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
10391        self.max = v.into();
10392        self
10393    }
10394}
10395
10396impl wkt::message::Message for Range {
10397    fn typename() -> &'static str {
10398        "type.googleapis.com/google.monitoring.v3.Range"
10399    }
10400}
10401
10402/// Service Level Indicators for which atomic units of service are counted
10403/// directly.
10404#[derive(Clone, Default, PartialEq)]
10405#[non_exhaustive]
10406pub struct RequestBasedSli {
10407    /// The means to compute a ratio of `good_service` to `total_service`.
10408    pub method: std::option::Option<crate::model::request_based_sli::Method>,
10409
10410    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10411}
10412
10413impl RequestBasedSli {
10414    pub fn new() -> Self {
10415        std::default::Default::default()
10416    }
10417
10418    /// Sets the value of [method][crate::model::RequestBasedSli::method].
10419    ///
10420    /// Note that all the setters affecting `method` are mutually
10421    /// exclusive.
10422    pub fn set_method<
10423        T: std::convert::Into<std::option::Option<crate::model::request_based_sli::Method>>,
10424    >(
10425        mut self,
10426        v: T,
10427    ) -> Self {
10428        self.method = v.into();
10429        self
10430    }
10431
10432    /// The value of [method][crate::model::RequestBasedSli::method]
10433    /// if it holds a `GoodTotalRatio`, `None` if the field is not set or
10434    /// holds a different branch.
10435    pub fn good_total_ratio(
10436        &self,
10437    ) -> std::option::Option<&std::boxed::Box<crate::model::TimeSeriesRatio>> {
10438        #[allow(unreachable_patterns)]
10439        self.method.as_ref().and_then(|v| match v {
10440            crate::model::request_based_sli::Method::GoodTotalRatio(v) => {
10441                std::option::Option::Some(v)
10442            }
10443            _ => std::option::Option::None,
10444        })
10445    }
10446
10447    /// Sets the value of [method][crate::model::RequestBasedSli::method]
10448    /// to hold a `GoodTotalRatio`.
10449    ///
10450    /// Note that all the setters affecting `method` are
10451    /// mutually exclusive.
10452    pub fn set_good_total_ratio<
10453        T: std::convert::Into<std::boxed::Box<crate::model::TimeSeriesRatio>>,
10454    >(
10455        mut self,
10456        v: T,
10457    ) -> Self {
10458        self.method = std::option::Option::Some(
10459            crate::model::request_based_sli::Method::GoodTotalRatio(v.into()),
10460        );
10461        self
10462    }
10463
10464    /// The value of [method][crate::model::RequestBasedSli::method]
10465    /// if it holds a `DistributionCut`, `None` if the field is not set or
10466    /// holds a different branch.
10467    pub fn distribution_cut(
10468        &self,
10469    ) -> std::option::Option<&std::boxed::Box<crate::model::DistributionCut>> {
10470        #[allow(unreachable_patterns)]
10471        self.method.as_ref().and_then(|v| match v {
10472            crate::model::request_based_sli::Method::DistributionCut(v) => {
10473                std::option::Option::Some(v)
10474            }
10475            _ => std::option::Option::None,
10476        })
10477    }
10478
10479    /// Sets the value of [method][crate::model::RequestBasedSli::method]
10480    /// to hold a `DistributionCut`.
10481    ///
10482    /// Note that all the setters affecting `method` are
10483    /// mutually exclusive.
10484    pub fn set_distribution_cut<
10485        T: std::convert::Into<std::boxed::Box<crate::model::DistributionCut>>,
10486    >(
10487        mut self,
10488        v: T,
10489    ) -> Self {
10490        self.method = std::option::Option::Some(
10491            crate::model::request_based_sli::Method::DistributionCut(v.into()),
10492        );
10493        self
10494    }
10495}
10496
10497impl wkt::message::Message for RequestBasedSli {
10498    fn typename() -> &'static str {
10499        "type.googleapis.com/google.monitoring.v3.RequestBasedSli"
10500    }
10501}
10502
10503/// Defines additional types related to [RequestBasedSli].
10504pub mod request_based_sli {
10505    #[allow(unused_imports)]
10506    use super::*;
10507
10508    /// The means to compute a ratio of `good_service` to `total_service`.
10509    #[derive(Clone, Debug, PartialEq)]
10510    #[non_exhaustive]
10511    pub enum Method {
10512        /// `good_total_ratio` is used when the ratio of `good_service` to
10513        /// `total_service` is computed from two `TimeSeries`.
10514        GoodTotalRatio(std::boxed::Box<crate::model::TimeSeriesRatio>),
10515        /// `distribution_cut` is used when `good_service` is a count of values
10516        /// aggregated in a `Distribution` that fall into a good range. The
10517        /// `total_service` is the total count of all values aggregated in the
10518        /// `Distribution`.
10519        DistributionCut(std::boxed::Box<crate::model::DistributionCut>),
10520    }
10521}
10522
10523/// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the
10524/// `good_service / total_service` ratio. The specified `TimeSeries` must have
10525/// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
10526/// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify
10527/// exactly two of good, bad, and total, and the relationship `good_service +
10528/// bad_service = total_service` will be assumed.
10529#[derive(Clone, Default, PartialEq)]
10530#[non_exhaustive]
10531pub struct TimeSeriesRatio {
10532    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
10533    /// specifying a `TimeSeries` quantifying good service provided. Must have
10534    /// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
10535    /// DELTA` or `MetricKind = CUMULATIVE`.
10536    pub good_service_filter: std::string::String,
10537
10538    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
10539    /// specifying a `TimeSeries` quantifying bad service, either demanded service
10540    /// that was not provided or demanded service that was of inadequate quality.
10541    /// Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have
10542    /// `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
10543    pub bad_service_filter: std::string::String,
10544
10545    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
10546    /// specifying a `TimeSeries` quantifying total demanded service. Must have
10547    /// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
10548    /// DELTA` or `MetricKind = CUMULATIVE`.
10549    pub total_service_filter: std::string::String,
10550
10551    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10552}
10553
10554impl TimeSeriesRatio {
10555    pub fn new() -> Self {
10556        std::default::Default::default()
10557    }
10558
10559    /// Sets the value of [good_service_filter][crate::model::TimeSeriesRatio::good_service_filter].
10560    pub fn set_good_service_filter<T: std::convert::Into<std::string::String>>(
10561        mut self,
10562        v: T,
10563    ) -> Self {
10564        self.good_service_filter = v.into();
10565        self
10566    }
10567
10568    /// Sets the value of [bad_service_filter][crate::model::TimeSeriesRatio::bad_service_filter].
10569    pub fn set_bad_service_filter<T: std::convert::Into<std::string::String>>(
10570        mut self,
10571        v: T,
10572    ) -> Self {
10573        self.bad_service_filter = v.into();
10574        self
10575    }
10576
10577    /// Sets the value of [total_service_filter][crate::model::TimeSeriesRatio::total_service_filter].
10578    pub fn set_total_service_filter<T: std::convert::Into<std::string::String>>(
10579        mut self,
10580        v: T,
10581    ) -> Self {
10582        self.total_service_filter = v.into();
10583        self
10584    }
10585}
10586
10587impl wkt::message::Message for TimeSeriesRatio {
10588    fn typename() -> &'static str {
10589        "type.googleapis.com/google.monitoring.v3.TimeSeriesRatio"
10590    }
10591}
10592
10593/// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring
10594/// good service and total service. The `TimeSeries` must have `ValueType =
10595/// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The
10596/// computed `good_service` will be the estimated count of values in the
10597/// `Distribution` that fall within the specified `min` and `max`.
10598#[derive(Clone, Default, PartialEq)]
10599#[non_exhaustive]
10600pub struct DistributionCut {
10601    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
10602    /// specifying a `TimeSeries` aggregating values. Must have `ValueType =
10603    /// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
10604    pub distribution_filter: std::string::String,
10605
10606    /// Range of values considered "good." For a one-sided range, set one bound to
10607    /// an infinite value.
10608    pub range: std::option::Option<crate::model::Range>,
10609
10610    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10611}
10612
10613impl DistributionCut {
10614    pub fn new() -> Self {
10615        std::default::Default::default()
10616    }
10617
10618    /// Sets the value of [distribution_filter][crate::model::DistributionCut::distribution_filter].
10619    pub fn set_distribution_filter<T: std::convert::Into<std::string::String>>(
10620        mut self,
10621        v: T,
10622    ) -> Self {
10623        self.distribution_filter = v.into();
10624        self
10625    }
10626
10627    /// Sets the value of [range][crate::model::DistributionCut::range].
10628    pub fn set_range<T>(mut self, v: T) -> Self
10629    where
10630        T: std::convert::Into<crate::model::Range>,
10631    {
10632        self.range = std::option::Option::Some(v.into());
10633        self
10634    }
10635
10636    /// Sets or clears the value of [range][crate::model::DistributionCut::range].
10637    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
10638    where
10639        T: std::convert::Into<crate::model::Range>,
10640    {
10641        self.range = v.map(|x| x.into());
10642        self
10643    }
10644}
10645
10646impl wkt::message::Message for DistributionCut {
10647    fn typename() -> &'static str {
10648        "type.googleapis.com/google.monitoring.v3.DistributionCut"
10649    }
10650}
10651
10652/// A `WindowsBasedSli` defines `good_service` as the count of time windows for
10653/// which the provided service was of good quality. Criteria for determining
10654/// if service was good are embedded in the `window_criterion`.
10655#[derive(Clone, Default, PartialEq)]
10656#[non_exhaustive]
10657pub struct WindowsBasedSli {
10658    /// Duration over which window quality is evaluated. Must be an integer
10659    /// fraction of a day and at least `60s`.
10660    pub window_period: std::option::Option<wkt::Duration>,
10661
10662    /// The criterion to use for evaluating window goodness.
10663    pub window_criterion: std::option::Option<crate::model::windows_based_sli::WindowCriterion>,
10664
10665    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10666}
10667
10668impl WindowsBasedSli {
10669    pub fn new() -> Self {
10670        std::default::Default::default()
10671    }
10672
10673    /// Sets the value of [window_period][crate::model::WindowsBasedSli::window_period].
10674    pub fn set_window_period<T>(mut self, v: T) -> Self
10675    where
10676        T: std::convert::Into<wkt::Duration>,
10677    {
10678        self.window_period = std::option::Option::Some(v.into());
10679        self
10680    }
10681
10682    /// Sets or clears the value of [window_period][crate::model::WindowsBasedSli::window_period].
10683    pub fn set_or_clear_window_period<T>(mut self, v: std::option::Option<T>) -> Self
10684    where
10685        T: std::convert::Into<wkt::Duration>,
10686    {
10687        self.window_period = v.map(|x| x.into());
10688        self
10689    }
10690
10691    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion].
10692    ///
10693    /// Note that all the setters affecting `window_criterion` are mutually
10694    /// exclusive.
10695    pub fn set_window_criterion<
10696        T: std::convert::Into<std::option::Option<crate::model::windows_based_sli::WindowCriterion>>,
10697    >(
10698        mut self,
10699        v: T,
10700    ) -> Self {
10701        self.window_criterion = v.into();
10702        self
10703    }
10704
10705    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10706    /// if it holds a `GoodBadMetricFilter`, `None` if the field is not set or
10707    /// holds a different branch.
10708    pub fn good_bad_metric_filter(&self) -> std::option::Option<&std::string::String> {
10709        #[allow(unreachable_patterns)]
10710        self.window_criterion.as_ref().and_then(|v| match v {
10711            crate::model::windows_based_sli::WindowCriterion::GoodBadMetricFilter(v) => {
10712                std::option::Option::Some(v)
10713            }
10714            _ => std::option::Option::None,
10715        })
10716    }
10717
10718    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10719    /// to hold a `GoodBadMetricFilter`.
10720    ///
10721    /// Note that all the setters affecting `window_criterion` are
10722    /// mutually exclusive.
10723    pub fn set_good_bad_metric_filter<T: std::convert::Into<std::string::String>>(
10724        mut self,
10725        v: T,
10726    ) -> Self {
10727        self.window_criterion = std::option::Option::Some(
10728            crate::model::windows_based_sli::WindowCriterion::GoodBadMetricFilter(v.into()),
10729        );
10730        self
10731    }
10732
10733    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10734    /// if it holds a `GoodTotalRatioThreshold`, `None` if the field is not set or
10735    /// holds a different branch.
10736    pub fn good_total_ratio_threshold(
10737        &self,
10738    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>>
10739    {
10740        #[allow(unreachable_patterns)]
10741        self.window_criterion.as_ref().and_then(|v| match v {
10742            crate::model::windows_based_sli::WindowCriterion::GoodTotalRatioThreshold(v) => {
10743                std::option::Option::Some(v)
10744            }
10745            _ => std::option::Option::None,
10746        })
10747    }
10748
10749    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10750    /// to hold a `GoodTotalRatioThreshold`.
10751    ///
10752    /// Note that all the setters affecting `window_criterion` are
10753    /// mutually exclusive.
10754    pub fn set_good_total_ratio_threshold<
10755        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>>,
10756    >(
10757        mut self,
10758        v: T,
10759    ) -> Self {
10760        self.window_criterion = std::option::Option::Some(
10761            crate::model::windows_based_sli::WindowCriterion::GoodTotalRatioThreshold(v.into()),
10762        );
10763        self
10764    }
10765
10766    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10767    /// if it holds a `MetricMeanInRange`, `None` if the field is not set or
10768    /// holds a different branch.
10769    pub fn metric_mean_in_range(
10770        &self,
10771    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::MetricRange>> {
10772        #[allow(unreachable_patterns)]
10773        self.window_criterion.as_ref().and_then(|v| match v {
10774            crate::model::windows_based_sli::WindowCriterion::MetricMeanInRange(v) => {
10775                std::option::Option::Some(v)
10776            }
10777            _ => std::option::Option::None,
10778        })
10779    }
10780
10781    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10782    /// to hold a `MetricMeanInRange`.
10783    ///
10784    /// Note that all the setters affecting `window_criterion` are
10785    /// mutually exclusive.
10786    pub fn set_metric_mean_in_range<
10787        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::MetricRange>>,
10788    >(
10789        mut self,
10790        v: T,
10791    ) -> Self {
10792        self.window_criterion = std::option::Option::Some(
10793            crate::model::windows_based_sli::WindowCriterion::MetricMeanInRange(v.into()),
10794        );
10795        self
10796    }
10797
10798    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10799    /// if it holds a `MetricSumInRange`, `None` if the field is not set or
10800    /// holds a different branch.
10801    pub fn metric_sum_in_range(
10802        &self,
10803    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::MetricRange>> {
10804        #[allow(unreachable_patterns)]
10805        self.window_criterion.as_ref().and_then(|v| match v {
10806            crate::model::windows_based_sli::WindowCriterion::MetricSumInRange(v) => {
10807                std::option::Option::Some(v)
10808            }
10809            _ => std::option::Option::None,
10810        })
10811    }
10812
10813    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
10814    /// to hold a `MetricSumInRange`.
10815    ///
10816    /// Note that all the setters affecting `window_criterion` are
10817    /// mutually exclusive.
10818    pub fn set_metric_sum_in_range<
10819        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::MetricRange>>,
10820    >(
10821        mut self,
10822        v: T,
10823    ) -> Self {
10824        self.window_criterion = std::option::Option::Some(
10825            crate::model::windows_based_sli::WindowCriterion::MetricSumInRange(v.into()),
10826        );
10827        self
10828    }
10829}
10830
10831impl wkt::message::Message for WindowsBasedSli {
10832    fn typename() -> &'static str {
10833        "type.googleapis.com/google.monitoring.v3.WindowsBasedSli"
10834    }
10835}
10836
10837/// Defines additional types related to [WindowsBasedSli].
10838pub mod windows_based_sli {
10839    #[allow(unused_imports)]
10840    use super::*;
10841
10842    /// A `PerformanceThreshold` is used when each window is good when that window
10843    /// has a sufficiently high `performance`.
10844    #[derive(Clone, Default, PartialEq)]
10845    #[non_exhaustive]
10846    pub struct PerformanceThreshold {
10847        /// If window `performance >= threshold`, the window is counted as good.
10848        pub threshold: f64,
10849
10850        /// The means, either a request-based SLI or a basic SLI, by which to compute
10851        /// performance over a window.
10852        pub r#type:
10853            std::option::Option<crate::model::windows_based_sli::performance_threshold::Type>,
10854
10855        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10856    }
10857
10858    impl PerformanceThreshold {
10859        pub fn new() -> Self {
10860            std::default::Default::default()
10861        }
10862
10863        /// Sets the value of [threshold][crate::model::windows_based_sli::PerformanceThreshold::threshold].
10864        pub fn set_threshold<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
10865            self.threshold = v.into();
10866            self
10867        }
10868
10869        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::type].
10870        ///
10871        /// Note that all the setters affecting `r#type` are mutually
10872        /// exclusive.
10873        pub fn set_type<
10874            T: std::convert::Into<
10875                    std::option::Option<
10876                        crate::model::windows_based_sli::performance_threshold::Type,
10877                    >,
10878                >,
10879        >(
10880            mut self,
10881            v: T,
10882        ) -> Self {
10883            self.r#type = v.into();
10884            self
10885        }
10886
10887        /// The value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
10888        /// if it holds a `Performance`, `None` if the field is not set or
10889        /// holds a different branch.
10890        pub fn performance(
10891            &self,
10892        ) -> std::option::Option<&std::boxed::Box<crate::model::RequestBasedSli>> {
10893            #[allow(unreachable_patterns)]
10894            self.r#type.as_ref().and_then(|v| match v {
10895                crate::model::windows_based_sli::performance_threshold::Type::Performance(v) => {
10896                    std::option::Option::Some(v)
10897                }
10898                _ => std::option::Option::None,
10899            })
10900        }
10901
10902        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
10903        /// to hold a `Performance`.
10904        ///
10905        /// Note that all the setters affecting `r#type` are
10906        /// mutually exclusive.
10907        pub fn set_performance<
10908            T: std::convert::Into<std::boxed::Box<crate::model::RequestBasedSli>>,
10909        >(
10910            mut self,
10911            v: T,
10912        ) -> Self {
10913            self.r#type = std::option::Option::Some(
10914                crate::model::windows_based_sli::performance_threshold::Type::Performance(v.into()),
10915            );
10916            self
10917        }
10918
10919        /// The value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
10920        /// if it holds a `BasicSliPerformance`, `None` if the field is not set or
10921        /// holds a different branch.
10922        pub fn basic_sli_performance(
10923            &self,
10924        ) -> std::option::Option<&std::boxed::Box<crate::model::BasicSli>> {
10925            #[allow(unreachable_patterns)]
10926            self.r#type.as_ref().and_then(|v| match v {
10927                crate::model::windows_based_sli::performance_threshold::Type::BasicSliPerformance(v) => std::option::Option::Some(v),
10928                _ => std::option::Option::None,
10929            })
10930        }
10931
10932        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
10933        /// to hold a `BasicSliPerformance`.
10934        ///
10935        /// Note that all the setters affecting `r#type` are
10936        /// mutually exclusive.
10937        pub fn set_basic_sli_performance<
10938            T: std::convert::Into<std::boxed::Box<crate::model::BasicSli>>,
10939        >(
10940            mut self,
10941            v: T,
10942        ) -> Self {
10943            self.r#type = std::option::Option::Some(
10944                crate::model::windows_based_sli::performance_threshold::Type::BasicSliPerformance(
10945                    v.into(),
10946                ),
10947            );
10948            self
10949        }
10950    }
10951
10952    impl wkt::message::Message for PerformanceThreshold {
10953        fn typename() -> &'static str {
10954            "type.googleapis.com/google.monitoring.v3.WindowsBasedSli.PerformanceThreshold"
10955        }
10956    }
10957
10958    /// Defines additional types related to [PerformanceThreshold].
10959    pub mod performance_threshold {
10960        #[allow(unused_imports)]
10961        use super::*;
10962
10963        /// The means, either a request-based SLI or a basic SLI, by which to compute
10964        /// performance over a window.
10965        #[derive(Clone, Debug, PartialEq)]
10966        #[non_exhaustive]
10967        pub enum Type {
10968            /// `RequestBasedSli` to evaluate to judge window quality.
10969            Performance(std::boxed::Box<crate::model::RequestBasedSli>),
10970            /// `BasicSli` to evaluate to judge window quality.
10971            BasicSliPerformance(std::boxed::Box<crate::model::BasicSli>),
10972        }
10973    }
10974
10975    /// A `MetricRange` is used when each window is good when the value x of a
10976    /// single `TimeSeries` satisfies `range.min <= x <= range.max`. The provided
10977    /// `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and
10978    /// `MetricKind = GAUGE`.
10979    #[derive(Clone, Default, PartialEq)]
10980    #[non_exhaustive]
10981    pub struct MetricRange {
10982        /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
10983        /// specifying the `TimeSeries` to use for evaluating window quality.
10984        pub time_series: std::string::String,
10985
10986        /// Range of values considered "good." For a one-sided range, set one bound
10987        /// to an infinite value.
10988        pub range: std::option::Option<crate::model::Range>,
10989
10990        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10991    }
10992
10993    impl MetricRange {
10994        pub fn new() -> Self {
10995            std::default::Default::default()
10996        }
10997
10998        /// Sets the value of [time_series][crate::model::windows_based_sli::MetricRange::time_series].
10999        pub fn set_time_series<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11000            self.time_series = v.into();
11001            self
11002        }
11003
11004        /// Sets the value of [range][crate::model::windows_based_sli::MetricRange::range].
11005        pub fn set_range<T>(mut self, v: T) -> Self
11006        where
11007            T: std::convert::Into<crate::model::Range>,
11008        {
11009            self.range = std::option::Option::Some(v.into());
11010            self
11011        }
11012
11013        /// Sets or clears the value of [range][crate::model::windows_based_sli::MetricRange::range].
11014        pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
11015        where
11016            T: std::convert::Into<crate::model::Range>,
11017        {
11018            self.range = v.map(|x| x.into());
11019            self
11020        }
11021    }
11022
11023    impl wkt::message::Message for MetricRange {
11024        fn typename() -> &'static str {
11025            "type.googleapis.com/google.monitoring.v3.WindowsBasedSli.MetricRange"
11026        }
11027    }
11028
11029    /// The criterion to use for evaluating window goodness.
11030    #[derive(Clone, Debug, PartialEq)]
11031    #[non_exhaustive]
11032    pub enum WindowCriterion {
11033        /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
11034        /// specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if
11035        /// any `true` values appear in the window.
11036        GoodBadMetricFilter(std::string::String),
11037        /// A window is good if its `performance` is high enough.
11038        GoodTotalRatioThreshold(
11039            std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>,
11040        ),
11041        /// A window is good if the metric's value is in a good range, averaged
11042        /// across returned streams.
11043        MetricMeanInRange(std::boxed::Box<crate::model::windows_based_sli::MetricRange>),
11044        /// A window is good if the metric's value is in a good range, summed across
11045        /// returned streams.
11046        MetricSumInRange(std::boxed::Box<crate::model::windows_based_sli::MetricRange>),
11047    }
11048}
11049
11050/// The `CreateService` request.
11051#[derive(Clone, Default, PartialEq)]
11052#[non_exhaustive]
11053pub struct CreateServiceRequest {
11054    /// Required. Resource
11055    /// [name](https://cloud.google.com/monitoring/api/v3#project_name) of the
11056    /// parent Metrics Scope. The format is:
11057    ///
11058    /// ```norust
11059    /// projects/[PROJECT_ID_OR_NUMBER]
11060    /// ```
11061    pub parent: std::string::String,
11062
11063    /// Optional. The Service id to use for this Service. If omitted, an id will be
11064    /// generated instead. Must match the pattern `[a-z0-9\-]+`
11065    pub service_id: std::string::String,
11066
11067    /// Required. The `Service` to create.
11068    pub service: std::option::Option<crate::model::Service>,
11069
11070    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11071}
11072
11073impl CreateServiceRequest {
11074    pub fn new() -> Self {
11075        std::default::Default::default()
11076    }
11077
11078    /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
11079    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11080        self.parent = v.into();
11081        self
11082    }
11083
11084    /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
11085    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11086        self.service_id = v.into();
11087        self
11088    }
11089
11090    /// Sets the value of [service][crate::model::CreateServiceRequest::service].
11091    pub fn set_service<T>(mut self, v: T) -> Self
11092    where
11093        T: std::convert::Into<crate::model::Service>,
11094    {
11095        self.service = std::option::Option::Some(v.into());
11096        self
11097    }
11098
11099    /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
11100    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
11101    where
11102        T: std::convert::Into<crate::model::Service>,
11103    {
11104        self.service = v.map(|x| x.into());
11105        self
11106    }
11107}
11108
11109impl wkt::message::Message for CreateServiceRequest {
11110    fn typename() -> &'static str {
11111        "type.googleapis.com/google.monitoring.v3.CreateServiceRequest"
11112    }
11113}
11114
11115/// The `GetService` request.
11116#[derive(Clone, Default, PartialEq)]
11117#[non_exhaustive]
11118pub struct GetServiceRequest {
11119    /// Required. Resource name of the `Service`. The format is:
11120    ///
11121    /// ```norust
11122    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
11123    /// ```
11124    pub name: std::string::String,
11125
11126    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11127}
11128
11129impl GetServiceRequest {
11130    pub fn new() -> Self {
11131        std::default::Default::default()
11132    }
11133
11134    /// Sets the value of [name][crate::model::GetServiceRequest::name].
11135    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11136        self.name = v.into();
11137        self
11138    }
11139}
11140
11141impl wkt::message::Message for GetServiceRequest {
11142    fn typename() -> &'static str {
11143        "type.googleapis.com/google.monitoring.v3.GetServiceRequest"
11144    }
11145}
11146
11147/// The `ListServices` request.
11148#[derive(Clone, Default, PartialEq)]
11149#[non_exhaustive]
11150pub struct ListServicesRequest {
11151    /// Required. Resource name of the parent containing the listed services,
11152    /// either a [project](https://cloud.google.com/monitoring/api/v3#project_name)
11153    /// or a Monitoring Metrics Scope. The formats are:
11154    ///
11155    /// ```norust
11156    /// projects/[PROJECT_ID_OR_NUMBER]
11157    /// workspaces/[HOST_PROJECT_ID_OR_NUMBER]
11158    /// ```
11159    pub parent: std::string::String,
11160
11161    /// A filter specifying what `Service`s to return. The filter supports
11162    /// filtering on a particular service-identifier type or one of its attributes.
11163    ///
11164    /// To filter on a particular service-identifier type, the `identifier_case`
11165    /// refers to which option in the `identifier` field is populated. For example,
11166    /// the filter `identifier_case = "CUSTOM"` would match all services with a
11167    /// value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE",
11168    /// "MESH_ISTIO", and the other options listed at
11169    /// <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service>
11170    ///
11171    /// To filter on an attribute of a service-identifier type, apply the filter
11172    /// name by using the snake case of the service-identifier type and the
11173    /// attribute of that service-identifier type, and join the two with a period.
11174    /// For example, to filter by the `meshUid` field of the `MeshIstio`
11175    /// service-identifier type, you must filter on `mesh_istio.mesh_uid =
11176    /// "123"` to match all services with mesh UID "123". Service-identifier types
11177    /// and their attributes are described at
11178    /// <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service>
11179    pub filter: std::string::String,
11180
11181    /// A non-negative number that is the maximum number of results to return.
11182    /// When 0, use default page size.
11183    pub page_size: i32,
11184
11185    /// If this field is not empty then it must contain the `nextPageToken` value
11186    /// returned by a previous call to this method.  Using this field causes the
11187    /// method to return additional results from the previous method call.
11188    pub page_token: std::string::String,
11189
11190    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11191}
11192
11193impl ListServicesRequest {
11194    pub fn new() -> Self {
11195        std::default::Default::default()
11196    }
11197
11198    /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
11199    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11200        self.parent = v.into();
11201        self
11202    }
11203
11204    /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
11205    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11206        self.filter = v.into();
11207        self
11208    }
11209
11210    /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
11211    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11212        self.page_size = v.into();
11213        self
11214    }
11215
11216    /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
11217    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11218        self.page_token = v.into();
11219        self
11220    }
11221}
11222
11223impl wkt::message::Message for ListServicesRequest {
11224    fn typename() -> &'static str {
11225        "type.googleapis.com/google.monitoring.v3.ListServicesRequest"
11226    }
11227}
11228
11229/// The `ListServices` response.
11230#[derive(Clone, Default, PartialEq)]
11231#[non_exhaustive]
11232pub struct ListServicesResponse {
11233    /// The `Service`s matching the specified filter.
11234    pub services: std::vec::Vec<crate::model::Service>,
11235
11236    /// If there are more results than have been returned, then this field is set
11237    /// to a non-empty value.  To see the additional results,
11238    /// use that value as `page_token` in the next call to this method.
11239    pub next_page_token: std::string::String,
11240
11241    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11242}
11243
11244impl ListServicesResponse {
11245    pub fn new() -> Self {
11246        std::default::Default::default()
11247    }
11248
11249    /// Sets the value of [services][crate::model::ListServicesResponse::services].
11250    pub fn set_services<T, V>(mut self, v: T) -> Self
11251    where
11252        T: std::iter::IntoIterator<Item = V>,
11253        V: std::convert::Into<crate::model::Service>,
11254    {
11255        use std::iter::Iterator;
11256        self.services = v.into_iter().map(|i| i.into()).collect();
11257        self
11258    }
11259
11260    /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
11261    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11262        self.next_page_token = v.into();
11263        self
11264    }
11265}
11266
11267impl wkt::message::Message for ListServicesResponse {
11268    fn typename() -> &'static str {
11269        "type.googleapis.com/google.monitoring.v3.ListServicesResponse"
11270    }
11271}
11272
11273#[doc(hidden)]
11274impl gax::paginator::internal::PageableResponse for ListServicesResponse {
11275    type PageItem = crate::model::Service;
11276
11277    fn items(self) -> std::vec::Vec<Self::PageItem> {
11278        self.services
11279    }
11280
11281    fn next_page_token(&self) -> std::string::String {
11282        use std::clone::Clone;
11283        self.next_page_token.clone()
11284    }
11285}
11286
11287/// The `UpdateService` request.
11288#[derive(Clone, Default, PartialEq)]
11289#[non_exhaustive]
11290pub struct UpdateServiceRequest {
11291    /// Required. The `Service` to draw updates from.
11292    /// The given `name` specifies the resource to update.
11293    pub service: std::option::Option<crate::model::Service>,
11294
11295    /// A set of field paths defining which fields to use for the update.
11296    pub update_mask: std::option::Option<wkt::FieldMask>,
11297
11298    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11299}
11300
11301impl UpdateServiceRequest {
11302    pub fn new() -> Self {
11303        std::default::Default::default()
11304    }
11305
11306    /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
11307    pub fn set_service<T>(mut self, v: T) -> Self
11308    where
11309        T: std::convert::Into<crate::model::Service>,
11310    {
11311        self.service = std::option::Option::Some(v.into());
11312        self
11313    }
11314
11315    /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
11316    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
11317    where
11318        T: std::convert::Into<crate::model::Service>,
11319    {
11320        self.service = v.map(|x| x.into());
11321        self
11322    }
11323
11324    /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
11325    pub fn set_update_mask<T>(mut self, v: T) -> Self
11326    where
11327        T: std::convert::Into<wkt::FieldMask>,
11328    {
11329        self.update_mask = std::option::Option::Some(v.into());
11330        self
11331    }
11332
11333    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
11334    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11335    where
11336        T: std::convert::Into<wkt::FieldMask>,
11337    {
11338        self.update_mask = v.map(|x| x.into());
11339        self
11340    }
11341}
11342
11343impl wkt::message::Message for UpdateServiceRequest {
11344    fn typename() -> &'static str {
11345        "type.googleapis.com/google.monitoring.v3.UpdateServiceRequest"
11346    }
11347}
11348
11349/// The `DeleteService` request.
11350#[derive(Clone, Default, PartialEq)]
11351#[non_exhaustive]
11352pub struct DeleteServiceRequest {
11353    /// Required. Resource name of the `Service` to delete. The format is:
11354    ///
11355    /// ```norust
11356    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
11357    /// ```
11358    pub name: std::string::String,
11359
11360    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11361}
11362
11363impl DeleteServiceRequest {
11364    pub fn new() -> Self {
11365        std::default::Default::default()
11366    }
11367
11368    /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
11369    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11370        self.name = v.into();
11371        self
11372    }
11373}
11374
11375impl wkt::message::Message for DeleteServiceRequest {
11376    fn typename() -> &'static str {
11377        "type.googleapis.com/google.monitoring.v3.DeleteServiceRequest"
11378    }
11379}
11380
11381/// The `CreateServiceLevelObjective` request.
11382#[derive(Clone, Default, PartialEq)]
11383#[non_exhaustive]
11384pub struct CreateServiceLevelObjectiveRequest {
11385    /// Required. Resource name of the parent `Service`. The format is:
11386    ///
11387    /// ```norust
11388    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
11389    /// ```
11390    pub parent: std::string::String,
11391
11392    /// Optional. The ServiceLevelObjective id to use for this
11393    /// ServiceLevelObjective. If omitted, an id will be generated instead. Must
11394    /// match the pattern `^[a-zA-Z0-9-_:.]+$`
11395    pub service_level_objective_id: std::string::String,
11396
11397    /// Required. The `ServiceLevelObjective` to create.
11398    /// The provided `name` will be respected if no `ServiceLevelObjective` exists
11399    /// with this name.
11400    pub service_level_objective: std::option::Option<crate::model::ServiceLevelObjective>,
11401
11402    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11403}
11404
11405impl CreateServiceLevelObjectiveRequest {
11406    pub fn new() -> Self {
11407        std::default::Default::default()
11408    }
11409
11410    /// Sets the value of [parent][crate::model::CreateServiceLevelObjectiveRequest::parent].
11411    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11412        self.parent = v.into();
11413        self
11414    }
11415
11416    /// Sets the value of [service_level_objective_id][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective_id].
11417    pub fn set_service_level_objective_id<T: std::convert::Into<std::string::String>>(
11418        mut self,
11419        v: T,
11420    ) -> Self {
11421        self.service_level_objective_id = v.into();
11422        self
11423    }
11424
11425    /// Sets the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
11426    pub fn set_service_level_objective<T>(mut self, v: T) -> Self
11427    where
11428        T: std::convert::Into<crate::model::ServiceLevelObjective>,
11429    {
11430        self.service_level_objective = std::option::Option::Some(v.into());
11431        self
11432    }
11433
11434    /// Sets or clears the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
11435    pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
11436    where
11437        T: std::convert::Into<crate::model::ServiceLevelObjective>,
11438    {
11439        self.service_level_objective = v.map(|x| x.into());
11440        self
11441    }
11442}
11443
11444impl wkt::message::Message for CreateServiceLevelObjectiveRequest {
11445    fn typename() -> &'static str {
11446        "type.googleapis.com/google.monitoring.v3.CreateServiceLevelObjectiveRequest"
11447    }
11448}
11449
11450/// The `GetServiceLevelObjective` request.
11451#[derive(Clone, Default, PartialEq)]
11452#[non_exhaustive]
11453pub struct GetServiceLevelObjectiveRequest {
11454    /// Required. Resource name of the `ServiceLevelObjective` to get. The format
11455    /// is:
11456    ///
11457    /// ```norust
11458    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
11459    /// ```
11460    pub name: std::string::String,
11461
11462    /// View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
11463    /// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
11464    /// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
11465    /// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
11466    pub view: crate::model::service_level_objective::View,
11467
11468    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11469}
11470
11471impl GetServiceLevelObjectiveRequest {
11472    pub fn new() -> Self {
11473        std::default::Default::default()
11474    }
11475
11476    /// Sets the value of [name][crate::model::GetServiceLevelObjectiveRequest::name].
11477    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11478        self.name = v.into();
11479        self
11480    }
11481
11482    /// Sets the value of [view][crate::model::GetServiceLevelObjectiveRequest::view].
11483    pub fn set_view<T: std::convert::Into<crate::model::service_level_objective::View>>(
11484        mut self,
11485        v: T,
11486    ) -> Self {
11487        self.view = v.into();
11488        self
11489    }
11490}
11491
11492impl wkt::message::Message for GetServiceLevelObjectiveRequest {
11493    fn typename() -> &'static str {
11494        "type.googleapis.com/google.monitoring.v3.GetServiceLevelObjectiveRequest"
11495    }
11496}
11497
11498/// The `ListServiceLevelObjectives` request.
11499#[derive(Clone, Default, PartialEq)]
11500#[non_exhaustive]
11501pub struct ListServiceLevelObjectivesRequest {
11502    /// Required. Resource name of the parent containing the listed SLOs, either a
11503    /// project or a Monitoring Metrics Scope. The formats are:
11504    ///
11505    /// ```norust
11506    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
11507    /// workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
11508    /// ```
11509    pub parent: std::string::String,
11510
11511    /// A filter specifying what `ServiceLevelObjective`s to return.
11512    pub filter: std::string::String,
11513
11514    /// A non-negative number that is the maximum number of results to return.
11515    /// When 0, use default page size.
11516    pub page_size: i32,
11517
11518    /// If this field is not empty then it must contain the `nextPageToken` value
11519    /// returned by a previous call to this method.  Using this field causes the
11520    /// method to return additional results from the previous method call.
11521    pub page_token: std::string::String,
11522
11523    /// View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
11524    /// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
11525    /// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
11526    /// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
11527    pub view: crate::model::service_level_objective::View,
11528
11529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11530}
11531
11532impl ListServiceLevelObjectivesRequest {
11533    pub fn new() -> Self {
11534        std::default::Default::default()
11535    }
11536
11537    /// Sets the value of [parent][crate::model::ListServiceLevelObjectivesRequest::parent].
11538    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11539        self.parent = v.into();
11540        self
11541    }
11542
11543    /// Sets the value of [filter][crate::model::ListServiceLevelObjectivesRequest::filter].
11544    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11545        self.filter = v.into();
11546        self
11547    }
11548
11549    /// Sets the value of [page_size][crate::model::ListServiceLevelObjectivesRequest::page_size].
11550    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11551        self.page_size = v.into();
11552        self
11553    }
11554
11555    /// Sets the value of [page_token][crate::model::ListServiceLevelObjectivesRequest::page_token].
11556    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11557        self.page_token = v.into();
11558        self
11559    }
11560
11561    /// Sets the value of [view][crate::model::ListServiceLevelObjectivesRequest::view].
11562    pub fn set_view<T: std::convert::Into<crate::model::service_level_objective::View>>(
11563        mut self,
11564        v: T,
11565    ) -> Self {
11566        self.view = v.into();
11567        self
11568    }
11569}
11570
11571impl wkt::message::Message for ListServiceLevelObjectivesRequest {
11572    fn typename() -> &'static str {
11573        "type.googleapis.com/google.monitoring.v3.ListServiceLevelObjectivesRequest"
11574    }
11575}
11576
11577/// The `ListServiceLevelObjectives` response.
11578#[derive(Clone, Default, PartialEq)]
11579#[non_exhaustive]
11580pub struct ListServiceLevelObjectivesResponse {
11581    /// The `ServiceLevelObjective`s matching the specified filter.
11582    pub service_level_objectives: std::vec::Vec<crate::model::ServiceLevelObjective>,
11583
11584    /// If there are more results than have been returned, then this field is set
11585    /// to a non-empty value.  To see the additional results,
11586    /// use that value as `page_token` in the next call to this method.
11587    pub next_page_token: std::string::String,
11588
11589    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11590}
11591
11592impl ListServiceLevelObjectivesResponse {
11593    pub fn new() -> Self {
11594        std::default::Default::default()
11595    }
11596
11597    /// Sets the value of [service_level_objectives][crate::model::ListServiceLevelObjectivesResponse::service_level_objectives].
11598    pub fn set_service_level_objectives<T, V>(mut self, v: T) -> Self
11599    where
11600        T: std::iter::IntoIterator<Item = V>,
11601        V: std::convert::Into<crate::model::ServiceLevelObjective>,
11602    {
11603        use std::iter::Iterator;
11604        self.service_level_objectives = v.into_iter().map(|i| i.into()).collect();
11605        self
11606    }
11607
11608    /// Sets the value of [next_page_token][crate::model::ListServiceLevelObjectivesResponse::next_page_token].
11609    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11610        self.next_page_token = v.into();
11611        self
11612    }
11613}
11614
11615impl wkt::message::Message for ListServiceLevelObjectivesResponse {
11616    fn typename() -> &'static str {
11617        "type.googleapis.com/google.monitoring.v3.ListServiceLevelObjectivesResponse"
11618    }
11619}
11620
11621#[doc(hidden)]
11622impl gax::paginator::internal::PageableResponse for ListServiceLevelObjectivesResponse {
11623    type PageItem = crate::model::ServiceLevelObjective;
11624
11625    fn items(self) -> std::vec::Vec<Self::PageItem> {
11626        self.service_level_objectives
11627    }
11628
11629    fn next_page_token(&self) -> std::string::String {
11630        use std::clone::Clone;
11631        self.next_page_token.clone()
11632    }
11633}
11634
11635/// The `UpdateServiceLevelObjective` request.
11636#[derive(Clone, Default, PartialEq)]
11637#[non_exhaustive]
11638pub struct UpdateServiceLevelObjectiveRequest {
11639    /// Required. The `ServiceLevelObjective` to draw updates from.
11640    /// The given `name` specifies the resource to update.
11641    pub service_level_objective: std::option::Option<crate::model::ServiceLevelObjective>,
11642
11643    /// A set of field paths defining which fields to use for the update.
11644    pub update_mask: std::option::Option<wkt::FieldMask>,
11645
11646    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11647}
11648
11649impl UpdateServiceLevelObjectiveRequest {
11650    pub fn new() -> Self {
11651        std::default::Default::default()
11652    }
11653
11654    /// Sets the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
11655    pub fn set_service_level_objective<T>(mut self, v: T) -> Self
11656    where
11657        T: std::convert::Into<crate::model::ServiceLevelObjective>,
11658    {
11659        self.service_level_objective = std::option::Option::Some(v.into());
11660        self
11661    }
11662
11663    /// Sets or clears the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
11664    pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
11665    where
11666        T: std::convert::Into<crate::model::ServiceLevelObjective>,
11667    {
11668        self.service_level_objective = v.map(|x| x.into());
11669        self
11670    }
11671
11672    /// Sets the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
11673    pub fn set_update_mask<T>(mut self, v: T) -> Self
11674    where
11675        T: std::convert::Into<wkt::FieldMask>,
11676    {
11677        self.update_mask = std::option::Option::Some(v.into());
11678        self
11679    }
11680
11681    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
11682    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11683    where
11684        T: std::convert::Into<wkt::FieldMask>,
11685    {
11686        self.update_mask = v.map(|x| x.into());
11687        self
11688    }
11689}
11690
11691impl wkt::message::Message for UpdateServiceLevelObjectiveRequest {
11692    fn typename() -> &'static str {
11693        "type.googleapis.com/google.monitoring.v3.UpdateServiceLevelObjectiveRequest"
11694    }
11695}
11696
11697/// The `DeleteServiceLevelObjective` request.
11698#[derive(Clone, Default, PartialEq)]
11699#[non_exhaustive]
11700pub struct DeleteServiceLevelObjectiveRequest {
11701    /// Required. Resource name of the `ServiceLevelObjective` to delete. The
11702    /// format is:
11703    ///
11704    /// ```norust
11705    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
11706    /// ```
11707    pub name: std::string::String,
11708
11709    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11710}
11711
11712impl DeleteServiceLevelObjectiveRequest {
11713    pub fn new() -> Self {
11714        std::default::Default::default()
11715    }
11716
11717    /// Sets the value of [name][crate::model::DeleteServiceLevelObjectiveRequest::name].
11718    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11719        self.name = v.into();
11720        self
11721    }
11722}
11723
11724impl wkt::message::Message for DeleteServiceLevelObjectiveRequest {
11725    fn typename() -> &'static str {
11726        "type.googleapis.com/google.monitoring.v3.DeleteServiceLevelObjectiveRequest"
11727    }
11728}
11729
11730/// A `Snooze` will prevent any alerts from being opened, and close any that
11731/// are already open. The `Snooze` will work on alerts that match the
11732/// criteria defined in the `Snooze`. The `Snooze` will be active from
11733/// `interval.start_time` through `interval.end_time`.
11734#[derive(Clone, Default, PartialEq)]
11735#[non_exhaustive]
11736pub struct Snooze {
11737    /// Required. Identifier. The name of the `Snooze`. The format is:
11738    ///
11739    /// ```norust
11740    /// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
11741    /// ```
11742    ///
11743    /// The ID of the `Snooze` will be generated by the system.
11744    pub name: std::string::String,
11745
11746    /// Required. This defines the criteria for applying the `Snooze`. See
11747    /// `Criteria` for more information.
11748    pub criteria: std::option::Option<crate::model::snooze::Criteria>,
11749
11750    /// Required. The `Snooze` will be active from `interval.start_time` through
11751    /// `interval.end_time`.
11752    /// `interval.start_time` cannot be in the past. There is a 15 second clock
11753    /// skew to account for the time it takes for a request to reach the API from
11754    /// the UI.
11755    pub interval: std::option::Option<crate::model::TimeInterval>,
11756
11757    /// Required. A display name for the `Snooze`. This can be, at most, 512
11758    /// unicode characters.
11759    pub display_name: std::string::String,
11760
11761    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11762}
11763
11764impl Snooze {
11765    pub fn new() -> Self {
11766        std::default::Default::default()
11767    }
11768
11769    /// Sets the value of [name][crate::model::Snooze::name].
11770    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11771        self.name = v.into();
11772        self
11773    }
11774
11775    /// Sets the value of [criteria][crate::model::Snooze::criteria].
11776    pub fn set_criteria<T>(mut self, v: T) -> Self
11777    where
11778        T: std::convert::Into<crate::model::snooze::Criteria>,
11779    {
11780        self.criteria = std::option::Option::Some(v.into());
11781        self
11782    }
11783
11784    /// Sets or clears the value of [criteria][crate::model::Snooze::criteria].
11785    pub fn set_or_clear_criteria<T>(mut self, v: std::option::Option<T>) -> Self
11786    where
11787        T: std::convert::Into<crate::model::snooze::Criteria>,
11788    {
11789        self.criteria = v.map(|x| x.into());
11790        self
11791    }
11792
11793    /// Sets the value of [interval][crate::model::Snooze::interval].
11794    pub fn set_interval<T>(mut self, v: T) -> Self
11795    where
11796        T: std::convert::Into<crate::model::TimeInterval>,
11797    {
11798        self.interval = std::option::Option::Some(v.into());
11799        self
11800    }
11801
11802    /// Sets or clears the value of [interval][crate::model::Snooze::interval].
11803    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
11804    where
11805        T: std::convert::Into<crate::model::TimeInterval>,
11806    {
11807        self.interval = v.map(|x| x.into());
11808        self
11809    }
11810
11811    /// Sets the value of [display_name][crate::model::Snooze::display_name].
11812    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11813        self.display_name = v.into();
11814        self
11815    }
11816}
11817
11818impl wkt::message::Message for Snooze {
11819    fn typename() -> &'static str {
11820        "type.googleapis.com/google.monitoring.v3.Snooze"
11821    }
11822}
11823
11824/// Defines additional types related to [Snooze].
11825pub mod snooze {
11826    #[allow(unused_imports)]
11827    use super::*;
11828
11829    /// Criteria specific to the `AlertPolicy`s that this `Snooze` applies to. The
11830    /// `Snooze` will suppress alerts that come from one of the `AlertPolicy`s
11831    /// whose names are supplied.
11832    #[derive(Clone, Default, PartialEq)]
11833    #[non_exhaustive]
11834    pub struct Criteria {
11835        /// The specific `AlertPolicy` names for the alert that should be snoozed.
11836        /// The format is:
11837        ///
11838        /// ```norust
11839        /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]
11840        /// ```
11841        ///
11842        /// There is a limit of 16 policies per snooze. This limit is checked during
11843        /// snooze creation.
11844        /// Exactly 1 alert policy is required if `filter` is specified at the same
11845        /// time.
11846        pub policies: std::vec::Vec<std::string::String>,
11847
11848        /// Optional. The filter string to match on Alert fields when silencing the
11849        /// alerts. It follows the standard <https://google.aip.dev/160> syntax.
11850        /// A filter string used to apply the snooze to specific incidents
11851        /// that have matching filter values.
11852        /// Filters can be defined for snoozes that apply to one alerting
11853        /// policy.
11854        /// Filters must be a string formatted as one or more resource labels with
11855        /// specific label values. If multiple resource labels are used, then they
11856        /// must be connected with an AND operator. For example, the following filter
11857        /// applies the snooze to incidents that have an instance ID of
11858        /// `1234567890` and a zone of `us-central1-a`:
11859        ///
11860        /// ```norust
11861        /// resource.labels.instance_id="1234567890" AND
11862        /// resource.labels.zone="us-central1-a"
11863        /// ```
11864        pub filter: std::string::String,
11865
11866        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11867    }
11868
11869    impl Criteria {
11870        pub fn new() -> Self {
11871            std::default::Default::default()
11872        }
11873
11874        /// Sets the value of [policies][crate::model::snooze::Criteria::policies].
11875        pub fn set_policies<T, V>(mut self, v: T) -> Self
11876        where
11877            T: std::iter::IntoIterator<Item = V>,
11878            V: std::convert::Into<std::string::String>,
11879        {
11880            use std::iter::Iterator;
11881            self.policies = v.into_iter().map(|i| i.into()).collect();
11882            self
11883        }
11884
11885        /// Sets the value of [filter][crate::model::snooze::Criteria::filter].
11886        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11887            self.filter = v.into();
11888            self
11889        }
11890    }
11891
11892    impl wkt::message::Message for Criteria {
11893        fn typename() -> &'static str {
11894            "type.googleapis.com/google.monitoring.v3.Snooze.Criteria"
11895        }
11896    }
11897}
11898
11899/// The message definition for creating a `Snooze`. Users must provide the body
11900/// of the `Snooze` to be created but must omit the `Snooze` field, `name`.
11901#[derive(Clone, Default, PartialEq)]
11902#[non_exhaustive]
11903pub struct CreateSnoozeRequest {
11904    /// Required. The
11905    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
11906    /// a `Snooze` should be created. The format is:
11907    ///
11908    /// ```norust
11909    /// projects/[PROJECT_ID_OR_NUMBER]
11910    /// ```
11911    pub parent: std::string::String,
11912
11913    /// Required. The `Snooze` to create. Omit the `name` field, as it will be
11914    /// filled in by the API.
11915    pub snooze: std::option::Option<crate::model::Snooze>,
11916
11917    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11918}
11919
11920impl CreateSnoozeRequest {
11921    pub fn new() -> Self {
11922        std::default::Default::default()
11923    }
11924
11925    /// Sets the value of [parent][crate::model::CreateSnoozeRequest::parent].
11926    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11927        self.parent = v.into();
11928        self
11929    }
11930
11931    /// Sets the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
11932    pub fn set_snooze<T>(mut self, v: T) -> Self
11933    where
11934        T: std::convert::Into<crate::model::Snooze>,
11935    {
11936        self.snooze = std::option::Option::Some(v.into());
11937        self
11938    }
11939
11940    /// Sets or clears the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
11941    pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
11942    where
11943        T: std::convert::Into<crate::model::Snooze>,
11944    {
11945        self.snooze = v.map(|x| x.into());
11946        self
11947    }
11948}
11949
11950impl wkt::message::Message for CreateSnoozeRequest {
11951    fn typename() -> &'static str {
11952        "type.googleapis.com/google.monitoring.v3.CreateSnoozeRequest"
11953    }
11954}
11955
11956/// The message definition for listing `Snooze`s associated with the given
11957/// `parent`, satisfying the optional `filter`.
11958#[derive(Clone, Default, PartialEq)]
11959#[non_exhaustive]
11960pub struct ListSnoozesRequest {
11961    /// Required. The
11962    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
11963    /// `Snooze`s should be listed. The format is:
11964    ///
11965    /// ```norust
11966    /// projects/[PROJECT_ID_OR_NUMBER]
11967    /// ```
11968    pub parent: std::string::String,
11969
11970    /// Optional. Optional filter to restrict results to the given criteria. The
11971    /// following fields are supported.
11972    ///
11973    /// * `interval.start_time`
11974    /// * `interval.end_time`
11975    ///
11976    /// For example:
11977    ///
11978    /// ```norust
11979    /// interval.start_time > "2022-03-11T00:00:00-08:00" AND
11980    ///     interval.end_time < "2022-03-12T00:00:00-08:00"
11981    /// ```
11982    pub filter: std::string::String,
11983
11984    /// Optional. The maximum number of results to return for a single query. The
11985    /// server may further constrain the maximum number of results returned in a
11986    /// single page. The value should be in the range [1, 1000]. If the value given
11987    /// is outside this range, the server will decide the number of results to be
11988    /// returned.
11989    pub page_size: i32,
11990
11991    /// Optional. The `next_page_token` from a previous call to
11992    /// `ListSnoozesRequest` to get the next page of results.
11993    pub page_token: std::string::String,
11994
11995    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11996}
11997
11998impl ListSnoozesRequest {
11999    pub fn new() -> Self {
12000        std::default::Default::default()
12001    }
12002
12003    /// Sets the value of [parent][crate::model::ListSnoozesRequest::parent].
12004    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12005        self.parent = v.into();
12006        self
12007    }
12008
12009    /// Sets the value of [filter][crate::model::ListSnoozesRequest::filter].
12010    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12011        self.filter = v.into();
12012        self
12013    }
12014
12015    /// Sets the value of [page_size][crate::model::ListSnoozesRequest::page_size].
12016    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12017        self.page_size = v.into();
12018        self
12019    }
12020
12021    /// Sets the value of [page_token][crate::model::ListSnoozesRequest::page_token].
12022    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12023        self.page_token = v.into();
12024        self
12025    }
12026}
12027
12028impl wkt::message::Message for ListSnoozesRequest {
12029    fn typename() -> &'static str {
12030        "type.googleapis.com/google.monitoring.v3.ListSnoozesRequest"
12031    }
12032}
12033
12034/// The results of a successful `ListSnoozes` call, containing the matching
12035/// `Snooze`s.
12036#[derive(Clone, Default, PartialEq)]
12037#[non_exhaustive]
12038pub struct ListSnoozesResponse {
12039    /// `Snooze`s matching this list call.
12040    pub snoozes: std::vec::Vec<crate::model::Snooze>,
12041
12042    /// Page token for repeated calls to `ListSnoozes`, to fetch additional pages
12043    /// of results. If this is empty or missing, there are no more pages.
12044    pub next_page_token: std::string::String,
12045
12046    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12047}
12048
12049impl ListSnoozesResponse {
12050    pub fn new() -> Self {
12051        std::default::Default::default()
12052    }
12053
12054    /// Sets the value of [snoozes][crate::model::ListSnoozesResponse::snoozes].
12055    pub fn set_snoozes<T, V>(mut self, v: T) -> Self
12056    where
12057        T: std::iter::IntoIterator<Item = V>,
12058        V: std::convert::Into<crate::model::Snooze>,
12059    {
12060        use std::iter::Iterator;
12061        self.snoozes = v.into_iter().map(|i| i.into()).collect();
12062        self
12063    }
12064
12065    /// Sets the value of [next_page_token][crate::model::ListSnoozesResponse::next_page_token].
12066    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12067        self.next_page_token = v.into();
12068        self
12069    }
12070}
12071
12072impl wkt::message::Message for ListSnoozesResponse {
12073    fn typename() -> &'static str {
12074        "type.googleapis.com/google.monitoring.v3.ListSnoozesResponse"
12075    }
12076}
12077
12078#[doc(hidden)]
12079impl gax::paginator::internal::PageableResponse for ListSnoozesResponse {
12080    type PageItem = crate::model::Snooze;
12081
12082    fn items(self) -> std::vec::Vec<Self::PageItem> {
12083        self.snoozes
12084    }
12085
12086    fn next_page_token(&self) -> std::string::String {
12087        use std::clone::Clone;
12088        self.next_page_token.clone()
12089    }
12090}
12091
12092/// The message definition for retrieving a `Snooze`. Users must specify the
12093/// field, `name`, which identifies the `Snooze`.
12094#[derive(Clone, Default, PartialEq)]
12095#[non_exhaustive]
12096pub struct GetSnoozeRequest {
12097    /// Required. The ID of the `Snooze` to retrieve. The format is:
12098    ///
12099    /// ```norust
12100    /// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
12101    /// ```
12102    pub name: std::string::String,
12103
12104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12105}
12106
12107impl GetSnoozeRequest {
12108    pub fn new() -> Self {
12109        std::default::Default::default()
12110    }
12111
12112    /// Sets the value of [name][crate::model::GetSnoozeRequest::name].
12113    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12114        self.name = v.into();
12115        self
12116    }
12117}
12118
12119impl wkt::message::Message for GetSnoozeRequest {
12120    fn typename() -> &'static str {
12121        "type.googleapis.com/google.monitoring.v3.GetSnoozeRequest"
12122    }
12123}
12124
12125/// The message definition for updating a `Snooze`. The field, `snooze.name`
12126/// identifies the `Snooze` to be updated. The remainder of `snooze` gives the
12127/// content the `Snooze` in question will be assigned.
12128///
12129/// What fields can be updated depends on the start time and end time of the
12130/// `Snooze`.
12131///
12132/// * end time is in the past: These `Snooze`s are considered
12133///   read-only and cannot be updated.
12134/// * start time is in the past and end time is in the future: `display_name`
12135///   and `interval.end_time` can be updated.
12136/// * start time is in the future: `display_name`, `interval.start_time` and
12137///   `interval.end_time` can be updated.
12138#[derive(Clone, Default, PartialEq)]
12139#[non_exhaustive]
12140pub struct UpdateSnoozeRequest {
12141    /// Required. The `Snooze` to update. Must have the name field present.
12142    pub snooze: std::option::Option<crate::model::Snooze>,
12143
12144    /// Required. The fields to update.
12145    ///
12146    /// For each field listed in `update_mask`:
12147    ///
12148    /// * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a
12149    ///   value for that field, the value of the field in the existing `Snooze`
12150    ///   will be set to the value of the field in the supplied `Snooze`.
12151    /// * If the field does not have a value in the supplied `Snooze`, the field
12152    ///   in the existing `Snooze` is set to its default value.
12153    ///
12154    /// Fields not listed retain their existing value.
12155    ///
12156    /// The following are the field names that are accepted in `update_mask`:
12157    ///
12158    /// * `display_name`
12159    /// * `interval.start_time`
12160    /// * `interval.end_time`
12161    ///
12162    /// That said, the start time and end time of the `Snooze` determines which
12163    /// fields can legally be updated. Before attempting an update, users should
12164    /// consult the documentation for `UpdateSnoozeRequest`, which talks about
12165    /// which fields can be updated.
12166    pub update_mask: std::option::Option<wkt::FieldMask>,
12167
12168    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12169}
12170
12171impl UpdateSnoozeRequest {
12172    pub fn new() -> Self {
12173        std::default::Default::default()
12174    }
12175
12176    /// Sets the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
12177    pub fn set_snooze<T>(mut self, v: T) -> Self
12178    where
12179        T: std::convert::Into<crate::model::Snooze>,
12180    {
12181        self.snooze = std::option::Option::Some(v.into());
12182        self
12183    }
12184
12185    /// Sets or clears the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
12186    pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
12187    where
12188        T: std::convert::Into<crate::model::Snooze>,
12189    {
12190        self.snooze = v.map(|x| x.into());
12191        self
12192    }
12193
12194    /// Sets the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
12195    pub fn set_update_mask<T>(mut self, v: T) -> Self
12196    where
12197        T: std::convert::Into<wkt::FieldMask>,
12198    {
12199        self.update_mask = std::option::Option::Some(v.into());
12200        self
12201    }
12202
12203    /// Sets or clears the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
12204    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12205    where
12206        T: std::convert::Into<wkt::FieldMask>,
12207    {
12208        self.update_mask = v.map(|x| x.into());
12209        self
12210    }
12211}
12212
12213impl wkt::message::Message for UpdateSnoozeRequest {
12214    fn typename() -> &'static str {
12215        "type.googleapis.com/google.monitoring.v3.UpdateSnoozeRequest"
12216    }
12217}
12218
12219/// The context of a span. This is attached to an
12220/// [Exemplar][google.api.Distribution.Exemplar]
12221/// in [Distribution][google.api.Distribution] values during aggregation.
12222///
12223/// It contains the name of a span with format:
12224///
12225/// ```norust
12226/// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
12227/// ```
12228///
12229/// [google.api.Distribution]: api::model::Distribution
12230/// [google.api.Distribution.Exemplar]: api::model::distribution::Exemplar
12231#[derive(Clone, Default, PartialEq)]
12232#[non_exhaustive]
12233pub struct SpanContext {
12234    /// The resource name of the span. The format is:
12235    ///
12236    /// ```norust
12237    /// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
12238    /// ```
12239    ///
12240    /// `[TRACE_ID]` is a unique identifier for a trace within a project;
12241    /// it is a 32-character hexadecimal encoding of a 16-byte array.
12242    ///
12243    /// `[SPAN_ID]` is a unique identifier for a span within a trace; it
12244    /// is a 16-character hexadecimal encoding of an 8-byte array.
12245    pub span_name: std::string::String,
12246
12247    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12248}
12249
12250impl SpanContext {
12251    pub fn new() -> Self {
12252        std::default::Default::default()
12253    }
12254
12255    /// Sets the value of [span_name][crate::model::SpanContext::span_name].
12256    pub fn set_span_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12257        self.span_name = v.into();
12258        self
12259    }
12260}
12261
12262impl wkt::message::Message for SpanContext {
12263    fn typename() -> &'static str {
12264        "type.googleapis.com/google.monitoring.v3.SpanContext"
12265    }
12266}
12267
12268/// An internal checker allows Uptime checks to run on private/internal GCP
12269/// resources.
12270#[derive(Clone, Default, PartialEq)]
12271#[non_exhaustive]
12272#[deprecated]
12273pub struct InternalChecker {
12274    /// A unique resource name for this InternalChecker. The format is:
12275    ///
12276    /// ```norust
12277    /// projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
12278    /// ```
12279    ///
12280    /// `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for
12281    /// the Uptime check config associated with the internal checker.
12282    pub name: std::string::String,
12283
12284    /// The checker's human-readable name. The display name
12285    /// should be unique within a Cloud Monitoring Metrics Scope in order to make
12286    /// it easier to identify; however, uniqueness is not enforced.
12287    pub display_name: std::string::String,
12288
12289    /// The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
12290    /// internal resource lives (ex: "default").
12291    pub network: std::string::String,
12292
12293    /// The GCP zone the Uptime check should egress from. Only respected for
12294    /// internal Uptime checks, where internal_network is specified.
12295    pub gcp_zone: std::string::String,
12296
12297    /// The GCP project ID where the internal checker lives. Not necessary
12298    /// the same as the Metrics Scope project.
12299    pub peer_project_id: std::string::String,
12300
12301    /// The current operational state of the internal checker.
12302    pub state: crate::model::internal_checker::State,
12303
12304    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12305}
12306
12307impl InternalChecker {
12308    pub fn new() -> Self {
12309        std::default::Default::default()
12310    }
12311
12312    /// Sets the value of [name][crate::model::InternalChecker::name].
12313    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12314        self.name = v.into();
12315        self
12316    }
12317
12318    /// Sets the value of [display_name][crate::model::InternalChecker::display_name].
12319    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12320        self.display_name = v.into();
12321        self
12322    }
12323
12324    /// Sets the value of [network][crate::model::InternalChecker::network].
12325    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12326        self.network = v.into();
12327        self
12328    }
12329
12330    /// Sets the value of [gcp_zone][crate::model::InternalChecker::gcp_zone].
12331    pub fn set_gcp_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12332        self.gcp_zone = v.into();
12333        self
12334    }
12335
12336    /// Sets the value of [peer_project_id][crate::model::InternalChecker::peer_project_id].
12337    pub fn set_peer_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12338        self.peer_project_id = v.into();
12339        self
12340    }
12341
12342    /// Sets the value of [state][crate::model::InternalChecker::state].
12343    pub fn set_state<T: std::convert::Into<crate::model::internal_checker::State>>(
12344        mut self,
12345        v: T,
12346    ) -> Self {
12347        self.state = v.into();
12348        self
12349    }
12350}
12351
12352impl wkt::message::Message for InternalChecker {
12353    fn typename() -> &'static str {
12354        "type.googleapis.com/google.monitoring.v3.InternalChecker"
12355    }
12356}
12357
12358/// Defines additional types related to [InternalChecker].
12359pub mod internal_checker {
12360    #[allow(unused_imports)]
12361    use super::*;
12362
12363    /// Operational states for an internal checker.
12364    ///
12365    /// # Working with unknown values
12366    ///
12367    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12368    /// additional enum variants at any time. Adding new variants is not considered
12369    /// a breaking change. Applications should write their code in anticipation of:
12370    ///
12371    /// - New values appearing in future releases of the client library, **and**
12372    /// - New values received dynamically, without application changes.
12373    ///
12374    /// Please consult the [Working with enums] section in the user guide for some
12375    /// guidelines.
12376    ///
12377    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12378    #[derive(Clone, Debug, PartialEq)]
12379    #[non_exhaustive]
12380    pub enum State {
12381        /// An internal checker should never be in the unspecified state.
12382        Unspecified,
12383        /// The checker is being created, provisioned, and configured. A checker in
12384        /// this state can be returned by `ListInternalCheckers` or
12385        /// `GetInternalChecker`, as well as by examining the [long running
12386        /// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
12387        /// that created it.
12388        Creating,
12389        /// The checker is running and available for use. A checker in this state
12390        /// can be returned by `ListInternalCheckers` or `GetInternalChecker` as
12391        /// well as by examining the [long running
12392        /// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
12393        /// that created it.
12394        /// If a checker is being torn down, it is neither visible nor usable, so
12395        /// there is no "deleting" or "down" state.
12396        Running,
12397        /// If set, the enum was initialized with an unknown value.
12398        ///
12399        /// Applications can examine the value using [State::value] or
12400        /// [State::name].
12401        UnknownValue(state::UnknownValue),
12402    }
12403
12404    #[doc(hidden)]
12405    pub mod state {
12406        #[allow(unused_imports)]
12407        use super::*;
12408        #[derive(Clone, Debug, PartialEq)]
12409        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12410    }
12411
12412    impl State {
12413        /// Gets the enum value.
12414        ///
12415        /// Returns `None` if the enum contains an unknown value deserialized from
12416        /// the string representation of enums.
12417        pub fn value(&self) -> std::option::Option<i32> {
12418            match self {
12419                Self::Unspecified => std::option::Option::Some(0),
12420                Self::Creating => std::option::Option::Some(1),
12421                Self::Running => std::option::Option::Some(2),
12422                Self::UnknownValue(u) => u.0.value(),
12423            }
12424        }
12425
12426        /// Gets the enum value as a string.
12427        ///
12428        /// Returns `None` if the enum contains an unknown value deserialized from
12429        /// the integer representation of enums.
12430        pub fn name(&self) -> std::option::Option<&str> {
12431            match self {
12432                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
12433                Self::Creating => std::option::Option::Some("CREATING"),
12434                Self::Running => std::option::Option::Some("RUNNING"),
12435                Self::UnknownValue(u) => u.0.name(),
12436            }
12437        }
12438    }
12439
12440    impl std::default::Default for State {
12441        fn default() -> Self {
12442            use std::convert::From;
12443            Self::from(0)
12444        }
12445    }
12446
12447    impl std::fmt::Display for State {
12448        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12449            wkt::internal::display_enum(f, self.name(), self.value())
12450        }
12451    }
12452
12453    impl std::convert::From<i32> for State {
12454        fn from(value: i32) -> Self {
12455            match value {
12456                0 => Self::Unspecified,
12457                1 => Self::Creating,
12458                2 => Self::Running,
12459                _ => Self::UnknownValue(state::UnknownValue(
12460                    wkt::internal::UnknownEnumValue::Integer(value),
12461                )),
12462            }
12463        }
12464    }
12465
12466    impl std::convert::From<&str> for State {
12467        fn from(value: &str) -> Self {
12468            use std::string::ToString;
12469            match value {
12470                "UNSPECIFIED" => Self::Unspecified,
12471                "CREATING" => Self::Creating,
12472                "RUNNING" => Self::Running,
12473                _ => Self::UnknownValue(state::UnknownValue(
12474                    wkt::internal::UnknownEnumValue::String(value.to_string()),
12475                )),
12476            }
12477        }
12478    }
12479
12480    impl serde::ser::Serialize for State {
12481        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12482        where
12483            S: serde::Serializer,
12484        {
12485            match self {
12486                Self::Unspecified => serializer.serialize_i32(0),
12487                Self::Creating => serializer.serialize_i32(1),
12488                Self::Running => serializer.serialize_i32(2),
12489                Self::UnknownValue(u) => u.0.serialize(serializer),
12490            }
12491        }
12492    }
12493
12494    impl<'de> serde::de::Deserialize<'de> for State {
12495        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12496        where
12497            D: serde::Deserializer<'de>,
12498        {
12499            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12500                ".google.monitoring.v3.InternalChecker.State",
12501            ))
12502        }
12503    }
12504}
12505
12506/// Describes a Synthetic Monitor to be invoked by Uptime.
12507#[derive(Clone, Default, PartialEq)]
12508#[non_exhaustive]
12509pub struct SyntheticMonitorTarget {
12510    /// Specifies a Synthetic Monitor's execution stack.
12511    pub target: std::option::Option<crate::model::synthetic_monitor_target::Target>,
12512
12513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12514}
12515
12516impl SyntheticMonitorTarget {
12517    pub fn new() -> Self {
12518        std::default::Default::default()
12519    }
12520
12521    /// Sets the value of [target][crate::model::SyntheticMonitorTarget::target].
12522    ///
12523    /// Note that all the setters affecting `target` are mutually
12524    /// exclusive.
12525    pub fn set_target<
12526        T: std::convert::Into<std::option::Option<crate::model::synthetic_monitor_target::Target>>,
12527    >(
12528        mut self,
12529        v: T,
12530    ) -> Self {
12531        self.target = v.into();
12532        self
12533    }
12534
12535    /// The value of [target][crate::model::SyntheticMonitorTarget::target]
12536    /// if it holds a `CloudFunctionV2`, `None` if the field is not set or
12537    /// holds a different branch.
12538    pub fn cloud_function_v2(
12539        &self,
12540    ) -> std::option::Option<
12541        &std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
12542    > {
12543        #[allow(unreachable_patterns)]
12544        self.target.as_ref().and_then(|v| match v {
12545            crate::model::synthetic_monitor_target::Target::CloudFunctionV2(v) => {
12546                std::option::Option::Some(v)
12547            }
12548            _ => std::option::Option::None,
12549        })
12550    }
12551
12552    /// Sets the value of [target][crate::model::SyntheticMonitorTarget::target]
12553    /// to hold a `CloudFunctionV2`.
12554    ///
12555    /// Note that all the setters affecting `target` are
12556    /// mutually exclusive.
12557    pub fn set_cloud_function_v2<
12558        T: std::convert::Into<
12559                std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
12560            >,
12561    >(
12562        mut self,
12563        v: T,
12564    ) -> Self {
12565        self.target = std::option::Option::Some(
12566            crate::model::synthetic_monitor_target::Target::CloudFunctionV2(v.into()),
12567        );
12568        self
12569    }
12570}
12571
12572impl wkt::message::Message for SyntheticMonitorTarget {
12573    fn typename() -> &'static str {
12574        "type.googleapis.com/google.monitoring.v3.SyntheticMonitorTarget"
12575    }
12576}
12577
12578/// Defines additional types related to [SyntheticMonitorTarget].
12579pub mod synthetic_monitor_target {
12580    #[allow(unused_imports)]
12581    use super::*;
12582
12583    /// A Synthetic Monitor deployed to a Cloud Functions V2 instance.
12584    #[derive(Clone, Default, PartialEq)]
12585    #[non_exhaustive]
12586    pub struct CloudFunctionV2Target {
12587        /// Required. Fully qualified GCFv2 resource name
12588        /// i.e. `projects/{project}/locations/{location}/functions/{function}`
12589        /// Required.
12590        pub name: std::string::String,
12591
12592        /// Output only. The `cloud_run_revision` Monitored Resource associated with
12593        /// the GCFv2. The Synthetic Monitor execution results (metrics, logs, and
12594        /// spans) are reported against this Monitored Resource. This field is output
12595        /// only.
12596        pub cloud_run_revision: std::option::Option<api::model::MonitoredResource>,
12597
12598        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12599    }
12600
12601    impl CloudFunctionV2Target {
12602        pub fn new() -> Self {
12603            std::default::Default::default()
12604        }
12605
12606        /// Sets the value of [name][crate::model::synthetic_monitor_target::CloudFunctionV2Target::name].
12607        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12608            self.name = v.into();
12609            self
12610        }
12611
12612        /// Sets the value of [cloud_run_revision][crate::model::synthetic_monitor_target::CloudFunctionV2Target::cloud_run_revision].
12613        pub fn set_cloud_run_revision<T>(mut self, v: T) -> Self
12614        where
12615            T: std::convert::Into<api::model::MonitoredResource>,
12616        {
12617            self.cloud_run_revision = std::option::Option::Some(v.into());
12618            self
12619        }
12620
12621        /// Sets or clears the value of [cloud_run_revision][crate::model::synthetic_monitor_target::CloudFunctionV2Target::cloud_run_revision].
12622        pub fn set_or_clear_cloud_run_revision<T>(mut self, v: std::option::Option<T>) -> Self
12623        where
12624            T: std::convert::Into<api::model::MonitoredResource>,
12625        {
12626            self.cloud_run_revision = v.map(|x| x.into());
12627            self
12628        }
12629    }
12630
12631    impl wkt::message::Message for CloudFunctionV2Target {
12632        fn typename() -> &'static str {
12633            "type.googleapis.com/google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target"
12634        }
12635    }
12636
12637    /// Specifies a Synthetic Monitor's execution stack.
12638    #[derive(Clone, Debug, PartialEq)]
12639    #[non_exhaustive]
12640    pub enum Target {
12641        /// Target a Synthetic Monitor GCFv2 instance.
12642        CloudFunctionV2(
12643            std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
12644        ),
12645    }
12646}
12647
12648/// This message configures which resources and services to monitor for
12649/// availability.
12650#[derive(Clone, Default, PartialEq)]
12651#[non_exhaustive]
12652pub struct UptimeCheckConfig {
12653    /// Identifier. A unique resource name for this Uptime check configuration. The
12654    /// format is:
12655    ///
12656    /// ```norust
12657    ///  projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
12658    /// ```
12659    ///
12660    /// `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the
12661    /// Uptime check.
12662    ///
12663    /// This field should be omitted when creating the Uptime check configuration;
12664    /// on create, the resource name is assigned by the server and included in the
12665    /// response.
12666    pub name: std::string::String,
12667
12668    /// A human-friendly name for the Uptime check configuration. The display name
12669    /// should be unique within a Cloud Monitoring Workspace in order to make it
12670    /// easier to identify; however, uniqueness is not enforced. Required.
12671    pub display_name: std::string::String,
12672
12673    /// How often, in seconds, the Uptime check is performed.
12674    /// Currently, the only supported values are `60s` (1 minute), `300s`
12675    /// (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
12676    /// defaults to `60s`.
12677    pub period: std::option::Option<wkt::Duration>,
12678
12679    /// The maximum amount of time to wait for the request to complete (must be
12680    /// between 1 and 60 seconds). Required.
12681    pub timeout: std::option::Option<wkt::Duration>,
12682
12683    /// The content that is expected to appear in the data returned by the target
12684    /// server against which the check is run.  Currently, only the first entry
12685    /// in the `content_matchers` list is supported, and additional entries will
12686    /// be ignored. This field is optional and should only be specified if a
12687    /// content match is required as part of the/ Uptime check.
12688    pub content_matchers: std::vec::Vec<crate::model::uptime_check_config::ContentMatcher>,
12689
12690    /// The type of checkers to use to execute the Uptime check.
12691    pub checker_type: crate::model::uptime_check_config::CheckerType,
12692
12693    /// The list of regions from which the check will be run.
12694    /// Some regions contain one location, and others contain more than one.
12695    /// If this field is specified, enough regions must be provided to include a
12696    /// minimum of 3 locations.  Not specifying this field will result in Uptime
12697    /// checks running from all available regions.
12698    pub selected_regions: std::vec::Vec<crate::model::UptimeCheckRegion>,
12699
12700    /// If this is `true`, then checks are made only from the 'internal_checkers'.
12701    /// If it is `false`, then checks are made only from the 'selected_regions'.
12702    /// It is an error to provide 'selected_regions' when is_internal is `true`,
12703    /// or to provide 'internal_checkers' when is_internal is `false`.
12704    #[deprecated]
12705    pub is_internal: bool,
12706
12707    /// The internal checkers that this check will egress from. If `is_internal` is
12708    /// `true` and this list is empty, the check will egress from all the
12709    /// InternalCheckers configured for the project that owns this
12710    /// `UptimeCheckConfig`.
12711    #[deprecated]
12712    pub internal_checkers: std::vec::Vec<crate::model::InternalChecker>,
12713
12714    /// User-supplied key/value data to be used for organizing and
12715    /// identifying the `UptimeCheckConfig` objects.
12716    ///
12717    /// The field can contain up to 64 entries. Each key and value is limited to
12718    /// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
12719    /// values can contain only lowercase letters, numerals, underscores, and
12720    /// dashes. Keys must begin with a letter.
12721    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
12722
12723    /// The resource the check is checking. Required.
12724    pub resource: std::option::Option<crate::model::uptime_check_config::Resource>,
12725
12726    /// The type of Uptime check request.
12727    pub check_request_type:
12728        std::option::Option<crate::model::uptime_check_config::CheckRequestType>,
12729
12730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12731}
12732
12733impl UptimeCheckConfig {
12734    pub fn new() -> Self {
12735        std::default::Default::default()
12736    }
12737
12738    /// Sets the value of [name][crate::model::UptimeCheckConfig::name].
12739    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12740        self.name = v.into();
12741        self
12742    }
12743
12744    /// Sets the value of [display_name][crate::model::UptimeCheckConfig::display_name].
12745    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12746        self.display_name = v.into();
12747        self
12748    }
12749
12750    /// Sets the value of [period][crate::model::UptimeCheckConfig::period].
12751    pub fn set_period<T>(mut self, v: T) -> Self
12752    where
12753        T: std::convert::Into<wkt::Duration>,
12754    {
12755        self.period = std::option::Option::Some(v.into());
12756        self
12757    }
12758
12759    /// Sets or clears the value of [period][crate::model::UptimeCheckConfig::period].
12760    pub fn set_or_clear_period<T>(mut self, v: std::option::Option<T>) -> Self
12761    where
12762        T: std::convert::Into<wkt::Duration>,
12763    {
12764        self.period = v.map(|x| x.into());
12765        self
12766    }
12767
12768    /// Sets the value of [timeout][crate::model::UptimeCheckConfig::timeout].
12769    pub fn set_timeout<T>(mut self, v: T) -> Self
12770    where
12771        T: std::convert::Into<wkt::Duration>,
12772    {
12773        self.timeout = std::option::Option::Some(v.into());
12774        self
12775    }
12776
12777    /// Sets or clears the value of [timeout][crate::model::UptimeCheckConfig::timeout].
12778    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
12779    where
12780        T: std::convert::Into<wkt::Duration>,
12781    {
12782        self.timeout = v.map(|x| x.into());
12783        self
12784    }
12785
12786    /// Sets the value of [content_matchers][crate::model::UptimeCheckConfig::content_matchers].
12787    pub fn set_content_matchers<T, V>(mut self, v: T) -> Self
12788    where
12789        T: std::iter::IntoIterator<Item = V>,
12790        V: std::convert::Into<crate::model::uptime_check_config::ContentMatcher>,
12791    {
12792        use std::iter::Iterator;
12793        self.content_matchers = v.into_iter().map(|i| i.into()).collect();
12794        self
12795    }
12796
12797    /// Sets the value of [checker_type][crate::model::UptimeCheckConfig::checker_type].
12798    pub fn set_checker_type<
12799        T: std::convert::Into<crate::model::uptime_check_config::CheckerType>,
12800    >(
12801        mut self,
12802        v: T,
12803    ) -> Self {
12804        self.checker_type = v.into();
12805        self
12806    }
12807
12808    /// Sets the value of [selected_regions][crate::model::UptimeCheckConfig::selected_regions].
12809    pub fn set_selected_regions<T, V>(mut self, v: T) -> Self
12810    where
12811        T: std::iter::IntoIterator<Item = V>,
12812        V: std::convert::Into<crate::model::UptimeCheckRegion>,
12813    {
12814        use std::iter::Iterator;
12815        self.selected_regions = v.into_iter().map(|i| i.into()).collect();
12816        self
12817    }
12818
12819    /// Sets the value of [is_internal][crate::model::UptimeCheckConfig::is_internal].
12820    #[deprecated]
12821    pub fn set_is_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12822        self.is_internal = v.into();
12823        self
12824    }
12825
12826    /// Sets the value of [internal_checkers][crate::model::UptimeCheckConfig::internal_checkers].
12827    #[deprecated]
12828    pub fn set_internal_checkers<T, V>(mut self, v: T) -> Self
12829    where
12830        T: std::iter::IntoIterator<Item = V>,
12831        V: std::convert::Into<crate::model::InternalChecker>,
12832    {
12833        use std::iter::Iterator;
12834        self.internal_checkers = v.into_iter().map(|i| i.into()).collect();
12835        self
12836    }
12837
12838    /// Sets the value of [user_labels][crate::model::UptimeCheckConfig::user_labels].
12839    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12840    where
12841        T: std::iter::IntoIterator<Item = (K, V)>,
12842        K: std::convert::Into<std::string::String>,
12843        V: std::convert::Into<std::string::String>,
12844    {
12845        use std::iter::Iterator;
12846        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12847        self
12848    }
12849
12850    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource].
12851    ///
12852    /// Note that all the setters affecting `resource` are mutually
12853    /// exclusive.
12854    pub fn set_resource<
12855        T: std::convert::Into<std::option::Option<crate::model::uptime_check_config::Resource>>,
12856    >(
12857        mut self,
12858        v: T,
12859    ) -> Self {
12860        self.resource = v.into();
12861        self
12862    }
12863
12864    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
12865    /// if it holds a `MonitoredResource`, `None` if the field is not set or
12866    /// holds a different branch.
12867    pub fn monitored_resource(
12868        &self,
12869    ) -> std::option::Option<&std::boxed::Box<api::model::MonitoredResource>> {
12870        #[allow(unreachable_patterns)]
12871        self.resource.as_ref().and_then(|v| match v {
12872            crate::model::uptime_check_config::Resource::MonitoredResource(v) => {
12873                std::option::Option::Some(v)
12874            }
12875            _ => std::option::Option::None,
12876        })
12877    }
12878
12879    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
12880    /// to hold a `MonitoredResource`.
12881    ///
12882    /// Note that all the setters affecting `resource` are
12883    /// mutually exclusive.
12884    pub fn set_monitored_resource<
12885        T: std::convert::Into<std::boxed::Box<api::model::MonitoredResource>>,
12886    >(
12887        mut self,
12888        v: T,
12889    ) -> Self {
12890        self.resource = std::option::Option::Some(
12891            crate::model::uptime_check_config::Resource::MonitoredResource(v.into()),
12892        );
12893        self
12894    }
12895
12896    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
12897    /// if it holds a `ResourceGroup`, `None` if the field is not set or
12898    /// holds a different branch.
12899    pub fn resource_group(
12900        &self,
12901    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>>
12902    {
12903        #[allow(unreachable_patterns)]
12904        self.resource.as_ref().and_then(|v| match v {
12905            crate::model::uptime_check_config::Resource::ResourceGroup(v) => {
12906                std::option::Option::Some(v)
12907            }
12908            _ => std::option::Option::None,
12909        })
12910    }
12911
12912    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
12913    /// to hold a `ResourceGroup`.
12914    ///
12915    /// Note that all the setters affecting `resource` are
12916    /// mutually exclusive.
12917    pub fn set_resource_group<
12918        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>>,
12919    >(
12920        mut self,
12921        v: T,
12922    ) -> Self {
12923        self.resource = std::option::Option::Some(
12924            crate::model::uptime_check_config::Resource::ResourceGroup(v.into()),
12925        );
12926        self
12927    }
12928
12929    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
12930    /// if it holds a `SyntheticMonitor`, `None` if the field is not set or
12931    /// holds a different branch.
12932    pub fn synthetic_monitor(
12933        &self,
12934    ) -> std::option::Option<&std::boxed::Box<crate::model::SyntheticMonitorTarget>> {
12935        #[allow(unreachable_patterns)]
12936        self.resource.as_ref().and_then(|v| match v {
12937            crate::model::uptime_check_config::Resource::SyntheticMonitor(v) => {
12938                std::option::Option::Some(v)
12939            }
12940            _ => std::option::Option::None,
12941        })
12942    }
12943
12944    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
12945    /// to hold a `SyntheticMonitor`.
12946    ///
12947    /// Note that all the setters affecting `resource` are
12948    /// mutually exclusive.
12949    pub fn set_synthetic_monitor<
12950        T: std::convert::Into<std::boxed::Box<crate::model::SyntheticMonitorTarget>>,
12951    >(
12952        mut self,
12953        v: T,
12954    ) -> Self {
12955        self.resource = std::option::Option::Some(
12956            crate::model::uptime_check_config::Resource::SyntheticMonitor(v.into()),
12957        );
12958        self
12959    }
12960
12961    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type].
12962    ///
12963    /// Note that all the setters affecting `check_request_type` are mutually
12964    /// exclusive.
12965    pub fn set_check_request_type<
12966        T: std::convert::Into<
12967                std::option::Option<crate::model::uptime_check_config::CheckRequestType>,
12968            >,
12969    >(
12970        mut self,
12971        v: T,
12972    ) -> Self {
12973        self.check_request_type = v.into();
12974        self
12975    }
12976
12977    /// The value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
12978    /// if it holds a `HttpCheck`, `None` if the field is not set or
12979    /// holds a different branch.
12980    pub fn http_check(
12981        &self,
12982    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::HttpCheck>> {
12983        #[allow(unreachable_patterns)]
12984        self.check_request_type.as_ref().and_then(|v| match v {
12985            crate::model::uptime_check_config::CheckRequestType::HttpCheck(v) => {
12986                std::option::Option::Some(v)
12987            }
12988            _ => std::option::Option::None,
12989        })
12990    }
12991
12992    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
12993    /// to hold a `HttpCheck`.
12994    ///
12995    /// Note that all the setters affecting `check_request_type` are
12996    /// mutually exclusive.
12997    pub fn set_http_check<
12998        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::HttpCheck>>,
12999    >(
13000        mut self,
13001        v: T,
13002    ) -> Self {
13003        self.check_request_type = std::option::Option::Some(
13004            crate::model::uptime_check_config::CheckRequestType::HttpCheck(v.into()),
13005        );
13006        self
13007    }
13008
13009    /// The value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
13010    /// if it holds a `TcpCheck`, `None` if the field is not set or
13011    /// holds a different branch.
13012    pub fn tcp_check(
13013        &self,
13014    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::TcpCheck>> {
13015        #[allow(unreachable_patterns)]
13016        self.check_request_type.as_ref().and_then(|v| match v {
13017            crate::model::uptime_check_config::CheckRequestType::TcpCheck(v) => {
13018                std::option::Option::Some(v)
13019            }
13020            _ => std::option::Option::None,
13021        })
13022    }
13023
13024    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
13025    /// to hold a `TcpCheck`.
13026    ///
13027    /// Note that all the setters affecting `check_request_type` are
13028    /// mutually exclusive.
13029    pub fn set_tcp_check<
13030        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::TcpCheck>>,
13031    >(
13032        mut self,
13033        v: T,
13034    ) -> Self {
13035        self.check_request_type = std::option::Option::Some(
13036            crate::model::uptime_check_config::CheckRequestType::TcpCheck(v.into()),
13037        );
13038        self
13039    }
13040}
13041
13042impl wkt::message::Message for UptimeCheckConfig {
13043    fn typename() -> &'static str {
13044        "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig"
13045    }
13046}
13047
13048/// Defines additional types related to [UptimeCheckConfig].
13049pub mod uptime_check_config {
13050    #[allow(unused_imports)]
13051    use super::*;
13052
13053    /// The resource submessage for group checks. It can be used instead of a
13054    /// monitored resource, when multiple resources are being monitored.
13055    #[derive(Clone, Default, PartialEq)]
13056    #[non_exhaustive]
13057    pub struct ResourceGroup {
13058        /// The group of resources being monitored. Should be only the `[GROUP_ID]`,
13059        /// and not the full-path
13060        /// `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`.
13061        pub group_id: std::string::String,
13062
13063        /// The resource type of the group members.
13064        pub resource_type: crate::model::GroupResourceType,
13065
13066        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13067    }
13068
13069    impl ResourceGroup {
13070        pub fn new() -> Self {
13071            std::default::Default::default()
13072        }
13073
13074        /// Sets the value of [group_id][crate::model::uptime_check_config::ResourceGroup::group_id].
13075        pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13076            self.group_id = v.into();
13077            self
13078        }
13079
13080        /// Sets the value of [resource_type][crate::model::uptime_check_config::ResourceGroup::resource_type].
13081        pub fn set_resource_type<T: std::convert::Into<crate::model::GroupResourceType>>(
13082            mut self,
13083            v: T,
13084        ) -> Self {
13085            self.resource_type = v.into();
13086            self
13087        }
13088    }
13089
13090    impl wkt::message::Message for ResourceGroup {
13091        fn typename() -> &'static str {
13092            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ResourceGroup"
13093        }
13094    }
13095
13096    /// Information involved in sending ICMP pings alongside public HTTP/TCP
13097    /// checks. For HTTP, the pings are performed for each part of the redirect
13098    /// chain.
13099    #[derive(Clone, Default, PartialEq)]
13100    #[non_exhaustive]
13101    pub struct PingConfig {
13102        /// Number of ICMP pings. A maximum of 3 ICMP pings is currently supported.
13103        pub pings_count: i32,
13104
13105        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13106    }
13107
13108    impl PingConfig {
13109        pub fn new() -> Self {
13110            std::default::Default::default()
13111        }
13112
13113        /// Sets the value of [pings_count][crate::model::uptime_check_config::PingConfig::pings_count].
13114        pub fn set_pings_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13115            self.pings_count = v.into();
13116            self
13117        }
13118    }
13119
13120    impl wkt::message::Message for PingConfig {
13121        fn typename() -> &'static str {
13122            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.PingConfig"
13123        }
13124    }
13125
13126    /// Information involved in an HTTP/HTTPS Uptime check request.
13127    #[derive(Clone, Default, PartialEq)]
13128    #[non_exhaustive]
13129    pub struct HttpCheck {
13130        /// The HTTP request method to use for the check. If set to
13131        /// `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`.
13132        pub request_method: crate::model::uptime_check_config::http_check::RequestMethod,
13133
13134        /// If `true`, use HTTPS instead of HTTP to run the check.
13135        pub use_ssl: bool,
13136
13137        /// Optional (defaults to "/"). The path to the page against which to run
13138        /// the check. Will be combined with the `host` (specified within the
13139        /// `monitored_resource`) and `port` to construct the full URL. If the
13140        /// provided path does not begin with "/", a "/" will be prepended
13141        /// automatically.
13142        pub path: std::string::String,
13143
13144        /// Optional (defaults to 80 when `use_ssl` is `false`, and 443 when
13145        /// `use_ssl` is `true`). The TCP port on the HTTP server against which to
13146        /// run the check. Will be combined with host (specified within the
13147        /// `monitored_resource`) and `path` to construct the full URL.
13148        pub port: i32,
13149
13150        /// The authentication information. Optional when creating an HTTP check;
13151        /// defaults to empty.
13152        /// Do not set both `auth_method` and `auth_info`.
13153        pub auth_info:
13154            std::option::Option<crate::model::uptime_check_config::http_check::BasicAuthentication>,
13155
13156        /// Boolean specifying whether to encrypt the header information.
13157        /// Encryption should be specified for any headers related to authentication
13158        /// that you do not wish to be seen when retrieving the configuration. The
13159        /// server will be responsible for encrypting the headers.
13160        /// On Get/List calls, if `mask_headers` is set to `true` then the headers
13161        /// will be obscured with `******.`
13162        pub mask_headers: bool,
13163
13164        /// The list of headers to send as part of the Uptime check request.
13165        /// If two headers have the same key and different values, they should
13166        /// be entered as a single header, with the value being a comma-separated
13167        /// list of all the desired values as described at
13168        /// <https://www.w3.org/Protocols/rfc2616/rfc2616.txt> (page 31).
13169        /// Entering two separate headers with the same key in a Create call will
13170        /// cause the first to be overwritten by the second.
13171        /// The maximum number of headers allowed is 100.
13172        pub headers: std::collections::HashMap<std::string::String, std::string::String>,
13173
13174        /// The content type header to use for the check. The following
13175        /// configurations result in errors:
13176        ///
13177        /// 1. Content type is specified in both the `headers` field and the
13178        ///    `content_type` field.
13179        /// 1. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED`
13180        /// 1. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`.
13181        /// 1. Request method is `POST` and a "Content-Type" header is provided via
13182        ///    `headers` field. The `content_type` field should be used instead.
13183        pub content_type: crate::model::uptime_check_config::http_check::ContentType,
13184
13185        /// A user provided content type header to use for the check. The invalid
13186        /// configurations outlined in the `content_type` field apply to
13187        /// `custom_content_type`, as well as the following:
13188        ///
13189        /// 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set.
13190        /// 1. `content_type` is `USER_PROVIDED` and `custom_content_type` is not
13191        ///    set.
13192        pub custom_content_type: std::string::String,
13193
13194        /// Boolean specifying whether to include SSL certificate validation as a
13195        /// part of the Uptime check. Only applies to checks where
13196        /// `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
13197        /// setting `validate_ssl` to `true` has no effect.
13198        pub validate_ssl: bool,
13199
13200        /// The request body associated with the HTTP POST request. If `content_type`
13201        /// is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
13202        /// provide a `Content-Length` header via the `headers` field or the API will
13203        /// do so. If the `request_method` is `GET` and `body` is not empty, the API
13204        /// will return an error. The maximum byte size is 1 megabyte.
13205        ///
13206        /// Note: If client libraries aren't used (which performs the conversion
13207        /// automatically) base64 encode your `body` data since the field is of
13208        /// `bytes` type.
13209        pub body: ::bytes::Bytes,
13210
13211        /// If present, the check will only pass if the HTTP response status code is
13212        /// in this set of status codes. If empty, the HTTP status code will only
13213        /// pass if the HTTP status code is 200-299.
13214        pub accepted_response_status_codes:
13215            std::vec::Vec<crate::model::uptime_check_config::http_check::ResponseStatusCode>,
13216
13217        /// Contains information needed to add pings to an HTTP check.
13218        pub ping_config: std::option::Option<crate::model::uptime_check_config::PingConfig>,
13219
13220        /// This field is optional and should be set only by users interested in
13221        /// an authenticated uptime check.
13222        /// Do not set both `auth_method` and `auth_info`.
13223        pub auth_method:
13224            std::option::Option<crate::model::uptime_check_config::http_check::AuthMethod>,
13225
13226        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13227    }
13228
13229    impl HttpCheck {
13230        pub fn new() -> Self {
13231            std::default::Default::default()
13232        }
13233
13234        /// Sets the value of [request_method][crate::model::uptime_check_config::HttpCheck::request_method].
13235        pub fn set_request_method<
13236            T: std::convert::Into<crate::model::uptime_check_config::http_check::RequestMethod>,
13237        >(
13238            mut self,
13239            v: T,
13240        ) -> Self {
13241            self.request_method = v.into();
13242            self
13243        }
13244
13245        /// Sets the value of [use_ssl][crate::model::uptime_check_config::HttpCheck::use_ssl].
13246        pub fn set_use_ssl<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13247            self.use_ssl = v.into();
13248            self
13249        }
13250
13251        /// Sets the value of [path][crate::model::uptime_check_config::HttpCheck::path].
13252        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13253            self.path = v.into();
13254            self
13255        }
13256
13257        /// Sets the value of [port][crate::model::uptime_check_config::HttpCheck::port].
13258        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13259            self.port = v.into();
13260            self
13261        }
13262
13263        /// Sets the value of [auth_info][crate::model::uptime_check_config::HttpCheck::auth_info].
13264        pub fn set_auth_info<T>(mut self, v: T) -> Self
13265        where
13266            T: std::convert::Into<
13267                    crate::model::uptime_check_config::http_check::BasicAuthentication,
13268                >,
13269        {
13270            self.auth_info = std::option::Option::Some(v.into());
13271            self
13272        }
13273
13274        /// Sets or clears the value of [auth_info][crate::model::uptime_check_config::HttpCheck::auth_info].
13275        pub fn set_or_clear_auth_info<T>(mut self, v: std::option::Option<T>) -> Self
13276        where
13277            T: std::convert::Into<
13278                    crate::model::uptime_check_config::http_check::BasicAuthentication,
13279                >,
13280        {
13281            self.auth_info = v.map(|x| x.into());
13282            self
13283        }
13284
13285        /// Sets the value of [mask_headers][crate::model::uptime_check_config::HttpCheck::mask_headers].
13286        pub fn set_mask_headers<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13287            self.mask_headers = v.into();
13288            self
13289        }
13290
13291        /// Sets the value of [headers][crate::model::uptime_check_config::HttpCheck::headers].
13292        pub fn set_headers<T, K, V>(mut self, v: T) -> Self
13293        where
13294            T: std::iter::IntoIterator<Item = (K, V)>,
13295            K: std::convert::Into<std::string::String>,
13296            V: std::convert::Into<std::string::String>,
13297        {
13298            use std::iter::Iterator;
13299            self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13300            self
13301        }
13302
13303        /// Sets the value of [content_type][crate::model::uptime_check_config::HttpCheck::content_type].
13304        pub fn set_content_type<
13305            T: std::convert::Into<crate::model::uptime_check_config::http_check::ContentType>,
13306        >(
13307            mut self,
13308            v: T,
13309        ) -> Self {
13310            self.content_type = v.into();
13311            self
13312        }
13313
13314        /// Sets the value of [custom_content_type][crate::model::uptime_check_config::HttpCheck::custom_content_type].
13315        pub fn set_custom_content_type<T: std::convert::Into<std::string::String>>(
13316            mut self,
13317            v: T,
13318        ) -> Self {
13319            self.custom_content_type = v.into();
13320            self
13321        }
13322
13323        /// Sets the value of [validate_ssl][crate::model::uptime_check_config::HttpCheck::validate_ssl].
13324        pub fn set_validate_ssl<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13325            self.validate_ssl = v.into();
13326            self
13327        }
13328
13329        /// Sets the value of [body][crate::model::uptime_check_config::HttpCheck::body].
13330        pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13331            self.body = v.into();
13332            self
13333        }
13334
13335        /// Sets the value of [accepted_response_status_codes][crate::model::uptime_check_config::HttpCheck::accepted_response_status_codes].
13336        pub fn set_accepted_response_status_codes<T, V>(mut self, v: T) -> Self
13337        where
13338            T: std::iter::IntoIterator<Item = V>,
13339            V: std::convert::Into<
13340                    crate::model::uptime_check_config::http_check::ResponseStatusCode,
13341                >,
13342        {
13343            use std::iter::Iterator;
13344            self.accepted_response_status_codes = v.into_iter().map(|i| i.into()).collect();
13345            self
13346        }
13347
13348        /// Sets the value of [ping_config][crate::model::uptime_check_config::HttpCheck::ping_config].
13349        pub fn set_ping_config<T>(mut self, v: T) -> Self
13350        where
13351            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
13352        {
13353            self.ping_config = std::option::Option::Some(v.into());
13354            self
13355        }
13356
13357        /// Sets or clears the value of [ping_config][crate::model::uptime_check_config::HttpCheck::ping_config].
13358        pub fn set_or_clear_ping_config<T>(mut self, v: std::option::Option<T>) -> Self
13359        where
13360            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
13361        {
13362            self.ping_config = v.map(|x| x.into());
13363            self
13364        }
13365
13366        /// Sets the value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method].
13367        ///
13368        /// Note that all the setters affecting `auth_method` are mutually
13369        /// exclusive.
13370        pub fn set_auth_method<
13371            T: std::convert::Into<
13372                    std::option::Option<crate::model::uptime_check_config::http_check::AuthMethod>,
13373                >,
13374        >(
13375            mut self,
13376            v: T,
13377        ) -> Self {
13378            self.auth_method = v.into();
13379            self
13380        }
13381
13382        /// The value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method]
13383        /// if it holds a `ServiceAgentAuthentication`, `None` if the field is not set or
13384        /// holds a different branch.
13385        pub fn service_agent_authentication(
13386            &self,
13387        ) -> std::option::Option<
13388            &std::boxed::Box<
13389                crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
13390            >,
13391        > {
13392            #[allow(unreachable_patterns)]
13393            self.auth_method.as_ref().and_then(|v| match v {
13394                crate::model::uptime_check_config::http_check::AuthMethod::ServiceAgentAuthentication(v) => std::option::Option::Some(v),
13395                _ => std::option::Option::None,
13396            })
13397        }
13398
13399        /// Sets the value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method]
13400        /// to hold a `ServiceAgentAuthentication`.
13401        ///
13402        /// Note that all the setters affecting `auth_method` are
13403        /// mutually exclusive.
13404        pub fn set_service_agent_authentication<
13405            T: std::convert::Into<
13406                    std::boxed::Box<
13407                        crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
13408                    >,
13409                >,
13410        >(
13411            mut self,
13412            v: T,
13413        ) -> Self {
13414            self.auth_method = std::option::Option::Some(
13415                crate::model::uptime_check_config::http_check::AuthMethod::ServiceAgentAuthentication(
13416                    v.into()
13417                )
13418            );
13419            self
13420        }
13421    }
13422
13423    impl wkt::message::Message for HttpCheck {
13424        fn typename() -> &'static str {
13425            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck"
13426        }
13427    }
13428
13429    /// Defines additional types related to [HttpCheck].
13430    pub mod http_check {
13431        #[allow(unused_imports)]
13432        use super::*;
13433
13434        /// The authentication parameters to provide to the specified resource or
13435        /// URL that requires a username and password. Currently, only
13436        /// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
13437        /// supported in Uptime checks.
13438        #[derive(Clone, Default, PartialEq)]
13439        #[non_exhaustive]
13440        pub struct BasicAuthentication {
13441            /// The username to use when authenticating with the HTTP server.
13442            pub username: std::string::String,
13443
13444            /// The password to use when authenticating with the HTTP server.
13445            pub password: std::string::String,
13446
13447            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13448        }
13449
13450        impl BasicAuthentication {
13451            pub fn new() -> Self {
13452                std::default::Default::default()
13453            }
13454
13455            /// Sets the value of [username][crate::model::uptime_check_config::http_check::BasicAuthentication::username].
13456            pub fn set_username<T: std::convert::Into<std::string::String>>(
13457                mut self,
13458                v: T,
13459            ) -> Self {
13460                self.username = v.into();
13461                self
13462            }
13463
13464            /// Sets the value of [password][crate::model::uptime_check_config::http_check::BasicAuthentication::password].
13465            pub fn set_password<T: std::convert::Into<std::string::String>>(
13466                mut self,
13467                v: T,
13468            ) -> Self {
13469                self.password = v.into();
13470                self
13471            }
13472        }
13473
13474        impl wkt::message::Message for BasicAuthentication {
13475            fn typename() -> &'static str {
13476                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication"
13477            }
13478        }
13479
13480        /// A status to accept. Either a status code class like "2xx", or an integer
13481        /// status code like "200".
13482        #[derive(Clone, Default, PartialEq)]
13483        #[non_exhaustive]
13484        pub struct ResponseStatusCode {
13485            /// Either a specific value or a class of status codes.
13486            pub status_code: std::option::Option<
13487                crate::model::uptime_check_config::http_check::response_status_code::StatusCode,
13488            >,
13489
13490            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13491        }
13492
13493        impl ResponseStatusCode {
13494            pub fn new() -> Self {
13495                std::default::Default::default()
13496            }
13497
13498            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code].
13499            ///
13500            /// Note that all the setters affecting `status_code` are mutually
13501            /// exclusive.
13502            pub fn set_status_code<T: std::convert::Into<std::option::Option<crate::model::uptime_check_config::http_check::response_status_code::StatusCode>>>(mut self, v: T) -> Self
13503            {
13504                self.status_code = v.into();
13505                self
13506            }
13507
13508            /// The value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
13509            /// if it holds a `StatusValue`, `None` if the field is not set or
13510            /// holds a different branch.
13511            pub fn status_value(&self) -> std::option::Option<&i32> {
13512                #[allow(unreachable_patterns)]
13513                self.status_code.as_ref().and_then(|v| match v {
13514                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusValue(v) => std::option::Option::Some(v),
13515                    _ => std::option::Option::None,
13516                })
13517            }
13518
13519            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
13520            /// to hold a `StatusValue`.
13521            ///
13522            /// Note that all the setters affecting `status_code` are
13523            /// mutually exclusive.
13524            pub fn set_status_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13525                self.status_code = std::option::Option::Some(
13526                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusValue(
13527                        v.into()
13528                    )
13529                );
13530                self
13531            }
13532
13533            /// The value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
13534            /// if it holds a `StatusClass`, `None` if the field is not set or
13535            /// holds a different branch.
13536            pub fn status_class(
13537                &self,
13538            ) -> std::option::Option<
13539                &crate::model::uptime_check_config::http_check::response_status_code::StatusClass,
13540            > {
13541                #[allow(unreachable_patterns)]
13542                self.status_code.as_ref().and_then(|v| match v {
13543                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusClass(v) => std::option::Option::Some(v),
13544                    _ => std::option::Option::None,
13545                })
13546            }
13547
13548            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
13549            /// to hold a `StatusClass`.
13550            ///
13551            /// Note that all the setters affecting `status_code` are
13552            /// mutually exclusive.
13553            pub fn set_status_class<T: std::convert::Into<crate::model::uptime_check_config::http_check::response_status_code::StatusClass>>(mut self, v: T) -> Self{
13554                self.status_code = std::option::Option::Some(
13555                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusClass(
13556                        v.into()
13557                    )
13558                );
13559                self
13560            }
13561        }
13562
13563        impl wkt::message::Message for ResponseStatusCode {
13564            fn typename() -> &'static str {
13565                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode"
13566            }
13567        }
13568
13569        /// Defines additional types related to [ResponseStatusCode].
13570        pub mod response_status_code {
13571            #[allow(unused_imports)]
13572            use super::*;
13573
13574            /// An HTTP status code class.
13575            ///
13576            /// # Working with unknown values
13577            ///
13578            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13579            /// additional enum variants at any time. Adding new variants is not considered
13580            /// a breaking change. Applications should write their code in anticipation of:
13581            ///
13582            /// - New values appearing in future releases of the client library, **and**
13583            /// - New values received dynamically, without application changes.
13584            ///
13585            /// Please consult the [Working with enums] section in the user guide for some
13586            /// guidelines.
13587            ///
13588            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13589            #[derive(Clone, Debug, PartialEq)]
13590            #[non_exhaustive]
13591            pub enum StatusClass {
13592                /// Default value that matches no status codes.
13593                Unspecified,
13594                /// The class of status codes between 100 and 199.
13595                StatusClass1Xx,
13596                /// The class of status codes between 200 and 299.
13597                StatusClass2Xx,
13598                /// The class of status codes between 300 and 399.
13599                StatusClass3Xx,
13600                /// The class of status codes between 400 and 499.
13601                StatusClass4Xx,
13602                /// The class of status codes between 500 and 599.
13603                StatusClass5Xx,
13604                /// The class of all status codes.
13605                Any,
13606                /// If set, the enum was initialized with an unknown value.
13607                ///
13608                /// Applications can examine the value using [StatusClass::value] or
13609                /// [StatusClass::name].
13610                UnknownValue(status_class::UnknownValue),
13611            }
13612
13613            #[doc(hidden)]
13614            pub mod status_class {
13615                #[allow(unused_imports)]
13616                use super::*;
13617                #[derive(Clone, Debug, PartialEq)]
13618                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13619            }
13620
13621            impl StatusClass {
13622                /// Gets the enum value.
13623                ///
13624                /// Returns `None` if the enum contains an unknown value deserialized from
13625                /// the string representation of enums.
13626                pub fn value(&self) -> std::option::Option<i32> {
13627                    match self {
13628                        Self::Unspecified => std::option::Option::Some(0),
13629                        Self::StatusClass1Xx => std::option::Option::Some(100),
13630                        Self::StatusClass2Xx => std::option::Option::Some(200),
13631                        Self::StatusClass3Xx => std::option::Option::Some(300),
13632                        Self::StatusClass4Xx => std::option::Option::Some(400),
13633                        Self::StatusClass5Xx => std::option::Option::Some(500),
13634                        Self::Any => std::option::Option::Some(1000),
13635                        Self::UnknownValue(u) => u.0.value(),
13636                    }
13637                }
13638
13639                /// Gets the enum value as a string.
13640                ///
13641                /// Returns `None` if the enum contains an unknown value deserialized from
13642                /// the integer representation of enums.
13643                pub fn name(&self) -> std::option::Option<&str> {
13644                    match self {
13645                        Self::Unspecified => std::option::Option::Some("STATUS_CLASS_UNSPECIFIED"),
13646                        Self::StatusClass1Xx => std::option::Option::Some("STATUS_CLASS_1XX"),
13647                        Self::StatusClass2Xx => std::option::Option::Some("STATUS_CLASS_2XX"),
13648                        Self::StatusClass3Xx => std::option::Option::Some("STATUS_CLASS_3XX"),
13649                        Self::StatusClass4Xx => std::option::Option::Some("STATUS_CLASS_4XX"),
13650                        Self::StatusClass5Xx => std::option::Option::Some("STATUS_CLASS_5XX"),
13651                        Self::Any => std::option::Option::Some("STATUS_CLASS_ANY"),
13652                        Self::UnknownValue(u) => u.0.name(),
13653                    }
13654                }
13655            }
13656
13657            impl std::default::Default for StatusClass {
13658                fn default() -> Self {
13659                    use std::convert::From;
13660                    Self::from(0)
13661                }
13662            }
13663
13664            impl std::fmt::Display for StatusClass {
13665                fn fmt(
13666                    &self,
13667                    f: &mut std::fmt::Formatter<'_>,
13668                ) -> std::result::Result<(), std::fmt::Error> {
13669                    wkt::internal::display_enum(f, self.name(), self.value())
13670                }
13671            }
13672
13673            impl std::convert::From<i32> for StatusClass {
13674                fn from(value: i32) -> Self {
13675                    match value {
13676                        0 => Self::Unspecified,
13677                        100 => Self::StatusClass1Xx,
13678                        200 => Self::StatusClass2Xx,
13679                        300 => Self::StatusClass3Xx,
13680                        400 => Self::StatusClass4Xx,
13681                        500 => Self::StatusClass5Xx,
13682                        1000 => Self::Any,
13683                        _ => Self::UnknownValue(status_class::UnknownValue(
13684                            wkt::internal::UnknownEnumValue::Integer(value),
13685                        )),
13686                    }
13687                }
13688            }
13689
13690            impl std::convert::From<&str> for StatusClass {
13691                fn from(value: &str) -> Self {
13692                    use std::string::ToString;
13693                    match value {
13694                        "STATUS_CLASS_UNSPECIFIED" => Self::Unspecified,
13695                        "STATUS_CLASS_1XX" => Self::StatusClass1Xx,
13696                        "STATUS_CLASS_2XX" => Self::StatusClass2Xx,
13697                        "STATUS_CLASS_3XX" => Self::StatusClass3Xx,
13698                        "STATUS_CLASS_4XX" => Self::StatusClass4Xx,
13699                        "STATUS_CLASS_5XX" => Self::StatusClass5Xx,
13700                        "STATUS_CLASS_ANY" => Self::Any,
13701                        _ => Self::UnknownValue(status_class::UnknownValue(
13702                            wkt::internal::UnknownEnumValue::String(value.to_string()),
13703                        )),
13704                    }
13705                }
13706            }
13707
13708            impl serde::ser::Serialize for StatusClass {
13709                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13710                where
13711                    S: serde::Serializer,
13712                {
13713                    match self {
13714                        Self::Unspecified => serializer.serialize_i32(0),
13715                        Self::StatusClass1Xx => serializer.serialize_i32(100),
13716                        Self::StatusClass2Xx => serializer.serialize_i32(200),
13717                        Self::StatusClass3Xx => serializer.serialize_i32(300),
13718                        Self::StatusClass4Xx => serializer.serialize_i32(400),
13719                        Self::StatusClass5Xx => serializer.serialize_i32(500),
13720                        Self::Any => serializer.serialize_i32(1000),
13721                        Self::UnknownValue(u) => u.0.serialize(serializer),
13722                    }
13723                }
13724            }
13725
13726            impl<'de> serde::de::Deserialize<'de> for StatusClass {
13727                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13728                where
13729                    D: serde::Deserializer<'de>,
13730                {
13731                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<StatusClass>::new(
13732                        ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.StatusClass"))
13733                }
13734            }
13735
13736            /// Either a specific value or a class of status codes.
13737            #[derive(Clone, Debug, PartialEq)]
13738            #[non_exhaustive]
13739            pub enum StatusCode {
13740                /// A status code to accept.
13741                StatusValue(i32),
13742                /// A class of status codes to accept.
13743                StatusClass(crate::model::uptime_check_config::http_check::response_status_code::StatusClass),
13744            }
13745        }
13746
13747        /// Contains information needed for generating either an
13748        /// [OpenID Connect
13749        /// token](https://developers.google.com/identity/protocols/OpenIDConnect) or
13750        /// [OAuth token](https://developers.google.com/identity/protocols/oauth2).
13751        /// The token will be generated for the Monitoring service agent service
13752        /// account.
13753        #[derive(Clone, Default, PartialEq)]
13754        #[non_exhaustive]
13755        pub struct ServiceAgentAuthentication {
13756
13757            /// Type of authentication.
13758            pub r#type: crate::model::uptime_check_config::http_check::service_agent_authentication::ServiceAgentAuthenticationType,
13759
13760            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13761        }
13762
13763        impl ServiceAgentAuthentication {
13764            pub fn new() -> Self {
13765                std::default::Default::default()
13766            }
13767
13768            /// Sets the value of [r#type][crate::model::uptime_check_config::http_check::ServiceAgentAuthentication::type].
13769            pub fn set_type<T: std::convert::Into<crate::model::uptime_check_config::http_check::service_agent_authentication::ServiceAgentAuthenticationType>>(mut self, v: T) -> Self{
13770                self.r#type = v.into();
13771                self
13772            }
13773        }
13774
13775        impl wkt::message::Message for ServiceAgentAuthentication {
13776            fn typename() -> &'static str {
13777                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication"
13778            }
13779        }
13780
13781        /// Defines additional types related to [ServiceAgentAuthentication].
13782        pub mod service_agent_authentication {
13783            #[allow(unused_imports)]
13784            use super::*;
13785
13786            /// Type of authentication.
13787            ///
13788            /// # Working with unknown values
13789            ///
13790            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13791            /// additional enum variants at any time. Adding new variants is not considered
13792            /// a breaking change. Applications should write their code in anticipation of:
13793            ///
13794            /// - New values appearing in future releases of the client library, **and**
13795            /// - New values received dynamically, without application changes.
13796            ///
13797            /// Please consult the [Working with enums] section in the user guide for some
13798            /// guidelines.
13799            ///
13800            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13801            #[derive(Clone, Debug, PartialEq)]
13802            #[non_exhaustive]
13803            pub enum ServiceAgentAuthenticationType {
13804                /// Default value, will result in OIDC Authentication.
13805                Unspecified,
13806                /// OIDC Authentication
13807                OidcToken,
13808                /// If set, the enum was initialized with an unknown value.
13809                ///
13810                /// Applications can examine the value using [ServiceAgentAuthenticationType::value] or
13811                /// [ServiceAgentAuthenticationType::name].
13812                UnknownValue(service_agent_authentication_type::UnknownValue),
13813            }
13814
13815            #[doc(hidden)]
13816            pub mod service_agent_authentication_type {
13817                #[allow(unused_imports)]
13818                use super::*;
13819                #[derive(Clone, Debug, PartialEq)]
13820                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13821            }
13822
13823            impl ServiceAgentAuthenticationType {
13824                /// Gets the enum value.
13825                ///
13826                /// Returns `None` if the enum contains an unknown value deserialized from
13827                /// the string representation of enums.
13828                pub fn value(&self) -> std::option::Option<i32> {
13829                    match self {
13830                        Self::Unspecified => std::option::Option::Some(0),
13831                        Self::OidcToken => std::option::Option::Some(1),
13832                        Self::UnknownValue(u) => u.0.value(),
13833                    }
13834                }
13835
13836                /// Gets the enum value as a string.
13837                ///
13838                /// Returns `None` if the enum contains an unknown value deserialized from
13839                /// the integer representation of enums.
13840                pub fn name(&self) -> std::option::Option<&str> {
13841                    match self {
13842                        Self::Unspecified => std::option::Option::Some(
13843                            "SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED",
13844                        ),
13845                        Self::OidcToken => std::option::Option::Some("OIDC_TOKEN"),
13846                        Self::UnknownValue(u) => u.0.name(),
13847                    }
13848                }
13849            }
13850
13851            impl std::default::Default for ServiceAgentAuthenticationType {
13852                fn default() -> Self {
13853                    use std::convert::From;
13854                    Self::from(0)
13855                }
13856            }
13857
13858            impl std::fmt::Display for ServiceAgentAuthenticationType {
13859                fn fmt(
13860                    &self,
13861                    f: &mut std::fmt::Formatter<'_>,
13862                ) -> std::result::Result<(), std::fmt::Error> {
13863                    wkt::internal::display_enum(f, self.name(), self.value())
13864                }
13865            }
13866
13867            impl std::convert::From<i32> for ServiceAgentAuthenticationType {
13868                fn from(value: i32) -> Self {
13869                    match value {
13870                        0 => Self::Unspecified,
13871                        1 => Self::OidcToken,
13872                        _ => Self::UnknownValue(service_agent_authentication_type::UnknownValue(
13873                            wkt::internal::UnknownEnumValue::Integer(value),
13874                        )),
13875                    }
13876                }
13877            }
13878
13879            impl std::convert::From<&str> for ServiceAgentAuthenticationType {
13880                fn from(value: &str) -> Self {
13881                    use std::string::ToString;
13882                    match value {
13883                        "SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
13884                        "OIDC_TOKEN" => Self::OidcToken,
13885                        _ => Self::UnknownValue(service_agent_authentication_type::UnknownValue(
13886                            wkt::internal::UnknownEnumValue::String(value.to_string()),
13887                        )),
13888                    }
13889                }
13890            }
13891
13892            impl serde::ser::Serialize for ServiceAgentAuthenticationType {
13893                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13894                where
13895                    S: serde::Serializer,
13896                {
13897                    match self {
13898                        Self::Unspecified => serializer.serialize_i32(0),
13899                        Self::OidcToken => serializer.serialize_i32(1),
13900                        Self::UnknownValue(u) => u.0.serialize(serializer),
13901                    }
13902                }
13903            }
13904
13905            impl<'de> serde::de::Deserialize<'de> for ServiceAgentAuthenticationType {
13906                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13907                where
13908                    D: serde::Deserializer<'de>,
13909                {
13910                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceAgentAuthenticationType>::new(
13911                        ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType"))
13912                }
13913            }
13914        }
13915
13916        /// The HTTP request method options.
13917        ///
13918        /// # Working with unknown values
13919        ///
13920        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13921        /// additional enum variants at any time. Adding new variants is not considered
13922        /// a breaking change. Applications should write their code in anticipation of:
13923        ///
13924        /// - New values appearing in future releases of the client library, **and**
13925        /// - New values received dynamically, without application changes.
13926        ///
13927        /// Please consult the [Working with enums] section in the user guide for some
13928        /// guidelines.
13929        ///
13930        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13931        #[derive(Clone, Debug, PartialEq)]
13932        #[non_exhaustive]
13933        pub enum RequestMethod {
13934            /// No request method specified.
13935            MethodUnspecified,
13936            /// GET request.
13937            Get,
13938            /// POST request.
13939            Post,
13940            /// If set, the enum was initialized with an unknown value.
13941            ///
13942            /// Applications can examine the value using [RequestMethod::value] or
13943            /// [RequestMethod::name].
13944            UnknownValue(request_method::UnknownValue),
13945        }
13946
13947        #[doc(hidden)]
13948        pub mod request_method {
13949            #[allow(unused_imports)]
13950            use super::*;
13951            #[derive(Clone, Debug, PartialEq)]
13952            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13953        }
13954
13955        impl RequestMethod {
13956            /// Gets the enum value.
13957            ///
13958            /// Returns `None` if the enum contains an unknown value deserialized from
13959            /// the string representation of enums.
13960            pub fn value(&self) -> std::option::Option<i32> {
13961                match self {
13962                    Self::MethodUnspecified => std::option::Option::Some(0),
13963                    Self::Get => std::option::Option::Some(1),
13964                    Self::Post => std::option::Option::Some(2),
13965                    Self::UnknownValue(u) => u.0.value(),
13966                }
13967            }
13968
13969            /// Gets the enum value as a string.
13970            ///
13971            /// Returns `None` if the enum contains an unknown value deserialized from
13972            /// the integer representation of enums.
13973            pub fn name(&self) -> std::option::Option<&str> {
13974                match self {
13975                    Self::MethodUnspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
13976                    Self::Get => std::option::Option::Some("GET"),
13977                    Self::Post => std::option::Option::Some("POST"),
13978                    Self::UnknownValue(u) => u.0.name(),
13979                }
13980            }
13981        }
13982
13983        impl std::default::Default for RequestMethod {
13984            fn default() -> Self {
13985                use std::convert::From;
13986                Self::from(0)
13987            }
13988        }
13989
13990        impl std::fmt::Display for RequestMethod {
13991            fn fmt(
13992                &self,
13993                f: &mut std::fmt::Formatter<'_>,
13994            ) -> std::result::Result<(), std::fmt::Error> {
13995                wkt::internal::display_enum(f, self.name(), self.value())
13996            }
13997        }
13998
13999        impl std::convert::From<i32> for RequestMethod {
14000            fn from(value: i32) -> Self {
14001                match value {
14002                    0 => Self::MethodUnspecified,
14003                    1 => Self::Get,
14004                    2 => Self::Post,
14005                    _ => Self::UnknownValue(request_method::UnknownValue(
14006                        wkt::internal::UnknownEnumValue::Integer(value),
14007                    )),
14008                }
14009            }
14010        }
14011
14012        impl std::convert::From<&str> for RequestMethod {
14013            fn from(value: &str) -> Self {
14014                use std::string::ToString;
14015                match value {
14016                    "METHOD_UNSPECIFIED" => Self::MethodUnspecified,
14017                    "GET" => Self::Get,
14018                    "POST" => Self::Post,
14019                    _ => Self::UnknownValue(request_method::UnknownValue(
14020                        wkt::internal::UnknownEnumValue::String(value.to_string()),
14021                    )),
14022                }
14023            }
14024        }
14025
14026        impl serde::ser::Serialize for RequestMethod {
14027            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14028            where
14029                S: serde::Serializer,
14030            {
14031                match self {
14032                    Self::MethodUnspecified => serializer.serialize_i32(0),
14033                    Self::Get => serializer.serialize_i32(1),
14034                    Self::Post => serializer.serialize_i32(2),
14035                    Self::UnknownValue(u) => u.0.serialize(serializer),
14036                }
14037            }
14038        }
14039
14040        impl<'de> serde::de::Deserialize<'de> for RequestMethod {
14041            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14042            where
14043                D: serde::Deserializer<'de>,
14044            {
14045                deserializer.deserialize_any(wkt::internal::EnumVisitor::<RequestMethod>::new(
14046                    ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod",
14047                ))
14048            }
14049        }
14050
14051        /// Header options corresponding to the content type of a HTTP request body.
14052        ///
14053        /// # Working with unknown values
14054        ///
14055        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14056        /// additional enum variants at any time. Adding new variants is not considered
14057        /// a breaking change. Applications should write their code in anticipation of:
14058        ///
14059        /// - New values appearing in future releases of the client library, **and**
14060        /// - New values received dynamically, without application changes.
14061        ///
14062        /// Please consult the [Working with enums] section in the user guide for some
14063        /// guidelines.
14064        ///
14065        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14066        #[derive(Clone, Debug, PartialEq)]
14067        #[non_exhaustive]
14068        pub enum ContentType {
14069            /// No content type specified.
14070            TypeUnspecified,
14071            /// `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
14072            /// to `application/x-www-form-urlencoded` in the HTTP request.
14073            UrlEncoded,
14074            /// `body` is in `custom_content_type` form. Equivalent to setting the
14075            /// `Content-Type` to the contents of `custom_content_type` in the HTTP
14076            /// request.
14077            UserProvided,
14078            /// If set, the enum was initialized with an unknown value.
14079            ///
14080            /// Applications can examine the value using [ContentType::value] or
14081            /// [ContentType::name].
14082            UnknownValue(content_type::UnknownValue),
14083        }
14084
14085        #[doc(hidden)]
14086        pub mod content_type {
14087            #[allow(unused_imports)]
14088            use super::*;
14089            #[derive(Clone, Debug, PartialEq)]
14090            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14091        }
14092
14093        impl ContentType {
14094            /// Gets the enum value.
14095            ///
14096            /// Returns `None` if the enum contains an unknown value deserialized from
14097            /// the string representation of enums.
14098            pub fn value(&self) -> std::option::Option<i32> {
14099                match self {
14100                    Self::TypeUnspecified => std::option::Option::Some(0),
14101                    Self::UrlEncoded => std::option::Option::Some(1),
14102                    Self::UserProvided => std::option::Option::Some(2),
14103                    Self::UnknownValue(u) => u.0.value(),
14104                }
14105            }
14106
14107            /// Gets the enum value as a string.
14108            ///
14109            /// Returns `None` if the enum contains an unknown value deserialized from
14110            /// the integer representation of enums.
14111            pub fn name(&self) -> std::option::Option<&str> {
14112                match self {
14113                    Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
14114                    Self::UrlEncoded => std::option::Option::Some("URL_ENCODED"),
14115                    Self::UserProvided => std::option::Option::Some("USER_PROVIDED"),
14116                    Self::UnknownValue(u) => u.0.name(),
14117                }
14118            }
14119        }
14120
14121        impl std::default::Default for ContentType {
14122            fn default() -> Self {
14123                use std::convert::From;
14124                Self::from(0)
14125            }
14126        }
14127
14128        impl std::fmt::Display for ContentType {
14129            fn fmt(
14130                &self,
14131                f: &mut std::fmt::Formatter<'_>,
14132            ) -> std::result::Result<(), std::fmt::Error> {
14133                wkt::internal::display_enum(f, self.name(), self.value())
14134            }
14135        }
14136
14137        impl std::convert::From<i32> for ContentType {
14138            fn from(value: i32) -> Self {
14139                match value {
14140                    0 => Self::TypeUnspecified,
14141                    1 => Self::UrlEncoded,
14142                    2 => Self::UserProvided,
14143                    _ => Self::UnknownValue(content_type::UnknownValue(
14144                        wkt::internal::UnknownEnumValue::Integer(value),
14145                    )),
14146                }
14147            }
14148        }
14149
14150        impl std::convert::From<&str> for ContentType {
14151            fn from(value: &str) -> Self {
14152                use std::string::ToString;
14153                match value {
14154                    "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
14155                    "URL_ENCODED" => Self::UrlEncoded,
14156                    "USER_PROVIDED" => Self::UserProvided,
14157                    _ => Self::UnknownValue(content_type::UnknownValue(
14158                        wkt::internal::UnknownEnumValue::String(value.to_string()),
14159                    )),
14160                }
14161            }
14162        }
14163
14164        impl serde::ser::Serialize for ContentType {
14165            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14166            where
14167                S: serde::Serializer,
14168            {
14169                match self {
14170                    Self::TypeUnspecified => serializer.serialize_i32(0),
14171                    Self::UrlEncoded => serializer.serialize_i32(1),
14172                    Self::UserProvided => serializer.serialize_i32(2),
14173                    Self::UnknownValue(u) => u.0.serialize(serializer),
14174                }
14175            }
14176        }
14177
14178        impl<'de> serde::de::Deserialize<'de> for ContentType {
14179            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14180            where
14181                D: serde::Deserializer<'de>,
14182            {
14183                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentType>::new(
14184                    ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType",
14185                ))
14186            }
14187        }
14188
14189        /// This field is optional and should be set only by users interested in
14190        /// an authenticated uptime check.
14191        /// Do not set both `auth_method` and `auth_info`.
14192        #[derive(Clone, Debug, PartialEq)]
14193        #[non_exhaustive]
14194        pub enum AuthMethod {
14195            /// If specified, Uptime will generate and attach an OIDC JWT token for the
14196            /// Monitoring service agent service account as an `Authorization` header
14197            /// in the HTTP request when probing.
14198            ServiceAgentAuthentication(
14199                std::boxed::Box<
14200                    crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
14201                >,
14202            ),
14203        }
14204    }
14205
14206    /// Information required for a TCP Uptime check request.
14207    #[derive(Clone, Default, PartialEq)]
14208    #[non_exhaustive]
14209    pub struct TcpCheck {
14210        /// The TCP port on the server against which to run the check. Will be
14211        /// combined with host (specified within the `monitored_resource`) to
14212        /// construct the full URL. Required.
14213        pub port: i32,
14214
14215        /// Contains information needed to add pings to a TCP check.
14216        pub ping_config: std::option::Option<crate::model::uptime_check_config::PingConfig>,
14217
14218        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14219    }
14220
14221    impl TcpCheck {
14222        pub fn new() -> Self {
14223            std::default::Default::default()
14224        }
14225
14226        /// Sets the value of [port][crate::model::uptime_check_config::TcpCheck::port].
14227        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14228            self.port = v.into();
14229            self
14230        }
14231
14232        /// Sets the value of [ping_config][crate::model::uptime_check_config::TcpCheck::ping_config].
14233        pub fn set_ping_config<T>(mut self, v: T) -> Self
14234        where
14235            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
14236        {
14237            self.ping_config = std::option::Option::Some(v.into());
14238            self
14239        }
14240
14241        /// Sets or clears the value of [ping_config][crate::model::uptime_check_config::TcpCheck::ping_config].
14242        pub fn set_or_clear_ping_config<T>(mut self, v: std::option::Option<T>) -> Self
14243        where
14244            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
14245        {
14246            self.ping_config = v.map(|x| x.into());
14247            self
14248        }
14249    }
14250
14251    impl wkt::message::Message for TcpCheck {
14252        fn typename() -> &'static str {
14253            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.TcpCheck"
14254        }
14255    }
14256
14257    /// Optional. Used to perform content matching. This allows matching based on
14258    /// substrings and regular expressions, together with their negations. Only the
14259    /// first 4&nbsp;MB of an HTTP or HTTPS check's response (and the first
14260    /// 1&nbsp;MB of a TCP check's response) are examined for purposes of content
14261    /// matching.
14262    #[derive(Clone, Default, PartialEq)]
14263    #[non_exhaustive]
14264    pub struct ContentMatcher {
14265        /// String, regex or JSON content to match. Maximum 1024 bytes. An empty
14266        /// `content` string indicates no content matching is to be performed.
14267        pub content: std::string::String,
14268
14269        /// The type of content matcher that will be applied to the server output,
14270        /// compared to the `content` string when the check is run.
14271        pub matcher: crate::model::uptime_check_config::content_matcher::ContentMatcherOption,
14272
14273        /// Certain `ContentMatcherOption` types require additional information.
14274        /// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
14275        /// `JsonPathMatcher`; not used for other options.
14276        pub additional_matcher_info: std::option::Option<
14277            crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo,
14278        >,
14279
14280        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14281    }
14282
14283    impl ContentMatcher {
14284        pub fn new() -> Self {
14285            std::default::Default::default()
14286        }
14287
14288        /// Sets the value of [content][crate::model::uptime_check_config::ContentMatcher::content].
14289        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14290            self.content = v.into();
14291            self
14292        }
14293
14294        /// Sets the value of [matcher][crate::model::uptime_check_config::ContentMatcher::matcher].
14295        pub fn set_matcher<
14296            T: std::convert::Into<
14297                    crate::model::uptime_check_config::content_matcher::ContentMatcherOption,
14298                >,
14299        >(
14300            mut self,
14301            v: T,
14302        ) -> Self {
14303            self.matcher = v.into();
14304            self
14305        }
14306
14307        /// Sets the value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info].
14308        ///
14309        /// Note that all the setters affecting `additional_matcher_info` are mutually
14310        /// exclusive.
14311        pub fn set_additional_matcher_info<
14312            T: std::convert::Into<
14313                    std::option::Option<
14314                        crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo,
14315                    >,
14316                >,
14317        >(
14318            mut self,
14319            v: T,
14320        ) -> Self {
14321            self.additional_matcher_info = v.into();
14322            self
14323        }
14324
14325        /// The value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info]
14326        /// if it holds a `JsonPathMatcher`, `None` if the field is not set or
14327        /// holds a different branch.
14328        pub fn json_path_matcher(
14329            &self,
14330        ) -> std::option::Option<
14331            &std::boxed::Box<crate::model::uptime_check_config::content_matcher::JsonPathMatcher>,
14332        > {
14333            #[allow(unreachable_patterns)]
14334            self.additional_matcher_info.as_ref().and_then(|v| match v {
14335                crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo::JsonPathMatcher(v) => std::option::Option::Some(v),
14336                _ => std::option::Option::None,
14337            })
14338        }
14339
14340        /// Sets the value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info]
14341        /// to hold a `JsonPathMatcher`.
14342        ///
14343        /// Note that all the setters affecting `additional_matcher_info` are
14344        /// mutually exclusive.
14345        pub fn set_json_path_matcher<
14346            T: std::convert::Into<
14347                    std::boxed::Box<
14348                        crate::model::uptime_check_config::content_matcher::JsonPathMatcher,
14349                    >,
14350                >,
14351        >(
14352            mut self,
14353            v: T,
14354        ) -> Self {
14355            self.additional_matcher_info = std::option::Option::Some(
14356                crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo::JsonPathMatcher(
14357                    v.into()
14358                )
14359            );
14360            self
14361        }
14362    }
14363
14364    impl wkt::message::Message for ContentMatcher {
14365        fn typename() -> &'static str {
14366            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ContentMatcher"
14367        }
14368    }
14369
14370    /// Defines additional types related to [ContentMatcher].
14371    pub mod content_matcher {
14372        #[allow(unused_imports)]
14373        use super::*;
14374
14375        /// Information needed to perform a JSONPath content match.
14376        /// Used for `ContentMatcherOption::MATCHES_JSON_PATH` and
14377        /// `ContentMatcherOption::NOT_MATCHES_JSON_PATH`.
14378        #[derive(Clone, Default, PartialEq)]
14379        #[non_exhaustive]
14380        pub struct JsonPathMatcher {
14381
14382            /// JSONPath within the response output pointing to the expected
14383            /// `ContentMatcher::content` to match against.
14384            pub json_path: std::string::String,
14385
14386            /// The type of JSONPath match that will be applied to the JSON output
14387            /// (`ContentMatcher.content`)
14388            pub json_matcher: crate::model::uptime_check_config::content_matcher::json_path_matcher::JsonPathMatcherOption,
14389
14390            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14391        }
14392
14393        impl JsonPathMatcher {
14394            pub fn new() -> Self {
14395                std::default::Default::default()
14396            }
14397
14398            /// Sets the value of [json_path][crate::model::uptime_check_config::content_matcher::JsonPathMatcher::json_path].
14399            pub fn set_json_path<T: std::convert::Into<std::string::String>>(
14400                mut self,
14401                v: T,
14402            ) -> Self {
14403                self.json_path = v.into();
14404                self
14405            }
14406
14407            /// Sets the value of [json_matcher][crate::model::uptime_check_config::content_matcher::JsonPathMatcher::json_matcher].
14408            pub fn set_json_matcher<T: std::convert::Into<crate::model::uptime_check_config::content_matcher::json_path_matcher::JsonPathMatcherOption>>(mut self, v: T) -> Self{
14409                self.json_matcher = v.into();
14410                self
14411            }
14412        }
14413
14414        impl wkt::message::Message for JsonPathMatcher {
14415            fn typename() -> &'static str {
14416                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher"
14417            }
14418        }
14419
14420        /// Defines additional types related to [JsonPathMatcher].
14421        pub mod json_path_matcher {
14422            #[allow(unused_imports)]
14423            use super::*;
14424
14425            /// Options to perform JSONPath content matching.
14426            ///
14427            /// # Working with unknown values
14428            ///
14429            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14430            /// additional enum variants at any time. Adding new variants is not considered
14431            /// a breaking change. Applications should write their code in anticipation of:
14432            ///
14433            /// - New values appearing in future releases of the client library, **and**
14434            /// - New values received dynamically, without application changes.
14435            ///
14436            /// Please consult the [Working with enums] section in the user guide for some
14437            /// guidelines.
14438            ///
14439            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14440            #[derive(Clone, Debug, PartialEq)]
14441            #[non_exhaustive]
14442            pub enum JsonPathMatcherOption {
14443                /// No JSONPath matcher type specified (not valid).
14444                Unspecified,
14445                /// Selects 'exact string' matching. The match succeeds if the content at
14446                /// the `json_path` within the output is exactly the same as the
14447                /// `content` string.
14448                ExactMatch,
14449                /// Selects regular-expression matching. The match succeeds if the
14450                /// content at the `json_path` within the output matches the regular
14451                /// expression specified in the `content` string.
14452                RegexMatch,
14453                /// If set, the enum was initialized with an unknown value.
14454                ///
14455                /// Applications can examine the value using [JsonPathMatcherOption::value] or
14456                /// [JsonPathMatcherOption::name].
14457                UnknownValue(json_path_matcher_option::UnknownValue),
14458            }
14459
14460            #[doc(hidden)]
14461            pub mod json_path_matcher_option {
14462                #[allow(unused_imports)]
14463                use super::*;
14464                #[derive(Clone, Debug, PartialEq)]
14465                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14466            }
14467
14468            impl JsonPathMatcherOption {
14469                /// Gets the enum value.
14470                ///
14471                /// Returns `None` if the enum contains an unknown value deserialized from
14472                /// the string representation of enums.
14473                pub fn value(&self) -> std::option::Option<i32> {
14474                    match self {
14475                        Self::Unspecified => std::option::Option::Some(0),
14476                        Self::ExactMatch => std::option::Option::Some(1),
14477                        Self::RegexMatch => std::option::Option::Some(2),
14478                        Self::UnknownValue(u) => u.0.value(),
14479                    }
14480                }
14481
14482                /// Gets the enum value as a string.
14483                ///
14484                /// Returns `None` if the enum contains an unknown value deserialized from
14485                /// the integer representation of enums.
14486                pub fn name(&self) -> std::option::Option<&str> {
14487                    match self {
14488                        Self::Unspecified => {
14489                            std::option::Option::Some("JSON_PATH_MATCHER_OPTION_UNSPECIFIED")
14490                        }
14491                        Self::ExactMatch => std::option::Option::Some("EXACT_MATCH"),
14492                        Self::RegexMatch => std::option::Option::Some("REGEX_MATCH"),
14493                        Self::UnknownValue(u) => u.0.name(),
14494                    }
14495                }
14496            }
14497
14498            impl std::default::Default for JsonPathMatcherOption {
14499                fn default() -> Self {
14500                    use std::convert::From;
14501                    Self::from(0)
14502                }
14503            }
14504
14505            impl std::fmt::Display for JsonPathMatcherOption {
14506                fn fmt(
14507                    &self,
14508                    f: &mut std::fmt::Formatter<'_>,
14509                ) -> std::result::Result<(), std::fmt::Error> {
14510                    wkt::internal::display_enum(f, self.name(), self.value())
14511                }
14512            }
14513
14514            impl std::convert::From<i32> for JsonPathMatcherOption {
14515                fn from(value: i32) -> Self {
14516                    match value {
14517                        0 => Self::Unspecified,
14518                        1 => Self::ExactMatch,
14519                        2 => Self::RegexMatch,
14520                        _ => Self::UnknownValue(json_path_matcher_option::UnknownValue(
14521                            wkt::internal::UnknownEnumValue::Integer(value),
14522                        )),
14523                    }
14524                }
14525            }
14526
14527            impl std::convert::From<&str> for JsonPathMatcherOption {
14528                fn from(value: &str) -> Self {
14529                    use std::string::ToString;
14530                    match value {
14531                        "JSON_PATH_MATCHER_OPTION_UNSPECIFIED" => Self::Unspecified,
14532                        "EXACT_MATCH" => Self::ExactMatch,
14533                        "REGEX_MATCH" => Self::RegexMatch,
14534                        _ => Self::UnknownValue(json_path_matcher_option::UnknownValue(
14535                            wkt::internal::UnknownEnumValue::String(value.to_string()),
14536                        )),
14537                    }
14538                }
14539            }
14540
14541            impl serde::ser::Serialize for JsonPathMatcherOption {
14542                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14543                where
14544                    S: serde::Serializer,
14545                {
14546                    match self {
14547                        Self::Unspecified => serializer.serialize_i32(0),
14548                        Self::ExactMatch => serializer.serialize_i32(1),
14549                        Self::RegexMatch => serializer.serialize_i32(2),
14550                        Self::UnknownValue(u) => u.0.serialize(serializer),
14551                    }
14552                }
14553            }
14554
14555            impl<'de> serde::de::Deserialize<'de> for JsonPathMatcherOption {
14556                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14557                where
14558                    D: serde::Deserializer<'de>,
14559                {
14560                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonPathMatcherOption>::new(
14561                        ".google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption"))
14562                }
14563            }
14564        }
14565
14566        /// Options to perform content matching.
14567        ///
14568        /// # Working with unknown values
14569        ///
14570        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14571        /// additional enum variants at any time. Adding new variants is not considered
14572        /// a breaking change. Applications should write their code in anticipation of:
14573        ///
14574        /// - New values appearing in future releases of the client library, **and**
14575        /// - New values received dynamically, without application changes.
14576        ///
14577        /// Please consult the [Working with enums] section in the user guide for some
14578        /// guidelines.
14579        ///
14580        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14581        #[derive(Clone, Debug, PartialEq)]
14582        #[non_exhaustive]
14583        pub enum ContentMatcherOption {
14584            /// No content matcher type specified (maintained for backward
14585            /// compatibility, but deprecated for future use).
14586            /// Treated as `CONTAINS_STRING`.
14587            Unspecified,
14588            /// Selects substring matching. The match succeeds if the output contains
14589            /// the `content` string.  This is the default value for checks without
14590            /// a `matcher` option, or where the value of `matcher` is
14591            /// `CONTENT_MATCHER_OPTION_UNSPECIFIED`.
14592            ContainsString,
14593            /// Selects negation of substring matching. The match succeeds if the
14594            /// output does _NOT_ contain the `content` string.
14595            NotContainsString,
14596            /// Selects regular-expression matching. The match succeeds if the output
14597            /// matches the regular expression specified in the `content` string.
14598            /// Regex matching is only supported for HTTP/HTTPS checks.
14599            MatchesRegex,
14600            /// Selects negation of regular-expression matching. The match succeeds if
14601            /// the output does _NOT_ match the regular expression specified in the
14602            /// `content` string. Regex matching is only supported for HTTP/HTTPS
14603            /// checks.
14604            NotMatchesRegex,
14605            /// Selects JSONPath matching. See `JsonPathMatcher` for details on when
14606            /// the match succeeds. JSONPath matching is only supported for HTTP/HTTPS
14607            /// checks.
14608            MatchesJsonPath,
14609            /// Selects JSONPath matching. See `JsonPathMatcher` for details on when
14610            /// the match succeeds. Succeeds when output does _NOT_ match as specified.
14611            /// JSONPath is only supported for HTTP/HTTPS checks.
14612            NotMatchesJsonPath,
14613            /// If set, the enum was initialized with an unknown value.
14614            ///
14615            /// Applications can examine the value using [ContentMatcherOption::value] or
14616            /// [ContentMatcherOption::name].
14617            UnknownValue(content_matcher_option::UnknownValue),
14618        }
14619
14620        #[doc(hidden)]
14621        pub mod content_matcher_option {
14622            #[allow(unused_imports)]
14623            use super::*;
14624            #[derive(Clone, Debug, PartialEq)]
14625            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14626        }
14627
14628        impl ContentMatcherOption {
14629            /// Gets the enum value.
14630            ///
14631            /// Returns `None` if the enum contains an unknown value deserialized from
14632            /// the string representation of enums.
14633            pub fn value(&self) -> std::option::Option<i32> {
14634                match self {
14635                    Self::Unspecified => std::option::Option::Some(0),
14636                    Self::ContainsString => std::option::Option::Some(1),
14637                    Self::NotContainsString => std::option::Option::Some(2),
14638                    Self::MatchesRegex => std::option::Option::Some(3),
14639                    Self::NotMatchesRegex => std::option::Option::Some(4),
14640                    Self::MatchesJsonPath => std::option::Option::Some(5),
14641                    Self::NotMatchesJsonPath => std::option::Option::Some(6),
14642                    Self::UnknownValue(u) => u.0.value(),
14643                }
14644            }
14645
14646            /// Gets the enum value as a string.
14647            ///
14648            /// Returns `None` if the enum contains an unknown value deserialized from
14649            /// the integer representation of enums.
14650            pub fn name(&self) -> std::option::Option<&str> {
14651                match self {
14652                    Self::Unspecified => {
14653                        std::option::Option::Some("CONTENT_MATCHER_OPTION_UNSPECIFIED")
14654                    }
14655                    Self::ContainsString => std::option::Option::Some("CONTAINS_STRING"),
14656                    Self::NotContainsString => std::option::Option::Some("NOT_CONTAINS_STRING"),
14657                    Self::MatchesRegex => std::option::Option::Some("MATCHES_REGEX"),
14658                    Self::NotMatchesRegex => std::option::Option::Some("NOT_MATCHES_REGEX"),
14659                    Self::MatchesJsonPath => std::option::Option::Some("MATCHES_JSON_PATH"),
14660                    Self::NotMatchesJsonPath => std::option::Option::Some("NOT_MATCHES_JSON_PATH"),
14661                    Self::UnknownValue(u) => u.0.name(),
14662                }
14663            }
14664        }
14665
14666        impl std::default::Default for ContentMatcherOption {
14667            fn default() -> Self {
14668                use std::convert::From;
14669                Self::from(0)
14670            }
14671        }
14672
14673        impl std::fmt::Display for ContentMatcherOption {
14674            fn fmt(
14675                &self,
14676                f: &mut std::fmt::Formatter<'_>,
14677            ) -> std::result::Result<(), std::fmt::Error> {
14678                wkt::internal::display_enum(f, self.name(), self.value())
14679            }
14680        }
14681
14682        impl std::convert::From<i32> for ContentMatcherOption {
14683            fn from(value: i32) -> Self {
14684                match value {
14685                    0 => Self::Unspecified,
14686                    1 => Self::ContainsString,
14687                    2 => Self::NotContainsString,
14688                    3 => Self::MatchesRegex,
14689                    4 => Self::NotMatchesRegex,
14690                    5 => Self::MatchesJsonPath,
14691                    6 => Self::NotMatchesJsonPath,
14692                    _ => Self::UnknownValue(content_matcher_option::UnknownValue(
14693                        wkt::internal::UnknownEnumValue::Integer(value),
14694                    )),
14695                }
14696            }
14697        }
14698
14699        impl std::convert::From<&str> for ContentMatcherOption {
14700            fn from(value: &str) -> Self {
14701                use std::string::ToString;
14702                match value {
14703                    "CONTENT_MATCHER_OPTION_UNSPECIFIED" => Self::Unspecified,
14704                    "CONTAINS_STRING" => Self::ContainsString,
14705                    "NOT_CONTAINS_STRING" => Self::NotContainsString,
14706                    "MATCHES_REGEX" => Self::MatchesRegex,
14707                    "NOT_MATCHES_REGEX" => Self::NotMatchesRegex,
14708                    "MATCHES_JSON_PATH" => Self::MatchesJsonPath,
14709                    "NOT_MATCHES_JSON_PATH" => Self::NotMatchesJsonPath,
14710                    _ => Self::UnknownValue(content_matcher_option::UnknownValue(
14711                        wkt::internal::UnknownEnumValue::String(value.to_string()),
14712                    )),
14713                }
14714            }
14715        }
14716
14717        impl serde::ser::Serialize for ContentMatcherOption {
14718            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14719            where
14720                S: serde::Serializer,
14721            {
14722                match self {
14723                    Self::Unspecified => serializer.serialize_i32(0),
14724                    Self::ContainsString => serializer.serialize_i32(1),
14725                    Self::NotContainsString => serializer.serialize_i32(2),
14726                    Self::MatchesRegex => serializer.serialize_i32(3),
14727                    Self::NotMatchesRegex => serializer.serialize_i32(4),
14728                    Self::MatchesJsonPath => serializer.serialize_i32(5),
14729                    Self::NotMatchesJsonPath => serializer.serialize_i32(6),
14730                    Self::UnknownValue(u) => u.0.serialize(serializer),
14731                }
14732            }
14733        }
14734
14735        impl<'de> serde::de::Deserialize<'de> for ContentMatcherOption {
14736            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14737            where
14738                D: serde::Deserializer<'de>,
14739            {
14740                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentMatcherOption>::new(
14741                    ".google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption"))
14742            }
14743        }
14744
14745        /// Certain `ContentMatcherOption` types require additional information.
14746        /// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
14747        /// `JsonPathMatcher`; not used for other options.
14748        #[derive(Clone, Debug, PartialEq)]
14749        #[non_exhaustive]
14750        pub enum AdditionalMatcherInfo {
14751            /// Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH`
14752            JsonPathMatcher(
14753                std::boxed::Box<
14754                    crate::model::uptime_check_config::content_matcher::JsonPathMatcher,
14755                >,
14756            ),
14757        }
14758    }
14759
14760    /// What kind of checkers are available to be used by the check.
14761    ///
14762    /// # Working with unknown values
14763    ///
14764    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14765    /// additional enum variants at any time. Adding new variants is not considered
14766    /// a breaking change. Applications should write their code in anticipation of:
14767    ///
14768    /// - New values appearing in future releases of the client library, **and**
14769    /// - New values received dynamically, without application changes.
14770    ///
14771    /// Please consult the [Working with enums] section in the user guide for some
14772    /// guidelines.
14773    ///
14774    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14775    #[derive(Clone, Debug, PartialEq)]
14776    #[non_exhaustive]
14777    pub enum CheckerType {
14778        /// The default checker type. Currently converted to `STATIC_IP_CHECKERS`
14779        /// on creation, the default conversion behavior may change in the future.
14780        Unspecified,
14781        /// `STATIC_IP_CHECKERS` are used for uptime checks that perform egress
14782        /// across the public internet. `STATIC_IP_CHECKERS` use the static IP
14783        /// addresses returned by `ListUptimeCheckIps`.
14784        StaticIpCheckers,
14785        /// `VPC_CHECKERS` are used for uptime checks that perform egress using
14786        /// Service Directory and private network access. When using `VPC_CHECKERS`,
14787        /// the monitored resource type must be `servicedirectory_service`.
14788        VpcCheckers,
14789        /// If set, the enum was initialized with an unknown value.
14790        ///
14791        /// Applications can examine the value using [CheckerType::value] or
14792        /// [CheckerType::name].
14793        UnknownValue(checker_type::UnknownValue),
14794    }
14795
14796    #[doc(hidden)]
14797    pub mod checker_type {
14798        #[allow(unused_imports)]
14799        use super::*;
14800        #[derive(Clone, Debug, PartialEq)]
14801        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14802    }
14803
14804    impl CheckerType {
14805        /// Gets the enum value.
14806        ///
14807        /// Returns `None` if the enum contains an unknown value deserialized from
14808        /// the string representation of enums.
14809        pub fn value(&self) -> std::option::Option<i32> {
14810            match self {
14811                Self::Unspecified => std::option::Option::Some(0),
14812                Self::StaticIpCheckers => std::option::Option::Some(1),
14813                Self::VpcCheckers => std::option::Option::Some(3),
14814                Self::UnknownValue(u) => u.0.value(),
14815            }
14816        }
14817
14818        /// Gets the enum value as a string.
14819        ///
14820        /// Returns `None` if the enum contains an unknown value deserialized from
14821        /// the integer representation of enums.
14822        pub fn name(&self) -> std::option::Option<&str> {
14823            match self {
14824                Self::Unspecified => std::option::Option::Some("CHECKER_TYPE_UNSPECIFIED"),
14825                Self::StaticIpCheckers => std::option::Option::Some("STATIC_IP_CHECKERS"),
14826                Self::VpcCheckers => std::option::Option::Some("VPC_CHECKERS"),
14827                Self::UnknownValue(u) => u.0.name(),
14828            }
14829        }
14830    }
14831
14832    impl std::default::Default for CheckerType {
14833        fn default() -> Self {
14834            use std::convert::From;
14835            Self::from(0)
14836        }
14837    }
14838
14839    impl std::fmt::Display for CheckerType {
14840        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14841            wkt::internal::display_enum(f, self.name(), self.value())
14842        }
14843    }
14844
14845    impl std::convert::From<i32> for CheckerType {
14846        fn from(value: i32) -> Self {
14847            match value {
14848                0 => Self::Unspecified,
14849                1 => Self::StaticIpCheckers,
14850                3 => Self::VpcCheckers,
14851                _ => Self::UnknownValue(checker_type::UnknownValue(
14852                    wkt::internal::UnknownEnumValue::Integer(value),
14853                )),
14854            }
14855        }
14856    }
14857
14858    impl std::convert::From<&str> for CheckerType {
14859        fn from(value: &str) -> Self {
14860            use std::string::ToString;
14861            match value {
14862                "CHECKER_TYPE_UNSPECIFIED" => Self::Unspecified,
14863                "STATIC_IP_CHECKERS" => Self::StaticIpCheckers,
14864                "VPC_CHECKERS" => Self::VpcCheckers,
14865                _ => Self::UnknownValue(checker_type::UnknownValue(
14866                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14867                )),
14868            }
14869        }
14870    }
14871
14872    impl serde::ser::Serialize for CheckerType {
14873        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14874        where
14875            S: serde::Serializer,
14876        {
14877            match self {
14878                Self::Unspecified => serializer.serialize_i32(0),
14879                Self::StaticIpCheckers => serializer.serialize_i32(1),
14880                Self::VpcCheckers => serializer.serialize_i32(3),
14881                Self::UnknownValue(u) => u.0.serialize(serializer),
14882            }
14883        }
14884    }
14885
14886    impl<'de> serde::de::Deserialize<'de> for CheckerType {
14887        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14888        where
14889            D: serde::Deserializer<'de>,
14890        {
14891            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CheckerType>::new(
14892                ".google.monitoring.v3.UptimeCheckConfig.CheckerType",
14893            ))
14894        }
14895    }
14896
14897    /// The resource the check is checking. Required.
14898    #[derive(Clone, Debug, PartialEq)]
14899    #[non_exhaustive]
14900    pub enum Resource {
14901        /// The [monitored
14902        /// resource](https://cloud.google.com/monitoring/api/resources) associated
14903        /// with the configuration.
14904        /// The following monitored resource types are valid for this field:
14905        /// `uptime_url`,
14906        /// `gce_instance`,
14907        /// `gae_app`,
14908        /// `aws_ec2_instance`,
14909        /// `aws_elb_load_balancer`
14910        /// `k8s_service`
14911        /// `servicedirectory_service`
14912        /// `cloud_run_revision`
14913        MonitoredResource(std::boxed::Box<api::model::MonitoredResource>),
14914        /// The group resource associated with the configuration.
14915        ResourceGroup(std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>),
14916        /// Specifies a Synthetic Monitor to invoke.
14917        SyntheticMonitor(std::boxed::Box<crate::model::SyntheticMonitorTarget>),
14918    }
14919
14920    /// The type of Uptime check request.
14921    #[derive(Clone, Debug, PartialEq)]
14922    #[non_exhaustive]
14923    pub enum CheckRequestType {
14924        /// Contains information needed to make an HTTP or HTTPS check.
14925        HttpCheck(std::boxed::Box<crate::model::uptime_check_config::HttpCheck>),
14926        /// Contains information needed to make a TCP check.
14927        TcpCheck(std::boxed::Box<crate::model::uptime_check_config::TcpCheck>),
14928    }
14929}
14930
14931/// Contains the region, location, and list of IP
14932/// addresses where checkers in the location run from.
14933#[derive(Clone, Default, PartialEq)]
14934#[non_exhaustive]
14935pub struct UptimeCheckIp {
14936    /// A broad region category in which the IP address is located.
14937    pub region: crate::model::UptimeCheckRegion,
14938
14939    /// A more specific location within the region that typically encodes
14940    /// a particular city/town/metro (and its containing state/province or country)
14941    /// within the broader umbrella region category.
14942    pub location: std::string::String,
14943
14944    /// The IP address from which the Uptime check originates. This is a fully
14945    /// specified IP address (not an IP address range). Most IP addresses, as of
14946    /// this publication, are in IPv4 format; however, one should not rely on the
14947    /// IP addresses being in IPv4 format indefinitely, and should support
14948    /// interpreting this field in either IPv4 or IPv6 format.
14949    pub ip_address: std::string::String,
14950
14951    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14952}
14953
14954impl UptimeCheckIp {
14955    pub fn new() -> Self {
14956        std::default::Default::default()
14957    }
14958
14959    /// Sets the value of [region][crate::model::UptimeCheckIp::region].
14960    pub fn set_region<T: std::convert::Into<crate::model::UptimeCheckRegion>>(
14961        mut self,
14962        v: T,
14963    ) -> Self {
14964        self.region = v.into();
14965        self
14966    }
14967
14968    /// Sets the value of [location][crate::model::UptimeCheckIp::location].
14969    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14970        self.location = v.into();
14971        self
14972    }
14973
14974    /// Sets the value of [ip_address][crate::model::UptimeCheckIp::ip_address].
14975    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14976        self.ip_address = v.into();
14977        self
14978    }
14979}
14980
14981impl wkt::message::Message for UptimeCheckIp {
14982    fn typename() -> &'static str {
14983        "type.googleapis.com/google.monitoring.v3.UptimeCheckIp"
14984    }
14985}
14986
14987/// The protocol for the `ListUptimeCheckConfigs` request.
14988#[derive(Clone, Default, PartialEq)]
14989#[non_exhaustive]
14990pub struct ListUptimeCheckConfigsRequest {
14991    /// Required. The
14992    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
14993    /// Uptime check configurations are listed. The format is:
14994    ///
14995    /// ```norust
14996    /// projects/[PROJECT_ID_OR_NUMBER]
14997    /// ```
14998    pub parent: std::string::String,
14999
15000    /// If provided, this field specifies the criteria that must be met by
15001    /// uptime checks to be included in the response.
15002    ///
15003    /// For more details, see [Filtering
15004    /// syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax).
15005    pub filter: std::string::String,
15006
15007    /// The maximum number of results to return in a single response. The server
15008    /// may further constrain the maximum number of results returned in a single
15009    /// page. If the page_size is <=0, the server will decide the number of results
15010    /// to be returned.
15011    pub page_size: i32,
15012
15013    /// If this field is not empty then it must contain the `nextPageToken` value
15014    /// returned by a previous call to this method.  Using this field causes the
15015    /// method to return more results from the previous method call.
15016    pub page_token: std::string::String,
15017
15018    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15019}
15020
15021impl ListUptimeCheckConfigsRequest {
15022    pub fn new() -> Self {
15023        std::default::Default::default()
15024    }
15025
15026    /// Sets the value of [parent][crate::model::ListUptimeCheckConfigsRequest::parent].
15027    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15028        self.parent = v.into();
15029        self
15030    }
15031
15032    /// Sets the value of [filter][crate::model::ListUptimeCheckConfigsRequest::filter].
15033    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15034        self.filter = v.into();
15035        self
15036    }
15037
15038    /// Sets the value of [page_size][crate::model::ListUptimeCheckConfigsRequest::page_size].
15039    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15040        self.page_size = v.into();
15041        self
15042    }
15043
15044    /// Sets the value of [page_token][crate::model::ListUptimeCheckConfigsRequest::page_token].
15045    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15046        self.page_token = v.into();
15047        self
15048    }
15049}
15050
15051impl wkt::message::Message for ListUptimeCheckConfigsRequest {
15052    fn typename() -> &'static str {
15053        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckConfigsRequest"
15054    }
15055}
15056
15057/// The protocol for the `ListUptimeCheckConfigs` response.
15058#[derive(Clone, Default, PartialEq)]
15059#[non_exhaustive]
15060pub struct ListUptimeCheckConfigsResponse {
15061    /// The returned Uptime check configurations.
15062    pub uptime_check_configs: std::vec::Vec<crate::model::UptimeCheckConfig>,
15063
15064    /// This field represents the pagination token to retrieve the next page of
15065    /// results. If the value is empty, it means no further results for the
15066    /// request. To retrieve the next page of results, the value of the
15067    /// next_page_token is passed to the subsequent List method call (in the
15068    /// request message's page_token field).
15069    pub next_page_token: std::string::String,
15070
15071    /// The total number of Uptime check configurations for the project,
15072    /// irrespective of any pagination.
15073    pub total_size: i32,
15074
15075    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15076}
15077
15078impl ListUptimeCheckConfigsResponse {
15079    pub fn new() -> Self {
15080        std::default::Default::default()
15081    }
15082
15083    /// Sets the value of [uptime_check_configs][crate::model::ListUptimeCheckConfigsResponse::uptime_check_configs].
15084    pub fn set_uptime_check_configs<T, V>(mut self, v: T) -> Self
15085    where
15086        T: std::iter::IntoIterator<Item = V>,
15087        V: std::convert::Into<crate::model::UptimeCheckConfig>,
15088    {
15089        use std::iter::Iterator;
15090        self.uptime_check_configs = v.into_iter().map(|i| i.into()).collect();
15091        self
15092    }
15093
15094    /// Sets the value of [next_page_token][crate::model::ListUptimeCheckConfigsResponse::next_page_token].
15095    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15096        self.next_page_token = v.into();
15097        self
15098    }
15099
15100    /// Sets the value of [total_size][crate::model::ListUptimeCheckConfigsResponse::total_size].
15101    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15102        self.total_size = v.into();
15103        self
15104    }
15105}
15106
15107impl wkt::message::Message for ListUptimeCheckConfigsResponse {
15108    fn typename() -> &'static str {
15109        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckConfigsResponse"
15110    }
15111}
15112
15113#[doc(hidden)]
15114impl gax::paginator::internal::PageableResponse for ListUptimeCheckConfigsResponse {
15115    type PageItem = crate::model::UptimeCheckConfig;
15116
15117    fn items(self) -> std::vec::Vec<Self::PageItem> {
15118        self.uptime_check_configs
15119    }
15120
15121    fn next_page_token(&self) -> std::string::String {
15122        use std::clone::Clone;
15123        self.next_page_token.clone()
15124    }
15125}
15126
15127/// The protocol for the `GetUptimeCheckConfig` request.
15128#[derive(Clone, Default, PartialEq)]
15129#[non_exhaustive]
15130pub struct GetUptimeCheckConfigRequest {
15131    /// Required. The Uptime check configuration to retrieve. The format is:
15132    ///
15133    /// ```norust
15134    /// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
15135    /// ```
15136    pub name: std::string::String,
15137
15138    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15139}
15140
15141impl GetUptimeCheckConfigRequest {
15142    pub fn new() -> Self {
15143        std::default::Default::default()
15144    }
15145
15146    /// Sets the value of [name][crate::model::GetUptimeCheckConfigRequest::name].
15147    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15148        self.name = v.into();
15149        self
15150    }
15151}
15152
15153impl wkt::message::Message for GetUptimeCheckConfigRequest {
15154    fn typename() -> &'static str {
15155        "type.googleapis.com/google.monitoring.v3.GetUptimeCheckConfigRequest"
15156    }
15157}
15158
15159/// The protocol for the `CreateUptimeCheckConfig` request.
15160#[derive(Clone, Default, PartialEq)]
15161#[non_exhaustive]
15162pub struct CreateUptimeCheckConfigRequest {
15163    /// Required. The
15164    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
15165    /// to create the Uptime check. The format is:
15166    ///
15167    /// ```norust
15168    /// projects/[PROJECT_ID_OR_NUMBER]
15169    /// ```
15170    pub parent: std::string::String,
15171
15172    /// Required. The new Uptime check configuration.
15173    pub uptime_check_config: std::option::Option<crate::model::UptimeCheckConfig>,
15174
15175    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15176}
15177
15178impl CreateUptimeCheckConfigRequest {
15179    pub fn new() -> Self {
15180        std::default::Default::default()
15181    }
15182
15183    /// Sets the value of [parent][crate::model::CreateUptimeCheckConfigRequest::parent].
15184    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15185        self.parent = v.into();
15186        self
15187    }
15188
15189    /// Sets the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
15190    pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
15191    where
15192        T: std::convert::Into<crate::model::UptimeCheckConfig>,
15193    {
15194        self.uptime_check_config = std::option::Option::Some(v.into());
15195        self
15196    }
15197
15198    /// Sets or clears the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
15199    pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
15200    where
15201        T: std::convert::Into<crate::model::UptimeCheckConfig>,
15202    {
15203        self.uptime_check_config = v.map(|x| x.into());
15204        self
15205    }
15206}
15207
15208impl wkt::message::Message for CreateUptimeCheckConfigRequest {
15209    fn typename() -> &'static str {
15210        "type.googleapis.com/google.monitoring.v3.CreateUptimeCheckConfigRequest"
15211    }
15212}
15213
15214/// The protocol for the `UpdateUptimeCheckConfig` request.
15215#[derive(Clone, Default, PartialEq)]
15216#[non_exhaustive]
15217pub struct UpdateUptimeCheckConfigRequest {
15218    /// Optional. If present, only the listed fields in the current Uptime check
15219    /// configuration are updated with values from the new configuration. If this
15220    /// field is empty, then the current configuration is completely replaced with
15221    /// the new configuration.
15222    pub update_mask: std::option::Option<wkt::FieldMask>,
15223
15224    /// Required. If an `updateMask` has been specified, this field gives
15225    /// the values for the set of fields mentioned in the `updateMask`. If an
15226    /// `updateMask` has not been given, this Uptime check configuration replaces
15227    /// the current configuration. If a field is mentioned in `updateMask` but
15228    /// the corresponding field is omitted in this partial Uptime check
15229    /// configuration, it has the effect of deleting/clearing the field from the
15230    /// configuration on the server.
15231    ///
15232    /// The following fields can be updated: `display_name`,
15233    /// `http_check`, `tcp_check`, `timeout`, `content_matchers`, and
15234    /// `selected_regions`.
15235    pub uptime_check_config: std::option::Option<crate::model::UptimeCheckConfig>,
15236
15237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15238}
15239
15240impl UpdateUptimeCheckConfigRequest {
15241    pub fn new() -> Self {
15242        std::default::Default::default()
15243    }
15244
15245    /// Sets the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
15246    pub fn set_update_mask<T>(mut self, v: T) -> Self
15247    where
15248        T: std::convert::Into<wkt::FieldMask>,
15249    {
15250        self.update_mask = std::option::Option::Some(v.into());
15251        self
15252    }
15253
15254    /// Sets or clears the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
15255    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15256    where
15257        T: std::convert::Into<wkt::FieldMask>,
15258    {
15259        self.update_mask = v.map(|x| x.into());
15260        self
15261    }
15262
15263    /// Sets the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
15264    pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
15265    where
15266        T: std::convert::Into<crate::model::UptimeCheckConfig>,
15267    {
15268        self.uptime_check_config = std::option::Option::Some(v.into());
15269        self
15270    }
15271
15272    /// Sets or clears the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
15273    pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
15274    where
15275        T: std::convert::Into<crate::model::UptimeCheckConfig>,
15276    {
15277        self.uptime_check_config = v.map(|x| x.into());
15278        self
15279    }
15280}
15281
15282impl wkt::message::Message for UpdateUptimeCheckConfigRequest {
15283    fn typename() -> &'static str {
15284        "type.googleapis.com/google.monitoring.v3.UpdateUptimeCheckConfigRequest"
15285    }
15286}
15287
15288/// The protocol for the `DeleteUptimeCheckConfig` request.
15289#[derive(Clone, Default, PartialEq)]
15290#[non_exhaustive]
15291pub struct DeleteUptimeCheckConfigRequest {
15292    /// Required. The Uptime check configuration to delete. The format is:
15293    ///
15294    /// ```norust
15295    /// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
15296    /// ```
15297    pub name: std::string::String,
15298
15299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15300}
15301
15302impl DeleteUptimeCheckConfigRequest {
15303    pub fn new() -> Self {
15304        std::default::Default::default()
15305    }
15306
15307    /// Sets the value of [name][crate::model::DeleteUptimeCheckConfigRequest::name].
15308    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15309        self.name = v.into();
15310        self
15311    }
15312}
15313
15314impl wkt::message::Message for DeleteUptimeCheckConfigRequest {
15315    fn typename() -> &'static str {
15316        "type.googleapis.com/google.monitoring.v3.DeleteUptimeCheckConfigRequest"
15317    }
15318}
15319
15320/// The protocol for the `ListUptimeCheckIps` request.
15321#[derive(Clone, Default, PartialEq)]
15322#[non_exhaustive]
15323pub struct ListUptimeCheckIpsRequest {
15324    /// The maximum number of results to return in a single response. The server
15325    /// may further constrain the maximum number of results returned in a single
15326    /// page. If the page_size is <=0, the server will decide the number of results
15327    /// to be returned.
15328    /// NOTE: this field is not yet implemented
15329    pub page_size: i32,
15330
15331    /// If this field is not empty then it must contain the `nextPageToken` value
15332    /// returned by a previous call to this method.  Using this field causes the
15333    /// method to return more results from the previous method call.
15334    /// NOTE: this field is not yet implemented
15335    pub page_token: std::string::String,
15336
15337    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15338}
15339
15340impl ListUptimeCheckIpsRequest {
15341    pub fn new() -> Self {
15342        std::default::Default::default()
15343    }
15344
15345    /// Sets the value of [page_size][crate::model::ListUptimeCheckIpsRequest::page_size].
15346    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15347        self.page_size = v.into();
15348        self
15349    }
15350
15351    /// Sets the value of [page_token][crate::model::ListUptimeCheckIpsRequest::page_token].
15352    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15353        self.page_token = v.into();
15354        self
15355    }
15356}
15357
15358impl wkt::message::Message for ListUptimeCheckIpsRequest {
15359    fn typename() -> &'static str {
15360        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckIpsRequest"
15361    }
15362}
15363
15364/// The protocol for the `ListUptimeCheckIps` response.
15365#[derive(Clone, Default, PartialEq)]
15366#[non_exhaustive]
15367pub struct ListUptimeCheckIpsResponse {
15368    /// The returned list of IP addresses (including region and location) that the
15369    /// checkers run from.
15370    pub uptime_check_ips: std::vec::Vec<crate::model::UptimeCheckIp>,
15371
15372    /// This field represents the pagination token to retrieve the next page of
15373    /// results. If the value is empty, it means no further results for the
15374    /// request. To retrieve the next page of results, the value of the
15375    /// next_page_token is passed to the subsequent List method call (in the
15376    /// request message's page_token field).
15377    /// NOTE: this field is not yet implemented
15378    pub next_page_token: std::string::String,
15379
15380    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15381}
15382
15383impl ListUptimeCheckIpsResponse {
15384    pub fn new() -> Self {
15385        std::default::Default::default()
15386    }
15387
15388    /// Sets the value of [uptime_check_ips][crate::model::ListUptimeCheckIpsResponse::uptime_check_ips].
15389    pub fn set_uptime_check_ips<T, V>(mut self, v: T) -> Self
15390    where
15391        T: std::iter::IntoIterator<Item = V>,
15392        V: std::convert::Into<crate::model::UptimeCheckIp>,
15393    {
15394        use std::iter::Iterator;
15395        self.uptime_check_ips = v.into_iter().map(|i| i.into()).collect();
15396        self
15397    }
15398
15399    /// Sets the value of [next_page_token][crate::model::ListUptimeCheckIpsResponse::next_page_token].
15400    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15401        self.next_page_token = v.into();
15402        self
15403    }
15404}
15405
15406impl wkt::message::Message for ListUptimeCheckIpsResponse {
15407    fn typename() -> &'static str {
15408        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckIpsResponse"
15409    }
15410}
15411
15412#[doc(hidden)]
15413impl gax::paginator::internal::PageableResponse for ListUptimeCheckIpsResponse {
15414    type PageItem = crate::model::UptimeCheckIp;
15415
15416    fn items(self) -> std::vec::Vec<Self::PageItem> {
15417        self.uptime_check_ips
15418    }
15419
15420    fn next_page_token(&self) -> std::string::String {
15421        use std::clone::Clone;
15422        self.next_page_token.clone()
15423    }
15424}
15425
15426/// Specifies an ordering relationship on two arguments, called `left` and
15427/// `right`.
15428///
15429/// # Working with unknown values
15430///
15431/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15432/// additional enum variants at any time. Adding new variants is not considered
15433/// a breaking change. Applications should write their code in anticipation of:
15434///
15435/// - New values appearing in future releases of the client library, **and**
15436/// - New values received dynamically, without application changes.
15437///
15438/// Please consult the [Working with enums] section in the user guide for some
15439/// guidelines.
15440///
15441/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15442#[derive(Clone, Debug, PartialEq)]
15443#[non_exhaustive]
15444pub enum ComparisonType {
15445    /// No ordering relationship is specified.
15446    ComparisonUnspecified,
15447    /// True if the left argument is greater than the right argument.
15448    ComparisonGt,
15449    /// True if the left argument is greater than or equal to the right argument.
15450    ComparisonGe,
15451    /// True if the left argument is less than the right argument.
15452    ComparisonLt,
15453    /// True if the left argument is less than or equal to the right argument.
15454    ComparisonLe,
15455    /// True if the left argument is equal to the right argument.
15456    ComparisonEq,
15457    /// True if the left argument is not equal to the right argument.
15458    ComparisonNe,
15459    /// If set, the enum was initialized with an unknown value.
15460    ///
15461    /// Applications can examine the value using [ComparisonType::value] or
15462    /// [ComparisonType::name].
15463    UnknownValue(comparison_type::UnknownValue),
15464}
15465
15466#[doc(hidden)]
15467pub mod comparison_type {
15468    #[allow(unused_imports)]
15469    use super::*;
15470    #[derive(Clone, Debug, PartialEq)]
15471    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15472}
15473
15474impl ComparisonType {
15475    /// Gets the enum value.
15476    ///
15477    /// Returns `None` if the enum contains an unknown value deserialized from
15478    /// the string representation of enums.
15479    pub fn value(&self) -> std::option::Option<i32> {
15480        match self {
15481            Self::ComparisonUnspecified => std::option::Option::Some(0),
15482            Self::ComparisonGt => std::option::Option::Some(1),
15483            Self::ComparisonGe => std::option::Option::Some(2),
15484            Self::ComparisonLt => std::option::Option::Some(3),
15485            Self::ComparisonLe => std::option::Option::Some(4),
15486            Self::ComparisonEq => std::option::Option::Some(5),
15487            Self::ComparisonNe => std::option::Option::Some(6),
15488            Self::UnknownValue(u) => u.0.value(),
15489        }
15490    }
15491
15492    /// Gets the enum value as a string.
15493    ///
15494    /// Returns `None` if the enum contains an unknown value deserialized from
15495    /// the integer representation of enums.
15496    pub fn name(&self) -> std::option::Option<&str> {
15497        match self {
15498            Self::ComparisonUnspecified => std::option::Option::Some("COMPARISON_UNSPECIFIED"),
15499            Self::ComparisonGt => std::option::Option::Some("COMPARISON_GT"),
15500            Self::ComparisonGe => std::option::Option::Some("COMPARISON_GE"),
15501            Self::ComparisonLt => std::option::Option::Some("COMPARISON_LT"),
15502            Self::ComparisonLe => std::option::Option::Some("COMPARISON_LE"),
15503            Self::ComparisonEq => std::option::Option::Some("COMPARISON_EQ"),
15504            Self::ComparisonNe => std::option::Option::Some("COMPARISON_NE"),
15505            Self::UnknownValue(u) => u.0.name(),
15506        }
15507    }
15508}
15509
15510impl std::default::Default for ComparisonType {
15511    fn default() -> Self {
15512        use std::convert::From;
15513        Self::from(0)
15514    }
15515}
15516
15517impl std::fmt::Display for ComparisonType {
15518    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15519        wkt::internal::display_enum(f, self.name(), self.value())
15520    }
15521}
15522
15523impl std::convert::From<i32> for ComparisonType {
15524    fn from(value: i32) -> Self {
15525        match value {
15526            0 => Self::ComparisonUnspecified,
15527            1 => Self::ComparisonGt,
15528            2 => Self::ComparisonGe,
15529            3 => Self::ComparisonLt,
15530            4 => Self::ComparisonLe,
15531            5 => Self::ComparisonEq,
15532            6 => Self::ComparisonNe,
15533            _ => Self::UnknownValue(comparison_type::UnknownValue(
15534                wkt::internal::UnknownEnumValue::Integer(value),
15535            )),
15536        }
15537    }
15538}
15539
15540impl std::convert::From<&str> for ComparisonType {
15541    fn from(value: &str) -> Self {
15542        use std::string::ToString;
15543        match value {
15544            "COMPARISON_UNSPECIFIED" => Self::ComparisonUnspecified,
15545            "COMPARISON_GT" => Self::ComparisonGt,
15546            "COMPARISON_GE" => Self::ComparisonGe,
15547            "COMPARISON_LT" => Self::ComparisonLt,
15548            "COMPARISON_LE" => Self::ComparisonLe,
15549            "COMPARISON_EQ" => Self::ComparisonEq,
15550            "COMPARISON_NE" => Self::ComparisonNe,
15551            _ => Self::UnknownValue(comparison_type::UnknownValue(
15552                wkt::internal::UnknownEnumValue::String(value.to_string()),
15553            )),
15554        }
15555    }
15556}
15557
15558impl serde::ser::Serialize for ComparisonType {
15559    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15560    where
15561        S: serde::Serializer,
15562    {
15563        match self {
15564            Self::ComparisonUnspecified => serializer.serialize_i32(0),
15565            Self::ComparisonGt => serializer.serialize_i32(1),
15566            Self::ComparisonGe => serializer.serialize_i32(2),
15567            Self::ComparisonLt => serializer.serialize_i32(3),
15568            Self::ComparisonLe => serializer.serialize_i32(4),
15569            Self::ComparisonEq => serializer.serialize_i32(5),
15570            Self::ComparisonNe => serializer.serialize_i32(6),
15571            Self::UnknownValue(u) => u.0.serialize(serializer),
15572        }
15573    }
15574}
15575
15576impl<'de> serde::de::Deserialize<'de> for ComparisonType {
15577    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15578    where
15579        D: serde::Deserializer<'de>,
15580    {
15581        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComparisonType>::new(
15582            ".google.monitoring.v3.ComparisonType",
15583        ))
15584    }
15585}
15586
15587/// The tier of service for a Metrics Scope. Please see the
15588/// [service tiers
15589/// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more
15590/// details.
15591///
15592/// # Working with unknown values
15593///
15594/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15595/// additional enum variants at any time. Adding new variants is not considered
15596/// a breaking change. Applications should write their code in anticipation of:
15597///
15598/// - New values appearing in future releases of the client library, **and**
15599/// - New values received dynamically, without application changes.
15600///
15601/// Please consult the [Working with enums] section in the user guide for some
15602/// guidelines.
15603///
15604/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15605#[derive(Clone, Debug, PartialEq)]
15606#[non_exhaustive]
15607#[deprecated]
15608pub enum ServiceTier {
15609    /// An invalid sentinel value, used to indicate that a tier has not
15610    /// been provided explicitly.
15611    Unspecified,
15612    /// The Cloud Monitoring Basic tier, a free tier of service that provides basic
15613    /// features, a moderate allotment of logs, and access to built-in metrics.
15614    /// A number of features are not available in this tier. For more details,
15615    /// see [the service tiers
15616    /// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
15617    Basic,
15618    /// The Cloud Monitoring Premium tier, a higher, more expensive tier of service
15619    /// that provides access to all Cloud Monitoring features, lets you use Cloud
15620    /// Monitoring with AWS accounts, and has a larger allotments for logs and
15621    /// metrics. For more details, see [the service tiers
15622    /// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
15623    Premium,
15624    /// If set, the enum was initialized with an unknown value.
15625    ///
15626    /// Applications can examine the value using [ServiceTier::value] or
15627    /// [ServiceTier::name].
15628    UnknownValue(service_tier::UnknownValue),
15629}
15630
15631#[doc(hidden)]
15632pub mod service_tier {
15633    #[allow(unused_imports)]
15634    use super::*;
15635    #[derive(Clone, Debug, PartialEq)]
15636    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15637}
15638
15639impl ServiceTier {
15640    /// Gets the enum value.
15641    ///
15642    /// Returns `None` if the enum contains an unknown value deserialized from
15643    /// the string representation of enums.
15644    pub fn value(&self) -> std::option::Option<i32> {
15645        match self {
15646            Self::Unspecified => std::option::Option::Some(0),
15647            Self::Basic => std::option::Option::Some(1),
15648            Self::Premium => std::option::Option::Some(2),
15649            Self::UnknownValue(u) => u.0.value(),
15650        }
15651    }
15652
15653    /// Gets the enum value as a string.
15654    ///
15655    /// Returns `None` if the enum contains an unknown value deserialized from
15656    /// the integer representation of enums.
15657    pub fn name(&self) -> std::option::Option<&str> {
15658        match self {
15659            Self::Unspecified => std::option::Option::Some("SERVICE_TIER_UNSPECIFIED"),
15660            Self::Basic => std::option::Option::Some("SERVICE_TIER_BASIC"),
15661            Self::Premium => std::option::Option::Some("SERVICE_TIER_PREMIUM"),
15662            Self::UnknownValue(u) => u.0.name(),
15663        }
15664    }
15665}
15666
15667impl std::default::Default for ServiceTier {
15668    fn default() -> Self {
15669        use std::convert::From;
15670        Self::from(0)
15671    }
15672}
15673
15674impl std::fmt::Display for ServiceTier {
15675    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15676        wkt::internal::display_enum(f, self.name(), self.value())
15677    }
15678}
15679
15680impl std::convert::From<i32> for ServiceTier {
15681    fn from(value: i32) -> Self {
15682        match value {
15683            0 => Self::Unspecified,
15684            1 => Self::Basic,
15685            2 => Self::Premium,
15686            _ => Self::UnknownValue(service_tier::UnknownValue(
15687                wkt::internal::UnknownEnumValue::Integer(value),
15688            )),
15689        }
15690    }
15691}
15692
15693impl std::convert::From<&str> for ServiceTier {
15694    fn from(value: &str) -> Self {
15695        use std::string::ToString;
15696        match value {
15697            "SERVICE_TIER_UNSPECIFIED" => Self::Unspecified,
15698            "SERVICE_TIER_BASIC" => Self::Basic,
15699            "SERVICE_TIER_PREMIUM" => Self::Premium,
15700            _ => Self::UnknownValue(service_tier::UnknownValue(
15701                wkt::internal::UnknownEnumValue::String(value.to_string()),
15702            )),
15703        }
15704    }
15705}
15706
15707impl serde::ser::Serialize for ServiceTier {
15708    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15709    where
15710        S: serde::Serializer,
15711    {
15712        match self {
15713            Self::Unspecified => serializer.serialize_i32(0),
15714            Self::Basic => serializer.serialize_i32(1),
15715            Self::Premium => serializer.serialize_i32(2),
15716            Self::UnknownValue(u) => u.0.serialize(serializer),
15717        }
15718    }
15719}
15720
15721impl<'de> serde::de::Deserialize<'de> for ServiceTier {
15722    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15723    where
15724        D: serde::Deserializer<'de>,
15725    {
15726        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceTier>::new(
15727            ".google.monitoring.v3.ServiceTier",
15728        ))
15729    }
15730}
15731
15732/// The regions from which an Uptime check can be run.
15733///
15734/// # Working with unknown values
15735///
15736/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15737/// additional enum variants at any time. Adding new variants is not considered
15738/// a breaking change. Applications should write their code in anticipation of:
15739///
15740/// - New values appearing in future releases of the client library, **and**
15741/// - New values received dynamically, without application changes.
15742///
15743/// Please consult the [Working with enums] section in the user guide for some
15744/// guidelines.
15745///
15746/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15747#[derive(Clone, Debug, PartialEq)]
15748#[non_exhaustive]
15749pub enum UptimeCheckRegion {
15750    /// Default value if no region is specified. Will result in Uptime checks
15751    /// running from all regions.
15752    RegionUnspecified,
15753    /// Allows checks to run from locations within the United States of America.
15754    Usa,
15755    /// Allows checks to run from locations within the continent of Europe.
15756    Europe,
15757    /// Allows checks to run from locations within the continent of South
15758    /// America.
15759    SouthAmerica,
15760    /// Allows checks to run from locations within the Asia Pacific area (ex:
15761    /// Singapore).
15762    AsiaPacific,
15763    /// Allows checks to run from locations within the western United States of
15764    /// America
15765    UsaOregon,
15766    /// Allows checks to run from locations within the central United States of
15767    /// America
15768    UsaIowa,
15769    /// Allows checks to run from locations within the eastern United States of
15770    /// America
15771    UsaVirginia,
15772    /// If set, the enum was initialized with an unknown value.
15773    ///
15774    /// Applications can examine the value using [UptimeCheckRegion::value] or
15775    /// [UptimeCheckRegion::name].
15776    UnknownValue(uptime_check_region::UnknownValue),
15777}
15778
15779#[doc(hidden)]
15780pub mod uptime_check_region {
15781    #[allow(unused_imports)]
15782    use super::*;
15783    #[derive(Clone, Debug, PartialEq)]
15784    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15785}
15786
15787impl UptimeCheckRegion {
15788    /// Gets the enum value.
15789    ///
15790    /// Returns `None` if the enum contains an unknown value deserialized from
15791    /// the string representation of enums.
15792    pub fn value(&self) -> std::option::Option<i32> {
15793        match self {
15794            Self::RegionUnspecified => std::option::Option::Some(0),
15795            Self::Usa => std::option::Option::Some(1),
15796            Self::Europe => std::option::Option::Some(2),
15797            Self::SouthAmerica => std::option::Option::Some(3),
15798            Self::AsiaPacific => std::option::Option::Some(4),
15799            Self::UsaOregon => std::option::Option::Some(5),
15800            Self::UsaIowa => std::option::Option::Some(6),
15801            Self::UsaVirginia => std::option::Option::Some(7),
15802            Self::UnknownValue(u) => u.0.value(),
15803        }
15804    }
15805
15806    /// Gets the enum value as a string.
15807    ///
15808    /// Returns `None` if the enum contains an unknown value deserialized from
15809    /// the integer representation of enums.
15810    pub fn name(&self) -> std::option::Option<&str> {
15811        match self {
15812            Self::RegionUnspecified => std::option::Option::Some("REGION_UNSPECIFIED"),
15813            Self::Usa => std::option::Option::Some("USA"),
15814            Self::Europe => std::option::Option::Some("EUROPE"),
15815            Self::SouthAmerica => std::option::Option::Some("SOUTH_AMERICA"),
15816            Self::AsiaPacific => std::option::Option::Some("ASIA_PACIFIC"),
15817            Self::UsaOregon => std::option::Option::Some("USA_OREGON"),
15818            Self::UsaIowa => std::option::Option::Some("USA_IOWA"),
15819            Self::UsaVirginia => std::option::Option::Some("USA_VIRGINIA"),
15820            Self::UnknownValue(u) => u.0.name(),
15821        }
15822    }
15823}
15824
15825impl std::default::Default for UptimeCheckRegion {
15826    fn default() -> Self {
15827        use std::convert::From;
15828        Self::from(0)
15829    }
15830}
15831
15832impl std::fmt::Display for UptimeCheckRegion {
15833    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15834        wkt::internal::display_enum(f, self.name(), self.value())
15835    }
15836}
15837
15838impl std::convert::From<i32> for UptimeCheckRegion {
15839    fn from(value: i32) -> Self {
15840        match value {
15841            0 => Self::RegionUnspecified,
15842            1 => Self::Usa,
15843            2 => Self::Europe,
15844            3 => Self::SouthAmerica,
15845            4 => Self::AsiaPacific,
15846            5 => Self::UsaOregon,
15847            6 => Self::UsaIowa,
15848            7 => Self::UsaVirginia,
15849            _ => Self::UnknownValue(uptime_check_region::UnknownValue(
15850                wkt::internal::UnknownEnumValue::Integer(value),
15851            )),
15852        }
15853    }
15854}
15855
15856impl std::convert::From<&str> for UptimeCheckRegion {
15857    fn from(value: &str) -> Self {
15858        use std::string::ToString;
15859        match value {
15860            "REGION_UNSPECIFIED" => Self::RegionUnspecified,
15861            "USA" => Self::Usa,
15862            "EUROPE" => Self::Europe,
15863            "SOUTH_AMERICA" => Self::SouthAmerica,
15864            "ASIA_PACIFIC" => Self::AsiaPacific,
15865            "USA_OREGON" => Self::UsaOregon,
15866            "USA_IOWA" => Self::UsaIowa,
15867            "USA_VIRGINIA" => Self::UsaVirginia,
15868            _ => Self::UnknownValue(uptime_check_region::UnknownValue(
15869                wkt::internal::UnknownEnumValue::String(value.to_string()),
15870            )),
15871        }
15872    }
15873}
15874
15875impl serde::ser::Serialize for UptimeCheckRegion {
15876    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15877    where
15878        S: serde::Serializer,
15879    {
15880        match self {
15881            Self::RegionUnspecified => serializer.serialize_i32(0),
15882            Self::Usa => serializer.serialize_i32(1),
15883            Self::Europe => serializer.serialize_i32(2),
15884            Self::SouthAmerica => serializer.serialize_i32(3),
15885            Self::AsiaPacific => serializer.serialize_i32(4),
15886            Self::UsaOregon => serializer.serialize_i32(5),
15887            Self::UsaIowa => serializer.serialize_i32(6),
15888            Self::UsaVirginia => serializer.serialize_i32(7),
15889            Self::UnknownValue(u) => u.0.serialize(serializer),
15890        }
15891    }
15892}
15893
15894impl<'de> serde::de::Deserialize<'de> for UptimeCheckRegion {
15895    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15896    where
15897        D: serde::Deserializer<'de>,
15898    {
15899        deserializer.deserialize_any(wkt::internal::EnumVisitor::<UptimeCheckRegion>::new(
15900            ".google.monitoring.v3.UptimeCheckRegion",
15901        ))
15902    }
15903}
15904
15905/// The supported resource types that can be used as values of
15906/// `group_resource.resource_type`.
15907/// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
15908/// The resource types `gae_app` and `uptime_url` are not valid here because
15909/// group checks on App Engine modules and URLs are not allowed.
15910///
15911/// # Working with unknown values
15912///
15913/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15914/// additional enum variants at any time. Adding new variants is not considered
15915/// a breaking change. Applications should write their code in anticipation of:
15916///
15917/// - New values appearing in future releases of the client library, **and**
15918/// - New values received dynamically, without application changes.
15919///
15920/// Please consult the [Working with enums] section in the user guide for some
15921/// guidelines.
15922///
15923/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15924#[derive(Clone, Debug, PartialEq)]
15925#[non_exhaustive]
15926pub enum GroupResourceType {
15927    /// Default value (not valid).
15928    ResourceTypeUnspecified,
15929    /// A group of instances from Google Cloud Platform (GCP) or
15930    /// Amazon Web Services (AWS).
15931    Instance,
15932    /// A group of Amazon ELB load balancers.
15933    AwsElbLoadBalancer,
15934    /// If set, the enum was initialized with an unknown value.
15935    ///
15936    /// Applications can examine the value using [GroupResourceType::value] or
15937    /// [GroupResourceType::name].
15938    UnknownValue(group_resource_type::UnknownValue),
15939}
15940
15941#[doc(hidden)]
15942pub mod group_resource_type {
15943    #[allow(unused_imports)]
15944    use super::*;
15945    #[derive(Clone, Debug, PartialEq)]
15946    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15947}
15948
15949impl GroupResourceType {
15950    /// Gets the enum value.
15951    ///
15952    /// Returns `None` if the enum contains an unknown value deserialized from
15953    /// the string representation of enums.
15954    pub fn value(&self) -> std::option::Option<i32> {
15955        match self {
15956            Self::ResourceTypeUnspecified => std::option::Option::Some(0),
15957            Self::Instance => std::option::Option::Some(1),
15958            Self::AwsElbLoadBalancer => std::option::Option::Some(2),
15959            Self::UnknownValue(u) => u.0.value(),
15960        }
15961    }
15962
15963    /// Gets the enum value as a string.
15964    ///
15965    /// Returns `None` if the enum contains an unknown value deserialized from
15966    /// the integer representation of enums.
15967    pub fn name(&self) -> std::option::Option<&str> {
15968        match self {
15969            Self::ResourceTypeUnspecified => std::option::Option::Some("RESOURCE_TYPE_UNSPECIFIED"),
15970            Self::Instance => std::option::Option::Some("INSTANCE"),
15971            Self::AwsElbLoadBalancer => std::option::Option::Some("AWS_ELB_LOAD_BALANCER"),
15972            Self::UnknownValue(u) => u.0.name(),
15973        }
15974    }
15975}
15976
15977impl std::default::Default for GroupResourceType {
15978    fn default() -> Self {
15979        use std::convert::From;
15980        Self::from(0)
15981    }
15982}
15983
15984impl std::fmt::Display for GroupResourceType {
15985    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15986        wkt::internal::display_enum(f, self.name(), self.value())
15987    }
15988}
15989
15990impl std::convert::From<i32> for GroupResourceType {
15991    fn from(value: i32) -> Self {
15992        match value {
15993            0 => Self::ResourceTypeUnspecified,
15994            1 => Self::Instance,
15995            2 => Self::AwsElbLoadBalancer,
15996            _ => Self::UnknownValue(group_resource_type::UnknownValue(
15997                wkt::internal::UnknownEnumValue::Integer(value),
15998            )),
15999        }
16000    }
16001}
16002
16003impl std::convert::From<&str> for GroupResourceType {
16004    fn from(value: &str) -> Self {
16005        use std::string::ToString;
16006        match value {
16007            "RESOURCE_TYPE_UNSPECIFIED" => Self::ResourceTypeUnspecified,
16008            "INSTANCE" => Self::Instance,
16009            "AWS_ELB_LOAD_BALANCER" => Self::AwsElbLoadBalancer,
16010            _ => Self::UnknownValue(group_resource_type::UnknownValue(
16011                wkt::internal::UnknownEnumValue::String(value.to_string()),
16012            )),
16013        }
16014    }
16015}
16016
16017impl serde::ser::Serialize for GroupResourceType {
16018    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16019    where
16020        S: serde::Serializer,
16021    {
16022        match self {
16023            Self::ResourceTypeUnspecified => serializer.serialize_i32(0),
16024            Self::Instance => serializer.serialize_i32(1),
16025            Self::AwsElbLoadBalancer => serializer.serialize_i32(2),
16026            Self::UnknownValue(u) => u.0.serialize(serializer),
16027        }
16028    }
16029}
16030
16031impl<'de> serde::de::Deserialize<'de> for GroupResourceType {
16032    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16033    where
16034        D: serde::Deserializer<'de>,
16035    {
16036        deserializer.deserialize_any(wkt::internal::EnumVisitor::<GroupResourceType>::new(
16037            ".google.monitoring.v3.GroupResourceType",
16038        ))
16039    }
16040}