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    ///
168    /// # Example
169    /// ```ignore,no_run
170    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
171    /// let x = AlertPolicy::new().set_name("example");
172    /// ```
173    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
174        self.name = v.into();
175        self
176    }
177
178    /// Sets the value of [display_name][crate::model::AlertPolicy::display_name].
179    ///
180    /// # Example
181    /// ```ignore,no_run
182    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
183    /// let x = AlertPolicy::new().set_display_name("example");
184    /// ```
185    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
186        self.display_name = v.into();
187        self
188    }
189
190    /// Sets the value of [documentation][crate::model::AlertPolicy::documentation].
191    ///
192    /// # Example
193    /// ```ignore,no_run
194    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
195    /// use google_cloud_monitoring_v3::model::alert_policy::Documentation;
196    /// let x = AlertPolicy::new().set_documentation(Documentation::default()/* use setters */);
197    /// ```
198    pub fn set_documentation<T>(mut self, v: T) -> Self
199    where
200        T: std::convert::Into<crate::model::alert_policy::Documentation>,
201    {
202        self.documentation = std::option::Option::Some(v.into());
203        self
204    }
205
206    /// Sets or clears the value of [documentation][crate::model::AlertPolicy::documentation].
207    ///
208    /// # Example
209    /// ```ignore,no_run
210    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
211    /// use google_cloud_monitoring_v3::model::alert_policy::Documentation;
212    /// let x = AlertPolicy::new().set_or_clear_documentation(Some(Documentation::default()/* use setters */));
213    /// let x = AlertPolicy::new().set_or_clear_documentation(None::<Documentation>);
214    /// ```
215    pub fn set_or_clear_documentation<T>(mut self, v: std::option::Option<T>) -> Self
216    where
217        T: std::convert::Into<crate::model::alert_policy::Documentation>,
218    {
219        self.documentation = v.map(|x| x.into());
220        self
221    }
222
223    /// Sets the value of [user_labels][crate::model::AlertPolicy::user_labels].
224    ///
225    /// # Example
226    /// ```ignore,no_run
227    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
228    /// let x = AlertPolicy::new().set_user_labels([
229    ///     ("key0", "abc"),
230    ///     ("key1", "xyz"),
231    /// ]);
232    /// ```
233    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
234    where
235        T: std::iter::IntoIterator<Item = (K, V)>,
236        K: std::convert::Into<std::string::String>,
237        V: std::convert::Into<std::string::String>,
238    {
239        use std::iter::Iterator;
240        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
241        self
242    }
243
244    /// Sets the value of [conditions][crate::model::AlertPolicy::conditions].
245    ///
246    /// # Example
247    /// ```ignore,no_run
248    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
249    /// use google_cloud_monitoring_v3::model::alert_policy::Condition;
250    /// let x = AlertPolicy::new()
251    ///     .set_conditions([
252    ///         Condition::default()/* use setters */,
253    ///         Condition::default()/* use (different) setters */,
254    ///     ]);
255    /// ```
256    pub fn set_conditions<T, V>(mut self, v: T) -> Self
257    where
258        T: std::iter::IntoIterator<Item = V>,
259        V: std::convert::Into<crate::model::alert_policy::Condition>,
260    {
261        use std::iter::Iterator;
262        self.conditions = v.into_iter().map(|i| i.into()).collect();
263        self
264    }
265
266    /// Sets the value of [combiner][crate::model::AlertPolicy::combiner].
267    ///
268    /// # Example
269    /// ```ignore,no_run
270    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
271    /// use google_cloud_monitoring_v3::model::alert_policy::ConditionCombinerType;
272    /// let x0 = AlertPolicy::new().set_combiner(ConditionCombinerType::And);
273    /// let x1 = AlertPolicy::new().set_combiner(ConditionCombinerType::Or);
274    /// let x2 = AlertPolicy::new().set_combiner(ConditionCombinerType::AndWithMatchingResource);
275    /// ```
276    pub fn set_combiner<
277        T: std::convert::Into<crate::model::alert_policy::ConditionCombinerType>,
278    >(
279        mut self,
280        v: T,
281    ) -> Self {
282        self.combiner = v.into();
283        self
284    }
285
286    /// Sets the value of [enabled][crate::model::AlertPolicy::enabled].
287    ///
288    /// # Example
289    /// ```ignore,no_run
290    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
291    /// use wkt::BoolValue;
292    /// let x = AlertPolicy::new().set_enabled(BoolValue::default()/* use setters */);
293    /// ```
294    pub fn set_enabled<T>(mut self, v: T) -> Self
295    where
296        T: std::convert::Into<wkt::BoolValue>,
297    {
298        self.enabled = std::option::Option::Some(v.into());
299        self
300    }
301
302    /// Sets or clears the value of [enabled][crate::model::AlertPolicy::enabled].
303    ///
304    /// # Example
305    /// ```ignore,no_run
306    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
307    /// use wkt::BoolValue;
308    /// let x = AlertPolicy::new().set_or_clear_enabled(Some(BoolValue::default()/* use setters */));
309    /// let x = AlertPolicy::new().set_or_clear_enabled(None::<BoolValue>);
310    /// ```
311    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
312    where
313        T: std::convert::Into<wkt::BoolValue>,
314    {
315        self.enabled = v.map(|x| x.into());
316        self
317    }
318
319    /// Sets the value of [validity][crate::model::AlertPolicy::validity].
320    ///
321    /// # Example
322    /// ```ignore,no_run
323    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
324    /// use rpc::model::Status;
325    /// let x = AlertPolicy::new().set_validity(Status::default()/* use setters */);
326    /// ```
327    pub fn set_validity<T>(mut self, v: T) -> Self
328    where
329        T: std::convert::Into<rpc::model::Status>,
330    {
331        self.validity = std::option::Option::Some(v.into());
332        self
333    }
334
335    /// Sets or clears the value of [validity][crate::model::AlertPolicy::validity].
336    ///
337    /// # Example
338    /// ```ignore,no_run
339    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
340    /// use rpc::model::Status;
341    /// let x = AlertPolicy::new().set_or_clear_validity(Some(Status::default()/* use setters */));
342    /// let x = AlertPolicy::new().set_or_clear_validity(None::<Status>);
343    /// ```
344    pub fn set_or_clear_validity<T>(mut self, v: std::option::Option<T>) -> Self
345    where
346        T: std::convert::Into<rpc::model::Status>,
347    {
348        self.validity = v.map(|x| x.into());
349        self
350    }
351
352    /// Sets the value of [notification_channels][crate::model::AlertPolicy::notification_channels].
353    ///
354    /// # Example
355    /// ```ignore,no_run
356    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
357    /// let x = AlertPolicy::new().set_notification_channels(["a", "b", "c"]);
358    /// ```
359    pub fn set_notification_channels<T, V>(mut self, v: T) -> Self
360    where
361        T: std::iter::IntoIterator<Item = V>,
362        V: std::convert::Into<std::string::String>,
363    {
364        use std::iter::Iterator;
365        self.notification_channels = v.into_iter().map(|i| i.into()).collect();
366        self
367    }
368
369    /// Sets the value of [creation_record][crate::model::AlertPolicy::creation_record].
370    ///
371    /// # Example
372    /// ```ignore,no_run
373    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
374    /// use google_cloud_monitoring_v3::model::MutationRecord;
375    /// let x = AlertPolicy::new().set_creation_record(MutationRecord::default()/* use setters */);
376    /// ```
377    pub fn set_creation_record<T>(mut self, v: T) -> Self
378    where
379        T: std::convert::Into<crate::model::MutationRecord>,
380    {
381        self.creation_record = std::option::Option::Some(v.into());
382        self
383    }
384
385    /// Sets or clears the value of [creation_record][crate::model::AlertPolicy::creation_record].
386    ///
387    /// # Example
388    /// ```ignore,no_run
389    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
390    /// use google_cloud_monitoring_v3::model::MutationRecord;
391    /// let x = AlertPolicy::new().set_or_clear_creation_record(Some(MutationRecord::default()/* use setters */));
392    /// let x = AlertPolicy::new().set_or_clear_creation_record(None::<MutationRecord>);
393    /// ```
394    pub fn set_or_clear_creation_record<T>(mut self, v: std::option::Option<T>) -> Self
395    where
396        T: std::convert::Into<crate::model::MutationRecord>,
397    {
398        self.creation_record = v.map(|x| x.into());
399        self
400    }
401
402    /// Sets the value of [mutation_record][crate::model::AlertPolicy::mutation_record].
403    ///
404    /// # Example
405    /// ```ignore,no_run
406    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
407    /// use google_cloud_monitoring_v3::model::MutationRecord;
408    /// let x = AlertPolicy::new().set_mutation_record(MutationRecord::default()/* use setters */);
409    /// ```
410    pub fn set_mutation_record<T>(mut self, v: T) -> Self
411    where
412        T: std::convert::Into<crate::model::MutationRecord>,
413    {
414        self.mutation_record = std::option::Option::Some(v.into());
415        self
416    }
417
418    /// Sets or clears the value of [mutation_record][crate::model::AlertPolicy::mutation_record].
419    ///
420    /// # Example
421    /// ```ignore,no_run
422    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
423    /// use google_cloud_monitoring_v3::model::MutationRecord;
424    /// let x = AlertPolicy::new().set_or_clear_mutation_record(Some(MutationRecord::default()/* use setters */));
425    /// let x = AlertPolicy::new().set_or_clear_mutation_record(None::<MutationRecord>);
426    /// ```
427    pub fn set_or_clear_mutation_record<T>(mut self, v: std::option::Option<T>) -> Self
428    where
429        T: std::convert::Into<crate::model::MutationRecord>,
430    {
431        self.mutation_record = v.map(|x| x.into());
432        self
433    }
434
435    /// Sets the value of [alert_strategy][crate::model::AlertPolicy::alert_strategy].
436    ///
437    /// # Example
438    /// ```ignore,no_run
439    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
440    /// use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
441    /// let x = AlertPolicy::new().set_alert_strategy(AlertStrategy::default()/* use setters */);
442    /// ```
443    pub fn set_alert_strategy<T>(mut self, v: T) -> Self
444    where
445        T: std::convert::Into<crate::model::alert_policy::AlertStrategy>,
446    {
447        self.alert_strategy = std::option::Option::Some(v.into());
448        self
449    }
450
451    /// Sets or clears the value of [alert_strategy][crate::model::AlertPolicy::alert_strategy].
452    ///
453    /// # Example
454    /// ```ignore,no_run
455    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
456    /// use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
457    /// let x = AlertPolicy::new().set_or_clear_alert_strategy(Some(AlertStrategy::default()/* use setters */));
458    /// let x = AlertPolicy::new().set_or_clear_alert_strategy(None::<AlertStrategy>);
459    /// ```
460    pub fn set_or_clear_alert_strategy<T>(mut self, v: std::option::Option<T>) -> Self
461    where
462        T: std::convert::Into<crate::model::alert_policy::AlertStrategy>,
463    {
464        self.alert_strategy = v.map(|x| x.into());
465        self
466    }
467
468    /// Sets the value of [severity][crate::model::AlertPolicy::severity].
469    ///
470    /// # Example
471    /// ```ignore,no_run
472    /// # use google_cloud_monitoring_v3::model::AlertPolicy;
473    /// use google_cloud_monitoring_v3::model::alert_policy::Severity;
474    /// let x0 = AlertPolicy::new().set_severity(Severity::Critical);
475    /// let x1 = AlertPolicy::new().set_severity(Severity::Error);
476    /// let x2 = AlertPolicy::new().set_severity(Severity::Warning);
477    /// ```
478    pub fn set_severity<T: std::convert::Into<crate::model::alert_policy::Severity>>(
479        mut self,
480        v: T,
481    ) -> Self {
482        self.severity = v.into();
483        self
484    }
485}
486
487impl wkt::message::Message for AlertPolicy {
488    fn typename() -> &'static str {
489        "type.googleapis.com/google.monitoring.v3.AlertPolicy"
490    }
491}
492
493/// Defines additional types related to [AlertPolicy].
494pub mod alert_policy {
495    #[allow(unused_imports)]
496    use super::*;
497
498    /// Documentation that is included in the notifications and incidents
499    /// pertaining to this policy.
500    #[derive(Clone, Default, PartialEq)]
501    #[non_exhaustive]
502    pub struct Documentation {
503        /// The body of the documentation, interpreted according to `mime_type`.
504        /// The content may not exceed 8,192 Unicode characters and may not exceed
505        /// more than 10,240 bytes when encoded in UTF-8 format, whichever is
506        /// smaller. This text can be [templatized by using
507        /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
508        pub content: std::string::String,
509
510        /// The format of the `content` field. Presently, only the value
511        /// `"text/markdown"` is supported. See
512        /// [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
513        pub mime_type: std::string::String,
514
515        /// Optional. The subject line of the notification. The subject line may not
516        /// exceed 10,240 bytes. In notifications generated by this policy, the
517        /// contents of the subject line after variable expansion will be truncated
518        /// to 255 bytes or shorter at the latest UTF-8 character boundary. The
519        /// 255-byte limit is recommended by [this
520        /// thread](https://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit).
521        /// It is both the limit imposed by some third-party ticketing products and
522        /// it is common to define textual fields in databases as VARCHAR(255).
523        ///
524        /// The contents of the subject line can be [templatized by using
525        /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
526        /// If this field is missing or empty, a default subject line will be
527        /// generated.
528        pub subject: std::string::String,
529
530        /// Optional. Links to content such as playbooks, repositories, and other
531        /// resources. This field can contain up to 3 entries.
532        pub links: std::vec::Vec<crate::model::alert_policy::documentation::Link>,
533
534        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
535    }
536
537    impl Documentation {
538        pub fn new() -> Self {
539            std::default::Default::default()
540        }
541
542        /// Sets the value of [content][crate::model::alert_policy::Documentation::content].
543        ///
544        /// # Example
545        /// ```ignore,no_run
546        /// # use google_cloud_monitoring_v3::model::alert_policy::Documentation;
547        /// let x = Documentation::new().set_content("example");
548        /// ```
549        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
550            self.content = v.into();
551            self
552        }
553
554        /// Sets the value of [mime_type][crate::model::alert_policy::Documentation::mime_type].
555        ///
556        /// # Example
557        /// ```ignore,no_run
558        /// # use google_cloud_monitoring_v3::model::alert_policy::Documentation;
559        /// let x = Documentation::new().set_mime_type("example");
560        /// ```
561        pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
562            self.mime_type = v.into();
563            self
564        }
565
566        /// Sets the value of [subject][crate::model::alert_policy::Documentation::subject].
567        ///
568        /// # Example
569        /// ```ignore,no_run
570        /// # use google_cloud_monitoring_v3::model::alert_policy::Documentation;
571        /// let x = Documentation::new().set_subject("example");
572        /// ```
573        pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
574            self.subject = v.into();
575            self
576        }
577
578        /// Sets the value of [links][crate::model::alert_policy::Documentation::links].
579        ///
580        /// # Example
581        /// ```ignore,no_run
582        /// # use google_cloud_monitoring_v3::model::alert_policy::Documentation;
583        /// use google_cloud_monitoring_v3::model::alert_policy::documentation::Link;
584        /// let x = Documentation::new()
585        ///     .set_links([
586        ///         Link::default()/* use setters */,
587        ///         Link::default()/* use (different) setters */,
588        ///     ]);
589        /// ```
590        pub fn set_links<T, V>(mut self, v: T) -> Self
591        where
592            T: std::iter::IntoIterator<Item = V>,
593            V: std::convert::Into<crate::model::alert_policy::documentation::Link>,
594        {
595            use std::iter::Iterator;
596            self.links = v.into_iter().map(|i| i.into()).collect();
597            self
598        }
599    }
600
601    impl wkt::message::Message for Documentation {
602        fn typename() -> &'static str {
603            "type.googleapis.com/google.monitoring.v3.AlertPolicy.Documentation"
604        }
605    }
606
607    /// Defines additional types related to [Documentation].
608    pub mod documentation {
609        #[allow(unused_imports)]
610        use super::*;
611
612        /// Links to content such as playbooks, repositories, and other resources.
613        #[derive(Clone, Default, PartialEq)]
614        #[non_exhaustive]
615        pub struct Link {
616            /// A short display name for the link. The display name must not be empty
617            /// or exceed 63 characters. Example: "playbook".
618            pub display_name: std::string::String,
619
620            /// The url of a webpage.
621            /// A url can be templatized by using variables
622            /// in the path or the query parameters. The total length of a URL should
623            /// not exceed 2083 characters before and after variable expansion.
624            /// Example: `https://my_domain.com/playbook?name=${resource.name}`
625            pub url: std::string::String,
626
627            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
628        }
629
630        impl Link {
631            pub fn new() -> Self {
632                std::default::Default::default()
633            }
634
635            /// Sets the value of [display_name][crate::model::alert_policy::documentation::Link::display_name].
636            ///
637            /// # Example
638            /// ```ignore,no_run
639            /// # use google_cloud_monitoring_v3::model::alert_policy::documentation::Link;
640            /// let x = Link::new().set_display_name("example");
641            /// ```
642            pub fn set_display_name<T: std::convert::Into<std::string::String>>(
643                mut self,
644                v: T,
645            ) -> Self {
646                self.display_name = v.into();
647                self
648            }
649
650            /// Sets the value of [url][crate::model::alert_policy::documentation::Link::url].
651            ///
652            /// # Example
653            /// ```ignore,no_run
654            /// # use google_cloud_monitoring_v3::model::alert_policy::documentation::Link;
655            /// let x = Link::new().set_url("example");
656            /// ```
657            pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
658                self.url = v.into();
659                self
660            }
661        }
662
663        impl wkt::message::Message for Link {
664            fn typename() -> &'static str {
665                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Documentation.Link"
666            }
667        }
668    }
669
670    /// A condition is a true/false test that determines when an alerting policy
671    /// should open an incident. If a condition evaluates to true, it signifies
672    /// that something is wrong.
673    #[derive(Clone, Default, PartialEq)]
674    #[non_exhaustive]
675    pub struct Condition {
676        /// Required if the condition exists. The unique resource name for this
677        /// condition. Its format is:
678        ///
679        /// ```norust
680        /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
681        /// ```
682        ///
683        /// `[CONDITION_ID]` is assigned by Cloud Monitoring when the
684        /// condition is created as part of a new or updated alerting policy.
685        ///
686        /// When calling the
687        /// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
688        /// method, do not include the `name` field in the conditions of the
689        /// requested alerting policy. Cloud Monitoring creates the
690        /// condition identifiers and includes them in the new policy.
691        ///
692        /// When calling the
693        /// [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
694        /// method to update a policy, including a condition `name` causes the
695        /// existing condition to be updated. Conditions without names are added to
696        /// the updated policy. Existing conditions are deleted if they are not
697        /// updated.
698        ///
699        /// Best practice is to preserve `[CONDITION_ID]` if you make only small
700        /// changes, such as those to condition thresholds, durations, or trigger
701        /// values.  Otherwise, treat the change as a new condition and let the
702        /// existing condition be deleted.
703        ///
704        /// [google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]: crate::client::AlertPolicyService::create_alert_policy
705        /// [google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]: crate::client::AlertPolicyService::update_alert_policy
706        pub name: std::string::String,
707
708        /// A short name or phrase used to identify the condition in dashboards,
709        /// notifications, and incidents. To avoid confusion, don't use the same
710        /// display name for multiple conditions in the same policy.
711        pub display_name: std::string::String,
712
713        /// Only one of the following condition types will be specified.
714        pub condition: std::option::Option<crate::model::alert_policy::condition::Condition>,
715
716        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
717    }
718
719    impl Condition {
720        pub fn new() -> Self {
721            std::default::Default::default()
722        }
723
724        /// Sets the value of [name][crate::model::alert_policy::Condition::name].
725        ///
726        /// # Example
727        /// ```ignore,no_run
728        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
729        /// let x = Condition::new().set_name("example");
730        /// ```
731        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
732            self.name = v.into();
733            self
734        }
735
736        /// Sets the value of [display_name][crate::model::alert_policy::Condition::display_name].
737        ///
738        /// # Example
739        /// ```ignore,no_run
740        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
741        /// let x = Condition::new().set_display_name("example");
742        /// ```
743        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
744            mut self,
745            v: T,
746        ) -> Self {
747            self.display_name = v.into();
748            self
749        }
750
751        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition].
752        ///
753        /// Note that all the setters affecting `condition` are mutually
754        /// exclusive.
755        ///
756        /// # Example
757        /// ```ignore,no_run
758        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
759        /// use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
760        /// let x = Condition::new().set_condition(Some(
761        ///     google_cloud_monitoring_v3::model::alert_policy::condition::Condition::ConditionThreshold(MetricThreshold::default().into())));
762        /// ```
763        pub fn set_condition<
764            T: std::convert::Into<
765                    std::option::Option<crate::model::alert_policy::condition::Condition>,
766                >,
767        >(
768            mut self,
769            v: T,
770        ) -> Self {
771            self.condition = v.into();
772            self
773        }
774
775        /// The value of [condition][crate::model::alert_policy::Condition::condition]
776        /// if it holds a `ConditionThreshold`, `None` if the field is not set or
777        /// holds a different branch.
778        pub fn condition_threshold(
779            &self,
780        ) -> std::option::Option<
781            &std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
782        > {
783            #[allow(unreachable_patterns)]
784            self.condition.as_ref().and_then(|v| match v {
785                crate::model::alert_policy::condition::Condition::ConditionThreshold(v) => {
786                    std::option::Option::Some(v)
787                }
788                _ => std::option::Option::None,
789            })
790        }
791
792        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
793        /// to hold a `ConditionThreshold`.
794        ///
795        /// Note that all the setters affecting `condition` are
796        /// mutually exclusive.
797        ///
798        /// # Example
799        /// ```ignore,no_run
800        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
801        /// use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
802        /// let x = Condition::new().set_condition_threshold(MetricThreshold::default()/* use setters */);
803        /// assert!(x.condition_threshold().is_some());
804        /// assert!(x.condition_absent().is_none());
805        /// assert!(x.condition_matched_log().is_none());
806        /// assert!(x.condition_monitoring_query_language().is_none());
807        /// assert!(x.condition_prometheus_query_language().is_none());
808        /// assert!(x.condition_sql().is_none());
809        /// ```
810        pub fn set_condition_threshold<
811            T: std::convert::Into<
812                    std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
813                >,
814        >(
815            mut self,
816            v: T,
817        ) -> Self {
818            self.condition = std::option::Option::Some(
819                crate::model::alert_policy::condition::Condition::ConditionThreshold(v.into()),
820            );
821            self
822        }
823
824        /// The value of [condition][crate::model::alert_policy::Condition::condition]
825        /// if it holds a `ConditionAbsent`, `None` if the field is not set or
826        /// holds a different branch.
827        pub fn condition_absent(
828            &self,
829        ) -> std::option::Option<
830            &std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>,
831        > {
832            #[allow(unreachable_patterns)]
833            self.condition.as_ref().and_then(|v| match v {
834                crate::model::alert_policy::condition::Condition::ConditionAbsent(v) => {
835                    std::option::Option::Some(v)
836                }
837                _ => std::option::Option::None,
838            })
839        }
840
841        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
842        /// to hold a `ConditionAbsent`.
843        ///
844        /// Note that all the setters affecting `condition` are
845        /// mutually exclusive.
846        ///
847        /// # Example
848        /// ```ignore,no_run
849        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
850        /// use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
851        /// let x = Condition::new().set_condition_absent(MetricAbsence::default()/* use setters */);
852        /// assert!(x.condition_absent().is_some());
853        /// assert!(x.condition_threshold().is_none());
854        /// assert!(x.condition_matched_log().is_none());
855        /// assert!(x.condition_monitoring_query_language().is_none());
856        /// assert!(x.condition_prometheus_query_language().is_none());
857        /// assert!(x.condition_sql().is_none());
858        /// ```
859        pub fn set_condition_absent<
860            T: std::convert::Into<
861                    std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>,
862                >,
863        >(
864            mut self,
865            v: T,
866        ) -> Self {
867            self.condition = std::option::Option::Some(
868                crate::model::alert_policy::condition::Condition::ConditionAbsent(v.into()),
869            );
870            self
871        }
872
873        /// The value of [condition][crate::model::alert_policy::Condition::condition]
874        /// if it holds a `ConditionMatchedLog`, `None` if the field is not set or
875        /// holds a different branch.
876        pub fn condition_matched_log(
877            &self,
878        ) -> std::option::Option<&std::boxed::Box<crate::model::alert_policy::condition::LogMatch>>
879        {
880            #[allow(unreachable_patterns)]
881            self.condition.as_ref().and_then(|v| match v {
882                crate::model::alert_policy::condition::Condition::ConditionMatchedLog(v) => {
883                    std::option::Option::Some(v)
884                }
885                _ => std::option::Option::None,
886            })
887        }
888
889        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
890        /// to hold a `ConditionMatchedLog`.
891        ///
892        /// Note that all the setters affecting `condition` are
893        /// mutually exclusive.
894        ///
895        /// # Example
896        /// ```ignore,no_run
897        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
898        /// use google_cloud_monitoring_v3::model::alert_policy::condition::LogMatch;
899        /// let x = Condition::new().set_condition_matched_log(LogMatch::default()/* use setters */);
900        /// assert!(x.condition_matched_log().is_some());
901        /// assert!(x.condition_threshold().is_none());
902        /// assert!(x.condition_absent().is_none());
903        /// assert!(x.condition_monitoring_query_language().is_none());
904        /// assert!(x.condition_prometheus_query_language().is_none());
905        /// assert!(x.condition_sql().is_none());
906        /// ```
907        pub fn set_condition_matched_log<
908            T: std::convert::Into<std::boxed::Box<crate::model::alert_policy::condition::LogMatch>>,
909        >(
910            mut self,
911            v: T,
912        ) -> Self {
913            self.condition = std::option::Option::Some(
914                crate::model::alert_policy::condition::Condition::ConditionMatchedLog(v.into()),
915            );
916            self
917        }
918
919        /// The value of [condition][crate::model::alert_policy::Condition::condition]
920        /// if it holds a `ConditionMonitoringQueryLanguage`, `None` if the field is not set or
921        /// holds a different branch.
922        pub fn condition_monitoring_query_language(
923            &self,
924        ) -> std::option::Option<
925            &std::boxed::Box<
926                crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
927            >,
928        > {
929            #[allow(unreachable_patterns)]
930            self.condition.as_ref().and_then(|v| match v {
931                crate::model::alert_policy::condition::Condition::ConditionMonitoringQueryLanguage(v) => std::option::Option::Some(v),
932                _ => std::option::Option::None,
933            })
934        }
935
936        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
937        /// to hold a `ConditionMonitoringQueryLanguage`.
938        ///
939        /// Note that all the setters affecting `condition` are
940        /// mutually exclusive.
941        ///
942        /// # Example
943        /// ```ignore,no_run
944        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
945        /// use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
946        /// let x = Condition::new().set_condition_monitoring_query_language(MonitoringQueryLanguageCondition::default()/* use setters */);
947        /// assert!(x.condition_monitoring_query_language().is_some());
948        /// assert!(x.condition_threshold().is_none());
949        /// assert!(x.condition_absent().is_none());
950        /// assert!(x.condition_matched_log().is_none());
951        /// assert!(x.condition_prometheus_query_language().is_none());
952        /// assert!(x.condition_sql().is_none());
953        /// ```
954        pub fn set_condition_monitoring_query_language<
955            T: std::convert::Into<
956                    std::boxed::Box<
957                        crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
958                    >,
959                >,
960        >(
961            mut self,
962            v: T,
963        ) -> Self {
964            self.condition = std::option::Option::Some(
965                crate::model::alert_policy::condition::Condition::ConditionMonitoringQueryLanguage(
966                    v.into(),
967                ),
968            );
969            self
970        }
971
972        /// The value of [condition][crate::model::alert_policy::Condition::condition]
973        /// if it holds a `ConditionPrometheusQueryLanguage`, `None` if the field is not set or
974        /// holds a different branch.
975        pub fn condition_prometheus_query_language(
976            &self,
977        ) -> std::option::Option<
978            &std::boxed::Box<
979                crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
980            >,
981        > {
982            #[allow(unreachable_patterns)]
983            self.condition.as_ref().and_then(|v| match v {
984                crate::model::alert_policy::condition::Condition::ConditionPrometheusQueryLanguage(v) => std::option::Option::Some(v),
985                _ => std::option::Option::None,
986            })
987        }
988
989        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
990        /// to hold a `ConditionPrometheusQueryLanguage`.
991        ///
992        /// Note that all the setters affecting `condition` are
993        /// mutually exclusive.
994        ///
995        /// # Example
996        /// ```ignore,no_run
997        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
998        /// use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
999        /// let x = Condition::new().set_condition_prometheus_query_language(PrometheusQueryLanguageCondition::default()/* use setters */);
1000        /// assert!(x.condition_prometheus_query_language().is_some());
1001        /// assert!(x.condition_threshold().is_none());
1002        /// assert!(x.condition_absent().is_none());
1003        /// assert!(x.condition_matched_log().is_none());
1004        /// assert!(x.condition_monitoring_query_language().is_none());
1005        /// assert!(x.condition_sql().is_none());
1006        /// ```
1007        pub fn set_condition_prometheus_query_language<
1008            T: std::convert::Into<
1009                    std::boxed::Box<
1010                        crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
1011                    >,
1012                >,
1013        >(
1014            mut self,
1015            v: T,
1016        ) -> Self {
1017            self.condition = std::option::Option::Some(
1018                crate::model::alert_policy::condition::Condition::ConditionPrometheusQueryLanguage(
1019                    v.into(),
1020                ),
1021            );
1022            self
1023        }
1024
1025        /// The value of [condition][crate::model::alert_policy::Condition::condition]
1026        /// if it holds a `ConditionSql`, `None` if the field is not set or
1027        /// holds a different branch.
1028        pub fn condition_sql(
1029            &self,
1030        ) -> std::option::Option<
1031            &std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>,
1032        > {
1033            #[allow(unreachable_patterns)]
1034            self.condition.as_ref().and_then(|v| match v {
1035                crate::model::alert_policy::condition::Condition::ConditionSql(v) => {
1036                    std::option::Option::Some(v)
1037                }
1038                _ => std::option::Option::None,
1039            })
1040        }
1041
1042        /// Sets the value of [condition][crate::model::alert_policy::Condition::condition]
1043        /// to hold a `ConditionSql`.
1044        ///
1045        /// Note that all the setters affecting `condition` are
1046        /// mutually exclusive.
1047        ///
1048        /// # Example
1049        /// ```ignore,no_run
1050        /// # use google_cloud_monitoring_v3::model::alert_policy::Condition;
1051        /// use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
1052        /// let x = Condition::new().set_condition_sql(SqlCondition::default()/* use setters */);
1053        /// assert!(x.condition_sql().is_some());
1054        /// assert!(x.condition_threshold().is_none());
1055        /// assert!(x.condition_absent().is_none());
1056        /// assert!(x.condition_matched_log().is_none());
1057        /// assert!(x.condition_monitoring_query_language().is_none());
1058        /// assert!(x.condition_prometheus_query_language().is_none());
1059        /// ```
1060        pub fn set_condition_sql<
1061            T: std::convert::Into<
1062                    std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>,
1063                >,
1064        >(
1065            mut self,
1066            v: T,
1067        ) -> Self {
1068            self.condition = std::option::Option::Some(
1069                crate::model::alert_policy::condition::Condition::ConditionSql(v.into()),
1070            );
1071            self
1072        }
1073    }
1074
1075    impl wkt::message::Message for Condition {
1076        fn typename() -> &'static str {
1077            "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition"
1078        }
1079    }
1080
1081    /// Defines additional types related to [Condition].
1082    pub mod condition {
1083        #[allow(unused_imports)]
1084        use super::*;
1085
1086        /// Specifies how many time series must fail a predicate to trigger a
1087        /// condition. If not specified, then a `{count: 1}` trigger is used.
1088        #[derive(Clone, Default, PartialEq)]
1089        #[non_exhaustive]
1090        pub struct Trigger {
1091            /// A type of trigger.
1092            pub r#type: std::option::Option<crate::model::alert_policy::condition::trigger::Type>,
1093
1094            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1095        }
1096
1097        impl Trigger {
1098            pub fn new() -> Self {
1099                std::default::Default::default()
1100            }
1101
1102            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::type].
1103            ///
1104            /// Note that all the setters affecting `r#type` are mutually
1105            /// exclusive.
1106            ///
1107            /// # Example
1108            /// ```ignore,no_run
1109            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1110            /// use google_cloud_monitoring_v3::model::alert_policy::condition::trigger::Type;
1111            /// let x = Trigger::new().set_type(Some(Type::Count(42)));
1112            /// ```
1113            pub fn set_type<
1114                T: std::convert::Into<
1115                        std::option::Option<crate::model::alert_policy::condition::trigger::Type>,
1116                    >,
1117            >(
1118                mut self,
1119                v: T,
1120            ) -> Self {
1121                self.r#type = v.into();
1122                self
1123            }
1124
1125            /// The value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
1126            /// if it holds a `Count`, `None` if the field is not set or
1127            /// holds a different branch.
1128            pub fn count(&self) -> std::option::Option<&i32> {
1129                #[allow(unreachable_patterns)]
1130                self.r#type.as_ref().and_then(|v| match v {
1131                    crate::model::alert_policy::condition::trigger::Type::Count(v) => {
1132                        std::option::Option::Some(v)
1133                    }
1134                    _ => std::option::Option::None,
1135                })
1136            }
1137
1138            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
1139            /// to hold a `Count`.
1140            ///
1141            /// Note that all the setters affecting `r#type` are
1142            /// mutually exclusive.
1143            ///
1144            /// # Example
1145            /// ```ignore,no_run
1146            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1147            /// let x = Trigger::new().set_count(42);
1148            /// assert!(x.count().is_some());
1149            /// assert!(x.percent().is_none());
1150            /// ```
1151            pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1152                self.r#type = std::option::Option::Some(
1153                    crate::model::alert_policy::condition::trigger::Type::Count(v.into()),
1154                );
1155                self
1156            }
1157
1158            /// The value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
1159            /// if it holds a `Percent`, `None` if the field is not set or
1160            /// holds a different branch.
1161            pub fn percent(&self) -> std::option::Option<&f64> {
1162                #[allow(unreachable_patterns)]
1163                self.r#type.as_ref().and_then(|v| match v {
1164                    crate::model::alert_policy::condition::trigger::Type::Percent(v) => {
1165                        std::option::Option::Some(v)
1166                    }
1167                    _ => std::option::Option::None,
1168                })
1169            }
1170
1171            /// Sets the value of [r#type][crate::model::alert_policy::condition::Trigger::r#type]
1172            /// to hold a `Percent`.
1173            ///
1174            /// Note that all the setters affecting `r#type` are
1175            /// mutually exclusive.
1176            ///
1177            /// # Example
1178            /// ```ignore,no_run
1179            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1180            /// let x = Trigger::new().set_percent(42.0);
1181            /// assert!(x.percent().is_some());
1182            /// assert!(x.count().is_none());
1183            /// ```
1184            pub fn set_percent<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1185                self.r#type = std::option::Option::Some(
1186                    crate::model::alert_policy::condition::trigger::Type::Percent(v.into()),
1187                );
1188                self
1189            }
1190        }
1191
1192        impl wkt::message::Message for Trigger {
1193            fn typename() -> &'static str {
1194                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.Trigger"
1195            }
1196        }
1197
1198        /// Defines additional types related to [Trigger].
1199        pub mod trigger {
1200            #[allow(unused_imports)]
1201            use super::*;
1202
1203            /// A type of trigger.
1204            #[derive(Clone, Debug, PartialEq)]
1205            #[non_exhaustive]
1206            pub enum Type {
1207                /// The absolute number of time series that must fail
1208                /// the predicate for the condition to be triggered.
1209                Count(i32),
1210                /// The percentage of time series that must fail the
1211                /// predicate for the condition to be triggered.
1212                Percent(f64),
1213            }
1214        }
1215
1216        /// A condition type that compares a collection of time series
1217        /// against a threshold.
1218        #[derive(Clone, Default, PartialEq)]
1219        #[non_exhaustive]
1220        pub struct MetricThreshold {
1221            /// Required. A
1222            /// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
1223            /// identifies which time series should be compared with the threshold.
1224            ///
1225            /// The filter is similar to the one that is specified in the
1226            /// [`ListTimeSeries`
1227            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
1228            /// (that call is useful to verify the time series that will be retrieved /
1229            /// processed). The filter must specify the metric type and the resource
1230            /// type. Optionally, it can specify resource labels and metric labels.
1231            /// This field must not exceed 2048 Unicode characters in length.
1232            pub filter: std::string::String,
1233
1234            /// Specifies the alignment of data points in individual time series as
1235            /// well as how to combine the retrieved time series together (such as
1236            /// when aggregating multiple streams on each resource to a single
1237            /// stream for each resource or when aggregating streams across all
1238            /// members of a group of resources). Multiple aggregations
1239            /// are applied in the order specified.
1240            ///
1241            /// This field is similar to the one in the [`ListTimeSeries`
1242            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
1243            /// It is advisable to use the `ListTimeSeries` method when debugging this
1244            /// field.
1245            pub aggregations: std::vec::Vec<crate::model::Aggregation>,
1246
1247            /// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
1248            /// identifies a time series that should be used as the denominator of a
1249            /// ratio that will be compared with the threshold. If a
1250            /// `denominator_filter` is specified, the time series specified by the
1251            /// `filter` field will be used as the numerator.
1252            ///
1253            /// The filter must specify the metric type and optionally may contain
1254            /// restrictions on resource type, resource labels, and metric labels.
1255            /// This field may not exceed 2048 Unicode characters in length.
1256            pub denominator_filter: std::string::String,
1257
1258            /// Specifies the alignment of data points in individual time series
1259            /// selected by `denominatorFilter` as
1260            /// well as how to combine the retrieved time series together (such as
1261            /// when aggregating multiple streams on each resource to a single
1262            /// stream for each resource or when aggregating streams across all
1263            /// members of a group of resources).
1264            ///
1265            /// When computing ratios, the `aggregations` and
1266            /// `denominator_aggregations` fields must use the same alignment period
1267            /// and produce time series that have the same periodicity and labels.
1268            pub denominator_aggregations: std::vec::Vec<crate::model::Aggregation>,
1269
1270            /// When this field is present, the `MetricThreshold` condition forecasts
1271            /// whether the time series is predicted to violate the threshold within
1272            /// the `forecast_horizon`. When this field is not set, the
1273            /// `MetricThreshold` tests the current value of the timeseries against the
1274            /// threshold.
1275            pub forecast_options: std::option::Option<
1276                crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
1277            >,
1278
1279            /// The comparison to apply between the time series (indicated by `filter`
1280            /// and `aggregation`) and the threshold (indicated by `threshold_value`).
1281            /// The comparison is applied on each time series, with the time series
1282            /// on the left-hand side and the threshold on the right-hand side.
1283            ///
1284            /// Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
1285            pub comparison: crate::model::ComparisonType,
1286
1287            /// A value against which to compare the time series.
1288            pub threshold_value: f64,
1289
1290            /// The amount of time that a time series must violate the
1291            /// threshold to be considered failing. Currently, only values
1292            /// that are a multiple of a minute--e.g., 0, 60, 120, or 300
1293            /// seconds--are supported. If an invalid value is given, an
1294            /// error will be returned. When choosing a duration, it is useful to
1295            /// keep in mind the frequency of the underlying time series data
1296            /// (which may also be affected by any alignments specified in the
1297            /// `aggregations` field); a good duration is long enough so that a single
1298            /// outlier does not generate spurious alerts, but short enough that
1299            /// unhealthy states are detected and alerted on quickly.
1300            pub duration: std::option::Option<wkt::Duration>,
1301
1302            /// The number/percent of time series for which the comparison must hold
1303            /// in order for the condition to trigger. If unspecified, then the
1304            /// condition will trigger if the comparison is true for any of the
1305            /// time series that have been identified by `filter` and `aggregations`,
1306            /// or by the ratio, if `denominator_filter` and `denominator_aggregations`
1307            /// are specified.
1308            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1309
1310            /// A condition control that determines how metric-threshold conditions
1311            /// are evaluated when data stops arriving. To use this control, the value
1312            /// of the `duration` field must be greater than or equal to 60 seconds.
1313            pub evaluation_missing_data:
1314                crate::model::alert_policy::condition::EvaluationMissingData,
1315
1316            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1317        }
1318
1319        impl MetricThreshold {
1320            pub fn new() -> Self {
1321                std::default::Default::default()
1322            }
1323
1324            /// Sets the value of [filter][crate::model::alert_policy::condition::MetricThreshold::filter].
1325            ///
1326            /// # Example
1327            /// ```ignore,no_run
1328            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1329            /// let x = MetricThreshold::new().set_filter("example");
1330            /// ```
1331            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1332                self.filter = v.into();
1333                self
1334            }
1335
1336            /// Sets the value of [aggregations][crate::model::alert_policy::condition::MetricThreshold::aggregations].
1337            ///
1338            /// # Example
1339            /// ```ignore,no_run
1340            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1341            /// use google_cloud_monitoring_v3::model::Aggregation;
1342            /// let x = MetricThreshold::new()
1343            ///     .set_aggregations([
1344            ///         Aggregation::default()/* use setters */,
1345            ///         Aggregation::default()/* use (different) setters */,
1346            ///     ]);
1347            /// ```
1348            pub fn set_aggregations<T, V>(mut self, v: T) -> Self
1349            where
1350                T: std::iter::IntoIterator<Item = V>,
1351                V: std::convert::Into<crate::model::Aggregation>,
1352            {
1353                use std::iter::Iterator;
1354                self.aggregations = v.into_iter().map(|i| i.into()).collect();
1355                self
1356            }
1357
1358            /// Sets the value of [denominator_filter][crate::model::alert_policy::condition::MetricThreshold::denominator_filter].
1359            ///
1360            /// # Example
1361            /// ```ignore,no_run
1362            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1363            /// let x = MetricThreshold::new().set_denominator_filter("example");
1364            /// ```
1365            pub fn set_denominator_filter<T: std::convert::Into<std::string::String>>(
1366                mut self,
1367                v: T,
1368            ) -> Self {
1369                self.denominator_filter = v.into();
1370                self
1371            }
1372
1373            /// Sets the value of [denominator_aggregations][crate::model::alert_policy::condition::MetricThreshold::denominator_aggregations].
1374            ///
1375            /// # Example
1376            /// ```ignore,no_run
1377            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1378            /// use google_cloud_monitoring_v3::model::Aggregation;
1379            /// let x = MetricThreshold::new()
1380            ///     .set_denominator_aggregations([
1381            ///         Aggregation::default()/* use setters */,
1382            ///         Aggregation::default()/* use (different) setters */,
1383            ///     ]);
1384            /// ```
1385            pub fn set_denominator_aggregations<T, V>(mut self, v: T) -> Self
1386            where
1387                T: std::iter::IntoIterator<Item = V>,
1388                V: std::convert::Into<crate::model::Aggregation>,
1389            {
1390                use std::iter::Iterator;
1391                self.denominator_aggregations = v.into_iter().map(|i| i.into()).collect();
1392                self
1393            }
1394
1395            /// Sets the value of [forecast_options][crate::model::alert_policy::condition::MetricThreshold::forecast_options].
1396            ///
1397            /// # Example
1398            /// ```ignore,no_run
1399            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1400            /// use google_cloud_monitoring_v3::model::alert_policy::condition::metric_threshold::ForecastOptions;
1401            /// let x = MetricThreshold::new().set_forecast_options(ForecastOptions::default()/* use setters */);
1402            /// ```
1403            pub fn set_forecast_options<T>(mut self, v: T) -> Self
1404            where
1405                T: std::convert::Into<
1406                        crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
1407                    >,
1408            {
1409                self.forecast_options = std::option::Option::Some(v.into());
1410                self
1411            }
1412
1413            /// Sets or clears the value of [forecast_options][crate::model::alert_policy::condition::MetricThreshold::forecast_options].
1414            ///
1415            /// # Example
1416            /// ```ignore,no_run
1417            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1418            /// use google_cloud_monitoring_v3::model::alert_policy::condition::metric_threshold::ForecastOptions;
1419            /// let x = MetricThreshold::new().set_or_clear_forecast_options(Some(ForecastOptions::default()/* use setters */));
1420            /// let x = MetricThreshold::new().set_or_clear_forecast_options(None::<ForecastOptions>);
1421            /// ```
1422            pub fn set_or_clear_forecast_options<T>(mut self, v: std::option::Option<T>) -> Self
1423            where
1424                T: std::convert::Into<
1425                        crate::model::alert_policy::condition::metric_threshold::ForecastOptions,
1426                    >,
1427            {
1428                self.forecast_options = v.map(|x| x.into());
1429                self
1430            }
1431
1432            /// Sets the value of [comparison][crate::model::alert_policy::condition::MetricThreshold::comparison].
1433            ///
1434            /// # Example
1435            /// ```ignore,no_run
1436            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1437            /// use google_cloud_monitoring_v3::model::ComparisonType;
1438            /// let x0 = MetricThreshold::new().set_comparison(ComparisonType::ComparisonGt);
1439            /// let x1 = MetricThreshold::new().set_comparison(ComparisonType::ComparisonGe);
1440            /// let x2 = MetricThreshold::new().set_comparison(ComparisonType::ComparisonLt);
1441            /// ```
1442            pub fn set_comparison<T: std::convert::Into<crate::model::ComparisonType>>(
1443                mut self,
1444                v: T,
1445            ) -> Self {
1446                self.comparison = v.into();
1447                self
1448            }
1449
1450            /// Sets the value of [threshold_value][crate::model::alert_policy::condition::MetricThreshold::threshold_value].
1451            ///
1452            /// # Example
1453            /// ```ignore,no_run
1454            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1455            /// let x = MetricThreshold::new().set_threshold_value(42.0);
1456            /// ```
1457            pub fn set_threshold_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1458                self.threshold_value = v.into();
1459                self
1460            }
1461
1462            /// Sets the value of [duration][crate::model::alert_policy::condition::MetricThreshold::duration].
1463            ///
1464            /// # Example
1465            /// ```ignore,no_run
1466            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1467            /// use wkt::Duration;
1468            /// let x = MetricThreshold::new().set_duration(Duration::default()/* use setters */);
1469            /// ```
1470            pub fn set_duration<T>(mut self, v: T) -> Self
1471            where
1472                T: std::convert::Into<wkt::Duration>,
1473            {
1474                self.duration = std::option::Option::Some(v.into());
1475                self
1476            }
1477
1478            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MetricThreshold::duration].
1479            ///
1480            /// # Example
1481            /// ```ignore,no_run
1482            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1483            /// use wkt::Duration;
1484            /// let x = MetricThreshold::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
1485            /// let x = MetricThreshold::new().set_or_clear_duration(None::<Duration>);
1486            /// ```
1487            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1488            where
1489                T: std::convert::Into<wkt::Duration>,
1490            {
1491                self.duration = v.map(|x| x.into());
1492                self
1493            }
1494
1495            /// Sets the value of [trigger][crate::model::alert_policy::condition::MetricThreshold::trigger].
1496            ///
1497            /// # Example
1498            /// ```ignore,no_run
1499            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1500            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1501            /// let x = MetricThreshold::new().set_trigger(Trigger::default()/* use setters */);
1502            /// ```
1503            pub fn set_trigger<T>(mut self, v: T) -> Self
1504            where
1505                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1506            {
1507                self.trigger = std::option::Option::Some(v.into());
1508                self
1509            }
1510
1511            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MetricThreshold::trigger].
1512            ///
1513            /// # Example
1514            /// ```ignore,no_run
1515            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1516            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1517            /// let x = MetricThreshold::new().set_or_clear_trigger(Some(Trigger::default()/* use setters */));
1518            /// let x = MetricThreshold::new().set_or_clear_trigger(None::<Trigger>);
1519            /// ```
1520            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1521            where
1522                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1523            {
1524                self.trigger = v.map(|x| x.into());
1525                self
1526            }
1527
1528            /// Sets the value of [evaluation_missing_data][crate::model::alert_policy::condition::MetricThreshold::evaluation_missing_data].
1529            ///
1530            /// # Example
1531            /// ```ignore,no_run
1532            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricThreshold;
1533            /// use google_cloud_monitoring_v3::model::alert_policy::condition::EvaluationMissingData;
1534            /// let x0 = MetricThreshold::new().set_evaluation_missing_data(EvaluationMissingData::Inactive);
1535            /// let x1 = MetricThreshold::new().set_evaluation_missing_data(EvaluationMissingData::Active);
1536            /// let x2 = MetricThreshold::new().set_evaluation_missing_data(EvaluationMissingData::NoOp);
1537            /// ```
1538            pub fn set_evaluation_missing_data<
1539                T: std::convert::Into<crate::model::alert_policy::condition::EvaluationMissingData>,
1540            >(
1541                mut self,
1542                v: T,
1543            ) -> Self {
1544                self.evaluation_missing_data = v.into();
1545                self
1546            }
1547        }
1548
1549        impl wkt::message::Message for MetricThreshold {
1550            fn typename() -> &'static str {
1551                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricThreshold"
1552            }
1553        }
1554
1555        /// Defines additional types related to [MetricThreshold].
1556        pub mod metric_threshold {
1557            #[allow(unused_imports)]
1558            use super::*;
1559
1560            /// Options used when forecasting the time series and testing
1561            /// the predicted value against the threshold.
1562            #[derive(Clone, Default, PartialEq)]
1563            #[non_exhaustive]
1564            pub struct ForecastOptions {
1565                /// Required. The length of time into the future to forecast whether a
1566                /// time series will violate the threshold. If the predicted value is
1567                /// found to violate the threshold, and the violation is observed in all
1568                /// forecasts made for the configured `duration`, then the time series is
1569                /// considered to be failing.
1570                /// The forecast horizon can range from 1 hour to 60 hours.
1571                pub forecast_horizon: std::option::Option<wkt::Duration>,
1572
1573                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1574            }
1575
1576            impl ForecastOptions {
1577                pub fn new() -> Self {
1578                    std::default::Default::default()
1579                }
1580
1581                /// Sets the value of [forecast_horizon][crate::model::alert_policy::condition::metric_threshold::ForecastOptions::forecast_horizon].
1582                ///
1583                /// # Example
1584                /// ```ignore,no_run
1585                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::metric_threshold::ForecastOptions;
1586                /// use wkt::Duration;
1587                /// let x = ForecastOptions::new().set_forecast_horizon(Duration::default()/* use setters */);
1588                /// ```
1589                pub fn set_forecast_horizon<T>(mut self, v: T) -> Self
1590                where
1591                    T: std::convert::Into<wkt::Duration>,
1592                {
1593                    self.forecast_horizon = std::option::Option::Some(v.into());
1594                    self
1595                }
1596
1597                /// Sets or clears the value of [forecast_horizon][crate::model::alert_policy::condition::metric_threshold::ForecastOptions::forecast_horizon].
1598                ///
1599                /// # Example
1600                /// ```ignore,no_run
1601                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::metric_threshold::ForecastOptions;
1602                /// use wkt::Duration;
1603                /// let x = ForecastOptions::new().set_or_clear_forecast_horizon(Some(Duration::default()/* use setters */));
1604                /// let x = ForecastOptions::new().set_or_clear_forecast_horizon(None::<Duration>);
1605                /// ```
1606                pub fn set_or_clear_forecast_horizon<T>(mut self, v: std::option::Option<T>) -> Self
1607                where
1608                    T: std::convert::Into<wkt::Duration>,
1609                {
1610                    self.forecast_horizon = v.map(|x| x.into());
1611                    self
1612                }
1613            }
1614
1615            impl wkt::message::Message for ForecastOptions {
1616                fn typename() -> &'static str {
1617                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.ForecastOptions"
1618                }
1619            }
1620        }
1621
1622        /// A condition type that checks that monitored resources
1623        /// are reporting data. The configuration defines a metric and
1624        /// a set of monitored resources. The predicate is considered in violation
1625        /// when a time series for the specified metric of a monitored
1626        /// resource does not include any data in the specified `duration`.
1627        #[derive(Clone, Default, PartialEq)]
1628        #[non_exhaustive]
1629        pub struct MetricAbsence {
1630            /// Required. A
1631            /// [filter](https://cloud.google.com/monitoring/api/v3/filters) that
1632            /// identifies which time series should be compared with the threshold.
1633            ///
1634            /// The filter is similar to the one that is specified in the
1635            /// [`ListTimeSeries`
1636            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
1637            /// (that call is useful to verify the time series that will be retrieved /
1638            /// processed). The filter must specify the metric type and the resource
1639            /// type. Optionally, it can specify resource labels and metric labels.
1640            /// This field must not exceed 2048 Unicode characters in length.
1641            pub filter: std::string::String,
1642
1643            /// Specifies the alignment of data points in individual time series as
1644            /// well as how to combine the retrieved time series together (such as
1645            /// when aggregating multiple streams on each resource to a single
1646            /// stream for each resource or when aggregating streams across all
1647            /// members of a group of resources). Multiple aggregations
1648            /// are applied in the order specified.
1649            ///
1650            /// This field is similar to the one in the [`ListTimeSeries`
1651            /// request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
1652            /// It is advisable to use the `ListTimeSeries` method when debugging this
1653            /// field.
1654            pub aggregations: std::vec::Vec<crate::model::Aggregation>,
1655
1656            /// The amount of time that a time series must fail to report new
1657            /// data to be considered failing. The minimum value of this field
1658            /// is 120 seconds. Larger values that are a multiple of a
1659            /// minute--for example, 240 or 300 seconds--are supported.
1660            /// If an invalid value is given, an
1661            /// error will be returned. The `Duration.nanos` field is
1662            /// ignored.
1663            pub duration: std::option::Option<wkt::Duration>,
1664
1665            /// The number/percent of time series for which the comparison must hold
1666            /// in order for the condition to trigger. If unspecified, then the
1667            /// condition will trigger if the comparison is true for any of the
1668            /// time series that have been identified by `filter` and `aggregations`.
1669            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1670
1671            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1672        }
1673
1674        impl MetricAbsence {
1675            pub fn new() -> Self {
1676                std::default::Default::default()
1677            }
1678
1679            /// Sets the value of [filter][crate::model::alert_policy::condition::MetricAbsence::filter].
1680            ///
1681            /// # Example
1682            /// ```ignore,no_run
1683            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1684            /// let x = MetricAbsence::new().set_filter("example");
1685            /// ```
1686            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1687                self.filter = v.into();
1688                self
1689            }
1690
1691            /// Sets the value of [aggregations][crate::model::alert_policy::condition::MetricAbsence::aggregations].
1692            ///
1693            /// # Example
1694            /// ```ignore,no_run
1695            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1696            /// use google_cloud_monitoring_v3::model::Aggregation;
1697            /// let x = MetricAbsence::new()
1698            ///     .set_aggregations([
1699            ///         Aggregation::default()/* use setters */,
1700            ///         Aggregation::default()/* use (different) setters */,
1701            ///     ]);
1702            /// ```
1703            pub fn set_aggregations<T, V>(mut self, v: T) -> Self
1704            where
1705                T: std::iter::IntoIterator<Item = V>,
1706                V: std::convert::Into<crate::model::Aggregation>,
1707            {
1708                use std::iter::Iterator;
1709                self.aggregations = v.into_iter().map(|i| i.into()).collect();
1710                self
1711            }
1712
1713            /// Sets the value of [duration][crate::model::alert_policy::condition::MetricAbsence::duration].
1714            ///
1715            /// # Example
1716            /// ```ignore,no_run
1717            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1718            /// use wkt::Duration;
1719            /// let x = MetricAbsence::new().set_duration(Duration::default()/* use setters */);
1720            /// ```
1721            pub fn set_duration<T>(mut self, v: T) -> Self
1722            where
1723                T: std::convert::Into<wkt::Duration>,
1724            {
1725                self.duration = std::option::Option::Some(v.into());
1726                self
1727            }
1728
1729            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MetricAbsence::duration].
1730            ///
1731            /// # Example
1732            /// ```ignore,no_run
1733            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1734            /// use wkt::Duration;
1735            /// let x = MetricAbsence::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
1736            /// let x = MetricAbsence::new().set_or_clear_duration(None::<Duration>);
1737            /// ```
1738            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1739            where
1740                T: std::convert::Into<wkt::Duration>,
1741            {
1742                self.duration = v.map(|x| x.into());
1743                self
1744            }
1745
1746            /// Sets the value of [trigger][crate::model::alert_policy::condition::MetricAbsence::trigger].
1747            ///
1748            /// # Example
1749            /// ```ignore,no_run
1750            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1751            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1752            /// let x = MetricAbsence::new().set_trigger(Trigger::default()/* use setters */);
1753            /// ```
1754            pub fn set_trigger<T>(mut self, v: T) -> Self
1755            where
1756                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1757            {
1758                self.trigger = std::option::Option::Some(v.into());
1759                self
1760            }
1761
1762            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MetricAbsence::trigger].
1763            ///
1764            /// # Example
1765            /// ```ignore,no_run
1766            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MetricAbsence;
1767            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1768            /// let x = MetricAbsence::new().set_or_clear_trigger(Some(Trigger::default()/* use setters */));
1769            /// let x = MetricAbsence::new().set_or_clear_trigger(None::<Trigger>);
1770            /// ```
1771            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1772            where
1773                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1774            {
1775                self.trigger = v.map(|x| x.into());
1776                self
1777            }
1778        }
1779
1780        impl wkt::message::Message for MetricAbsence {
1781            fn typename() -> &'static str {
1782                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MetricAbsence"
1783            }
1784        }
1785
1786        /// A condition type that checks whether a log message in the [scoping
1787        /// project](https://cloud.google.com/monitoring/api/v3#project_name)
1788        /// satisfies the given filter. Logs from other projects in the metrics
1789        /// scope are not evaluated.
1790        #[derive(Clone, Default, PartialEq)]
1791        #[non_exhaustive]
1792        pub struct LogMatch {
1793            /// Required. A logs-based filter. See [Advanced Logs
1794            /// Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
1795            /// for how this filter should be constructed.
1796            pub filter: std::string::String,
1797
1798            /// Optional. A map from a label key to an extractor expression, which is
1799            /// used to extract the value for this label key. Each entry in this map is
1800            /// a specification for how data should be extracted from log entries that
1801            /// match `filter`. Each combination of extracted values is treated as a
1802            /// separate rule for the purposes of triggering notifications. Label keys
1803            /// and corresponding values can be used in notifications generated by this
1804            /// condition.
1805            ///
1806            /// Please see [the documentation on logs-based metric
1807            /// `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
1808            /// for syntax and examples.
1809            pub label_extractors:
1810                std::collections::HashMap<std::string::String, std::string::String>,
1811
1812            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1813        }
1814
1815        impl LogMatch {
1816            pub fn new() -> Self {
1817                std::default::Default::default()
1818            }
1819
1820            /// Sets the value of [filter][crate::model::alert_policy::condition::LogMatch::filter].
1821            ///
1822            /// # Example
1823            /// ```ignore,no_run
1824            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::LogMatch;
1825            /// let x = LogMatch::new().set_filter("example");
1826            /// ```
1827            pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1828                self.filter = v.into();
1829                self
1830            }
1831
1832            /// Sets the value of [label_extractors][crate::model::alert_policy::condition::LogMatch::label_extractors].
1833            ///
1834            /// # Example
1835            /// ```ignore,no_run
1836            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::LogMatch;
1837            /// let x = LogMatch::new().set_label_extractors([
1838            ///     ("key0", "abc"),
1839            ///     ("key1", "xyz"),
1840            /// ]);
1841            /// ```
1842            pub fn set_label_extractors<T, K, V>(mut self, v: T) -> Self
1843            where
1844                T: std::iter::IntoIterator<Item = (K, V)>,
1845                K: std::convert::Into<std::string::String>,
1846                V: std::convert::Into<std::string::String>,
1847            {
1848                use std::iter::Iterator;
1849                self.label_extractors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1850                self
1851            }
1852        }
1853
1854        impl wkt::message::Message for LogMatch {
1855            fn typename() -> &'static str {
1856                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.LogMatch"
1857            }
1858        }
1859
1860        /// A condition type that allows alerting policies to be defined using
1861        /// [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
1862        #[derive(Clone, Default, PartialEq)]
1863        #[non_exhaustive]
1864        pub struct MonitoringQueryLanguageCondition {
1865            /// [Monitoring Query Language](https://cloud.google.com/monitoring/mql)
1866            /// query that outputs a boolean stream.
1867            pub query: std::string::String,
1868
1869            /// The amount of time that a time series must violate the
1870            /// threshold to be considered failing. Currently, only values
1871            /// that are a multiple of a minute--e.g., 0, 60, 120, or 300
1872            /// seconds--are supported. If an invalid value is given, an
1873            /// error will be returned. When choosing a duration, it is useful to
1874            /// keep in mind the frequency of the underlying time series data
1875            /// (which may also be affected by any alignments specified in the
1876            /// `aggregations` field); a good duration is long enough so that a single
1877            /// outlier does not generate spurious alerts, but short enough that
1878            /// unhealthy states are detected and alerted on quickly.
1879            pub duration: std::option::Option<wkt::Duration>,
1880
1881            /// The number/percent of time series for which the comparison must hold
1882            /// in order for the condition to trigger. If unspecified, then the
1883            /// condition will trigger if the comparison is true for any of the
1884            /// time series that have been identified by `filter` and `aggregations`,
1885            /// or by the ratio, if `denominator_filter` and `denominator_aggregations`
1886            /// are specified.
1887            pub trigger: std::option::Option<crate::model::alert_policy::condition::Trigger>,
1888
1889            /// A condition control that determines how metric-threshold conditions
1890            /// are evaluated when data stops arriving.
1891            pub evaluation_missing_data:
1892                crate::model::alert_policy::condition::EvaluationMissingData,
1893
1894            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1895        }
1896
1897        impl MonitoringQueryLanguageCondition {
1898            pub fn new() -> Self {
1899                std::default::Default::default()
1900            }
1901
1902            /// Sets the value of [query][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::query].
1903            ///
1904            /// # Example
1905            /// ```ignore,no_run
1906            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1907            /// let x = MonitoringQueryLanguageCondition::new().set_query("example");
1908            /// ```
1909            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1910                self.query = v.into();
1911                self
1912            }
1913
1914            /// Sets the value of [duration][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::duration].
1915            ///
1916            /// # Example
1917            /// ```ignore,no_run
1918            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1919            /// use wkt::Duration;
1920            /// let x = MonitoringQueryLanguageCondition::new().set_duration(Duration::default()/* use setters */);
1921            /// ```
1922            pub fn set_duration<T>(mut self, v: T) -> Self
1923            where
1924                T: std::convert::Into<wkt::Duration>,
1925            {
1926                self.duration = std::option::Option::Some(v.into());
1927                self
1928            }
1929
1930            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::duration].
1931            ///
1932            /// # Example
1933            /// ```ignore,no_run
1934            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1935            /// use wkt::Duration;
1936            /// let x = MonitoringQueryLanguageCondition::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
1937            /// let x = MonitoringQueryLanguageCondition::new().set_or_clear_duration(None::<Duration>);
1938            /// ```
1939            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
1940            where
1941                T: std::convert::Into<wkt::Duration>,
1942            {
1943                self.duration = v.map(|x| x.into());
1944                self
1945            }
1946
1947            /// Sets the value of [trigger][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::trigger].
1948            ///
1949            /// # Example
1950            /// ```ignore,no_run
1951            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1952            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1953            /// let x = MonitoringQueryLanguageCondition::new().set_trigger(Trigger::default()/* use setters */);
1954            /// ```
1955            pub fn set_trigger<T>(mut self, v: T) -> Self
1956            where
1957                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1958            {
1959                self.trigger = std::option::Option::Some(v.into());
1960                self
1961            }
1962
1963            /// Sets or clears the value of [trigger][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::trigger].
1964            ///
1965            /// # Example
1966            /// ```ignore,no_run
1967            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1968            /// use google_cloud_monitoring_v3::model::alert_policy::condition::Trigger;
1969            /// let x = MonitoringQueryLanguageCondition::new().set_or_clear_trigger(Some(Trigger::default()/* use setters */));
1970            /// let x = MonitoringQueryLanguageCondition::new().set_or_clear_trigger(None::<Trigger>);
1971            /// ```
1972            pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1973            where
1974                T: std::convert::Into<crate::model::alert_policy::condition::Trigger>,
1975            {
1976                self.trigger = v.map(|x| x.into());
1977                self
1978            }
1979
1980            /// Sets the value of [evaluation_missing_data][crate::model::alert_policy::condition::MonitoringQueryLanguageCondition::evaluation_missing_data].
1981            ///
1982            /// # Example
1983            /// ```ignore,no_run
1984            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::MonitoringQueryLanguageCondition;
1985            /// use google_cloud_monitoring_v3::model::alert_policy::condition::EvaluationMissingData;
1986            /// let x0 = MonitoringQueryLanguageCondition::new().set_evaluation_missing_data(EvaluationMissingData::Inactive);
1987            /// let x1 = MonitoringQueryLanguageCondition::new().set_evaluation_missing_data(EvaluationMissingData::Active);
1988            /// let x2 = MonitoringQueryLanguageCondition::new().set_evaluation_missing_data(EvaluationMissingData::NoOp);
1989            /// ```
1990            pub fn set_evaluation_missing_data<
1991                T: std::convert::Into<crate::model::alert_policy::condition::EvaluationMissingData>,
1992            >(
1993                mut self,
1994                v: T,
1995            ) -> Self {
1996                self.evaluation_missing_data = v.into();
1997                self
1998            }
1999        }
2000
2001        impl wkt::message::Message for MonitoringQueryLanguageCondition {
2002            fn typename() -> &'static str {
2003                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition"
2004            }
2005        }
2006
2007        /// A condition type that allows alerting policies to be defined using
2008        /// [Prometheus Query Language
2009        /// (PromQL)](https://prometheus.io/docs/prometheus/latest/querying/basics/).
2010        ///
2011        /// The PrometheusQueryLanguageCondition message contains information
2012        /// from a Prometheus alerting rule and its associated rule group.
2013        ///
2014        /// A Prometheus alerting rule is described
2015        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/).
2016        /// The semantics of a Prometheus alerting rule is described
2017        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule).
2018        ///
2019        /// A Prometheus rule group is described
2020        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
2021        /// The semantics of a Prometheus rule group is described
2022        /// [here](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/#rule_group).
2023        ///
2024        /// Because Cloud Alerting has no representation of a Prometheus rule
2025        /// group resource, we must embed the information of the parent rule
2026        /// group inside each of the conditions that refer to it. We must also
2027        /// update the contents of all Prometheus alerts in case the information
2028        /// of their rule group changes.
2029        ///
2030        /// The PrometheusQueryLanguageCondition protocol buffer combines the
2031        /// information of the corresponding rule group and alerting rule.
2032        /// The structure of the PrometheusQueryLanguageCondition protocol buffer
2033        /// does NOT mimic the structure of the Prometheus rule group and alerting
2034        /// rule YAML declarations. The PrometheusQueryLanguageCondition protocol
2035        /// buffer may change in the future to support future rule group and/or
2036        /// alerting rule features. There are no new such features at the present
2037        /// time (2023-06-26).
2038        #[derive(Clone, Default, PartialEq)]
2039        #[non_exhaustive]
2040        pub struct PrometheusQueryLanguageCondition {
2041            /// Required. The PromQL expression to evaluate. Every evaluation cycle
2042            /// this expression is evaluated at the current time, and all resultant
2043            /// time series become pending/firing alerts. This field must not be empty.
2044            pub query: std::string::String,
2045
2046            /// Optional. Alerts are considered firing once their PromQL expression was
2047            /// evaluated to be "true" for this long.
2048            /// Alerts whose PromQL expression was not evaluated to be "true" for
2049            /// long enough are considered pending.
2050            /// Must be a non-negative duration or missing.
2051            /// This field is optional. Its default value is zero.
2052            pub duration: std::option::Option<wkt::Duration>,
2053
2054            /// Optional. How often this rule should be evaluated.
2055            /// Must be a positive multiple of 30 seconds or missing.
2056            /// This field is optional. Its default value is 30 seconds.
2057            /// If this PrometheusQueryLanguageCondition was generated from a
2058            /// Prometheus alerting rule, then this value should be taken from the
2059            /// enclosing rule group.
2060            pub evaluation_interval: std::option::Option<wkt::Duration>,
2061
2062            /// Optional. Labels to add to or overwrite in the PromQL query result.
2063            /// Label names [must be
2064            /// valid](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
2065            /// Label values can be [templatized by using
2066            /// variables](https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars).
2067            /// The only available variable names are the names of the labels in the
2068            /// PromQL result, including "__name__" and "value". "labels" may be empty.
2069            pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2070
2071            /// Optional. The rule group name of this alert in the corresponding
2072            /// Prometheus configuration file.
2073            ///
2074            /// Some external tools may require this field to be populated correctly
2075            /// in order to refer to the original Prometheus configuration file.
2076            /// The rule group name and the alert name are necessary to update the
2077            /// relevant AlertPolicies in case the definition of the rule group changes
2078            /// in the future.
2079            ///
2080            /// This field is optional. If this field is not empty, then it must
2081            /// contain a valid UTF-8 string.
2082            /// This field may not exceed 2048 Unicode characters in length.
2083            pub rule_group: std::string::String,
2084
2085            /// Optional. The alerting rule name of this alert in the corresponding
2086            /// Prometheus configuration file.
2087            ///
2088            /// Some external tools may require this field to be populated correctly
2089            /// in order to refer to the original Prometheus configuration file.
2090            /// The rule group name and the alert name are necessary to update the
2091            /// relevant AlertPolicies in case the definition of the rule group changes
2092            /// in the future.
2093            ///
2094            /// This field is optional. If this field is not empty, then it must be a
2095            /// [valid Prometheus label
2096            /// name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
2097            /// This field may not exceed 2048 Unicode characters in length.
2098            pub alert_rule: std::string::String,
2099
2100            /// Optional. Whether to disable metric existence validation for this
2101            /// condition.
2102            ///
2103            /// This allows alerting policies to be defined on metrics that do not yet
2104            /// exist, improving advanced customer workflows such as configuring
2105            /// alerting policies using Terraform.
2106            ///
2107            /// Users with the `monitoring.alertPolicyViewer` role are able to see the
2108            /// name of the non-existent metric in the alerting policy condition.
2109            pub disable_metric_validation: bool,
2110
2111            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2112        }
2113
2114        impl PrometheusQueryLanguageCondition {
2115            pub fn new() -> Self {
2116                std::default::Default::default()
2117            }
2118
2119            /// Sets the value of [query][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::query].
2120            ///
2121            /// # Example
2122            /// ```ignore,no_run
2123            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2124            /// let x = PrometheusQueryLanguageCondition::new().set_query("example");
2125            /// ```
2126            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2127                self.query = v.into();
2128                self
2129            }
2130
2131            /// Sets the value of [duration][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::duration].
2132            ///
2133            /// # Example
2134            /// ```ignore,no_run
2135            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2136            /// use wkt::Duration;
2137            /// let x = PrometheusQueryLanguageCondition::new().set_duration(Duration::default()/* use setters */);
2138            /// ```
2139            pub fn set_duration<T>(mut self, v: T) -> Self
2140            where
2141                T: std::convert::Into<wkt::Duration>,
2142            {
2143                self.duration = std::option::Option::Some(v.into());
2144                self
2145            }
2146
2147            /// Sets or clears the value of [duration][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::duration].
2148            ///
2149            /// # Example
2150            /// ```ignore,no_run
2151            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2152            /// use wkt::Duration;
2153            /// let x = PrometheusQueryLanguageCondition::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
2154            /// let x = PrometheusQueryLanguageCondition::new().set_or_clear_duration(None::<Duration>);
2155            /// ```
2156            pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
2157            where
2158                T: std::convert::Into<wkt::Duration>,
2159            {
2160                self.duration = v.map(|x| x.into());
2161                self
2162            }
2163
2164            /// Sets the value of [evaluation_interval][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::evaluation_interval].
2165            ///
2166            /// # Example
2167            /// ```ignore,no_run
2168            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2169            /// use wkt::Duration;
2170            /// let x = PrometheusQueryLanguageCondition::new().set_evaluation_interval(Duration::default()/* use setters */);
2171            /// ```
2172            pub fn set_evaluation_interval<T>(mut self, v: T) -> Self
2173            where
2174                T: std::convert::Into<wkt::Duration>,
2175            {
2176                self.evaluation_interval = std::option::Option::Some(v.into());
2177                self
2178            }
2179
2180            /// Sets or clears the value of [evaluation_interval][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::evaluation_interval].
2181            ///
2182            /// # Example
2183            /// ```ignore,no_run
2184            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2185            /// use wkt::Duration;
2186            /// let x = PrometheusQueryLanguageCondition::new().set_or_clear_evaluation_interval(Some(Duration::default()/* use setters */));
2187            /// let x = PrometheusQueryLanguageCondition::new().set_or_clear_evaluation_interval(None::<Duration>);
2188            /// ```
2189            pub fn set_or_clear_evaluation_interval<T>(mut self, v: std::option::Option<T>) -> Self
2190            where
2191                T: std::convert::Into<wkt::Duration>,
2192            {
2193                self.evaluation_interval = v.map(|x| x.into());
2194                self
2195            }
2196
2197            /// Sets the value of [labels][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::labels].
2198            ///
2199            /// # Example
2200            /// ```ignore,no_run
2201            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2202            /// let x = PrometheusQueryLanguageCondition::new().set_labels([
2203            ///     ("key0", "abc"),
2204            ///     ("key1", "xyz"),
2205            /// ]);
2206            /// ```
2207            pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2208            where
2209                T: std::iter::IntoIterator<Item = (K, V)>,
2210                K: std::convert::Into<std::string::String>,
2211                V: std::convert::Into<std::string::String>,
2212            {
2213                use std::iter::Iterator;
2214                self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2215                self
2216            }
2217
2218            /// Sets the value of [rule_group][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::rule_group].
2219            ///
2220            /// # Example
2221            /// ```ignore,no_run
2222            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2223            /// let x = PrometheusQueryLanguageCondition::new().set_rule_group("example");
2224            /// ```
2225            pub fn set_rule_group<T: std::convert::Into<std::string::String>>(
2226                mut self,
2227                v: T,
2228            ) -> Self {
2229                self.rule_group = v.into();
2230                self
2231            }
2232
2233            /// Sets the value of [alert_rule][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::alert_rule].
2234            ///
2235            /// # Example
2236            /// ```ignore,no_run
2237            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2238            /// let x = PrometheusQueryLanguageCondition::new().set_alert_rule("example");
2239            /// ```
2240            pub fn set_alert_rule<T: std::convert::Into<std::string::String>>(
2241                mut self,
2242                v: T,
2243            ) -> Self {
2244                self.alert_rule = v.into();
2245                self
2246            }
2247
2248            /// Sets the value of [disable_metric_validation][crate::model::alert_policy::condition::PrometheusQueryLanguageCondition::disable_metric_validation].
2249            ///
2250            /// # Example
2251            /// ```ignore,no_run
2252            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::PrometheusQueryLanguageCondition;
2253            /// let x = PrometheusQueryLanguageCondition::new().set_disable_metric_validation(true);
2254            /// ```
2255            pub fn set_disable_metric_validation<T: std::convert::Into<bool>>(
2256                mut self,
2257                v: T,
2258            ) -> Self {
2259                self.disable_metric_validation = v.into();
2260                self
2261            }
2262        }
2263
2264        impl wkt::message::Message for PrometheusQueryLanguageCondition {
2265            fn typename() -> &'static str {
2266                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.PrometheusQueryLanguageCondition"
2267            }
2268        }
2269
2270        /// A condition that allows alerting policies to be defined using GoogleSQL.
2271        /// SQL conditions examine a sliding window of logs using GoogleSQL.
2272        /// Alert policies with SQL conditions may incur additional billing.
2273        #[derive(Clone, Default, PartialEq)]
2274        #[non_exhaustive]
2275        pub struct SqlCondition {
2276            /// Required. The Log Analytics SQL query to run, as a string.  The query
2277            /// must conform to the required shape. Specifically, the query must not
2278            /// try to filter the input by time.  A filter will automatically be
2279            /// applied to filter the input so that the query receives all rows
2280            /// received since the last time the query was run.
2281            ///
2282            /// For example, the following query extracts all log entries containing an
2283            /// HTTP request:
2284            ///
2285            /// ```norust
2286            /// SELECT
2287            ///   timestamp, log_name, severity, http_request, resource, labels
2288            /// FROM
2289            ///   my-project.global._Default._AllLogs
2290            /// WHERE
2291            ///   http_request IS NOT NULL
2292            /// ```
2293            pub query: std::string::String,
2294
2295            /// The schedule indicates how often the query should be run.
2296            pub schedule:
2297                std::option::Option<crate::model::alert_policy::condition::sql_condition::Schedule>,
2298
2299            /// The test to be run against the SQL result set.
2300            pub evaluate:
2301                std::option::Option<crate::model::alert_policy::condition::sql_condition::Evaluate>,
2302
2303            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2304        }
2305
2306        impl SqlCondition {
2307            pub fn new() -> Self {
2308                std::default::Default::default()
2309            }
2310
2311            /// Sets the value of [query][crate::model::alert_policy::condition::SqlCondition::query].
2312            ///
2313            /// # Example
2314            /// ```ignore,no_run
2315            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2316            /// let x = SqlCondition::new().set_query("example");
2317            /// ```
2318            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2319                self.query = v.into();
2320                self
2321            }
2322
2323            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule].
2324            ///
2325            /// Note that all the setters affecting `schedule` are mutually
2326            /// exclusive.
2327            ///
2328            /// # Example
2329            /// ```ignore,no_run
2330            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2331            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Minutes;
2332            /// let x = SqlCondition::new().set_schedule(Some(
2333            ///     google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Schedule::Minutes(Minutes::default().into())));
2334            /// ```
2335            pub fn set_schedule<
2336                T: std::convert::Into<
2337                        std::option::Option<
2338                            crate::model::alert_policy::condition::sql_condition::Schedule,
2339                        >,
2340                    >,
2341            >(
2342                mut self,
2343                v: T,
2344            ) -> Self {
2345                self.schedule = v.into();
2346                self
2347            }
2348
2349            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2350            /// if it holds a `Minutes`, `None` if the field is not set or
2351            /// holds a different branch.
2352            pub fn minutes(
2353                &self,
2354            ) -> std::option::Option<
2355                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Minutes>,
2356            > {
2357                #[allow(unreachable_patterns)]
2358                self.schedule.as_ref().and_then(|v| match v {
2359                    crate::model::alert_policy::condition::sql_condition::Schedule::Minutes(v) => {
2360                        std::option::Option::Some(v)
2361                    }
2362                    _ => std::option::Option::None,
2363                })
2364            }
2365
2366            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2367            /// to hold a `Minutes`.
2368            ///
2369            /// Note that all the setters affecting `schedule` are
2370            /// mutually exclusive.
2371            ///
2372            /// # Example
2373            /// ```ignore,no_run
2374            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2375            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Minutes;
2376            /// let x = SqlCondition::new().set_minutes(Minutes::default()/* use setters */);
2377            /// assert!(x.minutes().is_some());
2378            /// assert!(x.hourly().is_none());
2379            /// assert!(x.daily().is_none());
2380            /// ```
2381            pub fn set_minutes<
2382                T: std::convert::Into<
2383                        std::boxed::Box<
2384                            crate::model::alert_policy::condition::sql_condition::Minutes,
2385                        >,
2386                    >,
2387            >(
2388                mut self,
2389                v: T,
2390            ) -> Self {
2391                self.schedule = std::option::Option::Some(
2392                    crate::model::alert_policy::condition::sql_condition::Schedule::Minutes(
2393                        v.into(),
2394                    ),
2395                );
2396                self
2397            }
2398
2399            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2400            /// if it holds a `Hourly`, `None` if the field is not set or
2401            /// holds a different branch.
2402            pub fn hourly(
2403                &self,
2404            ) -> std::option::Option<
2405                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Hourly>,
2406            > {
2407                #[allow(unreachable_patterns)]
2408                self.schedule.as_ref().and_then(|v| match v {
2409                    crate::model::alert_policy::condition::sql_condition::Schedule::Hourly(v) => {
2410                        std::option::Option::Some(v)
2411                    }
2412                    _ => std::option::Option::None,
2413                })
2414            }
2415
2416            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2417            /// to hold a `Hourly`.
2418            ///
2419            /// Note that all the setters affecting `schedule` are
2420            /// mutually exclusive.
2421            ///
2422            /// # Example
2423            /// ```ignore,no_run
2424            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2425            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Hourly;
2426            /// let x = SqlCondition::new().set_hourly(Hourly::default()/* use setters */);
2427            /// assert!(x.hourly().is_some());
2428            /// assert!(x.minutes().is_none());
2429            /// assert!(x.daily().is_none());
2430            /// ```
2431            pub fn set_hourly<
2432                T: std::convert::Into<
2433                        std::boxed::Box<
2434                            crate::model::alert_policy::condition::sql_condition::Hourly,
2435                        >,
2436                    >,
2437            >(
2438                mut self,
2439                v: T,
2440            ) -> Self {
2441                self.schedule = std::option::Option::Some(
2442                    crate::model::alert_policy::condition::sql_condition::Schedule::Hourly(
2443                        v.into(),
2444                    ),
2445                );
2446                self
2447            }
2448
2449            /// The value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2450            /// if it holds a `Daily`, `None` if the field is not set or
2451            /// holds a different branch.
2452            pub fn daily(
2453                &self,
2454            ) -> std::option::Option<
2455                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Daily>,
2456            > {
2457                #[allow(unreachable_patterns)]
2458                self.schedule.as_ref().and_then(|v| match v {
2459                    crate::model::alert_policy::condition::sql_condition::Schedule::Daily(v) => {
2460                        std::option::Option::Some(v)
2461                    }
2462                    _ => std::option::Option::None,
2463                })
2464            }
2465
2466            /// Sets the value of [schedule][crate::model::alert_policy::condition::SqlCondition::schedule]
2467            /// to hold a `Daily`.
2468            ///
2469            /// Note that all the setters affecting `schedule` are
2470            /// mutually exclusive.
2471            ///
2472            /// # Example
2473            /// ```ignore,no_run
2474            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2475            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Daily;
2476            /// let x = SqlCondition::new().set_daily(Daily::default()/* use setters */);
2477            /// assert!(x.daily().is_some());
2478            /// assert!(x.minutes().is_none());
2479            /// assert!(x.hourly().is_none());
2480            /// ```
2481            pub fn set_daily<
2482                T: std::convert::Into<
2483                        std::boxed::Box<
2484                            crate::model::alert_policy::condition::sql_condition::Daily,
2485                        >,
2486                    >,
2487            >(
2488                mut self,
2489                v: T,
2490            ) -> Self {
2491                self.schedule = std::option::Option::Some(
2492                    crate::model::alert_policy::condition::sql_condition::Schedule::Daily(v.into()),
2493                );
2494                self
2495            }
2496
2497            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate].
2498            ///
2499            /// Note that all the setters affecting `evaluate` are mutually
2500            /// exclusive.
2501            ///
2502            /// # Example
2503            /// ```ignore,no_run
2504            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2505            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::RowCountTest;
2506            /// let x = SqlCondition::new().set_evaluate(Some(
2507            ///     google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Evaluate::RowCountTest(RowCountTest::default().into())));
2508            /// ```
2509            pub fn set_evaluate<
2510                T: std::convert::Into<
2511                        std::option::Option<
2512                            crate::model::alert_policy::condition::sql_condition::Evaluate,
2513                        >,
2514                    >,
2515            >(
2516                mut self,
2517                v: T,
2518            ) -> Self {
2519                self.evaluate = v.into();
2520                self
2521            }
2522
2523            /// The value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
2524            /// if it holds a `RowCountTest`, `None` if the field is not set or
2525            /// holds a different branch.
2526            pub fn row_count_test(
2527                &self,
2528            ) -> std::option::Option<
2529                &std::boxed::Box<
2530                    crate::model::alert_policy::condition::sql_condition::RowCountTest,
2531                >,
2532            > {
2533                #[allow(unreachable_patterns)]
2534                self.evaluate.as_ref().and_then(|v| match v {
2535                    crate::model::alert_policy::condition::sql_condition::Evaluate::RowCountTest(v) => std::option::Option::Some(v),
2536                    _ => std::option::Option::None,
2537                })
2538            }
2539
2540            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
2541            /// to hold a `RowCountTest`.
2542            ///
2543            /// Note that all the setters affecting `evaluate` are
2544            /// mutually exclusive.
2545            ///
2546            /// # Example
2547            /// ```ignore,no_run
2548            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2549            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::RowCountTest;
2550            /// let x = SqlCondition::new().set_row_count_test(RowCountTest::default()/* use setters */);
2551            /// assert!(x.row_count_test().is_some());
2552            /// assert!(x.boolean_test().is_none());
2553            /// ```
2554            pub fn set_row_count_test<
2555                T: std::convert::Into<
2556                        std::boxed::Box<
2557                            crate::model::alert_policy::condition::sql_condition::RowCountTest,
2558                        >,
2559                    >,
2560            >(
2561                mut self,
2562                v: T,
2563            ) -> Self {
2564                self.evaluate = std::option::Option::Some(
2565                    crate::model::alert_policy::condition::sql_condition::Evaluate::RowCountTest(
2566                        v.into(),
2567                    ),
2568                );
2569                self
2570            }
2571
2572            /// The value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
2573            /// if it holds a `BooleanTest`, `None` if the field is not set or
2574            /// holds a different branch.
2575            pub fn boolean_test(
2576                &self,
2577            ) -> std::option::Option<
2578                &std::boxed::Box<crate::model::alert_policy::condition::sql_condition::BooleanTest>,
2579            > {
2580                #[allow(unreachable_patterns)]
2581                self.evaluate.as_ref().and_then(|v| match v {
2582                    crate::model::alert_policy::condition::sql_condition::Evaluate::BooleanTest(
2583                        v,
2584                    ) => std::option::Option::Some(v),
2585                    _ => std::option::Option::None,
2586                })
2587            }
2588
2589            /// Sets the value of [evaluate][crate::model::alert_policy::condition::SqlCondition::evaluate]
2590            /// to hold a `BooleanTest`.
2591            ///
2592            /// Note that all the setters affecting `evaluate` are
2593            /// mutually exclusive.
2594            ///
2595            /// # Example
2596            /// ```ignore,no_run
2597            /// # use google_cloud_monitoring_v3::model::alert_policy::condition::SqlCondition;
2598            /// use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::BooleanTest;
2599            /// let x = SqlCondition::new().set_boolean_test(BooleanTest::default()/* use setters */);
2600            /// assert!(x.boolean_test().is_some());
2601            /// assert!(x.row_count_test().is_none());
2602            /// ```
2603            pub fn set_boolean_test<
2604                T: std::convert::Into<
2605                        std::boxed::Box<
2606                            crate::model::alert_policy::condition::sql_condition::BooleanTest,
2607                        >,
2608                    >,
2609            >(
2610                mut self,
2611                v: T,
2612            ) -> Self {
2613                self.evaluate = std::option::Option::Some(
2614                    crate::model::alert_policy::condition::sql_condition::Evaluate::BooleanTest(
2615                        v.into(),
2616                    ),
2617                );
2618                self
2619            }
2620        }
2621
2622        impl wkt::message::Message for SqlCondition {
2623            fn typename() -> &'static str {
2624                "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition"
2625            }
2626        }
2627
2628        /// Defines additional types related to [SqlCondition].
2629        pub mod sql_condition {
2630            #[allow(unused_imports)]
2631            use super::*;
2632
2633            /// Used to schedule the query to run every so many minutes.
2634            #[derive(Clone, Default, PartialEq)]
2635            #[non_exhaustive]
2636            pub struct Minutes {
2637                /// Required. Number of minutes between runs. The interval must be
2638                /// greater than or equal to 5 minutes and less than or equal to 1440
2639                /// minutes.
2640                pub periodicity: i32,
2641
2642                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2643            }
2644
2645            impl Minutes {
2646                pub fn new() -> Self {
2647                    std::default::Default::default()
2648                }
2649
2650                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Minutes::periodicity].
2651                ///
2652                /// # Example
2653                /// ```ignore,no_run
2654                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Minutes;
2655                /// let x = Minutes::new().set_periodicity(42);
2656                /// ```
2657                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2658                    self.periodicity = v.into();
2659                    self
2660                }
2661            }
2662
2663            impl wkt::message::Message for Minutes {
2664                fn typename() -> &'static str {
2665                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Minutes"
2666                }
2667            }
2668
2669            /// Used to schedule the query to run every so many hours.
2670            #[derive(Clone, Default, PartialEq)]
2671            #[non_exhaustive]
2672            pub struct Hourly {
2673                /// Required. The number of hours between runs. Must be greater than or
2674                /// equal to 1 hour and less than or equal to 48 hours.
2675                pub periodicity: i32,
2676
2677                /// Optional. The number of minutes after the hour (in UTC) to run the
2678                /// query. Must be greater than or equal to 0 minutes and less than or
2679                /// equal to 59 minutes.  If left unspecified, then an arbitrary offset
2680                /// is used.
2681                pub minute_offset: std::option::Option<i32>,
2682
2683                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2684            }
2685
2686            impl Hourly {
2687                pub fn new() -> Self {
2688                    std::default::Default::default()
2689                }
2690
2691                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Hourly::periodicity].
2692                ///
2693                /// # Example
2694                /// ```ignore,no_run
2695                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Hourly;
2696                /// let x = Hourly::new().set_periodicity(42);
2697                /// ```
2698                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2699                    self.periodicity = v.into();
2700                    self
2701                }
2702
2703                /// Sets the value of [minute_offset][crate::model::alert_policy::condition::sql_condition::Hourly::minute_offset].
2704                ///
2705                /// # Example
2706                /// ```ignore,no_run
2707                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Hourly;
2708                /// let x = Hourly::new().set_minute_offset(42);
2709                /// ```
2710                pub fn set_minute_offset<T>(mut self, v: T) -> Self
2711                where
2712                    T: std::convert::Into<i32>,
2713                {
2714                    self.minute_offset = std::option::Option::Some(v.into());
2715                    self
2716                }
2717
2718                /// Sets or clears the value of [minute_offset][crate::model::alert_policy::condition::sql_condition::Hourly::minute_offset].
2719                ///
2720                /// # Example
2721                /// ```ignore,no_run
2722                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Hourly;
2723                /// let x = Hourly::new().set_or_clear_minute_offset(Some(42));
2724                /// let x = Hourly::new().set_or_clear_minute_offset(None::<i32>);
2725                /// ```
2726                pub fn set_or_clear_minute_offset<T>(mut self, v: std::option::Option<T>) -> Self
2727                where
2728                    T: std::convert::Into<i32>,
2729                {
2730                    self.minute_offset = v.map(|x| x.into());
2731                    self
2732                }
2733            }
2734
2735            impl wkt::message::Message for Hourly {
2736                fn typename() -> &'static str {
2737                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Hourly"
2738                }
2739            }
2740
2741            /// Used to schedule the query to run every so many days.
2742            #[derive(Clone, Default, PartialEq)]
2743            #[non_exhaustive]
2744            pub struct Daily {
2745                /// Required. The number of days between runs. Must be greater than or
2746                /// equal to 1 day and less than or equal to 31 days.
2747                pub periodicity: i32,
2748
2749                /// Optional. The time of day (in UTC) at which the query should run. If
2750                /// left unspecified, the server picks an arbitrary time of day and runs
2751                /// the query at the same time each day.
2752                pub execution_time: std::option::Option<gtype::model::TimeOfDay>,
2753
2754                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2755            }
2756
2757            impl Daily {
2758                pub fn new() -> Self {
2759                    std::default::Default::default()
2760                }
2761
2762                /// Sets the value of [periodicity][crate::model::alert_policy::condition::sql_condition::Daily::periodicity].
2763                ///
2764                /// # Example
2765                /// ```ignore,no_run
2766                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Daily;
2767                /// let x = Daily::new().set_periodicity(42);
2768                /// ```
2769                pub fn set_periodicity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2770                    self.periodicity = v.into();
2771                    self
2772                }
2773
2774                /// Sets the value of [execution_time][crate::model::alert_policy::condition::sql_condition::Daily::execution_time].
2775                ///
2776                /// # Example
2777                /// ```ignore,no_run
2778                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Daily;
2779                /// use gtype::model::TimeOfDay;
2780                /// let x = Daily::new().set_execution_time(TimeOfDay::default()/* use setters */);
2781                /// ```
2782                pub fn set_execution_time<T>(mut self, v: T) -> Self
2783                where
2784                    T: std::convert::Into<gtype::model::TimeOfDay>,
2785                {
2786                    self.execution_time = std::option::Option::Some(v.into());
2787                    self
2788                }
2789
2790                /// Sets or clears the value of [execution_time][crate::model::alert_policy::condition::sql_condition::Daily::execution_time].
2791                ///
2792                /// # Example
2793                /// ```ignore,no_run
2794                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::Daily;
2795                /// use gtype::model::TimeOfDay;
2796                /// let x = Daily::new().set_or_clear_execution_time(Some(TimeOfDay::default()/* use setters */));
2797                /// let x = Daily::new().set_or_clear_execution_time(None::<TimeOfDay>);
2798                /// ```
2799                pub fn set_or_clear_execution_time<T>(mut self, v: std::option::Option<T>) -> Self
2800                where
2801                    T: std::convert::Into<gtype::model::TimeOfDay>,
2802                {
2803                    self.execution_time = v.map(|x| x.into());
2804                    self
2805                }
2806            }
2807
2808            impl wkt::message::Message for Daily {
2809                fn typename() -> &'static str {
2810                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.Daily"
2811                }
2812            }
2813
2814            /// A test that checks if the number of rows in the result set
2815            /// violates some threshold.
2816            #[derive(Clone, Default, PartialEq)]
2817            #[non_exhaustive]
2818            pub struct RowCountTest {
2819                /// Required. The comparison to apply between the number of rows returned
2820                /// by the query and the threshold.
2821                pub comparison: crate::model::ComparisonType,
2822
2823                /// Required. The value against which to compare the row count.
2824                pub threshold: i64,
2825
2826                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2827            }
2828
2829            impl RowCountTest {
2830                pub fn new() -> Self {
2831                    std::default::Default::default()
2832                }
2833
2834                /// Sets the value of [comparison][crate::model::alert_policy::condition::sql_condition::RowCountTest::comparison].
2835                ///
2836                /// # Example
2837                /// ```ignore,no_run
2838                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::RowCountTest;
2839                /// use google_cloud_monitoring_v3::model::ComparisonType;
2840                /// let x0 = RowCountTest::new().set_comparison(ComparisonType::ComparisonGt);
2841                /// let x1 = RowCountTest::new().set_comparison(ComparisonType::ComparisonGe);
2842                /// let x2 = RowCountTest::new().set_comparison(ComparisonType::ComparisonLt);
2843                /// ```
2844                pub fn set_comparison<T: std::convert::Into<crate::model::ComparisonType>>(
2845                    mut self,
2846                    v: T,
2847                ) -> Self {
2848                    self.comparison = v.into();
2849                    self
2850                }
2851
2852                /// Sets the value of [threshold][crate::model::alert_policy::condition::sql_condition::RowCountTest::threshold].
2853                ///
2854                /// # Example
2855                /// ```ignore,no_run
2856                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::RowCountTest;
2857                /// let x = RowCountTest::new().set_threshold(42);
2858                /// ```
2859                pub fn set_threshold<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2860                    self.threshold = v.into();
2861                    self
2862                }
2863            }
2864
2865            impl wkt::message::Message for RowCountTest {
2866                fn typename() -> &'static str {
2867                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.RowCountTest"
2868                }
2869            }
2870
2871            /// A test that uses an alerting result in a boolean column produced by
2872            /// the SQL query.
2873            #[derive(Clone, Default, PartialEq)]
2874            #[non_exhaustive]
2875            pub struct BooleanTest {
2876                /// Required. The name of the column containing the boolean value. If the
2877                /// value in a row is NULL, that row is ignored.
2878                pub column: std::string::String,
2879
2880                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2881            }
2882
2883            impl BooleanTest {
2884                pub fn new() -> Self {
2885                    std::default::Default::default()
2886                }
2887
2888                /// Sets the value of [column][crate::model::alert_policy::condition::sql_condition::BooleanTest::column].
2889                ///
2890                /// # Example
2891                /// ```ignore,no_run
2892                /// # use google_cloud_monitoring_v3::model::alert_policy::condition::sql_condition::BooleanTest;
2893                /// let x = BooleanTest::new().set_column("example");
2894                /// ```
2895                pub fn set_column<T: std::convert::Into<std::string::String>>(
2896                    mut self,
2897                    v: T,
2898                ) -> Self {
2899                    self.column = v.into();
2900                    self
2901                }
2902            }
2903
2904            impl wkt::message::Message for BooleanTest {
2905                fn typename() -> &'static str {
2906                    "type.googleapis.com/google.monitoring.v3.AlertPolicy.Condition.SqlCondition.BooleanTest"
2907                }
2908            }
2909
2910            /// The schedule indicates how often the query should be run.
2911            #[derive(Clone, Debug, PartialEq)]
2912            #[non_exhaustive]
2913            pub enum Schedule {
2914                /// Schedule the query to execute every so many minutes.
2915                Minutes(
2916                    std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Minutes>,
2917                ),
2918                /// Schedule the query to execute every so many hours.
2919                Hourly(
2920                    std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Hourly>,
2921                ),
2922                /// Schedule the query to execute every so many days.
2923                Daily(std::boxed::Box<crate::model::alert_policy::condition::sql_condition::Daily>),
2924            }
2925
2926            /// The test to be run against the SQL result set.
2927            #[derive(Clone, Debug, PartialEq)]
2928            #[non_exhaustive]
2929            pub enum Evaluate {
2930                /// Test the row count against a threshold.
2931                RowCountTest(
2932                    std::boxed::Box<
2933                        crate::model::alert_policy::condition::sql_condition::RowCountTest,
2934                    >,
2935                ),
2936                /// Test the boolean value in the indicated column.
2937                BooleanTest(
2938                    std::boxed::Box<
2939                        crate::model::alert_policy::condition::sql_condition::BooleanTest,
2940                    >,
2941                ),
2942            }
2943        }
2944
2945        /// A condition control that determines how metric-threshold conditions
2946        /// are evaluated when data stops arriving.
2947        /// This control doesn't affect metric-absence policies.
2948        ///
2949        /// # Working with unknown values
2950        ///
2951        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2952        /// additional enum variants at any time. Adding new variants is not considered
2953        /// a breaking change. Applications should write their code in anticipation of:
2954        ///
2955        /// - New values appearing in future releases of the client library, **and**
2956        /// - New values received dynamically, without application changes.
2957        ///
2958        /// Please consult the [Working with enums] section in the user guide for some
2959        /// guidelines.
2960        ///
2961        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2962        #[derive(Clone, Debug, PartialEq)]
2963        #[non_exhaustive]
2964        pub enum EvaluationMissingData {
2965            /// An unspecified evaluation missing data option.  Equivalent to
2966            /// EVALUATION_MISSING_DATA_NO_OP.
2967            Unspecified,
2968            /// If there is no data to evaluate the condition, then evaluate the
2969            /// condition as false.
2970            Inactive,
2971            /// If there is no data to evaluate the condition, then evaluate the
2972            /// condition as true.
2973            Active,
2974            /// Do not evaluate the condition to any value if there is no data.
2975            NoOp,
2976            /// If set, the enum was initialized with an unknown value.
2977            ///
2978            /// Applications can examine the value using [EvaluationMissingData::value] or
2979            /// [EvaluationMissingData::name].
2980            UnknownValue(evaluation_missing_data::UnknownValue),
2981        }
2982
2983        #[doc(hidden)]
2984        pub mod evaluation_missing_data {
2985            #[allow(unused_imports)]
2986            use super::*;
2987            #[derive(Clone, Debug, PartialEq)]
2988            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2989        }
2990
2991        impl EvaluationMissingData {
2992            /// Gets the enum value.
2993            ///
2994            /// Returns `None` if the enum contains an unknown value deserialized from
2995            /// the string representation of enums.
2996            pub fn value(&self) -> std::option::Option<i32> {
2997                match self {
2998                    Self::Unspecified => std::option::Option::Some(0),
2999                    Self::Inactive => std::option::Option::Some(1),
3000                    Self::Active => std::option::Option::Some(2),
3001                    Self::NoOp => std::option::Option::Some(3),
3002                    Self::UnknownValue(u) => u.0.value(),
3003                }
3004            }
3005
3006            /// Gets the enum value as a string.
3007            ///
3008            /// Returns `None` if the enum contains an unknown value deserialized from
3009            /// the integer representation of enums.
3010            pub fn name(&self) -> std::option::Option<&str> {
3011                match self {
3012                    Self::Unspecified => {
3013                        std::option::Option::Some("EVALUATION_MISSING_DATA_UNSPECIFIED")
3014                    }
3015                    Self::Inactive => std::option::Option::Some("EVALUATION_MISSING_DATA_INACTIVE"),
3016                    Self::Active => std::option::Option::Some("EVALUATION_MISSING_DATA_ACTIVE"),
3017                    Self::NoOp => std::option::Option::Some("EVALUATION_MISSING_DATA_NO_OP"),
3018                    Self::UnknownValue(u) => u.0.name(),
3019                }
3020            }
3021        }
3022
3023        impl std::default::Default for EvaluationMissingData {
3024            fn default() -> Self {
3025                use std::convert::From;
3026                Self::from(0)
3027            }
3028        }
3029
3030        impl std::fmt::Display for EvaluationMissingData {
3031            fn fmt(
3032                &self,
3033                f: &mut std::fmt::Formatter<'_>,
3034            ) -> std::result::Result<(), std::fmt::Error> {
3035                wkt::internal::display_enum(f, self.name(), self.value())
3036            }
3037        }
3038
3039        impl std::convert::From<i32> for EvaluationMissingData {
3040            fn from(value: i32) -> Self {
3041                match value {
3042                    0 => Self::Unspecified,
3043                    1 => Self::Inactive,
3044                    2 => Self::Active,
3045                    3 => Self::NoOp,
3046                    _ => Self::UnknownValue(evaluation_missing_data::UnknownValue(
3047                        wkt::internal::UnknownEnumValue::Integer(value),
3048                    )),
3049                }
3050            }
3051        }
3052
3053        impl std::convert::From<&str> for EvaluationMissingData {
3054            fn from(value: &str) -> Self {
3055                use std::string::ToString;
3056                match value {
3057                    "EVALUATION_MISSING_DATA_UNSPECIFIED" => Self::Unspecified,
3058                    "EVALUATION_MISSING_DATA_INACTIVE" => Self::Inactive,
3059                    "EVALUATION_MISSING_DATA_ACTIVE" => Self::Active,
3060                    "EVALUATION_MISSING_DATA_NO_OP" => Self::NoOp,
3061                    _ => Self::UnknownValue(evaluation_missing_data::UnknownValue(
3062                        wkt::internal::UnknownEnumValue::String(value.to_string()),
3063                    )),
3064                }
3065            }
3066        }
3067
3068        impl serde::ser::Serialize for EvaluationMissingData {
3069            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3070            where
3071                S: serde::Serializer,
3072            {
3073                match self {
3074                    Self::Unspecified => serializer.serialize_i32(0),
3075                    Self::Inactive => serializer.serialize_i32(1),
3076                    Self::Active => serializer.serialize_i32(2),
3077                    Self::NoOp => serializer.serialize_i32(3),
3078                    Self::UnknownValue(u) => u.0.serialize(serializer),
3079                }
3080            }
3081        }
3082
3083        impl<'de> serde::de::Deserialize<'de> for EvaluationMissingData {
3084            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3085            where
3086                D: serde::Deserializer<'de>,
3087            {
3088                deserializer.deserialize_any(
3089                    wkt::internal::EnumVisitor::<EvaluationMissingData>::new(
3090                        ".google.monitoring.v3.AlertPolicy.Condition.EvaluationMissingData",
3091                    ),
3092                )
3093            }
3094        }
3095
3096        /// Only one of the following condition types will be specified.
3097        #[derive(Clone, Debug, PartialEq)]
3098        #[non_exhaustive]
3099        pub enum Condition {
3100            /// A condition that compares a time series against a threshold.
3101            ConditionThreshold(
3102                std::boxed::Box<crate::model::alert_policy::condition::MetricThreshold>,
3103            ),
3104            /// A condition that checks that a time series continues to
3105            /// receive new data points.
3106            ConditionAbsent(std::boxed::Box<crate::model::alert_policy::condition::MetricAbsence>),
3107            /// A condition that checks for log messages matching given constraints. If
3108            /// set, no other conditions can be present.
3109            ConditionMatchedLog(std::boxed::Box<crate::model::alert_policy::condition::LogMatch>),
3110            /// A condition that uses the Monitoring Query Language to define
3111            /// alerts.
3112            ConditionMonitoringQueryLanguage(
3113                std::boxed::Box<
3114                    crate::model::alert_policy::condition::MonitoringQueryLanguageCondition,
3115                >,
3116            ),
3117            /// A condition that uses the Prometheus query language to define alerts.
3118            ConditionPrometheusQueryLanguage(
3119                std::boxed::Box<
3120                    crate::model::alert_policy::condition::PrometheusQueryLanguageCondition,
3121                >,
3122            ),
3123            /// A condition that periodically evaluates a SQL query result.
3124            ConditionSql(std::boxed::Box<crate::model::alert_policy::condition::SqlCondition>),
3125        }
3126    }
3127
3128    /// Control over how the notification channels in `notification_channels`
3129    /// are notified when this alert fires.
3130    #[derive(Clone, Default, PartialEq)]
3131    #[non_exhaustive]
3132    pub struct AlertStrategy {
3133        /// Required for log-based alerting policies, i.e. policies with a `LogMatch`
3134        /// condition.
3135        ///
3136        /// This limit is not implemented for alerting policies that do not have
3137        /// a LogMatch condition.
3138        pub notification_rate_limit:
3139            std::option::Option<crate::model::alert_policy::alert_strategy::NotificationRateLimit>,
3140
3141        /// For log-based alert policies, the notification prompts is always
3142        /// [OPENED]. For non log-based alert policies, the notification prompts can
3143        /// be [OPENED] or [OPENED, CLOSED].
3144        pub notification_prompts:
3145            std::vec::Vec<crate::model::alert_policy::alert_strategy::NotificationPrompt>,
3146
3147        /// If an alerting policy that was active has no data for this long, any open
3148        /// incidents will close
3149        pub auto_close: std::option::Option<wkt::Duration>,
3150
3151        /// Control how notifications will be sent out, on a per-channel basis.
3152        pub notification_channel_strategy:
3153            std::vec::Vec<crate::model::alert_policy::alert_strategy::NotificationChannelStrategy>,
3154
3155        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3156    }
3157
3158    impl AlertStrategy {
3159        pub fn new() -> Self {
3160            std::default::Default::default()
3161        }
3162
3163        /// Sets the value of [notification_rate_limit][crate::model::alert_policy::AlertStrategy::notification_rate_limit].
3164        ///
3165        /// # Example
3166        /// ```ignore,no_run
3167        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3168        /// use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationRateLimit;
3169        /// let x = AlertStrategy::new().set_notification_rate_limit(NotificationRateLimit::default()/* use setters */);
3170        /// ```
3171        pub fn set_notification_rate_limit<T>(mut self, v: T) -> Self
3172        where
3173            T: std::convert::Into<
3174                    crate::model::alert_policy::alert_strategy::NotificationRateLimit,
3175                >,
3176        {
3177            self.notification_rate_limit = std::option::Option::Some(v.into());
3178            self
3179        }
3180
3181        /// Sets or clears the value of [notification_rate_limit][crate::model::alert_policy::AlertStrategy::notification_rate_limit].
3182        ///
3183        /// # Example
3184        /// ```ignore,no_run
3185        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3186        /// use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationRateLimit;
3187        /// let x = AlertStrategy::new().set_or_clear_notification_rate_limit(Some(NotificationRateLimit::default()/* use setters */));
3188        /// let x = AlertStrategy::new().set_or_clear_notification_rate_limit(None::<NotificationRateLimit>);
3189        /// ```
3190        pub fn set_or_clear_notification_rate_limit<T>(mut self, v: std::option::Option<T>) -> Self
3191        where
3192            T: std::convert::Into<
3193                    crate::model::alert_policy::alert_strategy::NotificationRateLimit,
3194                >,
3195        {
3196            self.notification_rate_limit = v.map(|x| x.into());
3197            self
3198        }
3199
3200        /// Sets the value of [notification_prompts][crate::model::alert_policy::AlertStrategy::notification_prompts].
3201        ///
3202        /// # Example
3203        /// ```ignore,no_run
3204        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3205        /// use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationPrompt;
3206        /// let x = AlertStrategy::new().set_notification_prompts([
3207        ///     NotificationPrompt::Opened,
3208        ///     NotificationPrompt::Closed,
3209        /// ]);
3210        /// ```
3211        pub fn set_notification_prompts<T, V>(mut self, v: T) -> Self
3212        where
3213            T: std::iter::IntoIterator<Item = V>,
3214            V: std::convert::Into<crate::model::alert_policy::alert_strategy::NotificationPrompt>,
3215        {
3216            use std::iter::Iterator;
3217            self.notification_prompts = v.into_iter().map(|i| i.into()).collect();
3218            self
3219        }
3220
3221        /// Sets the value of [auto_close][crate::model::alert_policy::AlertStrategy::auto_close].
3222        ///
3223        /// # Example
3224        /// ```ignore,no_run
3225        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3226        /// use wkt::Duration;
3227        /// let x = AlertStrategy::new().set_auto_close(Duration::default()/* use setters */);
3228        /// ```
3229        pub fn set_auto_close<T>(mut self, v: T) -> Self
3230        where
3231            T: std::convert::Into<wkt::Duration>,
3232        {
3233            self.auto_close = std::option::Option::Some(v.into());
3234            self
3235        }
3236
3237        /// Sets or clears the value of [auto_close][crate::model::alert_policy::AlertStrategy::auto_close].
3238        ///
3239        /// # Example
3240        /// ```ignore,no_run
3241        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3242        /// use wkt::Duration;
3243        /// let x = AlertStrategy::new().set_or_clear_auto_close(Some(Duration::default()/* use setters */));
3244        /// let x = AlertStrategy::new().set_or_clear_auto_close(None::<Duration>);
3245        /// ```
3246        pub fn set_or_clear_auto_close<T>(mut self, v: std::option::Option<T>) -> Self
3247        where
3248            T: std::convert::Into<wkt::Duration>,
3249        {
3250            self.auto_close = v.map(|x| x.into());
3251            self
3252        }
3253
3254        /// Sets the value of [notification_channel_strategy][crate::model::alert_policy::AlertStrategy::notification_channel_strategy].
3255        ///
3256        /// # Example
3257        /// ```ignore,no_run
3258        /// # use google_cloud_monitoring_v3::model::alert_policy::AlertStrategy;
3259        /// use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationChannelStrategy;
3260        /// let x = AlertStrategy::new()
3261        ///     .set_notification_channel_strategy([
3262        ///         NotificationChannelStrategy::default()/* use setters */,
3263        ///         NotificationChannelStrategy::default()/* use (different) setters */,
3264        ///     ]);
3265        /// ```
3266        pub fn set_notification_channel_strategy<T, V>(mut self, v: T) -> Self
3267        where
3268            T: std::iter::IntoIterator<Item = V>,
3269            V: std::convert::Into<
3270                    crate::model::alert_policy::alert_strategy::NotificationChannelStrategy,
3271                >,
3272        {
3273            use std::iter::Iterator;
3274            self.notification_channel_strategy = v.into_iter().map(|i| i.into()).collect();
3275            self
3276        }
3277    }
3278
3279    impl wkt::message::Message for AlertStrategy {
3280        fn typename() -> &'static str {
3281            "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy"
3282        }
3283    }
3284
3285    /// Defines additional types related to [AlertStrategy].
3286    pub mod alert_strategy {
3287        #[allow(unused_imports)]
3288        use super::*;
3289
3290        /// Control over the rate of notifications sent to this alerting policy's
3291        /// notification channels.
3292        #[derive(Clone, Default, PartialEq)]
3293        #[non_exhaustive]
3294        pub struct NotificationRateLimit {
3295            /// Not more than one notification per `period`.
3296            pub period: std::option::Option<wkt::Duration>,
3297
3298            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3299        }
3300
3301        impl NotificationRateLimit {
3302            pub fn new() -> Self {
3303                std::default::Default::default()
3304            }
3305
3306            /// Sets the value of [period][crate::model::alert_policy::alert_strategy::NotificationRateLimit::period].
3307            ///
3308            /// # Example
3309            /// ```ignore,no_run
3310            /// # use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationRateLimit;
3311            /// use wkt::Duration;
3312            /// let x = NotificationRateLimit::new().set_period(Duration::default()/* use setters */);
3313            /// ```
3314            pub fn set_period<T>(mut self, v: T) -> Self
3315            where
3316                T: std::convert::Into<wkt::Duration>,
3317            {
3318                self.period = std::option::Option::Some(v.into());
3319                self
3320            }
3321
3322            /// Sets or clears the value of [period][crate::model::alert_policy::alert_strategy::NotificationRateLimit::period].
3323            ///
3324            /// # Example
3325            /// ```ignore,no_run
3326            /// # use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationRateLimit;
3327            /// use wkt::Duration;
3328            /// let x = NotificationRateLimit::new().set_or_clear_period(Some(Duration::default()/* use setters */));
3329            /// let x = NotificationRateLimit::new().set_or_clear_period(None::<Duration>);
3330            /// ```
3331            pub fn set_or_clear_period<T>(mut self, v: std::option::Option<T>) -> Self
3332            where
3333                T: std::convert::Into<wkt::Duration>,
3334            {
3335                self.period = v.map(|x| x.into());
3336                self
3337            }
3338        }
3339
3340        impl wkt::message::Message for NotificationRateLimit {
3341            fn typename() -> &'static str {
3342                "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationRateLimit"
3343            }
3344        }
3345
3346        /// Control over how the notification channels in `notification_channels`
3347        /// are notified when this alert fires, on a per-channel basis.
3348        #[derive(Clone, Default, PartialEq)]
3349        #[non_exhaustive]
3350        pub struct NotificationChannelStrategy {
3351            /// The full REST resource name for the notification channels that these
3352            /// settings apply to. Each of these correspond to the name field in one
3353            /// of the NotificationChannel objects referenced in the
3354            /// notification_channels field of this AlertPolicy.
3355            /// The format is:
3356            ///
3357            /// ```norust
3358            /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
3359            /// ```
3360            pub notification_channel_names: std::vec::Vec<std::string::String>,
3361
3362            /// The frequency at which to send reminder notifications for open
3363            /// incidents.
3364            pub renotify_interval: std::option::Option<wkt::Duration>,
3365
3366            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3367        }
3368
3369        impl NotificationChannelStrategy {
3370            pub fn new() -> Self {
3371                std::default::Default::default()
3372            }
3373
3374            /// Sets the value of [notification_channel_names][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::notification_channel_names].
3375            ///
3376            /// # Example
3377            /// ```ignore,no_run
3378            /// # use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationChannelStrategy;
3379            /// let x = NotificationChannelStrategy::new().set_notification_channel_names(["a", "b", "c"]);
3380            /// ```
3381            pub fn set_notification_channel_names<T, V>(mut self, v: T) -> Self
3382            where
3383                T: std::iter::IntoIterator<Item = V>,
3384                V: std::convert::Into<std::string::String>,
3385            {
3386                use std::iter::Iterator;
3387                self.notification_channel_names = v.into_iter().map(|i| i.into()).collect();
3388                self
3389            }
3390
3391            /// Sets the value of [renotify_interval][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::renotify_interval].
3392            ///
3393            /// # Example
3394            /// ```ignore,no_run
3395            /// # use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationChannelStrategy;
3396            /// use wkt::Duration;
3397            /// let x = NotificationChannelStrategy::new().set_renotify_interval(Duration::default()/* use setters */);
3398            /// ```
3399            pub fn set_renotify_interval<T>(mut self, v: T) -> Self
3400            where
3401                T: std::convert::Into<wkt::Duration>,
3402            {
3403                self.renotify_interval = std::option::Option::Some(v.into());
3404                self
3405            }
3406
3407            /// Sets or clears the value of [renotify_interval][crate::model::alert_policy::alert_strategy::NotificationChannelStrategy::renotify_interval].
3408            ///
3409            /// # Example
3410            /// ```ignore,no_run
3411            /// # use google_cloud_monitoring_v3::model::alert_policy::alert_strategy::NotificationChannelStrategy;
3412            /// use wkt::Duration;
3413            /// let x = NotificationChannelStrategy::new().set_or_clear_renotify_interval(Some(Duration::default()/* use setters */));
3414            /// let x = NotificationChannelStrategy::new().set_or_clear_renotify_interval(None::<Duration>);
3415            /// ```
3416            pub fn set_or_clear_renotify_interval<T>(mut self, v: std::option::Option<T>) -> Self
3417            where
3418                T: std::convert::Into<wkt::Duration>,
3419            {
3420                self.renotify_interval = v.map(|x| x.into());
3421                self
3422            }
3423        }
3424
3425        impl wkt::message::Message for NotificationChannelStrategy {
3426            fn typename() -> &'static str {
3427                "type.googleapis.com/google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationChannelStrategy"
3428            }
3429        }
3430
3431        /// Control when notifications will be sent out.
3432        ///
3433        /// # Working with unknown values
3434        ///
3435        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3436        /// additional enum variants at any time. Adding new variants is not considered
3437        /// a breaking change. Applications should write their code in anticipation of:
3438        ///
3439        /// - New values appearing in future releases of the client library, **and**
3440        /// - New values received dynamically, without application changes.
3441        ///
3442        /// Please consult the [Working with enums] section in the user guide for some
3443        /// guidelines.
3444        ///
3445        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3446        #[derive(Clone, Debug, PartialEq)]
3447        #[non_exhaustive]
3448        pub enum NotificationPrompt {
3449            /// No strategy specified. Treated as error.
3450            Unspecified,
3451            /// Notify when an incident is opened.
3452            Opened,
3453            /// Notify when an incident is closed.
3454            Closed,
3455            /// If set, the enum was initialized with an unknown value.
3456            ///
3457            /// Applications can examine the value using [NotificationPrompt::value] or
3458            /// [NotificationPrompt::name].
3459            UnknownValue(notification_prompt::UnknownValue),
3460        }
3461
3462        #[doc(hidden)]
3463        pub mod notification_prompt {
3464            #[allow(unused_imports)]
3465            use super::*;
3466            #[derive(Clone, Debug, PartialEq)]
3467            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3468        }
3469
3470        impl NotificationPrompt {
3471            /// Gets the enum value.
3472            ///
3473            /// Returns `None` if the enum contains an unknown value deserialized from
3474            /// the string representation of enums.
3475            pub fn value(&self) -> std::option::Option<i32> {
3476                match self {
3477                    Self::Unspecified => std::option::Option::Some(0),
3478                    Self::Opened => std::option::Option::Some(1),
3479                    Self::Closed => std::option::Option::Some(3),
3480                    Self::UnknownValue(u) => u.0.value(),
3481                }
3482            }
3483
3484            /// Gets the enum value as a string.
3485            ///
3486            /// Returns `None` if the enum contains an unknown value deserialized from
3487            /// the integer representation of enums.
3488            pub fn name(&self) -> std::option::Option<&str> {
3489                match self {
3490                    Self::Unspecified => {
3491                        std::option::Option::Some("NOTIFICATION_PROMPT_UNSPECIFIED")
3492                    }
3493                    Self::Opened => std::option::Option::Some("OPENED"),
3494                    Self::Closed => std::option::Option::Some("CLOSED"),
3495                    Self::UnknownValue(u) => u.0.name(),
3496                }
3497            }
3498        }
3499
3500        impl std::default::Default for NotificationPrompt {
3501            fn default() -> Self {
3502                use std::convert::From;
3503                Self::from(0)
3504            }
3505        }
3506
3507        impl std::fmt::Display for NotificationPrompt {
3508            fn fmt(
3509                &self,
3510                f: &mut std::fmt::Formatter<'_>,
3511            ) -> std::result::Result<(), std::fmt::Error> {
3512                wkt::internal::display_enum(f, self.name(), self.value())
3513            }
3514        }
3515
3516        impl std::convert::From<i32> for NotificationPrompt {
3517            fn from(value: i32) -> Self {
3518                match value {
3519                    0 => Self::Unspecified,
3520                    1 => Self::Opened,
3521                    3 => Self::Closed,
3522                    _ => Self::UnknownValue(notification_prompt::UnknownValue(
3523                        wkt::internal::UnknownEnumValue::Integer(value),
3524                    )),
3525                }
3526            }
3527        }
3528
3529        impl std::convert::From<&str> for NotificationPrompt {
3530            fn from(value: &str) -> Self {
3531                use std::string::ToString;
3532                match value {
3533                    "NOTIFICATION_PROMPT_UNSPECIFIED" => Self::Unspecified,
3534                    "OPENED" => Self::Opened,
3535                    "CLOSED" => Self::Closed,
3536                    _ => Self::UnknownValue(notification_prompt::UnknownValue(
3537                        wkt::internal::UnknownEnumValue::String(value.to_string()),
3538                    )),
3539                }
3540            }
3541        }
3542
3543        impl serde::ser::Serialize for NotificationPrompt {
3544            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3545            where
3546                S: serde::Serializer,
3547            {
3548                match self {
3549                    Self::Unspecified => serializer.serialize_i32(0),
3550                    Self::Opened => serializer.serialize_i32(1),
3551                    Self::Closed => serializer.serialize_i32(3),
3552                    Self::UnknownValue(u) => u.0.serialize(serializer),
3553                }
3554            }
3555        }
3556
3557        impl<'de> serde::de::Deserialize<'de> for NotificationPrompt {
3558            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3559            where
3560                D: serde::Deserializer<'de>,
3561            {
3562                deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationPrompt>::new(
3563                    ".google.monitoring.v3.AlertPolicy.AlertStrategy.NotificationPrompt",
3564                ))
3565            }
3566        }
3567    }
3568
3569    /// Operators for combining conditions.
3570    ///
3571    /// # Working with unknown values
3572    ///
3573    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3574    /// additional enum variants at any time. Adding new variants is not considered
3575    /// a breaking change. Applications should write their code in anticipation of:
3576    ///
3577    /// - New values appearing in future releases of the client library, **and**
3578    /// - New values received dynamically, without application changes.
3579    ///
3580    /// Please consult the [Working with enums] section in the user guide for some
3581    /// guidelines.
3582    ///
3583    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3584    #[derive(Clone, Debug, PartialEq)]
3585    #[non_exhaustive]
3586    pub enum ConditionCombinerType {
3587        /// An unspecified combiner.
3588        CombineUnspecified,
3589        /// Combine conditions using the logical `AND` operator. An
3590        /// incident is created only if all the conditions are met
3591        /// simultaneously. This combiner is satisfied if all conditions are
3592        /// met, even if they are met on completely different resources.
3593        And,
3594        /// Combine conditions using the logical `OR` operator. An incident
3595        /// is created if any of the listed conditions is met.
3596        Or,
3597        /// Combine conditions using logical `AND` operator, but unlike the regular
3598        /// `AND` option, an incident is created only if all conditions are met
3599        /// simultaneously on at least one resource.
3600        AndWithMatchingResource,
3601        /// If set, the enum was initialized with an unknown value.
3602        ///
3603        /// Applications can examine the value using [ConditionCombinerType::value] or
3604        /// [ConditionCombinerType::name].
3605        UnknownValue(condition_combiner_type::UnknownValue),
3606    }
3607
3608    #[doc(hidden)]
3609    pub mod condition_combiner_type {
3610        #[allow(unused_imports)]
3611        use super::*;
3612        #[derive(Clone, Debug, PartialEq)]
3613        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3614    }
3615
3616    impl ConditionCombinerType {
3617        /// Gets the enum value.
3618        ///
3619        /// Returns `None` if the enum contains an unknown value deserialized from
3620        /// the string representation of enums.
3621        pub fn value(&self) -> std::option::Option<i32> {
3622            match self {
3623                Self::CombineUnspecified => std::option::Option::Some(0),
3624                Self::And => std::option::Option::Some(1),
3625                Self::Or => std::option::Option::Some(2),
3626                Self::AndWithMatchingResource => std::option::Option::Some(3),
3627                Self::UnknownValue(u) => u.0.value(),
3628            }
3629        }
3630
3631        /// Gets the enum value as a string.
3632        ///
3633        /// Returns `None` if the enum contains an unknown value deserialized from
3634        /// the integer representation of enums.
3635        pub fn name(&self) -> std::option::Option<&str> {
3636            match self {
3637                Self::CombineUnspecified => std::option::Option::Some("COMBINE_UNSPECIFIED"),
3638                Self::And => std::option::Option::Some("AND"),
3639                Self::Or => std::option::Option::Some("OR"),
3640                Self::AndWithMatchingResource => {
3641                    std::option::Option::Some("AND_WITH_MATCHING_RESOURCE")
3642                }
3643                Self::UnknownValue(u) => u.0.name(),
3644            }
3645        }
3646    }
3647
3648    impl std::default::Default for ConditionCombinerType {
3649        fn default() -> Self {
3650            use std::convert::From;
3651            Self::from(0)
3652        }
3653    }
3654
3655    impl std::fmt::Display for ConditionCombinerType {
3656        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3657            wkt::internal::display_enum(f, self.name(), self.value())
3658        }
3659    }
3660
3661    impl std::convert::From<i32> for ConditionCombinerType {
3662        fn from(value: i32) -> Self {
3663            match value {
3664                0 => Self::CombineUnspecified,
3665                1 => Self::And,
3666                2 => Self::Or,
3667                3 => Self::AndWithMatchingResource,
3668                _ => Self::UnknownValue(condition_combiner_type::UnknownValue(
3669                    wkt::internal::UnknownEnumValue::Integer(value),
3670                )),
3671            }
3672        }
3673    }
3674
3675    impl std::convert::From<&str> for ConditionCombinerType {
3676        fn from(value: &str) -> Self {
3677            use std::string::ToString;
3678            match value {
3679                "COMBINE_UNSPECIFIED" => Self::CombineUnspecified,
3680                "AND" => Self::And,
3681                "OR" => Self::Or,
3682                "AND_WITH_MATCHING_RESOURCE" => Self::AndWithMatchingResource,
3683                _ => Self::UnknownValue(condition_combiner_type::UnknownValue(
3684                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3685                )),
3686            }
3687        }
3688    }
3689
3690    impl serde::ser::Serialize for ConditionCombinerType {
3691        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3692        where
3693            S: serde::Serializer,
3694        {
3695            match self {
3696                Self::CombineUnspecified => serializer.serialize_i32(0),
3697                Self::And => serializer.serialize_i32(1),
3698                Self::Or => serializer.serialize_i32(2),
3699                Self::AndWithMatchingResource => serializer.serialize_i32(3),
3700                Self::UnknownValue(u) => u.0.serialize(serializer),
3701            }
3702        }
3703    }
3704
3705    impl<'de> serde::de::Deserialize<'de> for ConditionCombinerType {
3706        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3707        where
3708            D: serde::Deserializer<'de>,
3709        {
3710            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConditionCombinerType>::new(
3711                ".google.monitoring.v3.AlertPolicy.ConditionCombinerType",
3712            ))
3713        }
3714    }
3715
3716    /// An enumeration of possible severity level for an alerting policy.
3717    ///
3718    /// # Working with unknown values
3719    ///
3720    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3721    /// additional enum variants at any time. Adding new variants is not considered
3722    /// a breaking change. Applications should write their code in anticipation of:
3723    ///
3724    /// - New values appearing in future releases of the client library, **and**
3725    /// - New values received dynamically, without application changes.
3726    ///
3727    /// Please consult the [Working with enums] section in the user guide for some
3728    /// guidelines.
3729    ///
3730    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3731    #[derive(Clone, Debug, PartialEq)]
3732    #[non_exhaustive]
3733    pub enum Severity {
3734        /// No severity is specified. This is the default value.
3735        Unspecified,
3736        /// This is the highest severity level. Use this if the problem could
3737        /// cause significant damage or downtime.
3738        Critical,
3739        /// This is the medium severity level. Use this if the problem could
3740        /// cause minor damage or downtime.
3741        Error,
3742        /// This is the lowest severity level. Use this if the problem is not causing
3743        /// any damage or downtime, but could potentially lead to a problem in the
3744        /// future.
3745        Warning,
3746        /// If set, the enum was initialized with an unknown value.
3747        ///
3748        /// Applications can examine the value using [Severity::value] or
3749        /// [Severity::name].
3750        UnknownValue(severity::UnknownValue),
3751    }
3752
3753    #[doc(hidden)]
3754    pub mod severity {
3755        #[allow(unused_imports)]
3756        use super::*;
3757        #[derive(Clone, Debug, PartialEq)]
3758        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3759    }
3760
3761    impl Severity {
3762        /// Gets the enum value.
3763        ///
3764        /// Returns `None` if the enum contains an unknown value deserialized from
3765        /// the string representation of enums.
3766        pub fn value(&self) -> std::option::Option<i32> {
3767            match self {
3768                Self::Unspecified => std::option::Option::Some(0),
3769                Self::Critical => std::option::Option::Some(1),
3770                Self::Error => std::option::Option::Some(2),
3771                Self::Warning => std::option::Option::Some(3),
3772                Self::UnknownValue(u) => u.0.value(),
3773            }
3774        }
3775
3776        /// Gets the enum value as a string.
3777        ///
3778        /// Returns `None` if the enum contains an unknown value deserialized from
3779        /// the integer representation of enums.
3780        pub fn name(&self) -> std::option::Option<&str> {
3781            match self {
3782                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
3783                Self::Critical => std::option::Option::Some("CRITICAL"),
3784                Self::Error => std::option::Option::Some("ERROR"),
3785                Self::Warning => std::option::Option::Some("WARNING"),
3786                Self::UnknownValue(u) => u.0.name(),
3787            }
3788        }
3789    }
3790
3791    impl std::default::Default for Severity {
3792        fn default() -> Self {
3793            use std::convert::From;
3794            Self::from(0)
3795        }
3796    }
3797
3798    impl std::fmt::Display for Severity {
3799        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3800            wkt::internal::display_enum(f, self.name(), self.value())
3801        }
3802    }
3803
3804    impl std::convert::From<i32> for Severity {
3805        fn from(value: i32) -> Self {
3806            match value {
3807                0 => Self::Unspecified,
3808                1 => Self::Critical,
3809                2 => Self::Error,
3810                3 => Self::Warning,
3811                _ => Self::UnknownValue(severity::UnknownValue(
3812                    wkt::internal::UnknownEnumValue::Integer(value),
3813                )),
3814            }
3815        }
3816    }
3817
3818    impl std::convert::From<&str> for Severity {
3819        fn from(value: &str) -> Self {
3820            use std::string::ToString;
3821            match value {
3822                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
3823                "CRITICAL" => Self::Critical,
3824                "ERROR" => Self::Error,
3825                "WARNING" => Self::Warning,
3826                _ => Self::UnknownValue(severity::UnknownValue(
3827                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3828                )),
3829            }
3830        }
3831    }
3832
3833    impl serde::ser::Serialize for Severity {
3834        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3835        where
3836            S: serde::Serializer,
3837        {
3838            match self {
3839                Self::Unspecified => serializer.serialize_i32(0),
3840                Self::Critical => serializer.serialize_i32(1),
3841                Self::Error => serializer.serialize_i32(2),
3842                Self::Warning => serializer.serialize_i32(3),
3843                Self::UnknownValue(u) => u.0.serialize(serializer),
3844            }
3845        }
3846    }
3847
3848    impl<'de> serde::de::Deserialize<'de> for Severity {
3849        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3850        where
3851            D: serde::Deserializer<'de>,
3852        {
3853            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
3854                ".google.monitoring.v3.AlertPolicy.Severity",
3855            ))
3856        }
3857    }
3858}
3859
3860/// The protocol for the `CreateAlertPolicy` request.
3861#[derive(Clone, Default, PartialEq)]
3862#[non_exhaustive]
3863pub struct CreateAlertPolicyRequest {
3864    /// Required. The
3865    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
3866    /// to create the alerting policy. The format is:
3867    ///
3868    /// ```norust
3869    /// projects/[PROJECT_ID_OR_NUMBER]
3870    /// ```
3871    ///
3872    /// Note that this field names the parent container in which the alerting
3873    /// policy will be written, not the name of the created policy. |name| must be
3874    /// a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will
3875    /// return. The alerting policy that is returned will have a name that contains
3876    /// a normalized representation of this name as a prefix but adds a suffix of
3877    /// the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
3878    /// container.
3879    pub name: std::string::String,
3880
3881    /// Required. The requested alerting policy. You should omit the `name` field
3882    /// in this policy. The name will be returned in the new policy, including a
3883    /// new `[ALERT_POLICY_ID]` value.
3884    pub alert_policy: std::option::Option<crate::model::AlertPolicy>,
3885
3886    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3887}
3888
3889impl CreateAlertPolicyRequest {
3890    pub fn new() -> Self {
3891        std::default::Default::default()
3892    }
3893
3894    /// Sets the value of [name][crate::model::CreateAlertPolicyRequest::name].
3895    ///
3896    /// # Example
3897    /// ```ignore,no_run
3898    /// # use google_cloud_monitoring_v3::model::CreateAlertPolicyRequest;
3899    /// let x = CreateAlertPolicyRequest::new().set_name("example");
3900    /// ```
3901    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3902        self.name = v.into();
3903        self
3904    }
3905
3906    /// Sets the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
3907    ///
3908    /// # Example
3909    /// ```ignore,no_run
3910    /// # use google_cloud_monitoring_v3::model::CreateAlertPolicyRequest;
3911    /// use google_cloud_monitoring_v3::model::AlertPolicy;
3912    /// let x = CreateAlertPolicyRequest::new().set_alert_policy(AlertPolicy::default()/* use setters */);
3913    /// ```
3914    pub fn set_alert_policy<T>(mut self, v: T) -> Self
3915    where
3916        T: std::convert::Into<crate::model::AlertPolicy>,
3917    {
3918        self.alert_policy = std::option::Option::Some(v.into());
3919        self
3920    }
3921
3922    /// Sets or clears the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
3923    ///
3924    /// # Example
3925    /// ```ignore,no_run
3926    /// # use google_cloud_monitoring_v3::model::CreateAlertPolicyRequest;
3927    /// use google_cloud_monitoring_v3::model::AlertPolicy;
3928    /// let x = CreateAlertPolicyRequest::new().set_or_clear_alert_policy(Some(AlertPolicy::default()/* use setters */));
3929    /// let x = CreateAlertPolicyRequest::new().set_or_clear_alert_policy(None::<AlertPolicy>);
3930    /// ```
3931    pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
3932    where
3933        T: std::convert::Into<crate::model::AlertPolicy>,
3934    {
3935        self.alert_policy = v.map(|x| x.into());
3936        self
3937    }
3938}
3939
3940impl wkt::message::Message for CreateAlertPolicyRequest {
3941    fn typename() -> &'static str {
3942        "type.googleapis.com/google.monitoring.v3.CreateAlertPolicyRequest"
3943    }
3944}
3945
3946/// The protocol for the `GetAlertPolicy` request.
3947#[derive(Clone, Default, PartialEq)]
3948#[non_exhaustive]
3949pub struct GetAlertPolicyRequest {
3950    /// Required. The alerting policy to retrieve. The format is:
3951    ///
3952    /// ```norust
3953    /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
3954    /// ```
3955    pub name: std::string::String,
3956
3957    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3958}
3959
3960impl GetAlertPolicyRequest {
3961    pub fn new() -> Self {
3962        std::default::Default::default()
3963    }
3964
3965    /// Sets the value of [name][crate::model::GetAlertPolicyRequest::name].
3966    ///
3967    /// # Example
3968    /// ```ignore,no_run
3969    /// # use google_cloud_monitoring_v3::model::GetAlertPolicyRequest;
3970    /// let x = GetAlertPolicyRequest::new().set_name("example");
3971    /// ```
3972    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3973        self.name = v.into();
3974        self
3975    }
3976}
3977
3978impl wkt::message::Message for GetAlertPolicyRequest {
3979    fn typename() -> &'static str {
3980        "type.googleapis.com/google.monitoring.v3.GetAlertPolicyRequest"
3981    }
3982}
3983
3984/// The protocol for the `ListAlertPolicies` request.
3985#[derive(Clone, Default, PartialEq)]
3986#[non_exhaustive]
3987pub struct ListAlertPoliciesRequest {
3988    /// Required. The
3989    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
3990    /// alert policies are to be listed. The format is:
3991    ///
3992    /// ```norust
3993    /// projects/[PROJECT_ID_OR_NUMBER]
3994    /// ```
3995    ///
3996    /// Note that this field names the parent container in which the alerting
3997    /// policies to be listed are stored. To retrieve a single alerting policy
3998    /// by name, use the
3999    /// [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
4000    /// operation, instead.
4001    ///
4002    /// [google.monitoring.v3.AlertPolicyService.GetAlertPolicy]: crate::client::AlertPolicyService::get_alert_policy
4003    pub name: std::string::String,
4004
4005    /// Optional. If provided, this field specifies the criteria that must be met
4006    /// by alert policies to be included in the response.
4007    ///
4008    /// For more details, see [sorting and
4009    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
4010    pub filter: std::string::String,
4011
4012    /// Optional. A comma-separated list of fields by which to sort the result.
4013    /// Supports the same set of field references as the `filter` field. Entries
4014    /// can be prefixed with a minus sign to sort by the field in descending order.
4015    ///
4016    /// For more details, see [sorting and
4017    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
4018    pub order_by: std::string::String,
4019
4020    /// Optional. The maximum number of results to return in a single response.
4021    pub page_size: i32,
4022
4023    /// Optional. If this field is not empty then it must contain the
4024    /// `nextPageToken` value returned by a previous call to this method.  Using
4025    /// this field causes the method to return more results from the previous
4026    /// method call.
4027    pub page_token: std::string::String,
4028
4029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4030}
4031
4032impl ListAlertPoliciesRequest {
4033    pub fn new() -> Self {
4034        std::default::Default::default()
4035    }
4036
4037    /// Sets the value of [name][crate::model::ListAlertPoliciesRequest::name].
4038    ///
4039    /// # Example
4040    /// ```ignore,no_run
4041    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesRequest;
4042    /// let x = ListAlertPoliciesRequest::new().set_name("example");
4043    /// ```
4044    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4045        self.name = v.into();
4046        self
4047    }
4048
4049    /// Sets the value of [filter][crate::model::ListAlertPoliciesRequest::filter].
4050    ///
4051    /// # Example
4052    /// ```ignore,no_run
4053    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesRequest;
4054    /// let x = ListAlertPoliciesRequest::new().set_filter("example");
4055    /// ```
4056    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4057        self.filter = v.into();
4058        self
4059    }
4060
4061    /// Sets the value of [order_by][crate::model::ListAlertPoliciesRequest::order_by].
4062    ///
4063    /// # Example
4064    /// ```ignore,no_run
4065    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesRequest;
4066    /// let x = ListAlertPoliciesRequest::new().set_order_by("example");
4067    /// ```
4068    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4069        self.order_by = v.into();
4070        self
4071    }
4072
4073    /// Sets the value of [page_size][crate::model::ListAlertPoliciesRequest::page_size].
4074    ///
4075    /// # Example
4076    /// ```ignore,no_run
4077    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesRequest;
4078    /// let x = ListAlertPoliciesRequest::new().set_page_size(42);
4079    /// ```
4080    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4081        self.page_size = v.into();
4082        self
4083    }
4084
4085    /// Sets the value of [page_token][crate::model::ListAlertPoliciesRequest::page_token].
4086    ///
4087    /// # Example
4088    /// ```ignore,no_run
4089    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesRequest;
4090    /// let x = ListAlertPoliciesRequest::new().set_page_token("example");
4091    /// ```
4092    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4093        self.page_token = v.into();
4094        self
4095    }
4096}
4097
4098impl wkt::message::Message for ListAlertPoliciesRequest {
4099    fn typename() -> &'static str {
4100        "type.googleapis.com/google.monitoring.v3.ListAlertPoliciesRequest"
4101    }
4102}
4103
4104/// The protocol for the `ListAlertPolicies` response.
4105#[derive(Clone, Default, PartialEq)]
4106#[non_exhaustive]
4107pub struct ListAlertPoliciesResponse {
4108    /// The returned alert policies.
4109    pub alert_policies: std::vec::Vec<crate::model::AlertPolicy>,
4110
4111    /// If there might be more results than were returned, then this field is set
4112    /// to a non-empty value. To see the additional results,
4113    /// use that value as `page_token` in the next call to this method.
4114    pub next_page_token: std::string::String,
4115
4116    /// The total number of alert policies in all pages. This number is only an
4117    /// estimate, and may change in subsequent pages. <https://aip.dev/158>
4118    pub total_size: i32,
4119
4120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4121}
4122
4123impl ListAlertPoliciesResponse {
4124    pub fn new() -> Self {
4125        std::default::Default::default()
4126    }
4127
4128    /// Sets the value of [alert_policies][crate::model::ListAlertPoliciesResponse::alert_policies].
4129    ///
4130    /// # Example
4131    /// ```ignore,no_run
4132    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesResponse;
4133    /// use google_cloud_monitoring_v3::model::AlertPolicy;
4134    /// let x = ListAlertPoliciesResponse::new()
4135    ///     .set_alert_policies([
4136    ///         AlertPolicy::default()/* use setters */,
4137    ///         AlertPolicy::default()/* use (different) setters */,
4138    ///     ]);
4139    /// ```
4140    pub fn set_alert_policies<T, V>(mut self, v: T) -> Self
4141    where
4142        T: std::iter::IntoIterator<Item = V>,
4143        V: std::convert::Into<crate::model::AlertPolicy>,
4144    {
4145        use std::iter::Iterator;
4146        self.alert_policies = v.into_iter().map(|i| i.into()).collect();
4147        self
4148    }
4149
4150    /// Sets the value of [next_page_token][crate::model::ListAlertPoliciesResponse::next_page_token].
4151    ///
4152    /// # Example
4153    /// ```ignore,no_run
4154    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesResponse;
4155    /// let x = ListAlertPoliciesResponse::new().set_next_page_token("example");
4156    /// ```
4157    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4158        self.next_page_token = v.into();
4159        self
4160    }
4161
4162    /// Sets the value of [total_size][crate::model::ListAlertPoliciesResponse::total_size].
4163    ///
4164    /// # Example
4165    /// ```ignore,no_run
4166    /// # use google_cloud_monitoring_v3::model::ListAlertPoliciesResponse;
4167    /// let x = ListAlertPoliciesResponse::new().set_total_size(42);
4168    /// ```
4169    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4170        self.total_size = v.into();
4171        self
4172    }
4173}
4174
4175impl wkt::message::Message for ListAlertPoliciesResponse {
4176    fn typename() -> &'static str {
4177        "type.googleapis.com/google.monitoring.v3.ListAlertPoliciesResponse"
4178    }
4179}
4180
4181#[doc(hidden)]
4182impl gax::paginator::internal::PageableResponse for ListAlertPoliciesResponse {
4183    type PageItem = crate::model::AlertPolicy;
4184
4185    fn items(self) -> std::vec::Vec<Self::PageItem> {
4186        self.alert_policies
4187    }
4188
4189    fn next_page_token(&self) -> std::string::String {
4190        use std::clone::Clone;
4191        self.next_page_token.clone()
4192    }
4193}
4194
4195/// The protocol for the `UpdateAlertPolicy` request.
4196#[derive(Clone, Default, PartialEq)]
4197#[non_exhaustive]
4198pub struct UpdateAlertPolicyRequest {
4199    /// Optional. A list of alerting policy field names. If this field is not
4200    /// empty, each listed field in the existing alerting policy is set to the
4201    /// value of the corresponding field in the supplied policy (`alert_policy`),
4202    /// or to the field's default value if the field is not in the supplied
4203    /// alerting policy.  Fields not listed retain their previous value.
4204    ///
4205    /// Examples of valid field masks include `display_name`, `documentation`,
4206    /// `documentation.content`, `documentation.mime_type`, `user_labels`,
4207    /// `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc.
4208    ///
4209    /// If this field is empty, then the supplied alerting policy replaces the
4210    /// existing policy. It is the same as deleting the existing policy and
4211    /// adding the supplied policy, except for the following:
4212    ///
4213    /// + The new policy will have the same `[ALERT_POLICY_ID]` as the former
4214    ///   policy. This gives you continuity with the former policy in your
4215    ///   notifications and incidents.
4216    /// + Conditions in the new policy will keep their former `[CONDITION_ID]` if
4217    ///   the supplied condition includes the `name` field with that
4218    ///   `[CONDITION_ID]`. If the supplied condition omits the `name` field,
4219    ///   then a new `[CONDITION_ID]` is created.
4220    pub update_mask: std::option::Option<wkt::FieldMask>,
4221
4222    /// Required. The updated alerting policy or the updated values for the
4223    /// fields listed in `update_mask`.
4224    /// If `update_mask` is not empty, any fields in this policy that are
4225    /// not in `update_mask` are ignored.
4226    pub alert_policy: std::option::Option<crate::model::AlertPolicy>,
4227
4228    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4229}
4230
4231impl UpdateAlertPolicyRequest {
4232    pub fn new() -> Self {
4233        std::default::Default::default()
4234    }
4235
4236    /// Sets the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
4237    ///
4238    /// # Example
4239    /// ```ignore,no_run
4240    /// # use google_cloud_monitoring_v3::model::UpdateAlertPolicyRequest;
4241    /// use wkt::FieldMask;
4242    /// let x = UpdateAlertPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4243    /// ```
4244    pub fn set_update_mask<T>(mut self, v: T) -> Self
4245    where
4246        T: std::convert::Into<wkt::FieldMask>,
4247    {
4248        self.update_mask = std::option::Option::Some(v.into());
4249        self
4250    }
4251
4252    /// Sets or clears the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
4253    ///
4254    /// # Example
4255    /// ```ignore,no_run
4256    /// # use google_cloud_monitoring_v3::model::UpdateAlertPolicyRequest;
4257    /// use wkt::FieldMask;
4258    /// let x = UpdateAlertPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4259    /// let x = UpdateAlertPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4260    /// ```
4261    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4262    where
4263        T: std::convert::Into<wkt::FieldMask>,
4264    {
4265        self.update_mask = v.map(|x| x.into());
4266        self
4267    }
4268
4269    /// Sets the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
4270    ///
4271    /// # Example
4272    /// ```ignore,no_run
4273    /// # use google_cloud_monitoring_v3::model::UpdateAlertPolicyRequest;
4274    /// use google_cloud_monitoring_v3::model::AlertPolicy;
4275    /// let x = UpdateAlertPolicyRequest::new().set_alert_policy(AlertPolicy::default()/* use setters */);
4276    /// ```
4277    pub fn set_alert_policy<T>(mut self, v: T) -> Self
4278    where
4279        T: std::convert::Into<crate::model::AlertPolicy>,
4280    {
4281        self.alert_policy = std::option::Option::Some(v.into());
4282        self
4283    }
4284
4285    /// Sets or clears the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
4286    ///
4287    /// # Example
4288    /// ```ignore,no_run
4289    /// # use google_cloud_monitoring_v3::model::UpdateAlertPolicyRequest;
4290    /// use google_cloud_monitoring_v3::model::AlertPolicy;
4291    /// let x = UpdateAlertPolicyRequest::new().set_or_clear_alert_policy(Some(AlertPolicy::default()/* use setters */));
4292    /// let x = UpdateAlertPolicyRequest::new().set_or_clear_alert_policy(None::<AlertPolicy>);
4293    /// ```
4294    pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
4295    where
4296        T: std::convert::Into<crate::model::AlertPolicy>,
4297    {
4298        self.alert_policy = v.map(|x| x.into());
4299        self
4300    }
4301}
4302
4303impl wkt::message::Message for UpdateAlertPolicyRequest {
4304    fn typename() -> &'static str {
4305        "type.googleapis.com/google.monitoring.v3.UpdateAlertPolicyRequest"
4306    }
4307}
4308
4309/// The protocol for the `DeleteAlertPolicy` request.
4310#[derive(Clone, Default, PartialEq)]
4311#[non_exhaustive]
4312pub struct DeleteAlertPolicyRequest {
4313    /// Required. The alerting policy to delete. The format is:
4314    ///
4315    /// ```norust
4316    /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
4317    /// ```
4318    ///
4319    /// For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
4320    ///
4321    /// [google.monitoring.v3.AlertPolicy]: crate::model::AlertPolicy
4322    pub name: std::string::String,
4323
4324    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4325}
4326
4327impl DeleteAlertPolicyRequest {
4328    pub fn new() -> Self {
4329        std::default::Default::default()
4330    }
4331
4332    /// Sets the value of [name][crate::model::DeleteAlertPolicyRequest::name].
4333    ///
4334    /// # Example
4335    /// ```ignore,no_run
4336    /// # use google_cloud_monitoring_v3::model::DeleteAlertPolicyRequest;
4337    /// let x = DeleteAlertPolicyRequest::new().set_name("example");
4338    /// ```
4339    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4340        self.name = v.into();
4341        self
4342    }
4343}
4344
4345impl wkt::message::Message for DeleteAlertPolicyRequest {
4346    fn typename() -> &'static str {
4347        "type.googleapis.com/google.monitoring.v3.DeleteAlertPolicyRequest"
4348    }
4349}
4350
4351/// A single strongly-typed value.
4352#[derive(Clone, Default, PartialEq)]
4353#[non_exhaustive]
4354pub struct TypedValue {
4355    /// The typed value field.
4356    pub value: std::option::Option<crate::model::typed_value::Value>,
4357
4358    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4359}
4360
4361impl TypedValue {
4362    pub fn new() -> Self {
4363        std::default::Default::default()
4364    }
4365
4366    /// Sets the value of [value][crate::model::TypedValue::value].
4367    ///
4368    /// Note that all the setters affecting `value` are mutually
4369    /// exclusive.
4370    ///
4371    /// # Example
4372    /// ```ignore,no_run
4373    /// # use google_cloud_monitoring_v3::model::TypedValue;
4374    /// use google_cloud_monitoring_v3::model::typed_value::Value;
4375    /// let x = TypedValue::new().set_value(Some(Value::BoolValue(true)));
4376    /// ```
4377    pub fn set_value<
4378        T: std::convert::Into<std::option::Option<crate::model::typed_value::Value>>,
4379    >(
4380        mut self,
4381        v: T,
4382    ) -> Self {
4383        self.value = v.into();
4384        self
4385    }
4386
4387    /// The value of [value][crate::model::TypedValue::value]
4388    /// if it holds a `BoolValue`, `None` if the field is not set or
4389    /// holds a different branch.
4390    pub fn bool_value(&self) -> std::option::Option<&bool> {
4391        #[allow(unreachable_patterns)]
4392        self.value.as_ref().and_then(|v| match v {
4393            crate::model::typed_value::Value::BoolValue(v) => std::option::Option::Some(v),
4394            _ => std::option::Option::None,
4395        })
4396    }
4397
4398    /// Sets the value of [value][crate::model::TypedValue::value]
4399    /// to hold a `BoolValue`.
4400    ///
4401    /// Note that all the setters affecting `value` are
4402    /// mutually exclusive.
4403    ///
4404    /// # Example
4405    /// ```ignore,no_run
4406    /// # use google_cloud_monitoring_v3::model::TypedValue;
4407    /// let x = TypedValue::new().set_bool_value(true);
4408    /// assert!(x.bool_value().is_some());
4409    /// assert!(x.int64_value().is_none());
4410    /// assert!(x.double_value().is_none());
4411    /// assert!(x.string_value().is_none());
4412    /// assert!(x.distribution_value().is_none());
4413    /// ```
4414    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4415        self.value =
4416            std::option::Option::Some(crate::model::typed_value::Value::BoolValue(v.into()));
4417        self
4418    }
4419
4420    /// The value of [value][crate::model::TypedValue::value]
4421    /// if it holds a `Int64Value`, `None` if the field is not set or
4422    /// holds a different branch.
4423    pub fn int64_value(&self) -> std::option::Option<&i64> {
4424        #[allow(unreachable_patterns)]
4425        self.value.as_ref().and_then(|v| match v {
4426            crate::model::typed_value::Value::Int64Value(v) => std::option::Option::Some(v),
4427            _ => std::option::Option::None,
4428        })
4429    }
4430
4431    /// Sets the value of [value][crate::model::TypedValue::value]
4432    /// to hold a `Int64Value`.
4433    ///
4434    /// Note that all the setters affecting `value` are
4435    /// mutually exclusive.
4436    ///
4437    /// # Example
4438    /// ```ignore,no_run
4439    /// # use google_cloud_monitoring_v3::model::TypedValue;
4440    /// let x = TypedValue::new().set_int64_value(42);
4441    /// assert!(x.int64_value().is_some());
4442    /// assert!(x.bool_value().is_none());
4443    /// assert!(x.double_value().is_none());
4444    /// assert!(x.string_value().is_none());
4445    /// assert!(x.distribution_value().is_none());
4446    /// ```
4447    pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4448        self.value =
4449            std::option::Option::Some(crate::model::typed_value::Value::Int64Value(v.into()));
4450        self
4451    }
4452
4453    /// The value of [value][crate::model::TypedValue::value]
4454    /// if it holds a `DoubleValue`, `None` if the field is not set or
4455    /// holds a different branch.
4456    pub fn double_value(&self) -> std::option::Option<&f64> {
4457        #[allow(unreachable_patterns)]
4458        self.value.as_ref().and_then(|v| match v {
4459            crate::model::typed_value::Value::DoubleValue(v) => std::option::Option::Some(v),
4460            _ => std::option::Option::None,
4461        })
4462    }
4463
4464    /// Sets the value of [value][crate::model::TypedValue::value]
4465    /// to hold a `DoubleValue`.
4466    ///
4467    /// Note that all the setters affecting `value` are
4468    /// mutually exclusive.
4469    ///
4470    /// # Example
4471    /// ```ignore,no_run
4472    /// # use google_cloud_monitoring_v3::model::TypedValue;
4473    /// let x = TypedValue::new().set_double_value(42.0);
4474    /// assert!(x.double_value().is_some());
4475    /// assert!(x.bool_value().is_none());
4476    /// assert!(x.int64_value().is_none());
4477    /// assert!(x.string_value().is_none());
4478    /// assert!(x.distribution_value().is_none());
4479    /// ```
4480    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
4481        self.value =
4482            std::option::Option::Some(crate::model::typed_value::Value::DoubleValue(v.into()));
4483        self
4484    }
4485
4486    /// The value of [value][crate::model::TypedValue::value]
4487    /// if it holds a `StringValue`, `None` if the field is not set or
4488    /// holds a different branch.
4489    pub fn string_value(&self) -> std::option::Option<&std::string::String> {
4490        #[allow(unreachable_patterns)]
4491        self.value.as_ref().and_then(|v| match v {
4492            crate::model::typed_value::Value::StringValue(v) => std::option::Option::Some(v),
4493            _ => std::option::Option::None,
4494        })
4495    }
4496
4497    /// Sets the value of [value][crate::model::TypedValue::value]
4498    /// to hold a `StringValue`.
4499    ///
4500    /// Note that all the setters affecting `value` are
4501    /// mutually exclusive.
4502    ///
4503    /// # Example
4504    /// ```ignore,no_run
4505    /// # use google_cloud_monitoring_v3::model::TypedValue;
4506    /// let x = TypedValue::new().set_string_value("example");
4507    /// assert!(x.string_value().is_some());
4508    /// assert!(x.bool_value().is_none());
4509    /// assert!(x.int64_value().is_none());
4510    /// assert!(x.double_value().is_none());
4511    /// assert!(x.distribution_value().is_none());
4512    /// ```
4513    pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4514        self.value =
4515            std::option::Option::Some(crate::model::typed_value::Value::StringValue(v.into()));
4516        self
4517    }
4518
4519    /// The value of [value][crate::model::TypedValue::value]
4520    /// if it holds a `DistributionValue`, `None` if the field is not set or
4521    /// holds a different branch.
4522    pub fn distribution_value(
4523        &self,
4524    ) -> std::option::Option<&std::boxed::Box<api::model::Distribution>> {
4525        #[allow(unreachable_patterns)]
4526        self.value.as_ref().and_then(|v| match v {
4527            crate::model::typed_value::Value::DistributionValue(v) => std::option::Option::Some(v),
4528            _ => std::option::Option::None,
4529        })
4530    }
4531
4532    /// Sets the value of [value][crate::model::TypedValue::value]
4533    /// to hold a `DistributionValue`.
4534    ///
4535    /// Note that all the setters affecting `value` are
4536    /// mutually exclusive.
4537    ///
4538    /// # Example
4539    /// ```ignore,no_run
4540    /// # use google_cloud_monitoring_v3::model::TypedValue;
4541    /// use api::model::Distribution;
4542    /// let x = TypedValue::new().set_distribution_value(Distribution::default()/* use setters */);
4543    /// assert!(x.distribution_value().is_some());
4544    /// assert!(x.bool_value().is_none());
4545    /// assert!(x.int64_value().is_none());
4546    /// assert!(x.double_value().is_none());
4547    /// assert!(x.string_value().is_none());
4548    /// ```
4549    pub fn set_distribution_value<
4550        T: std::convert::Into<std::boxed::Box<api::model::Distribution>>,
4551    >(
4552        mut self,
4553        v: T,
4554    ) -> Self {
4555        self.value = std::option::Option::Some(
4556            crate::model::typed_value::Value::DistributionValue(v.into()),
4557        );
4558        self
4559    }
4560}
4561
4562impl wkt::message::Message for TypedValue {
4563    fn typename() -> &'static str {
4564        "type.googleapis.com/google.monitoring.v3.TypedValue"
4565    }
4566}
4567
4568/// Defines additional types related to [TypedValue].
4569pub mod typed_value {
4570    #[allow(unused_imports)]
4571    use super::*;
4572
4573    /// The typed value field.
4574    #[derive(Clone, Debug, PartialEq)]
4575    #[non_exhaustive]
4576    pub enum Value {
4577        /// A Boolean value: `true` or `false`.
4578        BoolValue(bool),
4579        /// A 64-bit integer. Its range is approximately &plusmn;9.2x10\<sup\>18\</sup\>.
4580        Int64Value(i64),
4581        /// A 64-bit double-precision floating-point number. Its magnitude
4582        /// is approximately &plusmn;10\<sup\>&plusmn;300\</sup\> and it has 16
4583        /// significant digits of precision.
4584        DoubleValue(f64),
4585        /// A variable-length string value.
4586        StringValue(std::string::String),
4587        /// A distribution value.
4588        DistributionValue(std::boxed::Box<api::model::Distribution>),
4589    }
4590}
4591
4592/// Describes a time interval:
4593///
4594/// * Reads: A half-open time interval. It includes the end time but
4595///   excludes the start time: `(startTime, endTime]`. The start time
4596///   must be specified, must be earlier than the end time, and should be
4597///   no older than the data retention period for the metric.
4598/// * Writes: A closed time interval. It extends from the start time to the end
4599///   time,
4600///   and includes both: `[startTime, endTime]`. Valid time intervals
4601///   depend on the
4602///   [`MetricKind`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind)
4603///   of the metric value. The end time must not be earlier than the start
4604///   time, and the end time must not be more than 25 hours in the past or more
4605///   than five minutes in the future.
4606///   * For `GAUGE` metrics, the `startTime` value is technically optional; if
4607///     no value is specified, the start time defaults to the value of the
4608///     end time, and the interval represents a single point in time. If both
4609///     start and end times are specified, they must be identical. Such an
4610///     interval is valid only for `GAUGE` metrics, which are point-in-time
4611///     measurements. The end time of a new interval must be at least a
4612///     millisecond after the end time of the previous interval.
4613///   * For `DELTA` metrics, the start time and end time must specify a
4614///     non-zero interval, with subsequent points specifying contiguous and
4615///     non-overlapping intervals. For `DELTA` metrics, the start time of
4616///     the next interval must be at least a millisecond after the end time
4617///     of the previous interval.
4618///   * For `CUMULATIVE` metrics, the start time and end time must specify a
4619///     non-zero interval, with subsequent points specifying the same
4620///     start time and increasing end times, until an event resets the
4621///     cumulative value to zero and sets a new start time for the following
4622///     points. The new start time must be at least a millisecond after the
4623///     end time of the previous interval.
4624///   * The start time of a new interval must be at least a millisecond after
4625///     the
4626///     end time of the previous interval because intervals are closed. If the
4627///     start time of a new interval is the same as the end time of the
4628///     previous interval, then data written at the new start time could
4629///     overwrite data written at the previous end time.
4630#[derive(Clone, Default, PartialEq)]
4631#[non_exhaustive]
4632pub struct TimeInterval {
4633    /// Required. The end of the time interval.
4634    pub end_time: std::option::Option<wkt::Timestamp>,
4635
4636    /// Optional. The beginning of the time interval.  The default value
4637    /// for the start time is the end time. The start time must not be
4638    /// later than the end time.
4639    pub start_time: std::option::Option<wkt::Timestamp>,
4640
4641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4642}
4643
4644impl TimeInterval {
4645    pub fn new() -> Self {
4646        std::default::Default::default()
4647    }
4648
4649    /// Sets the value of [end_time][crate::model::TimeInterval::end_time].
4650    ///
4651    /// # Example
4652    /// ```ignore,no_run
4653    /// # use google_cloud_monitoring_v3::model::TimeInterval;
4654    /// use wkt::Timestamp;
4655    /// let x = TimeInterval::new().set_end_time(Timestamp::default()/* use setters */);
4656    /// ```
4657    pub fn set_end_time<T>(mut self, v: T) -> Self
4658    where
4659        T: std::convert::Into<wkt::Timestamp>,
4660    {
4661        self.end_time = std::option::Option::Some(v.into());
4662        self
4663    }
4664
4665    /// Sets or clears the value of [end_time][crate::model::TimeInterval::end_time].
4666    ///
4667    /// # Example
4668    /// ```ignore,no_run
4669    /// # use google_cloud_monitoring_v3::model::TimeInterval;
4670    /// use wkt::Timestamp;
4671    /// let x = TimeInterval::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4672    /// let x = TimeInterval::new().set_or_clear_end_time(None::<Timestamp>);
4673    /// ```
4674    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4675    where
4676        T: std::convert::Into<wkt::Timestamp>,
4677    {
4678        self.end_time = v.map(|x| x.into());
4679        self
4680    }
4681
4682    /// Sets the value of [start_time][crate::model::TimeInterval::start_time].
4683    ///
4684    /// # Example
4685    /// ```ignore,no_run
4686    /// # use google_cloud_monitoring_v3::model::TimeInterval;
4687    /// use wkt::Timestamp;
4688    /// let x = TimeInterval::new().set_start_time(Timestamp::default()/* use setters */);
4689    /// ```
4690    pub fn set_start_time<T>(mut self, v: T) -> Self
4691    where
4692        T: std::convert::Into<wkt::Timestamp>,
4693    {
4694        self.start_time = std::option::Option::Some(v.into());
4695        self
4696    }
4697
4698    /// Sets or clears the value of [start_time][crate::model::TimeInterval::start_time].
4699    ///
4700    /// # Example
4701    /// ```ignore,no_run
4702    /// # use google_cloud_monitoring_v3::model::TimeInterval;
4703    /// use wkt::Timestamp;
4704    /// let x = TimeInterval::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4705    /// let x = TimeInterval::new().set_or_clear_start_time(None::<Timestamp>);
4706    /// ```
4707    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4708    where
4709        T: std::convert::Into<wkt::Timestamp>,
4710    {
4711        self.start_time = v.map(|x| x.into());
4712        self
4713    }
4714}
4715
4716impl wkt::message::Message for TimeInterval {
4717    fn typename() -> &'static str {
4718        "type.googleapis.com/google.monitoring.v3.TimeInterval"
4719    }
4720}
4721
4722/// Describes how to combine multiple time series to provide a different view of
4723/// the data.  Aggregation of time series is done in two steps. First, each time
4724/// series in the set is _aligned_ to the same time interval boundaries, then the
4725/// set of time series is optionally _reduced_ in number.
4726///
4727/// Alignment consists of applying the `per_series_aligner` operation
4728/// to each time series after its data has been divided into regular
4729/// `alignment_period` time intervals. This process takes _all_ of the data
4730/// points in an alignment period, applies a mathematical transformation such as
4731/// averaging, minimum, maximum, delta, etc., and converts them into a single
4732/// data point per period.
4733///
4734/// Reduction is when the aligned and transformed time series can optionally be
4735/// combined, reducing the number of time series through similar mathematical
4736/// transformations. Reduction involves applying a `cross_series_reducer` to
4737/// all the time series, optionally sorting the time series into subsets with
4738/// `group_by_fields`, and applying the reducer to each subset.
4739///
4740/// The raw time series data can contain a huge amount of information from
4741/// multiple sources. Alignment and reduction transforms this mass of data into
4742/// a more manageable and representative collection of data, for example "the
4743/// 95% latency across the average of all tasks in a cluster". This
4744/// representative data can be more easily graphed and comprehended, and the
4745/// individual time series data is still available for later drilldown. For more
4746/// details, see [Filtering and
4747/// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation).
4748#[derive(Clone, Default, PartialEq)]
4749#[non_exhaustive]
4750pub struct Aggregation {
4751    /// The `alignment_period` specifies a time interval, in seconds, that is used
4752    /// to divide the data in all the
4753    /// [time series][google.monitoring.v3.TimeSeries] into consistent blocks of
4754    /// time. This will be done before the per-series aligner can be applied to
4755    /// the data.
4756    ///
4757    /// The value must be at least 60 seconds. If a per-series
4758    /// aligner other than `ALIGN_NONE` is specified, this field is required or an
4759    /// error is returned. If no per-series aligner is specified, or the aligner
4760    /// `ALIGN_NONE` is specified, then this field is ignored.
4761    ///
4762    /// The maximum value of the `alignment_period` is 104 weeks (2 years) for
4763    /// charts, and 90,000 seconds (25 hours) for alerting policies.
4764    ///
4765    /// [google.monitoring.v3.TimeSeries]: crate::model::TimeSeries
4766    pub alignment_period: std::option::Option<wkt::Duration>,
4767
4768    /// An `Aligner` describes how to bring the data points in a single
4769    /// time series into temporal alignment. Except for `ALIGN_NONE`, all
4770    /// alignments cause all the data points in an `alignment_period` to be
4771    /// mathematically grouped together, resulting in a single data point for
4772    /// each `alignment_period` with end timestamp at the end of the period.
4773    ///
4774    /// Not all alignment operations may be applied to all time series. The valid
4775    /// choices depend on the `metric_kind` and `value_type` of the original time
4776    /// series. Alignment can change the `metric_kind` or the `value_type` of
4777    /// the time series.
4778    ///
4779    /// Time series data must be aligned in order to perform cross-time
4780    /// series reduction. If `cross_series_reducer` is specified, then
4781    /// `per_series_aligner` must be specified and not equal to `ALIGN_NONE`
4782    /// and `alignment_period` must be specified; otherwise, an error is
4783    /// returned.
4784    pub per_series_aligner: crate::model::aggregation::Aligner,
4785
4786    /// The reduction operation to be used to combine time series into a single
4787    /// time series, where the value of each data point in the resulting series is
4788    /// a function of all the already aligned values in the input time series.
4789    ///
4790    /// Not all reducer operations can be applied to all time series. The valid
4791    /// choices depend on the `metric_kind` and the `value_type` of the original
4792    /// time series. Reduction can yield a time series with a different
4793    /// `metric_kind` or `value_type` than the input time series.
4794    ///
4795    /// Time series data must first be aligned (see `per_series_aligner`) in order
4796    /// to perform cross-time series reduction. If `cross_series_reducer` is
4797    /// specified, then `per_series_aligner` must be specified, and must not be
4798    /// `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an
4799    /// error is returned.
4800    pub cross_series_reducer: crate::model::aggregation::Reducer,
4801
4802    /// The set of fields to preserve when `cross_series_reducer` is
4803    /// specified. The `group_by_fields` determine how the time series are
4804    /// partitioned into subsets prior to applying the aggregation
4805    /// operation. Each subset contains time series that have the same
4806    /// value for each of the grouping fields. Each individual time
4807    /// series is a member of exactly one subset. The
4808    /// `cross_series_reducer` is applied to each subset of time series.
4809    /// It is not possible to reduce across different resource types, so
4810    /// this field implicitly contains `resource.type`.  Fields not
4811    /// specified in `group_by_fields` are aggregated away.  If
4812    /// `group_by_fields` is not specified and all the time series have
4813    /// the same resource type, then the time series are aggregated into
4814    /// a single output time series. If `cross_series_reducer` is not
4815    /// defined, this field is ignored.
4816    pub group_by_fields: std::vec::Vec<std::string::String>,
4817
4818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4819}
4820
4821impl Aggregation {
4822    pub fn new() -> Self {
4823        std::default::Default::default()
4824    }
4825
4826    /// Sets the value of [alignment_period][crate::model::Aggregation::alignment_period].
4827    ///
4828    /// # Example
4829    /// ```ignore,no_run
4830    /// # use google_cloud_monitoring_v3::model::Aggregation;
4831    /// use wkt::Duration;
4832    /// let x = Aggregation::new().set_alignment_period(Duration::default()/* use setters */);
4833    /// ```
4834    pub fn set_alignment_period<T>(mut self, v: T) -> Self
4835    where
4836        T: std::convert::Into<wkt::Duration>,
4837    {
4838        self.alignment_period = std::option::Option::Some(v.into());
4839        self
4840    }
4841
4842    /// Sets or clears the value of [alignment_period][crate::model::Aggregation::alignment_period].
4843    ///
4844    /// # Example
4845    /// ```ignore,no_run
4846    /// # use google_cloud_monitoring_v3::model::Aggregation;
4847    /// use wkt::Duration;
4848    /// let x = Aggregation::new().set_or_clear_alignment_period(Some(Duration::default()/* use setters */));
4849    /// let x = Aggregation::new().set_or_clear_alignment_period(None::<Duration>);
4850    /// ```
4851    pub fn set_or_clear_alignment_period<T>(mut self, v: std::option::Option<T>) -> Self
4852    where
4853        T: std::convert::Into<wkt::Duration>,
4854    {
4855        self.alignment_period = v.map(|x| x.into());
4856        self
4857    }
4858
4859    /// Sets the value of [per_series_aligner][crate::model::Aggregation::per_series_aligner].
4860    ///
4861    /// # Example
4862    /// ```ignore,no_run
4863    /// # use google_cloud_monitoring_v3::model::Aggregation;
4864    /// use google_cloud_monitoring_v3::model::aggregation::Aligner;
4865    /// let x0 = Aggregation::new().set_per_series_aligner(Aligner::AlignDelta);
4866    /// let x1 = Aggregation::new().set_per_series_aligner(Aligner::AlignRate);
4867    /// let x2 = Aggregation::new().set_per_series_aligner(Aligner::AlignInterpolate);
4868    /// ```
4869    pub fn set_per_series_aligner<T: std::convert::Into<crate::model::aggregation::Aligner>>(
4870        mut self,
4871        v: T,
4872    ) -> Self {
4873        self.per_series_aligner = v.into();
4874        self
4875    }
4876
4877    /// Sets the value of [cross_series_reducer][crate::model::Aggregation::cross_series_reducer].
4878    ///
4879    /// # Example
4880    /// ```ignore,no_run
4881    /// # use google_cloud_monitoring_v3::model::Aggregation;
4882    /// use google_cloud_monitoring_v3::model::aggregation::Reducer;
4883    /// let x0 = Aggregation::new().set_cross_series_reducer(Reducer::ReduceMean);
4884    /// let x1 = Aggregation::new().set_cross_series_reducer(Reducer::ReduceMin);
4885    /// let x2 = Aggregation::new().set_cross_series_reducer(Reducer::ReduceMax);
4886    /// ```
4887    pub fn set_cross_series_reducer<T: std::convert::Into<crate::model::aggregation::Reducer>>(
4888        mut self,
4889        v: T,
4890    ) -> Self {
4891        self.cross_series_reducer = v.into();
4892        self
4893    }
4894
4895    /// Sets the value of [group_by_fields][crate::model::Aggregation::group_by_fields].
4896    ///
4897    /// # Example
4898    /// ```ignore,no_run
4899    /// # use google_cloud_monitoring_v3::model::Aggregation;
4900    /// let x = Aggregation::new().set_group_by_fields(["a", "b", "c"]);
4901    /// ```
4902    pub fn set_group_by_fields<T, V>(mut self, v: T) -> Self
4903    where
4904        T: std::iter::IntoIterator<Item = V>,
4905        V: std::convert::Into<std::string::String>,
4906    {
4907        use std::iter::Iterator;
4908        self.group_by_fields = v.into_iter().map(|i| i.into()).collect();
4909        self
4910    }
4911}
4912
4913impl wkt::message::Message for Aggregation {
4914    fn typename() -> &'static str {
4915        "type.googleapis.com/google.monitoring.v3.Aggregation"
4916    }
4917}
4918
4919/// Defines additional types related to [Aggregation].
4920pub mod aggregation {
4921    #[allow(unused_imports)]
4922    use super::*;
4923
4924    /// The `Aligner` specifies the operation that will be applied to the data
4925    /// points in each alignment period in a time series. Except for
4926    /// `ALIGN_NONE`, which specifies that no operation be applied, each alignment
4927    /// operation replaces the set of data values in each alignment period with
4928    /// a single value: the result of applying the operation to the data values.
4929    /// An aligned time series has a single data value at the end of each
4930    /// `alignment_period`.
4931    ///
4932    /// An alignment operation can change the data type of the values, too. For
4933    /// example, if you apply a counting operation to boolean values, the data
4934    /// `value_type` in the original time series is `BOOLEAN`, but the `value_type`
4935    /// in the aligned result is `INT64`.
4936    ///
4937    /// # Working with unknown values
4938    ///
4939    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4940    /// additional enum variants at any time. Adding new variants is not considered
4941    /// a breaking change. Applications should write their code in anticipation of:
4942    ///
4943    /// - New values appearing in future releases of the client library, **and**
4944    /// - New values received dynamically, without application changes.
4945    ///
4946    /// Please consult the [Working with enums] section in the user guide for some
4947    /// guidelines.
4948    ///
4949    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4950    #[derive(Clone, Debug, PartialEq)]
4951    #[non_exhaustive]
4952    pub enum Aligner {
4953        /// No alignment. Raw data is returned. Not valid if cross-series reduction
4954        /// is requested. The `value_type` of the result is the same as the
4955        /// `value_type` of the input.
4956        AlignNone,
4957        /// Align and convert to
4958        /// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA].
4959        /// The output is `delta = y1 - y0`.
4960        ///
4961        /// This alignment is valid for
4962        /// [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and
4963        /// `DELTA` metrics. If the selected alignment period results in periods
4964        /// with no data, then the aligned value for such a period is created by
4965        /// interpolation. The `value_type`  of the aligned result is the same as
4966        /// the `value_type` of the input.
4967        ///
4968        /// [google.api.MetricDescriptor.MetricKind.CUMULATIVE]: api::model::metric_descriptor::MetricKind::Cumulative
4969        /// [google.api.MetricDescriptor.MetricKind.DELTA]: api::model::metric_descriptor::MetricKind::Delta
4970        AlignDelta,
4971        /// Align and convert to a rate. The result is computed as
4972        /// `rate = (y1 - y0)/(t1 - t0)`, or "delta over time".
4973        /// Think of this aligner as providing the slope of the line that passes
4974        /// through the value at the start and at the end of the `alignment_period`.
4975        ///
4976        /// This aligner is valid for `CUMULATIVE`
4977        /// and `DELTA` metrics with numeric values. If the selected alignment
4978        /// period results in periods with no data, then the aligned value for
4979        /// such a period is created by interpolation. The output is a `GAUGE`
4980        /// metric with `value_type` `DOUBLE`.
4981        ///
4982        /// If, by "rate", you mean "percentage change", see the
4983        /// `ALIGN_PERCENT_CHANGE` aligner instead.
4984        AlignRate,
4985        /// Align by interpolating between adjacent points around the alignment
4986        /// period boundary. This aligner is valid for `GAUGE` metrics with
4987        /// numeric values. The `value_type` of the aligned result is the same as the
4988        /// `value_type` of the input.
4989        AlignInterpolate,
4990        /// Align by moving the most recent data point before the end of the
4991        /// alignment period to the boundary at the end of the alignment
4992        /// period. This aligner is valid for `GAUGE` metrics. The `value_type` of
4993        /// the aligned result is the same as the `value_type` of the input.
4994        AlignNextOlder,
4995        /// Align the time series by returning the minimum value in each alignment
4996        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
4997        /// numeric values. The `value_type` of the aligned result is the same as
4998        /// the `value_type` of the input.
4999        AlignMin,
5000        /// Align the time series by returning the maximum value in each alignment
5001        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
5002        /// numeric values. The `value_type` of the aligned result is the same as
5003        /// the `value_type` of the input.
5004        AlignMax,
5005        /// Align the time series by returning the mean value in each alignment
5006        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
5007        /// numeric values. The `value_type` of the aligned result is `DOUBLE`.
5008        AlignMean,
5009        /// Align the time series by returning the number of values in each alignment
5010        /// period. This aligner is valid for `GAUGE` and `DELTA` metrics with
5011        /// numeric or Boolean values. The `value_type` of the aligned result is
5012        /// `INT64`.
5013        AlignCount,
5014        /// Align the time series by returning the sum of the values in each
5015        /// alignment period. This aligner is valid for `GAUGE` and `DELTA`
5016        /// metrics with numeric and distribution values. The `value_type` of the
5017        /// aligned result is the same as the `value_type` of the input.
5018        AlignSum,
5019        /// Align the time series by returning the standard deviation of the values
5020        /// in each alignment period. This aligner is valid for `GAUGE` and
5021        /// `DELTA` metrics with numeric values. The `value_type` of the output is
5022        /// `DOUBLE`.
5023        AlignStddev,
5024        /// Align the time series by returning the number of `True` values in
5025        /// each alignment period. This aligner is valid for `GAUGE` metrics with
5026        /// Boolean values. The `value_type` of the output is `INT64`.
5027        AlignCountTrue,
5028        /// Align the time series by returning the number of `False` values in
5029        /// each alignment period. This aligner is valid for `GAUGE` metrics with
5030        /// Boolean values. The `value_type` of the output is `INT64`.
5031        AlignCountFalse,
5032        /// Align the time series by returning the ratio of the number of `True`
5033        /// values to the total number of values in each alignment period. This
5034        /// aligner is valid for `GAUGE` metrics with Boolean values. The output
5035        /// value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`.
5036        AlignFractionTrue,
5037        /// Align the time series by using [percentile
5038        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
5039        /// data point in each alignment period is the 99th percentile of all data
5040        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
5041        /// metrics with distribution values. The output is a `GAUGE` metric with
5042        /// `value_type` `DOUBLE`.
5043        AlignPercentile99,
5044        /// Align the time series by using [percentile
5045        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
5046        /// data point in each alignment period is the 95th percentile of all data
5047        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
5048        /// metrics with distribution values. The output is a `GAUGE` metric with
5049        /// `value_type` `DOUBLE`.
5050        AlignPercentile95,
5051        /// Align the time series by using [percentile
5052        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
5053        /// data point in each alignment period is the 50th percentile of all data
5054        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
5055        /// metrics with distribution values. The output is a `GAUGE` metric with
5056        /// `value_type` `DOUBLE`.
5057        AlignPercentile50,
5058        /// Align the time series by using [percentile
5059        /// aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting
5060        /// data point in each alignment period is the 5th percentile of all data
5061        /// points in the period. This aligner is valid for `GAUGE` and `DELTA`
5062        /// metrics with distribution values. The output is a `GAUGE` metric with
5063        /// `value_type` `DOUBLE`.
5064        AlignPercentile05,
5065        /// Align and convert to a percentage change. This aligner is valid for
5066        /// `GAUGE` and `DELTA` metrics with numeric values. This alignment returns
5067        /// `((current - previous)/previous) * 100`, where the value of `previous` is
5068        /// determined based on the `alignment_period`.
5069        ///
5070        /// If the values of `current` and `previous` are both 0, then the returned
5071        /// value is 0. If only `previous` is 0, the returned value is infinity.
5072        ///
5073        /// A 10-minute moving mean is computed at each point of the alignment period
5074        /// prior to the above calculation to smooth the metric and prevent false
5075        /// positives from very short-lived spikes. The moving mean is only
5076        /// applicable for data whose values are `>= 0`. Any values `< 0` are
5077        /// treated as a missing datapoint, and are ignored. While `DELTA`
5078        /// metrics are accepted by this alignment, special care should be taken that
5079        /// the values for the metric will always be positive. The output is a
5080        /// `GAUGE` metric with `value_type` `DOUBLE`.
5081        AlignPercentChange,
5082        /// If set, the enum was initialized with an unknown value.
5083        ///
5084        /// Applications can examine the value using [Aligner::value] or
5085        /// [Aligner::name].
5086        UnknownValue(aligner::UnknownValue),
5087    }
5088
5089    #[doc(hidden)]
5090    pub mod aligner {
5091        #[allow(unused_imports)]
5092        use super::*;
5093        #[derive(Clone, Debug, PartialEq)]
5094        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5095    }
5096
5097    impl Aligner {
5098        /// Gets the enum value.
5099        ///
5100        /// Returns `None` if the enum contains an unknown value deserialized from
5101        /// the string representation of enums.
5102        pub fn value(&self) -> std::option::Option<i32> {
5103            match self {
5104                Self::AlignNone => std::option::Option::Some(0),
5105                Self::AlignDelta => std::option::Option::Some(1),
5106                Self::AlignRate => std::option::Option::Some(2),
5107                Self::AlignInterpolate => std::option::Option::Some(3),
5108                Self::AlignNextOlder => std::option::Option::Some(4),
5109                Self::AlignMin => std::option::Option::Some(10),
5110                Self::AlignMax => std::option::Option::Some(11),
5111                Self::AlignMean => std::option::Option::Some(12),
5112                Self::AlignCount => std::option::Option::Some(13),
5113                Self::AlignSum => std::option::Option::Some(14),
5114                Self::AlignStddev => std::option::Option::Some(15),
5115                Self::AlignCountTrue => std::option::Option::Some(16),
5116                Self::AlignCountFalse => std::option::Option::Some(24),
5117                Self::AlignFractionTrue => std::option::Option::Some(17),
5118                Self::AlignPercentile99 => std::option::Option::Some(18),
5119                Self::AlignPercentile95 => std::option::Option::Some(19),
5120                Self::AlignPercentile50 => std::option::Option::Some(20),
5121                Self::AlignPercentile05 => std::option::Option::Some(21),
5122                Self::AlignPercentChange => std::option::Option::Some(23),
5123                Self::UnknownValue(u) => u.0.value(),
5124            }
5125        }
5126
5127        /// Gets the enum value as a string.
5128        ///
5129        /// Returns `None` if the enum contains an unknown value deserialized from
5130        /// the integer representation of enums.
5131        pub fn name(&self) -> std::option::Option<&str> {
5132            match self {
5133                Self::AlignNone => std::option::Option::Some("ALIGN_NONE"),
5134                Self::AlignDelta => std::option::Option::Some("ALIGN_DELTA"),
5135                Self::AlignRate => std::option::Option::Some("ALIGN_RATE"),
5136                Self::AlignInterpolate => std::option::Option::Some("ALIGN_INTERPOLATE"),
5137                Self::AlignNextOlder => std::option::Option::Some("ALIGN_NEXT_OLDER"),
5138                Self::AlignMin => std::option::Option::Some("ALIGN_MIN"),
5139                Self::AlignMax => std::option::Option::Some("ALIGN_MAX"),
5140                Self::AlignMean => std::option::Option::Some("ALIGN_MEAN"),
5141                Self::AlignCount => std::option::Option::Some("ALIGN_COUNT"),
5142                Self::AlignSum => std::option::Option::Some("ALIGN_SUM"),
5143                Self::AlignStddev => std::option::Option::Some("ALIGN_STDDEV"),
5144                Self::AlignCountTrue => std::option::Option::Some("ALIGN_COUNT_TRUE"),
5145                Self::AlignCountFalse => std::option::Option::Some("ALIGN_COUNT_FALSE"),
5146                Self::AlignFractionTrue => std::option::Option::Some("ALIGN_FRACTION_TRUE"),
5147                Self::AlignPercentile99 => std::option::Option::Some("ALIGN_PERCENTILE_99"),
5148                Self::AlignPercentile95 => std::option::Option::Some("ALIGN_PERCENTILE_95"),
5149                Self::AlignPercentile50 => std::option::Option::Some("ALIGN_PERCENTILE_50"),
5150                Self::AlignPercentile05 => std::option::Option::Some("ALIGN_PERCENTILE_05"),
5151                Self::AlignPercentChange => std::option::Option::Some("ALIGN_PERCENT_CHANGE"),
5152                Self::UnknownValue(u) => u.0.name(),
5153            }
5154        }
5155    }
5156
5157    impl std::default::Default for Aligner {
5158        fn default() -> Self {
5159            use std::convert::From;
5160            Self::from(0)
5161        }
5162    }
5163
5164    impl std::fmt::Display for Aligner {
5165        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5166            wkt::internal::display_enum(f, self.name(), self.value())
5167        }
5168    }
5169
5170    impl std::convert::From<i32> for Aligner {
5171        fn from(value: i32) -> Self {
5172            match value {
5173                0 => Self::AlignNone,
5174                1 => Self::AlignDelta,
5175                2 => Self::AlignRate,
5176                3 => Self::AlignInterpolate,
5177                4 => Self::AlignNextOlder,
5178                10 => Self::AlignMin,
5179                11 => Self::AlignMax,
5180                12 => Self::AlignMean,
5181                13 => Self::AlignCount,
5182                14 => Self::AlignSum,
5183                15 => Self::AlignStddev,
5184                16 => Self::AlignCountTrue,
5185                17 => Self::AlignFractionTrue,
5186                18 => Self::AlignPercentile99,
5187                19 => Self::AlignPercentile95,
5188                20 => Self::AlignPercentile50,
5189                21 => Self::AlignPercentile05,
5190                23 => Self::AlignPercentChange,
5191                24 => Self::AlignCountFalse,
5192                _ => Self::UnknownValue(aligner::UnknownValue(
5193                    wkt::internal::UnknownEnumValue::Integer(value),
5194                )),
5195            }
5196        }
5197    }
5198
5199    impl std::convert::From<&str> for Aligner {
5200        fn from(value: &str) -> Self {
5201            use std::string::ToString;
5202            match value {
5203                "ALIGN_NONE" => Self::AlignNone,
5204                "ALIGN_DELTA" => Self::AlignDelta,
5205                "ALIGN_RATE" => Self::AlignRate,
5206                "ALIGN_INTERPOLATE" => Self::AlignInterpolate,
5207                "ALIGN_NEXT_OLDER" => Self::AlignNextOlder,
5208                "ALIGN_MIN" => Self::AlignMin,
5209                "ALIGN_MAX" => Self::AlignMax,
5210                "ALIGN_MEAN" => Self::AlignMean,
5211                "ALIGN_COUNT" => Self::AlignCount,
5212                "ALIGN_SUM" => Self::AlignSum,
5213                "ALIGN_STDDEV" => Self::AlignStddev,
5214                "ALIGN_COUNT_TRUE" => Self::AlignCountTrue,
5215                "ALIGN_COUNT_FALSE" => Self::AlignCountFalse,
5216                "ALIGN_FRACTION_TRUE" => Self::AlignFractionTrue,
5217                "ALIGN_PERCENTILE_99" => Self::AlignPercentile99,
5218                "ALIGN_PERCENTILE_95" => Self::AlignPercentile95,
5219                "ALIGN_PERCENTILE_50" => Self::AlignPercentile50,
5220                "ALIGN_PERCENTILE_05" => Self::AlignPercentile05,
5221                "ALIGN_PERCENT_CHANGE" => Self::AlignPercentChange,
5222                _ => Self::UnknownValue(aligner::UnknownValue(
5223                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5224                )),
5225            }
5226        }
5227    }
5228
5229    impl serde::ser::Serialize for Aligner {
5230        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5231        where
5232            S: serde::Serializer,
5233        {
5234            match self {
5235                Self::AlignNone => serializer.serialize_i32(0),
5236                Self::AlignDelta => serializer.serialize_i32(1),
5237                Self::AlignRate => serializer.serialize_i32(2),
5238                Self::AlignInterpolate => serializer.serialize_i32(3),
5239                Self::AlignNextOlder => serializer.serialize_i32(4),
5240                Self::AlignMin => serializer.serialize_i32(10),
5241                Self::AlignMax => serializer.serialize_i32(11),
5242                Self::AlignMean => serializer.serialize_i32(12),
5243                Self::AlignCount => serializer.serialize_i32(13),
5244                Self::AlignSum => serializer.serialize_i32(14),
5245                Self::AlignStddev => serializer.serialize_i32(15),
5246                Self::AlignCountTrue => serializer.serialize_i32(16),
5247                Self::AlignCountFalse => serializer.serialize_i32(24),
5248                Self::AlignFractionTrue => serializer.serialize_i32(17),
5249                Self::AlignPercentile99 => serializer.serialize_i32(18),
5250                Self::AlignPercentile95 => serializer.serialize_i32(19),
5251                Self::AlignPercentile50 => serializer.serialize_i32(20),
5252                Self::AlignPercentile05 => serializer.serialize_i32(21),
5253                Self::AlignPercentChange => serializer.serialize_i32(23),
5254                Self::UnknownValue(u) => u.0.serialize(serializer),
5255            }
5256        }
5257    }
5258
5259    impl<'de> serde::de::Deserialize<'de> for Aligner {
5260        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5261        where
5262            D: serde::Deserializer<'de>,
5263        {
5264            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Aligner>::new(
5265                ".google.monitoring.v3.Aggregation.Aligner",
5266            ))
5267        }
5268    }
5269
5270    /// A Reducer operation describes how to aggregate data points from multiple
5271    /// time series into a single time series, where the value of each data point
5272    /// in the resulting series is a function of all the already aligned values in
5273    /// the input time series.
5274    ///
5275    /// # Working with unknown values
5276    ///
5277    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5278    /// additional enum variants at any time. Adding new variants is not considered
5279    /// a breaking change. Applications should write their code in anticipation of:
5280    ///
5281    /// - New values appearing in future releases of the client library, **and**
5282    /// - New values received dynamically, without application changes.
5283    ///
5284    /// Please consult the [Working with enums] section in the user guide for some
5285    /// guidelines.
5286    ///
5287    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5288    #[derive(Clone, Debug, PartialEq)]
5289    #[non_exhaustive]
5290    pub enum Reducer {
5291        /// No cross-time series reduction. The output of the `Aligner` is
5292        /// returned.
5293        ReduceNone,
5294        /// Reduce by computing the mean value across time series for each
5295        /// alignment period. This reducer is valid for
5296        /// [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and
5297        /// [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with
5298        /// numeric or distribution values. The `value_type` of the output is
5299        /// [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE].
5300        ///
5301        /// [google.api.MetricDescriptor.MetricKind.DELTA]: api::model::metric_descriptor::MetricKind::Delta
5302        /// [google.api.MetricDescriptor.MetricKind.GAUGE]: api::model::metric_descriptor::MetricKind::Gauge
5303        /// [google.api.MetricDescriptor.ValueType.DOUBLE]: api::model::metric_descriptor::ValueType::Double
5304        ReduceMean,
5305        /// Reduce by computing the minimum value across time series for each
5306        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
5307        /// with numeric values. The `value_type` of the output is the same as the
5308        /// `value_type` of the input.
5309        ReduceMin,
5310        /// Reduce by computing the maximum value across time series for each
5311        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
5312        /// with numeric values. The `value_type` of the output is the same as the
5313        /// `value_type` of the input.
5314        ReduceMax,
5315        /// Reduce by computing the sum across time series for each
5316        /// alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics
5317        /// with numeric and distribution values. The `value_type` of the output is
5318        /// the same as the `value_type` of the input.
5319        ReduceSum,
5320        /// Reduce by computing the standard deviation across time series
5321        /// for each alignment period. This reducer is valid for `DELTA` and
5322        /// `GAUGE` metrics with numeric or distribution values. The `value_type`
5323        /// of the output is `DOUBLE`.
5324        ReduceStddev,
5325        /// Reduce by computing the number of data points across time series
5326        /// for each alignment period. This reducer is valid for `DELTA` and
5327        /// `GAUGE` metrics of numeric, Boolean, distribution, and string
5328        /// `value_type`. The `value_type` of the output is `INT64`.
5329        ReduceCount,
5330        /// Reduce by computing the number of `True`-valued data points across time
5331        /// series for each alignment period. This reducer is valid for `DELTA` and
5332        /// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
5333        /// is `INT64`.
5334        ReduceCountTrue,
5335        /// Reduce by computing the number of `False`-valued data points across time
5336        /// series for each alignment period. This reducer is valid for `DELTA` and
5337        /// `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output
5338        /// is `INT64`.
5339        ReduceCountFalse,
5340        /// Reduce by computing the ratio of the number of `True`-valued data points
5341        /// to the total number of data points for each alignment period. This
5342        /// reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`.
5343        /// The output value is in the range [0.0, 1.0] and has `value_type`
5344        /// `DOUBLE`.
5345        ReduceFractionTrue,
5346        /// Reduce by computing the [99th
5347        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
5348        /// across time series for each alignment period. This reducer is valid for
5349        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
5350        /// of the output is `DOUBLE`.
5351        ReducePercentile99,
5352        /// Reduce by computing the [95th
5353        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
5354        /// across time series for each alignment period. This reducer is valid for
5355        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
5356        /// of the output is `DOUBLE`.
5357        ReducePercentile95,
5358        /// Reduce by computing the [50th
5359        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
5360        /// across time series for each alignment period. This reducer is valid for
5361        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
5362        /// of the output is `DOUBLE`.
5363        ReducePercentile50,
5364        /// Reduce by computing the [5th
5365        /// percentile](https://en.wikipedia.org/wiki/Percentile) of data points
5366        /// across time series for each alignment period. This reducer is valid for
5367        /// `GAUGE` and `DELTA` metrics of numeric and distribution type. The value
5368        /// of the output is `DOUBLE`.
5369        ReducePercentile05,
5370        /// If set, the enum was initialized with an unknown value.
5371        ///
5372        /// Applications can examine the value using [Reducer::value] or
5373        /// [Reducer::name].
5374        UnknownValue(reducer::UnknownValue),
5375    }
5376
5377    #[doc(hidden)]
5378    pub mod reducer {
5379        #[allow(unused_imports)]
5380        use super::*;
5381        #[derive(Clone, Debug, PartialEq)]
5382        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5383    }
5384
5385    impl Reducer {
5386        /// Gets the enum value.
5387        ///
5388        /// Returns `None` if the enum contains an unknown value deserialized from
5389        /// the string representation of enums.
5390        pub fn value(&self) -> std::option::Option<i32> {
5391            match self {
5392                Self::ReduceNone => std::option::Option::Some(0),
5393                Self::ReduceMean => std::option::Option::Some(1),
5394                Self::ReduceMin => std::option::Option::Some(2),
5395                Self::ReduceMax => std::option::Option::Some(3),
5396                Self::ReduceSum => std::option::Option::Some(4),
5397                Self::ReduceStddev => std::option::Option::Some(5),
5398                Self::ReduceCount => std::option::Option::Some(6),
5399                Self::ReduceCountTrue => std::option::Option::Some(7),
5400                Self::ReduceCountFalse => std::option::Option::Some(15),
5401                Self::ReduceFractionTrue => std::option::Option::Some(8),
5402                Self::ReducePercentile99 => std::option::Option::Some(9),
5403                Self::ReducePercentile95 => std::option::Option::Some(10),
5404                Self::ReducePercentile50 => std::option::Option::Some(11),
5405                Self::ReducePercentile05 => std::option::Option::Some(12),
5406                Self::UnknownValue(u) => u.0.value(),
5407            }
5408        }
5409
5410        /// Gets the enum value as a string.
5411        ///
5412        /// Returns `None` if the enum contains an unknown value deserialized from
5413        /// the integer representation of enums.
5414        pub fn name(&self) -> std::option::Option<&str> {
5415            match self {
5416                Self::ReduceNone => std::option::Option::Some("REDUCE_NONE"),
5417                Self::ReduceMean => std::option::Option::Some("REDUCE_MEAN"),
5418                Self::ReduceMin => std::option::Option::Some("REDUCE_MIN"),
5419                Self::ReduceMax => std::option::Option::Some("REDUCE_MAX"),
5420                Self::ReduceSum => std::option::Option::Some("REDUCE_SUM"),
5421                Self::ReduceStddev => std::option::Option::Some("REDUCE_STDDEV"),
5422                Self::ReduceCount => std::option::Option::Some("REDUCE_COUNT"),
5423                Self::ReduceCountTrue => std::option::Option::Some("REDUCE_COUNT_TRUE"),
5424                Self::ReduceCountFalse => std::option::Option::Some("REDUCE_COUNT_FALSE"),
5425                Self::ReduceFractionTrue => std::option::Option::Some("REDUCE_FRACTION_TRUE"),
5426                Self::ReducePercentile99 => std::option::Option::Some("REDUCE_PERCENTILE_99"),
5427                Self::ReducePercentile95 => std::option::Option::Some("REDUCE_PERCENTILE_95"),
5428                Self::ReducePercentile50 => std::option::Option::Some("REDUCE_PERCENTILE_50"),
5429                Self::ReducePercentile05 => std::option::Option::Some("REDUCE_PERCENTILE_05"),
5430                Self::UnknownValue(u) => u.0.name(),
5431            }
5432        }
5433    }
5434
5435    impl std::default::Default for Reducer {
5436        fn default() -> Self {
5437            use std::convert::From;
5438            Self::from(0)
5439        }
5440    }
5441
5442    impl std::fmt::Display for Reducer {
5443        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5444            wkt::internal::display_enum(f, self.name(), self.value())
5445        }
5446    }
5447
5448    impl std::convert::From<i32> for Reducer {
5449        fn from(value: i32) -> Self {
5450            match value {
5451                0 => Self::ReduceNone,
5452                1 => Self::ReduceMean,
5453                2 => Self::ReduceMin,
5454                3 => Self::ReduceMax,
5455                4 => Self::ReduceSum,
5456                5 => Self::ReduceStddev,
5457                6 => Self::ReduceCount,
5458                7 => Self::ReduceCountTrue,
5459                8 => Self::ReduceFractionTrue,
5460                9 => Self::ReducePercentile99,
5461                10 => Self::ReducePercentile95,
5462                11 => Self::ReducePercentile50,
5463                12 => Self::ReducePercentile05,
5464                15 => Self::ReduceCountFalse,
5465                _ => Self::UnknownValue(reducer::UnknownValue(
5466                    wkt::internal::UnknownEnumValue::Integer(value),
5467                )),
5468            }
5469        }
5470    }
5471
5472    impl std::convert::From<&str> for Reducer {
5473        fn from(value: &str) -> Self {
5474            use std::string::ToString;
5475            match value {
5476                "REDUCE_NONE" => Self::ReduceNone,
5477                "REDUCE_MEAN" => Self::ReduceMean,
5478                "REDUCE_MIN" => Self::ReduceMin,
5479                "REDUCE_MAX" => Self::ReduceMax,
5480                "REDUCE_SUM" => Self::ReduceSum,
5481                "REDUCE_STDDEV" => Self::ReduceStddev,
5482                "REDUCE_COUNT" => Self::ReduceCount,
5483                "REDUCE_COUNT_TRUE" => Self::ReduceCountTrue,
5484                "REDUCE_COUNT_FALSE" => Self::ReduceCountFalse,
5485                "REDUCE_FRACTION_TRUE" => Self::ReduceFractionTrue,
5486                "REDUCE_PERCENTILE_99" => Self::ReducePercentile99,
5487                "REDUCE_PERCENTILE_95" => Self::ReducePercentile95,
5488                "REDUCE_PERCENTILE_50" => Self::ReducePercentile50,
5489                "REDUCE_PERCENTILE_05" => Self::ReducePercentile05,
5490                _ => Self::UnknownValue(reducer::UnknownValue(
5491                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5492                )),
5493            }
5494        }
5495    }
5496
5497    impl serde::ser::Serialize for Reducer {
5498        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5499        where
5500            S: serde::Serializer,
5501        {
5502            match self {
5503                Self::ReduceNone => serializer.serialize_i32(0),
5504                Self::ReduceMean => serializer.serialize_i32(1),
5505                Self::ReduceMin => serializer.serialize_i32(2),
5506                Self::ReduceMax => serializer.serialize_i32(3),
5507                Self::ReduceSum => serializer.serialize_i32(4),
5508                Self::ReduceStddev => serializer.serialize_i32(5),
5509                Self::ReduceCount => serializer.serialize_i32(6),
5510                Self::ReduceCountTrue => serializer.serialize_i32(7),
5511                Self::ReduceCountFalse => serializer.serialize_i32(15),
5512                Self::ReduceFractionTrue => serializer.serialize_i32(8),
5513                Self::ReducePercentile99 => serializer.serialize_i32(9),
5514                Self::ReducePercentile95 => serializer.serialize_i32(10),
5515                Self::ReducePercentile50 => serializer.serialize_i32(11),
5516                Self::ReducePercentile05 => serializer.serialize_i32(12),
5517                Self::UnknownValue(u) => u.0.serialize(serializer),
5518            }
5519        }
5520    }
5521
5522    impl<'de> serde::de::Deserialize<'de> for Reducer {
5523        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5524        where
5525            D: serde::Deserializer<'de>,
5526        {
5527            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reducer>::new(
5528                ".google.monitoring.v3.Aggregation.Reducer",
5529            ))
5530        }
5531    }
5532}
5533
5534/// A set of (label, value) pairs that were removed from a Distribution
5535/// time series during aggregation and then added as an attachment to a
5536/// Distribution.Exemplar.
5537///
5538/// The full label set for the exemplars is constructed by using the dropped
5539/// pairs in combination with the label values that remain on the aggregated
5540/// Distribution time series. The constructed full label set can be used to
5541/// identify the specific entity, such as the instance or job, which might be
5542/// contributing to a long-tail. However, with dropped labels, the storage
5543/// requirements are reduced because only the aggregated distribution values for
5544/// a large group of time series are stored.
5545///
5546/// Note that there are no guarantees on ordering of the labels from
5547/// exemplar-to-exemplar and from distribution-to-distribution in the same
5548/// stream, and there may be duplicates.  It is up to clients to resolve any
5549/// ambiguities.
5550#[derive(Clone, Default, PartialEq)]
5551#[non_exhaustive]
5552pub struct DroppedLabels {
5553    /// Map from label to its value, for all labels dropped in any aggregation.
5554    pub label: std::collections::HashMap<std::string::String, std::string::String>,
5555
5556    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5557}
5558
5559impl DroppedLabels {
5560    pub fn new() -> Self {
5561        std::default::Default::default()
5562    }
5563
5564    /// Sets the value of [label][crate::model::DroppedLabels::label].
5565    ///
5566    /// # Example
5567    /// ```ignore,no_run
5568    /// # use google_cloud_monitoring_v3::model::DroppedLabels;
5569    /// let x = DroppedLabels::new().set_label([
5570    ///     ("key0", "abc"),
5571    ///     ("key1", "xyz"),
5572    /// ]);
5573    /// ```
5574    pub fn set_label<T, K, V>(mut self, v: T) -> Self
5575    where
5576        T: std::iter::IntoIterator<Item = (K, V)>,
5577        K: std::convert::Into<std::string::String>,
5578        V: std::convert::Into<std::string::String>,
5579    {
5580        use std::iter::Iterator;
5581        self.label = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5582        self
5583    }
5584}
5585
5586impl wkt::message::Message for DroppedLabels {
5587    fn typename() -> &'static str {
5588        "type.googleapis.com/google.monitoring.v3.DroppedLabels"
5589    }
5590}
5591
5592/// The description of a dynamic collection of monitored resources. Each group
5593/// has a filter that is matched against monitored resources and their associated
5594/// metadata. If a group's filter matches an available monitored resource, then
5595/// that resource is a member of that group.  Groups can contain any number of
5596/// monitored resources, and each monitored resource can be a member of any
5597/// number of groups.
5598///
5599/// Groups can be nested in parent-child hierarchies. The `parentName` field
5600/// identifies an optional parent for each group.  If a group has a parent, then
5601/// the only monitored resources available to be matched by the group's filter
5602/// are the resources contained in the parent group.  In other words, a group
5603/// contains the monitored resources that match its filter and the filters of all
5604/// the group's ancestors.  A group without a parent can contain any monitored
5605/// resource.
5606///
5607/// For example, consider an infrastructure running a set of instances with two
5608/// user-defined tags: `"environment"` and `"role"`. A parent group has a filter,
5609/// `environment="production"`.  A child of that parent group has a filter,
5610/// `role="transcoder"`.  The parent group contains all instances in the
5611/// production environment, regardless of their roles.  The child group contains
5612/// instances that have the transcoder role *and* are in the production
5613/// environment.
5614///
5615/// The monitored resources contained in a group can change at any moment,
5616/// depending on what resources exist and what filters are associated with the
5617/// group and its ancestors.
5618#[derive(Clone, Default, PartialEq)]
5619#[non_exhaustive]
5620pub struct Group {
5621    /// Output only. The name of this group. The format is:
5622    ///
5623    /// ```norust
5624    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5625    /// ```
5626    ///
5627    /// When creating a group, this field is ignored and a new name is created
5628    /// consisting of the project specified in the call to `CreateGroup`
5629    /// and a unique `[GROUP_ID]` that is generated automatically.
5630    pub name: std::string::String,
5631
5632    /// A user-assigned name for this group, used only for display purposes.
5633    pub display_name: std::string::String,
5634
5635    /// The name of the group's parent, if it has one. The format is:
5636    ///
5637    /// ```norust
5638    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5639    /// ```
5640    ///
5641    /// For groups with no parent, `parent_name` is the empty string, `""`.
5642    pub parent_name: std::string::String,
5643
5644    /// The filter used to determine which monitored resources belong to this
5645    /// group.
5646    pub filter: std::string::String,
5647
5648    /// If true, the members of this group are considered to be a cluster.
5649    /// The system can perform additional analysis on groups that are clusters.
5650    pub is_cluster: bool,
5651
5652    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5653}
5654
5655impl Group {
5656    pub fn new() -> Self {
5657        std::default::Default::default()
5658    }
5659
5660    /// Sets the value of [name][crate::model::Group::name].
5661    ///
5662    /// # Example
5663    /// ```ignore,no_run
5664    /// # use google_cloud_monitoring_v3::model::Group;
5665    /// let x = Group::new().set_name("example");
5666    /// ```
5667    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5668        self.name = v.into();
5669        self
5670    }
5671
5672    /// Sets the value of [display_name][crate::model::Group::display_name].
5673    ///
5674    /// # Example
5675    /// ```ignore,no_run
5676    /// # use google_cloud_monitoring_v3::model::Group;
5677    /// let x = Group::new().set_display_name("example");
5678    /// ```
5679    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5680        self.display_name = v.into();
5681        self
5682    }
5683
5684    /// Sets the value of [parent_name][crate::model::Group::parent_name].
5685    ///
5686    /// # Example
5687    /// ```ignore,no_run
5688    /// # use google_cloud_monitoring_v3::model::Group;
5689    /// let x = Group::new().set_parent_name("example");
5690    /// ```
5691    pub fn set_parent_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5692        self.parent_name = v.into();
5693        self
5694    }
5695
5696    /// Sets the value of [filter][crate::model::Group::filter].
5697    ///
5698    /// # Example
5699    /// ```ignore,no_run
5700    /// # use google_cloud_monitoring_v3::model::Group;
5701    /// let x = Group::new().set_filter("example");
5702    /// ```
5703    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5704        self.filter = v.into();
5705        self
5706    }
5707
5708    /// Sets the value of [is_cluster][crate::model::Group::is_cluster].
5709    ///
5710    /// # Example
5711    /// ```ignore,no_run
5712    /// # use google_cloud_monitoring_v3::model::Group;
5713    /// let x = Group::new().set_is_cluster(true);
5714    /// ```
5715    pub fn set_is_cluster<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5716        self.is_cluster = v.into();
5717        self
5718    }
5719}
5720
5721impl wkt::message::Message for Group {
5722    fn typename() -> &'static str {
5723        "type.googleapis.com/google.monitoring.v3.Group"
5724    }
5725}
5726
5727/// The `ListGroup` request.
5728#[derive(Clone, Default, PartialEq)]
5729#[non_exhaustive]
5730pub struct ListGroupsRequest {
5731    /// Required. The
5732    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
5733    /// groups are to be listed. The format is:
5734    ///
5735    /// ```norust
5736    /// projects/[PROJECT_ID_OR_NUMBER]
5737    /// ```
5738    pub name: std::string::String,
5739
5740    /// A positive number that is the maximum number of results to return.
5741    pub page_size: i32,
5742
5743    /// If this field is not empty then it must contain the `next_page_token` value
5744    /// returned by a previous call to this method.  Using this field causes the
5745    /// method to return additional results from the previous method call.
5746    pub page_token: std::string::String,
5747
5748    /// An optional filter consisting of a single group name.  The filters limit
5749    /// the groups returned based on their parent-child relationship with the
5750    /// specified group. If no filter is specified, all groups are returned.
5751    pub filter: std::option::Option<crate::model::list_groups_request::Filter>,
5752
5753    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5754}
5755
5756impl ListGroupsRequest {
5757    pub fn new() -> Self {
5758        std::default::Default::default()
5759    }
5760
5761    /// Sets the value of [name][crate::model::ListGroupsRequest::name].
5762    ///
5763    /// # Example
5764    /// ```ignore,no_run
5765    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5766    /// let x = ListGroupsRequest::new().set_name("example");
5767    /// ```
5768    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5769        self.name = v.into();
5770        self
5771    }
5772
5773    /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
5774    ///
5775    /// # Example
5776    /// ```ignore,no_run
5777    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5778    /// let x = ListGroupsRequest::new().set_page_size(42);
5779    /// ```
5780    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5781        self.page_size = v.into();
5782        self
5783    }
5784
5785    /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
5786    ///
5787    /// # Example
5788    /// ```ignore,no_run
5789    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5790    /// let x = ListGroupsRequest::new().set_page_token("example");
5791    /// ```
5792    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5793        self.page_token = v.into();
5794        self
5795    }
5796
5797    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
5798    ///
5799    /// Note that all the setters affecting `filter` are mutually
5800    /// exclusive.
5801    ///
5802    /// # Example
5803    /// ```ignore,no_run
5804    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5805    /// use google_cloud_monitoring_v3::model::list_groups_request::Filter;
5806    /// let x = ListGroupsRequest::new().set_filter(Some(Filter::ChildrenOfGroup("example".to_string())));
5807    /// ```
5808    pub fn set_filter<
5809        T: std::convert::Into<std::option::Option<crate::model::list_groups_request::Filter>>,
5810    >(
5811        mut self,
5812        v: T,
5813    ) -> Self {
5814        self.filter = v.into();
5815        self
5816    }
5817
5818    /// The value of [filter][crate::model::ListGroupsRequest::filter]
5819    /// if it holds a `ChildrenOfGroup`, `None` if the field is not set or
5820    /// holds a different branch.
5821    pub fn children_of_group(&self) -> std::option::Option<&std::string::String> {
5822        #[allow(unreachable_patterns)]
5823        self.filter.as_ref().and_then(|v| match v {
5824            crate::model::list_groups_request::Filter::ChildrenOfGroup(v) => {
5825                std::option::Option::Some(v)
5826            }
5827            _ => std::option::Option::None,
5828        })
5829    }
5830
5831    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
5832    /// to hold a `ChildrenOfGroup`.
5833    ///
5834    /// Note that all the setters affecting `filter` are
5835    /// mutually exclusive.
5836    ///
5837    /// # Example
5838    /// ```ignore,no_run
5839    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5840    /// let x = ListGroupsRequest::new().set_children_of_group("example");
5841    /// assert!(x.children_of_group().is_some());
5842    /// assert!(x.ancestors_of_group().is_none());
5843    /// assert!(x.descendants_of_group().is_none());
5844    /// ```
5845    pub fn set_children_of_group<T: std::convert::Into<std::string::String>>(
5846        mut self,
5847        v: T,
5848    ) -> Self {
5849        self.filter = std::option::Option::Some(
5850            crate::model::list_groups_request::Filter::ChildrenOfGroup(v.into()),
5851        );
5852        self
5853    }
5854
5855    /// The value of [filter][crate::model::ListGroupsRequest::filter]
5856    /// if it holds a `AncestorsOfGroup`, `None` if the field is not set or
5857    /// holds a different branch.
5858    pub fn ancestors_of_group(&self) -> std::option::Option<&std::string::String> {
5859        #[allow(unreachable_patterns)]
5860        self.filter.as_ref().and_then(|v| match v {
5861            crate::model::list_groups_request::Filter::AncestorsOfGroup(v) => {
5862                std::option::Option::Some(v)
5863            }
5864            _ => std::option::Option::None,
5865        })
5866    }
5867
5868    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
5869    /// to hold a `AncestorsOfGroup`.
5870    ///
5871    /// Note that all the setters affecting `filter` are
5872    /// mutually exclusive.
5873    ///
5874    /// # Example
5875    /// ```ignore,no_run
5876    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5877    /// let x = ListGroupsRequest::new().set_ancestors_of_group("example");
5878    /// assert!(x.ancestors_of_group().is_some());
5879    /// assert!(x.children_of_group().is_none());
5880    /// assert!(x.descendants_of_group().is_none());
5881    /// ```
5882    pub fn set_ancestors_of_group<T: std::convert::Into<std::string::String>>(
5883        mut self,
5884        v: T,
5885    ) -> Self {
5886        self.filter = std::option::Option::Some(
5887            crate::model::list_groups_request::Filter::AncestorsOfGroup(v.into()),
5888        );
5889        self
5890    }
5891
5892    /// The value of [filter][crate::model::ListGroupsRequest::filter]
5893    /// if it holds a `DescendantsOfGroup`, `None` if the field is not set or
5894    /// holds a different branch.
5895    pub fn descendants_of_group(&self) -> std::option::Option<&std::string::String> {
5896        #[allow(unreachable_patterns)]
5897        self.filter.as_ref().and_then(|v| match v {
5898            crate::model::list_groups_request::Filter::DescendantsOfGroup(v) => {
5899                std::option::Option::Some(v)
5900            }
5901            _ => std::option::Option::None,
5902        })
5903    }
5904
5905    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
5906    /// to hold a `DescendantsOfGroup`.
5907    ///
5908    /// Note that all the setters affecting `filter` are
5909    /// mutually exclusive.
5910    ///
5911    /// # Example
5912    /// ```ignore,no_run
5913    /// # use google_cloud_monitoring_v3::model::ListGroupsRequest;
5914    /// let x = ListGroupsRequest::new().set_descendants_of_group("example");
5915    /// assert!(x.descendants_of_group().is_some());
5916    /// assert!(x.children_of_group().is_none());
5917    /// assert!(x.ancestors_of_group().is_none());
5918    /// ```
5919    pub fn set_descendants_of_group<T: std::convert::Into<std::string::String>>(
5920        mut self,
5921        v: T,
5922    ) -> Self {
5923        self.filter = std::option::Option::Some(
5924            crate::model::list_groups_request::Filter::DescendantsOfGroup(v.into()),
5925        );
5926        self
5927    }
5928}
5929
5930impl wkt::message::Message for ListGroupsRequest {
5931    fn typename() -> &'static str {
5932        "type.googleapis.com/google.monitoring.v3.ListGroupsRequest"
5933    }
5934}
5935
5936/// Defines additional types related to [ListGroupsRequest].
5937pub mod list_groups_request {
5938    #[allow(unused_imports)]
5939    use super::*;
5940
5941    /// An optional filter consisting of a single group name.  The filters limit
5942    /// the groups returned based on their parent-child relationship with the
5943    /// specified group. If no filter is specified, all groups are returned.
5944    #[derive(Clone, Debug, PartialEq)]
5945    #[non_exhaustive]
5946    pub enum Filter {
5947        /// A group name. The format is:
5948        ///
5949        /// ```norust
5950        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5951        /// ```
5952        ///
5953        /// Returns groups whose `parent_name` field contains the group
5954        /// name.  If no groups have this parent, the results are empty.
5955        ChildrenOfGroup(std::string::String),
5956        /// A group name. The format is:
5957        ///
5958        /// ```norust
5959        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5960        /// ```
5961        ///
5962        /// Returns groups that are ancestors of the specified group.
5963        /// The groups are returned in order, starting with the immediate parent and
5964        /// ending with the most distant ancestor.  If the specified group has no
5965        /// immediate parent, the results are empty.
5966        AncestorsOfGroup(std::string::String),
5967        /// A group name. The format is:
5968        ///
5969        /// ```norust
5970        /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
5971        /// ```
5972        ///
5973        /// Returns the descendants of the specified group.  This is a superset of
5974        /// the results returned by the `children_of_group` filter, and includes
5975        /// children-of-children, and so forth.
5976        DescendantsOfGroup(std::string::String),
5977    }
5978}
5979
5980/// The `ListGroups` response.
5981#[derive(Clone, Default, PartialEq)]
5982#[non_exhaustive]
5983pub struct ListGroupsResponse {
5984    /// The groups that match the specified filters.
5985    pub group: std::vec::Vec<crate::model::Group>,
5986
5987    /// If there are more results than have been returned, then this field is set
5988    /// to a non-empty value.  To see the additional results,
5989    /// use that value as `page_token` in the next call to this method.
5990    pub next_page_token: std::string::String,
5991
5992    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5993}
5994
5995impl ListGroupsResponse {
5996    pub fn new() -> Self {
5997        std::default::Default::default()
5998    }
5999
6000    /// Sets the value of [group][crate::model::ListGroupsResponse::group].
6001    ///
6002    /// # Example
6003    /// ```ignore,no_run
6004    /// # use google_cloud_monitoring_v3::model::ListGroupsResponse;
6005    /// use google_cloud_monitoring_v3::model::Group;
6006    /// let x = ListGroupsResponse::new()
6007    ///     .set_group([
6008    ///         Group::default()/* use setters */,
6009    ///         Group::default()/* use (different) setters */,
6010    ///     ]);
6011    /// ```
6012    pub fn set_group<T, V>(mut self, v: T) -> Self
6013    where
6014        T: std::iter::IntoIterator<Item = V>,
6015        V: std::convert::Into<crate::model::Group>,
6016    {
6017        use std::iter::Iterator;
6018        self.group = v.into_iter().map(|i| i.into()).collect();
6019        self
6020    }
6021
6022    /// Sets the value of [next_page_token][crate::model::ListGroupsResponse::next_page_token].
6023    ///
6024    /// # Example
6025    /// ```ignore,no_run
6026    /// # use google_cloud_monitoring_v3::model::ListGroupsResponse;
6027    /// let x = ListGroupsResponse::new().set_next_page_token("example");
6028    /// ```
6029    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6030        self.next_page_token = v.into();
6031        self
6032    }
6033}
6034
6035impl wkt::message::Message for ListGroupsResponse {
6036    fn typename() -> &'static str {
6037        "type.googleapis.com/google.monitoring.v3.ListGroupsResponse"
6038    }
6039}
6040
6041#[doc(hidden)]
6042impl gax::paginator::internal::PageableResponse for ListGroupsResponse {
6043    type PageItem = crate::model::Group;
6044
6045    fn items(self) -> std::vec::Vec<Self::PageItem> {
6046        self.group
6047    }
6048
6049    fn next_page_token(&self) -> std::string::String {
6050        use std::clone::Clone;
6051        self.next_page_token.clone()
6052    }
6053}
6054
6055/// The `GetGroup` request.
6056#[derive(Clone, Default, PartialEq)]
6057#[non_exhaustive]
6058pub struct GetGroupRequest {
6059    /// Required. The group to retrieve. The format is:
6060    ///
6061    /// ```norust
6062    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
6063    /// ```
6064    pub name: std::string::String,
6065
6066    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6067}
6068
6069impl GetGroupRequest {
6070    pub fn new() -> Self {
6071        std::default::Default::default()
6072    }
6073
6074    /// Sets the value of [name][crate::model::GetGroupRequest::name].
6075    ///
6076    /// # Example
6077    /// ```ignore,no_run
6078    /// # use google_cloud_monitoring_v3::model::GetGroupRequest;
6079    /// let x = GetGroupRequest::new().set_name("example");
6080    /// ```
6081    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6082        self.name = v.into();
6083        self
6084    }
6085}
6086
6087impl wkt::message::Message for GetGroupRequest {
6088    fn typename() -> &'static str {
6089        "type.googleapis.com/google.monitoring.v3.GetGroupRequest"
6090    }
6091}
6092
6093/// The `CreateGroup` request.
6094#[derive(Clone, Default, PartialEq)]
6095#[non_exhaustive]
6096pub struct CreateGroupRequest {
6097    /// Required. The
6098    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
6099    /// to create the group. The format is:
6100    ///
6101    /// ```norust
6102    /// projects/[PROJECT_ID_OR_NUMBER]
6103    /// ```
6104    pub name: std::string::String,
6105
6106    /// Required. A group definition. It is an error to define the `name` field
6107    /// because the system assigns the name.
6108    pub group: std::option::Option<crate::model::Group>,
6109
6110    /// If true, validate this request but do not create the group.
6111    pub validate_only: bool,
6112
6113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6114}
6115
6116impl CreateGroupRequest {
6117    pub fn new() -> Self {
6118        std::default::Default::default()
6119    }
6120
6121    /// Sets the value of [name][crate::model::CreateGroupRequest::name].
6122    ///
6123    /// # Example
6124    /// ```ignore,no_run
6125    /// # use google_cloud_monitoring_v3::model::CreateGroupRequest;
6126    /// let x = CreateGroupRequest::new().set_name("example");
6127    /// ```
6128    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6129        self.name = v.into();
6130        self
6131    }
6132
6133    /// Sets the value of [group][crate::model::CreateGroupRequest::group].
6134    ///
6135    /// # Example
6136    /// ```ignore,no_run
6137    /// # use google_cloud_monitoring_v3::model::CreateGroupRequest;
6138    /// use google_cloud_monitoring_v3::model::Group;
6139    /// let x = CreateGroupRequest::new().set_group(Group::default()/* use setters */);
6140    /// ```
6141    pub fn set_group<T>(mut self, v: T) -> Self
6142    where
6143        T: std::convert::Into<crate::model::Group>,
6144    {
6145        self.group = std::option::Option::Some(v.into());
6146        self
6147    }
6148
6149    /// Sets or clears the value of [group][crate::model::CreateGroupRequest::group].
6150    ///
6151    /// # Example
6152    /// ```ignore,no_run
6153    /// # use google_cloud_monitoring_v3::model::CreateGroupRequest;
6154    /// use google_cloud_monitoring_v3::model::Group;
6155    /// let x = CreateGroupRequest::new().set_or_clear_group(Some(Group::default()/* use setters */));
6156    /// let x = CreateGroupRequest::new().set_or_clear_group(None::<Group>);
6157    /// ```
6158    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
6159    where
6160        T: std::convert::Into<crate::model::Group>,
6161    {
6162        self.group = v.map(|x| x.into());
6163        self
6164    }
6165
6166    /// Sets the value of [validate_only][crate::model::CreateGroupRequest::validate_only].
6167    ///
6168    /// # Example
6169    /// ```ignore,no_run
6170    /// # use google_cloud_monitoring_v3::model::CreateGroupRequest;
6171    /// let x = CreateGroupRequest::new().set_validate_only(true);
6172    /// ```
6173    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6174        self.validate_only = v.into();
6175        self
6176    }
6177}
6178
6179impl wkt::message::Message for CreateGroupRequest {
6180    fn typename() -> &'static str {
6181        "type.googleapis.com/google.monitoring.v3.CreateGroupRequest"
6182    }
6183}
6184
6185/// The `UpdateGroup` request.
6186#[derive(Clone, Default, PartialEq)]
6187#[non_exhaustive]
6188pub struct UpdateGroupRequest {
6189    /// Required. The new definition of the group.  All fields of the existing
6190    /// group, excepting `name`, are replaced with the corresponding fields of this
6191    /// group.
6192    pub group: std::option::Option<crate::model::Group>,
6193
6194    /// If true, validate this request but do not update the existing group.
6195    pub validate_only: bool,
6196
6197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6198}
6199
6200impl UpdateGroupRequest {
6201    pub fn new() -> Self {
6202        std::default::Default::default()
6203    }
6204
6205    /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
6206    ///
6207    /// # Example
6208    /// ```ignore,no_run
6209    /// # use google_cloud_monitoring_v3::model::UpdateGroupRequest;
6210    /// use google_cloud_monitoring_v3::model::Group;
6211    /// let x = UpdateGroupRequest::new().set_group(Group::default()/* use setters */);
6212    /// ```
6213    pub fn set_group<T>(mut self, v: T) -> Self
6214    where
6215        T: std::convert::Into<crate::model::Group>,
6216    {
6217        self.group = std::option::Option::Some(v.into());
6218        self
6219    }
6220
6221    /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
6222    ///
6223    /// # Example
6224    /// ```ignore,no_run
6225    /// # use google_cloud_monitoring_v3::model::UpdateGroupRequest;
6226    /// use google_cloud_monitoring_v3::model::Group;
6227    /// let x = UpdateGroupRequest::new().set_or_clear_group(Some(Group::default()/* use setters */));
6228    /// let x = UpdateGroupRequest::new().set_or_clear_group(None::<Group>);
6229    /// ```
6230    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
6231    where
6232        T: std::convert::Into<crate::model::Group>,
6233    {
6234        self.group = v.map(|x| x.into());
6235        self
6236    }
6237
6238    /// Sets the value of [validate_only][crate::model::UpdateGroupRequest::validate_only].
6239    ///
6240    /// # Example
6241    /// ```ignore,no_run
6242    /// # use google_cloud_monitoring_v3::model::UpdateGroupRequest;
6243    /// let x = UpdateGroupRequest::new().set_validate_only(true);
6244    /// ```
6245    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6246        self.validate_only = v.into();
6247        self
6248    }
6249}
6250
6251impl wkt::message::Message for UpdateGroupRequest {
6252    fn typename() -> &'static str {
6253        "type.googleapis.com/google.monitoring.v3.UpdateGroupRequest"
6254    }
6255}
6256
6257/// The `DeleteGroup` request. The default behavior is to be able to delete a
6258/// single group without any descendants.
6259#[derive(Clone, Default, PartialEq)]
6260#[non_exhaustive]
6261pub struct DeleteGroupRequest {
6262    /// Required. The group to delete. The format is:
6263    ///
6264    /// ```norust
6265    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
6266    /// ```
6267    pub name: std::string::String,
6268
6269    /// If this field is true, then the request means to delete a group with all
6270    /// its descendants. Otherwise, the request means to delete a group only when
6271    /// it has no descendants. The default value is false.
6272    pub recursive: bool,
6273
6274    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6275}
6276
6277impl DeleteGroupRequest {
6278    pub fn new() -> Self {
6279        std::default::Default::default()
6280    }
6281
6282    /// Sets the value of [name][crate::model::DeleteGroupRequest::name].
6283    ///
6284    /// # Example
6285    /// ```ignore,no_run
6286    /// # use google_cloud_monitoring_v3::model::DeleteGroupRequest;
6287    /// let x = DeleteGroupRequest::new().set_name("example");
6288    /// ```
6289    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6290        self.name = v.into();
6291        self
6292    }
6293
6294    /// Sets the value of [recursive][crate::model::DeleteGroupRequest::recursive].
6295    ///
6296    /// # Example
6297    /// ```ignore,no_run
6298    /// # use google_cloud_monitoring_v3::model::DeleteGroupRequest;
6299    /// let x = DeleteGroupRequest::new().set_recursive(true);
6300    /// ```
6301    pub fn set_recursive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6302        self.recursive = v.into();
6303        self
6304    }
6305}
6306
6307impl wkt::message::Message for DeleteGroupRequest {
6308    fn typename() -> &'static str {
6309        "type.googleapis.com/google.monitoring.v3.DeleteGroupRequest"
6310    }
6311}
6312
6313/// The `ListGroupMembers` request.
6314#[derive(Clone, Default, PartialEq)]
6315#[non_exhaustive]
6316pub struct ListGroupMembersRequest {
6317    /// Required. The group whose members are listed. The format is:
6318    ///
6319    /// ```norust
6320    /// projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
6321    /// ```
6322    pub name: std::string::String,
6323
6324    /// A positive number that is the maximum number of results to return.
6325    pub page_size: i32,
6326
6327    /// If this field is not empty then it must contain the `next_page_token` value
6328    /// returned by a previous call to this method.  Using this field causes the
6329    /// method to return additional results from the previous method call.
6330    pub page_token: std::string::String,
6331
6332    /// An optional [list
6333    /// filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
6334    /// describing the members to be returned.  The filter may reference the type,
6335    /// labels, and metadata of monitored resources that comprise the group. For
6336    /// example, to return only resources representing Compute Engine VM instances,
6337    /// use this filter:
6338    ///
6339    /// ```norust
6340    /// `resource.type = "gce_instance"`
6341    /// ```
6342    pub filter: std::string::String,
6343
6344    /// An optional time interval for which results should be returned. Only
6345    /// members that were part of the group during the specified interval are
6346    /// included in the response.  If no interval is provided then the group
6347    /// membership over the last minute is returned.
6348    pub interval: std::option::Option<crate::model::TimeInterval>,
6349
6350    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6351}
6352
6353impl ListGroupMembersRequest {
6354    pub fn new() -> Self {
6355        std::default::Default::default()
6356    }
6357
6358    /// Sets the value of [name][crate::model::ListGroupMembersRequest::name].
6359    ///
6360    /// # Example
6361    /// ```ignore,no_run
6362    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6363    /// let x = ListGroupMembersRequest::new().set_name("example");
6364    /// ```
6365    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6366        self.name = v.into();
6367        self
6368    }
6369
6370    /// Sets the value of [page_size][crate::model::ListGroupMembersRequest::page_size].
6371    ///
6372    /// # Example
6373    /// ```ignore,no_run
6374    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6375    /// let x = ListGroupMembersRequest::new().set_page_size(42);
6376    /// ```
6377    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6378        self.page_size = v.into();
6379        self
6380    }
6381
6382    /// Sets the value of [page_token][crate::model::ListGroupMembersRequest::page_token].
6383    ///
6384    /// # Example
6385    /// ```ignore,no_run
6386    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6387    /// let x = ListGroupMembersRequest::new().set_page_token("example");
6388    /// ```
6389    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6390        self.page_token = v.into();
6391        self
6392    }
6393
6394    /// Sets the value of [filter][crate::model::ListGroupMembersRequest::filter].
6395    ///
6396    /// # Example
6397    /// ```ignore,no_run
6398    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6399    /// let x = ListGroupMembersRequest::new().set_filter("example");
6400    /// ```
6401    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6402        self.filter = v.into();
6403        self
6404    }
6405
6406    /// Sets the value of [interval][crate::model::ListGroupMembersRequest::interval].
6407    ///
6408    /// # Example
6409    /// ```ignore,no_run
6410    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6411    /// use google_cloud_monitoring_v3::model::TimeInterval;
6412    /// let x = ListGroupMembersRequest::new().set_interval(TimeInterval::default()/* use setters */);
6413    /// ```
6414    pub fn set_interval<T>(mut self, v: T) -> Self
6415    where
6416        T: std::convert::Into<crate::model::TimeInterval>,
6417    {
6418        self.interval = std::option::Option::Some(v.into());
6419        self
6420    }
6421
6422    /// Sets or clears the value of [interval][crate::model::ListGroupMembersRequest::interval].
6423    ///
6424    /// # Example
6425    /// ```ignore,no_run
6426    /// # use google_cloud_monitoring_v3::model::ListGroupMembersRequest;
6427    /// use google_cloud_monitoring_v3::model::TimeInterval;
6428    /// let x = ListGroupMembersRequest::new().set_or_clear_interval(Some(TimeInterval::default()/* use setters */));
6429    /// let x = ListGroupMembersRequest::new().set_or_clear_interval(None::<TimeInterval>);
6430    /// ```
6431    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
6432    where
6433        T: std::convert::Into<crate::model::TimeInterval>,
6434    {
6435        self.interval = v.map(|x| x.into());
6436        self
6437    }
6438}
6439
6440impl wkt::message::Message for ListGroupMembersRequest {
6441    fn typename() -> &'static str {
6442        "type.googleapis.com/google.monitoring.v3.ListGroupMembersRequest"
6443    }
6444}
6445
6446/// The `ListGroupMembers` response.
6447#[derive(Clone, Default, PartialEq)]
6448#[non_exhaustive]
6449pub struct ListGroupMembersResponse {
6450    /// A set of monitored resources in the group.
6451    pub members: std::vec::Vec<api::model::MonitoredResource>,
6452
6453    /// If there are more results than have been returned, then this field is
6454    /// set to a non-empty value.  To see the additional results, use that value as
6455    /// `page_token` in the next call to this method.
6456    pub next_page_token: std::string::String,
6457
6458    /// The total number of elements matching this request.
6459    pub total_size: i32,
6460
6461    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6462}
6463
6464impl ListGroupMembersResponse {
6465    pub fn new() -> Self {
6466        std::default::Default::default()
6467    }
6468
6469    /// Sets the value of [members][crate::model::ListGroupMembersResponse::members].
6470    ///
6471    /// # Example
6472    /// ```ignore,no_run
6473    /// # use google_cloud_monitoring_v3::model::ListGroupMembersResponse;
6474    /// use api::model::MonitoredResource;
6475    /// let x = ListGroupMembersResponse::new()
6476    ///     .set_members([
6477    ///         MonitoredResource::default()/* use setters */,
6478    ///         MonitoredResource::default()/* use (different) setters */,
6479    ///     ]);
6480    /// ```
6481    pub fn set_members<T, V>(mut self, v: T) -> Self
6482    where
6483        T: std::iter::IntoIterator<Item = V>,
6484        V: std::convert::Into<api::model::MonitoredResource>,
6485    {
6486        use std::iter::Iterator;
6487        self.members = v.into_iter().map(|i| i.into()).collect();
6488        self
6489    }
6490
6491    /// Sets the value of [next_page_token][crate::model::ListGroupMembersResponse::next_page_token].
6492    ///
6493    /// # Example
6494    /// ```ignore,no_run
6495    /// # use google_cloud_monitoring_v3::model::ListGroupMembersResponse;
6496    /// let x = ListGroupMembersResponse::new().set_next_page_token("example");
6497    /// ```
6498    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6499        self.next_page_token = v.into();
6500        self
6501    }
6502
6503    /// Sets the value of [total_size][crate::model::ListGroupMembersResponse::total_size].
6504    ///
6505    /// # Example
6506    /// ```ignore,no_run
6507    /// # use google_cloud_monitoring_v3::model::ListGroupMembersResponse;
6508    /// let x = ListGroupMembersResponse::new().set_total_size(42);
6509    /// ```
6510    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6511        self.total_size = v.into();
6512        self
6513    }
6514}
6515
6516impl wkt::message::Message for ListGroupMembersResponse {
6517    fn typename() -> &'static str {
6518        "type.googleapis.com/google.monitoring.v3.ListGroupMembersResponse"
6519    }
6520}
6521
6522#[doc(hidden)]
6523impl gax::paginator::internal::PageableResponse for ListGroupMembersResponse {
6524    type PageItem = api::model::MonitoredResource;
6525
6526    fn items(self) -> std::vec::Vec<Self::PageItem> {
6527        self.members
6528    }
6529
6530    fn next_page_token(&self) -> std::string::String {
6531        use std::clone::Clone;
6532        self.next_page_token.clone()
6533    }
6534}
6535
6536/// A single data point in a time series.
6537#[derive(Clone, Default, PartialEq)]
6538#[non_exhaustive]
6539pub struct Point {
6540    /// The time interval to which the data point applies.  For `GAUGE` metrics,
6541    /// the start time is optional, but if it is supplied, it must equal the
6542    /// end time.  For `DELTA` metrics, the start
6543    /// and end time should specify a non-zero interval, with subsequent points
6544    /// specifying contiguous and non-overlapping intervals.  For `CUMULATIVE`
6545    /// metrics, the start and end time should specify a non-zero interval, with
6546    /// subsequent points specifying the same start time and increasing end times,
6547    /// until an event resets the cumulative value to zero and sets a new start
6548    /// time for the following points.
6549    pub interval: std::option::Option<crate::model::TimeInterval>,
6550
6551    /// The value of the data point.
6552    pub value: std::option::Option<crate::model::TypedValue>,
6553
6554    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6555}
6556
6557impl Point {
6558    pub fn new() -> Self {
6559        std::default::Default::default()
6560    }
6561
6562    /// Sets the value of [interval][crate::model::Point::interval].
6563    ///
6564    /// # Example
6565    /// ```ignore,no_run
6566    /// # use google_cloud_monitoring_v3::model::Point;
6567    /// use google_cloud_monitoring_v3::model::TimeInterval;
6568    /// let x = Point::new().set_interval(TimeInterval::default()/* use setters */);
6569    /// ```
6570    pub fn set_interval<T>(mut self, v: T) -> Self
6571    where
6572        T: std::convert::Into<crate::model::TimeInterval>,
6573    {
6574        self.interval = std::option::Option::Some(v.into());
6575        self
6576    }
6577
6578    /// Sets or clears the value of [interval][crate::model::Point::interval].
6579    ///
6580    /// # Example
6581    /// ```ignore,no_run
6582    /// # use google_cloud_monitoring_v3::model::Point;
6583    /// use google_cloud_monitoring_v3::model::TimeInterval;
6584    /// let x = Point::new().set_or_clear_interval(Some(TimeInterval::default()/* use setters */));
6585    /// let x = Point::new().set_or_clear_interval(None::<TimeInterval>);
6586    /// ```
6587    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
6588    where
6589        T: std::convert::Into<crate::model::TimeInterval>,
6590    {
6591        self.interval = v.map(|x| x.into());
6592        self
6593    }
6594
6595    /// Sets the value of [value][crate::model::Point::value].
6596    ///
6597    /// # Example
6598    /// ```ignore,no_run
6599    /// # use google_cloud_monitoring_v3::model::Point;
6600    /// use google_cloud_monitoring_v3::model::TypedValue;
6601    /// let x = Point::new().set_value(TypedValue::default()/* use setters */);
6602    /// ```
6603    pub fn set_value<T>(mut self, v: T) -> Self
6604    where
6605        T: std::convert::Into<crate::model::TypedValue>,
6606    {
6607        self.value = std::option::Option::Some(v.into());
6608        self
6609    }
6610
6611    /// Sets or clears the value of [value][crate::model::Point::value].
6612    ///
6613    /// # Example
6614    /// ```ignore,no_run
6615    /// # use google_cloud_monitoring_v3::model::Point;
6616    /// use google_cloud_monitoring_v3::model::TypedValue;
6617    /// let x = Point::new().set_or_clear_value(Some(TypedValue::default()/* use setters */));
6618    /// let x = Point::new().set_or_clear_value(None::<TypedValue>);
6619    /// ```
6620    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
6621    where
6622        T: std::convert::Into<crate::model::TypedValue>,
6623    {
6624        self.value = v.map(|x| x.into());
6625        self
6626    }
6627}
6628
6629impl wkt::message::Message for Point {
6630    fn typename() -> &'static str {
6631        "type.googleapis.com/google.monitoring.v3.Point"
6632    }
6633}
6634
6635/// A collection of data points that describes the time-varying values
6636/// of a metric. A time series is identified by a combination of a
6637/// fully-specified monitored resource and a fully-specified metric.
6638/// This type is used for both listing and creating time series.
6639#[derive(Clone, Default, PartialEq)]
6640#[non_exhaustive]
6641pub struct TimeSeries {
6642    /// The associated metric. A fully-specified metric used to identify the time
6643    /// series.
6644    pub metric: std::option::Option<api::model::Metric>,
6645
6646    /// The associated monitored resource.  Custom metrics can use only certain
6647    /// monitored resource types in their time series data. For more information,
6648    /// see [Monitored resources for custom
6649    /// metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
6650    pub resource: std::option::Option<api::model::MonitoredResource>,
6651
6652    /// Output only. The associated monitored resource metadata. When reading a
6653    /// time series, this field will include metadata labels that are explicitly
6654    /// named in the reduction. When creating a time series, this field is ignored.
6655    pub metadata: std::option::Option<api::model::MonitoredResourceMetadata>,
6656
6657    /// The metric kind of the time series. When listing time series, this metric
6658    /// kind might be different from the metric kind of the associated metric if
6659    /// this time series is an alignment or reduction of other time series.
6660    ///
6661    /// When creating a time series, this field is optional. If present, it must be
6662    /// the same as the metric kind of the associated metric. If the associated
6663    /// metric's descriptor must be auto-created, then this field specifies the
6664    /// metric kind of the new descriptor and must be either `GAUGE` (the default)
6665    /// or `CUMULATIVE`.
6666    pub metric_kind: api::model::metric_descriptor::MetricKind,
6667
6668    /// The value type of the time series. When listing time series, this value
6669    /// type might be different from the value type of the associated metric if
6670    /// this time series is an alignment or reduction of other time series.
6671    ///
6672    /// When creating a time series, this field is optional. If present, it must be
6673    /// the same as the type of the data in the `points` field.
6674    pub value_type: api::model::metric_descriptor::ValueType,
6675
6676    /// The data points of this time series. When listing time series, points are
6677    /// returned in reverse time order.
6678    ///
6679    /// When creating a time series, this field must contain exactly one point and
6680    /// the point's type must be the same as the value type of the associated
6681    /// metric. If the associated metric's descriptor must be auto-created, then
6682    /// the value type of the descriptor is determined by the point's type, which
6683    /// must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
6684    pub points: std::vec::Vec<crate::model::Point>,
6685
6686    /// The units in which the metric value is reported. It is only applicable
6687    /// if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
6688    /// defines the representation of the stored metric values. This field can only
6689    /// be changed through CreateTimeSeries when it is empty.
6690    pub unit: std::string::String,
6691
6692    /// Input only. A detailed description of the time series that will be
6693    /// associated with the
6694    /// [google.api.MetricDescriptor][google.api.MetricDescriptor] for the metric.
6695    /// Once set, this field cannot be changed through CreateTimeSeries.
6696    ///
6697    /// [google.api.MetricDescriptor]: api::model::MetricDescriptor
6698    pub description: std::string::String,
6699
6700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6701}
6702
6703impl TimeSeries {
6704    pub fn new() -> Self {
6705        std::default::Default::default()
6706    }
6707
6708    /// Sets the value of [metric][crate::model::TimeSeries::metric].
6709    ///
6710    /// # Example
6711    /// ```ignore,no_run
6712    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6713    /// use api::model::Metric;
6714    /// let x = TimeSeries::new().set_metric(Metric::default()/* use setters */);
6715    /// ```
6716    pub fn set_metric<T>(mut self, v: T) -> Self
6717    where
6718        T: std::convert::Into<api::model::Metric>,
6719    {
6720        self.metric = std::option::Option::Some(v.into());
6721        self
6722    }
6723
6724    /// Sets or clears the value of [metric][crate::model::TimeSeries::metric].
6725    ///
6726    /// # Example
6727    /// ```ignore,no_run
6728    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6729    /// use api::model::Metric;
6730    /// let x = TimeSeries::new().set_or_clear_metric(Some(Metric::default()/* use setters */));
6731    /// let x = TimeSeries::new().set_or_clear_metric(None::<Metric>);
6732    /// ```
6733    pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
6734    where
6735        T: std::convert::Into<api::model::Metric>,
6736    {
6737        self.metric = v.map(|x| x.into());
6738        self
6739    }
6740
6741    /// Sets the value of [resource][crate::model::TimeSeries::resource].
6742    ///
6743    /// # Example
6744    /// ```ignore,no_run
6745    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6746    /// use api::model::MonitoredResource;
6747    /// let x = TimeSeries::new().set_resource(MonitoredResource::default()/* use setters */);
6748    /// ```
6749    pub fn set_resource<T>(mut self, v: T) -> Self
6750    where
6751        T: std::convert::Into<api::model::MonitoredResource>,
6752    {
6753        self.resource = std::option::Option::Some(v.into());
6754        self
6755    }
6756
6757    /// Sets or clears the value of [resource][crate::model::TimeSeries::resource].
6758    ///
6759    /// # Example
6760    /// ```ignore,no_run
6761    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6762    /// use api::model::MonitoredResource;
6763    /// let x = TimeSeries::new().set_or_clear_resource(Some(MonitoredResource::default()/* use setters */));
6764    /// let x = TimeSeries::new().set_or_clear_resource(None::<MonitoredResource>);
6765    /// ```
6766    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
6767    where
6768        T: std::convert::Into<api::model::MonitoredResource>,
6769    {
6770        self.resource = v.map(|x| x.into());
6771        self
6772    }
6773
6774    /// Sets the value of [metadata][crate::model::TimeSeries::metadata].
6775    ///
6776    /// # Example
6777    /// ```ignore,no_run
6778    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6779    /// use api::model::MonitoredResourceMetadata;
6780    /// let x = TimeSeries::new().set_metadata(MonitoredResourceMetadata::default()/* use setters */);
6781    /// ```
6782    pub fn set_metadata<T>(mut self, v: T) -> Self
6783    where
6784        T: std::convert::Into<api::model::MonitoredResourceMetadata>,
6785    {
6786        self.metadata = std::option::Option::Some(v.into());
6787        self
6788    }
6789
6790    /// Sets or clears the value of [metadata][crate::model::TimeSeries::metadata].
6791    ///
6792    /// # Example
6793    /// ```ignore,no_run
6794    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6795    /// use api::model::MonitoredResourceMetadata;
6796    /// let x = TimeSeries::new().set_or_clear_metadata(Some(MonitoredResourceMetadata::default()/* use setters */));
6797    /// let x = TimeSeries::new().set_or_clear_metadata(None::<MonitoredResourceMetadata>);
6798    /// ```
6799    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
6800    where
6801        T: std::convert::Into<api::model::MonitoredResourceMetadata>,
6802    {
6803        self.metadata = v.map(|x| x.into());
6804        self
6805    }
6806
6807    /// Sets the value of [metric_kind][crate::model::TimeSeries::metric_kind].
6808    ///
6809    /// # Example
6810    /// ```ignore,no_run
6811    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6812    /// use api::model::metric_descriptor::MetricKind;
6813    /// let x0 = TimeSeries::new().set_metric_kind(MetricKind::Gauge);
6814    /// let x1 = TimeSeries::new().set_metric_kind(MetricKind::Delta);
6815    /// let x2 = TimeSeries::new().set_metric_kind(MetricKind::Cumulative);
6816    /// ```
6817    pub fn set_metric_kind<T: std::convert::Into<api::model::metric_descriptor::MetricKind>>(
6818        mut self,
6819        v: T,
6820    ) -> Self {
6821        self.metric_kind = v.into();
6822        self
6823    }
6824
6825    /// Sets the value of [value_type][crate::model::TimeSeries::value_type].
6826    ///
6827    /// # Example
6828    /// ```ignore,no_run
6829    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6830    /// use api::model::metric_descriptor::ValueType;
6831    /// let x0 = TimeSeries::new().set_value_type(ValueType::Bool);
6832    /// let x1 = TimeSeries::new().set_value_type(ValueType::Int64);
6833    /// let x2 = TimeSeries::new().set_value_type(ValueType::Double);
6834    /// ```
6835    pub fn set_value_type<T: std::convert::Into<api::model::metric_descriptor::ValueType>>(
6836        mut self,
6837        v: T,
6838    ) -> Self {
6839        self.value_type = v.into();
6840        self
6841    }
6842
6843    /// Sets the value of [points][crate::model::TimeSeries::points].
6844    ///
6845    /// # Example
6846    /// ```ignore,no_run
6847    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6848    /// use google_cloud_monitoring_v3::model::Point;
6849    /// let x = TimeSeries::new()
6850    ///     .set_points([
6851    ///         Point::default()/* use setters */,
6852    ///         Point::default()/* use (different) setters */,
6853    ///     ]);
6854    /// ```
6855    pub fn set_points<T, V>(mut self, v: T) -> Self
6856    where
6857        T: std::iter::IntoIterator<Item = V>,
6858        V: std::convert::Into<crate::model::Point>,
6859    {
6860        use std::iter::Iterator;
6861        self.points = v.into_iter().map(|i| i.into()).collect();
6862        self
6863    }
6864
6865    /// Sets the value of [unit][crate::model::TimeSeries::unit].
6866    ///
6867    /// # Example
6868    /// ```ignore,no_run
6869    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6870    /// let x = TimeSeries::new().set_unit("example");
6871    /// ```
6872    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6873        self.unit = v.into();
6874        self
6875    }
6876
6877    /// Sets the value of [description][crate::model::TimeSeries::description].
6878    ///
6879    /// # Example
6880    /// ```ignore,no_run
6881    /// # use google_cloud_monitoring_v3::model::TimeSeries;
6882    /// let x = TimeSeries::new().set_description("example");
6883    /// ```
6884    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6885        self.description = v.into();
6886        self
6887    }
6888}
6889
6890impl wkt::message::Message for TimeSeries {
6891    fn typename() -> &'static str {
6892        "type.googleapis.com/google.monitoring.v3.TimeSeries"
6893    }
6894}
6895
6896/// A descriptor for the labels and points in a time series.
6897#[derive(Clone, Default, PartialEq)]
6898#[non_exhaustive]
6899pub struct TimeSeriesDescriptor {
6900    /// Descriptors for the labels.
6901    pub label_descriptors: std::vec::Vec<api::model::LabelDescriptor>,
6902
6903    /// Descriptors for the point data value columns.
6904    pub point_descriptors: std::vec::Vec<crate::model::time_series_descriptor::ValueDescriptor>,
6905
6906    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6907}
6908
6909impl TimeSeriesDescriptor {
6910    pub fn new() -> Self {
6911        std::default::Default::default()
6912    }
6913
6914    /// Sets the value of [label_descriptors][crate::model::TimeSeriesDescriptor::label_descriptors].
6915    ///
6916    /// # Example
6917    /// ```ignore,no_run
6918    /// # use google_cloud_monitoring_v3::model::TimeSeriesDescriptor;
6919    /// use api::model::LabelDescriptor;
6920    /// let x = TimeSeriesDescriptor::new()
6921    ///     .set_label_descriptors([
6922    ///         LabelDescriptor::default()/* use setters */,
6923    ///         LabelDescriptor::default()/* use (different) setters */,
6924    ///     ]);
6925    /// ```
6926    pub fn set_label_descriptors<T, V>(mut self, v: T) -> Self
6927    where
6928        T: std::iter::IntoIterator<Item = V>,
6929        V: std::convert::Into<api::model::LabelDescriptor>,
6930    {
6931        use std::iter::Iterator;
6932        self.label_descriptors = v.into_iter().map(|i| i.into()).collect();
6933        self
6934    }
6935
6936    /// Sets the value of [point_descriptors][crate::model::TimeSeriesDescriptor::point_descriptors].
6937    ///
6938    /// # Example
6939    /// ```ignore,no_run
6940    /// # use google_cloud_monitoring_v3::model::TimeSeriesDescriptor;
6941    /// use google_cloud_monitoring_v3::model::time_series_descriptor::ValueDescriptor;
6942    /// let x = TimeSeriesDescriptor::new()
6943    ///     .set_point_descriptors([
6944    ///         ValueDescriptor::default()/* use setters */,
6945    ///         ValueDescriptor::default()/* use (different) setters */,
6946    ///     ]);
6947    /// ```
6948    pub fn set_point_descriptors<T, V>(mut self, v: T) -> Self
6949    where
6950        T: std::iter::IntoIterator<Item = V>,
6951        V: std::convert::Into<crate::model::time_series_descriptor::ValueDescriptor>,
6952    {
6953        use std::iter::Iterator;
6954        self.point_descriptors = v.into_iter().map(|i| i.into()).collect();
6955        self
6956    }
6957}
6958
6959impl wkt::message::Message for TimeSeriesDescriptor {
6960    fn typename() -> &'static str {
6961        "type.googleapis.com/google.monitoring.v3.TimeSeriesDescriptor"
6962    }
6963}
6964
6965/// Defines additional types related to [TimeSeriesDescriptor].
6966pub mod time_series_descriptor {
6967    #[allow(unused_imports)]
6968    use super::*;
6969
6970    /// A descriptor for the value columns in a data point.
6971    #[derive(Clone, Default, PartialEq)]
6972    #[non_exhaustive]
6973    pub struct ValueDescriptor {
6974        /// The value key.
6975        pub key: std::string::String,
6976
6977        /// The value type.
6978        pub value_type: api::model::metric_descriptor::ValueType,
6979
6980        /// The value stream kind.
6981        pub metric_kind: api::model::metric_descriptor::MetricKind,
6982
6983        /// The unit in which `time_series` point values are reported. `unit`
6984        /// follows the UCUM format for units as seen in
6985        /// <https://unitsofmeasure.org/ucum.html>.
6986        /// `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION.
6987        pub unit: std::string::String,
6988
6989        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6990    }
6991
6992    impl ValueDescriptor {
6993        pub fn new() -> Self {
6994            std::default::Default::default()
6995        }
6996
6997        /// Sets the value of [key][crate::model::time_series_descriptor::ValueDescriptor::key].
6998        ///
6999        /// # Example
7000        /// ```ignore,no_run
7001        /// # use google_cloud_monitoring_v3::model::time_series_descriptor::ValueDescriptor;
7002        /// let x = ValueDescriptor::new().set_key("example");
7003        /// ```
7004        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7005            self.key = v.into();
7006            self
7007        }
7008
7009        /// Sets the value of [value_type][crate::model::time_series_descriptor::ValueDescriptor::value_type].
7010        ///
7011        /// # Example
7012        /// ```ignore,no_run
7013        /// # use google_cloud_monitoring_v3::model::time_series_descriptor::ValueDescriptor;
7014        /// use api::model::metric_descriptor::ValueType;
7015        /// let x0 = ValueDescriptor::new().set_value_type(ValueType::Bool);
7016        /// let x1 = ValueDescriptor::new().set_value_type(ValueType::Int64);
7017        /// let x2 = ValueDescriptor::new().set_value_type(ValueType::Double);
7018        /// ```
7019        pub fn set_value_type<T: std::convert::Into<api::model::metric_descriptor::ValueType>>(
7020            mut self,
7021            v: T,
7022        ) -> Self {
7023            self.value_type = v.into();
7024            self
7025        }
7026
7027        /// Sets the value of [metric_kind][crate::model::time_series_descriptor::ValueDescriptor::metric_kind].
7028        ///
7029        /// # Example
7030        /// ```ignore,no_run
7031        /// # use google_cloud_monitoring_v3::model::time_series_descriptor::ValueDescriptor;
7032        /// use api::model::metric_descriptor::MetricKind;
7033        /// let x0 = ValueDescriptor::new().set_metric_kind(MetricKind::Gauge);
7034        /// let x1 = ValueDescriptor::new().set_metric_kind(MetricKind::Delta);
7035        /// let x2 = ValueDescriptor::new().set_metric_kind(MetricKind::Cumulative);
7036        /// ```
7037        pub fn set_metric_kind<T: std::convert::Into<api::model::metric_descriptor::MetricKind>>(
7038            mut self,
7039            v: T,
7040        ) -> Self {
7041            self.metric_kind = v.into();
7042            self
7043        }
7044
7045        /// Sets the value of [unit][crate::model::time_series_descriptor::ValueDescriptor::unit].
7046        ///
7047        /// # Example
7048        /// ```ignore,no_run
7049        /// # use google_cloud_monitoring_v3::model::time_series_descriptor::ValueDescriptor;
7050        /// let x = ValueDescriptor::new().set_unit("example");
7051        /// ```
7052        pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7053            self.unit = v.into();
7054            self
7055        }
7056    }
7057
7058    impl wkt::message::Message for ValueDescriptor {
7059        fn typename() -> &'static str {
7060            "type.googleapis.com/google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor"
7061        }
7062    }
7063}
7064
7065/// Represents the values of a time series associated with a
7066/// TimeSeriesDescriptor.
7067#[derive(Clone, Default, PartialEq)]
7068#[non_exhaustive]
7069pub struct TimeSeriesData {
7070    /// The values of the labels in the time series identifier, given in the same
7071    /// order as the `label_descriptors` field of the TimeSeriesDescriptor
7072    /// associated with this object. Each value must have a value of the type
7073    /// given in the corresponding entry of `label_descriptors`.
7074    pub label_values: std::vec::Vec<crate::model::LabelValue>,
7075
7076    /// The points in the time series.
7077    pub point_data: std::vec::Vec<crate::model::time_series_data::PointData>,
7078
7079    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7080}
7081
7082impl TimeSeriesData {
7083    pub fn new() -> Self {
7084        std::default::Default::default()
7085    }
7086
7087    /// Sets the value of [label_values][crate::model::TimeSeriesData::label_values].
7088    ///
7089    /// # Example
7090    /// ```ignore,no_run
7091    /// # use google_cloud_monitoring_v3::model::TimeSeriesData;
7092    /// use google_cloud_monitoring_v3::model::LabelValue;
7093    /// let x = TimeSeriesData::new()
7094    ///     .set_label_values([
7095    ///         LabelValue::default()/* use setters */,
7096    ///         LabelValue::default()/* use (different) setters */,
7097    ///     ]);
7098    /// ```
7099    pub fn set_label_values<T, V>(mut self, v: T) -> Self
7100    where
7101        T: std::iter::IntoIterator<Item = V>,
7102        V: std::convert::Into<crate::model::LabelValue>,
7103    {
7104        use std::iter::Iterator;
7105        self.label_values = v.into_iter().map(|i| i.into()).collect();
7106        self
7107    }
7108
7109    /// Sets the value of [point_data][crate::model::TimeSeriesData::point_data].
7110    ///
7111    /// # Example
7112    /// ```ignore,no_run
7113    /// # use google_cloud_monitoring_v3::model::TimeSeriesData;
7114    /// use google_cloud_monitoring_v3::model::time_series_data::PointData;
7115    /// let x = TimeSeriesData::new()
7116    ///     .set_point_data([
7117    ///         PointData::default()/* use setters */,
7118    ///         PointData::default()/* use (different) setters */,
7119    ///     ]);
7120    /// ```
7121    pub fn set_point_data<T, V>(mut self, v: T) -> Self
7122    where
7123        T: std::iter::IntoIterator<Item = V>,
7124        V: std::convert::Into<crate::model::time_series_data::PointData>,
7125    {
7126        use std::iter::Iterator;
7127        self.point_data = v.into_iter().map(|i| i.into()).collect();
7128        self
7129    }
7130}
7131
7132impl wkt::message::Message for TimeSeriesData {
7133    fn typename() -> &'static str {
7134        "type.googleapis.com/google.monitoring.v3.TimeSeriesData"
7135    }
7136}
7137
7138/// Defines additional types related to [TimeSeriesData].
7139pub mod time_series_data {
7140    #[allow(unused_imports)]
7141    use super::*;
7142
7143    /// A point's value columns and time interval. Each point has one or more
7144    /// point values corresponding to the entries in `point_descriptors` field in
7145    /// the TimeSeriesDescriptor associated with this object.
7146    #[derive(Clone, Default, PartialEq)]
7147    #[non_exhaustive]
7148    pub struct PointData {
7149        /// The values that make up the point.
7150        pub values: std::vec::Vec<crate::model::TypedValue>,
7151
7152        /// The time interval associated with the point.
7153        pub time_interval: std::option::Option<crate::model::TimeInterval>,
7154
7155        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7156    }
7157
7158    impl PointData {
7159        pub fn new() -> Self {
7160            std::default::Default::default()
7161        }
7162
7163        /// Sets the value of [values][crate::model::time_series_data::PointData::values].
7164        ///
7165        /// # Example
7166        /// ```ignore,no_run
7167        /// # use google_cloud_monitoring_v3::model::time_series_data::PointData;
7168        /// use google_cloud_monitoring_v3::model::TypedValue;
7169        /// let x = PointData::new()
7170        ///     .set_values([
7171        ///         TypedValue::default()/* use setters */,
7172        ///         TypedValue::default()/* use (different) setters */,
7173        ///     ]);
7174        /// ```
7175        pub fn set_values<T, V>(mut self, v: T) -> Self
7176        where
7177            T: std::iter::IntoIterator<Item = V>,
7178            V: std::convert::Into<crate::model::TypedValue>,
7179        {
7180            use std::iter::Iterator;
7181            self.values = v.into_iter().map(|i| i.into()).collect();
7182            self
7183        }
7184
7185        /// Sets the value of [time_interval][crate::model::time_series_data::PointData::time_interval].
7186        ///
7187        /// # Example
7188        /// ```ignore,no_run
7189        /// # use google_cloud_monitoring_v3::model::time_series_data::PointData;
7190        /// use google_cloud_monitoring_v3::model::TimeInterval;
7191        /// let x = PointData::new().set_time_interval(TimeInterval::default()/* use setters */);
7192        /// ```
7193        pub fn set_time_interval<T>(mut self, v: T) -> Self
7194        where
7195            T: std::convert::Into<crate::model::TimeInterval>,
7196        {
7197            self.time_interval = std::option::Option::Some(v.into());
7198            self
7199        }
7200
7201        /// Sets or clears the value of [time_interval][crate::model::time_series_data::PointData::time_interval].
7202        ///
7203        /// # Example
7204        /// ```ignore,no_run
7205        /// # use google_cloud_monitoring_v3::model::time_series_data::PointData;
7206        /// use google_cloud_monitoring_v3::model::TimeInterval;
7207        /// let x = PointData::new().set_or_clear_time_interval(Some(TimeInterval::default()/* use setters */));
7208        /// let x = PointData::new().set_or_clear_time_interval(None::<TimeInterval>);
7209        /// ```
7210        pub fn set_or_clear_time_interval<T>(mut self, v: std::option::Option<T>) -> Self
7211        where
7212            T: std::convert::Into<crate::model::TimeInterval>,
7213        {
7214            self.time_interval = v.map(|x| x.into());
7215            self
7216        }
7217    }
7218
7219    impl wkt::message::Message for PointData {
7220        fn typename() -> &'static str {
7221            "type.googleapis.com/google.monitoring.v3.TimeSeriesData.PointData"
7222        }
7223    }
7224}
7225
7226/// A label value.
7227#[derive(Clone, Default, PartialEq)]
7228#[non_exhaustive]
7229pub struct LabelValue {
7230    /// The label value can be a bool, int64, or string.
7231    pub value: std::option::Option<crate::model::label_value::Value>,
7232
7233    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7234}
7235
7236impl LabelValue {
7237    pub fn new() -> Self {
7238        std::default::Default::default()
7239    }
7240
7241    /// Sets the value of [value][crate::model::LabelValue::value].
7242    ///
7243    /// Note that all the setters affecting `value` are mutually
7244    /// exclusive.
7245    ///
7246    /// # Example
7247    /// ```ignore,no_run
7248    /// # use google_cloud_monitoring_v3::model::LabelValue;
7249    /// use google_cloud_monitoring_v3::model::label_value::Value;
7250    /// let x = LabelValue::new().set_value(Some(Value::BoolValue(true)));
7251    /// ```
7252    pub fn set_value<
7253        T: std::convert::Into<std::option::Option<crate::model::label_value::Value>>,
7254    >(
7255        mut self,
7256        v: T,
7257    ) -> Self {
7258        self.value = v.into();
7259        self
7260    }
7261
7262    /// The value of [value][crate::model::LabelValue::value]
7263    /// if it holds a `BoolValue`, `None` if the field is not set or
7264    /// holds a different branch.
7265    pub fn bool_value(&self) -> std::option::Option<&bool> {
7266        #[allow(unreachable_patterns)]
7267        self.value.as_ref().and_then(|v| match v {
7268            crate::model::label_value::Value::BoolValue(v) => std::option::Option::Some(v),
7269            _ => std::option::Option::None,
7270        })
7271    }
7272
7273    /// Sets the value of [value][crate::model::LabelValue::value]
7274    /// to hold a `BoolValue`.
7275    ///
7276    /// Note that all the setters affecting `value` are
7277    /// mutually exclusive.
7278    ///
7279    /// # Example
7280    /// ```ignore,no_run
7281    /// # use google_cloud_monitoring_v3::model::LabelValue;
7282    /// let x = LabelValue::new().set_bool_value(true);
7283    /// assert!(x.bool_value().is_some());
7284    /// assert!(x.int64_value().is_none());
7285    /// assert!(x.string_value().is_none());
7286    /// ```
7287    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7288        self.value =
7289            std::option::Option::Some(crate::model::label_value::Value::BoolValue(v.into()));
7290        self
7291    }
7292
7293    /// The value of [value][crate::model::LabelValue::value]
7294    /// if it holds a `Int64Value`, `None` if the field is not set or
7295    /// holds a different branch.
7296    pub fn int64_value(&self) -> std::option::Option<&i64> {
7297        #[allow(unreachable_patterns)]
7298        self.value.as_ref().and_then(|v| match v {
7299            crate::model::label_value::Value::Int64Value(v) => std::option::Option::Some(v),
7300            _ => std::option::Option::None,
7301        })
7302    }
7303
7304    /// Sets the value of [value][crate::model::LabelValue::value]
7305    /// to hold a `Int64Value`.
7306    ///
7307    /// Note that all the setters affecting `value` are
7308    /// mutually exclusive.
7309    ///
7310    /// # Example
7311    /// ```ignore,no_run
7312    /// # use google_cloud_monitoring_v3::model::LabelValue;
7313    /// let x = LabelValue::new().set_int64_value(42);
7314    /// assert!(x.int64_value().is_some());
7315    /// assert!(x.bool_value().is_none());
7316    /// assert!(x.string_value().is_none());
7317    /// ```
7318    pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7319        self.value =
7320            std::option::Option::Some(crate::model::label_value::Value::Int64Value(v.into()));
7321        self
7322    }
7323
7324    /// The value of [value][crate::model::LabelValue::value]
7325    /// if it holds a `StringValue`, `None` if the field is not set or
7326    /// holds a different branch.
7327    pub fn string_value(&self) -> std::option::Option<&std::string::String> {
7328        #[allow(unreachable_patterns)]
7329        self.value.as_ref().and_then(|v| match v {
7330            crate::model::label_value::Value::StringValue(v) => std::option::Option::Some(v),
7331            _ => std::option::Option::None,
7332        })
7333    }
7334
7335    /// Sets the value of [value][crate::model::LabelValue::value]
7336    /// to hold a `StringValue`.
7337    ///
7338    /// Note that all the setters affecting `value` are
7339    /// mutually exclusive.
7340    ///
7341    /// # Example
7342    /// ```ignore,no_run
7343    /// # use google_cloud_monitoring_v3::model::LabelValue;
7344    /// let x = LabelValue::new().set_string_value("example");
7345    /// assert!(x.string_value().is_some());
7346    /// assert!(x.bool_value().is_none());
7347    /// assert!(x.int64_value().is_none());
7348    /// ```
7349    pub fn set_string_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7350        self.value =
7351            std::option::Option::Some(crate::model::label_value::Value::StringValue(v.into()));
7352        self
7353    }
7354}
7355
7356impl wkt::message::Message for LabelValue {
7357    fn typename() -> &'static str {
7358        "type.googleapis.com/google.monitoring.v3.LabelValue"
7359    }
7360}
7361
7362/// Defines additional types related to [LabelValue].
7363pub mod label_value {
7364    #[allow(unused_imports)]
7365    use super::*;
7366
7367    /// The label value can be a bool, int64, or string.
7368    #[derive(Clone, Debug, PartialEq)]
7369    #[non_exhaustive]
7370    pub enum Value {
7371        /// A bool label value.
7372        BoolValue(bool),
7373        /// An int64 label value.
7374        Int64Value(i64),
7375        /// A string label value.
7376        StringValue(std::string::String),
7377    }
7378}
7379
7380/// An error associated with a query in the time series query language format.
7381#[derive(Clone, Default, PartialEq)]
7382#[non_exhaustive]
7383pub struct QueryError {
7384    /// The location of the time series query language text that this error applies
7385    /// to.
7386    pub locator: std::option::Option<crate::model::TextLocator>,
7387
7388    /// The error message.
7389    pub message: std::string::String,
7390
7391    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7392}
7393
7394impl QueryError {
7395    pub fn new() -> Self {
7396        std::default::Default::default()
7397    }
7398
7399    /// Sets the value of [locator][crate::model::QueryError::locator].
7400    ///
7401    /// # Example
7402    /// ```ignore,no_run
7403    /// # use google_cloud_monitoring_v3::model::QueryError;
7404    /// use google_cloud_monitoring_v3::model::TextLocator;
7405    /// let x = QueryError::new().set_locator(TextLocator::default()/* use setters */);
7406    /// ```
7407    pub fn set_locator<T>(mut self, v: T) -> Self
7408    where
7409        T: std::convert::Into<crate::model::TextLocator>,
7410    {
7411        self.locator = std::option::Option::Some(v.into());
7412        self
7413    }
7414
7415    /// Sets or clears the value of [locator][crate::model::QueryError::locator].
7416    ///
7417    /// # Example
7418    /// ```ignore,no_run
7419    /// # use google_cloud_monitoring_v3::model::QueryError;
7420    /// use google_cloud_monitoring_v3::model::TextLocator;
7421    /// let x = QueryError::new().set_or_clear_locator(Some(TextLocator::default()/* use setters */));
7422    /// let x = QueryError::new().set_or_clear_locator(None::<TextLocator>);
7423    /// ```
7424    pub fn set_or_clear_locator<T>(mut self, v: std::option::Option<T>) -> Self
7425    where
7426        T: std::convert::Into<crate::model::TextLocator>,
7427    {
7428        self.locator = v.map(|x| x.into());
7429        self
7430    }
7431
7432    /// Sets the value of [message][crate::model::QueryError::message].
7433    ///
7434    /// # Example
7435    /// ```ignore,no_run
7436    /// # use google_cloud_monitoring_v3::model::QueryError;
7437    /// let x = QueryError::new().set_message("example");
7438    /// ```
7439    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7440        self.message = v.into();
7441        self
7442    }
7443}
7444
7445impl wkt::message::Message for QueryError {
7446    fn typename() -> &'static str {
7447        "type.googleapis.com/google.monitoring.v3.QueryError"
7448    }
7449}
7450
7451/// A locator for text. Indicates a particular part of the text of a request or
7452/// of an object referenced in the request.
7453///
7454/// For example, suppose the request field `text` contains:
7455///
7456/// text: "The quick brown fox jumps over the lazy dog."
7457///
7458/// Then the locator:
7459///
7460/// source: "text"
7461/// start_position {
7462/// line: 1
7463/// column: 17
7464/// }
7465/// end_position {
7466/// line: 1
7467/// column: 19
7468/// }
7469///
7470/// refers to the part of the text: "fox".
7471#[derive(Clone, Default, PartialEq)]
7472#[non_exhaustive]
7473pub struct TextLocator {
7474    /// The source of the text. The source may be a field in the request, in which
7475    /// case its format is the format of the
7476    /// google.rpc.BadRequest.FieldViolation.field field in
7477    /// <https://cloud.google.com/apis/design/errors#error_details>. It may also be
7478    /// be a source other than the request field (e.g. a macro definition
7479    /// referenced in the text of the query), in which case this is the name of
7480    /// the source (e.g. the macro name).
7481    pub source: std::string::String,
7482
7483    /// The position of the first byte within the text.
7484    pub start_position: std::option::Option<crate::model::text_locator::Position>,
7485
7486    /// The position of the last byte within the text.
7487    pub end_position: std::option::Option<crate::model::text_locator::Position>,
7488
7489    /// If `source`, `start_position`, and `end_position` describe a call on
7490    /// some object (e.g. a macro in the time series query language text) and a
7491    /// location is to be designated in that object's text, `nested_locator`
7492    /// identifies the location within that object.
7493    pub nested_locator: std::option::Option<std::boxed::Box<crate::model::TextLocator>>,
7494
7495    /// When `nested_locator` is set, this field gives the reason for the nesting.
7496    /// Usually, the reason is a macro invocation. In that case, the macro name
7497    /// (including the leading '@') signals the location of the macro call
7498    /// in the text and a macro argument name (including the leading '$') signals
7499    /// the location of the macro argument inside the macro body that got
7500    /// substituted away.
7501    pub nesting_reason: std::string::String,
7502
7503    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7504}
7505
7506impl TextLocator {
7507    pub fn new() -> Self {
7508        std::default::Default::default()
7509    }
7510
7511    /// Sets the value of [source][crate::model::TextLocator::source].
7512    ///
7513    /// # Example
7514    /// ```ignore,no_run
7515    /// # use google_cloud_monitoring_v3::model::TextLocator;
7516    /// let x = TextLocator::new().set_source("example");
7517    /// ```
7518    pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7519        self.source = v.into();
7520        self
7521    }
7522
7523    /// Sets the value of [start_position][crate::model::TextLocator::start_position].
7524    ///
7525    /// # Example
7526    /// ```ignore,no_run
7527    /// # use google_cloud_monitoring_v3::model::TextLocator;
7528    /// use google_cloud_monitoring_v3::model::text_locator::Position;
7529    /// let x = TextLocator::new().set_start_position(Position::default()/* use setters */);
7530    /// ```
7531    pub fn set_start_position<T>(mut self, v: T) -> Self
7532    where
7533        T: std::convert::Into<crate::model::text_locator::Position>,
7534    {
7535        self.start_position = std::option::Option::Some(v.into());
7536        self
7537    }
7538
7539    /// Sets or clears the value of [start_position][crate::model::TextLocator::start_position].
7540    ///
7541    /// # Example
7542    /// ```ignore,no_run
7543    /// # use google_cloud_monitoring_v3::model::TextLocator;
7544    /// use google_cloud_monitoring_v3::model::text_locator::Position;
7545    /// let x = TextLocator::new().set_or_clear_start_position(Some(Position::default()/* use setters */));
7546    /// let x = TextLocator::new().set_or_clear_start_position(None::<Position>);
7547    /// ```
7548    pub fn set_or_clear_start_position<T>(mut self, v: std::option::Option<T>) -> Self
7549    where
7550        T: std::convert::Into<crate::model::text_locator::Position>,
7551    {
7552        self.start_position = v.map(|x| x.into());
7553        self
7554    }
7555
7556    /// Sets the value of [end_position][crate::model::TextLocator::end_position].
7557    ///
7558    /// # Example
7559    /// ```ignore,no_run
7560    /// # use google_cloud_monitoring_v3::model::TextLocator;
7561    /// use google_cloud_monitoring_v3::model::text_locator::Position;
7562    /// let x = TextLocator::new().set_end_position(Position::default()/* use setters */);
7563    /// ```
7564    pub fn set_end_position<T>(mut self, v: T) -> Self
7565    where
7566        T: std::convert::Into<crate::model::text_locator::Position>,
7567    {
7568        self.end_position = std::option::Option::Some(v.into());
7569        self
7570    }
7571
7572    /// Sets or clears the value of [end_position][crate::model::TextLocator::end_position].
7573    ///
7574    /// # Example
7575    /// ```ignore,no_run
7576    /// # use google_cloud_monitoring_v3::model::TextLocator;
7577    /// use google_cloud_monitoring_v3::model::text_locator::Position;
7578    /// let x = TextLocator::new().set_or_clear_end_position(Some(Position::default()/* use setters */));
7579    /// let x = TextLocator::new().set_or_clear_end_position(None::<Position>);
7580    /// ```
7581    pub fn set_or_clear_end_position<T>(mut self, v: std::option::Option<T>) -> Self
7582    where
7583        T: std::convert::Into<crate::model::text_locator::Position>,
7584    {
7585        self.end_position = v.map(|x| x.into());
7586        self
7587    }
7588
7589    /// Sets the value of [nested_locator][crate::model::TextLocator::nested_locator].
7590    ///
7591    /// # Example
7592    /// ```ignore,no_run
7593    /// # use google_cloud_monitoring_v3::model::TextLocator;
7594    /// let x = TextLocator::new().set_nested_locator(TextLocator::default()/* use setters */);
7595    /// ```
7596    pub fn set_nested_locator<T>(mut self, v: T) -> Self
7597    where
7598        T: std::convert::Into<crate::model::TextLocator>,
7599    {
7600        self.nested_locator = std::option::Option::Some(std::boxed::Box::new(v.into()));
7601        self
7602    }
7603
7604    /// Sets or clears the value of [nested_locator][crate::model::TextLocator::nested_locator].
7605    ///
7606    /// # Example
7607    /// ```ignore,no_run
7608    /// # use google_cloud_monitoring_v3::model::TextLocator;
7609    /// let x = TextLocator::new().set_or_clear_nested_locator(Some(TextLocator::default()/* use setters */));
7610    /// let x = TextLocator::new().set_or_clear_nested_locator(None::<TextLocator>);
7611    /// ```
7612    pub fn set_or_clear_nested_locator<T>(mut self, v: std::option::Option<T>) -> Self
7613    where
7614        T: std::convert::Into<crate::model::TextLocator>,
7615    {
7616        self.nested_locator = v.map(|x| std::boxed::Box::new(x.into()));
7617        self
7618    }
7619
7620    /// Sets the value of [nesting_reason][crate::model::TextLocator::nesting_reason].
7621    ///
7622    /// # Example
7623    /// ```ignore,no_run
7624    /// # use google_cloud_monitoring_v3::model::TextLocator;
7625    /// let x = TextLocator::new().set_nesting_reason("example");
7626    /// ```
7627    pub fn set_nesting_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7628        self.nesting_reason = v.into();
7629        self
7630    }
7631}
7632
7633impl wkt::message::Message for TextLocator {
7634    fn typename() -> &'static str {
7635        "type.googleapis.com/google.monitoring.v3.TextLocator"
7636    }
7637}
7638
7639/// Defines additional types related to [TextLocator].
7640pub mod text_locator {
7641    #[allow(unused_imports)]
7642    use super::*;
7643
7644    /// The position of a byte within the text.
7645    #[derive(Clone, Default, PartialEq)]
7646    #[non_exhaustive]
7647    pub struct Position {
7648        /// The line, starting with 1, where the byte is positioned.
7649        pub line: i32,
7650
7651        /// The column within the line, starting with 1, where the byte is
7652        /// positioned. This is a byte index even though the text is UTF-8.
7653        pub column: i32,
7654
7655        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7656    }
7657
7658    impl Position {
7659        pub fn new() -> Self {
7660            std::default::Default::default()
7661        }
7662
7663        /// Sets the value of [line][crate::model::text_locator::Position::line].
7664        ///
7665        /// # Example
7666        /// ```ignore,no_run
7667        /// # use google_cloud_monitoring_v3::model::text_locator::Position;
7668        /// let x = Position::new().set_line(42);
7669        /// ```
7670        pub fn set_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7671            self.line = v.into();
7672            self
7673        }
7674
7675        /// Sets the value of [column][crate::model::text_locator::Position::column].
7676        ///
7677        /// # Example
7678        /// ```ignore,no_run
7679        /// # use google_cloud_monitoring_v3::model::text_locator::Position;
7680        /// let x = Position::new().set_column(42);
7681        /// ```
7682        pub fn set_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7683            self.column = v.into();
7684            self
7685        }
7686    }
7687
7688    impl wkt::message::Message for Position {
7689        fn typename() -> &'static str {
7690            "type.googleapis.com/google.monitoring.v3.TextLocator.Position"
7691        }
7692    }
7693}
7694
7695/// The `ListMonitoredResourceDescriptors` request.
7696#[derive(Clone, Default, PartialEq)]
7697#[non_exhaustive]
7698pub struct ListMonitoredResourceDescriptorsRequest {
7699    /// Required. The
7700    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
7701    /// to execute the request. The format is:
7702    ///
7703    /// ```norust
7704    /// projects/[PROJECT_ID_OR_NUMBER]
7705    /// ```
7706    pub name: std::string::String,
7707
7708    /// An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
7709    /// describing the descriptors to be returned.  The filter can reference the
7710    /// descriptor's type and labels. For example, the following filter returns
7711    /// only Google Compute Engine descriptors that have an `id` label:
7712    ///
7713    /// ```norust
7714    /// resource.type = starts_with("gce_") AND resource.label:id
7715    /// ```
7716    pub filter: std::string::String,
7717
7718    /// A positive number that is the maximum number of results to return.
7719    pub page_size: i32,
7720
7721    /// If this field is not empty then it must contain the `nextPageToken` value
7722    /// returned by a previous call to this method.  Using this field causes the
7723    /// method to return additional results from the previous method call.
7724    pub page_token: std::string::String,
7725
7726    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7727}
7728
7729impl ListMonitoredResourceDescriptorsRequest {
7730    pub fn new() -> Self {
7731        std::default::Default::default()
7732    }
7733
7734    /// Sets the value of [name][crate::model::ListMonitoredResourceDescriptorsRequest::name].
7735    ///
7736    /// # Example
7737    /// ```ignore,no_run
7738    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsRequest;
7739    /// let x = ListMonitoredResourceDescriptorsRequest::new().set_name("example");
7740    /// ```
7741    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7742        self.name = v.into();
7743        self
7744    }
7745
7746    /// Sets the value of [filter][crate::model::ListMonitoredResourceDescriptorsRequest::filter].
7747    ///
7748    /// # Example
7749    /// ```ignore,no_run
7750    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsRequest;
7751    /// let x = ListMonitoredResourceDescriptorsRequest::new().set_filter("example");
7752    /// ```
7753    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7754        self.filter = v.into();
7755        self
7756    }
7757
7758    /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
7759    ///
7760    /// # Example
7761    /// ```ignore,no_run
7762    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsRequest;
7763    /// let x = ListMonitoredResourceDescriptorsRequest::new().set_page_size(42);
7764    /// ```
7765    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7766        self.page_size = v.into();
7767        self
7768    }
7769
7770    /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
7771    ///
7772    /// # Example
7773    /// ```ignore,no_run
7774    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsRequest;
7775    /// let x = ListMonitoredResourceDescriptorsRequest::new().set_page_token("example");
7776    /// ```
7777    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7778        self.page_token = v.into();
7779        self
7780    }
7781}
7782
7783impl wkt::message::Message for ListMonitoredResourceDescriptorsRequest {
7784    fn typename() -> &'static str {
7785        "type.googleapis.com/google.monitoring.v3.ListMonitoredResourceDescriptorsRequest"
7786    }
7787}
7788
7789/// The `ListMonitoredResourceDescriptors` response.
7790#[derive(Clone, Default, PartialEq)]
7791#[non_exhaustive]
7792pub struct ListMonitoredResourceDescriptorsResponse {
7793    /// The monitored resource descriptors that are available to this project
7794    /// and that match `filter`, if present.
7795    pub resource_descriptors: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
7796
7797    /// If there are more results than have been returned, then this field is set
7798    /// to a non-empty value.  To see the additional results,
7799    /// use that value as `page_token` in the next call to this method.
7800    pub next_page_token: std::string::String,
7801
7802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7803}
7804
7805impl ListMonitoredResourceDescriptorsResponse {
7806    pub fn new() -> Self {
7807        std::default::Default::default()
7808    }
7809
7810    /// Sets the value of [resource_descriptors][crate::model::ListMonitoredResourceDescriptorsResponse::resource_descriptors].
7811    ///
7812    /// # Example
7813    /// ```ignore,no_run
7814    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsResponse;
7815    /// use api::model::MonitoredResourceDescriptor;
7816    /// let x = ListMonitoredResourceDescriptorsResponse::new()
7817    ///     .set_resource_descriptors([
7818    ///         MonitoredResourceDescriptor::default()/* use setters */,
7819    ///         MonitoredResourceDescriptor::default()/* use (different) setters */,
7820    ///     ]);
7821    /// ```
7822    pub fn set_resource_descriptors<T, V>(mut self, v: T) -> Self
7823    where
7824        T: std::iter::IntoIterator<Item = V>,
7825        V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
7826    {
7827        use std::iter::Iterator;
7828        self.resource_descriptors = v.into_iter().map(|i| i.into()).collect();
7829        self
7830    }
7831
7832    /// Sets the value of [next_page_token][crate::model::ListMonitoredResourceDescriptorsResponse::next_page_token].
7833    ///
7834    /// # Example
7835    /// ```ignore,no_run
7836    /// # use google_cloud_monitoring_v3::model::ListMonitoredResourceDescriptorsResponse;
7837    /// let x = ListMonitoredResourceDescriptorsResponse::new().set_next_page_token("example");
7838    /// ```
7839    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7840        self.next_page_token = v.into();
7841        self
7842    }
7843}
7844
7845impl wkt::message::Message for ListMonitoredResourceDescriptorsResponse {
7846    fn typename() -> &'static str {
7847        "type.googleapis.com/google.monitoring.v3.ListMonitoredResourceDescriptorsResponse"
7848    }
7849}
7850
7851#[doc(hidden)]
7852impl gax::paginator::internal::PageableResponse for ListMonitoredResourceDescriptorsResponse {
7853    type PageItem = api::model::MonitoredResourceDescriptor;
7854
7855    fn items(self) -> std::vec::Vec<Self::PageItem> {
7856        self.resource_descriptors
7857    }
7858
7859    fn next_page_token(&self) -> std::string::String {
7860        use std::clone::Clone;
7861        self.next_page_token.clone()
7862    }
7863}
7864
7865/// The `GetMonitoredResourceDescriptor` request.
7866#[derive(Clone, Default, PartialEq)]
7867#[non_exhaustive]
7868pub struct GetMonitoredResourceDescriptorRequest {
7869    /// Required. The monitored resource descriptor to get.  The format is:
7870    ///
7871    /// ```norust
7872    /// projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
7873    /// ```
7874    ///
7875    /// The `[RESOURCE_TYPE]` is a predefined type, such as
7876    /// `cloudsql_database`.
7877    pub name: std::string::String,
7878
7879    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7880}
7881
7882impl GetMonitoredResourceDescriptorRequest {
7883    pub fn new() -> Self {
7884        std::default::Default::default()
7885    }
7886
7887    /// Sets the value of [name][crate::model::GetMonitoredResourceDescriptorRequest::name].
7888    ///
7889    /// # Example
7890    /// ```ignore,no_run
7891    /// # use google_cloud_monitoring_v3::model::GetMonitoredResourceDescriptorRequest;
7892    /// let x = GetMonitoredResourceDescriptorRequest::new().set_name("example");
7893    /// ```
7894    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7895        self.name = v.into();
7896        self
7897    }
7898}
7899
7900impl wkt::message::Message for GetMonitoredResourceDescriptorRequest {
7901    fn typename() -> &'static str {
7902        "type.googleapis.com/google.monitoring.v3.GetMonitoredResourceDescriptorRequest"
7903    }
7904}
7905
7906/// The `ListMetricDescriptors` request.
7907#[derive(Clone, Default, PartialEq)]
7908#[non_exhaustive]
7909pub struct ListMetricDescriptorsRequest {
7910    /// Required. The
7911    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
7912    /// to execute the request. The format is:
7913    ///
7914    /// ```norust
7915    /// projects/[PROJECT_ID_OR_NUMBER]
7916    /// ```
7917    pub name: std::string::String,
7918
7919    /// Optional. If this field is empty, all custom and
7920    /// system-defined metric descriptors are returned.
7921    /// Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
7922    /// specifies which metric descriptors are to be
7923    /// returned. For example, the following filter matches all
7924    /// [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
7925    ///
7926    /// ```norust
7927    /// metric.type = starts_with("custom.googleapis.com/")
7928    /// ```
7929    pub filter: std::string::String,
7930
7931    /// Optional. A positive number that is the maximum number of results to
7932    /// return. The default and maximum value is 10,000. If a page_size <= 0 or >
7933    /// 10,000 is submitted, will instead return a maximum of 10,000 results.
7934    pub page_size: i32,
7935
7936    /// Optional. If this field is not empty then it must contain the
7937    /// `nextPageToken` value returned by a previous call to this method.  Using
7938    /// this field causes the method to return additional results from the previous
7939    /// method call.
7940    pub page_token: std::string::String,
7941
7942    /// Optional. If true, only metrics and monitored resource types that have
7943    /// recent data (within roughly 25 hours) will be included in the response.
7944    ///
7945    /// - If a metric descriptor enumerates monitored resource types, only the
7946    ///   monitored resource types for which the metric type has recent data will
7947    ///   be included in the returned metric descriptor, and if none of them have
7948    ///   recent data, the metric descriptor will not be returned.
7949    /// - If a metric descriptor does not enumerate the compatible monitored
7950    ///   resource types, it will be returned only if the metric type has recent
7951    ///   data for some monitored resource type. The returned descriptor will not
7952    ///   enumerate any monitored resource types.
7953    pub active_only: bool,
7954
7955    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7956}
7957
7958impl ListMetricDescriptorsRequest {
7959    pub fn new() -> Self {
7960        std::default::Default::default()
7961    }
7962
7963    /// Sets the value of [name][crate::model::ListMetricDescriptorsRequest::name].
7964    ///
7965    /// # Example
7966    /// ```ignore,no_run
7967    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsRequest;
7968    /// let x = ListMetricDescriptorsRequest::new().set_name("example");
7969    /// ```
7970    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7971        self.name = v.into();
7972        self
7973    }
7974
7975    /// Sets the value of [filter][crate::model::ListMetricDescriptorsRequest::filter].
7976    ///
7977    /// # Example
7978    /// ```ignore,no_run
7979    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsRequest;
7980    /// let x = ListMetricDescriptorsRequest::new().set_filter("example");
7981    /// ```
7982    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7983        self.filter = v.into();
7984        self
7985    }
7986
7987    /// Sets the value of [page_size][crate::model::ListMetricDescriptorsRequest::page_size].
7988    ///
7989    /// # Example
7990    /// ```ignore,no_run
7991    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsRequest;
7992    /// let x = ListMetricDescriptorsRequest::new().set_page_size(42);
7993    /// ```
7994    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7995        self.page_size = v.into();
7996        self
7997    }
7998
7999    /// Sets the value of [page_token][crate::model::ListMetricDescriptorsRequest::page_token].
8000    ///
8001    /// # Example
8002    /// ```ignore,no_run
8003    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsRequest;
8004    /// let x = ListMetricDescriptorsRequest::new().set_page_token("example");
8005    /// ```
8006    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8007        self.page_token = v.into();
8008        self
8009    }
8010
8011    /// Sets the value of [active_only][crate::model::ListMetricDescriptorsRequest::active_only].
8012    ///
8013    /// # Example
8014    /// ```ignore,no_run
8015    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsRequest;
8016    /// let x = ListMetricDescriptorsRequest::new().set_active_only(true);
8017    /// ```
8018    pub fn set_active_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8019        self.active_only = v.into();
8020        self
8021    }
8022}
8023
8024impl wkt::message::Message for ListMetricDescriptorsRequest {
8025    fn typename() -> &'static str {
8026        "type.googleapis.com/google.monitoring.v3.ListMetricDescriptorsRequest"
8027    }
8028}
8029
8030/// The `ListMetricDescriptors` response.
8031#[derive(Clone, Default, PartialEq)]
8032#[non_exhaustive]
8033pub struct ListMetricDescriptorsResponse {
8034    /// The metric descriptors that are available to the project
8035    /// and that match the value of `filter`, if present.
8036    pub metric_descriptors: std::vec::Vec<api::model::MetricDescriptor>,
8037
8038    /// If there are more results than have been returned, then this field is set
8039    /// to a non-empty value.  To see the additional results,
8040    /// use that value as `page_token` in the next call to this method.
8041    pub next_page_token: std::string::String,
8042
8043    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8044}
8045
8046impl ListMetricDescriptorsResponse {
8047    pub fn new() -> Self {
8048        std::default::Default::default()
8049    }
8050
8051    /// Sets the value of [metric_descriptors][crate::model::ListMetricDescriptorsResponse::metric_descriptors].
8052    ///
8053    /// # Example
8054    /// ```ignore,no_run
8055    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsResponse;
8056    /// use api::model::MetricDescriptor;
8057    /// let x = ListMetricDescriptorsResponse::new()
8058    ///     .set_metric_descriptors([
8059    ///         MetricDescriptor::default()/* use setters */,
8060    ///         MetricDescriptor::default()/* use (different) setters */,
8061    ///     ]);
8062    /// ```
8063    pub fn set_metric_descriptors<T, V>(mut self, v: T) -> Self
8064    where
8065        T: std::iter::IntoIterator<Item = V>,
8066        V: std::convert::Into<api::model::MetricDescriptor>,
8067    {
8068        use std::iter::Iterator;
8069        self.metric_descriptors = v.into_iter().map(|i| i.into()).collect();
8070        self
8071    }
8072
8073    /// Sets the value of [next_page_token][crate::model::ListMetricDescriptorsResponse::next_page_token].
8074    ///
8075    /// # Example
8076    /// ```ignore,no_run
8077    /// # use google_cloud_monitoring_v3::model::ListMetricDescriptorsResponse;
8078    /// let x = ListMetricDescriptorsResponse::new().set_next_page_token("example");
8079    /// ```
8080    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8081        self.next_page_token = v.into();
8082        self
8083    }
8084}
8085
8086impl wkt::message::Message for ListMetricDescriptorsResponse {
8087    fn typename() -> &'static str {
8088        "type.googleapis.com/google.monitoring.v3.ListMetricDescriptorsResponse"
8089    }
8090}
8091
8092#[doc(hidden)]
8093impl gax::paginator::internal::PageableResponse for ListMetricDescriptorsResponse {
8094    type PageItem = api::model::MetricDescriptor;
8095
8096    fn items(self) -> std::vec::Vec<Self::PageItem> {
8097        self.metric_descriptors
8098    }
8099
8100    fn next_page_token(&self) -> std::string::String {
8101        use std::clone::Clone;
8102        self.next_page_token.clone()
8103    }
8104}
8105
8106/// The `GetMetricDescriptor` request.
8107#[derive(Clone, Default, PartialEq)]
8108#[non_exhaustive]
8109pub struct GetMetricDescriptorRequest {
8110    /// Required. The metric descriptor on which to execute the request. The format
8111    /// is:
8112    ///
8113    /// ```norust
8114    /// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
8115    /// ```
8116    ///
8117    /// An example value of `[METRIC_ID]` is
8118    /// `"compute.googleapis.com/instance/disk/read_bytes_count"`.
8119    pub name: std::string::String,
8120
8121    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8122}
8123
8124impl GetMetricDescriptorRequest {
8125    pub fn new() -> Self {
8126        std::default::Default::default()
8127    }
8128
8129    /// Sets the value of [name][crate::model::GetMetricDescriptorRequest::name].
8130    ///
8131    /// # Example
8132    /// ```ignore,no_run
8133    /// # use google_cloud_monitoring_v3::model::GetMetricDescriptorRequest;
8134    /// let x = GetMetricDescriptorRequest::new().set_name("example");
8135    /// ```
8136    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8137        self.name = v.into();
8138        self
8139    }
8140}
8141
8142impl wkt::message::Message for GetMetricDescriptorRequest {
8143    fn typename() -> &'static str {
8144        "type.googleapis.com/google.monitoring.v3.GetMetricDescriptorRequest"
8145    }
8146}
8147
8148/// The `CreateMetricDescriptor` request.
8149#[derive(Clone, Default, PartialEq)]
8150#[non_exhaustive]
8151pub struct CreateMetricDescriptorRequest {
8152    /// Required. The
8153    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
8154    /// to execute the request. The format is:
8155    /// 4
8156    /// projects/[PROJECT_ID_OR_NUMBER]
8157    pub name: std::string::String,
8158
8159    /// Required. The new [custom
8160    /// metric](https://cloud.google.com/monitoring/custom-metrics) descriptor.
8161    pub metric_descriptor: std::option::Option<api::model::MetricDescriptor>,
8162
8163    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8164}
8165
8166impl CreateMetricDescriptorRequest {
8167    pub fn new() -> Self {
8168        std::default::Default::default()
8169    }
8170
8171    /// Sets the value of [name][crate::model::CreateMetricDescriptorRequest::name].
8172    ///
8173    /// # Example
8174    /// ```ignore,no_run
8175    /// # use google_cloud_monitoring_v3::model::CreateMetricDescriptorRequest;
8176    /// let x = CreateMetricDescriptorRequest::new().set_name("example");
8177    /// ```
8178    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8179        self.name = v.into();
8180        self
8181    }
8182
8183    /// Sets the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
8184    ///
8185    /// # Example
8186    /// ```ignore,no_run
8187    /// # use google_cloud_monitoring_v3::model::CreateMetricDescriptorRequest;
8188    /// use api::model::MetricDescriptor;
8189    /// let x = CreateMetricDescriptorRequest::new().set_metric_descriptor(MetricDescriptor::default()/* use setters */);
8190    /// ```
8191    pub fn set_metric_descriptor<T>(mut self, v: T) -> Self
8192    where
8193        T: std::convert::Into<api::model::MetricDescriptor>,
8194    {
8195        self.metric_descriptor = std::option::Option::Some(v.into());
8196        self
8197    }
8198
8199    /// Sets or clears the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
8200    ///
8201    /// # Example
8202    /// ```ignore,no_run
8203    /// # use google_cloud_monitoring_v3::model::CreateMetricDescriptorRequest;
8204    /// use api::model::MetricDescriptor;
8205    /// let x = CreateMetricDescriptorRequest::new().set_or_clear_metric_descriptor(Some(MetricDescriptor::default()/* use setters */));
8206    /// let x = CreateMetricDescriptorRequest::new().set_or_clear_metric_descriptor(None::<MetricDescriptor>);
8207    /// ```
8208    pub fn set_or_clear_metric_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
8209    where
8210        T: std::convert::Into<api::model::MetricDescriptor>,
8211    {
8212        self.metric_descriptor = v.map(|x| x.into());
8213        self
8214    }
8215}
8216
8217impl wkt::message::Message for CreateMetricDescriptorRequest {
8218    fn typename() -> &'static str {
8219        "type.googleapis.com/google.monitoring.v3.CreateMetricDescriptorRequest"
8220    }
8221}
8222
8223/// The `DeleteMetricDescriptor` request.
8224#[derive(Clone, Default, PartialEq)]
8225#[non_exhaustive]
8226pub struct DeleteMetricDescriptorRequest {
8227    /// Required. The metric descriptor on which to execute the request. The format
8228    /// is:
8229    ///
8230    /// ```norust
8231    /// projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
8232    /// ```
8233    ///
8234    /// An example of `[METRIC_ID]` is:
8235    /// `"custom.googleapis.com/my_test_metric"`.
8236    pub name: std::string::String,
8237
8238    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8239}
8240
8241impl DeleteMetricDescriptorRequest {
8242    pub fn new() -> Self {
8243        std::default::Default::default()
8244    }
8245
8246    /// Sets the value of [name][crate::model::DeleteMetricDescriptorRequest::name].
8247    ///
8248    /// # Example
8249    /// ```ignore,no_run
8250    /// # use google_cloud_monitoring_v3::model::DeleteMetricDescriptorRequest;
8251    /// let x = DeleteMetricDescriptorRequest::new().set_name("example");
8252    /// ```
8253    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8254        self.name = v.into();
8255        self
8256    }
8257}
8258
8259impl wkt::message::Message for DeleteMetricDescriptorRequest {
8260    fn typename() -> &'static str {
8261        "type.googleapis.com/google.monitoring.v3.DeleteMetricDescriptorRequest"
8262    }
8263}
8264
8265/// The `ListTimeSeries` request.
8266#[derive(Clone, Default, PartialEq)]
8267#[non_exhaustive]
8268pub struct ListTimeSeriesRequest {
8269    /// Required. The
8270    /// [project](https://cloud.google.com/monitoring/api/v3#project_name),
8271    /// organization or folder on which to execute the request. The format is:
8272    ///
8273    /// ```norust
8274    /// projects/[PROJECT_ID_OR_NUMBER]
8275    /// organizations/[ORGANIZATION_ID]
8276    /// folders/[FOLDER_ID]
8277    /// ```
8278    pub name: std::string::String,
8279
8280    /// Required. A [monitoring
8281    /// filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies
8282    /// which time series should be returned.  The filter must specify a single
8283    /// metric type, and can additionally specify metric labels and other
8284    /// information. For example:
8285    ///
8286    /// ```norust
8287    /// metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
8288    ///     metric.labels.instance_name = "my-instance-name"
8289    /// ```
8290    pub filter: std::string::String,
8291
8292    /// Required. The time interval for which results should be returned. Only time
8293    /// series that contain data points in the specified interval are included in
8294    /// the response.
8295    pub interval: std::option::Option<crate::model::TimeInterval>,
8296
8297    /// Specifies the alignment of data points in individual time series as
8298    /// well as how to combine the retrieved time series across specified labels.
8299    ///
8300    /// By default (if no `aggregation` is explicitly specified), the raw time
8301    /// series data is returned.
8302    pub aggregation: std::option::Option<crate::model::Aggregation>,
8303
8304    /// Apply a second aggregation after `aggregation` is applied. May only be
8305    /// specified if `aggregation` is specified.
8306    pub secondary_aggregation: std::option::Option<crate::model::Aggregation>,
8307
8308    /// Unsupported: must be left blank. The points in each time series are
8309    /// currently returned in reverse time order (most recent to oldest).
8310    pub order_by: std::string::String,
8311
8312    /// Required. Specifies which information is returned about the time series.
8313    pub view: crate::model::list_time_series_request::TimeSeriesView,
8314
8315    /// A positive number that is the maximum number of results to return. If
8316    /// `page_size` is empty or more than 100,000 results, the effective
8317    /// `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
8318    /// maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
8319    /// the maximum number of `TimeSeries` returned.
8320    pub page_size: i32,
8321
8322    /// If this field is not empty then it must contain the `nextPageToken` value
8323    /// returned by a previous call to this method.  Using this field causes the
8324    /// method to return additional results from the previous method call.
8325    pub page_token: std::string::String,
8326
8327    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8328}
8329
8330impl ListTimeSeriesRequest {
8331    pub fn new() -> Self {
8332        std::default::Default::default()
8333    }
8334
8335    /// Sets the value of [name][crate::model::ListTimeSeriesRequest::name].
8336    ///
8337    /// # Example
8338    /// ```ignore,no_run
8339    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8340    /// let x = ListTimeSeriesRequest::new().set_name("example");
8341    /// ```
8342    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8343        self.name = v.into();
8344        self
8345    }
8346
8347    /// Sets the value of [filter][crate::model::ListTimeSeriesRequest::filter].
8348    ///
8349    /// # Example
8350    /// ```ignore,no_run
8351    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8352    /// let x = ListTimeSeriesRequest::new().set_filter("example");
8353    /// ```
8354    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8355        self.filter = v.into();
8356        self
8357    }
8358
8359    /// Sets the value of [interval][crate::model::ListTimeSeriesRequest::interval].
8360    ///
8361    /// # Example
8362    /// ```ignore,no_run
8363    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8364    /// use google_cloud_monitoring_v3::model::TimeInterval;
8365    /// let x = ListTimeSeriesRequest::new().set_interval(TimeInterval::default()/* use setters */);
8366    /// ```
8367    pub fn set_interval<T>(mut self, v: T) -> Self
8368    where
8369        T: std::convert::Into<crate::model::TimeInterval>,
8370    {
8371        self.interval = std::option::Option::Some(v.into());
8372        self
8373    }
8374
8375    /// Sets or clears the value of [interval][crate::model::ListTimeSeriesRequest::interval].
8376    ///
8377    /// # Example
8378    /// ```ignore,no_run
8379    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8380    /// use google_cloud_monitoring_v3::model::TimeInterval;
8381    /// let x = ListTimeSeriesRequest::new().set_or_clear_interval(Some(TimeInterval::default()/* use setters */));
8382    /// let x = ListTimeSeriesRequest::new().set_or_clear_interval(None::<TimeInterval>);
8383    /// ```
8384    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
8385    where
8386        T: std::convert::Into<crate::model::TimeInterval>,
8387    {
8388        self.interval = v.map(|x| x.into());
8389        self
8390    }
8391
8392    /// Sets the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
8393    ///
8394    /// # Example
8395    /// ```ignore,no_run
8396    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8397    /// use google_cloud_monitoring_v3::model::Aggregation;
8398    /// let x = ListTimeSeriesRequest::new().set_aggregation(Aggregation::default()/* use setters */);
8399    /// ```
8400    pub fn set_aggregation<T>(mut self, v: T) -> Self
8401    where
8402        T: std::convert::Into<crate::model::Aggregation>,
8403    {
8404        self.aggregation = std::option::Option::Some(v.into());
8405        self
8406    }
8407
8408    /// Sets or clears the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
8409    ///
8410    /// # Example
8411    /// ```ignore,no_run
8412    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8413    /// use google_cloud_monitoring_v3::model::Aggregation;
8414    /// let x = ListTimeSeriesRequest::new().set_or_clear_aggregation(Some(Aggregation::default()/* use setters */));
8415    /// let x = ListTimeSeriesRequest::new().set_or_clear_aggregation(None::<Aggregation>);
8416    /// ```
8417    pub fn set_or_clear_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
8418    where
8419        T: std::convert::Into<crate::model::Aggregation>,
8420    {
8421        self.aggregation = v.map(|x| x.into());
8422        self
8423    }
8424
8425    /// Sets the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
8426    ///
8427    /// # Example
8428    /// ```ignore,no_run
8429    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8430    /// use google_cloud_monitoring_v3::model::Aggregation;
8431    /// let x = ListTimeSeriesRequest::new().set_secondary_aggregation(Aggregation::default()/* use setters */);
8432    /// ```
8433    pub fn set_secondary_aggregation<T>(mut self, v: T) -> Self
8434    where
8435        T: std::convert::Into<crate::model::Aggregation>,
8436    {
8437        self.secondary_aggregation = std::option::Option::Some(v.into());
8438        self
8439    }
8440
8441    /// Sets or clears the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
8442    ///
8443    /// # Example
8444    /// ```ignore,no_run
8445    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8446    /// use google_cloud_monitoring_v3::model::Aggregation;
8447    /// let x = ListTimeSeriesRequest::new().set_or_clear_secondary_aggregation(Some(Aggregation::default()/* use setters */));
8448    /// let x = ListTimeSeriesRequest::new().set_or_clear_secondary_aggregation(None::<Aggregation>);
8449    /// ```
8450    pub fn set_or_clear_secondary_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
8451    where
8452        T: std::convert::Into<crate::model::Aggregation>,
8453    {
8454        self.secondary_aggregation = v.map(|x| x.into());
8455        self
8456    }
8457
8458    /// Sets the value of [order_by][crate::model::ListTimeSeriesRequest::order_by].
8459    ///
8460    /// # Example
8461    /// ```ignore,no_run
8462    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8463    /// let x = ListTimeSeriesRequest::new().set_order_by("example");
8464    /// ```
8465    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8466        self.order_by = v.into();
8467        self
8468    }
8469
8470    /// Sets the value of [view][crate::model::ListTimeSeriesRequest::view].
8471    ///
8472    /// # Example
8473    /// ```ignore,no_run
8474    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8475    /// use google_cloud_monitoring_v3::model::list_time_series_request::TimeSeriesView;
8476    /// let x0 = ListTimeSeriesRequest::new().set_view(TimeSeriesView::Headers);
8477    /// ```
8478    pub fn set_view<
8479        T: std::convert::Into<crate::model::list_time_series_request::TimeSeriesView>,
8480    >(
8481        mut self,
8482        v: T,
8483    ) -> Self {
8484        self.view = v.into();
8485        self
8486    }
8487
8488    /// Sets the value of [page_size][crate::model::ListTimeSeriesRequest::page_size].
8489    ///
8490    /// # Example
8491    /// ```ignore,no_run
8492    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8493    /// let x = ListTimeSeriesRequest::new().set_page_size(42);
8494    /// ```
8495    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8496        self.page_size = v.into();
8497        self
8498    }
8499
8500    /// Sets the value of [page_token][crate::model::ListTimeSeriesRequest::page_token].
8501    ///
8502    /// # Example
8503    /// ```ignore,no_run
8504    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesRequest;
8505    /// let x = ListTimeSeriesRequest::new().set_page_token("example");
8506    /// ```
8507    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8508        self.page_token = v.into();
8509        self
8510    }
8511}
8512
8513impl wkt::message::Message for ListTimeSeriesRequest {
8514    fn typename() -> &'static str {
8515        "type.googleapis.com/google.monitoring.v3.ListTimeSeriesRequest"
8516    }
8517}
8518
8519/// Defines additional types related to [ListTimeSeriesRequest].
8520pub mod list_time_series_request {
8521    #[allow(unused_imports)]
8522    use super::*;
8523
8524    /// Controls which fields are returned by `ListTimeSeries*`.
8525    ///
8526    /// # Working with unknown values
8527    ///
8528    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8529    /// additional enum variants at any time. Adding new variants is not considered
8530    /// a breaking change. Applications should write their code in anticipation of:
8531    ///
8532    /// - New values appearing in future releases of the client library, **and**
8533    /// - New values received dynamically, without application changes.
8534    ///
8535    /// Please consult the [Working with enums] section in the user guide for some
8536    /// guidelines.
8537    ///
8538    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8539    #[derive(Clone, Debug, PartialEq)]
8540    #[non_exhaustive]
8541    pub enum TimeSeriesView {
8542        /// Returns the identity of the metric(s), the time series,
8543        /// and the time series data.
8544        Full,
8545        /// Returns the identity of the metric and the time series resource,
8546        /// but not the time series data.
8547        Headers,
8548        /// If set, the enum was initialized with an unknown value.
8549        ///
8550        /// Applications can examine the value using [TimeSeriesView::value] or
8551        /// [TimeSeriesView::name].
8552        UnknownValue(time_series_view::UnknownValue),
8553    }
8554
8555    #[doc(hidden)]
8556    pub mod time_series_view {
8557        #[allow(unused_imports)]
8558        use super::*;
8559        #[derive(Clone, Debug, PartialEq)]
8560        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8561    }
8562
8563    impl TimeSeriesView {
8564        /// Gets the enum value.
8565        ///
8566        /// Returns `None` if the enum contains an unknown value deserialized from
8567        /// the string representation of enums.
8568        pub fn value(&self) -> std::option::Option<i32> {
8569            match self {
8570                Self::Full => std::option::Option::Some(0),
8571                Self::Headers => std::option::Option::Some(1),
8572                Self::UnknownValue(u) => u.0.value(),
8573            }
8574        }
8575
8576        /// Gets the enum value as a string.
8577        ///
8578        /// Returns `None` if the enum contains an unknown value deserialized from
8579        /// the integer representation of enums.
8580        pub fn name(&self) -> std::option::Option<&str> {
8581            match self {
8582                Self::Full => std::option::Option::Some("FULL"),
8583                Self::Headers => std::option::Option::Some("HEADERS"),
8584                Self::UnknownValue(u) => u.0.name(),
8585            }
8586        }
8587    }
8588
8589    impl std::default::Default for TimeSeriesView {
8590        fn default() -> Self {
8591            use std::convert::From;
8592            Self::from(0)
8593        }
8594    }
8595
8596    impl std::fmt::Display for TimeSeriesView {
8597        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8598            wkt::internal::display_enum(f, self.name(), self.value())
8599        }
8600    }
8601
8602    impl std::convert::From<i32> for TimeSeriesView {
8603        fn from(value: i32) -> Self {
8604            match value {
8605                0 => Self::Full,
8606                1 => Self::Headers,
8607                _ => Self::UnknownValue(time_series_view::UnknownValue(
8608                    wkt::internal::UnknownEnumValue::Integer(value),
8609                )),
8610            }
8611        }
8612    }
8613
8614    impl std::convert::From<&str> for TimeSeriesView {
8615        fn from(value: &str) -> Self {
8616            use std::string::ToString;
8617            match value {
8618                "FULL" => Self::Full,
8619                "HEADERS" => Self::Headers,
8620                _ => Self::UnknownValue(time_series_view::UnknownValue(
8621                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8622                )),
8623            }
8624        }
8625    }
8626
8627    impl serde::ser::Serialize for TimeSeriesView {
8628        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8629        where
8630            S: serde::Serializer,
8631        {
8632            match self {
8633                Self::Full => serializer.serialize_i32(0),
8634                Self::Headers => serializer.serialize_i32(1),
8635                Self::UnknownValue(u) => u.0.serialize(serializer),
8636            }
8637        }
8638    }
8639
8640    impl<'de> serde::de::Deserialize<'de> for TimeSeriesView {
8641        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8642        where
8643            D: serde::Deserializer<'de>,
8644        {
8645            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TimeSeriesView>::new(
8646                ".google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView",
8647            ))
8648        }
8649    }
8650}
8651
8652/// The `ListTimeSeries` response.
8653#[derive(Clone, Default, PartialEq)]
8654#[non_exhaustive]
8655pub struct ListTimeSeriesResponse {
8656    /// One or more time series that match the filter included in the request.
8657    pub time_series: std::vec::Vec<crate::model::TimeSeries>,
8658
8659    /// If there are more results than have been returned, then this field is set
8660    /// to a non-empty value.  To see the additional results,
8661    /// use that value as `page_token` in the next call to this method.
8662    pub next_page_token: std::string::String,
8663
8664    /// Query execution errors that may have caused the time series data returned
8665    /// to be incomplete.
8666    pub execution_errors: std::vec::Vec<rpc::model::Status>,
8667
8668    /// The unit in which all `time_series` point values are reported. `unit`
8669    /// follows the UCUM format for units as seen in
8670    /// <https://unitsofmeasure.org/ucum.html>.
8671    /// If different `time_series` have different units (for example, because they
8672    /// come from different metric types, or a unit is absent), then `unit` will be
8673    /// "{not_a_unit}".
8674    pub unit: std::string::String,
8675
8676    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8677}
8678
8679impl ListTimeSeriesResponse {
8680    pub fn new() -> Self {
8681        std::default::Default::default()
8682    }
8683
8684    /// Sets the value of [time_series][crate::model::ListTimeSeriesResponse::time_series].
8685    ///
8686    /// # Example
8687    /// ```ignore,no_run
8688    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesResponse;
8689    /// use google_cloud_monitoring_v3::model::TimeSeries;
8690    /// let x = ListTimeSeriesResponse::new()
8691    ///     .set_time_series([
8692    ///         TimeSeries::default()/* use setters */,
8693    ///         TimeSeries::default()/* use (different) setters */,
8694    ///     ]);
8695    /// ```
8696    pub fn set_time_series<T, V>(mut self, v: T) -> Self
8697    where
8698        T: std::iter::IntoIterator<Item = V>,
8699        V: std::convert::Into<crate::model::TimeSeries>,
8700    {
8701        use std::iter::Iterator;
8702        self.time_series = v.into_iter().map(|i| i.into()).collect();
8703        self
8704    }
8705
8706    /// Sets the value of [next_page_token][crate::model::ListTimeSeriesResponse::next_page_token].
8707    ///
8708    /// # Example
8709    /// ```ignore,no_run
8710    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesResponse;
8711    /// let x = ListTimeSeriesResponse::new().set_next_page_token("example");
8712    /// ```
8713    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8714        self.next_page_token = v.into();
8715        self
8716    }
8717
8718    /// Sets the value of [execution_errors][crate::model::ListTimeSeriesResponse::execution_errors].
8719    ///
8720    /// # Example
8721    /// ```ignore,no_run
8722    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesResponse;
8723    /// use rpc::model::Status;
8724    /// let x = ListTimeSeriesResponse::new()
8725    ///     .set_execution_errors([
8726    ///         Status::default()/* use setters */,
8727    ///         Status::default()/* use (different) setters */,
8728    ///     ]);
8729    /// ```
8730    pub fn set_execution_errors<T, V>(mut self, v: T) -> Self
8731    where
8732        T: std::iter::IntoIterator<Item = V>,
8733        V: std::convert::Into<rpc::model::Status>,
8734    {
8735        use std::iter::Iterator;
8736        self.execution_errors = v.into_iter().map(|i| i.into()).collect();
8737        self
8738    }
8739
8740    /// Sets the value of [unit][crate::model::ListTimeSeriesResponse::unit].
8741    ///
8742    /// # Example
8743    /// ```ignore,no_run
8744    /// # use google_cloud_monitoring_v3::model::ListTimeSeriesResponse;
8745    /// let x = ListTimeSeriesResponse::new().set_unit("example");
8746    /// ```
8747    pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8748        self.unit = v.into();
8749        self
8750    }
8751}
8752
8753impl wkt::message::Message for ListTimeSeriesResponse {
8754    fn typename() -> &'static str {
8755        "type.googleapis.com/google.monitoring.v3.ListTimeSeriesResponse"
8756    }
8757}
8758
8759#[doc(hidden)]
8760impl gax::paginator::internal::PageableResponse for ListTimeSeriesResponse {
8761    type PageItem = crate::model::TimeSeries;
8762
8763    fn items(self) -> std::vec::Vec<Self::PageItem> {
8764        self.time_series
8765    }
8766
8767    fn next_page_token(&self) -> std::string::String {
8768        use std::clone::Clone;
8769        self.next_page_token.clone()
8770    }
8771}
8772
8773/// The `CreateTimeSeries` request.
8774#[derive(Clone, Default, PartialEq)]
8775#[non_exhaustive]
8776pub struct CreateTimeSeriesRequest {
8777    /// Required. The
8778    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
8779    /// to execute the request. The format is:
8780    ///
8781    /// ```norust
8782    /// projects/[PROJECT_ID_OR_NUMBER]
8783    /// ```
8784    pub name: std::string::String,
8785
8786    /// Required. The new data to be added to a list of time series.
8787    /// Adds at most one data point to each of several time series.  The new data
8788    /// point must be more recent than any other point in its time series.  Each
8789    /// `TimeSeries` value must fully specify a unique time series by supplying
8790    /// all label values for the metric and the monitored resource.
8791    ///
8792    /// The maximum number of `TimeSeries` objects per `Create` request is 200.
8793    pub time_series: std::vec::Vec<crate::model::TimeSeries>,
8794
8795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8796}
8797
8798impl CreateTimeSeriesRequest {
8799    pub fn new() -> Self {
8800        std::default::Default::default()
8801    }
8802
8803    /// Sets the value of [name][crate::model::CreateTimeSeriesRequest::name].
8804    ///
8805    /// # Example
8806    /// ```ignore,no_run
8807    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesRequest;
8808    /// let x = CreateTimeSeriesRequest::new().set_name("example");
8809    /// ```
8810    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8811        self.name = v.into();
8812        self
8813    }
8814
8815    /// Sets the value of [time_series][crate::model::CreateTimeSeriesRequest::time_series].
8816    ///
8817    /// # Example
8818    /// ```ignore,no_run
8819    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesRequest;
8820    /// use google_cloud_monitoring_v3::model::TimeSeries;
8821    /// let x = CreateTimeSeriesRequest::new()
8822    ///     .set_time_series([
8823    ///         TimeSeries::default()/* use setters */,
8824    ///         TimeSeries::default()/* use (different) setters */,
8825    ///     ]);
8826    /// ```
8827    pub fn set_time_series<T, V>(mut self, v: T) -> Self
8828    where
8829        T: std::iter::IntoIterator<Item = V>,
8830        V: std::convert::Into<crate::model::TimeSeries>,
8831    {
8832        use std::iter::Iterator;
8833        self.time_series = v.into_iter().map(|i| i.into()).collect();
8834        self
8835    }
8836}
8837
8838impl wkt::message::Message for CreateTimeSeriesRequest {
8839    fn typename() -> &'static str {
8840        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesRequest"
8841    }
8842}
8843
8844/// DEPRECATED. Used to hold per-time-series error status.
8845#[derive(Clone, Default, PartialEq)]
8846#[non_exhaustive]
8847pub struct CreateTimeSeriesError {
8848    /// DEPRECATED. Time series ID that resulted in the `status` error.
8849    #[deprecated]
8850    pub time_series: std::option::Option<crate::model::TimeSeries>,
8851
8852    /// DEPRECATED. The status of the requested write operation for `time_series`.
8853    #[deprecated]
8854    pub status: std::option::Option<rpc::model::Status>,
8855
8856    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8857}
8858
8859impl CreateTimeSeriesError {
8860    pub fn new() -> Self {
8861        std::default::Default::default()
8862    }
8863
8864    /// Sets the value of [time_series][crate::model::CreateTimeSeriesError::time_series].
8865    ///
8866    /// # Example
8867    /// ```ignore,no_run
8868    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesError;
8869    /// use google_cloud_monitoring_v3::model::TimeSeries;
8870    /// let x = CreateTimeSeriesError::new().set_time_series(TimeSeries::default()/* use setters */);
8871    /// ```
8872    #[deprecated]
8873    pub fn set_time_series<T>(mut self, v: T) -> Self
8874    where
8875        T: std::convert::Into<crate::model::TimeSeries>,
8876    {
8877        self.time_series = std::option::Option::Some(v.into());
8878        self
8879    }
8880
8881    /// Sets or clears the value of [time_series][crate::model::CreateTimeSeriesError::time_series].
8882    ///
8883    /// # Example
8884    /// ```ignore,no_run
8885    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesError;
8886    /// use google_cloud_monitoring_v3::model::TimeSeries;
8887    /// let x = CreateTimeSeriesError::new().set_or_clear_time_series(Some(TimeSeries::default()/* use setters */));
8888    /// let x = CreateTimeSeriesError::new().set_or_clear_time_series(None::<TimeSeries>);
8889    /// ```
8890    #[deprecated]
8891    pub fn set_or_clear_time_series<T>(mut self, v: std::option::Option<T>) -> Self
8892    where
8893        T: std::convert::Into<crate::model::TimeSeries>,
8894    {
8895        self.time_series = v.map(|x| x.into());
8896        self
8897    }
8898
8899    /// Sets the value of [status][crate::model::CreateTimeSeriesError::status].
8900    ///
8901    /// # Example
8902    /// ```ignore,no_run
8903    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesError;
8904    /// use rpc::model::Status;
8905    /// let x = CreateTimeSeriesError::new().set_status(Status::default()/* use setters */);
8906    /// ```
8907    #[deprecated]
8908    pub fn set_status<T>(mut self, v: T) -> Self
8909    where
8910        T: std::convert::Into<rpc::model::Status>,
8911    {
8912        self.status = std::option::Option::Some(v.into());
8913        self
8914    }
8915
8916    /// Sets or clears the value of [status][crate::model::CreateTimeSeriesError::status].
8917    ///
8918    /// # Example
8919    /// ```ignore,no_run
8920    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesError;
8921    /// use rpc::model::Status;
8922    /// let x = CreateTimeSeriesError::new().set_or_clear_status(Some(Status::default()/* use setters */));
8923    /// let x = CreateTimeSeriesError::new().set_or_clear_status(None::<Status>);
8924    /// ```
8925    #[deprecated]
8926    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
8927    where
8928        T: std::convert::Into<rpc::model::Status>,
8929    {
8930        self.status = v.map(|x| x.into());
8931        self
8932    }
8933}
8934
8935impl wkt::message::Message for CreateTimeSeriesError {
8936    fn typename() -> &'static str {
8937        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesError"
8938    }
8939}
8940
8941/// Summary of the result of a failed request to write data to a time series.
8942#[derive(Clone, Default, PartialEq)]
8943#[non_exhaustive]
8944pub struct CreateTimeSeriesSummary {
8945    /// The number of points in the request.
8946    pub total_point_count: i32,
8947
8948    /// The number of points that were successfully written.
8949    pub success_point_count: i32,
8950
8951    /// The number of points that failed to be written. Order is not guaranteed.
8952    pub errors: std::vec::Vec<crate::model::create_time_series_summary::Error>,
8953
8954    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8955}
8956
8957impl CreateTimeSeriesSummary {
8958    pub fn new() -> Self {
8959        std::default::Default::default()
8960    }
8961
8962    /// Sets the value of [total_point_count][crate::model::CreateTimeSeriesSummary::total_point_count].
8963    ///
8964    /// # Example
8965    /// ```ignore,no_run
8966    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesSummary;
8967    /// let x = CreateTimeSeriesSummary::new().set_total_point_count(42);
8968    /// ```
8969    pub fn set_total_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8970        self.total_point_count = v.into();
8971        self
8972    }
8973
8974    /// Sets the value of [success_point_count][crate::model::CreateTimeSeriesSummary::success_point_count].
8975    ///
8976    /// # Example
8977    /// ```ignore,no_run
8978    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesSummary;
8979    /// let x = CreateTimeSeriesSummary::new().set_success_point_count(42);
8980    /// ```
8981    pub fn set_success_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8982        self.success_point_count = v.into();
8983        self
8984    }
8985
8986    /// Sets the value of [errors][crate::model::CreateTimeSeriesSummary::errors].
8987    ///
8988    /// # Example
8989    /// ```ignore,no_run
8990    /// # use google_cloud_monitoring_v3::model::CreateTimeSeriesSummary;
8991    /// use google_cloud_monitoring_v3::model::create_time_series_summary::Error;
8992    /// let x = CreateTimeSeriesSummary::new()
8993    ///     .set_errors([
8994    ///         Error::default()/* use setters */,
8995    ///         Error::default()/* use (different) setters */,
8996    ///     ]);
8997    /// ```
8998    pub fn set_errors<T, V>(mut self, v: T) -> Self
8999    where
9000        T: std::iter::IntoIterator<Item = V>,
9001        V: std::convert::Into<crate::model::create_time_series_summary::Error>,
9002    {
9003        use std::iter::Iterator;
9004        self.errors = v.into_iter().map(|i| i.into()).collect();
9005        self
9006    }
9007}
9008
9009impl wkt::message::Message for CreateTimeSeriesSummary {
9010    fn typename() -> &'static str {
9011        "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesSummary"
9012    }
9013}
9014
9015/// Defines additional types related to [CreateTimeSeriesSummary].
9016pub mod create_time_series_summary {
9017    #[allow(unused_imports)]
9018    use super::*;
9019
9020    /// Detailed information about an error category.
9021    #[derive(Clone, Default, PartialEq)]
9022    #[non_exhaustive]
9023    pub struct Error {
9024        /// The status of the requested write operation.
9025        pub status: std::option::Option<rpc::model::Status>,
9026
9027        /// The number of points that couldn't be written because of `status`.
9028        pub point_count: i32,
9029
9030        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9031    }
9032
9033    impl Error {
9034        pub fn new() -> Self {
9035            std::default::Default::default()
9036        }
9037
9038        /// Sets the value of [status][crate::model::create_time_series_summary::Error::status].
9039        ///
9040        /// # Example
9041        /// ```ignore,no_run
9042        /// # use google_cloud_monitoring_v3::model::create_time_series_summary::Error;
9043        /// use rpc::model::Status;
9044        /// let x = Error::new().set_status(Status::default()/* use setters */);
9045        /// ```
9046        pub fn set_status<T>(mut self, v: T) -> Self
9047        where
9048            T: std::convert::Into<rpc::model::Status>,
9049        {
9050            self.status = std::option::Option::Some(v.into());
9051            self
9052        }
9053
9054        /// Sets or clears the value of [status][crate::model::create_time_series_summary::Error::status].
9055        ///
9056        /// # Example
9057        /// ```ignore,no_run
9058        /// # use google_cloud_monitoring_v3::model::create_time_series_summary::Error;
9059        /// use rpc::model::Status;
9060        /// let x = Error::new().set_or_clear_status(Some(Status::default()/* use setters */));
9061        /// let x = Error::new().set_or_clear_status(None::<Status>);
9062        /// ```
9063        pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
9064        where
9065            T: std::convert::Into<rpc::model::Status>,
9066        {
9067            self.status = v.map(|x| x.into());
9068            self
9069        }
9070
9071        /// Sets the value of [point_count][crate::model::create_time_series_summary::Error::point_count].
9072        ///
9073        /// # Example
9074        /// ```ignore,no_run
9075        /// # use google_cloud_monitoring_v3::model::create_time_series_summary::Error;
9076        /// let x = Error::new().set_point_count(42);
9077        /// ```
9078        pub fn set_point_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9079            self.point_count = v.into();
9080            self
9081        }
9082    }
9083
9084    impl wkt::message::Message for Error {
9085        fn typename() -> &'static str {
9086            "type.googleapis.com/google.monitoring.v3.CreateTimeSeriesSummary.Error"
9087        }
9088    }
9089}
9090
9091/// The `QueryTimeSeries` request. For information about the status of
9092/// Monitoring Query Language (MQL), see the [MQL deprecation
9093/// notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
9094#[derive(Clone, Default, PartialEq)]
9095#[non_exhaustive]
9096#[deprecated]
9097pub struct QueryTimeSeriesRequest {
9098    /// Required. The
9099    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
9100    /// to execute the request. The format is:
9101    ///
9102    /// ```norust
9103    /// projects/[PROJECT_ID_OR_NUMBER]
9104    /// ```
9105    pub name: std::string::String,
9106
9107    /// Required. The query in the [Monitoring Query
9108    /// Language](https://cloud.google.com/monitoring/mql/reference) format.
9109    /// The default time zone is in UTC.
9110    pub query: std::string::String,
9111
9112    /// A positive number that is the maximum number of time_series_data to return.
9113    pub page_size: i32,
9114
9115    /// If this field is not empty then it must contain the `nextPageToken` value
9116    /// returned by a previous call to this method.  Using this field causes the
9117    /// method to return additional results from the previous method call.
9118    pub page_token: std::string::String,
9119
9120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9121}
9122
9123impl QueryTimeSeriesRequest {
9124    pub fn new() -> Self {
9125        std::default::Default::default()
9126    }
9127
9128    /// Sets the value of [name][crate::model::QueryTimeSeriesRequest::name].
9129    ///
9130    /// # Example
9131    /// ```ignore,no_run
9132    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesRequest;
9133    /// let x = QueryTimeSeriesRequest::new().set_name("example");
9134    /// ```
9135    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9136        self.name = v.into();
9137        self
9138    }
9139
9140    /// Sets the value of [query][crate::model::QueryTimeSeriesRequest::query].
9141    ///
9142    /// # Example
9143    /// ```ignore,no_run
9144    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesRequest;
9145    /// let x = QueryTimeSeriesRequest::new().set_query("example");
9146    /// ```
9147    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9148        self.query = v.into();
9149        self
9150    }
9151
9152    /// Sets the value of [page_size][crate::model::QueryTimeSeriesRequest::page_size].
9153    ///
9154    /// # Example
9155    /// ```ignore,no_run
9156    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesRequest;
9157    /// let x = QueryTimeSeriesRequest::new().set_page_size(42);
9158    /// ```
9159    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9160        self.page_size = v.into();
9161        self
9162    }
9163
9164    /// Sets the value of [page_token][crate::model::QueryTimeSeriesRequest::page_token].
9165    ///
9166    /// # Example
9167    /// ```ignore,no_run
9168    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesRequest;
9169    /// let x = QueryTimeSeriesRequest::new().set_page_token("example");
9170    /// ```
9171    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9172        self.page_token = v.into();
9173        self
9174    }
9175}
9176
9177impl wkt::message::Message for QueryTimeSeriesRequest {
9178    fn typename() -> &'static str {
9179        "type.googleapis.com/google.monitoring.v3.QueryTimeSeriesRequest"
9180    }
9181}
9182
9183/// The `QueryTimeSeries` response. For information about the status of
9184/// Monitoring Query Language (MQL), see the [MQL deprecation
9185/// notice](https://cloud.google.com/stackdriver/docs/deprecations/mql).
9186#[derive(Clone, Default, PartialEq)]
9187#[non_exhaustive]
9188#[deprecated]
9189pub struct QueryTimeSeriesResponse {
9190    /// The descriptor for the time series data.
9191    pub time_series_descriptor: std::option::Option<crate::model::TimeSeriesDescriptor>,
9192
9193    /// The time series data.
9194    pub time_series_data: std::vec::Vec<crate::model::TimeSeriesData>,
9195
9196    /// If there are more results than have been returned, then this field is set
9197    /// to a non-empty value.  To see the additional results, use that value as
9198    /// `page_token` in the next call to this method.
9199    pub next_page_token: std::string::String,
9200
9201    /// Query execution errors that may have caused the time series data returned
9202    /// to be incomplete. The available data will be available in the
9203    /// response.
9204    pub partial_errors: std::vec::Vec<rpc::model::Status>,
9205
9206    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9207}
9208
9209impl QueryTimeSeriesResponse {
9210    pub fn new() -> Self {
9211        std::default::Default::default()
9212    }
9213
9214    /// Sets the value of [time_series_descriptor][crate::model::QueryTimeSeriesResponse::time_series_descriptor].
9215    ///
9216    /// # Example
9217    /// ```ignore,no_run
9218    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesResponse;
9219    /// use google_cloud_monitoring_v3::model::TimeSeriesDescriptor;
9220    /// let x = QueryTimeSeriesResponse::new().set_time_series_descriptor(TimeSeriesDescriptor::default()/* use setters */);
9221    /// ```
9222    pub fn set_time_series_descriptor<T>(mut self, v: T) -> Self
9223    where
9224        T: std::convert::Into<crate::model::TimeSeriesDescriptor>,
9225    {
9226        self.time_series_descriptor = std::option::Option::Some(v.into());
9227        self
9228    }
9229
9230    /// Sets or clears the value of [time_series_descriptor][crate::model::QueryTimeSeriesResponse::time_series_descriptor].
9231    ///
9232    /// # Example
9233    /// ```ignore,no_run
9234    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesResponse;
9235    /// use google_cloud_monitoring_v3::model::TimeSeriesDescriptor;
9236    /// let x = QueryTimeSeriesResponse::new().set_or_clear_time_series_descriptor(Some(TimeSeriesDescriptor::default()/* use setters */));
9237    /// let x = QueryTimeSeriesResponse::new().set_or_clear_time_series_descriptor(None::<TimeSeriesDescriptor>);
9238    /// ```
9239    pub fn set_or_clear_time_series_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
9240    where
9241        T: std::convert::Into<crate::model::TimeSeriesDescriptor>,
9242    {
9243        self.time_series_descriptor = v.map(|x| x.into());
9244        self
9245    }
9246
9247    /// Sets the value of [time_series_data][crate::model::QueryTimeSeriesResponse::time_series_data].
9248    ///
9249    /// # Example
9250    /// ```ignore,no_run
9251    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesResponse;
9252    /// use google_cloud_monitoring_v3::model::TimeSeriesData;
9253    /// let x = QueryTimeSeriesResponse::new()
9254    ///     .set_time_series_data([
9255    ///         TimeSeriesData::default()/* use setters */,
9256    ///         TimeSeriesData::default()/* use (different) setters */,
9257    ///     ]);
9258    /// ```
9259    pub fn set_time_series_data<T, V>(mut self, v: T) -> Self
9260    where
9261        T: std::iter::IntoIterator<Item = V>,
9262        V: std::convert::Into<crate::model::TimeSeriesData>,
9263    {
9264        use std::iter::Iterator;
9265        self.time_series_data = v.into_iter().map(|i| i.into()).collect();
9266        self
9267    }
9268
9269    /// Sets the value of [next_page_token][crate::model::QueryTimeSeriesResponse::next_page_token].
9270    ///
9271    /// # Example
9272    /// ```ignore,no_run
9273    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesResponse;
9274    /// let x = QueryTimeSeriesResponse::new().set_next_page_token("example");
9275    /// ```
9276    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9277        self.next_page_token = v.into();
9278        self
9279    }
9280
9281    /// Sets the value of [partial_errors][crate::model::QueryTimeSeriesResponse::partial_errors].
9282    ///
9283    /// # Example
9284    /// ```ignore,no_run
9285    /// # use google_cloud_monitoring_v3::model::QueryTimeSeriesResponse;
9286    /// use rpc::model::Status;
9287    /// let x = QueryTimeSeriesResponse::new()
9288    ///     .set_partial_errors([
9289    ///         Status::default()/* use setters */,
9290    ///         Status::default()/* use (different) setters */,
9291    ///     ]);
9292    /// ```
9293    pub fn set_partial_errors<T, V>(mut self, v: T) -> Self
9294    where
9295        T: std::iter::IntoIterator<Item = V>,
9296        V: std::convert::Into<rpc::model::Status>,
9297    {
9298        use std::iter::Iterator;
9299        self.partial_errors = v.into_iter().map(|i| i.into()).collect();
9300        self
9301    }
9302}
9303
9304impl wkt::message::Message for QueryTimeSeriesResponse {
9305    fn typename() -> &'static str {
9306        "type.googleapis.com/google.monitoring.v3.QueryTimeSeriesResponse"
9307    }
9308}
9309
9310#[doc(hidden)]
9311impl gax::paginator::internal::PageableResponse for QueryTimeSeriesResponse {
9312    type PageItem = crate::model::TimeSeriesData;
9313
9314    fn items(self) -> std::vec::Vec<Self::PageItem> {
9315        self.time_series_data
9316    }
9317
9318    fn next_page_token(&self) -> std::string::String {
9319        use std::clone::Clone;
9320        self.next_page_token.clone()
9321    }
9322}
9323
9324/// This is an error detail intended to be used with INVALID_ARGUMENT errors.
9325#[derive(Clone, Default, PartialEq)]
9326#[non_exhaustive]
9327pub struct QueryErrorList {
9328    /// Errors in parsing the time series query language text. The number of errors
9329    /// in the response may be limited.
9330    pub errors: std::vec::Vec<crate::model::QueryError>,
9331
9332    /// A summary of all the errors.
9333    pub error_summary: std::string::String,
9334
9335    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9336}
9337
9338impl QueryErrorList {
9339    pub fn new() -> Self {
9340        std::default::Default::default()
9341    }
9342
9343    /// Sets the value of [errors][crate::model::QueryErrorList::errors].
9344    ///
9345    /// # Example
9346    /// ```ignore,no_run
9347    /// # use google_cloud_monitoring_v3::model::QueryErrorList;
9348    /// use google_cloud_monitoring_v3::model::QueryError;
9349    /// let x = QueryErrorList::new()
9350    ///     .set_errors([
9351    ///         QueryError::default()/* use setters */,
9352    ///         QueryError::default()/* use (different) setters */,
9353    ///     ]);
9354    /// ```
9355    pub fn set_errors<T, V>(mut self, v: T) -> Self
9356    where
9357        T: std::iter::IntoIterator<Item = V>,
9358        V: std::convert::Into<crate::model::QueryError>,
9359    {
9360        use std::iter::Iterator;
9361        self.errors = v.into_iter().map(|i| i.into()).collect();
9362        self
9363    }
9364
9365    /// Sets the value of [error_summary][crate::model::QueryErrorList::error_summary].
9366    ///
9367    /// # Example
9368    /// ```ignore,no_run
9369    /// # use google_cloud_monitoring_v3::model::QueryErrorList;
9370    /// let x = QueryErrorList::new().set_error_summary("example");
9371    /// ```
9372    pub fn set_error_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9373        self.error_summary = v.into();
9374        self
9375    }
9376}
9377
9378impl wkt::message::Message for QueryErrorList {
9379    fn typename() -> &'static str {
9380        "type.googleapis.com/google.monitoring.v3.QueryErrorList"
9381    }
9382}
9383
9384/// Describes a change made to a configuration.
9385#[derive(Clone, Default, PartialEq)]
9386#[non_exhaustive]
9387pub struct MutationRecord {
9388    /// When the change occurred.
9389    pub mutate_time: std::option::Option<wkt::Timestamp>,
9390
9391    /// The email address of the user making the change.
9392    pub mutated_by: std::string::String,
9393
9394    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9395}
9396
9397impl MutationRecord {
9398    pub fn new() -> Self {
9399        std::default::Default::default()
9400    }
9401
9402    /// Sets the value of [mutate_time][crate::model::MutationRecord::mutate_time].
9403    ///
9404    /// # Example
9405    /// ```ignore,no_run
9406    /// # use google_cloud_monitoring_v3::model::MutationRecord;
9407    /// use wkt::Timestamp;
9408    /// let x = MutationRecord::new().set_mutate_time(Timestamp::default()/* use setters */);
9409    /// ```
9410    pub fn set_mutate_time<T>(mut self, v: T) -> Self
9411    where
9412        T: std::convert::Into<wkt::Timestamp>,
9413    {
9414        self.mutate_time = std::option::Option::Some(v.into());
9415        self
9416    }
9417
9418    /// Sets or clears the value of [mutate_time][crate::model::MutationRecord::mutate_time].
9419    ///
9420    /// # Example
9421    /// ```ignore,no_run
9422    /// # use google_cloud_monitoring_v3::model::MutationRecord;
9423    /// use wkt::Timestamp;
9424    /// let x = MutationRecord::new().set_or_clear_mutate_time(Some(Timestamp::default()/* use setters */));
9425    /// let x = MutationRecord::new().set_or_clear_mutate_time(None::<Timestamp>);
9426    /// ```
9427    pub fn set_or_clear_mutate_time<T>(mut self, v: std::option::Option<T>) -> Self
9428    where
9429        T: std::convert::Into<wkt::Timestamp>,
9430    {
9431        self.mutate_time = v.map(|x| x.into());
9432        self
9433    }
9434
9435    /// Sets the value of [mutated_by][crate::model::MutationRecord::mutated_by].
9436    ///
9437    /// # Example
9438    /// ```ignore,no_run
9439    /// # use google_cloud_monitoring_v3::model::MutationRecord;
9440    /// let x = MutationRecord::new().set_mutated_by("example");
9441    /// ```
9442    pub fn set_mutated_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9443        self.mutated_by = v.into();
9444        self
9445    }
9446}
9447
9448impl wkt::message::Message for MutationRecord {
9449    fn typename() -> &'static str {
9450        "type.googleapis.com/google.monitoring.v3.MutationRecord"
9451    }
9452}
9453
9454/// A description of a notification channel. The descriptor includes
9455/// the properties of the channel and the set of labels or fields that
9456/// must be specified to configure channels of a given type.
9457#[derive(Clone, Default, PartialEq)]
9458#[non_exhaustive]
9459pub struct NotificationChannelDescriptor {
9460    /// The full REST resource name for this descriptor. The format is:
9461    ///
9462    /// ```norust
9463    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE]
9464    /// ```
9465    ///
9466    /// In the above, `[TYPE]` is the value of the `type` field.
9467    pub name: std::string::String,
9468
9469    /// The type of notification channel, such as "email" and "sms". To view the
9470    /// full list of channels, see
9471    /// [Channel
9472    /// descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd).
9473    /// Notification channel types are globally unique.
9474    pub r#type: std::string::String,
9475
9476    /// A human-readable name for the notification channel type.  This
9477    /// form of the name is suitable for a user interface.
9478    pub display_name: std::string::String,
9479
9480    /// A human-readable description of the notification channel
9481    /// type. The description may include a description of the properties
9482    /// of the channel and pointers to external documentation.
9483    pub description: std::string::String,
9484
9485    /// The set of labels that must be defined to identify a particular
9486    /// channel of the corresponding type. Each label includes a
9487    /// description for how that field should be populated.
9488    pub labels: std::vec::Vec<api::model::LabelDescriptor>,
9489
9490    /// The tiers that support this notification channel; the project service tier
9491    /// must be one of the supported_tiers.
9492    #[deprecated]
9493    pub supported_tiers: std::vec::Vec<crate::model::ServiceTier>,
9494
9495    /// The product launch stage for channels of this type.
9496    pub launch_stage: api::model::LaunchStage,
9497
9498    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9499}
9500
9501impl NotificationChannelDescriptor {
9502    pub fn new() -> Self {
9503        std::default::Default::default()
9504    }
9505
9506    /// Sets the value of [name][crate::model::NotificationChannelDescriptor::name].
9507    ///
9508    /// # Example
9509    /// ```ignore,no_run
9510    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9511    /// let x = NotificationChannelDescriptor::new().set_name("example");
9512    /// ```
9513    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9514        self.name = v.into();
9515        self
9516    }
9517
9518    /// Sets the value of [r#type][crate::model::NotificationChannelDescriptor::type].
9519    ///
9520    /// # Example
9521    /// ```ignore,no_run
9522    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9523    /// let x = NotificationChannelDescriptor::new().set_type("example");
9524    /// ```
9525    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9526        self.r#type = v.into();
9527        self
9528    }
9529
9530    /// Sets the value of [display_name][crate::model::NotificationChannelDescriptor::display_name].
9531    ///
9532    /// # Example
9533    /// ```ignore,no_run
9534    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9535    /// let x = NotificationChannelDescriptor::new().set_display_name("example");
9536    /// ```
9537    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9538        self.display_name = v.into();
9539        self
9540    }
9541
9542    /// Sets the value of [description][crate::model::NotificationChannelDescriptor::description].
9543    ///
9544    /// # Example
9545    /// ```ignore,no_run
9546    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9547    /// let x = NotificationChannelDescriptor::new().set_description("example");
9548    /// ```
9549    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9550        self.description = v.into();
9551        self
9552    }
9553
9554    /// Sets the value of [labels][crate::model::NotificationChannelDescriptor::labels].
9555    ///
9556    /// # Example
9557    /// ```ignore,no_run
9558    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9559    /// use api::model::LabelDescriptor;
9560    /// let x = NotificationChannelDescriptor::new()
9561    ///     .set_labels([
9562    ///         LabelDescriptor::default()/* use setters */,
9563    ///         LabelDescriptor::default()/* use (different) setters */,
9564    ///     ]);
9565    /// ```
9566    pub fn set_labels<T, V>(mut self, v: T) -> Self
9567    where
9568        T: std::iter::IntoIterator<Item = V>,
9569        V: std::convert::Into<api::model::LabelDescriptor>,
9570    {
9571        use std::iter::Iterator;
9572        self.labels = v.into_iter().map(|i| i.into()).collect();
9573        self
9574    }
9575
9576    /// Sets the value of [supported_tiers][crate::model::NotificationChannelDescriptor::supported_tiers].
9577    ///
9578    /// # Example
9579    /// ```ignore,no_run
9580    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9581    /// use google_cloud_monitoring_v3::model::ServiceTier;
9582    /// let x = NotificationChannelDescriptor::new().set_supported_tiers([
9583    ///     ServiceTier::Basic,
9584    ///     ServiceTier::Premium,
9585    /// ]);
9586    /// ```
9587    #[deprecated]
9588    pub fn set_supported_tiers<T, V>(mut self, v: T) -> Self
9589    where
9590        T: std::iter::IntoIterator<Item = V>,
9591        V: std::convert::Into<crate::model::ServiceTier>,
9592    {
9593        use std::iter::Iterator;
9594        self.supported_tiers = v.into_iter().map(|i| i.into()).collect();
9595        self
9596    }
9597
9598    /// Sets the value of [launch_stage][crate::model::NotificationChannelDescriptor::launch_stage].
9599    ///
9600    /// # Example
9601    /// ```ignore,no_run
9602    /// # use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
9603    /// use api::model::LaunchStage;
9604    /// let x0 = NotificationChannelDescriptor::new().set_launch_stage(LaunchStage::Unimplemented);
9605    /// let x1 = NotificationChannelDescriptor::new().set_launch_stage(LaunchStage::Prelaunch);
9606    /// let x2 = NotificationChannelDescriptor::new().set_launch_stage(LaunchStage::EarlyAccess);
9607    /// ```
9608    pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
9609        mut self,
9610        v: T,
9611    ) -> Self {
9612        self.launch_stage = v.into();
9613        self
9614    }
9615}
9616
9617impl wkt::message::Message for NotificationChannelDescriptor {
9618    fn typename() -> &'static str {
9619        "type.googleapis.com/google.monitoring.v3.NotificationChannelDescriptor"
9620    }
9621}
9622
9623/// A `NotificationChannel` is a medium through which an alert is
9624/// delivered when a policy violation is detected. Examples of channels
9625/// include email, SMS, and third-party messaging applications. Fields
9626/// containing sensitive information like authentication tokens or
9627/// contact info are only partially populated on retrieval.
9628#[derive(Clone, Default, PartialEq)]
9629#[non_exhaustive]
9630pub struct NotificationChannel {
9631    /// The type of the notification channel. This field matches the
9632    /// value of the
9633    /// [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type]
9634    /// field.
9635    ///
9636    /// [google.monitoring.v3.NotificationChannelDescriptor.type]: crate::model::NotificationChannelDescriptor::type
9637    pub r#type: std::string::String,
9638
9639    /// Identifier. The full REST resource name for this channel. The format is:
9640    ///
9641    /// ```norust
9642    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
9643    /// ```
9644    ///
9645    /// The `[CHANNEL_ID]` is automatically assigned by the server on creation.
9646    pub name: std::string::String,
9647
9648    /// An optional human-readable name for this notification channel. It is
9649    /// recommended that you specify a non-empty and unique name in order to
9650    /// make it easier to identify the channels in your project, though this is
9651    /// not enforced. The display name is limited to 512 Unicode characters.
9652    pub display_name: std::string::String,
9653
9654    /// An optional human-readable description of this notification channel. This
9655    /// description may provide additional details, beyond the display
9656    /// name, for the channel. This may not exceed 1024 Unicode characters.
9657    pub description: std::string::String,
9658
9659    /// Configuration fields that define the channel and its behavior. The
9660    /// permissible and required labels are specified in the
9661    /// [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels]
9662    /// of the `NotificationChannelDescriptor` corresponding to the `type` field.
9663    ///
9664    /// [google.monitoring.v3.NotificationChannelDescriptor.labels]: crate::model::NotificationChannelDescriptor::labels
9665    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9666
9667    /// User-supplied key/value data that does not need to conform to
9668    /// the corresponding `NotificationChannelDescriptor`'s schema, unlike
9669    /// the `labels` field. This field is intended to be used for organizing
9670    /// and identifying the `NotificationChannel` objects.
9671    ///
9672    /// The field can contain up to 64 entries. Each key and value is limited to
9673    /// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
9674    /// values can contain only lowercase letters, numerals, underscores, and
9675    /// dashes. Keys must begin with a letter.
9676    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
9677
9678    /// Indicates whether this channel has been verified or not. On a
9679    /// [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
9680    /// or
9681    /// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
9682    /// operation, this field is expected to be populated.
9683    ///
9684    /// If the value is `UNVERIFIED`, then it indicates that the channel is
9685    /// non-functioning (it both requires verification and lacks verification);
9686    /// otherwise, it is assumed that the channel works.
9687    ///
9688    /// If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that
9689    /// the channel is of a type that does not require verification or that
9690    /// this specific channel has been exempted from verification because it was
9691    /// created prior to verification being required for channels of this type.
9692    ///
9693    /// This field cannot be modified using a standard
9694    /// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
9695    /// operation. To change the value of this field, you must call
9696    /// [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel].
9697    ///
9698    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannel]: crate::client::NotificationChannelService::get_notification_channel
9699    /// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]: crate::client::NotificationChannelService::list_notification_channels
9700    /// [google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]: crate::client::NotificationChannelService::update_notification_channel
9701    /// [google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]: crate::client::NotificationChannelService::verify_notification_channel
9702    pub verification_status: crate::model::notification_channel::VerificationStatus,
9703
9704    /// Whether notifications are forwarded to the described channel. This makes
9705    /// it possible to disable delivery of notifications to a particular channel
9706    /// without removing the channel from all alerting policies that reference
9707    /// the channel. This is a more convenient approach when the change is
9708    /// temporary and you want to receive notifications from the same set
9709    /// of alerting policies on the channel at some point in the future.
9710    pub enabled: std::option::Option<wkt::BoolValue>,
9711
9712    /// Record of the creation of this channel.
9713    pub creation_record: std::option::Option<crate::model::MutationRecord>,
9714
9715    /// Records of the modification of this channel.
9716    pub mutation_records: std::vec::Vec<crate::model::MutationRecord>,
9717
9718    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9719}
9720
9721impl NotificationChannel {
9722    pub fn new() -> Self {
9723        std::default::Default::default()
9724    }
9725
9726    /// Sets the value of [r#type][crate::model::NotificationChannel::type].
9727    ///
9728    /// # Example
9729    /// ```ignore,no_run
9730    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9731    /// let x = NotificationChannel::new().set_type("example");
9732    /// ```
9733    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9734        self.r#type = v.into();
9735        self
9736    }
9737
9738    /// Sets the value of [name][crate::model::NotificationChannel::name].
9739    ///
9740    /// # Example
9741    /// ```ignore,no_run
9742    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9743    /// let x = NotificationChannel::new().set_name("example");
9744    /// ```
9745    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9746        self.name = v.into();
9747        self
9748    }
9749
9750    /// Sets the value of [display_name][crate::model::NotificationChannel::display_name].
9751    ///
9752    /// # Example
9753    /// ```ignore,no_run
9754    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9755    /// let x = NotificationChannel::new().set_display_name("example");
9756    /// ```
9757    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9758        self.display_name = v.into();
9759        self
9760    }
9761
9762    /// Sets the value of [description][crate::model::NotificationChannel::description].
9763    ///
9764    /// # Example
9765    /// ```ignore,no_run
9766    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9767    /// let x = NotificationChannel::new().set_description("example");
9768    /// ```
9769    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9770        self.description = v.into();
9771        self
9772    }
9773
9774    /// Sets the value of [labels][crate::model::NotificationChannel::labels].
9775    ///
9776    /// # Example
9777    /// ```ignore,no_run
9778    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9779    /// let x = NotificationChannel::new().set_labels([
9780    ///     ("key0", "abc"),
9781    ///     ("key1", "xyz"),
9782    /// ]);
9783    /// ```
9784    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9785    where
9786        T: std::iter::IntoIterator<Item = (K, V)>,
9787        K: std::convert::Into<std::string::String>,
9788        V: std::convert::Into<std::string::String>,
9789    {
9790        use std::iter::Iterator;
9791        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9792        self
9793    }
9794
9795    /// Sets the value of [user_labels][crate::model::NotificationChannel::user_labels].
9796    ///
9797    /// # Example
9798    /// ```ignore,no_run
9799    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9800    /// let x = NotificationChannel::new().set_user_labels([
9801    ///     ("key0", "abc"),
9802    ///     ("key1", "xyz"),
9803    /// ]);
9804    /// ```
9805    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9806    where
9807        T: std::iter::IntoIterator<Item = (K, V)>,
9808        K: std::convert::Into<std::string::String>,
9809        V: std::convert::Into<std::string::String>,
9810    {
9811        use std::iter::Iterator;
9812        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9813        self
9814    }
9815
9816    /// Sets the value of [verification_status][crate::model::NotificationChannel::verification_status].
9817    ///
9818    /// # Example
9819    /// ```ignore,no_run
9820    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9821    /// use google_cloud_monitoring_v3::model::notification_channel::VerificationStatus;
9822    /// let x0 = NotificationChannel::new().set_verification_status(VerificationStatus::Unverified);
9823    /// let x1 = NotificationChannel::new().set_verification_status(VerificationStatus::Verified);
9824    /// ```
9825    pub fn set_verification_status<
9826        T: std::convert::Into<crate::model::notification_channel::VerificationStatus>,
9827    >(
9828        mut self,
9829        v: T,
9830    ) -> Self {
9831        self.verification_status = v.into();
9832        self
9833    }
9834
9835    /// Sets the value of [enabled][crate::model::NotificationChannel::enabled].
9836    ///
9837    /// # Example
9838    /// ```ignore,no_run
9839    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9840    /// use wkt::BoolValue;
9841    /// let x = NotificationChannel::new().set_enabled(BoolValue::default()/* use setters */);
9842    /// ```
9843    pub fn set_enabled<T>(mut self, v: T) -> Self
9844    where
9845        T: std::convert::Into<wkt::BoolValue>,
9846    {
9847        self.enabled = std::option::Option::Some(v.into());
9848        self
9849    }
9850
9851    /// Sets or clears the value of [enabled][crate::model::NotificationChannel::enabled].
9852    ///
9853    /// # Example
9854    /// ```ignore,no_run
9855    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9856    /// use wkt::BoolValue;
9857    /// let x = NotificationChannel::new().set_or_clear_enabled(Some(BoolValue::default()/* use setters */));
9858    /// let x = NotificationChannel::new().set_or_clear_enabled(None::<BoolValue>);
9859    /// ```
9860    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
9861    where
9862        T: std::convert::Into<wkt::BoolValue>,
9863    {
9864        self.enabled = v.map(|x| x.into());
9865        self
9866    }
9867
9868    /// Sets the value of [creation_record][crate::model::NotificationChannel::creation_record].
9869    ///
9870    /// # Example
9871    /// ```ignore,no_run
9872    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9873    /// use google_cloud_monitoring_v3::model::MutationRecord;
9874    /// let x = NotificationChannel::new().set_creation_record(MutationRecord::default()/* use setters */);
9875    /// ```
9876    pub fn set_creation_record<T>(mut self, v: T) -> Self
9877    where
9878        T: std::convert::Into<crate::model::MutationRecord>,
9879    {
9880        self.creation_record = std::option::Option::Some(v.into());
9881        self
9882    }
9883
9884    /// Sets or clears the value of [creation_record][crate::model::NotificationChannel::creation_record].
9885    ///
9886    /// # Example
9887    /// ```ignore,no_run
9888    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9889    /// use google_cloud_monitoring_v3::model::MutationRecord;
9890    /// let x = NotificationChannel::new().set_or_clear_creation_record(Some(MutationRecord::default()/* use setters */));
9891    /// let x = NotificationChannel::new().set_or_clear_creation_record(None::<MutationRecord>);
9892    /// ```
9893    pub fn set_or_clear_creation_record<T>(mut self, v: std::option::Option<T>) -> Self
9894    where
9895        T: std::convert::Into<crate::model::MutationRecord>,
9896    {
9897        self.creation_record = v.map(|x| x.into());
9898        self
9899    }
9900
9901    /// Sets the value of [mutation_records][crate::model::NotificationChannel::mutation_records].
9902    ///
9903    /// # Example
9904    /// ```ignore,no_run
9905    /// # use google_cloud_monitoring_v3::model::NotificationChannel;
9906    /// use google_cloud_monitoring_v3::model::MutationRecord;
9907    /// let x = NotificationChannel::new()
9908    ///     .set_mutation_records([
9909    ///         MutationRecord::default()/* use setters */,
9910    ///         MutationRecord::default()/* use (different) setters */,
9911    ///     ]);
9912    /// ```
9913    pub fn set_mutation_records<T, V>(mut self, v: T) -> Self
9914    where
9915        T: std::iter::IntoIterator<Item = V>,
9916        V: std::convert::Into<crate::model::MutationRecord>,
9917    {
9918        use std::iter::Iterator;
9919        self.mutation_records = v.into_iter().map(|i| i.into()).collect();
9920        self
9921    }
9922}
9923
9924impl wkt::message::Message for NotificationChannel {
9925    fn typename() -> &'static str {
9926        "type.googleapis.com/google.monitoring.v3.NotificationChannel"
9927    }
9928}
9929
9930/// Defines additional types related to [NotificationChannel].
9931pub mod notification_channel {
9932    #[allow(unused_imports)]
9933    use super::*;
9934
9935    /// Indicates whether the channel has been verified or not. It is illegal
9936    /// to specify this field in a
9937    /// [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]
9938    /// or an
9939    /// [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]
9940    /// operation.
9941    ///
9942    /// [google.monitoring.v3.NotificationChannelService.CreateNotificationChannel]: crate::client::NotificationChannelService::create_notification_channel
9943    /// [google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel]: crate::client::NotificationChannelService::update_notification_channel
9944    ///
9945    /// # Working with unknown values
9946    ///
9947    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9948    /// additional enum variants at any time. Adding new variants is not considered
9949    /// a breaking change. Applications should write their code in anticipation of:
9950    ///
9951    /// - New values appearing in future releases of the client library, **and**
9952    /// - New values received dynamically, without application changes.
9953    ///
9954    /// Please consult the [Working with enums] section in the user guide for some
9955    /// guidelines.
9956    ///
9957    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9958    #[derive(Clone, Debug, PartialEq)]
9959    #[non_exhaustive]
9960    pub enum VerificationStatus {
9961        /// Sentinel value used to indicate that the state is unknown, omitted, or
9962        /// is not applicable (as in the case of channels that neither support
9963        /// nor require verification in order to function).
9964        Unspecified,
9965        /// The channel has yet to be verified and requires verification to function.
9966        /// Note that this state also applies to the case where the verification
9967        /// process has been initiated by sending a verification code but where
9968        /// the verification code has not been submitted to complete the process.
9969        Unverified,
9970        /// It has been proven that notifications can be received on this
9971        /// notification channel and that someone on the project has access
9972        /// to messages that are delivered to that channel.
9973        Verified,
9974        /// If set, the enum was initialized with an unknown value.
9975        ///
9976        /// Applications can examine the value using [VerificationStatus::value] or
9977        /// [VerificationStatus::name].
9978        UnknownValue(verification_status::UnknownValue),
9979    }
9980
9981    #[doc(hidden)]
9982    pub mod verification_status {
9983        #[allow(unused_imports)]
9984        use super::*;
9985        #[derive(Clone, Debug, PartialEq)]
9986        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9987    }
9988
9989    impl VerificationStatus {
9990        /// Gets the enum value.
9991        ///
9992        /// Returns `None` if the enum contains an unknown value deserialized from
9993        /// the string representation of enums.
9994        pub fn value(&self) -> std::option::Option<i32> {
9995            match self {
9996                Self::Unspecified => std::option::Option::Some(0),
9997                Self::Unverified => std::option::Option::Some(1),
9998                Self::Verified => std::option::Option::Some(2),
9999                Self::UnknownValue(u) => u.0.value(),
10000            }
10001        }
10002
10003        /// Gets the enum value as a string.
10004        ///
10005        /// Returns `None` if the enum contains an unknown value deserialized from
10006        /// the integer representation of enums.
10007        pub fn name(&self) -> std::option::Option<&str> {
10008            match self {
10009                Self::Unspecified => std::option::Option::Some("VERIFICATION_STATUS_UNSPECIFIED"),
10010                Self::Unverified => std::option::Option::Some("UNVERIFIED"),
10011                Self::Verified => std::option::Option::Some("VERIFIED"),
10012                Self::UnknownValue(u) => u.0.name(),
10013            }
10014        }
10015    }
10016
10017    impl std::default::Default for VerificationStatus {
10018        fn default() -> Self {
10019            use std::convert::From;
10020            Self::from(0)
10021        }
10022    }
10023
10024    impl std::fmt::Display for VerificationStatus {
10025        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10026            wkt::internal::display_enum(f, self.name(), self.value())
10027        }
10028    }
10029
10030    impl std::convert::From<i32> for VerificationStatus {
10031        fn from(value: i32) -> Self {
10032            match value {
10033                0 => Self::Unspecified,
10034                1 => Self::Unverified,
10035                2 => Self::Verified,
10036                _ => Self::UnknownValue(verification_status::UnknownValue(
10037                    wkt::internal::UnknownEnumValue::Integer(value),
10038                )),
10039            }
10040        }
10041    }
10042
10043    impl std::convert::From<&str> for VerificationStatus {
10044        fn from(value: &str) -> Self {
10045            use std::string::ToString;
10046            match value {
10047                "VERIFICATION_STATUS_UNSPECIFIED" => Self::Unspecified,
10048                "UNVERIFIED" => Self::Unverified,
10049                "VERIFIED" => Self::Verified,
10050                _ => Self::UnknownValue(verification_status::UnknownValue(
10051                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10052                )),
10053            }
10054        }
10055    }
10056
10057    impl serde::ser::Serialize for VerificationStatus {
10058        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10059        where
10060            S: serde::Serializer,
10061        {
10062            match self {
10063                Self::Unspecified => serializer.serialize_i32(0),
10064                Self::Unverified => serializer.serialize_i32(1),
10065                Self::Verified => serializer.serialize_i32(2),
10066                Self::UnknownValue(u) => u.0.serialize(serializer),
10067            }
10068        }
10069    }
10070
10071    impl<'de> serde::de::Deserialize<'de> for VerificationStatus {
10072        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10073        where
10074            D: serde::Deserializer<'de>,
10075        {
10076            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerificationStatus>::new(
10077                ".google.monitoring.v3.NotificationChannel.VerificationStatus",
10078            ))
10079        }
10080    }
10081}
10082
10083/// The `ListNotificationChannelDescriptors` request.
10084#[derive(Clone, Default, PartialEq)]
10085#[non_exhaustive]
10086pub struct ListNotificationChannelDescriptorsRequest {
10087    /// Required. The REST resource name of the parent from which to retrieve
10088    /// the notification channel descriptors. The expected syntax is:
10089    ///
10090    /// ```norust
10091    /// projects/[PROJECT_ID_OR_NUMBER]
10092    /// ```
10093    ///
10094    /// Note that this
10095    /// [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent
10096    /// container in which to look for the descriptors; to retrieve a single
10097    /// descriptor by name, use the
10098    /// [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]
10099    /// operation, instead.
10100    ///
10101    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor]: crate::client::NotificationChannelService::get_notification_channel_descriptor
10102    pub name: std::string::String,
10103
10104    /// The maximum number of results to return in a single response. If
10105    /// not set to a positive number, a reasonable value will be chosen by the
10106    /// service.
10107    pub page_size: i32,
10108
10109    /// If non-empty, `page_token` must contain a value returned as the
10110    /// `next_page_token` in a previous response to request the next set
10111    /// of results.
10112    pub page_token: std::string::String,
10113
10114    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10115}
10116
10117impl ListNotificationChannelDescriptorsRequest {
10118    pub fn new() -> Self {
10119        std::default::Default::default()
10120    }
10121
10122    /// Sets the value of [name][crate::model::ListNotificationChannelDescriptorsRequest::name].
10123    ///
10124    /// # Example
10125    /// ```ignore,no_run
10126    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelDescriptorsRequest;
10127    /// let x = ListNotificationChannelDescriptorsRequest::new().set_name("example");
10128    /// ```
10129    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10130        self.name = v.into();
10131        self
10132    }
10133
10134    /// Sets the value of [page_size][crate::model::ListNotificationChannelDescriptorsRequest::page_size].
10135    ///
10136    /// # Example
10137    /// ```ignore,no_run
10138    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelDescriptorsRequest;
10139    /// let x = ListNotificationChannelDescriptorsRequest::new().set_page_size(42);
10140    /// ```
10141    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10142        self.page_size = v.into();
10143        self
10144    }
10145
10146    /// Sets the value of [page_token][crate::model::ListNotificationChannelDescriptorsRequest::page_token].
10147    ///
10148    /// # Example
10149    /// ```ignore,no_run
10150    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelDescriptorsRequest;
10151    /// let x = ListNotificationChannelDescriptorsRequest::new().set_page_token("example");
10152    /// ```
10153    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10154        self.page_token = v.into();
10155        self
10156    }
10157}
10158
10159impl wkt::message::Message for ListNotificationChannelDescriptorsRequest {
10160    fn typename() -> &'static str {
10161        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelDescriptorsRequest"
10162    }
10163}
10164
10165/// The `ListNotificationChannelDescriptors` response.
10166#[derive(Clone, Default, PartialEq)]
10167#[non_exhaustive]
10168pub struct ListNotificationChannelDescriptorsResponse {
10169    /// The monitored resource descriptors supported for the specified
10170    /// project, optionally filtered.
10171    pub channel_descriptors: std::vec::Vec<crate::model::NotificationChannelDescriptor>,
10172
10173    /// If not empty, indicates that there may be more results that match
10174    /// the request. Use the value in the `page_token` field in a
10175    /// subsequent request to fetch the next set of results. If empty,
10176    /// all results have been returned.
10177    pub next_page_token: std::string::String,
10178
10179    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10180}
10181
10182impl ListNotificationChannelDescriptorsResponse {
10183    pub fn new() -> Self {
10184        std::default::Default::default()
10185    }
10186
10187    /// Sets the value of [channel_descriptors][crate::model::ListNotificationChannelDescriptorsResponse::channel_descriptors].
10188    ///
10189    /// # Example
10190    /// ```ignore,no_run
10191    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelDescriptorsResponse;
10192    /// use google_cloud_monitoring_v3::model::NotificationChannelDescriptor;
10193    /// let x = ListNotificationChannelDescriptorsResponse::new()
10194    ///     .set_channel_descriptors([
10195    ///         NotificationChannelDescriptor::default()/* use setters */,
10196    ///         NotificationChannelDescriptor::default()/* use (different) setters */,
10197    ///     ]);
10198    /// ```
10199    pub fn set_channel_descriptors<T, V>(mut self, v: T) -> Self
10200    where
10201        T: std::iter::IntoIterator<Item = V>,
10202        V: std::convert::Into<crate::model::NotificationChannelDescriptor>,
10203    {
10204        use std::iter::Iterator;
10205        self.channel_descriptors = v.into_iter().map(|i| i.into()).collect();
10206        self
10207    }
10208
10209    /// Sets the value of [next_page_token][crate::model::ListNotificationChannelDescriptorsResponse::next_page_token].
10210    ///
10211    /// # Example
10212    /// ```ignore,no_run
10213    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelDescriptorsResponse;
10214    /// let x = ListNotificationChannelDescriptorsResponse::new().set_next_page_token("example");
10215    /// ```
10216    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10217        self.next_page_token = v.into();
10218        self
10219    }
10220}
10221
10222impl wkt::message::Message for ListNotificationChannelDescriptorsResponse {
10223    fn typename() -> &'static str {
10224        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelDescriptorsResponse"
10225    }
10226}
10227
10228#[doc(hidden)]
10229impl gax::paginator::internal::PageableResponse for ListNotificationChannelDescriptorsResponse {
10230    type PageItem = crate::model::NotificationChannelDescriptor;
10231
10232    fn items(self) -> std::vec::Vec<Self::PageItem> {
10233        self.channel_descriptors
10234    }
10235
10236    fn next_page_token(&self) -> std::string::String {
10237        use std::clone::Clone;
10238        self.next_page_token.clone()
10239    }
10240}
10241
10242/// The `GetNotificationChannelDescriptor` response.
10243#[derive(Clone, Default, PartialEq)]
10244#[non_exhaustive]
10245pub struct GetNotificationChannelDescriptorRequest {
10246    /// Required. The channel type for which to execute the request. The format is:
10247    ///
10248    /// ```norust
10249    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
10250    /// ```
10251    pub name: std::string::String,
10252
10253    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10254}
10255
10256impl GetNotificationChannelDescriptorRequest {
10257    pub fn new() -> Self {
10258        std::default::Default::default()
10259    }
10260
10261    /// Sets the value of [name][crate::model::GetNotificationChannelDescriptorRequest::name].
10262    ///
10263    /// # Example
10264    /// ```ignore,no_run
10265    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelDescriptorRequest;
10266    /// let x = GetNotificationChannelDescriptorRequest::new().set_name("example");
10267    /// ```
10268    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10269        self.name = v.into();
10270        self
10271    }
10272}
10273
10274impl wkt::message::Message for GetNotificationChannelDescriptorRequest {
10275    fn typename() -> &'static str {
10276        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelDescriptorRequest"
10277    }
10278}
10279
10280/// The `CreateNotificationChannel` request.
10281#[derive(Clone, Default, PartialEq)]
10282#[non_exhaustive]
10283pub struct CreateNotificationChannelRequest {
10284    /// Required. The
10285    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
10286    /// to execute the request. The format is:
10287    ///
10288    /// ```norust
10289    /// projects/[PROJECT_ID_OR_NUMBER]
10290    /// ```
10291    ///
10292    /// This names the container into which the channel will be
10293    /// written, this does not name the newly created channel. The resulting
10294    /// channel's name will have a normalized version of this field as a prefix,
10295    /// but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
10296    pub name: std::string::String,
10297
10298    /// Required. The definition of the `NotificationChannel` to create.
10299    pub notification_channel: std::option::Option<crate::model::NotificationChannel>,
10300
10301    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10302}
10303
10304impl CreateNotificationChannelRequest {
10305    pub fn new() -> Self {
10306        std::default::Default::default()
10307    }
10308
10309    /// Sets the value of [name][crate::model::CreateNotificationChannelRequest::name].
10310    ///
10311    /// # Example
10312    /// ```ignore,no_run
10313    /// # use google_cloud_monitoring_v3::model::CreateNotificationChannelRequest;
10314    /// let x = CreateNotificationChannelRequest::new().set_name("example");
10315    /// ```
10316    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10317        self.name = v.into();
10318        self
10319    }
10320
10321    /// Sets the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
10322    ///
10323    /// # Example
10324    /// ```ignore,no_run
10325    /// # use google_cloud_monitoring_v3::model::CreateNotificationChannelRequest;
10326    /// use google_cloud_monitoring_v3::model::NotificationChannel;
10327    /// let x = CreateNotificationChannelRequest::new().set_notification_channel(NotificationChannel::default()/* use setters */);
10328    /// ```
10329    pub fn set_notification_channel<T>(mut self, v: T) -> Self
10330    where
10331        T: std::convert::Into<crate::model::NotificationChannel>,
10332    {
10333        self.notification_channel = std::option::Option::Some(v.into());
10334        self
10335    }
10336
10337    /// Sets or clears the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
10338    ///
10339    /// # Example
10340    /// ```ignore,no_run
10341    /// # use google_cloud_monitoring_v3::model::CreateNotificationChannelRequest;
10342    /// use google_cloud_monitoring_v3::model::NotificationChannel;
10343    /// let x = CreateNotificationChannelRequest::new().set_or_clear_notification_channel(Some(NotificationChannel::default()/* use setters */));
10344    /// let x = CreateNotificationChannelRequest::new().set_or_clear_notification_channel(None::<NotificationChannel>);
10345    /// ```
10346    pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
10347    where
10348        T: std::convert::Into<crate::model::NotificationChannel>,
10349    {
10350        self.notification_channel = v.map(|x| x.into());
10351        self
10352    }
10353}
10354
10355impl wkt::message::Message for CreateNotificationChannelRequest {
10356    fn typename() -> &'static str {
10357        "type.googleapis.com/google.monitoring.v3.CreateNotificationChannelRequest"
10358    }
10359}
10360
10361/// The `ListNotificationChannels` request.
10362#[derive(Clone, Default, PartialEq)]
10363#[non_exhaustive]
10364pub struct ListNotificationChannelsRequest {
10365    /// Required. The
10366    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) on which
10367    /// to execute the request. The format is:
10368    ///
10369    /// ```norust
10370    /// projects/[PROJECT_ID_OR_NUMBER]
10371    /// ```
10372    ///
10373    /// This names the container
10374    /// in which to look for the notification channels; it does not name a
10375    /// specific channel. To query a specific channel by REST resource name, use
10376    /// the
10377    /// [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
10378    /// operation.
10379    ///
10380    /// [google.monitoring.v3.NotificationChannelService.GetNotificationChannel]: crate::client::NotificationChannelService::get_notification_channel
10381    pub name: std::string::String,
10382
10383    /// Optional. If provided, this field specifies the criteria that must be met
10384    /// by notification channels to be included in the response.
10385    ///
10386    /// For more details, see [sorting and
10387    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
10388    pub filter: std::string::String,
10389
10390    /// Optional. A comma-separated list of fields by which to sort the result.
10391    /// Supports the same set of fields as in `filter`. Entries can be prefixed
10392    /// with a minus sign to sort in descending rather than ascending order.
10393    ///
10394    /// For more details, see [sorting and
10395    /// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
10396    pub order_by: std::string::String,
10397
10398    /// Optional. The maximum number of results to return in a single response. If
10399    /// not set to a positive number, a reasonable value will be chosen by the
10400    /// service.
10401    pub page_size: i32,
10402
10403    /// Optional. If non-empty, `page_token` must contain a value returned as the
10404    /// `next_page_token` in a previous response to request the next set
10405    /// of results.
10406    pub page_token: std::string::String,
10407
10408    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10409}
10410
10411impl ListNotificationChannelsRequest {
10412    pub fn new() -> Self {
10413        std::default::Default::default()
10414    }
10415
10416    /// Sets the value of [name][crate::model::ListNotificationChannelsRequest::name].
10417    ///
10418    /// # Example
10419    /// ```ignore,no_run
10420    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsRequest;
10421    /// let x = ListNotificationChannelsRequest::new().set_name("example");
10422    /// ```
10423    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10424        self.name = v.into();
10425        self
10426    }
10427
10428    /// Sets the value of [filter][crate::model::ListNotificationChannelsRequest::filter].
10429    ///
10430    /// # Example
10431    /// ```ignore,no_run
10432    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsRequest;
10433    /// let x = ListNotificationChannelsRequest::new().set_filter("example");
10434    /// ```
10435    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10436        self.filter = v.into();
10437        self
10438    }
10439
10440    /// Sets the value of [order_by][crate::model::ListNotificationChannelsRequest::order_by].
10441    ///
10442    /// # Example
10443    /// ```ignore,no_run
10444    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsRequest;
10445    /// let x = ListNotificationChannelsRequest::new().set_order_by("example");
10446    /// ```
10447    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10448        self.order_by = v.into();
10449        self
10450    }
10451
10452    /// Sets the value of [page_size][crate::model::ListNotificationChannelsRequest::page_size].
10453    ///
10454    /// # Example
10455    /// ```ignore,no_run
10456    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsRequest;
10457    /// let x = ListNotificationChannelsRequest::new().set_page_size(42);
10458    /// ```
10459    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10460        self.page_size = v.into();
10461        self
10462    }
10463
10464    /// Sets the value of [page_token][crate::model::ListNotificationChannelsRequest::page_token].
10465    ///
10466    /// # Example
10467    /// ```ignore,no_run
10468    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsRequest;
10469    /// let x = ListNotificationChannelsRequest::new().set_page_token("example");
10470    /// ```
10471    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10472        self.page_token = v.into();
10473        self
10474    }
10475}
10476
10477impl wkt::message::Message for ListNotificationChannelsRequest {
10478    fn typename() -> &'static str {
10479        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelsRequest"
10480    }
10481}
10482
10483/// The `ListNotificationChannels` response.
10484#[derive(Clone, Default, PartialEq)]
10485#[non_exhaustive]
10486pub struct ListNotificationChannelsResponse {
10487    /// The notification channels defined for the specified project.
10488    pub notification_channels: std::vec::Vec<crate::model::NotificationChannel>,
10489
10490    /// If not empty, indicates that there may be more results that match
10491    /// the request. Use the value in the `page_token` field in a
10492    /// subsequent request to fetch the next set of results. If empty,
10493    /// all results have been returned.
10494    pub next_page_token: std::string::String,
10495
10496    /// The total number of notification channels in all pages. This number is only
10497    /// an estimate, and may change in subsequent pages. <https://aip.dev/158>
10498    pub total_size: i32,
10499
10500    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10501}
10502
10503impl ListNotificationChannelsResponse {
10504    pub fn new() -> Self {
10505        std::default::Default::default()
10506    }
10507
10508    /// Sets the value of [notification_channels][crate::model::ListNotificationChannelsResponse::notification_channels].
10509    ///
10510    /// # Example
10511    /// ```ignore,no_run
10512    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsResponse;
10513    /// use google_cloud_monitoring_v3::model::NotificationChannel;
10514    /// let x = ListNotificationChannelsResponse::new()
10515    ///     .set_notification_channels([
10516    ///         NotificationChannel::default()/* use setters */,
10517    ///         NotificationChannel::default()/* use (different) setters */,
10518    ///     ]);
10519    /// ```
10520    pub fn set_notification_channels<T, V>(mut self, v: T) -> Self
10521    where
10522        T: std::iter::IntoIterator<Item = V>,
10523        V: std::convert::Into<crate::model::NotificationChannel>,
10524    {
10525        use std::iter::Iterator;
10526        self.notification_channels = v.into_iter().map(|i| i.into()).collect();
10527        self
10528    }
10529
10530    /// Sets the value of [next_page_token][crate::model::ListNotificationChannelsResponse::next_page_token].
10531    ///
10532    /// # Example
10533    /// ```ignore,no_run
10534    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsResponse;
10535    /// let x = ListNotificationChannelsResponse::new().set_next_page_token("example");
10536    /// ```
10537    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10538        self.next_page_token = v.into();
10539        self
10540    }
10541
10542    /// Sets the value of [total_size][crate::model::ListNotificationChannelsResponse::total_size].
10543    ///
10544    /// # Example
10545    /// ```ignore,no_run
10546    /// # use google_cloud_monitoring_v3::model::ListNotificationChannelsResponse;
10547    /// let x = ListNotificationChannelsResponse::new().set_total_size(42);
10548    /// ```
10549    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10550        self.total_size = v.into();
10551        self
10552    }
10553}
10554
10555impl wkt::message::Message for ListNotificationChannelsResponse {
10556    fn typename() -> &'static str {
10557        "type.googleapis.com/google.monitoring.v3.ListNotificationChannelsResponse"
10558    }
10559}
10560
10561#[doc(hidden)]
10562impl gax::paginator::internal::PageableResponse for ListNotificationChannelsResponse {
10563    type PageItem = crate::model::NotificationChannel;
10564
10565    fn items(self) -> std::vec::Vec<Self::PageItem> {
10566        self.notification_channels
10567    }
10568
10569    fn next_page_token(&self) -> std::string::String {
10570        use std::clone::Clone;
10571        self.next_page_token.clone()
10572    }
10573}
10574
10575/// The `GetNotificationChannel` request.
10576#[derive(Clone, Default, PartialEq)]
10577#[non_exhaustive]
10578pub struct GetNotificationChannelRequest {
10579    /// Required. The channel for which to execute the request. The format is:
10580    ///
10581    /// ```norust
10582    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
10583    /// ```
10584    pub name: std::string::String,
10585
10586    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10587}
10588
10589impl GetNotificationChannelRequest {
10590    pub fn new() -> Self {
10591        std::default::Default::default()
10592    }
10593
10594    /// Sets the value of [name][crate::model::GetNotificationChannelRequest::name].
10595    ///
10596    /// # Example
10597    /// ```ignore,no_run
10598    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelRequest;
10599    /// let x = GetNotificationChannelRequest::new().set_name("example");
10600    /// ```
10601    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10602        self.name = v.into();
10603        self
10604    }
10605}
10606
10607impl wkt::message::Message for GetNotificationChannelRequest {
10608    fn typename() -> &'static str {
10609        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelRequest"
10610    }
10611}
10612
10613/// The `UpdateNotificationChannel` request.
10614#[derive(Clone, Default, PartialEq)]
10615#[non_exhaustive]
10616pub struct UpdateNotificationChannelRequest {
10617    /// Optional. The fields to update.
10618    pub update_mask: std::option::Option<wkt::FieldMask>,
10619
10620    /// Required. A description of the changes to be applied to the specified
10621    /// notification channel. The description must provide a definition for
10622    /// fields to be updated; the names of these fields should also be
10623    /// included in the `update_mask`.
10624    pub notification_channel: std::option::Option<crate::model::NotificationChannel>,
10625
10626    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10627}
10628
10629impl UpdateNotificationChannelRequest {
10630    pub fn new() -> Self {
10631        std::default::Default::default()
10632    }
10633
10634    /// Sets the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
10635    ///
10636    /// # Example
10637    /// ```ignore,no_run
10638    /// # use google_cloud_monitoring_v3::model::UpdateNotificationChannelRequest;
10639    /// use wkt::FieldMask;
10640    /// let x = UpdateNotificationChannelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10641    /// ```
10642    pub fn set_update_mask<T>(mut self, v: T) -> Self
10643    where
10644        T: std::convert::Into<wkt::FieldMask>,
10645    {
10646        self.update_mask = std::option::Option::Some(v.into());
10647        self
10648    }
10649
10650    /// Sets or clears the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
10651    ///
10652    /// # Example
10653    /// ```ignore,no_run
10654    /// # use google_cloud_monitoring_v3::model::UpdateNotificationChannelRequest;
10655    /// use wkt::FieldMask;
10656    /// let x = UpdateNotificationChannelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10657    /// let x = UpdateNotificationChannelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10658    /// ```
10659    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10660    where
10661        T: std::convert::Into<wkt::FieldMask>,
10662    {
10663        self.update_mask = v.map(|x| x.into());
10664        self
10665    }
10666
10667    /// Sets the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
10668    ///
10669    /// # Example
10670    /// ```ignore,no_run
10671    /// # use google_cloud_monitoring_v3::model::UpdateNotificationChannelRequest;
10672    /// use google_cloud_monitoring_v3::model::NotificationChannel;
10673    /// let x = UpdateNotificationChannelRequest::new().set_notification_channel(NotificationChannel::default()/* use setters */);
10674    /// ```
10675    pub fn set_notification_channel<T>(mut self, v: T) -> Self
10676    where
10677        T: std::convert::Into<crate::model::NotificationChannel>,
10678    {
10679        self.notification_channel = std::option::Option::Some(v.into());
10680        self
10681    }
10682
10683    /// Sets or clears the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
10684    ///
10685    /// # Example
10686    /// ```ignore,no_run
10687    /// # use google_cloud_monitoring_v3::model::UpdateNotificationChannelRequest;
10688    /// use google_cloud_monitoring_v3::model::NotificationChannel;
10689    /// let x = UpdateNotificationChannelRequest::new().set_or_clear_notification_channel(Some(NotificationChannel::default()/* use setters */));
10690    /// let x = UpdateNotificationChannelRequest::new().set_or_clear_notification_channel(None::<NotificationChannel>);
10691    /// ```
10692    pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
10693    where
10694        T: std::convert::Into<crate::model::NotificationChannel>,
10695    {
10696        self.notification_channel = v.map(|x| x.into());
10697        self
10698    }
10699}
10700
10701impl wkt::message::Message for UpdateNotificationChannelRequest {
10702    fn typename() -> &'static str {
10703        "type.googleapis.com/google.monitoring.v3.UpdateNotificationChannelRequest"
10704    }
10705}
10706
10707/// The `DeleteNotificationChannel` request.
10708#[derive(Clone, Default, PartialEq)]
10709#[non_exhaustive]
10710pub struct DeleteNotificationChannelRequest {
10711    /// Required. The channel for which to execute the request. The format is:
10712    ///
10713    /// ```norust
10714    /// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
10715    /// ```
10716    pub name: std::string::String,
10717
10718    /// If true, the notification channel will be deleted regardless of its
10719    /// use in alert policies (the policies will be updated to remove the
10720    /// channel). If false, this operation will fail if the notification channel
10721    /// is referenced by existing alerting policies.
10722    pub force: bool,
10723
10724    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10725}
10726
10727impl DeleteNotificationChannelRequest {
10728    pub fn new() -> Self {
10729        std::default::Default::default()
10730    }
10731
10732    /// Sets the value of [name][crate::model::DeleteNotificationChannelRequest::name].
10733    ///
10734    /// # Example
10735    /// ```ignore,no_run
10736    /// # use google_cloud_monitoring_v3::model::DeleteNotificationChannelRequest;
10737    /// let x = DeleteNotificationChannelRequest::new().set_name("example");
10738    /// ```
10739    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10740        self.name = v.into();
10741        self
10742    }
10743
10744    /// Sets the value of [force][crate::model::DeleteNotificationChannelRequest::force].
10745    ///
10746    /// # Example
10747    /// ```ignore,no_run
10748    /// # use google_cloud_monitoring_v3::model::DeleteNotificationChannelRequest;
10749    /// let x = DeleteNotificationChannelRequest::new().set_force(true);
10750    /// ```
10751    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10752        self.force = v.into();
10753        self
10754    }
10755}
10756
10757impl wkt::message::Message for DeleteNotificationChannelRequest {
10758    fn typename() -> &'static str {
10759        "type.googleapis.com/google.monitoring.v3.DeleteNotificationChannelRequest"
10760    }
10761}
10762
10763/// The `SendNotificationChannelVerificationCode` request.
10764#[derive(Clone, Default, PartialEq)]
10765#[non_exhaustive]
10766pub struct SendNotificationChannelVerificationCodeRequest {
10767    /// Required. The notification channel to which to send a verification code.
10768    pub name: std::string::String,
10769
10770    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10771}
10772
10773impl SendNotificationChannelVerificationCodeRequest {
10774    pub fn new() -> Self {
10775        std::default::Default::default()
10776    }
10777
10778    /// Sets the value of [name][crate::model::SendNotificationChannelVerificationCodeRequest::name].
10779    ///
10780    /// # Example
10781    /// ```ignore,no_run
10782    /// # use google_cloud_monitoring_v3::model::SendNotificationChannelVerificationCodeRequest;
10783    /// let x = SendNotificationChannelVerificationCodeRequest::new().set_name("example");
10784    /// ```
10785    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10786        self.name = v.into();
10787        self
10788    }
10789}
10790
10791impl wkt::message::Message for SendNotificationChannelVerificationCodeRequest {
10792    fn typename() -> &'static str {
10793        "type.googleapis.com/google.monitoring.v3.SendNotificationChannelVerificationCodeRequest"
10794    }
10795}
10796
10797/// The `GetNotificationChannelVerificationCode` request.
10798#[derive(Clone, Default, PartialEq)]
10799#[non_exhaustive]
10800pub struct GetNotificationChannelVerificationCodeRequest {
10801    /// Required. The notification channel for which a verification code is to be
10802    /// generated and retrieved. This must name a channel that is already verified;
10803    /// if the specified channel is not verified, the request will fail.
10804    pub name: std::string::String,
10805
10806    /// The desired expiration time. If specified, the API will guarantee that
10807    /// the returned code will not be valid after the specified timestamp;
10808    /// however, the API cannot guarantee that the returned code will be
10809    /// valid for at least as long as the requested time (the API puts an upper
10810    /// bound on the amount of time for which a code may be valid). If omitted,
10811    /// a default expiration will be used, which may be less than the max
10812    /// permissible expiration (so specifying an expiration may extend the
10813    /// code's lifetime over omitting an expiration, even though the API does
10814    /// impose an upper limit on the maximum expiration that is permitted).
10815    pub expire_time: std::option::Option<wkt::Timestamp>,
10816
10817    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10818}
10819
10820impl GetNotificationChannelVerificationCodeRequest {
10821    pub fn new() -> Self {
10822        std::default::Default::default()
10823    }
10824
10825    /// Sets the value of [name][crate::model::GetNotificationChannelVerificationCodeRequest::name].
10826    ///
10827    /// # Example
10828    /// ```ignore,no_run
10829    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeRequest;
10830    /// let x = GetNotificationChannelVerificationCodeRequest::new().set_name("example");
10831    /// ```
10832    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10833        self.name = v.into();
10834        self
10835    }
10836
10837    /// Sets the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
10838    ///
10839    /// # Example
10840    /// ```ignore,no_run
10841    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeRequest;
10842    /// use wkt::Timestamp;
10843    /// let x = GetNotificationChannelVerificationCodeRequest::new().set_expire_time(Timestamp::default()/* use setters */);
10844    /// ```
10845    pub fn set_expire_time<T>(mut self, v: T) -> Self
10846    where
10847        T: std::convert::Into<wkt::Timestamp>,
10848    {
10849        self.expire_time = std::option::Option::Some(v.into());
10850        self
10851    }
10852
10853    /// Sets or clears the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
10854    ///
10855    /// # Example
10856    /// ```ignore,no_run
10857    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeRequest;
10858    /// use wkt::Timestamp;
10859    /// let x = GetNotificationChannelVerificationCodeRequest::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10860    /// let x = GetNotificationChannelVerificationCodeRequest::new().set_or_clear_expire_time(None::<Timestamp>);
10861    /// ```
10862    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10863    where
10864        T: std::convert::Into<wkt::Timestamp>,
10865    {
10866        self.expire_time = v.map(|x| x.into());
10867        self
10868    }
10869}
10870
10871impl wkt::message::Message for GetNotificationChannelVerificationCodeRequest {
10872    fn typename() -> &'static str {
10873        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelVerificationCodeRequest"
10874    }
10875}
10876
10877/// The `GetNotificationChannelVerificationCode` request.
10878#[derive(Clone, Default, PartialEq)]
10879#[non_exhaustive]
10880pub struct GetNotificationChannelVerificationCodeResponse {
10881    /// The verification code, which may be used to verify other channels
10882    /// that have an equivalent identity (i.e. other channels of the same
10883    /// type with the same fingerprint such as other email channels with
10884    /// the same email address or other sms channels with the same number).
10885    pub code: std::string::String,
10886
10887    /// The expiration time associated with the code that was returned. If
10888    /// an expiration was provided in the request, this is the minimum of the
10889    /// requested expiration in the request and the max permitted expiration.
10890    pub expire_time: std::option::Option<wkt::Timestamp>,
10891
10892    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10893}
10894
10895impl GetNotificationChannelVerificationCodeResponse {
10896    pub fn new() -> Self {
10897        std::default::Default::default()
10898    }
10899
10900    /// Sets the value of [code][crate::model::GetNotificationChannelVerificationCodeResponse::code].
10901    ///
10902    /// # Example
10903    /// ```ignore,no_run
10904    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeResponse;
10905    /// let x = GetNotificationChannelVerificationCodeResponse::new().set_code("example");
10906    /// ```
10907    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10908        self.code = v.into();
10909        self
10910    }
10911
10912    /// Sets the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeResponse::expire_time].
10913    ///
10914    /// # Example
10915    /// ```ignore,no_run
10916    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeResponse;
10917    /// use wkt::Timestamp;
10918    /// let x = GetNotificationChannelVerificationCodeResponse::new().set_expire_time(Timestamp::default()/* use setters */);
10919    /// ```
10920    pub fn set_expire_time<T>(mut self, v: T) -> Self
10921    where
10922        T: std::convert::Into<wkt::Timestamp>,
10923    {
10924        self.expire_time = std::option::Option::Some(v.into());
10925        self
10926    }
10927
10928    /// Sets or clears the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeResponse::expire_time].
10929    ///
10930    /// # Example
10931    /// ```ignore,no_run
10932    /// # use google_cloud_monitoring_v3::model::GetNotificationChannelVerificationCodeResponse;
10933    /// use wkt::Timestamp;
10934    /// let x = GetNotificationChannelVerificationCodeResponse::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10935    /// let x = GetNotificationChannelVerificationCodeResponse::new().set_or_clear_expire_time(None::<Timestamp>);
10936    /// ```
10937    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10938    where
10939        T: std::convert::Into<wkt::Timestamp>,
10940    {
10941        self.expire_time = v.map(|x| x.into());
10942        self
10943    }
10944}
10945
10946impl wkt::message::Message for GetNotificationChannelVerificationCodeResponse {
10947    fn typename() -> &'static str {
10948        "type.googleapis.com/google.monitoring.v3.GetNotificationChannelVerificationCodeResponse"
10949    }
10950}
10951
10952/// The `VerifyNotificationChannel` request.
10953#[derive(Clone, Default, PartialEq)]
10954#[non_exhaustive]
10955pub struct VerifyNotificationChannelRequest {
10956    /// Required. The notification channel to verify.
10957    pub name: std::string::String,
10958
10959    /// Required. The verification code that was delivered to the channel as
10960    /// a result of invoking the `SendNotificationChannelVerificationCode` API
10961    /// method or that was retrieved from a verified channel via
10962    /// `GetNotificationChannelVerificationCode`. For example, one might have
10963    /// "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
10964    /// guaranteed that the code is valid UTF-8; one should not
10965    /// make any assumptions regarding the structure or format of the code).
10966    pub code: std::string::String,
10967
10968    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10969}
10970
10971impl VerifyNotificationChannelRequest {
10972    pub fn new() -> Self {
10973        std::default::Default::default()
10974    }
10975
10976    /// Sets the value of [name][crate::model::VerifyNotificationChannelRequest::name].
10977    ///
10978    /// # Example
10979    /// ```ignore,no_run
10980    /// # use google_cloud_monitoring_v3::model::VerifyNotificationChannelRequest;
10981    /// let x = VerifyNotificationChannelRequest::new().set_name("example");
10982    /// ```
10983    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10984        self.name = v.into();
10985        self
10986    }
10987
10988    /// Sets the value of [code][crate::model::VerifyNotificationChannelRequest::code].
10989    ///
10990    /// # Example
10991    /// ```ignore,no_run
10992    /// # use google_cloud_monitoring_v3::model::VerifyNotificationChannelRequest;
10993    /// let x = VerifyNotificationChannelRequest::new().set_code("example");
10994    /// ```
10995    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10996        self.code = v.into();
10997        self
10998    }
10999}
11000
11001impl wkt::message::Message for VerifyNotificationChannelRequest {
11002    fn typename() -> &'static str {
11003        "type.googleapis.com/google.monitoring.v3.VerifyNotificationChannelRequest"
11004    }
11005}
11006
11007/// A `Service` is a discrete, autonomous, and network-accessible unit, designed
11008/// to solve an individual concern
11009/// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In
11010/// Cloud Monitoring, a `Service` acts as the root resource under which
11011/// operational aspects of the service are accessible.
11012#[derive(Clone, Default, PartialEq)]
11013#[non_exhaustive]
11014pub struct Service {
11015    /// Identifier. Resource name for this Service. The format is:
11016    ///
11017    /// ```norust
11018    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
11019    /// ```
11020    pub name: std::string::String,
11021
11022    /// Name used for UI elements listing this Service.
11023    pub display_name: std::string::String,
11024
11025    /// Message that contains the service type and service labels of this service
11026    /// if it is a basic service.
11027    /// Documentation and examples
11028    /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
11029    pub basic_service: std::option::Option<crate::model::service::BasicService>,
11030
11031    /// Configuration for how to query telemetry on a Service.
11032    pub telemetry: std::option::Option<crate::model::service::Telemetry>,
11033
11034    /// Labels which have been used to annotate the service. Label keys must start
11035    /// with a letter. Label keys and values may contain lowercase letters,
11036    /// numbers, underscores, and dashes. Label keys and values have a maximum
11037    /// length of 63 characters, and must be less than 128 bytes in size. Up to 64
11038    /// label entries may be stored. For labels which do not have a semantic value,
11039    /// the empty string may be supplied for the label value.
11040    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
11041
11042    /// REQUIRED. Service-identifying atoms specifying the underlying service.
11043    pub identifier: std::option::Option<crate::model::service::Identifier>,
11044
11045    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11046}
11047
11048impl Service {
11049    pub fn new() -> Self {
11050        std::default::Default::default()
11051    }
11052
11053    /// Sets the value of [name][crate::model::Service::name].
11054    ///
11055    /// # Example
11056    /// ```ignore,no_run
11057    /// # use google_cloud_monitoring_v3::model::Service;
11058    /// let x = Service::new().set_name("example");
11059    /// ```
11060    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11061        self.name = v.into();
11062        self
11063    }
11064
11065    /// Sets the value of [display_name][crate::model::Service::display_name].
11066    ///
11067    /// # Example
11068    /// ```ignore,no_run
11069    /// # use google_cloud_monitoring_v3::model::Service;
11070    /// let x = Service::new().set_display_name("example");
11071    /// ```
11072    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11073        self.display_name = v.into();
11074        self
11075    }
11076
11077    /// Sets the value of [basic_service][crate::model::Service::basic_service].
11078    ///
11079    /// # Example
11080    /// ```ignore,no_run
11081    /// # use google_cloud_monitoring_v3::model::Service;
11082    /// use google_cloud_monitoring_v3::model::service::BasicService;
11083    /// let x = Service::new().set_basic_service(BasicService::default()/* use setters */);
11084    /// ```
11085    pub fn set_basic_service<T>(mut self, v: T) -> Self
11086    where
11087        T: std::convert::Into<crate::model::service::BasicService>,
11088    {
11089        self.basic_service = std::option::Option::Some(v.into());
11090        self
11091    }
11092
11093    /// Sets or clears the value of [basic_service][crate::model::Service::basic_service].
11094    ///
11095    /// # Example
11096    /// ```ignore,no_run
11097    /// # use google_cloud_monitoring_v3::model::Service;
11098    /// use google_cloud_monitoring_v3::model::service::BasicService;
11099    /// let x = Service::new().set_or_clear_basic_service(Some(BasicService::default()/* use setters */));
11100    /// let x = Service::new().set_or_clear_basic_service(None::<BasicService>);
11101    /// ```
11102    pub fn set_or_clear_basic_service<T>(mut self, v: std::option::Option<T>) -> Self
11103    where
11104        T: std::convert::Into<crate::model::service::BasicService>,
11105    {
11106        self.basic_service = v.map(|x| x.into());
11107        self
11108    }
11109
11110    /// Sets the value of [telemetry][crate::model::Service::telemetry].
11111    ///
11112    /// # Example
11113    /// ```ignore,no_run
11114    /// # use google_cloud_monitoring_v3::model::Service;
11115    /// use google_cloud_monitoring_v3::model::service::Telemetry;
11116    /// let x = Service::new().set_telemetry(Telemetry::default()/* use setters */);
11117    /// ```
11118    pub fn set_telemetry<T>(mut self, v: T) -> Self
11119    where
11120        T: std::convert::Into<crate::model::service::Telemetry>,
11121    {
11122        self.telemetry = std::option::Option::Some(v.into());
11123        self
11124    }
11125
11126    /// Sets or clears the value of [telemetry][crate::model::Service::telemetry].
11127    ///
11128    /// # Example
11129    /// ```ignore,no_run
11130    /// # use google_cloud_monitoring_v3::model::Service;
11131    /// use google_cloud_monitoring_v3::model::service::Telemetry;
11132    /// let x = Service::new().set_or_clear_telemetry(Some(Telemetry::default()/* use setters */));
11133    /// let x = Service::new().set_or_clear_telemetry(None::<Telemetry>);
11134    /// ```
11135    pub fn set_or_clear_telemetry<T>(mut self, v: std::option::Option<T>) -> Self
11136    where
11137        T: std::convert::Into<crate::model::service::Telemetry>,
11138    {
11139        self.telemetry = v.map(|x| x.into());
11140        self
11141    }
11142
11143    /// Sets the value of [user_labels][crate::model::Service::user_labels].
11144    ///
11145    /// # Example
11146    /// ```ignore,no_run
11147    /// # use google_cloud_monitoring_v3::model::Service;
11148    /// let x = Service::new().set_user_labels([
11149    ///     ("key0", "abc"),
11150    ///     ("key1", "xyz"),
11151    /// ]);
11152    /// ```
11153    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11154    where
11155        T: std::iter::IntoIterator<Item = (K, V)>,
11156        K: std::convert::Into<std::string::String>,
11157        V: std::convert::Into<std::string::String>,
11158    {
11159        use std::iter::Iterator;
11160        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11161        self
11162    }
11163
11164    /// Sets the value of [identifier][crate::model::Service::identifier].
11165    ///
11166    /// Note that all the setters affecting `identifier` are mutually
11167    /// exclusive.
11168    ///
11169    /// # Example
11170    /// ```ignore,no_run
11171    /// # use google_cloud_monitoring_v3::model::Service;
11172    /// use google_cloud_monitoring_v3::model::service::Custom;
11173    /// let x = Service::new().set_identifier(Some(
11174    ///     google_cloud_monitoring_v3::model::service::Identifier::Custom(Custom::default().into())));
11175    /// ```
11176    pub fn set_identifier<
11177        T: std::convert::Into<std::option::Option<crate::model::service::Identifier>>,
11178    >(
11179        mut self,
11180        v: T,
11181    ) -> Self {
11182        self.identifier = v.into();
11183        self
11184    }
11185
11186    /// The value of [identifier][crate::model::Service::identifier]
11187    /// if it holds a `Custom`, `None` if the field is not set or
11188    /// holds a different branch.
11189    pub fn custom(&self) -> std::option::Option<&std::boxed::Box<crate::model::service::Custom>> {
11190        #[allow(unreachable_patterns)]
11191        self.identifier.as_ref().and_then(|v| match v {
11192            crate::model::service::Identifier::Custom(v) => std::option::Option::Some(v),
11193            _ => std::option::Option::None,
11194        })
11195    }
11196
11197    /// Sets the value of [identifier][crate::model::Service::identifier]
11198    /// to hold a `Custom`.
11199    ///
11200    /// Note that all the setters affecting `identifier` are
11201    /// mutually exclusive.
11202    ///
11203    /// # Example
11204    /// ```ignore,no_run
11205    /// # use google_cloud_monitoring_v3::model::Service;
11206    /// use google_cloud_monitoring_v3::model::service::Custom;
11207    /// let x = Service::new().set_custom(Custom::default()/* use setters */);
11208    /// assert!(x.custom().is_some());
11209    /// assert!(x.app_engine().is_none());
11210    /// assert!(x.cloud_endpoints().is_none());
11211    /// assert!(x.cluster_istio().is_none());
11212    /// assert!(x.mesh_istio().is_none());
11213    /// assert!(x.istio_canonical_service().is_none());
11214    /// assert!(x.cloud_run().is_none());
11215    /// assert!(x.gke_namespace().is_none());
11216    /// assert!(x.gke_workload().is_none());
11217    /// assert!(x.gke_service().is_none());
11218    /// ```
11219    pub fn set_custom<T: std::convert::Into<std::boxed::Box<crate::model::service::Custom>>>(
11220        mut self,
11221        v: T,
11222    ) -> Self {
11223        self.identifier =
11224            std::option::Option::Some(crate::model::service::Identifier::Custom(v.into()));
11225        self
11226    }
11227
11228    /// The value of [identifier][crate::model::Service::identifier]
11229    /// if it holds a `AppEngine`, `None` if the field is not set or
11230    /// holds a different branch.
11231    pub fn app_engine(
11232        &self,
11233    ) -> std::option::Option<&std::boxed::Box<crate::model::service::AppEngine>> {
11234        #[allow(unreachable_patterns)]
11235        self.identifier.as_ref().and_then(|v| match v {
11236            crate::model::service::Identifier::AppEngine(v) => std::option::Option::Some(v),
11237            _ => std::option::Option::None,
11238        })
11239    }
11240
11241    /// Sets the value of [identifier][crate::model::Service::identifier]
11242    /// to hold a `AppEngine`.
11243    ///
11244    /// Note that all the setters affecting `identifier` are
11245    /// mutually exclusive.
11246    ///
11247    /// # Example
11248    /// ```ignore,no_run
11249    /// # use google_cloud_monitoring_v3::model::Service;
11250    /// use google_cloud_monitoring_v3::model::service::AppEngine;
11251    /// let x = Service::new().set_app_engine(AppEngine::default()/* use setters */);
11252    /// assert!(x.app_engine().is_some());
11253    /// assert!(x.custom().is_none());
11254    /// assert!(x.cloud_endpoints().is_none());
11255    /// assert!(x.cluster_istio().is_none());
11256    /// assert!(x.mesh_istio().is_none());
11257    /// assert!(x.istio_canonical_service().is_none());
11258    /// assert!(x.cloud_run().is_none());
11259    /// assert!(x.gke_namespace().is_none());
11260    /// assert!(x.gke_workload().is_none());
11261    /// assert!(x.gke_service().is_none());
11262    /// ```
11263    pub fn set_app_engine<
11264        T: std::convert::Into<std::boxed::Box<crate::model::service::AppEngine>>,
11265    >(
11266        mut self,
11267        v: T,
11268    ) -> Self {
11269        self.identifier =
11270            std::option::Option::Some(crate::model::service::Identifier::AppEngine(v.into()));
11271        self
11272    }
11273
11274    /// The value of [identifier][crate::model::Service::identifier]
11275    /// if it holds a `CloudEndpoints`, `None` if the field is not set or
11276    /// holds a different branch.
11277    pub fn cloud_endpoints(
11278        &self,
11279    ) -> std::option::Option<&std::boxed::Box<crate::model::service::CloudEndpoints>> {
11280        #[allow(unreachable_patterns)]
11281        self.identifier.as_ref().and_then(|v| match v {
11282            crate::model::service::Identifier::CloudEndpoints(v) => std::option::Option::Some(v),
11283            _ => std::option::Option::None,
11284        })
11285    }
11286
11287    /// Sets the value of [identifier][crate::model::Service::identifier]
11288    /// to hold a `CloudEndpoints`.
11289    ///
11290    /// Note that all the setters affecting `identifier` are
11291    /// mutually exclusive.
11292    ///
11293    /// # Example
11294    /// ```ignore,no_run
11295    /// # use google_cloud_monitoring_v3::model::Service;
11296    /// use google_cloud_monitoring_v3::model::service::CloudEndpoints;
11297    /// let x = Service::new().set_cloud_endpoints(CloudEndpoints::default()/* use setters */);
11298    /// assert!(x.cloud_endpoints().is_some());
11299    /// assert!(x.custom().is_none());
11300    /// assert!(x.app_engine().is_none());
11301    /// assert!(x.cluster_istio().is_none());
11302    /// assert!(x.mesh_istio().is_none());
11303    /// assert!(x.istio_canonical_service().is_none());
11304    /// assert!(x.cloud_run().is_none());
11305    /// assert!(x.gke_namespace().is_none());
11306    /// assert!(x.gke_workload().is_none());
11307    /// assert!(x.gke_service().is_none());
11308    /// ```
11309    pub fn set_cloud_endpoints<
11310        T: std::convert::Into<std::boxed::Box<crate::model::service::CloudEndpoints>>,
11311    >(
11312        mut self,
11313        v: T,
11314    ) -> Self {
11315        self.identifier =
11316            std::option::Option::Some(crate::model::service::Identifier::CloudEndpoints(v.into()));
11317        self
11318    }
11319
11320    /// The value of [identifier][crate::model::Service::identifier]
11321    /// if it holds a `ClusterIstio`, `None` if the field is not set or
11322    /// holds a different branch.
11323    pub fn cluster_istio(
11324        &self,
11325    ) -> std::option::Option<&std::boxed::Box<crate::model::service::ClusterIstio>> {
11326        #[allow(unreachable_patterns)]
11327        self.identifier.as_ref().and_then(|v| match v {
11328            crate::model::service::Identifier::ClusterIstio(v) => std::option::Option::Some(v),
11329            _ => std::option::Option::None,
11330        })
11331    }
11332
11333    /// Sets the value of [identifier][crate::model::Service::identifier]
11334    /// to hold a `ClusterIstio`.
11335    ///
11336    /// Note that all the setters affecting `identifier` are
11337    /// mutually exclusive.
11338    ///
11339    /// # Example
11340    /// ```ignore,no_run
11341    /// # use google_cloud_monitoring_v3::model::Service;
11342    /// use google_cloud_monitoring_v3::model::service::ClusterIstio;
11343    /// let x = Service::new().set_cluster_istio(ClusterIstio::default()/* use setters */);
11344    /// assert!(x.cluster_istio().is_some());
11345    /// assert!(x.custom().is_none());
11346    /// assert!(x.app_engine().is_none());
11347    /// assert!(x.cloud_endpoints().is_none());
11348    /// assert!(x.mesh_istio().is_none());
11349    /// assert!(x.istio_canonical_service().is_none());
11350    /// assert!(x.cloud_run().is_none());
11351    /// assert!(x.gke_namespace().is_none());
11352    /// assert!(x.gke_workload().is_none());
11353    /// assert!(x.gke_service().is_none());
11354    /// ```
11355    pub fn set_cluster_istio<
11356        T: std::convert::Into<std::boxed::Box<crate::model::service::ClusterIstio>>,
11357    >(
11358        mut self,
11359        v: T,
11360    ) -> Self {
11361        self.identifier =
11362            std::option::Option::Some(crate::model::service::Identifier::ClusterIstio(v.into()));
11363        self
11364    }
11365
11366    /// The value of [identifier][crate::model::Service::identifier]
11367    /// if it holds a `MeshIstio`, `None` if the field is not set or
11368    /// holds a different branch.
11369    pub fn mesh_istio(
11370        &self,
11371    ) -> std::option::Option<&std::boxed::Box<crate::model::service::MeshIstio>> {
11372        #[allow(unreachable_patterns)]
11373        self.identifier.as_ref().and_then(|v| match v {
11374            crate::model::service::Identifier::MeshIstio(v) => std::option::Option::Some(v),
11375            _ => std::option::Option::None,
11376        })
11377    }
11378
11379    /// Sets the value of [identifier][crate::model::Service::identifier]
11380    /// to hold a `MeshIstio`.
11381    ///
11382    /// Note that all the setters affecting `identifier` are
11383    /// mutually exclusive.
11384    ///
11385    /// # Example
11386    /// ```ignore,no_run
11387    /// # use google_cloud_monitoring_v3::model::Service;
11388    /// use google_cloud_monitoring_v3::model::service::MeshIstio;
11389    /// let x = Service::new().set_mesh_istio(MeshIstio::default()/* use setters */);
11390    /// assert!(x.mesh_istio().is_some());
11391    /// assert!(x.custom().is_none());
11392    /// assert!(x.app_engine().is_none());
11393    /// assert!(x.cloud_endpoints().is_none());
11394    /// assert!(x.cluster_istio().is_none());
11395    /// assert!(x.istio_canonical_service().is_none());
11396    /// assert!(x.cloud_run().is_none());
11397    /// assert!(x.gke_namespace().is_none());
11398    /// assert!(x.gke_workload().is_none());
11399    /// assert!(x.gke_service().is_none());
11400    /// ```
11401    pub fn set_mesh_istio<
11402        T: std::convert::Into<std::boxed::Box<crate::model::service::MeshIstio>>,
11403    >(
11404        mut self,
11405        v: T,
11406    ) -> Self {
11407        self.identifier =
11408            std::option::Option::Some(crate::model::service::Identifier::MeshIstio(v.into()));
11409        self
11410    }
11411
11412    /// The value of [identifier][crate::model::Service::identifier]
11413    /// if it holds a `IstioCanonicalService`, `None` if the field is not set or
11414    /// holds a different branch.
11415    pub fn istio_canonical_service(
11416        &self,
11417    ) -> std::option::Option<&std::boxed::Box<crate::model::service::IstioCanonicalService>> {
11418        #[allow(unreachable_patterns)]
11419        self.identifier.as_ref().and_then(|v| match v {
11420            crate::model::service::Identifier::IstioCanonicalService(v) => {
11421                std::option::Option::Some(v)
11422            }
11423            _ => std::option::Option::None,
11424        })
11425    }
11426
11427    /// Sets the value of [identifier][crate::model::Service::identifier]
11428    /// to hold a `IstioCanonicalService`.
11429    ///
11430    /// Note that all the setters affecting `identifier` are
11431    /// mutually exclusive.
11432    ///
11433    /// # Example
11434    /// ```ignore,no_run
11435    /// # use google_cloud_monitoring_v3::model::Service;
11436    /// use google_cloud_monitoring_v3::model::service::IstioCanonicalService;
11437    /// let x = Service::new().set_istio_canonical_service(IstioCanonicalService::default()/* use setters */);
11438    /// assert!(x.istio_canonical_service().is_some());
11439    /// assert!(x.custom().is_none());
11440    /// assert!(x.app_engine().is_none());
11441    /// assert!(x.cloud_endpoints().is_none());
11442    /// assert!(x.cluster_istio().is_none());
11443    /// assert!(x.mesh_istio().is_none());
11444    /// assert!(x.cloud_run().is_none());
11445    /// assert!(x.gke_namespace().is_none());
11446    /// assert!(x.gke_workload().is_none());
11447    /// assert!(x.gke_service().is_none());
11448    /// ```
11449    pub fn set_istio_canonical_service<
11450        T: std::convert::Into<std::boxed::Box<crate::model::service::IstioCanonicalService>>,
11451    >(
11452        mut self,
11453        v: T,
11454    ) -> Self {
11455        self.identifier = std::option::Option::Some(
11456            crate::model::service::Identifier::IstioCanonicalService(v.into()),
11457        );
11458        self
11459    }
11460
11461    /// The value of [identifier][crate::model::Service::identifier]
11462    /// if it holds a `CloudRun`, `None` if the field is not set or
11463    /// holds a different branch.
11464    pub fn cloud_run(
11465        &self,
11466    ) -> std::option::Option<&std::boxed::Box<crate::model::service::CloudRun>> {
11467        #[allow(unreachable_patterns)]
11468        self.identifier.as_ref().and_then(|v| match v {
11469            crate::model::service::Identifier::CloudRun(v) => std::option::Option::Some(v),
11470            _ => std::option::Option::None,
11471        })
11472    }
11473
11474    /// Sets the value of [identifier][crate::model::Service::identifier]
11475    /// to hold a `CloudRun`.
11476    ///
11477    /// Note that all the setters affecting `identifier` are
11478    /// mutually exclusive.
11479    ///
11480    /// # Example
11481    /// ```ignore,no_run
11482    /// # use google_cloud_monitoring_v3::model::Service;
11483    /// use google_cloud_monitoring_v3::model::service::CloudRun;
11484    /// let x = Service::new().set_cloud_run(CloudRun::default()/* use setters */);
11485    /// assert!(x.cloud_run().is_some());
11486    /// assert!(x.custom().is_none());
11487    /// assert!(x.app_engine().is_none());
11488    /// assert!(x.cloud_endpoints().is_none());
11489    /// assert!(x.cluster_istio().is_none());
11490    /// assert!(x.mesh_istio().is_none());
11491    /// assert!(x.istio_canonical_service().is_none());
11492    /// assert!(x.gke_namespace().is_none());
11493    /// assert!(x.gke_workload().is_none());
11494    /// assert!(x.gke_service().is_none());
11495    /// ```
11496    pub fn set_cloud_run<
11497        T: std::convert::Into<std::boxed::Box<crate::model::service::CloudRun>>,
11498    >(
11499        mut self,
11500        v: T,
11501    ) -> Self {
11502        self.identifier =
11503            std::option::Option::Some(crate::model::service::Identifier::CloudRun(v.into()));
11504        self
11505    }
11506
11507    /// The value of [identifier][crate::model::Service::identifier]
11508    /// if it holds a `GkeNamespace`, `None` if the field is not set or
11509    /// holds a different branch.
11510    pub fn gke_namespace(
11511        &self,
11512    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeNamespace>> {
11513        #[allow(unreachable_patterns)]
11514        self.identifier.as_ref().and_then(|v| match v {
11515            crate::model::service::Identifier::GkeNamespace(v) => std::option::Option::Some(v),
11516            _ => std::option::Option::None,
11517        })
11518    }
11519
11520    /// Sets the value of [identifier][crate::model::Service::identifier]
11521    /// to hold a `GkeNamespace`.
11522    ///
11523    /// Note that all the setters affecting `identifier` are
11524    /// mutually exclusive.
11525    ///
11526    /// # Example
11527    /// ```ignore,no_run
11528    /// # use google_cloud_monitoring_v3::model::Service;
11529    /// use google_cloud_monitoring_v3::model::service::GkeNamespace;
11530    /// let x = Service::new().set_gke_namespace(GkeNamespace::default()/* use setters */);
11531    /// assert!(x.gke_namespace().is_some());
11532    /// assert!(x.custom().is_none());
11533    /// assert!(x.app_engine().is_none());
11534    /// assert!(x.cloud_endpoints().is_none());
11535    /// assert!(x.cluster_istio().is_none());
11536    /// assert!(x.mesh_istio().is_none());
11537    /// assert!(x.istio_canonical_service().is_none());
11538    /// assert!(x.cloud_run().is_none());
11539    /// assert!(x.gke_workload().is_none());
11540    /// assert!(x.gke_service().is_none());
11541    /// ```
11542    pub fn set_gke_namespace<
11543        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeNamespace>>,
11544    >(
11545        mut self,
11546        v: T,
11547    ) -> Self {
11548        self.identifier =
11549            std::option::Option::Some(crate::model::service::Identifier::GkeNamespace(v.into()));
11550        self
11551    }
11552
11553    /// The value of [identifier][crate::model::Service::identifier]
11554    /// if it holds a `GkeWorkload`, `None` if the field is not set or
11555    /// holds a different branch.
11556    pub fn gke_workload(
11557        &self,
11558    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeWorkload>> {
11559        #[allow(unreachable_patterns)]
11560        self.identifier.as_ref().and_then(|v| match v {
11561            crate::model::service::Identifier::GkeWorkload(v) => std::option::Option::Some(v),
11562            _ => std::option::Option::None,
11563        })
11564    }
11565
11566    /// Sets the value of [identifier][crate::model::Service::identifier]
11567    /// to hold a `GkeWorkload`.
11568    ///
11569    /// Note that all the setters affecting `identifier` are
11570    /// mutually exclusive.
11571    ///
11572    /// # Example
11573    /// ```ignore,no_run
11574    /// # use google_cloud_monitoring_v3::model::Service;
11575    /// use google_cloud_monitoring_v3::model::service::GkeWorkload;
11576    /// let x = Service::new().set_gke_workload(GkeWorkload::default()/* use setters */);
11577    /// assert!(x.gke_workload().is_some());
11578    /// assert!(x.custom().is_none());
11579    /// assert!(x.app_engine().is_none());
11580    /// assert!(x.cloud_endpoints().is_none());
11581    /// assert!(x.cluster_istio().is_none());
11582    /// assert!(x.mesh_istio().is_none());
11583    /// assert!(x.istio_canonical_service().is_none());
11584    /// assert!(x.cloud_run().is_none());
11585    /// assert!(x.gke_namespace().is_none());
11586    /// assert!(x.gke_service().is_none());
11587    /// ```
11588    pub fn set_gke_workload<
11589        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeWorkload>>,
11590    >(
11591        mut self,
11592        v: T,
11593    ) -> Self {
11594        self.identifier =
11595            std::option::Option::Some(crate::model::service::Identifier::GkeWorkload(v.into()));
11596        self
11597    }
11598
11599    /// The value of [identifier][crate::model::Service::identifier]
11600    /// if it holds a `GkeService`, `None` if the field is not set or
11601    /// holds a different branch.
11602    pub fn gke_service(
11603        &self,
11604    ) -> std::option::Option<&std::boxed::Box<crate::model::service::GkeService>> {
11605        #[allow(unreachable_patterns)]
11606        self.identifier.as_ref().and_then(|v| match v {
11607            crate::model::service::Identifier::GkeService(v) => std::option::Option::Some(v),
11608            _ => std::option::Option::None,
11609        })
11610    }
11611
11612    /// Sets the value of [identifier][crate::model::Service::identifier]
11613    /// to hold a `GkeService`.
11614    ///
11615    /// Note that all the setters affecting `identifier` are
11616    /// mutually exclusive.
11617    ///
11618    /// # Example
11619    /// ```ignore,no_run
11620    /// # use google_cloud_monitoring_v3::model::Service;
11621    /// use google_cloud_monitoring_v3::model::service::GkeService;
11622    /// let x = Service::new().set_gke_service(GkeService::default()/* use setters */);
11623    /// assert!(x.gke_service().is_some());
11624    /// assert!(x.custom().is_none());
11625    /// assert!(x.app_engine().is_none());
11626    /// assert!(x.cloud_endpoints().is_none());
11627    /// assert!(x.cluster_istio().is_none());
11628    /// assert!(x.mesh_istio().is_none());
11629    /// assert!(x.istio_canonical_service().is_none());
11630    /// assert!(x.cloud_run().is_none());
11631    /// assert!(x.gke_namespace().is_none());
11632    /// assert!(x.gke_workload().is_none());
11633    /// ```
11634    pub fn set_gke_service<
11635        T: std::convert::Into<std::boxed::Box<crate::model::service::GkeService>>,
11636    >(
11637        mut self,
11638        v: T,
11639    ) -> Self {
11640        self.identifier =
11641            std::option::Option::Some(crate::model::service::Identifier::GkeService(v.into()));
11642        self
11643    }
11644}
11645
11646impl wkt::message::Message for Service {
11647    fn typename() -> &'static str {
11648        "type.googleapis.com/google.monitoring.v3.Service"
11649    }
11650}
11651
11652/// Defines additional types related to [Service].
11653pub mod service {
11654    #[allow(unused_imports)]
11655    use super::*;
11656
11657    /// Use a custom service to designate a service that you want to monitor
11658    /// when none of the other service types (like App Engine, Cloud Run, or
11659    /// a GKE type) matches your intended service.
11660    #[derive(Clone, Default, PartialEq)]
11661    #[non_exhaustive]
11662    pub struct Custom {
11663        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11664    }
11665
11666    impl Custom {
11667        pub fn new() -> Self {
11668            std::default::Default::default()
11669        }
11670    }
11671
11672    impl wkt::message::Message for Custom {
11673        fn typename() -> &'static str {
11674            "type.googleapis.com/google.monitoring.v3.Service.Custom"
11675        }
11676    }
11677
11678    /// App Engine service. Learn more at <https://cloud.google.com/appengine>.
11679    #[derive(Clone, Default, PartialEq)]
11680    #[non_exhaustive]
11681    pub struct AppEngine {
11682        /// The ID of the App Engine module underlying this service. Corresponds to
11683        /// the `module_id` resource label in the [`gae_app` monitored
11684        /// resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app).
11685        pub module_id: std::string::String,
11686
11687        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11688    }
11689
11690    impl AppEngine {
11691        pub fn new() -> Self {
11692            std::default::Default::default()
11693        }
11694
11695        /// Sets the value of [module_id][crate::model::service::AppEngine::module_id].
11696        ///
11697        /// # Example
11698        /// ```ignore,no_run
11699        /// # use google_cloud_monitoring_v3::model::service::AppEngine;
11700        /// let x = AppEngine::new().set_module_id("example");
11701        /// ```
11702        pub fn set_module_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11703            self.module_id = v.into();
11704            self
11705        }
11706    }
11707
11708    impl wkt::message::Message for AppEngine {
11709        fn typename() -> &'static str {
11710            "type.googleapis.com/google.monitoring.v3.Service.AppEngine"
11711        }
11712    }
11713
11714    /// Cloud Endpoints service. Learn more at <https://cloud.google.com/endpoints>.
11715    #[derive(Clone, Default, PartialEq)]
11716    #[non_exhaustive]
11717    pub struct CloudEndpoints {
11718        /// The name of the Cloud Endpoints service underlying this service.
11719        /// Corresponds to the `service` resource label in the [`api` monitored
11720        /// resource](https://cloud.google.com/monitoring/api/resources#tag_api).
11721        pub service: std::string::String,
11722
11723        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11724    }
11725
11726    impl CloudEndpoints {
11727        pub fn new() -> Self {
11728            std::default::Default::default()
11729        }
11730
11731        /// Sets the value of [service][crate::model::service::CloudEndpoints::service].
11732        ///
11733        /// # Example
11734        /// ```ignore,no_run
11735        /// # use google_cloud_monitoring_v3::model::service::CloudEndpoints;
11736        /// let x = CloudEndpoints::new().set_service("example");
11737        /// ```
11738        pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11739            self.service = v.into();
11740            self
11741        }
11742    }
11743
11744    impl wkt::message::Message for CloudEndpoints {
11745        fn typename() -> &'static str {
11746            "type.googleapis.com/google.monitoring.v3.Service.CloudEndpoints"
11747        }
11748    }
11749
11750    /// Istio service scoped to a single Kubernetes cluster. Learn more at
11751    /// <https://istio.io>. Clusters running OSS Istio will have their services
11752    /// ingested as this type.
11753    #[derive(Clone, Default, PartialEq)]
11754    #[non_exhaustive]
11755    pub struct ClusterIstio {
11756        /// The location of the Kubernetes cluster in which this Istio service is
11757        /// defined. Corresponds to the `location` resource label in `k8s_cluster`
11758        /// resources.
11759        pub location: std::string::String,
11760
11761        /// The name of the Kubernetes cluster in which this Istio service is
11762        /// defined. Corresponds to the `cluster_name` resource label in
11763        /// `k8s_cluster` resources.
11764        pub cluster_name: std::string::String,
11765
11766        /// The namespace of the Istio service underlying this service. Corresponds
11767        /// to the `destination_service_namespace` metric label in Istio metrics.
11768        pub service_namespace: std::string::String,
11769
11770        /// The name of the Istio service underlying this service. Corresponds to the
11771        /// `destination_service_name` metric label in Istio metrics.
11772        pub service_name: std::string::String,
11773
11774        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11775    }
11776
11777    impl ClusterIstio {
11778        pub fn new() -> Self {
11779            std::default::Default::default()
11780        }
11781
11782        /// Sets the value of [location][crate::model::service::ClusterIstio::location].
11783        ///
11784        /// # Example
11785        /// ```ignore,no_run
11786        /// # use google_cloud_monitoring_v3::model::service::ClusterIstio;
11787        /// let x = ClusterIstio::new().set_location("example");
11788        /// ```
11789        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11790            self.location = v.into();
11791            self
11792        }
11793
11794        /// Sets the value of [cluster_name][crate::model::service::ClusterIstio::cluster_name].
11795        ///
11796        /// # Example
11797        /// ```ignore,no_run
11798        /// # use google_cloud_monitoring_v3::model::service::ClusterIstio;
11799        /// let x = ClusterIstio::new().set_cluster_name("example");
11800        /// ```
11801        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
11802            mut self,
11803            v: T,
11804        ) -> Self {
11805            self.cluster_name = v.into();
11806            self
11807        }
11808
11809        /// Sets the value of [service_namespace][crate::model::service::ClusterIstio::service_namespace].
11810        ///
11811        /// # Example
11812        /// ```ignore,no_run
11813        /// # use google_cloud_monitoring_v3::model::service::ClusterIstio;
11814        /// let x = ClusterIstio::new().set_service_namespace("example");
11815        /// ```
11816        pub fn set_service_namespace<T: std::convert::Into<std::string::String>>(
11817            mut self,
11818            v: T,
11819        ) -> Self {
11820            self.service_namespace = v.into();
11821            self
11822        }
11823
11824        /// Sets the value of [service_name][crate::model::service::ClusterIstio::service_name].
11825        ///
11826        /// # Example
11827        /// ```ignore,no_run
11828        /// # use google_cloud_monitoring_v3::model::service::ClusterIstio;
11829        /// let x = ClusterIstio::new().set_service_name("example");
11830        /// ```
11831        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
11832            mut self,
11833            v: T,
11834        ) -> Self {
11835            self.service_name = v.into();
11836            self
11837        }
11838    }
11839
11840    impl wkt::message::Message for ClusterIstio {
11841        fn typename() -> &'static str {
11842            "type.googleapis.com/google.monitoring.v3.Service.ClusterIstio"
11843        }
11844    }
11845
11846    /// Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8
11847    /// will have their services ingested as this type.
11848    #[derive(Clone, Default, PartialEq)]
11849    #[non_exhaustive]
11850    pub struct MeshIstio {
11851        /// Identifier for the mesh in which this Istio service is defined.
11852        /// Corresponds to the `mesh_uid` metric label in Istio metrics.
11853        pub mesh_uid: std::string::String,
11854
11855        /// The namespace of the Istio service underlying this service. Corresponds
11856        /// to the `destination_service_namespace` metric label in Istio metrics.
11857        pub service_namespace: std::string::String,
11858
11859        /// The name of the Istio service underlying this service. Corresponds to the
11860        /// `destination_service_name` metric label in Istio metrics.
11861        pub service_name: std::string::String,
11862
11863        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11864    }
11865
11866    impl MeshIstio {
11867        pub fn new() -> Self {
11868            std::default::Default::default()
11869        }
11870
11871        /// Sets the value of [mesh_uid][crate::model::service::MeshIstio::mesh_uid].
11872        ///
11873        /// # Example
11874        /// ```ignore,no_run
11875        /// # use google_cloud_monitoring_v3::model::service::MeshIstio;
11876        /// let x = MeshIstio::new().set_mesh_uid("example");
11877        /// ```
11878        pub fn set_mesh_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11879            self.mesh_uid = v.into();
11880            self
11881        }
11882
11883        /// Sets the value of [service_namespace][crate::model::service::MeshIstio::service_namespace].
11884        ///
11885        /// # Example
11886        /// ```ignore,no_run
11887        /// # use google_cloud_monitoring_v3::model::service::MeshIstio;
11888        /// let x = MeshIstio::new().set_service_namespace("example");
11889        /// ```
11890        pub fn set_service_namespace<T: std::convert::Into<std::string::String>>(
11891            mut self,
11892            v: T,
11893        ) -> Self {
11894            self.service_namespace = v.into();
11895            self
11896        }
11897
11898        /// Sets the value of [service_name][crate::model::service::MeshIstio::service_name].
11899        ///
11900        /// # Example
11901        /// ```ignore,no_run
11902        /// # use google_cloud_monitoring_v3::model::service::MeshIstio;
11903        /// let x = MeshIstio::new().set_service_name("example");
11904        /// ```
11905        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
11906            mut self,
11907            v: T,
11908        ) -> Self {
11909            self.service_name = v.into();
11910            self
11911        }
11912    }
11913
11914    impl wkt::message::Message for MeshIstio {
11915        fn typename() -> &'static str {
11916            "type.googleapis.com/google.monitoring.v3.Service.MeshIstio"
11917        }
11918    }
11919
11920    /// Canonical service scoped to an Istio mesh. Anthos clusters running ASM >=
11921    /// 1.6.8 will have their services ingested as this type.
11922    #[derive(Clone, Default, PartialEq)]
11923    #[non_exhaustive]
11924    pub struct IstioCanonicalService {
11925        /// Identifier for the Istio mesh in which this canonical service is defined.
11926        /// Corresponds to the `mesh_uid` metric label in
11927        /// [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio).
11928        pub mesh_uid: std::string::String,
11929
11930        /// The namespace of the canonical service underlying this service.
11931        /// Corresponds to the `destination_canonical_service_namespace` metric
11932        /// label in [Istio
11933        /// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
11934        pub canonical_service_namespace: std::string::String,
11935
11936        /// The name of the canonical service underlying this service.
11937        /// Corresponds to the `destination_canonical_service_name` metric label in
11938        /// label in [Istio
11939        /// metrics](https://cloud.google.com/monitoring/api/metrics_istio).
11940        pub canonical_service: std::string::String,
11941
11942        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11943    }
11944
11945    impl IstioCanonicalService {
11946        pub fn new() -> Self {
11947            std::default::Default::default()
11948        }
11949
11950        /// Sets the value of [mesh_uid][crate::model::service::IstioCanonicalService::mesh_uid].
11951        ///
11952        /// # Example
11953        /// ```ignore,no_run
11954        /// # use google_cloud_monitoring_v3::model::service::IstioCanonicalService;
11955        /// let x = IstioCanonicalService::new().set_mesh_uid("example");
11956        /// ```
11957        pub fn set_mesh_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11958            self.mesh_uid = v.into();
11959            self
11960        }
11961
11962        /// Sets the value of [canonical_service_namespace][crate::model::service::IstioCanonicalService::canonical_service_namespace].
11963        ///
11964        /// # Example
11965        /// ```ignore,no_run
11966        /// # use google_cloud_monitoring_v3::model::service::IstioCanonicalService;
11967        /// let x = IstioCanonicalService::new().set_canonical_service_namespace("example");
11968        /// ```
11969        pub fn set_canonical_service_namespace<T: std::convert::Into<std::string::String>>(
11970            mut self,
11971            v: T,
11972        ) -> Self {
11973            self.canonical_service_namespace = v.into();
11974            self
11975        }
11976
11977        /// Sets the value of [canonical_service][crate::model::service::IstioCanonicalService::canonical_service].
11978        ///
11979        /// # Example
11980        /// ```ignore,no_run
11981        /// # use google_cloud_monitoring_v3::model::service::IstioCanonicalService;
11982        /// let x = IstioCanonicalService::new().set_canonical_service("example");
11983        /// ```
11984        pub fn set_canonical_service<T: std::convert::Into<std::string::String>>(
11985            mut self,
11986            v: T,
11987        ) -> Self {
11988            self.canonical_service = v.into();
11989            self
11990        }
11991    }
11992
11993    impl wkt::message::Message for IstioCanonicalService {
11994        fn typename() -> &'static str {
11995            "type.googleapis.com/google.monitoring.v3.Service.IstioCanonicalService"
11996        }
11997    }
11998
11999    /// Cloud Run service. Learn more at <https://cloud.google.com/run>.
12000    #[derive(Clone, Default, PartialEq)]
12001    #[non_exhaustive]
12002    pub struct CloudRun {
12003        /// The name of the Cloud Run service. Corresponds to the `service_name`
12004        /// resource label in the [`cloud_run_revision` monitored
12005        /// resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
12006        pub service_name: std::string::String,
12007
12008        /// The location the service is run. Corresponds to the `location`
12009        /// resource label in the [`cloud_run_revision` monitored
12010        /// resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
12011        pub location: std::string::String,
12012
12013        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12014    }
12015
12016    impl CloudRun {
12017        pub fn new() -> Self {
12018            std::default::Default::default()
12019        }
12020
12021        /// Sets the value of [service_name][crate::model::service::CloudRun::service_name].
12022        ///
12023        /// # Example
12024        /// ```ignore,no_run
12025        /// # use google_cloud_monitoring_v3::model::service::CloudRun;
12026        /// let x = CloudRun::new().set_service_name("example");
12027        /// ```
12028        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
12029            mut self,
12030            v: T,
12031        ) -> Self {
12032            self.service_name = v.into();
12033            self
12034        }
12035
12036        /// Sets the value of [location][crate::model::service::CloudRun::location].
12037        ///
12038        /// # Example
12039        /// ```ignore,no_run
12040        /// # use google_cloud_monitoring_v3::model::service::CloudRun;
12041        /// let x = CloudRun::new().set_location("example");
12042        /// ```
12043        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12044            self.location = v.into();
12045            self
12046        }
12047    }
12048
12049    impl wkt::message::Message for CloudRun {
12050        fn typename() -> &'static str {
12051            "type.googleapis.com/google.monitoring.v3.Service.CloudRun"
12052        }
12053    }
12054
12055    /// GKE Namespace. The field names correspond to the resource metadata labels
12056    /// on monitored resources that fall under a namespace (for example,
12057    /// `k8s_container` or `k8s_pod`).
12058    #[derive(Clone, Default, PartialEq)]
12059    #[non_exhaustive]
12060    pub struct GkeNamespace {
12061        /// Output only. The project this resource lives in. For legacy services
12062        /// migrated from the `Custom` type, this may be a distinct project from the
12063        /// one parenting the service itself.
12064        pub project_id: std::string::String,
12065
12066        /// The location of the parent cluster. This may be a zone or region.
12067        pub location: std::string::String,
12068
12069        /// The name of the parent cluster.
12070        pub cluster_name: std::string::String,
12071
12072        /// The name of this namespace.
12073        pub namespace_name: std::string::String,
12074
12075        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12076    }
12077
12078    impl GkeNamespace {
12079        pub fn new() -> Self {
12080            std::default::Default::default()
12081        }
12082
12083        /// Sets the value of [project_id][crate::model::service::GkeNamespace::project_id].
12084        ///
12085        /// # Example
12086        /// ```ignore,no_run
12087        /// # use google_cloud_monitoring_v3::model::service::GkeNamespace;
12088        /// let x = GkeNamespace::new().set_project_id("example");
12089        /// ```
12090        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12091            self.project_id = v.into();
12092            self
12093        }
12094
12095        /// Sets the value of [location][crate::model::service::GkeNamespace::location].
12096        ///
12097        /// # Example
12098        /// ```ignore,no_run
12099        /// # use google_cloud_monitoring_v3::model::service::GkeNamespace;
12100        /// let x = GkeNamespace::new().set_location("example");
12101        /// ```
12102        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12103            self.location = v.into();
12104            self
12105        }
12106
12107        /// Sets the value of [cluster_name][crate::model::service::GkeNamespace::cluster_name].
12108        ///
12109        /// # Example
12110        /// ```ignore,no_run
12111        /// # use google_cloud_monitoring_v3::model::service::GkeNamespace;
12112        /// let x = GkeNamespace::new().set_cluster_name("example");
12113        /// ```
12114        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
12115            mut self,
12116            v: T,
12117        ) -> Self {
12118            self.cluster_name = v.into();
12119            self
12120        }
12121
12122        /// Sets the value of [namespace_name][crate::model::service::GkeNamespace::namespace_name].
12123        ///
12124        /// # Example
12125        /// ```ignore,no_run
12126        /// # use google_cloud_monitoring_v3::model::service::GkeNamespace;
12127        /// let x = GkeNamespace::new().set_namespace_name("example");
12128        /// ```
12129        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
12130            mut self,
12131            v: T,
12132        ) -> Self {
12133            self.namespace_name = v.into();
12134            self
12135        }
12136    }
12137
12138    impl wkt::message::Message for GkeNamespace {
12139        fn typename() -> &'static str {
12140            "type.googleapis.com/google.monitoring.v3.Service.GkeNamespace"
12141        }
12142    }
12143
12144    /// A GKE Workload (Deployment, StatefulSet, etc). The field names correspond
12145    /// to the metadata labels on monitored resources that fall under a workload
12146    /// (for example, `k8s_container` or `k8s_pod`).
12147    #[derive(Clone, Default, PartialEq)]
12148    #[non_exhaustive]
12149    pub struct GkeWorkload {
12150        /// Output only. The project this resource lives in. For legacy services
12151        /// migrated from the `Custom` type, this may be a distinct project from the
12152        /// one parenting the service itself.
12153        pub project_id: std::string::String,
12154
12155        /// The location of the parent cluster. This may be a zone or region.
12156        pub location: std::string::String,
12157
12158        /// The name of the parent cluster.
12159        pub cluster_name: std::string::String,
12160
12161        /// The name of the parent namespace.
12162        pub namespace_name: std::string::String,
12163
12164        /// The type of this workload (for example, "Deployment" or "DaemonSet")
12165        pub top_level_controller_type: std::string::String,
12166
12167        /// The name of this workload.
12168        pub top_level_controller_name: std::string::String,
12169
12170        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12171    }
12172
12173    impl GkeWorkload {
12174        pub fn new() -> Self {
12175            std::default::Default::default()
12176        }
12177
12178        /// Sets the value of [project_id][crate::model::service::GkeWorkload::project_id].
12179        ///
12180        /// # Example
12181        /// ```ignore,no_run
12182        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12183        /// let x = GkeWorkload::new().set_project_id("example");
12184        /// ```
12185        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12186            self.project_id = v.into();
12187            self
12188        }
12189
12190        /// Sets the value of [location][crate::model::service::GkeWorkload::location].
12191        ///
12192        /// # Example
12193        /// ```ignore,no_run
12194        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12195        /// let x = GkeWorkload::new().set_location("example");
12196        /// ```
12197        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12198            self.location = v.into();
12199            self
12200        }
12201
12202        /// Sets the value of [cluster_name][crate::model::service::GkeWorkload::cluster_name].
12203        ///
12204        /// # Example
12205        /// ```ignore,no_run
12206        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12207        /// let x = GkeWorkload::new().set_cluster_name("example");
12208        /// ```
12209        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
12210            mut self,
12211            v: T,
12212        ) -> Self {
12213            self.cluster_name = v.into();
12214            self
12215        }
12216
12217        /// Sets the value of [namespace_name][crate::model::service::GkeWorkload::namespace_name].
12218        ///
12219        /// # Example
12220        /// ```ignore,no_run
12221        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12222        /// let x = GkeWorkload::new().set_namespace_name("example");
12223        /// ```
12224        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
12225            mut self,
12226            v: T,
12227        ) -> Self {
12228            self.namespace_name = v.into();
12229            self
12230        }
12231
12232        /// Sets the value of [top_level_controller_type][crate::model::service::GkeWorkload::top_level_controller_type].
12233        ///
12234        /// # Example
12235        /// ```ignore,no_run
12236        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12237        /// let x = GkeWorkload::new().set_top_level_controller_type("example");
12238        /// ```
12239        pub fn set_top_level_controller_type<T: std::convert::Into<std::string::String>>(
12240            mut self,
12241            v: T,
12242        ) -> Self {
12243            self.top_level_controller_type = v.into();
12244            self
12245        }
12246
12247        /// Sets the value of [top_level_controller_name][crate::model::service::GkeWorkload::top_level_controller_name].
12248        ///
12249        /// # Example
12250        /// ```ignore,no_run
12251        /// # use google_cloud_monitoring_v3::model::service::GkeWorkload;
12252        /// let x = GkeWorkload::new().set_top_level_controller_name("example");
12253        /// ```
12254        pub fn set_top_level_controller_name<T: std::convert::Into<std::string::String>>(
12255            mut self,
12256            v: T,
12257        ) -> Self {
12258            self.top_level_controller_name = v.into();
12259            self
12260        }
12261    }
12262
12263    impl wkt::message::Message for GkeWorkload {
12264        fn typename() -> &'static str {
12265            "type.googleapis.com/google.monitoring.v3.Service.GkeWorkload"
12266        }
12267    }
12268
12269    /// GKE Service. The "service" here represents a
12270    /// [Kubernetes service
12271    /// object](https://kubernetes.io/docs/concepts/services-networking/service).
12272    /// The field names correspond to the resource labels on [`k8s_service`
12273    /// monitored
12274    /// resources](https://cloud.google.com/monitoring/api/resources#tag_k8s_service).
12275    #[derive(Clone, Default, PartialEq)]
12276    #[non_exhaustive]
12277    pub struct GkeService {
12278        /// Output only. The project this resource lives in. For legacy services
12279        /// migrated from the `Custom` type, this may be a distinct project from the
12280        /// one parenting the service itself.
12281        pub project_id: std::string::String,
12282
12283        /// The location of the parent cluster. This may be a zone or region.
12284        pub location: std::string::String,
12285
12286        /// The name of the parent cluster.
12287        pub cluster_name: std::string::String,
12288
12289        /// The name of the parent namespace.
12290        pub namespace_name: std::string::String,
12291
12292        /// The name of this service.
12293        pub service_name: std::string::String,
12294
12295        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12296    }
12297
12298    impl GkeService {
12299        pub fn new() -> Self {
12300            std::default::Default::default()
12301        }
12302
12303        /// Sets the value of [project_id][crate::model::service::GkeService::project_id].
12304        ///
12305        /// # Example
12306        /// ```ignore,no_run
12307        /// # use google_cloud_monitoring_v3::model::service::GkeService;
12308        /// let x = GkeService::new().set_project_id("example");
12309        /// ```
12310        pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12311            self.project_id = v.into();
12312            self
12313        }
12314
12315        /// Sets the value of [location][crate::model::service::GkeService::location].
12316        ///
12317        /// # Example
12318        /// ```ignore,no_run
12319        /// # use google_cloud_monitoring_v3::model::service::GkeService;
12320        /// let x = GkeService::new().set_location("example");
12321        /// ```
12322        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12323            self.location = v.into();
12324            self
12325        }
12326
12327        /// Sets the value of [cluster_name][crate::model::service::GkeService::cluster_name].
12328        ///
12329        /// # Example
12330        /// ```ignore,no_run
12331        /// # use google_cloud_monitoring_v3::model::service::GkeService;
12332        /// let x = GkeService::new().set_cluster_name("example");
12333        /// ```
12334        pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(
12335            mut self,
12336            v: T,
12337        ) -> Self {
12338            self.cluster_name = v.into();
12339            self
12340        }
12341
12342        /// Sets the value of [namespace_name][crate::model::service::GkeService::namespace_name].
12343        ///
12344        /// # Example
12345        /// ```ignore,no_run
12346        /// # use google_cloud_monitoring_v3::model::service::GkeService;
12347        /// let x = GkeService::new().set_namespace_name("example");
12348        /// ```
12349        pub fn set_namespace_name<T: std::convert::Into<std::string::String>>(
12350            mut self,
12351            v: T,
12352        ) -> Self {
12353            self.namespace_name = v.into();
12354            self
12355        }
12356
12357        /// Sets the value of [service_name][crate::model::service::GkeService::service_name].
12358        ///
12359        /// # Example
12360        /// ```ignore,no_run
12361        /// # use google_cloud_monitoring_v3::model::service::GkeService;
12362        /// let x = GkeService::new().set_service_name("example");
12363        /// ```
12364        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
12365            mut self,
12366            v: T,
12367        ) -> Self {
12368            self.service_name = v.into();
12369            self
12370        }
12371    }
12372
12373    impl wkt::message::Message for GkeService {
12374        fn typename() -> &'static str {
12375            "type.googleapis.com/google.monitoring.v3.Service.GkeService"
12376        }
12377    }
12378
12379    /// A well-known service type, defined by its service type and service labels.
12380    /// Documentation and examples
12381    /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
12382    #[derive(Clone, Default, PartialEq)]
12383    #[non_exhaustive]
12384    pub struct BasicService {
12385        /// The type of service that this basic service defines, e.g.
12386        /// APP_ENGINE service type.
12387        /// Documentation and valid values
12388        /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
12389        pub service_type: std::string::String,
12390
12391        /// Labels that specify the resource that emits the monitoring data which
12392        /// is used for SLO reporting of this `Service`.
12393        /// Documentation and valid values for given service types
12394        /// [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
12395        pub service_labels: std::collections::HashMap<std::string::String, std::string::String>,
12396
12397        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12398    }
12399
12400    impl BasicService {
12401        pub fn new() -> Self {
12402            std::default::Default::default()
12403        }
12404
12405        /// Sets the value of [service_type][crate::model::service::BasicService::service_type].
12406        ///
12407        /// # Example
12408        /// ```ignore,no_run
12409        /// # use google_cloud_monitoring_v3::model::service::BasicService;
12410        /// let x = BasicService::new().set_service_type("example");
12411        /// ```
12412        pub fn set_service_type<T: std::convert::Into<std::string::String>>(
12413            mut self,
12414            v: T,
12415        ) -> Self {
12416            self.service_type = v.into();
12417            self
12418        }
12419
12420        /// Sets the value of [service_labels][crate::model::service::BasicService::service_labels].
12421        ///
12422        /// # Example
12423        /// ```ignore,no_run
12424        /// # use google_cloud_monitoring_v3::model::service::BasicService;
12425        /// let x = BasicService::new().set_service_labels([
12426        ///     ("key0", "abc"),
12427        ///     ("key1", "xyz"),
12428        /// ]);
12429        /// ```
12430        pub fn set_service_labels<T, K, V>(mut self, v: T) -> Self
12431        where
12432            T: std::iter::IntoIterator<Item = (K, V)>,
12433            K: std::convert::Into<std::string::String>,
12434            V: std::convert::Into<std::string::String>,
12435        {
12436            use std::iter::Iterator;
12437            self.service_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12438            self
12439        }
12440    }
12441
12442    impl wkt::message::Message for BasicService {
12443        fn typename() -> &'static str {
12444            "type.googleapis.com/google.monitoring.v3.Service.BasicService"
12445        }
12446    }
12447
12448    /// Configuration for how to query telemetry on a Service.
12449    #[derive(Clone, Default, PartialEq)]
12450    #[non_exhaustive]
12451    pub struct Telemetry {
12452        /// The full name of the resource that defines this service. Formatted as
12453        /// described in <https://cloud.google.com/apis/design/resource_names>.
12454        pub resource_name: std::string::String,
12455
12456        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12457    }
12458
12459    impl Telemetry {
12460        pub fn new() -> Self {
12461            std::default::Default::default()
12462        }
12463
12464        /// Sets the value of [resource_name][crate::model::service::Telemetry::resource_name].
12465        ///
12466        /// # Example
12467        /// ```ignore,no_run
12468        /// # use google_cloud_monitoring_v3::model::service::Telemetry;
12469        /// let x = Telemetry::new().set_resource_name("example");
12470        /// ```
12471        pub fn set_resource_name<T: std::convert::Into<std::string::String>>(
12472            mut self,
12473            v: T,
12474        ) -> Self {
12475            self.resource_name = v.into();
12476            self
12477        }
12478    }
12479
12480    impl wkt::message::Message for Telemetry {
12481        fn typename() -> &'static str {
12482            "type.googleapis.com/google.monitoring.v3.Service.Telemetry"
12483        }
12484    }
12485
12486    /// REQUIRED. Service-identifying atoms specifying the underlying service.
12487    #[derive(Clone, Debug, PartialEq)]
12488    #[non_exhaustive]
12489    pub enum Identifier {
12490        /// Custom service type.
12491        Custom(std::boxed::Box<crate::model::service::Custom>),
12492        /// Type used for App Engine services.
12493        AppEngine(std::boxed::Box<crate::model::service::AppEngine>),
12494        /// Type used for Cloud Endpoints services.
12495        CloudEndpoints(std::boxed::Box<crate::model::service::CloudEndpoints>),
12496        /// Type used for Istio services that live in a Kubernetes cluster.
12497        ClusterIstio(std::boxed::Box<crate::model::service::ClusterIstio>),
12498        /// Type used for Istio services scoped to an Istio mesh.
12499        MeshIstio(std::boxed::Box<crate::model::service::MeshIstio>),
12500        /// Type used for canonical services scoped to an Istio mesh.
12501        /// Metrics for Istio are
12502        /// [documented here](https://istio.io/latest/docs/reference/config/metrics/)
12503        IstioCanonicalService(std::boxed::Box<crate::model::service::IstioCanonicalService>),
12504        /// Type used for Cloud Run services.
12505        CloudRun(std::boxed::Box<crate::model::service::CloudRun>),
12506        /// Type used for GKE Namespaces.
12507        GkeNamespace(std::boxed::Box<crate::model::service::GkeNamespace>),
12508        /// Type used for GKE Workloads.
12509        GkeWorkload(std::boxed::Box<crate::model::service::GkeWorkload>),
12510        /// Type used for GKE Services (the Kubernetes concept of a service).
12511        GkeService(std::boxed::Box<crate::model::service::GkeService>),
12512    }
12513}
12514
12515/// A Service-Level Objective (SLO) describes a level of desired good service. It
12516/// consists of a service-level indicator (SLI), a performance goal, and a period
12517/// over which the objective is to be evaluated against that goal. The SLO can
12518/// use SLIs defined in a number of different manners. Typical SLOs might include
12519/// "99% of requests in each rolling week have latency below 200 milliseconds" or
12520/// "99.5% of requests in each calendar month return successfully."
12521#[derive(Clone, Default, PartialEq)]
12522#[non_exhaustive]
12523pub struct ServiceLevelObjective {
12524    /// Identifier. Resource name for this `ServiceLevelObjective`. The format is:
12525    ///
12526    /// ```norust
12527    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
12528    /// ```
12529    pub name: std::string::String,
12530
12531    /// Name used for UI elements listing this SLO.
12532    pub display_name: std::string::String,
12533
12534    /// The definition of good service, used to measure and calculate the quality
12535    /// of the `Service`'s performance with respect to a single aspect of service
12536    /// quality.
12537    pub service_level_indicator: std::option::Option<crate::model::ServiceLevelIndicator>,
12538
12539    /// The fraction of service that must be good in order for this objective to be
12540    /// met. `0 < goal <= 0.9999`.
12541    pub goal: f64,
12542
12543    /// Labels which have been used to annotate the service-level objective. Label
12544    /// keys must start with a letter. Label keys and values may contain lowercase
12545    /// letters, numbers, underscores, and dashes. Label keys and values have a
12546    /// maximum length of 63 characters, and must be less than 128 bytes in size.
12547    /// Up to 64 label entries may be stored. For labels which do not have a
12548    /// semantic value, the empty string may be supplied for the label value.
12549    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
12550
12551    /// The time period over which the objective will be evaluated.
12552    pub period: std::option::Option<crate::model::service_level_objective::Period>,
12553
12554    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12555}
12556
12557impl ServiceLevelObjective {
12558    pub fn new() -> Self {
12559        std::default::Default::default()
12560    }
12561
12562    /// Sets the value of [name][crate::model::ServiceLevelObjective::name].
12563    ///
12564    /// # Example
12565    /// ```ignore,no_run
12566    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12567    /// let x = ServiceLevelObjective::new().set_name("example");
12568    /// ```
12569    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12570        self.name = v.into();
12571        self
12572    }
12573
12574    /// Sets the value of [display_name][crate::model::ServiceLevelObjective::display_name].
12575    ///
12576    /// # Example
12577    /// ```ignore,no_run
12578    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12579    /// let x = ServiceLevelObjective::new().set_display_name("example");
12580    /// ```
12581    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12582        self.display_name = v.into();
12583        self
12584    }
12585
12586    /// Sets the value of [service_level_indicator][crate::model::ServiceLevelObjective::service_level_indicator].
12587    ///
12588    /// # Example
12589    /// ```ignore,no_run
12590    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12591    /// use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
12592    /// let x = ServiceLevelObjective::new().set_service_level_indicator(ServiceLevelIndicator::default()/* use setters */);
12593    /// ```
12594    pub fn set_service_level_indicator<T>(mut self, v: T) -> Self
12595    where
12596        T: std::convert::Into<crate::model::ServiceLevelIndicator>,
12597    {
12598        self.service_level_indicator = std::option::Option::Some(v.into());
12599        self
12600    }
12601
12602    /// Sets or clears the value of [service_level_indicator][crate::model::ServiceLevelObjective::service_level_indicator].
12603    ///
12604    /// # Example
12605    /// ```ignore,no_run
12606    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12607    /// use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
12608    /// let x = ServiceLevelObjective::new().set_or_clear_service_level_indicator(Some(ServiceLevelIndicator::default()/* use setters */));
12609    /// let x = ServiceLevelObjective::new().set_or_clear_service_level_indicator(None::<ServiceLevelIndicator>);
12610    /// ```
12611    pub fn set_or_clear_service_level_indicator<T>(mut self, v: std::option::Option<T>) -> Self
12612    where
12613        T: std::convert::Into<crate::model::ServiceLevelIndicator>,
12614    {
12615        self.service_level_indicator = v.map(|x| x.into());
12616        self
12617    }
12618
12619    /// Sets the value of [goal][crate::model::ServiceLevelObjective::goal].
12620    ///
12621    /// # Example
12622    /// ```ignore,no_run
12623    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12624    /// let x = ServiceLevelObjective::new().set_goal(42.0);
12625    /// ```
12626    pub fn set_goal<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
12627        self.goal = v.into();
12628        self
12629    }
12630
12631    /// Sets the value of [user_labels][crate::model::ServiceLevelObjective::user_labels].
12632    ///
12633    /// # Example
12634    /// ```ignore,no_run
12635    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12636    /// let x = ServiceLevelObjective::new().set_user_labels([
12637    ///     ("key0", "abc"),
12638    ///     ("key1", "xyz"),
12639    /// ]);
12640    /// ```
12641    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12642    where
12643        T: std::iter::IntoIterator<Item = (K, V)>,
12644        K: std::convert::Into<std::string::String>,
12645        V: std::convert::Into<std::string::String>,
12646    {
12647        use std::iter::Iterator;
12648        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12649        self
12650    }
12651
12652    /// Sets the value of [period][crate::model::ServiceLevelObjective::period].
12653    ///
12654    /// Note that all the setters affecting `period` are mutually
12655    /// exclusive.
12656    ///
12657    /// # Example
12658    /// ```ignore,no_run
12659    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12660    /// use gtype::model::CalendarPeriod;
12661    /// let x0 = ServiceLevelObjective::new().set_period(Some(
12662    ///     google_cloud_monitoring_v3::model::service_level_objective::Period::CalendarPeriod(CalendarPeriod::Day)));
12663    /// let x1 = ServiceLevelObjective::new().set_period(Some(
12664    ///     google_cloud_monitoring_v3::model::service_level_objective::Period::CalendarPeriod(CalendarPeriod::Week)));
12665    /// let x2 = ServiceLevelObjective::new().set_period(Some(
12666    ///     google_cloud_monitoring_v3::model::service_level_objective::Period::CalendarPeriod(CalendarPeriod::Fortnight)));
12667    /// ```
12668    pub fn set_period<
12669        T: std::convert::Into<std::option::Option<crate::model::service_level_objective::Period>>,
12670    >(
12671        mut self,
12672        v: T,
12673    ) -> Self {
12674        self.period = v.into();
12675        self
12676    }
12677
12678    /// The value of [period][crate::model::ServiceLevelObjective::period]
12679    /// if it holds a `RollingPeriod`, `None` if the field is not set or
12680    /// holds a different branch.
12681    pub fn rolling_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
12682        #[allow(unreachable_patterns)]
12683        self.period.as_ref().and_then(|v| match v {
12684            crate::model::service_level_objective::Period::RollingPeriod(v) => {
12685                std::option::Option::Some(v)
12686            }
12687            _ => std::option::Option::None,
12688        })
12689    }
12690
12691    /// Sets the value of [period][crate::model::ServiceLevelObjective::period]
12692    /// to hold a `RollingPeriod`.
12693    ///
12694    /// Note that all the setters affecting `period` are
12695    /// mutually exclusive.
12696    ///
12697    /// # Example
12698    /// ```ignore,no_run
12699    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12700    /// use wkt::Duration;
12701    /// let x = ServiceLevelObjective::new().set_rolling_period(Duration::default()/* use setters */);
12702    /// assert!(x.rolling_period().is_some());
12703    /// assert!(x.calendar_period().is_none());
12704    /// ```
12705    pub fn set_rolling_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
12706        mut self,
12707        v: T,
12708    ) -> Self {
12709        self.period = std::option::Option::Some(
12710            crate::model::service_level_objective::Period::RollingPeriod(v.into()),
12711        );
12712        self
12713    }
12714
12715    /// The value of [period][crate::model::ServiceLevelObjective::period]
12716    /// if it holds a `CalendarPeriod`, `None` if the field is not set or
12717    /// holds a different branch.
12718    pub fn calendar_period(&self) -> std::option::Option<&gtype::model::CalendarPeriod> {
12719        #[allow(unreachable_patterns)]
12720        self.period.as_ref().and_then(|v| match v {
12721            crate::model::service_level_objective::Period::CalendarPeriod(v) => {
12722                std::option::Option::Some(v)
12723            }
12724            _ => std::option::Option::None,
12725        })
12726    }
12727
12728    /// Sets the value of [period][crate::model::ServiceLevelObjective::period]
12729    /// to hold a `CalendarPeriod`.
12730    ///
12731    /// Note that all the setters affecting `period` are
12732    /// mutually exclusive.
12733    ///
12734    /// # Example
12735    /// ```ignore,no_run
12736    /// # use google_cloud_monitoring_v3::model::ServiceLevelObjective;
12737    /// use gtype::model::CalendarPeriod;
12738    /// let x0 = ServiceLevelObjective::new().set_calendar_period(CalendarPeriod::Day);
12739    /// let x1 = ServiceLevelObjective::new().set_calendar_period(CalendarPeriod::Week);
12740    /// let x2 = ServiceLevelObjective::new().set_calendar_period(CalendarPeriod::Fortnight);
12741    /// assert!(x0.calendar_period().is_some());
12742    /// assert!(x0.rolling_period().is_none());
12743    /// assert!(x1.calendar_period().is_some());
12744    /// assert!(x1.rolling_period().is_none());
12745    /// assert!(x2.calendar_period().is_some());
12746    /// assert!(x2.rolling_period().is_none());
12747    /// ```
12748    pub fn set_calendar_period<T: std::convert::Into<gtype::model::CalendarPeriod>>(
12749        mut self,
12750        v: T,
12751    ) -> Self {
12752        self.period = std::option::Option::Some(
12753            crate::model::service_level_objective::Period::CalendarPeriod(v.into()),
12754        );
12755        self
12756    }
12757}
12758
12759impl wkt::message::Message for ServiceLevelObjective {
12760    fn typename() -> &'static str {
12761        "type.googleapis.com/google.monitoring.v3.ServiceLevelObjective"
12762    }
12763}
12764
12765/// Defines additional types related to [ServiceLevelObjective].
12766pub mod service_level_objective {
12767    #[allow(unused_imports)]
12768    use super::*;
12769
12770    /// `ServiceLevelObjective.View` determines what form of
12771    /// `ServiceLevelObjective` is returned from `GetServiceLevelObjective`,
12772    /// `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs.
12773    ///
12774    /// # Working with unknown values
12775    ///
12776    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12777    /// additional enum variants at any time. Adding new variants is not considered
12778    /// a breaking change. Applications should write their code in anticipation of:
12779    ///
12780    /// - New values appearing in future releases of the client library, **and**
12781    /// - New values received dynamically, without application changes.
12782    ///
12783    /// Please consult the [Working with enums] section in the user guide for some
12784    /// guidelines.
12785    ///
12786    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12787    #[derive(Clone, Debug, PartialEq)]
12788    #[non_exhaustive]
12789    pub enum View {
12790        /// Same as FULL.
12791        Unspecified,
12792        /// Return the embedded `ServiceLevelIndicator` in the form in which it was
12793        /// defined. If it was defined using a `BasicSli`, return that `BasicSli`.
12794        Full,
12795        /// For `ServiceLevelIndicator`s using `BasicSli` articulation, instead
12796        /// return the `ServiceLevelIndicator` with its mode of computation fully
12797        /// spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using
12798        /// `RequestBasedSli` or `WindowsBasedSli`, return the
12799        /// `ServiceLevelIndicator` as it was provided.
12800        Explicit,
12801        /// If set, the enum was initialized with an unknown value.
12802        ///
12803        /// Applications can examine the value using [View::value] or
12804        /// [View::name].
12805        UnknownValue(view::UnknownValue),
12806    }
12807
12808    #[doc(hidden)]
12809    pub mod view {
12810        #[allow(unused_imports)]
12811        use super::*;
12812        #[derive(Clone, Debug, PartialEq)]
12813        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12814    }
12815
12816    impl View {
12817        /// Gets the enum value.
12818        ///
12819        /// Returns `None` if the enum contains an unknown value deserialized from
12820        /// the string representation of enums.
12821        pub fn value(&self) -> std::option::Option<i32> {
12822            match self {
12823                Self::Unspecified => std::option::Option::Some(0),
12824                Self::Full => std::option::Option::Some(2),
12825                Self::Explicit => std::option::Option::Some(1),
12826                Self::UnknownValue(u) => u.0.value(),
12827            }
12828        }
12829
12830        /// Gets the enum value as a string.
12831        ///
12832        /// Returns `None` if the enum contains an unknown value deserialized from
12833        /// the integer representation of enums.
12834        pub fn name(&self) -> std::option::Option<&str> {
12835            match self {
12836                Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
12837                Self::Full => std::option::Option::Some("FULL"),
12838                Self::Explicit => std::option::Option::Some("EXPLICIT"),
12839                Self::UnknownValue(u) => u.0.name(),
12840            }
12841        }
12842    }
12843
12844    impl std::default::Default for View {
12845        fn default() -> Self {
12846            use std::convert::From;
12847            Self::from(0)
12848        }
12849    }
12850
12851    impl std::fmt::Display for View {
12852        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12853            wkt::internal::display_enum(f, self.name(), self.value())
12854        }
12855    }
12856
12857    impl std::convert::From<i32> for View {
12858        fn from(value: i32) -> Self {
12859            match value {
12860                0 => Self::Unspecified,
12861                1 => Self::Explicit,
12862                2 => Self::Full,
12863                _ => Self::UnknownValue(view::UnknownValue(
12864                    wkt::internal::UnknownEnumValue::Integer(value),
12865                )),
12866            }
12867        }
12868    }
12869
12870    impl std::convert::From<&str> for View {
12871        fn from(value: &str) -> Self {
12872            use std::string::ToString;
12873            match value {
12874                "VIEW_UNSPECIFIED" => Self::Unspecified,
12875                "FULL" => Self::Full,
12876                "EXPLICIT" => Self::Explicit,
12877                _ => Self::UnknownValue(view::UnknownValue(
12878                    wkt::internal::UnknownEnumValue::String(value.to_string()),
12879                )),
12880            }
12881        }
12882    }
12883
12884    impl serde::ser::Serialize for View {
12885        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12886        where
12887            S: serde::Serializer,
12888        {
12889            match self {
12890                Self::Unspecified => serializer.serialize_i32(0),
12891                Self::Full => serializer.serialize_i32(2),
12892                Self::Explicit => serializer.serialize_i32(1),
12893                Self::UnknownValue(u) => u.0.serialize(serializer),
12894            }
12895        }
12896    }
12897
12898    impl<'de> serde::de::Deserialize<'de> for View {
12899        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12900        where
12901            D: serde::Deserializer<'de>,
12902        {
12903            deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
12904                ".google.monitoring.v3.ServiceLevelObjective.View",
12905            ))
12906        }
12907    }
12908
12909    /// The time period over which the objective will be evaluated.
12910    #[derive(Clone, Debug, PartialEq)]
12911    #[non_exhaustive]
12912    pub enum Period {
12913        /// A rolling time period, semantically "in the past `<rolling_period>`".
12914        /// Must be an integer multiple of 1 day no larger than 30 days.
12915        RollingPeriod(std::boxed::Box<wkt::Duration>),
12916        /// A calendar period, semantically "since the start of the current
12917        /// `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
12918        /// `MONTH` are supported.
12919        CalendarPeriod(gtype::model::CalendarPeriod),
12920    }
12921}
12922
12923/// A Service-Level Indicator (SLI) describes the "performance" of a service. For
12924/// some services, the SLI is well-defined. In such cases, the SLI can be
12925/// described easily by referencing the well-known SLI and providing the needed
12926/// parameters. Alternatively, a "custom" SLI can be defined with a query to the
12927/// underlying metric store. An SLI is defined to be `good_service /
12928/// total_service` over any queried time interval. The value of performance
12929/// always falls into the range `0 <= performance <= 1`. A custom SLI describes
12930/// how to compute this ratio, whether this is by dividing values from a pair of
12931/// time series, cutting a `Distribution` into good and bad counts, or counting
12932/// time windows in which the service complies with a criterion. For separation
12933/// of concerns, a single Service-Level Indicator measures performance for only
12934/// one aspect of service quality, such as fraction of successful queries or
12935/// fast-enough queries.
12936#[derive(Clone, Default, PartialEq)]
12937#[non_exhaustive]
12938pub struct ServiceLevelIndicator {
12939    /// Service level indicators can be grouped by whether the "unit" of service
12940    /// being measured is based on counts of good requests or on counts of good
12941    /// time windows
12942    pub r#type: std::option::Option<crate::model::service_level_indicator::Type>,
12943
12944    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12945}
12946
12947impl ServiceLevelIndicator {
12948    pub fn new() -> Self {
12949        std::default::Default::default()
12950    }
12951
12952    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::type].
12953    ///
12954    /// Note that all the setters affecting `r#type` are mutually
12955    /// exclusive.
12956    ///
12957    /// # Example
12958    /// ```ignore,no_run
12959    /// # use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
12960    /// use google_cloud_monitoring_v3::model::BasicSli;
12961    /// let x = ServiceLevelIndicator::new().set_type(Some(
12962    ///     google_cloud_monitoring_v3::model::service_level_indicator::Type::BasicSli(BasicSli::default().into())));
12963    /// ```
12964    pub fn set_type<
12965        T: std::convert::Into<std::option::Option<crate::model::service_level_indicator::Type>>,
12966    >(
12967        mut self,
12968        v: T,
12969    ) -> Self {
12970        self.r#type = v.into();
12971        self
12972    }
12973
12974    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
12975    /// if it holds a `BasicSli`, `None` if the field is not set or
12976    /// holds a different branch.
12977    pub fn basic_sli(&self) -> std::option::Option<&std::boxed::Box<crate::model::BasicSli>> {
12978        #[allow(unreachable_patterns)]
12979        self.r#type.as_ref().and_then(|v| match v {
12980            crate::model::service_level_indicator::Type::BasicSli(v) => {
12981                std::option::Option::Some(v)
12982            }
12983            _ => std::option::Option::None,
12984        })
12985    }
12986
12987    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
12988    /// to hold a `BasicSli`.
12989    ///
12990    /// Note that all the setters affecting `r#type` are
12991    /// mutually exclusive.
12992    ///
12993    /// # Example
12994    /// ```ignore,no_run
12995    /// # use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
12996    /// use google_cloud_monitoring_v3::model::BasicSli;
12997    /// let x = ServiceLevelIndicator::new().set_basic_sli(BasicSli::default()/* use setters */);
12998    /// assert!(x.basic_sli().is_some());
12999    /// assert!(x.request_based().is_none());
13000    /// assert!(x.windows_based().is_none());
13001    /// ```
13002    pub fn set_basic_sli<T: std::convert::Into<std::boxed::Box<crate::model::BasicSli>>>(
13003        mut self,
13004        v: T,
13005    ) -> Self {
13006        self.r#type = std::option::Option::Some(
13007            crate::model::service_level_indicator::Type::BasicSli(v.into()),
13008        );
13009        self
13010    }
13011
13012    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
13013    /// if it holds a `RequestBased`, `None` if the field is not set or
13014    /// holds a different branch.
13015    pub fn request_based(
13016        &self,
13017    ) -> std::option::Option<&std::boxed::Box<crate::model::RequestBasedSli>> {
13018        #[allow(unreachable_patterns)]
13019        self.r#type.as_ref().and_then(|v| match v {
13020            crate::model::service_level_indicator::Type::RequestBased(v) => {
13021                std::option::Option::Some(v)
13022            }
13023            _ => std::option::Option::None,
13024        })
13025    }
13026
13027    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
13028    /// to hold a `RequestBased`.
13029    ///
13030    /// Note that all the setters affecting `r#type` are
13031    /// mutually exclusive.
13032    ///
13033    /// # Example
13034    /// ```ignore,no_run
13035    /// # use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
13036    /// use google_cloud_monitoring_v3::model::RequestBasedSli;
13037    /// let x = ServiceLevelIndicator::new().set_request_based(RequestBasedSli::default()/* use setters */);
13038    /// assert!(x.request_based().is_some());
13039    /// assert!(x.basic_sli().is_none());
13040    /// assert!(x.windows_based().is_none());
13041    /// ```
13042    pub fn set_request_based<
13043        T: std::convert::Into<std::boxed::Box<crate::model::RequestBasedSli>>,
13044    >(
13045        mut self,
13046        v: T,
13047    ) -> Self {
13048        self.r#type = std::option::Option::Some(
13049            crate::model::service_level_indicator::Type::RequestBased(v.into()),
13050        );
13051        self
13052    }
13053
13054    /// The value of [r#type][crate::model::ServiceLevelIndicator::r#type]
13055    /// if it holds a `WindowsBased`, `None` if the field is not set or
13056    /// holds a different branch.
13057    pub fn windows_based(
13058        &self,
13059    ) -> std::option::Option<&std::boxed::Box<crate::model::WindowsBasedSli>> {
13060        #[allow(unreachable_patterns)]
13061        self.r#type.as_ref().and_then(|v| match v {
13062            crate::model::service_level_indicator::Type::WindowsBased(v) => {
13063                std::option::Option::Some(v)
13064            }
13065            _ => std::option::Option::None,
13066        })
13067    }
13068
13069    /// Sets the value of [r#type][crate::model::ServiceLevelIndicator::r#type]
13070    /// to hold a `WindowsBased`.
13071    ///
13072    /// Note that all the setters affecting `r#type` are
13073    /// mutually exclusive.
13074    ///
13075    /// # Example
13076    /// ```ignore,no_run
13077    /// # use google_cloud_monitoring_v3::model::ServiceLevelIndicator;
13078    /// use google_cloud_monitoring_v3::model::WindowsBasedSli;
13079    /// let x = ServiceLevelIndicator::new().set_windows_based(WindowsBasedSli::default()/* use setters */);
13080    /// assert!(x.windows_based().is_some());
13081    /// assert!(x.basic_sli().is_none());
13082    /// assert!(x.request_based().is_none());
13083    /// ```
13084    pub fn set_windows_based<
13085        T: std::convert::Into<std::boxed::Box<crate::model::WindowsBasedSli>>,
13086    >(
13087        mut self,
13088        v: T,
13089    ) -> Self {
13090        self.r#type = std::option::Option::Some(
13091            crate::model::service_level_indicator::Type::WindowsBased(v.into()),
13092        );
13093        self
13094    }
13095}
13096
13097impl wkt::message::Message for ServiceLevelIndicator {
13098    fn typename() -> &'static str {
13099        "type.googleapis.com/google.monitoring.v3.ServiceLevelIndicator"
13100    }
13101}
13102
13103/// Defines additional types related to [ServiceLevelIndicator].
13104pub mod service_level_indicator {
13105    #[allow(unused_imports)]
13106    use super::*;
13107
13108    /// Service level indicators can be grouped by whether the "unit" of service
13109    /// being measured is based on counts of good requests or on counts of good
13110    /// time windows
13111    #[derive(Clone, Debug, PartialEq)]
13112    #[non_exhaustive]
13113    pub enum Type {
13114        /// Basic SLI on a well-known service type.
13115        BasicSli(std::boxed::Box<crate::model::BasicSli>),
13116        /// Request-based SLIs
13117        RequestBased(std::boxed::Box<crate::model::RequestBasedSli>),
13118        /// Windows-based SLIs
13119        WindowsBased(std::boxed::Box<crate::model::WindowsBasedSli>),
13120    }
13121}
13122
13123/// An SLI measuring performance on a well-known service type. Performance will
13124/// be computed on the basis of pre-defined metrics. The type of the
13125/// `service_resource` determines the metrics to use and the
13126/// `service_resource.labels` and `metric_labels` are used to construct a
13127/// monitoring filter to filter that metric down to just the data relevant to
13128/// this service.
13129#[derive(Clone, Default, PartialEq)]
13130#[non_exhaustive]
13131pub struct BasicSli {
13132    /// OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from
13133    /// other methods will not be used to calculate performance for this SLI. If
13134    /// omitted, this SLI applies to all the Service's methods. For service types
13135    /// that don't support breaking down by method, setting this field will result
13136    /// in an error.
13137    pub method: std::vec::Vec<std::string::String>,
13138
13139    /// OPTIONAL: The set of locations to which this SLI is relevant. Telemetry
13140    /// from other locations will not be used to calculate performance for this
13141    /// SLI. If omitted, this SLI applies to all locations in which the Service has
13142    /// activity. For service types that don't support breaking down by location,
13143    /// setting this field will result in an error.
13144    pub location: std::vec::Vec<std::string::String>,
13145
13146    /// OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry
13147    /// from other API versions will not be used to calculate performance for this
13148    /// SLI. If omitted, this SLI applies to all API versions. For service types
13149    /// that don't support breaking down by version, setting this field will result
13150    /// in an error.
13151    pub version: std::vec::Vec<std::string::String>,
13152
13153    /// This SLI can be evaluated on the basis of availability or latency.
13154    pub sli_criteria: std::option::Option<crate::model::basic_sli::SliCriteria>,
13155
13156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13157}
13158
13159impl BasicSli {
13160    pub fn new() -> Self {
13161        std::default::Default::default()
13162    }
13163
13164    /// Sets the value of [method][crate::model::BasicSli::method].
13165    ///
13166    /// # Example
13167    /// ```ignore,no_run
13168    /// # use google_cloud_monitoring_v3::model::BasicSli;
13169    /// let x = BasicSli::new().set_method(["a", "b", "c"]);
13170    /// ```
13171    pub fn set_method<T, V>(mut self, v: T) -> Self
13172    where
13173        T: std::iter::IntoIterator<Item = V>,
13174        V: std::convert::Into<std::string::String>,
13175    {
13176        use std::iter::Iterator;
13177        self.method = v.into_iter().map(|i| i.into()).collect();
13178        self
13179    }
13180
13181    /// Sets the value of [location][crate::model::BasicSli::location].
13182    ///
13183    /// # Example
13184    /// ```ignore,no_run
13185    /// # use google_cloud_monitoring_v3::model::BasicSli;
13186    /// let x = BasicSli::new().set_location(["a", "b", "c"]);
13187    /// ```
13188    pub fn set_location<T, V>(mut self, v: T) -> Self
13189    where
13190        T: std::iter::IntoIterator<Item = V>,
13191        V: std::convert::Into<std::string::String>,
13192    {
13193        use std::iter::Iterator;
13194        self.location = v.into_iter().map(|i| i.into()).collect();
13195        self
13196    }
13197
13198    /// Sets the value of [version][crate::model::BasicSli::version].
13199    ///
13200    /// # Example
13201    /// ```ignore,no_run
13202    /// # use google_cloud_monitoring_v3::model::BasicSli;
13203    /// let x = BasicSli::new().set_version(["a", "b", "c"]);
13204    /// ```
13205    pub fn set_version<T, V>(mut self, v: T) -> Self
13206    where
13207        T: std::iter::IntoIterator<Item = V>,
13208        V: std::convert::Into<std::string::String>,
13209    {
13210        use std::iter::Iterator;
13211        self.version = v.into_iter().map(|i| i.into()).collect();
13212        self
13213    }
13214
13215    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria].
13216    ///
13217    /// Note that all the setters affecting `sli_criteria` are mutually
13218    /// exclusive.
13219    ///
13220    /// # Example
13221    /// ```ignore,no_run
13222    /// # use google_cloud_monitoring_v3::model::BasicSli;
13223    /// use google_cloud_monitoring_v3::model::basic_sli::AvailabilityCriteria;
13224    /// let x = BasicSli::new().set_sli_criteria(Some(
13225    ///     google_cloud_monitoring_v3::model::basic_sli::SliCriteria::Availability(AvailabilityCriteria::default().into())));
13226    /// ```
13227    pub fn set_sli_criteria<
13228        T: std::convert::Into<std::option::Option<crate::model::basic_sli::SliCriteria>>,
13229    >(
13230        mut self,
13231        v: T,
13232    ) -> Self {
13233        self.sli_criteria = v.into();
13234        self
13235    }
13236
13237    /// The value of [sli_criteria][crate::model::BasicSli::sli_criteria]
13238    /// if it holds a `Availability`, `None` if the field is not set or
13239    /// holds a different branch.
13240    pub fn availability(
13241        &self,
13242    ) -> std::option::Option<&std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>> {
13243        #[allow(unreachable_patterns)]
13244        self.sli_criteria.as_ref().and_then(|v| match v {
13245            crate::model::basic_sli::SliCriteria::Availability(v) => std::option::Option::Some(v),
13246            _ => std::option::Option::None,
13247        })
13248    }
13249
13250    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria]
13251    /// to hold a `Availability`.
13252    ///
13253    /// Note that all the setters affecting `sli_criteria` are
13254    /// mutually exclusive.
13255    ///
13256    /// # Example
13257    /// ```ignore,no_run
13258    /// # use google_cloud_monitoring_v3::model::BasicSli;
13259    /// use google_cloud_monitoring_v3::model::basic_sli::AvailabilityCriteria;
13260    /// let x = BasicSli::new().set_availability(AvailabilityCriteria::default()/* use setters */);
13261    /// assert!(x.availability().is_some());
13262    /// assert!(x.latency().is_none());
13263    /// ```
13264    pub fn set_availability<
13265        T: std::convert::Into<std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>>,
13266    >(
13267        mut self,
13268        v: T,
13269    ) -> Self {
13270        self.sli_criteria =
13271            std::option::Option::Some(crate::model::basic_sli::SliCriteria::Availability(v.into()));
13272        self
13273    }
13274
13275    /// The value of [sli_criteria][crate::model::BasicSli::sli_criteria]
13276    /// if it holds a `Latency`, `None` if the field is not set or
13277    /// holds a different branch.
13278    pub fn latency(
13279        &self,
13280    ) -> std::option::Option<&std::boxed::Box<crate::model::basic_sli::LatencyCriteria>> {
13281        #[allow(unreachable_patterns)]
13282        self.sli_criteria.as_ref().and_then(|v| match v {
13283            crate::model::basic_sli::SliCriteria::Latency(v) => std::option::Option::Some(v),
13284            _ => std::option::Option::None,
13285        })
13286    }
13287
13288    /// Sets the value of [sli_criteria][crate::model::BasicSli::sli_criteria]
13289    /// to hold a `Latency`.
13290    ///
13291    /// Note that all the setters affecting `sli_criteria` are
13292    /// mutually exclusive.
13293    ///
13294    /// # Example
13295    /// ```ignore,no_run
13296    /// # use google_cloud_monitoring_v3::model::BasicSli;
13297    /// use google_cloud_monitoring_v3::model::basic_sli::LatencyCriteria;
13298    /// let x = BasicSli::new().set_latency(LatencyCriteria::default()/* use setters */);
13299    /// assert!(x.latency().is_some());
13300    /// assert!(x.availability().is_none());
13301    /// ```
13302    pub fn set_latency<
13303        T: std::convert::Into<std::boxed::Box<crate::model::basic_sli::LatencyCriteria>>,
13304    >(
13305        mut self,
13306        v: T,
13307    ) -> Self {
13308        self.sli_criteria =
13309            std::option::Option::Some(crate::model::basic_sli::SliCriteria::Latency(v.into()));
13310        self
13311    }
13312}
13313
13314impl wkt::message::Message for BasicSli {
13315    fn typename() -> &'static str {
13316        "type.googleapis.com/google.monitoring.v3.BasicSli"
13317    }
13318}
13319
13320/// Defines additional types related to [BasicSli].
13321pub mod basic_sli {
13322    #[allow(unused_imports)]
13323    use super::*;
13324
13325    /// Future parameters for the availability SLI.
13326    #[derive(Clone, Default, PartialEq)]
13327    #[non_exhaustive]
13328    pub struct AvailabilityCriteria {
13329        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13330    }
13331
13332    impl AvailabilityCriteria {
13333        pub fn new() -> Self {
13334            std::default::Default::default()
13335        }
13336    }
13337
13338    impl wkt::message::Message for AvailabilityCriteria {
13339        fn typename() -> &'static str {
13340            "type.googleapis.com/google.monitoring.v3.BasicSli.AvailabilityCriteria"
13341        }
13342    }
13343
13344    /// Parameters for a latency threshold SLI.
13345    #[derive(Clone, Default, PartialEq)]
13346    #[non_exhaustive]
13347    pub struct LatencyCriteria {
13348        /// Good service is defined to be the count of requests made to this service
13349        /// that return in no more than `threshold`.
13350        pub threshold: std::option::Option<wkt::Duration>,
13351
13352        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13353    }
13354
13355    impl LatencyCriteria {
13356        pub fn new() -> Self {
13357            std::default::Default::default()
13358        }
13359
13360        /// Sets the value of [threshold][crate::model::basic_sli::LatencyCriteria::threshold].
13361        ///
13362        /// # Example
13363        /// ```ignore,no_run
13364        /// # use google_cloud_monitoring_v3::model::basic_sli::LatencyCriteria;
13365        /// use wkt::Duration;
13366        /// let x = LatencyCriteria::new().set_threshold(Duration::default()/* use setters */);
13367        /// ```
13368        pub fn set_threshold<T>(mut self, v: T) -> Self
13369        where
13370            T: std::convert::Into<wkt::Duration>,
13371        {
13372            self.threshold = std::option::Option::Some(v.into());
13373            self
13374        }
13375
13376        /// Sets or clears the value of [threshold][crate::model::basic_sli::LatencyCriteria::threshold].
13377        ///
13378        /// # Example
13379        /// ```ignore,no_run
13380        /// # use google_cloud_monitoring_v3::model::basic_sli::LatencyCriteria;
13381        /// use wkt::Duration;
13382        /// let x = LatencyCriteria::new().set_or_clear_threshold(Some(Duration::default()/* use setters */));
13383        /// let x = LatencyCriteria::new().set_or_clear_threshold(None::<Duration>);
13384        /// ```
13385        pub fn set_or_clear_threshold<T>(mut self, v: std::option::Option<T>) -> Self
13386        where
13387            T: std::convert::Into<wkt::Duration>,
13388        {
13389            self.threshold = v.map(|x| x.into());
13390            self
13391        }
13392    }
13393
13394    impl wkt::message::Message for LatencyCriteria {
13395        fn typename() -> &'static str {
13396            "type.googleapis.com/google.monitoring.v3.BasicSli.LatencyCriteria"
13397        }
13398    }
13399
13400    /// This SLI can be evaluated on the basis of availability or latency.
13401    #[derive(Clone, Debug, PartialEq)]
13402    #[non_exhaustive]
13403    pub enum SliCriteria {
13404        /// Good service is defined to be the count of requests made to this service
13405        /// that return successfully.
13406        Availability(std::boxed::Box<crate::model::basic_sli::AvailabilityCriteria>),
13407        /// Good service is defined to be the count of requests made to this service
13408        /// that are fast enough with respect to `latency.threshold`.
13409        Latency(std::boxed::Box<crate::model::basic_sli::LatencyCriteria>),
13410    }
13411}
13412
13413/// Range of numerical values within `min` and `max`.
13414#[derive(Clone, Default, PartialEq)]
13415#[non_exhaustive]
13416pub struct Range {
13417    /// Range minimum.
13418    pub min: f64,
13419
13420    /// Range maximum.
13421    pub max: f64,
13422
13423    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13424}
13425
13426impl Range {
13427    pub fn new() -> Self {
13428        std::default::Default::default()
13429    }
13430
13431    /// Sets the value of [min][crate::model::Range::min].
13432    ///
13433    /// # Example
13434    /// ```ignore,no_run
13435    /// # use google_cloud_monitoring_v3::model::Range;
13436    /// let x = Range::new().set_min(42.0);
13437    /// ```
13438    pub fn set_min<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13439        self.min = v.into();
13440        self
13441    }
13442
13443    /// Sets the value of [max][crate::model::Range::max].
13444    ///
13445    /// # Example
13446    /// ```ignore,no_run
13447    /// # use google_cloud_monitoring_v3::model::Range;
13448    /// let x = Range::new().set_max(42.0);
13449    /// ```
13450    pub fn set_max<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13451        self.max = v.into();
13452        self
13453    }
13454}
13455
13456impl wkt::message::Message for Range {
13457    fn typename() -> &'static str {
13458        "type.googleapis.com/google.monitoring.v3.Range"
13459    }
13460}
13461
13462/// Service Level Indicators for which atomic units of service are counted
13463/// directly.
13464#[derive(Clone, Default, PartialEq)]
13465#[non_exhaustive]
13466pub struct RequestBasedSli {
13467    /// The means to compute a ratio of `good_service` to `total_service`.
13468    pub method: std::option::Option<crate::model::request_based_sli::Method>,
13469
13470    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13471}
13472
13473impl RequestBasedSli {
13474    pub fn new() -> Self {
13475        std::default::Default::default()
13476    }
13477
13478    /// Sets the value of [method][crate::model::RequestBasedSli::method].
13479    ///
13480    /// Note that all the setters affecting `method` are mutually
13481    /// exclusive.
13482    ///
13483    /// # Example
13484    /// ```ignore,no_run
13485    /// # use google_cloud_monitoring_v3::model::RequestBasedSli;
13486    /// use google_cloud_monitoring_v3::model::TimeSeriesRatio;
13487    /// let x = RequestBasedSli::new().set_method(Some(
13488    ///     google_cloud_monitoring_v3::model::request_based_sli::Method::GoodTotalRatio(TimeSeriesRatio::default().into())));
13489    /// ```
13490    pub fn set_method<
13491        T: std::convert::Into<std::option::Option<crate::model::request_based_sli::Method>>,
13492    >(
13493        mut self,
13494        v: T,
13495    ) -> Self {
13496        self.method = v.into();
13497        self
13498    }
13499
13500    /// The value of [method][crate::model::RequestBasedSli::method]
13501    /// if it holds a `GoodTotalRatio`, `None` if the field is not set or
13502    /// holds a different branch.
13503    pub fn good_total_ratio(
13504        &self,
13505    ) -> std::option::Option<&std::boxed::Box<crate::model::TimeSeriesRatio>> {
13506        #[allow(unreachable_patterns)]
13507        self.method.as_ref().and_then(|v| match v {
13508            crate::model::request_based_sli::Method::GoodTotalRatio(v) => {
13509                std::option::Option::Some(v)
13510            }
13511            _ => std::option::Option::None,
13512        })
13513    }
13514
13515    /// Sets the value of [method][crate::model::RequestBasedSli::method]
13516    /// to hold a `GoodTotalRatio`.
13517    ///
13518    /// Note that all the setters affecting `method` are
13519    /// mutually exclusive.
13520    ///
13521    /// # Example
13522    /// ```ignore,no_run
13523    /// # use google_cloud_monitoring_v3::model::RequestBasedSli;
13524    /// use google_cloud_monitoring_v3::model::TimeSeriesRatio;
13525    /// let x = RequestBasedSli::new().set_good_total_ratio(TimeSeriesRatio::default()/* use setters */);
13526    /// assert!(x.good_total_ratio().is_some());
13527    /// assert!(x.distribution_cut().is_none());
13528    /// ```
13529    pub fn set_good_total_ratio<
13530        T: std::convert::Into<std::boxed::Box<crate::model::TimeSeriesRatio>>,
13531    >(
13532        mut self,
13533        v: T,
13534    ) -> Self {
13535        self.method = std::option::Option::Some(
13536            crate::model::request_based_sli::Method::GoodTotalRatio(v.into()),
13537        );
13538        self
13539    }
13540
13541    /// The value of [method][crate::model::RequestBasedSli::method]
13542    /// if it holds a `DistributionCut`, `None` if the field is not set or
13543    /// holds a different branch.
13544    pub fn distribution_cut(
13545        &self,
13546    ) -> std::option::Option<&std::boxed::Box<crate::model::DistributionCut>> {
13547        #[allow(unreachable_patterns)]
13548        self.method.as_ref().and_then(|v| match v {
13549            crate::model::request_based_sli::Method::DistributionCut(v) => {
13550                std::option::Option::Some(v)
13551            }
13552            _ => std::option::Option::None,
13553        })
13554    }
13555
13556    /// Sets the value of [method][crate::model::RequestBasedSli::method]
13557    /// to hold a `DistributionCut`.
13558    ///
13559    /// Note that all the setters affecting `method` are
13560    /// mutually exclusive.
13561    ///
13562    /// # Example
13563    /// ```ignore,no_run
13564    /// # use google_cloud_monitoring_v3::model::RequestBasedSli;
13565    /// use google_cloud_monitoring_v3::model::DistributionCut;
13566    /// let x = RequestBasedSli::new().set_distribution_cut(DistributionCut::default()/* use setters */);
13567    /// assert!(x.distribution_cut().is_some());
13568    /// assert!(x.good_total_ratio().is_none());
13569    /// ```
13570    pub fn set_distribution_cut<
13571        T: std::convert::Into<std::boxed::Box<crate::model::DistributionCut>>,
13572    >(
13573        mut self,
13574        v: T,
13575    ) -> Self {
13576        self.method = std::option::Option::Some(
13577            crate::model::request_based_sli::Method::DistributionCut(v.into()),
13578        );
13579        self
13580    }
13581}
13582
13583impl wkt::message::Message for RequestBasedSli {
13584    fn typename() -> &'static str {
13585        "type.googleapis.com/google.monitoring.v3.RequestBasedSli"
13586    }
13587}
13588
13589/// Defines additional types related to [RequestBasedSli].
13590pub mod request_based_sli {
13591    #[allow(unused_imports)]
13592    use super::*;
13593
13594    /// The means to compute a ratio of `good_service` to `total_service`.
13595    #[derive(Clone, Debug, PartialEq)]
13596    #[non_exhaustive]
13597    pub enum Method {
13598        /// `good_total_ratio` is used when the ratio of `good_service` to
13599        /// `total_service` is computed from two `TimeSeries`.
13600        GoodTotalRatio(std::boxed::Box<crate::model::TimeSeriesRatio>),
13601        /// `distribution_cut` is used when `good_service` is a count of values
13602        /// aggregated in a `Distribution` that fall into a good range. The
13603        /// `total_service` is the total count of all values aggregated in the
13604        /// `Distribution`.
13605        DistributionCut(std::boxed::Box<crate::model::DistributionCut>),
13606    }
13607}
13608
13609/// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the
13610/// `good_service / total_service` ratio. The specified `TimeSeries` must have
13611/// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
13612/// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify
13613/// exactly two of good, bad, and total, and the relationship `good_service +
13614/// bad_service = total_service` will be assumed.
13615#[derive(Clone, Default, PartialEq)]
13616#[non_exhaustive]
13617pub struct TimeSeriesRatio {
13618    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
13619    /// specifying a `TimeSeries` quantifying good service provided. Must have
13620    /// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
13621    /// DELTA` or `MetricKind = CUMULATIVE`.
13622    pub good_service_filter: std::string::String,
13623
13624    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
13625    /// specifying a `TimeSeries` quantifying bad service, either demanded service
13626    /// that was not provided or demanded service that was of inadequate quality.
13627    /// Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have
13628    /// `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
13629    pub bad_service_filter: std::string::String,
13630
13631    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
13632    /// specifying a `TimeSeries` quantifying total demanded service. Must have
13633    /// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
13634    /// DELTA` or `MetricKind = CUMULATIVE`.
13635    pub total_service_filter: std::string::String,
13636
13637    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13638}
13639
13640impl TimeSeriesRatio {
13641    pub fn new() -> Self {
13642        std::default::Default::default()
13643    }
13644
13645    /// Sets the value of [good_service_filter][crate::model::TimeSeriesRatio::good_service_filter].
13646    ///
13647    /// # Example
13648    /// ```ignore,no_run
13649    /// # use google_cloud_monitoring_v3::model::TimeSeriesRatio;
13650    /// let x = TimeSeriesRatio::new().set_good_service_filter("example");
13651    /// ```
13652    pub fn set_good_service_filter<T: std::convert::Into<std::string::String>>(
13653        mut self,
13654        v: T,
13655    ) -> Self {
13656        self.good_service_filter = v.into();
13657        self
13658    }
13659
13660    /// Sets the value of [bad_service_filter][crate::model::TimeSeriesRatio::bad_service_filter].
13661    ///
13662    /// # Example
13663    /// ```ignore,no_run
13664    /// # use google_cloud_monitoring_v3::model::TimeSeriesRatio;
13665    /// let x = TimeSeriesRatio::new().set_bad_service_filter("example");
13666    /// ```
13667    pub fn set_bad_service_filter<T: std::convert::Into<std::string::String>>(
13668        mut self,
13669        v: T,
13670    ) -> Self {
13671        self.bad_service_filter = v.into();
13672        self
13673    }
13674
13675    /// Sets the value of [total_service_filter][crate::model::TimeSeriesRatio::total_service_filter].
13676    ///
13677    /// # Example
13678    /// ```ignore,no_run
13679    /// # use google_cloud_monitoring_v3::model::TimeSeriesRatio;
13680    /// let x = TimeSeriesRatio::new().set_total_service_filter("example");
13681    /// ```
13682    pub fn set_total_service_filter<T: std::convert::Into<std::string::String>>(
13683        mut self,
13684        v: T,
13685    ) -> Self {
13686        self.total_service_filter = v.into();
13687        self
13688    }
13689}
13690
13691impl wkt::message::Message for TimeSeriesRatio {
13692    fn typename() -> &'static str {
13693        "type.googleapis.com/google.monitoring.v3.TimeSeriesRatio"
13694    }
13695}
13696
13697/// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring
13698/// good service and total service. The `TimeSeries` must have `ValueType =
13699/// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The
13700/// computed `good_service` will be the estimated count of values in the
13701/// `Distribution` that fall within the specified `min` and `max`.
13702#[derive(Clone, Default, PartialEq)]
13703#[non_exhaustive]
13704pub struct DistributionCut {
13705    /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
13706    /// specifying a `TimeSeries` aggregating values. Must have `ValueType =
13707    /// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
13708    pub distribution_filter: std::string::String,
13709
13710    /// Range of values considered "good." For a one-sided range, set one bound to
13711    /// an infinite value.
13712    pub range: std::option::Option<crate::model::Range>,
13713
13714    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13715}
13716
13717impl DistributionCut {
13718    pub fn new() -> Self {
13719        std::default::Default::default()
13720    }
13721
13722    /// Sets the value of [distribution_filter][crate::model::DistributionCut::distribution_filter].
13723    ///
13724    /// # Example
13725    /// ```ignore,no_run
13726    /// # use google_cloud_monitoring_v3::model::DistributionCut;
13727    /// let x = DistributionCut::new().set_distribution_filter("example");
13728    /// ```
13729    pub fn set_distribution_filter<T: std::convert::Into<std::string::String>>(
13730        mut self,
13731        v: T,
13732    ) -> Self {
13733        self.distribution_filter = v.into();
13734        self
13735    }
13736
13737    /// Sets the value of [range][crate::model::DistributionCut::range].
13738    ///
13739    /// # Example
13740    /// ```ignore,no_run
13741    /// # use google_cloud_monitoring_v3::model::DistributionCut;
13742    /// use google_cloud_monitoring_v3::model::Range;
13743    /// let x = DistributionCut::new().set_range(Range::default()/* use setters */);
13744    /// ```
13745    pub fn set_range<T>(mut self, v: T) -> Self
13746    where
13747        T: std::convert::Into<crate::model::Range>,
13748    {
13749        self.range = std::option::Option::Some(v.into());
13750        self
13751    }
13752
13753    /// Sets or clears the value of [range][crate::model::DistributionCut::range].
13754    ///
13755    /// # Example
13756    /// ```ignore,no_run
13757    /// # use google_cloud_monitoring_v3::model::DistributionCut;
13758    /// use google_cloud_monitoring_v3::model::Range;
13759    /// let x = DistributionCut::new().set_or_clear_range(Some(Range::default()/* use setters */));
13760    /// let x = DistributionCut::new().set_or_clear_range(None::<Range>);
13761    /// ```
13762    pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
13763    where
13764        T: std::convert::Into<crate::model::Range>,
13765    {
13766        self.range = v.map(|x| x.into());
13767        self
13768    }
13769}
13770
13771impl wkt::message::Message for DistributionCut {
13772    fn typename() -> &'static str {
13773        "type.googleapis.com/google.monitoring.v3.DistributionCut"
13774    }
13775}
13776
13777/// A `WindowsBasedSli` defines `good_service` as the count of time windows for
13778/// which the provided service was of good quality. Criteria for determining
13779/// if service was good are embedded in the `window_criterion`.
13780#[derive(Clone, Default, PartialEq)]
13781#[non_exhaustive]
13782pub struct WindowsBasedSli {
13783    /// Duration over which window quality is evaluated. Must be an integer
13784    /// fraction of a day and at least `60s`.
13785    pub window_period: std::option::Option<wkt::Duration>,
13786
13787    /// The criterion to use for evaluating window goodness.
13788    pub window_criterion: std::option::Option<crate::model::windows_based_sli::WindowCriterion>,
13789
13790    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13791}
13792
13793impl WindowsBasedSli {
13794    pub fn new() -> Self {
13795        std::default::Default::default()
13796    }
13797
13798    /// Sets the value of [window_period][crate::model::WindowsBasedSli::window_period].
13799    ///
13800    /// # Example
13801    /// ```ignore,no_run
13802    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13803    /// use wkt::Duration;
13804    /// let x = WindowsBasedSli::new().set_window_period(Duration::default()/* use setters */);
13805    /// ```
13806    pub fn set_window_period<T>(mut self, v: T) -> Self
13807    where
13808        T: std::convert::Into<wkt::Duration>,
13809    {
13810        self.window_period = std::option::Option::Some(v.into());
13811        self
13812    }
13813
13814    /// Sets or clears the value of [window_period][crate::model::WindowsBasedSli::window_period].
13815    ///
13816    /// # Example
13817    /// ```ignore,no_run
13818    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13819    /// use wkt::Duration;
13820    /// let x = WindowsBasedSli::new().set_or_clear_window_period(Some(Duration::default()/* use setters */));
13821    /// let x = WindowsBasedSli::new().set_or_clear_window_period(None::<Duration>);
13822    /// ```
13823    pub fn set_or_clear_window_period<T>(mut self, v: std::option::Option<T>) -> Self
13824    where
13825        T: std::convert::Into<wkt::Duration>,
13826    {
13827        self.window_period = v.map(|x| x.into());
13828        self
13829    }
13830
13831    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion].
13832    ///
13833    /// Note that all the setters affecting `window_criterion` are mutually
13834    /// exclusive.
13835    ///
13836    /// # Example
13837    /// ```ignore,no_run
13838    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13839    /// use google_cloud_monitoring_v3::model::windows_based_sli::WindowCriterion;
13840    /// let x = WindowsBasedSli::new().set_window_criterion(Some(WindowCriterion::GoodBadMetricFilter("example".to_string())));
13841    /// ```
13842    pub fn set_window_criterion<
13843        T: std::convert::Into<std::option::Option<crate::model::windows_based_sli::WindowCriterion>>,
13844    >(
13845        mut self,
13846        v: T,
13847    ) -> Self {
13848        self.window_criterion = v.into();
13849        self
13850    }
13851
13852    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13853    /// if it holds a `GoodBadMetricFilter`, `None` if the field is not set or
13854    /// holds a different branch.
13855    pub fn good_bad_metric_filter(&self) -> std::option::Option<&std::string::String> {
13856        #[allow(unreachable_patterns)]
13857        self.window_criterion.as_ref().and_then(|v| match v {
13858            crate::model::windows_based_sli::WindowCriterion::GoodBadMetricFilter(v) => {
13859                std::option::Option::Some(v)
13860            }
13861            _ => std::option::Option::None,
13862        })
13863    }
13864
13865    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13866    /// to hold a `GoodBadMetricFilter`.
13867    ///
13868    /// Note that all the setters affecting `window_criterion` are
13869    /// mutually exclusive.
13870    ///
13871    /// # Example
13872    /// ```ignore,no_run
13873    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13874    /// let x = WindowsBasedSli::new().set_good_bad_metric_filter("example");
13875    /// assert!(x.good_bad_metric_filter().is_some());
13876    /// assert!(x.good_total_ratio_threshold().is_none());
13877    /// assert!(x.metric_mean_in_range().is_none());
13878    /// assert!(x.metric_sum_in_range().is_none());
13879    /// ```
13880    pub fn set_good_bad_metric_filter<T: std::convert::Into<std::string::String>>(
13881        mut self,
13882        v: T,
13883    ) -> Self {
13884        self.window_criterion = std::option::Option::Some(
13885            crate::model::windows_based_sli::WindowCriterion::GoodBadMetricFilter(v.into()),
13886        );
13887        self
13888    }
13889
13890    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13891    /// if it holds a `GoodTotalRatioThreshold`, `None` if the field is not set or
13892    /// holds a different branch.
13893    pub fn good_total_ratio_threshold(
13894        &self,
13895    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>>
13896    {
13897        #[allow(unreachable_patterns)]
13898        self.window_criterion.as_ref().and_then(|v| match v {
13899            crate::model::windows_based_sli::WindowCriterion::GoodTotalRatioThreshold(v) => {
13900                std::option::Option::Some(v)
13901            }
13902            _ => std::option::Option::None,
13903        })
13904    }
13905
13906    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13907    /// to hold a `GoodTotalRatioThreshold`.
13908    ///
13909    /// Note that all the setters affecting `window_criterion` are
13910    /// mutually exclusive.
13911    ///
13912    /// # Example
13913    /// ```ignore,no_run
13914    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13915    /// use google_cloud_monitoring_v3::model::windows_based_sli::PerformanceThreshold;
13916    /// let x = WindowsBasedSli::new().set_good_total_ratio_threshold(PerformanceThreshold::default()/* use setters */);
13917    /// assert!(x.good_total_ratio_threshold().is_some());
13918    /// assert!(x.good_bad_metric_filter().is_none());
13919    /// assert!(x.metric_mean_in_range().is_none());
13920    /// assert!(x.metric_sum_in_range().is_none());
13921    /// ```
13922    pub fn set_good_total_ratio_threshold<
13923        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>>,
13924    >(
13925        mut self,
13926        v: T,
13927    ) -> Self {
13928        self.window_criterion = std::option::Option::Some(
13929            crate::model::windows_based_sli::WindowCriterion::GoodTotalRatioThreshold(v.into()),
13930        );
13931        self
13932    }
13933
13934    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13935    /// if it holds a `MetricMeanInRange`, `None` if the field is not set or
13936    /// holds a different branch.
13937    pub fn metric_mean_in_range(
13938        &self,
13939    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::MetricRange>> {
13940        #[allow(unreachable_patterns)]
13941        self.window_criterion.as_ref().and_then(|v| match v {
13942            crate::model::windows_based_sli::WindowCriterion::MetricMeanInRange(v) => {
13943                std::option::Option::Some(v)
13944            }
13945            _ => std::option::Option::None,
13946        })
13947    }
13948
13949    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13950    /// to hold a `MetricMeanInRange`.
13951    ///
13952    /// Note that all the setters affecting `window_criterion` are
13953    /// mutually exclusive.
13954    ///
13955    /// # Example
13956    /// ```ignore,no_run
13957    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
13958    /// use google_cloud_monitoring_v3::model::windows_based_sli::MetricRange;
13959    /// let x = WindowsBasedSli::new().set_metric_mean_in_range(MetricRange::default()/* use setters */);
13960    /// assert!(x.metric_mean_in_range().is_some());
13961    /// assert!(x.good_bad_metric_filter().is_none());
13962    /// assert!(x.good_total_ratio_threshold().is_none());
13963    /// assert!(x.metric_sum_in_range().is_none());
13964    /// ```
13965    pub fn set_metric_mean_in_range<
13966        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::MetricRange>>,
13967    >(
13968        mut self,
13969        v: T,
13970    ) -> Self {
13971        self.window_criterion = std::option::Option::Some(
13972            crate::model::windows_based_sli::WindowCriterion::MetricMeanInRange(v.into()),
13973        );
13974        self
13975    }
13976
13977    /// The value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13978    /// if it holds a `MetricSumInRange`, `None` if the field is not set or
13979    /// holds a different branch.
13980    pub fn metric_sum_in_range(
13981        &self,
13982    ) -> std::option::Option<&std::boxed::Box<crate::model::windows_based_sli::MetricRange>> {
13983        #[allow(unreachable_patterns)]
13984        self.window_criterion.as_ref().and_then(|v| match v {
13985            crate::model::windows_based_sli::WindowCriterion::MetricSumInRange(v) => {
13986                std::option::Option::Some(v)
13987            }
13988            _ => std::option::Option::None,
13989        })
13990    }
13991
13992    /// Sets the value of [window_criterion][crate::model::WindowsBasedSli::window_criterion]
13993    /// to hold a `MetricSumInRange`.
13994    ///
13995    /// Note that all the setters affecting `window_criterion` are
13996    /// mutually exclusive.
13997    ///
13998    /// # Example
13999    /// ```ignore,no_run
14000    /// # use google_cloud_monitoring_v3::model::WindowsBasedSli;
14001    /// use google_cloud_monitoring_v3::model::windows_based_sli::MetricRange;
14002    /// let x = WindowsBasedSli::new().set_metric_sum_in_range(MetricRange::default()/* use setters */);
14003    /// assert!(x.metric_sum_in_range().is_some());
14004    /// assert!(x.good_bad_metric_filter().is_none());
14005    /// assert!(x.good_total_ratio_threshold().is_none());
14006    /// assert!(x.metric_mean_in_range().is_none());
14007    /// ```
14008    pub fn set_metric_sum_in_range<
14009        T: std::convert::Into<std::boxed::Box<crate::model::windows_based_sli::MetricRange>>,
14010    >(
14011        mut self,
14012        v: T,
14013    ) -> Self {
14014        self.window_criterion = std::option::Option::Some(
14015            crate::model::windows_based_sli::WindowCriterion::MetricSumInRange(v.into()),
14016        );
14017        self
14018    }
14019}
14020
14021impl wkt::message::Message for WindowsBasedSli {
14022    fn typename() -> &'static str {
14023        "type.googleapis.com/google.monitoring.v3.WindowsBasedSli"
14024    }
14025}
14026
14027/// Defines additional types related to [WindowsBasedSli].
14028pub mod windows_based_sli {
14029    #[allow(unused_imports)]
14030    use super::*;
14031
14032    /// A `PerformanceThreshold` is used when each window is good when that window
14033    /// has a sufficiently high `performance`.
14034    #[derive(Clone, Default, PartialEq)]
14035    #[non_exhaustive]
14036    pub struct PerformanceThreshold {
14037        /// If window `performance >= threshold`, the window is counted as good.
14038        pub threshold: f64,
14039
14040        /// The means, either a request-based SLI or a basic SLI, by which to compute
14041        /// performance over a window.
14042        pub r#type:
14043            std::option::Option<crate::model::windows_based_sli::performance_threshold::Type>,
14044
14045        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14046    }
14047
14048    impl PerformanceThreshold {
14049        pub fn new() -> Self {
14050            std::default::Default::default()
14051        }
14052
14053        /// Sets the value of [threshold][crate::model::windows_based_sli::PerformanceThreshold::threshold].
14054        ///
14055        /// # Example
14056        /// ```ignore,no_run
14057        /// # use google_cloud_monitoring_v3::model::windows_based_sli::PerformanceThreshold;
14058        /// let x = PerformanceThreshold::new().set_threshold(42.0);
14059        /// ```
14060        pub fn set_threshold<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
14061            self.threshold = v.into();
14062            self
14063        }
14064
14065        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::type].
14066        ///
14067        /// Note that all the setters affecting `r#type` are mutually
14068        /// exclusive.
14069        ///
14070        /// # Example
14071        /// ```ignore,no_run
14072        /// # use google_cloud_monitoring_v3::model::windows_based_sli::PerformanceThreshold;
14073        /// use google_cloud_monitoring_v3::model::RequestBasedSli;
14074        /// let x = PerformanceThreshold::new().set_type(Some(
14075        ///     google_cloud_monitoring_v3::model::windows_based_sli::performance_threshold::Type::Performance(RequestBasedSli::default().into())));
14076        /// ```
14077        pub fn set_type<
14078            T: std::convert::Into<
14079                    std::option::Option<
14080                        crate::model::windows_based_sli::performance_threshold::Type,
14081                    >,
14082                >,
14083        >(
14084            mut self,
14085            v: T,
14086        ) -> Self {
14087            self.r#type = v.into();
14088            self
14089        }
14090
14091        /// The value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
14092        /// if it holds a `Performance`, `None` if the field is not set or
14093        /// holds a different branch.
14094        pub fn performance(
14095            &self,
14096        ) -> std::option::Option<&std::boxed::Box<crate::model::RequestBasedSli>> {
14097            #[allow(unreachable_patterns)]
14098            self.r#type.as_ref().and_then(|v| match v {
14099                crate::model::windows_based_sli::performance_threshold::Type::Performance(v) => {
14100                    std::option::Option::Some(v)
14101                }
14102                _ => std::option::Option::None,
14103            })
14104        }
14105
14106        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
14107        /// to hold a `Performance`.
14108        ///
14109        /// Note that all the setters affecting `r#type` are
14110        /// mutually exclusive.
14111        ///
14112        /// # Example
14113        /// ```ignore,no_run
14114        /// # use google_cloud_monitoring_v3::model::windows_based_sli::PerformanceThreshold;
14115        /// use google_cloud_monitoring_v3::model::RequestBasedSli;
14116        /// let x = PerformanceThreshold::new().set_performance(RequestBasedSli::default()/* use setters */);
14117        /// assert!(x.performance().is_some());
14118        /// assert!(x.basic_sli_performance().is_none());
14119        /// ```
14120        pub fn set_performance<
14121            T: std::convert::Into<std::boxed::Box<crate::model::RequestBasedSli>>,
14122        >(
14123            mut self,
14124            v: T,
14125        ) -> Self {
14126            self.r#type = std::option::Option::Some(
14127                crate::model::windows_based_sli::performance_threshold::Type::Performance(v.into()),
14128            );
14129            self
14130        }
14131
14132        /// The value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
14133        /// if it holds a `BasicSliPerformance`, `None` if the field is not set or
14134        /// holds a different branch.
14135        pub fn basic_sli_performance(
14136            &self,
14137        ) -> std::option::Option<&std::boxed::Box<crate::model::BasicSli>> {
14138            #[allow(unreachable_patterns)]
14139            self.r#type.as_ref().and_then(|v| match v {
14140                crate::model::windows_based_sli::performance_threshold::Type::BasicSliPerformance(v) => std::option::Option::Some(v),
14141                _ => std::option::Option::None,
14142            })
14143        }
14144
14145        /// Sets the value of [r#type][crate::model::windows_based_sli::PerformanceThreshold::r#type]
14146        /// to hold a `BasicSliPerformance`.
14147        ///
14148        /// Note that all the setters affecting `r#type` are
14149        /// mutually exclusive.
14150        ///
14151        /// # Example
14152        /// ```ignore,no_run
14153        /// # use google_cloud_monitoring_v3::model::windows_based_sli::PerformanceThreshold;
14154        /// use google_cloud_monitoring_v3::model::BasicSli;
14155        /// let x = PerformanceThreshold::new().set_basic_sli_performance(BasicSli::default()/* use setters */);
14156        /// assert!(x.basic_sli_performance().is_some());
14157        /// assert!(x.performance().is_none());
14158        /// ```
14159        pub fn set_basic_sli_performance<
14160            T: std::convert::Into<std::boxed::Box<crate::model::BasicSli>>,
14161        >(
14162            mut self,
14163            v: T,
14164        ) -> Self {
14165            self.r#type = std::option::Option::Some(
14166                crate::model::windows_based_sli::performance_threshold::Type::BasicSliPerformance(
14167                    v.into(),
14168                ),
14169            );
14170            self
14171        }
14172    }
14173
14174    impl wkt::message::Message for PerformanceThreshold {
14175        fn typename() -> &'static str {
14176            "type.googleapis.com/google.monitoring.v3.WindowsBasedSli.PerformanceThreshold"
14177        }
14178    }
14179
14180    /// Defines additional types related to [PerformanceThreshold].
14181    pub mod performance_threshold {
14182        #[allow(unused_imports)]
14183        use super::*;
14184
14185        /// The means, either a request-based SLI or a basic SLI, by which to compute
14186        /// performance over a window.
14187        #[derive(Clone, Debug, PartialEq)]
14188        #[non_exhaustive]
14189        pub enum Type {
14190            /// `RequestBasedSli` to evaluate to judge window quality.
14191            Performance(std::boxed::Box<crate::model::RequestBasedSli>),
14192            /// `BasicSli` to evaluate to judge window quality.
14193            BasicSliPerformance(std::boxed::Box<crate::model::BasicSli>),
14194        }
14195    }
14196
14197    /// A `MetricRange` is used when each window is good when the value x of a
14198    /// single `TimeSeries` satisfies `range.min <= x <= range.max`. The provided
14199    /// `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and
14200    /// `MetricKind = GAUGE`.
14201    #[derive(Clone, Default, PartialEq)]
14202    #[non_exhaustive]
14203    pub struct MetricRange {
14204        /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
14205        /// specifying the `TimeSeries` to use for evaluating window quality.
14206        pub time_series: std::string::String,
14207
14208        /// Range of values considered "good." For a one-sided range, set one bound
14209        /// to an infinite value.
14210        pub range: std::option::Option<crate::model::Range>,
14211
14212        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14213    }
14214
14215    impl MetricRange {
14216        pub fn new() -> Self {
14217            std::default::Default::default()
14218        }
14219
14220        /// Sets the value of [time_series][crate::model::windows_based_sli::MetricRange::time_series].
14221        ///
14222        /// # Example
14223        /// ```ignore,no_run
14224        /// # use google_cloud_monitoring_v3::model::windows_based_sli::MetricRange;
14225        /// let x = MetricRange::new().set_time_series("example");
14226        /// ```
14227        pub fn set_time_series<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14228            self.time_series = v.into();
14229            self
14230        }
14231
14232        /// Sets the value of [range][crate::model::windows_based_sli::MetricRange::range].
14233        ///
14234        /// # Example
14235        /// ```ignore,no_run
14236        /// # use google_cloud_monitoring_v3::model::windows_based_sli::MetricRange;
14237        /// use google_cloud_monitoring_v3::model::Range;
14238        /// let x = MetricRange::new().set_range(Range::default()/* use setters */);
14239        /// ```
14240        pub fn set_range<T>(mut self, v: T) -> Self
14241        where
14242            T: std::convert::Into<crate::model::Range>,
14243        {
14244            self.range = std::option::Option::Some(v.into());
14245            self
14246        }
14247
14248        /// Sets or clears the value of [range][crate::model::windows_based_sli::MetricRange::range].
14249        ///
14250        /// # Example
14251        /// ```ignore,no_run
14252        /// # use google_cloud_monitoring_v3::model::windows_based_sli::MetricRange;
14253        /// use google_cloud_monitoring_v3::model::Range;
14254        /// let x = MetricRange::new().set_or_clear_range(Some(Range::default()/* use setters */));
14255        /// let x = MetricRange::new().set_or_clear_range(None::<Range>);
14256        /// ```
14257        pub fn set_or_clear_range<T>(mut self, v: std::option::Option<T>) -> Self
14258        where
14259            T: std::convert::Into<crate::model::Range>,
14260        {
14261            self.range = v.map(|x| x.into());
14262            self
14263        }
14264    }
14265
14266    impl wkt::message::Message for MetricRange {
14267        fn typename() -> &'static str {
14268            "type.googleapis.com/google.monitoring.v3.WindowsBasedSli.MetricRange"
14269        }
14270    }
14271
14272    /// The criterion to use for evaluating window goodness.
14273    #[derive(Clone, Debug, PartialEq)]
14274    #[non_exhaustive]
14275    pub enum WindowCriterion {
14276        /// A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
14277        /// specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if
14278        /// any `true` values appear in the window.
14279        GoodBadMetricFilter(std::string::String),
14280        /// A window is good if its `performance` is high enough.
14281        GoodTotalRatioThreshold(
14282            std::boxed::Box<crate::model::windows_based_sli::PerformanceThreshold>,
14283        ),
14284        /// A window is good if the metric's value is in a good range, averaged
14285        /// across returned streams.
14286        MetricMeanInRange(std::boxed::Box<crate::model::windows_based_sli::MetricRange>),
14287        /// A window is good if the metric's value is in a good range, summed across
14288        /// returned streams.
14289        MetricSumInRange(std::boxed::Box<crate::model::windows_based_sli::MetricRange>),
14290    }
14291}
14292
14293/// The `CreateService` request.
14294#[derive(Clone, Default, PartialEq)]
14295#[non_exhaustive]
14296pub struct CreateServiceRequest {
14297    /// Required. Resource
14298    /// [name](https://cloud.google.com/monitoring/api/v3#project_name) of the
14299    /// parent Metrics Scope. The format is:
14300    ///
14301    /// ```norust
14302    /// projects/[PROJECT_ID_OR_NUMBER]
14303    /// ```
14304    pub parent: std::string::String,
14305
14306    /// Optional. The Service id to use for this Service. If omitted, an id will be
14307    /// generated instead. Must match the pattern `[a-z0-9\-]+`
14308    pub service_id: std::string::String,
14309
14310    /// Required. The `Service` to create.
14311    pub service: std::option::Option<crate::model::Service>,
14312
14313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14314}
14315
14316impl CreateServiceRequest {
14317    pub fn new() -> Self {
14318        std::default::Default::default()
14319    }
14320
14321    /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
14322    ///
14323    /// # Example
14324    /// ```ignore,no_run
14325    /// # use google_cloud_monitoring_v3::model::CreateServiceRequest;
14326    /// let x = CreateServiceRequest::new().set_parent("example");
14327    /// ```
14328    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14329        self.parent = v.into();
14330        self
14331    }
14332
14333    /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
14334    ///
14335    /// # Example
14336    /// ```ignore,no_run
14337    /// # use google_cloud_monitoring_v3::model::CreateServiceRequest;
14338    /// let x = CreateServiceRequest::new().set_service_id("example");
14339    /// ```
14340    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14341        self.service_id = v.into();
14342        self
14343    }
14344
14345    /// Sets the value of [service][crate::model::CreateServiceRequest::service].
14346    ///
14347    /// # Example
14348    /// ```ignore,no_run
14349    /// # use google_cloud_monitoring_v3::model::CreateServiceRequest;
14350    /// use google_cloud_monitoring_v3::model::Service;
14351    /// let x = CreateServiceRequest::new().set_service(Service::default()/* use setters */);
14352    /// ```
14353    pub fn set_service<T>(mut self, v: T) -> Self
14354    where
14355        T: std::convert::Into<crate::model::Service>,
14356    {
14357        self.service = std::option::Option::Some(v.into());
14358        self
14359    }
14360
14361    /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
14362    ///
14363    /// # Example
14364    /// ```ignore,no_run
14365    /// # use google_cloud_monitoring_v3::model::CreateServiceRequest;
14366    /// use google_cloud_monitoring_v3::model::Service;
14367    /// let x = CreateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
14368    /// let x = CreateServiceRequest::new().set_or_clear_service(None::<Service>);
14369    /// ```
14370    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
14371    where
14372        T: std::convert::Into<crate::model::Service>,
14373    {
14374        self.service = v.map(|x| x.into());
14375        self
14376    }
14377}
14378
14379impl wkt::message::Message for CreateServiceRequest {
14380    fn typename() -> &'static str {
14381        "type.googleapis.com/google.monitoring.v3.CreateServiceRequest"
14382    }
14383}
14384
14385/// The `GetService` request.
14386#[derive(Clone, Default, PartialEq)]
14387#[non_exhaustive]
14388pub struct GetServiceRequest {
14389    /// Required. Resource name of the `Service`. The format is:
14390    ///
14391    /// ```norust
14392    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
14393    /// ```
14394    pub name: std::string::String,
14395
14396    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14397}
14398
14399impl GetServiceRequest {
14400    pub fn new() -> Self {
14401        std::default::Default::default()
14402    }
14403
14404    /// Sets the value of [name][crate::model::GetServiceRequest::name].
14405    ///
14406    /// # Example
14407    /// ```ignore,no_run
14408    /// # use google_cloud_monitoring_v3::model::GetServiceRequest;
14409    /// let x = GetServiceRequest::new().set_name("example");
14410    /// ```
14411    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14412        self.name = v.into();
14413        self
14414    }
14415}
14416
14417impl wkt::message::Message for GetServiceRequest {
14418    fn typename() -> &'static str {
14419        "type.googleapis.com/google.monitoring.v3.GetServiceRequest"
14420    }
14421}
14422
14423/// The `ListServices` request.
14424#[derive(Clone, Default, PartialEq)]
14425#[non_exhaustive]
14426pub struct ListServicesRequest {
14427    /// Required. Resource name of the parent containing the listed services,
14428    /// either a [project](https://cloud.google.com/monitoring/api/v3#project_name)
14429    /// or a Monitoring Metrics Scope. The formats are:
14430    ///
14431    /// ```norust
14432    /// projects/[PROJECT_ID_OR_NUMBER]
14433    /// workspaces/[HOST_PROJECT_ID_OR_NUMBER]
14434    /// ```
14435    pub parent: std::string::String,
14436
14437    /// A filter specifying what `Service`s to return. The filter supports
14438    /// filtering on a particular service-identifier type or one of its attributes.
14439    ///
14440    /// To filter on a particular service-identifier type, the `identifier_case`
14441    /// refers to which option in the `identifier` field is populated. For example,
14442    /// the filter `identifier_case = "CUSTOM"` would match all services with a
14443    /// value for the `custom` field. Valid options include "CUSTOM", "APP_ENGINE",
14444    /// "MESH_ISTIO", and the other options listed at
14445    /// <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service>
14446    ///
14447    /// To filter on an attribute of a service-identifier type, apply the filter
14448    /// name by using the snake case of the service-identifier type and the
14449    /// attribute of that service-identifier type, and join the two with a period.
14450    /// For example, to filter by the `meshUid` field of the `MeshIstio`
14451    /// service-identifier type, you must filter on `mesh_istio.mesh_uid =
14452    /// "123"` to match all services with mesh UID "123". Service-identifier types
14453    /// and their attributes are described at
14454    /// <https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services#Service>
14455    pub filter: std::string::String,
14456
14457    /// A non-negative number that is the maximum number of results to return.
14458    /// When 0, use default page size.
14459    pub page_size: i32,
14460
14461    /// If this field is not empty then it must contain the `nextPageToken` value
14462    /// returned by a previous call to this method.  Using this field causes the
14463    /// method to return additional results from the previous method call.
14464    pub page_token: std::string::String,
14465
14466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14467}
14468
14469impl ListServicesRequest {
14470    pub fn new() -> Self {
14471        std::default::Default::default()
14472    }
14473
14474    /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
14475    ///
14476    /// # Example
14477    /// ```ignore,no_run
14478    /// # use google_cloud_monitoring_v3::model::ListServicesRequest;
14479    /// let x = ListServicesRequest::new().set_parent("example");
14480    /// ```
14481    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14482        self.parent = v.into();
14483        self
14484    }
14485
14486    /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
14487    ///
14488    /// # Example
14489    /// ```ignore,no_run
14490    /// # use google_cloud_monitoring_v3::model::ListServicesRequest;
14491    /// let x = ListServicesRequest::new().set_filter("example");
14492    /// ```
14493    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14494        self.filter = v.into();
14495        self
14496    }
14497
14498    /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
14499    ///
14500    /// # Example
14501    /// ```ignore,no_run
14502    /// # use google_cloud_monitoring_v3::model::ListServicesRequest;
14503    /// let x = ListServicesRequest::new().set_page_size(42);
14504    /// ```
14505    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14506        self.page_size = v.into();
14507        self
14508    }
14509
14510    /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
14511    ///
14512    /// # Example
14513    /// ```ignore,no_run
14514    /// # use google_cloud_monitoring_v3::model::ListServicesRequest;
14515    /// let x = ListServicesRequest::new().set_page_token("example");
14516    /// ```
14517    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14518        self.page_token = v.into();
14519        self
14520    }
14521}
14522
14523impl wkt::message::Message for ListServicesRequest {
14524    fn typename() -> &'static str {
14525        "type.googleapis.com/google.monitoring.v3.ListServicesRequest"
14526    }
14527}
14528
14529/// The `ListServices` response.
14530#[derive(Clone, Default, PartialEq)]
14531#[non_exhaustive]
14532pub struct ListServicesResponse {
14533    /// The `Service`s matching the specified filter.
14534    pub services: std::vec::Vec<crate::model::Service>,
14535
14536    /// If there are more results than have been returned, then this field is set
14537    /// to a non-empty value.  To see the additional results,
14538    /// use that value as `page_token` in the next call to this method.
14539    pub next_page_token: std::string::String,
14540
14541    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14542}
14543
14544impl ListServicesResponse {
14545    pub fn new() -> Self {
14546        std::default::Default::default()
14547    }
14548
14549    /// Sets the value of [services][crate::model::ListServicesResponse::services].
14550    ///
14551    /// # Example
14552    /// ```ignore,no_run
14553    /// # use google_cloud_monitoring_v3::model::ListServicesResponse;
14554    /// use google_cloud_monitoring_v3::model::Service;
14555    /// let x = ListServicesResponse::new()
14556    ///     .set_services([
14557    ///         Service::default()/* use setters */,
14558    ///         Service::default()/* use (different) setters */,
14559    ///     ]);
14560    /// ```
14561    pub fn set_services<T, V>(mut self, v: T) -> Self
14562    where
14563        T: std::iter::IntoIterator<Item = V>,
14564        V: std::convert::Into<crate::model::Service>,
14565    {
14566        use std::iter::Iterator;
14567        self.services = v.into_iter().map(|i| i.into()).collect();
14568        self
14569    }
14570
14571    /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
14572    ///
14573    /// # Example
14574    /// ```ignore,no_run
14575    /// # use google_cloud_monitoring_v3::model::ListServicesResponse;
14576    /// let x = ListServicesResponse::new().set_next_page_token("example");
14577    /// ```
14578    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14579        self.next_page_token = v.into();
14580        self
14581    }
14582}
14583
14584impl wkt::message::Message for ListServicesResponse {
14585    fn typename() -> &'static str {
14586        "type.googleapis.com/google.monitoring.v3.ListServicesResponse"
14587    }
14588}
14589
14590#[doc(hidden)]
14591impl gax::paginator::internal::PageableResponse for ListServicesResponse {
14592    type PageItem = crate::model::Service;
14593
14594    fn items(self) -> std::vec::Vec<Self::PageItem> {
14595        self.services
14596    }
14597
14598    fn next_page_token(&self) -> std::string::String {
14599        use std::clone::Clone;
14600        self.next_page_token.clone()
14601    }
14602}
14603
14604/// The `UpdateService` request.
14605#[derive(Clone, Default, PartialEq)]
14606#[non_exhaustive]
14607pub struct UpdateServiceRequest {
14608    /// Required. The `Service` to draw updates from.
14609    /// The given `name` specifies the resource to update.
14610    pub service: std::option::Option<crate::model::Service>,
14611
14612    /// A set of field paths defining which fields to use for the update.
14613    pub update_mask: std::option::Option<wkt::FieldMask>,
14614
14615    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14616}
14617
14618impl UpdateServiceRequest {
14619    pub fn new() -> Self {
14620        std::default::Default::default()
14621    }
14622
14623    /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
14624    ///
14625    /// # Example
14626    /// ```ignore,no_run
14627    /// # use google_cloud_monitoring_v3::model::UpdateServiceRequest;
14628    /// use google_cloud_monitoring_v3::model::Service;
14629    /// let x = UpdateServiceRequest::new().set_service(Service::default()/* use setters */);
14630    /// ```
14631    pub fn set_service<T>(mut self, v: T) -> Self
14632    where
14633        T: std::convert::Into<crate::model::Service>,
14634    {
14635        self.service = std::option::Option::Some(v.into());
14636        self
14637    }
14638
14639    /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
14640    ///
14641    /// # Example
14642    /// ```ignore,no_run
14643    /// # use google_cloud_monitoring_v3::model::UpdateServiceRequest;
14644    /// use google_cloud_monitoring_v3::model::Service;
14645    /// let x = UpdateServiceRequest::new().set_or_clear_service(Some(Service::default()/* use setters */));
14646    /// let x = UpdateServiceRequest::new().set_or_clear_service(None::<Service>);
14647    /// ```
14648    pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
14649    where
14650        T: std::convert::Into<crate::model::Service>,
14651    {
14652        self.service = v.map(|x| x.into());
14653        self
14654    }
14655
14656    /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
14657    ///
14658    /// # Example
14659    /// ```ignore,no_run
14660    /// # use google_cloud_monitoring_v3::model::UpdateServiceRequest;
14661    /// use wkt::FieldMask;
14662    /// let x = UpdateServiceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14663    /// ```
14664    pub fn set_update_mask<T>(mut self, v: T) -> Self
14665    where
14666        T: std::convert::Into<wkt::FieldMask>,
14667    {
14668        self.update_mask = std::option::Option::Some(v.into());
14669        self
14670    }
14671
14672    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
14673    ///
14674    /// # Example
14675    /// ```ignore,no_run
14676    /// # use google_cloud_monitoring_v3::model::UpdateServiceRequest;
14677    /// use wkt::FieldMask;
14678    /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14679    /// let x = UpdateServiceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14680    /// ```
14681    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14682    where
14683        T: std::convert::Into<wkt::FieldMask>,
14684    {
14685        self.update_mask = v.map(|x| x.into());
14686        self
14687    }
14688}
14689
14690impl wkt::message::Message for UpdateServiceRequest {
14691    fn typename() -> &'static str {
14692        "type.googleapis.com/google.monitoring.v3.UpdateServiceRequest"
14693    }
14694}
14695
14696/// The `DeleteService` request.
14697#[derive(Clone, Default, PartialEq)]
14698#[non_exhaustive]
14699pub struct DeleteServiceRequest {
14700    /// Required. Resource name of the `Service` to delete. The format is:
14701    ///
14702    /// ```norust
14703    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
14704    /// ```
14705    pub name: std::string::String,
14706
14707    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14708}
14709
14710impl DeleteServiceRequest {
14711    pub fn new() -> Self {
14712        std::default::Default::default()
14713    }
14714
14715    /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
14716    ///
14717    /// # Example
14718    /// ```ignore,no_run
14719    /// # use google_cloud_monitoring_v3::model::DeleteServiceRequest;
14720    /// let x = DeleteServiceRequest::new().set_name("example");
14721    /// ```
14722    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14723        self.name = v.into();
14724        self
14725    }
14726}
14727
14728impl wkt::message::Message for DeleteServiceRequest {
14729    fn typename() -> &'static str {
14730        "type.googleapis.com/google.monitoring.v3.DeleteServiceRequest"
14731    }
14732}
14733
14734/// The `CreateServiceLevelObjective` request.
14735#[derive(Clone, Default, PartialEq)]
14736#[non_exhaustive]
14737pub struct CreateServiceLevelObjectiveRequest {
14738    /// Required. Resource name of the parent `Service`. The format is:
14739    ///
14740    /// ```norust
14741    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
14742    /// ```
14743    pub parent: std::string::String,
14744
14745    /// Optional. The ServiceLevelObjective id to use for this
14746    /// ServiceLevelObjective. If omitted, an id will be generated instead. Must
14747    /// match the pattern `^[a-zA-Z0-9-_:.]+$`
14748    pub service_level_objective_id: std::string::String,
14749
14750    /// Required. The `ServiceLevelObjective` to create.
14751    /// The provided `name` will be respected if no `ServiceLevelObjective` exists
14752    /// with this name.
14753    pub service_level_objective: std::option::Option<crate::model::ServiceLevelObjective>,
14754
14755    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14756}
14757
14758impl CreateServiceLevelObjectiveRequest {
14759    pub fn new() -> Self {
14760        std::default::Default::default()
14761    }
14762
14763    /// Sets the value of [parent][crate::model::CreateServiceLevelObjectiveRequest::parent].
14764    ///
14765    /// # Example
14766    /// ```ignore,no_run
14767    /// # use google_cloud_monitoring_v3::model::CreateServiceLevelObjectiveRequest;
14768    /// let x = CreateServiceLevelObjectiveRequest::new().set_parent("example");
14769    /// ```
14770    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14771        self.parent = v.into();
14772        self
14773    }
14774
14775    /// Sets the value of [service_level_objective_id][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective_id].
14776    ///
14777    /// # Example
14778    /// ```ignore,no_run
14779    /// # use google_cloud_monitoring_v3::model::CreateServiceLevelObjectiveRequest;
14780    /// let x = CreateServiceLevelObjectiveRequest::new().set_service_level_objective_id("example");
14781    /// ```
14782    pub fn set_service_level_objective_id<T: std::convert::Into<std::string::String>>(
14783        mut self,
14784        v: T,
14785    ) -> Self {
14786        self.service_level_objective_id = v.into();
14787        self
14788    }
14789
14790    /// Sets the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
14791    ///
14792    /// # Example
14793    /// ```ignore,no_run
14794    /// # use google_cloud_monitoring_v3::model::CreateServiceLevelObjectiveRequest;
14795    /// use google_cloud_monitoring_v3::model::ServiceLevelObjective;
14796    /// let x = CreateServiceLevelObjectiveRequest::new().set_service_level_objective(ServiceLevelObjective::default()/* use setters */);
14797    /// ```
14798    pub fn set_service_level_objective<T>(mut self, v: T) -> Self
14799    where
14800        T: std::convert::Into<crate::model::ServiceLevelObjective>,
14801    {
14802        self.service_level_objective = std::option::Option::Some(v.into());
14803        self
14804    }
14805
14806    /// Sets or clears the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
14807    ///
14808    /// # Example
14809    /// ```ignore,no_run
14810    /// # use google_cloud_monitoring_v3::model::CreateServiceLevelObjectiveRequest;
14811    /// use google_cloud_monitoring_v3::model::ServiceLevelObjective;
14812    /// let x = CreateServiceLevelObjectiveRequest::new().set_or_clear_service_level_objective(Some(ServiceLevelObjective::default()/* use setters */));
14813    /// let x = CreateServiceLevelObjectiveRequest::new().set_or_clear_service_level_objective(None::<ServiceLevelObjective>);
14814    /// ```
14815    pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
14816    where
14817        T: std::convert::Into<crate::model::ServiceLevelObjective>,
14818    {
14819        self.service_level_objective = v.map(|x| x.into());
14820        self
14821    }
14822}
14823
14824impl wkt::message::Message for CreateServiceLevelObjectiveRequest {
14825    fn typename() -> &'static str {
14826        "type.googleapis.com/google.monitoring.v3.CreateServiceLevelObjectiveRequest"
14827    }
14828}
14829
14830/// The `GetServiceLevelObjective` request.
14831#[derive(Clone, Default, PartialEq)]
14832#[non_exhaustive]
14833pub struct GetServiceLevelObjectiveRequest {
14834    /// Required. Resource name of the `ServiceLevelObjective` to get. The format
14835    /// is:
14836    ///
14837    /// ```norust
14838    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
14839    /// ```
14840    pub name: std::string::String,
14841
14842    /// View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the
14843    /// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
14844    /// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
14845    /// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
14846    pub view: crate::model::service_level_objective::View,
14847
14848    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14849}
14850
14851impl GetServiceLevelObjectiveRequest {
14852    pub fn new() -> Self {
14853        std::default::Default::default()
14854    }
14855
14856    /// Sets the value of [name][crate::model::GetServiceLevelObjectiveRequest::name].
14857    ///
14858    /// # Example
14859    /// ```ignore,no_run
14860    /// # use google_cloud_monitoring_v3::model::GetServiceLevelObjectiveRequest;
14861    /// let x = GetServiceLevelObjectiveRequest::new().set_name("example");
14862    /// ```
14863    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14864        self.name = v.into();
14865        self
14866    }
14867
14868    /// Sets the value of [view][crate::model::GetServiceLevelObjectiveRequest::view].
14869    ///
14870    /// # Example
14871    /// ```ignore,no_run
14872    /// # use google_cloud_monitoring_v3::model::GetServiceLevelObjectiveRequest;
14873    /// use google_cloud_monitoring_v3::model::service_level_objective::View;
14874    /// let x0 = GetServiceLevelObjectiveRequest::new().set_view(View::Full);
14875    /// let x1 = GetServiceLevelObjectiveRequest::new().set_view(View::Explicit);
14876    /// ```
14877    pub fn set_view<T: std::convert::Into<crate::model::service_level_objective::View>>(
14878        mut self,
14879        v: T,
14880    ) -> Self {
14881        self.view = v.into();
14882        self
14883    }
14884}
14885
14886impl wkt::message::Message for GetServiceLevelObjectiveRequest {
14887    fn typename() -> &'static str {
14888        "type.googleapis.com/google.monitoring.v3.GetServiceLevelObjectiveRequest"
14889    }
14890}
14891
14892/// The `ListServiceLevelObjectives` request.
14893#[derive(Clone, Default, PartialEq)]
14894#[non_exhaustive]
14895pub struct ListServiceLevelObjectivesRequest {
14896    /// Required. Resource name of the parent containing the listed SLOs, either a
14897    /// project or a Monitoring Metrics Scope. The formats are:
14898    ///
14899    /// ```norust
14900    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
14901    /// workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-
14902    /// ```
14903    pub parent: std::string::String,
14904
14905    /// A filter specifying what `ServiceLevelObjective`s to return.
14906    pub filter: std::string::String,
14907
14908    /// A non-negative number that is the maximum number of results to return.
14909    /// When 0, use default page size.
14910    pub page_size: i32,
14911
14912    /// If this field is not empty then it must contain the `nextPageToken` value
14913    /// returned by a previous call to this method.  Using this field causes the
14914    /// method to return additional results from the previous method call.
14915    pub page_token: std::string::String,
14916
14917    /// View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each
14918    /// `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the
14919    /// `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the
14920    /// `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed.
14921    pub view: crate::model::service_level_objective::View,
14922
14923    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14924}
14925
14926impl ListServiceLevelObjectivesRequest {
14927    pub fn new() -> Self {
14928        std::default::Default::default()
14929    }
14930
14931    /// Sets the value of [parent][crate::model::ListServiceLevelObjectivesRequest::parent].
14932    ///
14933    /// # Example
14934    /// ```ignore,no_run
14935    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesRequest;
14936    /// let x = ListServiceLevelObjectivesRequest::new().set_parent("example");
14937    /// ```
14938    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14939        self.parent = v.into();
14940        self
14941    }
14942
14943    /// Sets the value of [filter][crate::model::ListServiceLevelObjectivesRequest::filter].
14944    ///
14945    /// # Example
14946    /// ```ignore,no_run
14947    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesRequest;
14948    /// let x = ListServiceLevelObjectivesRequest::new().set_filter("example");
14949    /// ```
14950    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14951        self.filter = v.into();
14952        self
14953    }
14954
14955    /// Sets the value of [page_size][crate::model::ListServiceLevelObjectivesRequest::page_size].
14956    ///
14957    /// # Example
14958    /// ```ignore,no_run
14959    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesRequest;
14960    /// let x = ListServiceLevelObjectivesRequest::new().set_page_size(42);
14961    /// ```
14962    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14963        self.page_size = v.into();
14964        self
14965    }
14966
14967    /// Sets the value of [page_token][crate::model::ListServiceLevelObjectivesRequest::page_token].
14968    ///
14969    /// # Example
14970    /// ```ignore,no_run
14971    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesRequest;
14972    /// let x = ListServiceLevelObjectivesRequest::new().set_page_token("example");
14973    /// ```
14974    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14975        self.page_token = v.into();
14976        self
14977    }
14978
14979    /// Sets the value of [view][crate::model::ListServiceLevelObjectivesRequest::view].
14980    ///
14981    /// # Example
14982    /// ```ignore,no_run
14983    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesRequest;
14984    /// use google_cloud_monitoring_v3::model::service_level_objective::View;
14985    /// let x0 = ListServiceLevelObjectivesRequest::new().set_view(View::Full);
14986    /// let x1 = ListServiceLevelObjectivesRequest::new().set_view(View::Explicit);
14987    /// ```
14988    pub fn set_view<T: std::convert::Into<crate::model::service_level_objective::View>>(
14989        mut self,
14990        v: T,
14991    ) -> Self {
14992        self.view = v.into();
14993        self
14994    }
14995}
14996
14997impl wkt::message::Message for ListServiceLevelObjectivesRequest {
14998    fn typename() -> &'static str {
14999        "type.googleapis.com/google.monitoring.v3.ListServiceLevelObjectivesRequest"
15000    }
15001}
15002
15003/// The `ListServiceLevelObjectives` response.
15004#[derive(Clone, Default, PartialEq)]
15005#[non_exhaustive]
15006pub struct ListServiceLevelObjectivesResponse {
15007    /// The `ServiceLevelObjective`s matching the specified filter.
15008    pub service_level_objectives: std::vec::Vec<crate::model::ServiceLevelObjective>,
15009
15010    /// If there are more results than have been returned, then this field is set
15011    /// to a non-empty value.  To see the additional results,
15012    /// use that value as `page_token` in the next call to this method.
15013    pub next_page_token: std::string::String,
15014
15015    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15016}
15017
15018impl ListServiceLevelObjectivesResponse {
15019    pub fn new() -> Self {
15020        std::default::Default::default()
15021    }
15022
15023    /// Sets the value of [service_level_objectives][crate::model::ListServiceLevelObjectivesResponse::service_level_objectives].
15024    ///
15025    /// # Example
15026    /// ```ignore,no_run
15027    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesResponse;
15028    /// use google_cloud_monitoring_v3::model::ServiceLevelObjective;
15029    /// let x = ListServiceLevelObjectivesResponse::new()
15030    ///     .set_service_level_objectives([
15031    ///         ServiceLevelObjective::default()/* use setters */,
15032    ///         ServiceLevelObjective::default()/* use (different) setters */,
15033    ///     ]);
15034    /// ```
15035    pub fn set_service_level_objectives<T, V>(mut self, v: T) -> Self
15036    where
15037        T: std::iter::IntoIterator<Item = V>,
15038        V: std::convert::Into<crate::model::ServiceLevelObjective>,
15039    {
15040        use std::iter::Iterator;
15041        self.service_level_objectives = v.into_iter().map(|i| i.into()).collect();
15042        self
15043    }
15044
15045    /// Sets the value of [next_page_token][crate::model::ListServiceLevelObjectivesResponse::next_page_token].
15046    ///
15047    /// # Example
15048    /// ```ignore,no_run
15049    /// # use google_cloud_monitoring_v3::model::ListServiceLevelObjectivesResponse;
15050    /// let x = ListServiceLevelObjectivesResponse::new().set_next_page_token("example");
15051    /// ```
15052    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15053        self.next_page_token = v.into();
15054        self
15055    }
15056}
15057
15058impl wkt::message::Message for ListServiceLevelObjectivesResponse {
15059    fn typename() -> &'static str {
15060        "type.googleapis.com/google.monitoring.v3.ListServiceLevelObjectivesResponse"
15061    }
15062}
15063
15064#[doc(hidden)]
15065impl gax::paginator::internal::PageableResponse for ListServiceLevelObjectivesResponse {
15066    type PageItem = crate::model::ServiceLevelObjective;
15067
15068    fn items(self) -> std::vec::Vec<Self::PageItem> {
15069        self.service_level_objectives
15070    }
15071
15072    fn next_page_token(&self) -> std::string::String {
15073        use std::clone::Clone;
15074        self.next_page_token.clone()
15075    }
15076}
15077
15078/// The `UpdateServiceLevelObjective` request.
15079#[derive(Clone, Default, PartialEq)]
15080#[non_exhaustive]
15081pub struct UpdateServiceLevelObjectiveRequest {
15082    /// Required. The `ServiceLevelObjective` to draw updates from.
15083    /// The given `name` specifies the resource to update.
15084    pub service_level_objective: std::option::Option<crate::model::ServiceLevelObjective>,
15085
15086    /// A set of field paths defining which fields to use for the update.
15087    pub update_mask: std::option::Option<wkt::FieldMask>,
15088
15089    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15090}
15091
15092impl UpdateServiceLevelObjectiveRequest {
15093    pub fn new() -> Self {
15094        std::default::Default::default()
15095    }
15096
15097    /// Sets the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
15098    ///
15099    /// # Example
15100    /// ```ignore,no_run
15101    /// # use google_cloud_monitoring_v3::model::UpdateServiceLevelObjectiveRequest;
15102    /// use google_cloud_monitoring_v3::model::ServiceLevelObjective;
15103    /// let x = UpdateServiceLevelObjectiveRequest::new().set_service_level_objective(ServiceLevelObjective::default()/* use setters */);
15104    /// ```
15105    pub fn set_service_level_objective<T>(mut self, v: T) -> Self
15106    where
15107        T: std::convert::Into<crate::model::ServiceLevelObjective>,
15108    {
15109        self.service_level_objective = std::option::Option::Some(v.into());
15110        self
15111    }
15112
15113    /// Sets or clears the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
15114    ///
15115    /// # Example
15116    /// ```ignore,no_run
15117    /// # use google_cloud_monitoring_v3::model::UpdateServiceLevelObjectiveRequest;
15118    /// use google_cloud_monitoring_v3::model::ServiceLevelObjective;
15119    /// let x = UpdateServiceLevelObjectiveRequest::new().set_or_clear_service_level_objective(Some(ServiceLevelObjective::default()/* use setters */));
15120    /// let x = UpdateServiceLevelObjectiveRequest::new().set_or_clear_service_level_objective(None::<ServiceLevelObjective>);
15121    /// ```
15122    pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
15123    where
15124        T: std::convert::Into<crate::model::ServiceLevelObjective>,
15125    {
15126        self.service_level_objective = v.map(|x| x.into());
15127        self
15128    }
15129
15130    /// Sets the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
15131    ///
15132    /// # Example
15133    /// ```ignore,no_run
15134    /// # use google_cloud_monitoring_v3::model::UpdateServiceLevelObjectiveRequest;
15135    /// use wkt::FieldMask;
15136    /// let x = UpdateServiceLevelObjectiveRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15137    /// ```
15138    pub fn set_update_mask<T>(mut self, v: T) -> Self
15139    where
15140        T: std::convert::Into<wkt::FieldMask>,
15141    {
15142        self.update_mask = std::option::Option::Some(v.into());
15143        self
15144    }
15145
15146    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
15147    ///
15148    /// # Example
15149    /// ```ignore,no_run
15150    /// # use google_cloud_monitoring_v3::model::UpdateServiceLevelObjectiveRequest;
15151    /// use wkt::FieldMask;
15152    /// let x = UpdateServiceLevelObjectiveRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15153    /// let x = UpdateServiceLevelObjectiveRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15154    /// ```
15155    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15156    where
15157        T: std::convert::Into<wkt::FieldMask>,
15158    {
15159        self.update_mask = v.map(|x| x.into());
15160        self
15161    }
15162}
15163
15164impl wkt::message::Message for UpdateServiceLevelObjectiveRequest {
15165    fn typename() -> &'static str {
15166        "type.googleapis.com/google.monitoring.v3.UpdateServiceLevelObjectiveRequest"
15167    }
15168}
15169
15170/// The `DeleteServiceLevelObjective` request.
15171#[derive(Clone, Default, PartialEq)]
15172#[non_exhaustive]
15173pub struct DeleteServiceLevelObjectiveRequest {
15174    /// Required. Resource name of the `ServiceLevelObjective` to delete. The
15175    /// format is:
15176    ///
15177    /// ```norust
15178    /// projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
15179    /// ```
15180    pub name: std::string::String,
15181
15182    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15183}
15184
15185impl DeleteServiceLevelObjectiveRequest {
15186    pub fn new() -> Self {
15187        std::default::Default::default()
15188    }
15189
15190    /// Sets the value of [name][crate::model::DeleteServiceLevelObjectiveRequest::name].
15191    ///
15192    /// # Example
15193    /// ```ignore,no_run
15194    /// # use google_cloud_monitoring_v3::model::DeleteServiceLevelObjectiveRequest;
15195    /// let x = DeleteServiceLevelObjectiveRequest::new().set_name("example");
15196    /// ```
15197    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15198        self.name = v.into();
15199        self
15200    }
15201}
15202
15203impl wkt::message::Message for DeleteServiceLevelObjectiveRequest {
15204    fn typename() -> &'static str {
15205        "type.googleapis.com/google.monitoring.v3.DeleteServiceLevelObjectiveRequest"
15206    }
15207}
15208
15209/// A `Snooze` will prevent any alerts from being opened, and close any that
15210/// are already open. The `Snooze` will work on alerts that match the
15211/// criteria defined in the `Snooze`. The `Snooze` will be active from
15212/// `interval.start_time` through `interval.end_time`.
15213#[derive(Clone, Default, PartialEq)]
15214#[non_exhaustive]
15215pub struct Snooze {
15216    /// Required. Identifier. The name of the `Snooze`. The format is:
15217    ///
15218    /// ```norust
15219    /// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
15220    /// ```
15221    ///
15222    /// The ID of the `Snooze` will be generated by the system.
15223    pub name: std::string::String,
15224
15225    /// Required. This defines the criteria for applying the `Snooze`. See
15226    /// `Criteria` for more information.
15227    pub criteria: std::option::Option<crate::model::snooze::Criteria>,
15228
15229    /// Required. The `Snooze` will be active from `interval.start_time` through
15230    /// `interval.end_time`.
15231    /// `interval.start_time` cannot be in the past. There is a 15 second clock
15232    /// skew to account for the time it takes for a request to reach the API from
15233    /// the UI.
15234    pub interval: std::option::Option<crate::model::TimeInterval>,
15235
15236    /// Required. A display name for the `Snooze`. This can be, at most, 512
15237    /// unicode characters.
15238    pub display_name: std::string::String,
15239
15240    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15241}
15242
15243impl Snooze {
15244    pub fn new() -> Self {
15245        std::default::Default::default()
15246    }
15247
15248    /// Sets the value of [name][crate::model::Snooze::name].
15249    ///
15250    /// # Example
15251    /// ```ignore,no_run
15252    /// # use google_cloud_monitoring_v3::model::Snooze;
15253    /// let x = Snooze::new().set_name("example");
15254    /// ```
15255    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15256        self.name = v.into();
15257        self
15258    }
15259
15260    /// Sets the value of [criteria][crate::model::Snooze::criteria].
15261    ///
15262    /// # Example
15263    /// ```ignore,no_run
15264    /// # use google_cloud_monitoring_v3::model::Snooze;
15265    /// use google_cloud_monitoring_v3::model::snooze::Criteria;
15266    /// let x = Snooze::new().set_criteria(Criteria::default()/* use setters */);
15267    /// ```
15268    pub fn set_criteria<T>(mut self, v: T) -> Self
15269    where
15270        T: std::convert::Into<crate::model::snooze::Criteria>,
15271    {
15272        self.criteria = std::option::Option::Some(v.into());
15273        self
15274    }
15275
15276    /// Sets or clears the value of [criteria][crate::model::Snooze::criteria].
15277    ///
15278    /// # Example
15279    /// ```ignore,no_run
15280    /// # use google_cloud_monitoring_v3::model::Snooze;
15281    /// use google_cloud_monitoring_v3::model::snooze::Criteria;
15282    /// let x = Snooze::new().set_or_clear_criteria(Some(Criteria::default()/* use setters */));
15283    /// let x = Snooze::new().set_or_clear_criteria(None::<Criteria>);
15284    /// ```
15285    pub fn set_or_clear_criteria<T>(mut self, v: std::option::Option<T>) -> Self
15286    where
15287        T: std::convert::Into<crate::model::snooze::Criteria>,
15288    {
15289        self.criteria = v.map(|x| x.into());
15290        self
15291    }
15292
15293    /// Sets the value of [interval][crate::model::Snooze::interval].
15294    ///
15295    /// # Example
15296    /// ```ignore,no_run
15297    /// # use google_cloud_monitoring_v3::model::Snooze;
15298    /// use google_cloud_monitoring_v3::model::TimeInterval;
15299    /// let x = Snooze::new().set_interval(TimeInterval::default()/* use setters */);
15300    /// ```
15301    pub fn set_interval<T>(mut self, v: T) -> Self
15302    where
15303        T: std::convert::Into<crate::model::TimeInterval>,
15304    {
15305        self.interval = std::option::Option::Some(v.into());
15306        self
15307    }
15308
15309    /// Sets or clears the value of [interval][crate::model::Snooze::interval].
15310    ///
15311    /// # Example
15312    /// ```ignore,no_run
15313    /// # use google_cloud_monitoring_v3::model::Snooze;
15314    /// use google_cloud_monitoring_v3::model::TimeInterval;
15315    /// let x = Snooze::new().set_or_clear_interval(Some(TimeInterval::default()/* use setters */));
15316    /// let x = Snooze::new().set_or_clear_interval(None::<TimeInterval>);
15317    /// ```
15318    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
15319    where
15320        T: std::convert::Into<crate::model::TimeInterval>,
15321    {
15322        self.interval = v.map(|x| x.into());
15323        self
15324    }
15325
15326    /// Sets the value of [display_name][crate::model::Snooze::display_name].
15327    ///
15328    /// # Example
15329    /// ```ignore,no_run
15330    /// # use google_cloud_monitoring_v3::model::Snooze;
15331    /// let x = Snooze::new().set_display_name("example");
15332    /// ```
15333    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15334        self.display_name = v.into();
15335        self
15336    }
15337}
15338
15339impl wkt::message::Message for Snooze {
15340    fn typename() -> &'static str {
15341        "type.googleapis.com/google.monitoring.v3.Snooze"
15342    }
15343}
15344
15345/// Defines additional types related to [Snooze].
15346pub mod snooze {
15347    #[allow(unused_imports)]
15348    use super::*;
15349
15350    /// Criteria specific to the `AlertPolicy`s that this `Snooze` applies to. The
15351    /// `Snooze` will suppress alerts that come from one of the `AlertPolicy`s
15352    /// whose names are supplied.
15353    #[derive(Clone, Default, PartialEq)]
15354    #[non_exhaustive]
15355    pub struct Criteria {
15356        /// The specific `AlertPolicy` names for the alert that should be snoozed.
15357        /// The format is:
15358        ///
15359        /// ```norust
15360        /// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]
15361        /// ```
15362        ///
15363        /// There is a limit of 16 policies per snooze. This limit is checked during
15364        /// snooze creation.
15365        /// Exactly 1 alert policy is required if `filter` is specified at the same
15366        /// time.
15367        pub policies: std::vec::Vec<std::string::String>,
15368
15369        /// Optional. The filter string to match on Alert fields when silencing the
15370        /// alerts. It follows the standard <https://google.aip.dev/160> syntax.
15371        /// A filter string used to apply the snooze to specific incidents
15372        /// that have matching filter values.
15373        /// Filters can be defined for snoozes that apply to one alerting
15374        /// policy.
15375        /// Filters must be a string formatted as one or more resource labels with
15376        /// specific label values. If multiple resource labels are used, then they
15377        /// must be connected with an AND operator. For example, the following filter
15378        /// applies the snooze to incidents that have an instance ID of
15379        /// `1234567890` and a zone of `us-central1-a`:
15380        ///
15381        /// ```norust
15382        /// resource.labels.instance_id="1234567890" AND
15383        /// resource.labels.zone="us-central1-a"
15384        /// ```
15385        pub filter: std::string::String,
15386
15387        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15388    }
15389
15390    impl Criteria {
15391        pub fn new() -> Self {
15392            std::default::Default::default()
15393        }
15394
15395        /// Sets the value of [policies][crate::model::snooze::Criteria::policies].
15396        ///
15397        /// # Example
15398        /// ```ignore,no_run
15399        /// # use google_cloud_monitoring_v3::model::snooze::Criteria;
15400        /// let x = Criteria::new().set_policies(["a", "b", "c"]);
15401        /// ```
15402        pub fn set_policies<T, V>(mut self, v: T) -> Self
15403        where
15404            T: std::iter::IntoIterator<Item = V>,
15405            V: std::convert::Into<std::string::String>,
15406        {
15407            use std::iter::Iterator;
15408            self.policies = v.into_iter().map(|i| i.into()).collect();
15409            self
15410        }
15411
15412        /// Sets the value of [filter][crate::model::snooze::Criteria::filter].
15413        ///
15414        /// # Example
15415        /// ```ignore,no_run
15416        /// # use google_cloud_monitoring_v3::model::snooze::Criteria;
15417        /// let x = Criteria::new().set_filter("example");
15418        /// ```
15419        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15420            self.filter = v.into();
15421            self
15422        }
15423    }
15424
15425    impl wkt::message::Message for Criteria {
15426        fn typename() -> &'static str {
15427            "type.googleapis.com/google.monitoring.v3.Snooze.Criteria"
15428        }
15429    }
15430}
15431
15432/// The message definition for creating a `Snooze`. Users must provide the body
15433/// of the `Snooze` to be created but must omit the `Snooze` field, `name`.
15434#[derive(Clone, Default, PartialEq)]
15435#[non_exhaustive]
15436pub struct CreateSnoozeRequest {
15437    /// Required. The
15438    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
15439    /// a `Snooze` should be created. The format is:
15440    ///
15441    /// ```norust
15442    /// projects/[PROJECT_ID_OR_NUMBER]
15443    /// ```
15444    pub parent: std::string::String,
15445
15446    /// Required. The `Snooze` to create. Omit the `name` field, as it will be
15447    /// filled in by the API.
15448    pub snooze: std::option::Option<crate::model::Snooze>,
15449
15450    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15451}
15452
15453impl CreateSnoozeRequest {
15454    pub fn new() -> Self {
15455        std::default::Default::default()
15456    }
15457
15458    /// Sets the value of [parent][crate::model::CreateSnoozeRequest::parent].
15459    ///
15460    /// # Example
15461    /// ```ignore,no_run
15462    /// # use google_cloud_monitoring_v3::model::CreateSnoozeRequest;
15463    /// let x = CreateSnoozeRequest::new().set_parent("example");
15464    /// ```
15465    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15466        self.parent = v.into();
15467        self
15468    }
15469
15470    /// Sets the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
15471    ///
15472    /// # Example
15473    /// ```ignore,no_run
15474    /// # use google_cloud_monitoring_v3::model::CreateSnoozeRequest;
15475    /// use google_cloud_monitoring_v3::model::Snooze;
15476    /// let x = CreateSnoozeRequest::new().set_snooze(Snooze::default()/* use setters */);
15477    /// ```
15478    pub fn set_snooze<T>(mut self, v: T) -> Self
15479    where
15480        T: std::convert::Into<crate::model::Snooze>,
15481    {
15482        self.snooze = std::option::Option::Some(v.into());
15483        self
15484    }
15485
15486    /// Sets or clears the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
15487    ///
15488    /// # Example
15489    /// ```ignore,no_run
15490    /// # use google_cloud_monitoring_v3::model::CreateSnoozeRequest;
15491    /// use google_cloud_monitoring_v3::model::Snooze;
15492    /// let x = CreateSnoozeRequest::new().set_or_clear_snooze(Some(Snooze::default()/* use setters */));
15493    /// let x = CreateSnoozeRequest::new().set_or_clear_snooze(None::<Snooze>);
15494    /// ```
15495    pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
15496    where
15497        T: std::convert::Into<crate::model::Snooze>,
15498    {
15499        self.snooze = v.map(|x| x.into());
15500        self
15501    }
15502}
15503
15504impl wkt::message::Message for CreateSnoozeRequest {
15505    fn typename() -> &'static str {
15506        "type.googleapis.com/google.monitoring.v3.CreateSnoozeRequest"
15507    }
15508}
15509
15510/// The message definition for listing `Snooze`s associated with the given
15511/// `parent`, satisfying the optional `filter`.
15512#[derive(Clone, Default, PartialEq)]
15513#[non_exhaustive]
15514pub struct ListSnoozesRequest {
15515    /// Required. The
15516    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
15517    /// `Snooze`s should be listed. The format is:
15518    ///
15519    /// ```norust
15520    /// projects/[PROJECT_ID_OR_NUMBER]
15521    /// ```
15522    pub parent: std::string::String,
15523
15524    /// Optional. Optional filter to restrict results to the given criteria. The
15525    /// following fields are supported.
15526    ///
15527    /// * `interval.start_time`
15528    /// * `interval.end_time`
15529    ///
15530    /// For example:
15531    ///
15532    /// ```norust
15533    /// interval.start_time > "2022-03-11T00:00:00-08:00" AND
15534    ///     interval.end_time < "2022-03-12T00:00:00-08:00"
15535    /// ```
15536    pub filter: std::string::String,
15537
15538    /// Optional. The maximum number of results to return for a single query. The
15539    /// server may further constrain the maximum number of results returned in a
15540    /// single page. The value should be in the range [1, 1000]. If the value given
15541    /// is outside this range, the server will decide the number of results to be
15542    /// returned.
15543    pub page_size: i32,
15544
15545    /// Optional. The `next_page_token` from a previous call to
15546    /// `ListSnoozesRequest` to get the next page of results.
15547    pub page_token: std::string::String,
15548
15549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15550}
15551
15552impl ListSnoozesRequest {
15553    pub fn new() -> Self {
15554        std::default::Default::default()
15555    }
15556
15557    /// Sets the value of [parent][crate::model::ListSnoozesRequest::parent].
15558    ///
15559    /// # Example
15560    /// ```ignore,no_run
15561    /// # use google_cloud_monitoring_v3::model::ListSnoozesRequest;
15562    /// let x = ListSnoozesRequest::new().set_parent("example");
15563    /// ```
15564    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15565        self.parent = v.into();
15566        self
15567    }
15568
15569    /// Sets the value of [filter][crate::model::ListSnoozesRequest::filter].
15570    ///
15571    /// # Example
15572    /// ```ignore,no_run
15573    /// # use google_cloud_monitoring_v3::model::ListSnoozesRequest;
15574    /// let x = ListSnoozesRequest::new().set_filter("example");
15575    /// ```
15576    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15577        self.filter = v.into();
15578        self
15579    }
15580
15581    /// Sets the value of [page_size][crate::model::ListSnoozesRequest::page_size].
15582    ///
15583    /// # Example
15584    /// ```ignore,no_run
15585    /// # use google_cloud_monitoring_v3::model::ListSnoozesRequest;
15586    /// let x = ListSnoozesRequest::new().set_page_size(42);
15587    /// ```
15588    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15589        self.page_size = v.into();
15590        self
15591    }
15592
15593    /// Sets the value of [page_token][crate::model::ListSnoozesRequest::page_token].
15594    ///
15595    /// # Example
15596    /// ```ignore,no_run
15597    /// # use google_cloud_monitoring_v3::model::ListSnoozesRequest;
15598    /// let x = ListSnoozesRequest::new().set_page_token("example");
15599    /// ```
15600    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15601        self.page_token = v.into();
15602        self
15603    }
15604}
15605
15606impl wkt::message::Message for ListSnoozesRequest {
15607    fn typename() -> &'static str {
15608        "type.googleapis.com/google.monitoring.v3.ListSnoozesRequest"
15609    }
15610}
15611
15612/// The results of a successful `ListSnoozes` call, containing the matching
15613/// `Snooze`s.
15614#[derive(Clone, Default, PartialEq)]
15615#[non_exhaustive]
15616pub struct ListSnoozesResponse {
15617    /// `Snooze`s matching this list call.
15618    pub snoozes: std::vec::Vec<crate::model::Snooze>,
15619
15620    /// Page token for repeated calls to `ListSnoozes`, to fetch additional pages
15621    /// of results. If this is empty or missing, there are no more pages.
15622    pub next_page_token: std::string::String,
15623
15624    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15625}
15626
15627impl ListSnoozesResponse {
15628    pub fn new() -> Self {
15629        std::default::Default::default()
15630    }
15631
15632    /// Sets the value of [snoozes][crate::model::ListSnoozesResponse::snoozes].
15633    ///
15634    /// # Example
15635    /// ```ignore,no_run
15636    /// # use google_cloud_monitoring_v3::model::ListSnoozesResponse;
15637    /// use google_cloud_monitoring_v3::model::Snooze;
15638    /// let x = ListSnoozesResponse::new()
15639    ///     .set_snoozes([
15640    ///         Snooze::default()/* use setters */,
15641    ///         Snooze::default()/* use (different) setters */,
15642    ///     ]);
15643    /// ```
15644    pub fn set_snoozes<T, V>(mut self, v: T) -> Self
15645    where
15646        T: std::iter::IntoIterator<Item = V>,
15647        V: std::convert::Into<crate::model::Snooze>,
15648    {
15649        use std::iter::Iterator;
15650        self.snoozes = v.into_iter().map(|i| i.into()).collect();
15651        self
15652    }
15653
15654    /// Sets the value of [next_page_token][crate::model::ListSnoozesResponse::next_page_token].
15655    ///
15656    /// # Example
15657    /// ```ignore,no_run
15658    /// # use google_cloud_monitoring_v3::model::ListSnoozesResponse;
15659    /// let x = ListSnoozesResponse::new().set_next_page_token("example");
15660    /// ```
15661    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15662        self.next_page_token = v.into();
15663        self
15664    }
15665}
15666
15667impl wkt::message::Message for ListSnoozesResponse {
15668    fn typename() -> &'static str {
15669        "type.googleapis.com/google.monitoring.v3.ListSnoozesResponse"
15670    }
15671}
15672
15673#[doc(hidden)]
15674impl gax::paginator::internal::PageableResponse for ListSnoozesResponse {
15675    type PageItem = crate::model::Snooze;
15676
15677    fn items(self) -> std::vec::Vec<Self::PageItem> {
15678        self.snoozes
15679    }
15680
15681    fn next_page_token(&self) -> std::string::String {
15682        use std::clone::Clone;
15683        self.next_page_token.clone()
15684    }
15685}
15686
15687/// The message definition for retrieving a `Snooze`. Users must specify the
15688/// field, `name`, which identifies the `Snooze`.
15689#[derive(Clone, Default, PartialEq)]
15690#[non_exhaustive]
15691pub struct GetSnoozeRequest {
15692    /// Required. The ID of the `Snooze` to retrieve. The format is:
15693    ///
15694    /// ```norust
15695    /// projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
15696    /// ```
15697    pub name: std::string::String,
15698
15699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15700}
15701
15702impl GetSnoozeRequest {
15703    pub fn new() -> Self {
15704        std::default::Default::default()
15705    }
15706
15707    /// Sets the value of [name][crate::model::GetSnoozeRequest::name].
15708    ///
15709    /// # Example
15710    /// ```ignore,no_run
15711    /// # use google_cloud_monitoring_v3::model::GetSnoozeRequest;
15712    /// let x = GetSnoozeRequest::new().set_name("example");
15713    /// ```
15714    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15715        self.name = v.into();
15716        self
15717    }
15718}
15719
15720impl wkt::message::Message for GetSnoozeRequest {
15721    fn typename() -> &'static str {
15722        "type.googleapis.com/google.monitoring.v3.GetSnoozeRequest"
15723    }
15724}
15725
15726/// The message definition for updating a `Snooze`. The field, `snooze.name`
15727/// identifies the `Snooze` to be updated. The remainder of `snooze` gives the
15728/// content the `Snooze` in question will be assigned.
15729///
15730/// What fields can be updated depends on the start time and end time of the
15731/// `Snooze`.
15732///
15733/// * end time is in the past: These `Snooze`s are considered
15734///   read-only and cannot be updated.
15735/// * start time is in the past and end time is in the future: `display_name`
15736///   and `interval.end_time` can be updated.
15737/// * start time is in the future: `display_name`, `interval.start_time` and
15738///   `interval.end_time` can be updated.
15739#[derive(Clone, Default, PartialEq)]
15740#[non_exhaustive]
15741pub struct UpdateSnoozeRequest {
15742    /// Required. The `Snooze` to update. Must have the name field present.
15743    pub snooze: std::option::Option<crate::model::Snooze>,
15744
15745    /// Required. The fields to update.
15746    ///
15747    /// For each field listed in `update_mask`:
15748    ///
15749    /// * If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a
15750    ///   value for that field, the value of the field in the existing `Snooze`
15751    ///   will be set to the value of the field in the supplied `Snooze`.
15752    /// * If the field does not have a value in the supplied `Snooze`, the field
15753    ///   in the existing `Snooze` is set to its default value.
15754    ///
15755    /// Fields not listed retain their existing value.
15756    ///
15757    /// The following are the field names that are accepted in `update_mask`:
15758    ///
15759    /// * `display_name`
15760    /// * `interval.start_time`
15761    /// * `interval.end_time`
15762    ///
15763    /// That said, the start time and end time of the `Snooze` determines which
15764    /// fields can legally be updated. Before attempting an update, users should
15765    /// consult the documentation for `UpdateSnoozeRequest`, which talks about
15766    /// which fields can be updated.
15767    pub update_mask: std::option::Option<wkt::FieldMask>,
15768
15769    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15770}
15771
15772impl UpdateSnoozeRequest {
15773    pub fn new() -> Self {
15774        std::default::Default::default()
15775    }
15776
15777    /// Sets the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
15778    ///
15779    /// # Example
15780    /// ```ignore,no_run
15781    /// # use google_cloud_monitoring_v3::model::UpdateSnoozeRequest;
15782    /// use google_cloud_monitoring_v3::model::Snooze;
15783    /// let x = UpdateSnoozeRequest::new().set_snooze(Snooze::default()/* use setters */);
15784    /// ```
15785    pub fn set_snooze<T>(mut self, v: T) -> Self
15786    where
15787        T: std::convert::Into<crate::model::Snooze>,
15788    {
15789        self.snooze = std::option::Option::Some(v.into());
15790        self
15791    }
15792
15793    /// Sets or clears the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
15794    ///
15795    /// # Example
15796    /// ```ignore,no_run
15797    /// # use google_cloud_monitoring_v3::model::UpdateSnoozeRequest;
15798    /// use google_cloud_monitoring_v3::model::Snooze;
15799    /// let x = UpdateSnoozeRequest::new().set_or_clear_snooze(Some(Snooze::default()/* use setters */));
15800    /// let x = UpdateSnoozeRequest::new().set_or_clear_snooze(None::<Snooze>);
15801    /// ```
15802    pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
15803    where
15804        T: std::convert::Into<crate::model::Snooze>,
15805    {
15806        self.snooze = v.map(|x| x.into());
15807        self
15808    }
15809
15810    /// Sets the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
15811    ///
15812    /// # Example
15813    /// ```ignore,no_run
15814    /// # use google_cloud_monitoring_v3::model::UpdateSnoozeRequest;
15815    /// use wkt::FieldMask;
15816    /// let x = UpdateSnoozeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15817    /// ```
15818    pub fn set_update_mask<T>(mut self, v: T) -> Self
15819    where
15820        T: std::convert::Into<wkt::FieldMask>,
15821    {
15822        self.update_mask = std::option::Option::Some(v.into());
15823        self
15824    }
15825
15826    /// Sets or clears the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
15827    ///
15828    /// # Example
15829    /// ```ignore,no_run
15830    /// # use google_cloud_monitoring_v3::model::UpdateSnoozeRequest;
15831    /// use wkt::FieldMask;
15832    /// let x = UpdateSnoozeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15833    /// let x = UpdateSnoozeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15834    /// ```
15835    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15836    where
15837        T: std::convert::Into<wkt::FieldMask>,
15838    {
15839        self.update_mask = v.map(|x| x.into());
15840        self
15841    }
15842}
15843
15844impl wkt::message::Message for UpdateSnoozeRequest {
15845    fn typename() -> &'static str {
15846        "type.googleapis.com/google.monitoring.v3.UpdateSnoozeRequest"
15847    }
15848}
15849
15850/// The context of a span. This is attached to an
15851/// [Exemplar][google.api.Distribution.Exemplar]
15852/// in [Distribution][google.api.Distribution] values during aggregation.
15853///
15854/// It contains the name of a span with format:
15855///
15856/// ```norust
15857/// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
15858/// ```
15859///
15860/// [google.api.Distribution]: api::model::Distribution
15861/// [google.api.Distribution.Exemplar]: api::model::distribution::Exemplar
15862#[derive(Clone, Default, PartialEq)]
15863#[non_exhaustive]
15864pub struct SpanContext {
15865    /// The resource name of the span. The format is:
15866    ///
15867    /// ```norust
15868    /// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID]
15869    /// ```
15870    ///
15871    /// `[TRACE_ID]` is a unique identifier for a trace within a project;
15872    /// it is a 32-character hexadecimal encoding of a 16-byte array.
15873    ///
15874    /// `[SPAN_ID]` is a unique identifier for a span within a trace; it
15875    /// is a 16-character hexadecimal encoding of an 8-byte array.
15876    pub span_name: std::string::String,
15877
15878    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15879}
15880
15881impl SpanContext {
15882    pub fn new() -> Self {
15883        std::default::Default::default()
15884    }
15885
15886    /// Sets the value of [span_name][crate::model::SpanContext::span_name].
15887    ///
15888    /// # Example
15889    /// ```ignore,no_run
15890    /// # use google_cloud_monitoring_v3::model::SpanContext;
15891    /// let x = SpanContext::new().set_span_name("example");
15892    /// ```
15893    pub fn set_span_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15894        self.span_name = v.into();
15895        self
15896    }
15897}
15898
15899impl wkt::message::Message for SpanContext {
15900    fn typename() -> &'static str {
15901        "type.googleapis.com/google.monitoring.v3.SpanContext"
15902    }
15903}
15904
15905/// An internal checker allows Uptime checks to run on private/internal GCP
15906/// resources.
15907#[derive(Clone, Default, PartialEq)]
15908#[non_exhaustive]
15909#[deprecated]
15910pub struct InternalChecker {
15911    /// A unique resource name for this InternalChecker. The format is:
15912    ///
15913    /// ```norust
15914    /// projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
15915    /// ```
15916    ///
15917    /// `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for
15918    /// the Uptime check config associated with the internal checker.
15919    pub name: std::string::String,
15920
15921    /// The checker's human-readable name. The display name
15922    /// should be unique within a Cloud Monitoring Metrics Scope in order to make
15923    /// it easier to identify; however, uniqueness is not enforced.
15924    pub display_name: std::string::String,
15925
15926    /// The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
15927    /// internal resource lives (ex: "default").
15928    pub network: std::string::String,
15929
15930    /// The GCP zone the Uptime check should egress from. Only respected for
15931    /// internal Uptime checks, where internal_network is specified.
15932    pub gcp_zone: std::string::String,
15933
15934    /// The GCP project ID where the internal checker lives. Not necessary
15935    /// the same as the Metrics Scope project.
15936    pub peer_project_id: std::string::String,
15937
15938    /// The current operational state of the internal checker.
15939    pub state: crate::model::internal_checker::State,
15940
15941    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15942}
15943
15944impl InternalChecker {
15945    pub fn new() -> Self {
15946        std::default::Default::default()
15947    }
15948
15949    /// Sets the value of [name][crate::model::InternalChecker::name].
15950    ///
15951    /// # Example
15952    /// ```ignore,no_run
15953    /// # use google_cloud_monitoring_v3::model::InternalChecker;
15954    /// let x = InternalChecker::new().set_name("example");
15955    /// ```
15956    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15957        self.name = v.into();
15958        self
15959    }
15960
15961    /// Sets the value of [display_name][crate::model::InternalChecker::display_name].
15962    ///
15963    /// # Example
15964    /// ```ignore,no_run
15965    /// # use google_cloud_monitoring_v3::model::InternalChecker;
15966    /// let x = InternalChecker::new().set_display_name("example");
15967    /// ```
15968    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15969        self.display_name = v.into();
15970        self
15971    }
15972
15973    /// Sets the value of [network][crate::model::InternalChecker::network].
15974    ///
15975    /// # Example
15976    /// ```ignore,no_run
15977    /// # use google_cloud_monitoring_v3::model::InternalChecker;
15978    /// let x = InternalChecker::new().set_network("example");
15979    /// ```
15980    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15981        self.network = v.into();
15982        self
15983    }
15984
15985    /// Sets the value of [gcp_zone][crate::model::InternalChecker::gcp_zone].
15986    ///
15987    /// # Example
15988    /// ```ignore,no_run
15989    /// # use google_cloud_monitoring_v3::model::InternalChecker;
15990    /// let x = InternalChecker::new().set_gcp_zone("example");
15991    /// ```
15992    pub fn set_gcp_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15993        self.gcp_zone = v.into();
15994        self
15995    }
15996
15997    /// Sets the value of [peer_project_id][crate::model::InternalChecker::peer_project_id].
15998    ///
15999    /// # Example
16000    /// ```ignore,no_run
16001    /// # use google_cloud_monitoring_v3::model::InternalChecker;
16002    /// let x = InternalChecker::new().set_peer_project_id("example");
16003    /// ```
16004    pub fn set_peer_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16005        self.peer_project_id = v.into();
16006        self
16007    }
16008
16009    /// Sets the value of [state][crate::model::InternalChecker::state].
16010    ///
16011    /// # Example
16012    /// ```ignore,no_run
16013    /// # use google_cloud_monitoring_v3::model::InternalChecker;
16014    /// use google_cloud_monitoring_v3::model::internal_checker::State;
16015    /// let x0 = InternalChecker::new().set_state(State::Creating);
16016    /// let x1 = InternalChecker::new().set_state(State::Running);
16017    /// ```
16018    pub fn set_state<T: std::convert::Into<crate::model::internal_checker::State>>(
16019        mut self,
16020        v: T,
16021    ) -> Self {
16022        self.state = v.into();
16023        self
16024    }
16025}
16026
16027impl wkt::message::Message for InternalChecker {
16028    fn typename() -> &'static str {
16029        "type.googleapis.com/google.monitoring.v3.InternalChecker"
16030    }
16031}
16032
16033/// Defines additional types related to [InternalChecker].
16034pub mod internal_checker {
16035    #[allow(unused_imports)]
16036    use super::*;
16037
16038    /// Operational states for an internal checker.
16039    ///
16040    /// # Working with unknown values
16041    ///
16042    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16043    /// additional enum variants at any time. Adding new variants is not considered
16044    /// a breaking change. Applications should write their code in anticipation of:
16045    ///
16046    /// - New values appearing in future releases of the client library, **and**
16047    /// - New values received dynamically, without application changes.
16048    ///
16049    /// Please consult the [Working with enums] section in the user guide for some
16050    /// guidelines.
16051    ///
16052    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16053    #[derive(Clone, Debug, PartialEq)]
16054    #[non_exhaustive]
16055    pub enum State {
16056        /// An internal checker should never be in the unspecified state.
16057        Unspecified,
16058        /// The checker is being created, provisioned, and configured. A checker in
16059        /// this state can be returned by `ListInternalCheckers` or
16060        /// `GetInternalChecker`, as well as by examining the [long running
16061        /// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
16062        /// that created it.
16063        Creating,
16064        /// The checker is running and available for use. A checker in this state
16065        /// can be returned by `ListInternalCheckers` or `GetInternalChecker` as
16066        /// well as by examining the [long running
16067        /// Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
16068        /// that created it.
16069        /// If a checker is being torn down, it is neither visible nor usable, so
16070        /// there is no "deleting" or "down" state.
16071        Running,
16072        /// If set, the enum was initialized with an unknown value.
16073        ///
16074        /// Applications can examine the value using [State::value] or
16075        /// [State::name].
16076        UnknownValue(state::UnknownValue),
16077    }
16078
16079    #[doc(hidden)]
16080    pub mod state {
16081        #[allow(unused_imports)]
16082        use super::*;
16083        #[derive(Clone, Debug, PartialEq)]
16084        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16085    }
16086
16087    impl State {
16088        /// Gets the enum value.
16089        ///
16090        /// Returns `None` if the enum contains an unknown value deserialized from
16091        /// the string representation of enums.
16092        pub fn value(&self) -> std::option::Option<i32> {
16093            match self {
16094                Self::Unspecified => std::option::Option::Some(0),
16095                Self::Creating => std::option::Option::Some(1),
16096                Self::Running => std::option::Option::Some(2),
16097                Self::UnknownValue(u) => u.0.value(),
16098            }
16099        }
16100
16101        /// Gets the enum value as a string.
16102        ///
16103        /// Returns `None` if the enum contains an unknown value deserialized from
16104        /// the integer representation of enums.
16105        pub fn name(&self) -> std::option::Option<&str> {
16106            match self {
16107                Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
16108                Self::Creating => std::option::Option::Some("CREATING"),
16109                Self::Running => std::option::Option::Some("RUNNING"),
16110                Self::UnknownValue(u) => u.0.name(),
16111            }
16112        }
16113    }
16114
16115    impl std::default::Default for State {
16116        fn default() -> Self {
16117            use std::convert::From;
16118            Self::from(0)
16119        }
16120    }
16121
16122    impl std::fmt::Display for State {
16123        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16124            wkt::internal::display_enum(f, self.name(), self.value())
16125        }
16126    }
16127
16128    impl std::convert::From<i32> for State {
16129        fn from(value: i32) -> Self {
16130            match value {
16131                0 => Self::Unspecified,
16132                1 => Self::Creating,
16133                2 => Self::Running,
16134                _ => Self::UnknownValue(state::UnknownValue(
16135                    wkt::internal::UnknownEnumValue::Integer(value),
16136                )),
16137            }
16138        }
16139    }
16140
16141    impl std::convert::From<&str> for State {
16142        fn from(value: &str) -> Self {
16143            use std::string::ToString;
16144            match value {
16145                "UNSPECIFIED" => Self::Unspecified,
16146                "CREATING" => Self::Creating,
16147                "RUNNING" => Self::Running,
16148                _ => Self::UnknownValue(state::UnknownValue(
16149                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16150                )),
16151            }
16152        }
16153    }
16154
16155    impl serde::ser::Serialize for State {
16156        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16157        where
16158            S: serde::Serializer,
16159        {
16160            match self {
16161                Self::Unspecified => serializer.serialize_i32(0),
16162                Self::Creating => serializer.serialize_i32(1),
16163                Self::Running => serializer.serialize_i32(2),
16164                Self::UnknownValue(u) => u.0.serialize(serializer),
16165            }
16166        }
16167    }
16168
16169    impl<'de> serde::de::Deserialize<'de> for State {
16170        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16171        where
16172            D: serde::Deserializer<'de>,
16173        {
16174            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
16175                ".google.monitoring.v3.InternalChecker.State",
16176            ))
16177        }
16178    }
16179}
16180
16181/// Describes a Synthetic Monitor to be invoked by Uptime.
16182#[derive(Clone, Default, PartialEq)]
16183#[non_exhaustive]
16184pub struct SyntheticMonitorTarget {
16185    /// Specifies a Synthetic Monitor's execution stack.
16186    pub target: std::option::Option<crate::model::synthetic_monitor_target::Target>,
16187
16188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16189}
16190
16191impl SyntheticMonitorTarget {
16192    pub fn new() -> Self {
16193        std::default::Default::default()
16194    }
16195
16196    /// Sets the value of [target][crate::model::SyntheticMonitorTarget::target].
16197    ///
16198    /// Note that all the setters affecting `target` are mutually
16199    /// exclusive.
16200    ///
16201    /// # Example
16202    /// ```ignore,no_run
16203    /// # use google_cloud_monitoring_v3::model::SyntheticMonitorTarget;
16204    /// use google_cloud_monitoring_v3::model::synthetic_monitor_target::CloudFunctionV2Target;
16205    /// let x = SyntheticMonitorTarget::new().set_target(Some(
16206    ///     google_cloud_monitoring_v3::model::synthetic_monitor_target::Target::CloudFunctionV2(CloudFunctionV2Target::default().into())));
16207    /// ```
16208    pub fn set_target<
16209        T: std::convert::Into<std::option::Option<crate::model::synthetic_monitor_target::Target>>,
16210    >(
16211        mut self,
16212        v: T,
16213    ) -> Self {
16214        self.target = v.into();
16215        self
16216    }
16217
16218    /// The value of [target][crate::model::SyntheticMonitorTarget::target]
16219    /// if it holds a `CloudFunctionV2`, `None` if the field is not set or
16220    /// holds a different branch.
16221    pub fn cloud_function_v2(
16222        &self,
16223    ) -> std::option::Option<
16224        &std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
16225    > {
16226        #[allow(unreachable_patterns)]
16227        self.target.as_ref().and_then(|v| match v {
16228            crate::model::synthetic_monitor_target::Target::CloudFunctionV2(v) => {
16229                std::option::Option::Some(v)
16230            }
16231            _ => std::option::Option::None,
16232        })
16233    }
16234
16235    /// Sets the value of [target][crate::model::SyntheticMonitorTarget::target]
16236    /// to hold a `CloudFunctionV2`.
16237    ///
16238    /// Note that all the setters affecting `target` are
16239    /// mutually exclusive.
16240    ///
16241    /// # Example
16242    /// ```ignore,no_run
16243    /// # use google_cloud_monitoring_v3::model::SyntheticMonitorTarget;
16244    /// use google_cloud_monitoring_v3::model::synthetic_monitor_target::CloudFunctionV2Target;
16245    /// let x = SyntheticMonitorTarget::new().set_cloud_function_v2(CloudFunctionV2Target::default()/* use setters */);
16246    /// assert!(x.cloud_function_v2().is_some());
16247    /// ```
16248    pub fn set_cloud_function_v2<
16249        T: std::convert::Into<
16250                std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
16251            >,
16252    >(
16253        mut self,
16254        v: T,
16255    ) -> Self {
16256        self.target = std::option::Option::Some(
16257            crate::model::synthetic_monitor_target::Target::CloudFunctionV2(v.into()),
16258        );
16259        self
16260    }
16261}
16262
16263impl wkt::message::Message for SyntheticMonitorTarget {
16264    fn typename() -> &'static str {
16265        "type.googleapis.com/google.monitoring.v3.SyntheticMonitorTarget"
16266    }
16267}
16268
16269/// Defines additional types related to [SyntheticMonitorTarget].
16270pub mod synthetic_monitor_target {
16271    #[allow(unused_imports)]
16272    use super::*;
16273
16274    /// A Synthetic Monitor deployed to a Cloud Functions V2 instance.
16275    #[derive(Clone, Default, PartialEq)]
16276    #[non_exhaustive]
16277    pub struct CloudFunctionV2Target {
16278        /// Required. Fully qualified GCFv2 resource name
16279        /// i.e. `projects/{project}/locations/{location}/functions/{function}`
16280        /// Required.
16281        pub name: std::string::String,
16282
16283        /// Output only. The `cloud_run_revision` Monitored Resource associated with
16284        /// the GCFv2. The Synthetic Monitor execution results (metrics, logs, and
16285        /// spans) are reported against this Monitored Resource. This field is output
16286        /// only.
16287        pub cloud_run_revision: std::option::Option<api::model::MonitoredResource>,
16288
16289        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16290    }
16291
16292    impl CloudFunctionV2Target {
16293        pub fn new() -> Self {
16294            std::default::Default::default()
16295        }
16296
16297        /// Sets the value of [name][crate::model::synthetic_monitor_target::CloudFunctionV2Target::name].
16298        ///
16299        /// # Example
16300        /// ```ignore,no_run
16301        /// # use google_cloud_monitoring_v3::model::synthetic_monitor_target::CloudFunctionV2Target;
16302        /// let x = CloudFunctionV2Target::new().set_name("example");
16303        /// ```
16304        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16305            self.name = v.into();
16306            self
16307        }
16308
16309        /// Sets the value of [cloud_run_revision][crate::model::synthetic_monitor_target::CloudFunctionV2Target::cloud_run_revision].
16310        ///
16311        /// # Example
16312        /// ```ignore,no_run
16313        /// # use google_cloud_monitoring_v3::model::synthetic_monitor_target::CloudFunctionV2Target;
16314        /// use api::model::MonitoredResource;
16315        /// let x = CloudFunctionV2Target::new().set_cloud_run_revision(MonitoredResource::default()/* use setters */);
16316        /// ```
16317        pub fn set_cloud_run_revision<T>(mut self, v: T) -> Self
16318        where
16319            T: std::convert::Into<api::model::MonitoredResource>,
16320        {
16321            self.cloud_run_revision = std::option::Option::Some(v.into());
16322            self
16323        }
16324
16325        /// Sets or clears the value of [cloud_run_revision][crate::model::synthetic_monitor_target::CloudFunctionV2Target::cloud_run_revision].
16326        ///
16327        /// # Example
16328        /// ```ignore,no_run
16329        /// # use google_cloud_monitoring_v3::model::synthetic_monitor_target::CloudFunctionV2Target;
16330        /// use api::model::MonitoredResource;
16331        /// let x = CloudFunctionV2Target::new().set_or_clear_cloud_run_revision(Some(MonitoredResource::default()/* use setters */));
16332        /// let x = CloudFunctionV2Target::new().set_or_clear_cloud_run_revision(None::<MonitoredResource>);
16333        /// ```
16334        pub fn set_or_clear_cloud_run_revision<T>(mut self, v: std::option::Option<T>) -> Self
16335        where
16336            T: std::convert::Into<api::model::MonitoredResource>,
16337        {
16338            self.cloud_run_revision = v.map(|x| x.into());
16339            self
16340        }
16341    }
16342
16343    impl wkt::message::Message for CloudFunctionV2Target {
16344        fn typename() -> &'static str {
16345            "type.googleapis.com/google.monitoring.v3.SyntheticMonitorTarget.CloudFunctionV2Target"
16346        }
16347    }
16348
16349    /// Specifies a Synthetic Monitor's execution stack.
16350    #[derive(Clone, Debug, PartialEq)]
16351    #[non_exhaustive]
16352    pub enum Target {
16353        /// Target a Synthetic Monitor GCFv2 instance.
16354        CloudFunctionV2(
16355            std::boxed::Box<crate::model::synthetic_monitor_target::CloudFunctionV2Target>,
16356        ),
16357    }
16358}
16359
16360/// This message configures which resources and services to monitor for
16361/// availability.
16362#[derive(Clone, Default, PartialEq)]
16363#[non_exhaustive]
16364pub struct UptimeCheckConfig {
16365    /// Identifier. A unique resource name for this Uptime check configuration. The
16366    /// format is:
16367    ///
16368    /// ```norust
16369    ///  projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
16370    /// ```
16371    ///
16372    /// `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the
16373    /// Uptime check.
16374    ///
16375    /// This field should be omitted when creating the Uptime check configuration;
16376    /// on create, the resource name is assigned by the server and included in the
16377    /// response.
16378    pub name: std::string::String,
16379
16380    /// A human-friendly name for the Uptime check configuration. The display name
16381    /// should be unique within a Cloud Monitoring Workspace in order to make it
16382    /// easier to identify; however, uniqueness is not enforced. Required.
16383    pub display_name: std::string::String,
16384
16385    /// How often, in seconds, the Uptime check is performed.
16386    /// Currently, the only supported values are `60s` (1 minute), `300s`
16387    /// (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
16388    /// defaults to `60s`.
16389    pub period: std::option::Option<wkt::Duration>,
16390
16391    /// The maximum amount of time to wait for the request to complete (must be
16392    /// between 1 and 60 seconds). Required.
16393    pub timeout: std::option::Option<wkt::Duration>,
16394
16395    /// The content that is expected to appear in the data returned by the target
16396    /// server against which the check is run.  Currently, only the first entry
16397    /// in the `content_matchers` list is supported, and additional entries will
16398    /// be ignored. This field is optional and should only be specified if a
16399    /// content match is required as part of the/ Uptime check.
16400    pub content_matchers: std::vec::Vec<crate::model::uptime_check_config::ContentMatcher>,
16401
16402    /// The type of checkers to use to execute the Uptime check.
16403    pub checker_type: crate::model::uptime_check_config::CheckerType,
16404
16405    /// The list of regions from which the check will be run.
16406    /// Some regions contain one location, and others contain more than one.
16407    /// If this field is specified, enough regions must be provided to include a
16408    /// minimum of 3 locations.  Not specifying this field will result in Uptime
16409    /// checks running from all available regions.
16410    pub selected_regions: std::vec::Vec<crate::model::UptimeCheckRegion>,
16411
16412    /// If this is `true`, then checks are made only from the 'internal_checkers'.
16413    /// If it is `false`, then checks are made only from the 'selected_regions'.
16414    /// It is an error to provide 'selected_regions' when is_internal is `true`,
16415    /// or to provide 'internal_checkers' when is_internal is `false`.
16416    #[deprecated]
16417    pub is_internal: bool,
16418
16419    /// The internal checkers that this check will egress from. If `is_internal` is
16420    /// `true` and this list is empty, the check will egress from all the
16421    /// InternalCheckers configured for the project that owns this
16422    /// `UptimeCheckConfig`.
16423    #[deprecated]
16424    pub internal_checkers: std::vec::Vec<crate::model::InternalChecker>,
16425
16426    /// User-supplied key/value data to be used for organizing and
16427    /// identifying the `UptimeCheckConfig` objects.
16428    ///
16429    /// The field can contain up to 64 entries. Each key and value is limited to
16430    /// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
16431    /// values can contain only lowercase letters, numerals, underscores, and
16432    /// dashes. Keys must begin with a letter.
16433    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
16434
16435    /// The resource the check is checking. Required.
16436    pub resource: std::option::Option<crate::model::uptime_check_config::Resource>,
16437
16438    /// The type of Uptime check request.
16439    pub check_request_type:
16440        std::option::Option<crate::model::uptime_check_config::CheckRequestType>,
16441
16442    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16443}
16444
16445impl UptimeCheckConfig {
16446    pub fn new() -> Self {
16447        std::default::Default::default()
16448    }
16449
16450    /// Sets the value of [name][crate::model::UptimeCheckConfig::name].
16451    ///
16452    /// # Example
16453    /// ```ignore,no_run
16454    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16455    /// let x = UptimeCheckConfig::new().set_name("example");
16456    /// ```
16457    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16458        self.name = v.into();
16459        self
16460    }
16461
16462    /// Sets the value of [display_name][crate::model::UptimeCheckConfig::display_name].
16463    ///
16464    /// # Example
16465    /// ```ignore,no_run
16466    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16467    /// let x = UptimeCheckConfig::new().set_display_name("example");
16468    /// ```
16469    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16470        self.display_name = v.into();
16471        self
16472    }
16473
16474    /// Sets the value of [period][crate::model::UptimeCheckConfig::period].
16475    ///
16476    /// # Example
16477    /// ```ignore,no_run
16478    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16479    /// use wkt::Duration;
16480    /// let x = UptimeCheckConfig::new().set_period(Duration::default()/* use setters */);
16481    /// ```
16482    pub fn set_period<T>(mut self, v: T) -> Self
16483    where
16484        T: std::convert::Into<wkt::Duration>,
16485    {
16486        self.period = std::option::Option::Some(v.into());
16487        self
16488    }
16489
16490    /// Sets or clears the value of [period][crate::model::UptimeCheckConfig::period].
16491    ///
16492    /// # Example
16493    /// ```ignore,no_run
16494    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16495    /// use wkt::Duration;
16496    /// let x = UptimeCheckConfig::new().set_or_clear_period(Some(Duration::default()/* use setters */));
16497    /// let x = UptimeCheckConfig::new().set_or_clear_period(None::<Duration>);
16498    /// ```
16499    pub fn set_or_clear_period<T>(mut self, v: std::option::Option<T>) -> Self
16500    where
16501        T: std::convert::Into<wkt::Duration>,
16502    {
16503        self.period = v.map(|x| x.into());
16504        self
16505    }
16506
16507    /// Sets the value of [timeout][crate::model::UptimeCheckConfig::timeout].
16508    ///
16509    /// # Example
16510    /// ```ignore,no_run
16511    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16512    /// use wkt::Duration;
16513    /// let x = UptimeCheckConfig::new().set_timeout(Duration::default()/* use setters */);
16514    /// ```
16515    pub fn set_timeout<T>(mut self, v: T) -> Self
16516    where
16517        T: std::convert::Into<wkt::Duration>,
16518    {
16519        self.timeout = std::option::Option::Some(v.into());
16520        self
16521    }
16522
16523    /// Sets or clears the value of [timeout][crate::model::UptimeCheckConfig::timeout].
16524    ///
16525    /// # Example
16526    /// ```ignore,no_run
16527    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16528    /// use wkt::Duration;
16529    /// let x = UptimeCheckConfig::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
16530    /// let x = UptimeCheckConfig::new().set_or_clear_timeout(None::<Duration>);
16531    /// ```
16532    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
16533    where
16534        T: std::convert::Into<wkt::Duration>,
16535    {
16536        self.timeout = v.map(|x| x.into());
16537        self
16538    }
16539
16540    /// Sets the value of [content_matchers][crate::model::UptimeCheckConfig::content_matchers].
16541    ///
16542    /// # Example
16543    /// ```ignore,no_run
16544    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16545    /// use google_cloud_monitoring_v3::model::uptime_check_config::ContentMatcher;
16546    /// let x = UptimeCheckConfig::new()
16547    ///     .set_content_matchers([
16548    ///         ContentMatcher::default()/* use setters */,
16549    ///         ContentMatcher::default()/* use (different) setters */,
16550    ///     ]);
16551    /// ```
16552    pub fn set_content_matchers<T, V>(mut self, v: T) -> Self
16553    where
16554        T: std::iter::IntoIterator<Item = V>,
16555        V: std::convert::Into<crate::model::uptime_check_config::ContentMatcher>,
16556    {
16557        use std::iter::Iterator;
16558        self.content_matchers = v.into_iter().map(|i| i.into()).collect();
16559        self
16560    }
16561
16562    /// Sets the value of [checker_type][crate::model::UptimeCheckConfig::checker_type].
16563    ///
16564    /// # Example
16565    /// ```ignore,no_run
16566    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16567    /// use google_cloud_monitoring_v3::model::uptime_check_config::CheckerType;
16568    /// let x0 = UptimeCheckConfig::new().set_checker_type(CheckerType::StaticIpCheckers);
16569    /// let x1 = UptimeCheckConfig::new().set_checker_type(CheckerType::VpcCheckers);
16570    /// ```
16571    pub fn set_checker_type<
16572        T: std::convert::Into<crate::model::uptime_check_config::CheckerType>,
16573    >(
16574        mut self,
16575        v: T,
16576    ) -> Self {
16577        self.checker_type = v.into();
16578        self
16579    }
16580
16581    /// Sets the value of [selected_regions][crate::model::UptimeCheckConfig::selected_regions].
16582    ///
16583    /// # Example
16584    /// ```ignore,no_run
16585    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16586    /// use google_cloud_monitoring_v3::model::UptimeCheckRegion;
16587    /// let x = UptimeCheckConfig::new().set_selected_regions([
16588    ///     UptimeCheckRegion::Usa,
16589    ///     UptimeCheckRegion::Europe,
16590    ///     UptimeCheckRegion::SouthAmerica,
16591    /// ]);
16592    /// ```
16593    pub fn set_selected_regions<T, V>(mut self, v: T) -> Self
16594    where
16595        T: std::iter::IntoIterator<Item = V>,
16596        V: std::convert::Into<crate::model::UptimeCheckRegion>,
16597    {
16598        use std::iter::Iterator;
16599        self.selected_regions = v.into_iter().map(|i| i.into()).collect();
16600        self
16601    }
16602
16603    /// Sets the value of [is_internal][crate::model::UptimeCheckConfig::is_internal].
16604    ///
16605    /// # Example
16606    /// ```ignore,no_run
16607    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16608    /// let x = UptimeCheckConfig::new().set_is_internal(true);
16609    /// ```
16610    #[deprecated]
16611    pub fn set_is_internal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16612        self.is_internal = v.into();
16613        self
16614    }
16615
16616    /// Sets the value of [internal_checkers][crate::model::UptimeCheckConfig::internal_checkers].
16617    ///
16618    /// # Example
16619    /// ```ignore,no_run
16620    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16621    /// use google_cloud_monitoring_v3::model::InternalChecker;
16622    /// let x = UptimeCheckConfig::new()
16623    ///     .set_internal_checkers([
16624    ///         InternalChecker::default()/* use setters */,
16625    ///         InternalChecker::default()/* use (different) setters */,
16626    ///     ]);
16627    /// ```
16628    #[deprecated]
16629    pub fn set_internal_checkers<T, V>(mut self, v: T) -> Self
16630    where
16631        T: std::iter::IntoIterator<Item = V>,
16632        V: std::convert::Into<crate::model::InternalChecker>,
16633    {
16634        use std::iter::Iterator;
16635        self.internal_checkers = v.into_iter().map(|i| i.into()).collect();
16636        self
16637    }
16638
16639    /// Sets the value of [user_labels][crate::model::UptimeCheckConfig::user_labels].
16640    ///
16641    /// # Example
16642    /// ```ignore,no_run
16643    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16644    /// let x = UptimeCheckConfig::new().set_user_labels([
16645    ///     ("key0", "abc"),
16646    ///     ("key1", "xyz"),
16647    /// ]);
16648    /// ```
16649    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
16650    where
16651        T: std::iter::IntoIterator<Item = (K, V)>,
16652        K: std::convert::Into<std::string::String>,
16653        V: std::convert::Into<std::string::String>,
16654    {
16655        use std::iter::Iterator;
16656        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16657        self
16658    }
16659
16660    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource].
16661    ///
16662    /// Note that all the setters affecting `resource` are mutually
16663    /// exclusive.
16664    ///
16665    /// # Example
16666    /// ```ignore,no_run
16667    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16668    /// use api::model::MonitoredResource;
16669    /// let x = UptimeCheckConfig::new().set_resource(Some(
16670    ///     google_cloud_monitoring_v3::model::uptime_check_config::Resource::MonitoredResource(MonitoredResource::default().into())));
16671    /// ```
16672    pub fn set_resource<
16673        T: std::convert::Into<std::option::Option<crate::model::uptime_check_config::Resource>>,
16674    >(
16675        mut self,
16676        v: T,
16677    ) -> Self {
16678        self.resource = v.into();
16679        self
16680    }
16681
16682    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
16683    /// if it holds a `MonitoredResource`, `None` if the field is not set or
16684    /// holds a different branch.
16685    pub fn monitored_resource(
16686        &self,
16687    ) -> std::option::Option<&std::boxed::Box<api::model::MonitoredResource>> {
16688        #[allow(unreachable_patterns)]
16689        self.resource.as_ref().and_then(|v| match v {
16690            crate::model::uptime_check_config::Resource::MonitoredResource(v) => {
16691                std::option::Option::Some(v)
16692            }
16693            _ => std::option::Option::None,
16694        })
16695    }
16696
16697    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
16698    /// to hold a `MonitoredResource`.
16699    ///
16700    /// Note that all the setters affecting `resource` are
16701    /// mutually exclusive.
16702    ///
16703    /// # Example
16704    /// ```ignore,no_run
16705    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16706    /// use api::model::MonitoredResource;
16707    /// let x = UptimeCheckConfig::new().set_monitored_resource(MonitoredResource::default()/* use setters */);
16708    /// assert!(x.monitored_resource().is_some());
16709    /// assert!(x.resource_group().is_none());
16710    /// assert!(x.synthetic_monitor().is_none());
16711    /// ```
16712    pub fn set_monitored_resource<
16713        T: std::convert::Into<std::boxed::Box<api::model::MonitoredResource>>,
16714    >(
16715        mut self,
16716        v: T,
16717    ) -> Self {
16718        self.resource = std::option::Option::Some(
16719            crate::model::uptime_check_config::Resource::MonitoredResource(v.into()),
16720        );
16721        self
16722    }
16723
16724    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
16725    /// if it holds a `ResourceGroup`, `None` if the field is not set or
16726    /// holds a different branch.
16727    pub fn resource_group(
16728        &self,
16729    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>>
16730    {
16731        #[allow(unreachable_patterns)]
16732        self.resource.as_ref().and_then(|v| match v {
16733            crate::model::uptime_check_config::Resource::ResourceGroup(v) => {
16734                std::option::Option::Some(v)
16735            }
16736            _ => std::option::Option::None,
16737        })
16738    }
16739
16740    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
16741    /// to hold a `ResourceGroup`.
16742    ///
16743    /// Note that all the setters affecting `resource` are
16744    /// mutually exclusive.
16745    ///
16746    /// # Example
16747    /// ```ignore,no_run
16748    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16749    /// use google_cloud_monitoring_v3::model::uptime_check_config::ResourceGroup;
16750    /// let x = UptimeCheckConfig::new().set_resource_group(ResourceGroup::default()/* use setters */);
16751    /// assert!(x.resource_group().is_some());
16752    /// assert!(x.monitored_resource().is_none());
16753    /// assert!(x.synthetic_monitor().is_none());
16754    /// ```
16755    pub fn set_resource_group<
16756        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>>,
16757    >(
16758        mut self,
16759        v: T,
16760    ) -> Self {
16761        self.resource = std::option::Option::Some(
16762            crate::model::uptime_check_config::Resource::ResourceGroup(v.into()),
16763        );
16764        self
16765    }
16766
16767    /// The value of [resource][crate::model::UptimeCheckConfig::resource]
16768    /// if it holds a `SyntheticMonitor`, `None` if the field is not set or
16769    /// holds a different branch.
16770    pub fn synthetic_monitor(
16771        &self,
16772    ) -> std::option::Option<&std::boxed::Box<crate::model::SyntheticMonitorTarget>> {
16773        #[allow(unreachable_patterns)]
16774        self.resource.as_ref().and_then(|v| match v {
16775            crate::model::uptime_check_config::Resource::SyntheticMonitor(v) => {
16776                std::option::Option::Some(v)
16777            }
16778            _ => std::option::Option::None,
16779        })
16780    }
16781
16782    /// Sets the value of [resource][crate::model::UptimeCheckConfig::resource]
16783    /// to hold a `SyntheticMonitor`.
16784    ///
16785    /// Note that all the setters affecting `resource` are
16786    /// mutually exclusive.
16787    ///
16788    /// # Example
16789    /// ```ignore,no_run
16790    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16791    /// use google_cloud_monitoring_v3::model::SyntheticMonitorTarget;
16792    /// let x = UptimeCheckConfig::new().set_synthetic_monitor(SyntheticMonitorTarget::default()/* use setters */);
16793    /// assert!(x.synthetic_monitor().is_some());
16794    /// assert!(x.monitored_resource().is_none());
16795    /// assert!(x.resource_group().is_none());
16796    /// ```
16797    pub fn set_synthetic_monitor<
16798        T: std::convert::Into<std::boxed::Box<crate::model::SyntheticMonitorTarget>>,
16799    >(
16800        mut self,
16801        v: T,
16802    ) -> Self {
16803        self.resource = std::option::Option::Some(
16804            crate::model::uptime_check_config::Resource::SyntheticMonitor(v.into()),
16805        );
16806        self
16807    }
16808
16809    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type].
16810    ///
16811    /// Note that all the setters affecting `check_request_type` are mutually
16812    /// exclusive.
16813    ///
16814    /// # Example
16815    /// ```ignore,no_run
16816    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16817    /// use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
16818    /// let x = UptimeCheckConfig::new().set_check_request_type(Some(
16819    ///     google_cloud_monitoring_v3::model::uptime_check_config::CheckRequestType::HttpCheck(HttpCheck::default().into())));
16820    /// ```
16821    pub fn set_check_request_type<
16822        T: std::convert::Into<
16823                std::option::Option<crate::model::uptime_check_config::CheckRequestType>,
16824            >,
16825    >(
16826        mut self,
16827        v: T,
16828    ) -> Self {
16829        self.check_request_type = v.into();
16830        self
16831    }
16832
16833    /// The value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
16834    /// if it holds a `HttpCheck`, `None` if the field is not set or
16835    /// holds a different branch.
16836    pub fn http_check(
16837        &self,
16838    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::HttpCheck>> {
16839        #[allow(unreachable_patterns)]
16840        self.check_request_type.as_ref().and_then(|v| match v {
16841            crate::model::uptime_check_config::CheckRequestType::HttpCheck(v) => {
16842                std::option::Option::Some(v)
16843            }
16844            _ => std::option::Option::None,
16845        })
16846    }
16847
16848    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
16849    /// to hold a `HttpCheck`.
16850    ///
16851    /// Note that all the setters affecting `check_request_type` are
16852    /// mutually exclusive.
16853    ///
16854    /// # Example
16855    /// ```ignore,no_run
16856    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16857    /// use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
16858    /// let x = UptimeCheckConfig::new().set_http_check(HttpCheck::default()/* use setters */);
16859    /// assert!(x.http_check().is_some());
16860    /// assert!(x.tcp_check().is_none());
16861    /// ```
16862    pub fn set_http_check<
16863        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::HttpCheck>>,
16864    >(
16865        mut self,
16866        v: T,
16867    ) -> Self {
16868        self.check_request_type = std::option::Option::Some(
16869            crate::model::uptime_check_config::CheckRequestType::HttpCheck(v.into()),
16870        );
16871        self
16872    }
16873
16874    /// The value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
16875    /// if it holds a `TcpCheck`, `None` if the field is not set or
16876    /// holds a different branch.
16877    pub fn tcp_check(
16878        &self,
16879    ) -> std::option::Option<&std::boxed::Box<crate::model::uptime_check_config::TcpCheck>> {
16880        #[allow(unreachable_patterns)]
16881        self.check_request_type.as_ref().and_then(|v| match v {
16882            crate::model::uptime_check_config::CheckRequestType::TcpCheck(v) => {
16883                std::option::Option::Some(v)
16884            }
16885            _ => std::option::Option::None,
16886        })
16887    }
16888
16889    /// Sets the value of [check_request_type][crate::model::UptimeCheckConfig::check_request_type]
16890    /// to hold a `TcpCheck`.
16891    ///
16892    /// Note that all the setters affecting `check_request_type` are
16893    /// mutually exclusive.
16894    ///
16895    /// # Example
16896    /// ```ignore,no_run
16897    /// # use google_cloud_monitoring_v3::model::UptimeCheckConfig;
16898    /// use google_cloud_monitoring_v3::model::uptime_check_config::TcpCheck;
16899    /// let x = UptimeCheckConfig::new().set_tcp_check(TcpCheck::default()/* use setters */);
16900    /// assert!(x.tcp_check().is_some());
16901    /// assert!(x.http_check().is_none());
16902    /// ```
16903    pub fn set_tcp_check<
16904        T: std::convert::Into<std::boxed::Box<crate::model::uptime_check_config::TcpCheck>>,
16905    >(
16906        mut self,
16907        v: T,
16908    ) -> Self {
16909        self.check_request_type = std::option::Option::Some(
16910            crate::model::uptime_check_config::CheckRequestType::TcpCheck(v.into()),
16911        );
16912        self
16913    }
16914}
16915
16916impl wkt::message::Message for UptimeCheckConfig {
16917    fn typename() -> &'static str {
16918        "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig"
16919    }
16920}
16921
16922/// Defines additional types related to [UptimeCheckConfig].
16923pub mod uptime_check_config {
16924    #[allow(unused_imports)]
16925    use super::*;
16926
16927    /// The resource submessage for group checks. It can be used instead of a
16928    /// monitored resource, when multiple resources are being monitored.
16929    #[derive(Clone, Default, PartialEq)]
16930    #[non_exhaustive]
16931    pub struct ResourceGroup {
16932        /// The group of resources being monitored. Should be only the `[GROUP_ID]`,
16933        /// and not the full-path
16934        /// `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`.
16935        pub group_id: std::string::String,
16936
16937        /// The resource type of the group members.
16938        pub resource_type: crate::model::GroupResourceType,
16939
16940        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16941    }
16942
16943    impl ResourceGroup {
16944        pub fn new() -> Self {
16945            std::default::Default::default()
16946        }
16947
16948        /// Sets the value of [group_id][crate::model::uptime_check_config::ResourceGroup::group_id].
16949        ///
16950        /// # Example
16951        /// ```ignore,no_run
16952        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ResourceGroup;
16953        /// let x = ResourceGroup::new().set_group_id("example");
16954        /// ```
16955        pub fn set_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16956            self.group_id = v.into();
16957            self
16958        }
16959
16960        /// Sets the value of [resource_type][crate::model::uptime_check_config::ResourceGroup::resource_type].
16961        ///
16962        /// # Example
16963        /// ```ignore,no_run
16964        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ResourceGroup;
16965        /// use google_cloud_monitoring_v3::model::GroupResourceType;
16966        /// let x0 = ResourceGroup::new().set_resource_type(GroupResourceType::Instance);
16967        /// let x1 = ResourceGroup::new().set_resource_type(GroupResourceType::AwsElbLoadBalancer);
16968        /// ```
16969        pub fn set_resource_type<T: std::convert::Into<crate::model::GroupResourceType>>(
16970            mut self,
16971            v: T,
16972        ) -> Self {
16973            self.resource_type = v.into();
16974            self
16975        }
16976    }
16977
16978    impl wkt::message::Message for ResourceGroup {
16979        fn typename() -> &'static str {
16980            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ResourceGroup"
16981        }
16982    }
16983
16984    /// Information involved in sending ICMP pings alongside public HTTP/TCP
16985    /// checks. For HTTP, the pings are performed for each part of the redirect
16986    /// chain.
16987    #[derive(Clone, Default, PartialEq)]
16988    #[non_exhaustive]
16989    pub struct PingConfig {
16990        /// Number of ICMP pings. A maximum of 3 ICMP pings is currently supported.
16991        pub pings_count: i32,
16992
16993        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16994    }
16995
16996    impl PingConfig {
16997        pub fn new() -> Self {
16998            std::default::Default::default()
16999        }
17000
17001        /// Sets the value of [pings_count][crate::model::uptime_check_config::PingConfig::pings_count].
17002        ///
17003        /// # Example
17004        /// ```ignore,no_run
17005        /// # use google_cloud_monitoring_v3::model::uptime_check_config::PingConfig;
17006        /// let x = PingConfig::new().set_pings_count(42);
17007        /// ```
17008        pub fn set_pings_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17009            self.pings_count = v.into();
17010            self
17011        }
17012    }
17013
17014    impl wkt::message::Message for PingConfig {
17015        fn typename() -> &'static str {
17016            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.PingConfig"
17017        }
17018    }
17019
17020    /// Information involved in an HTTP/HTTPS Uptime check request.
17021    #[derive(Clone, Default, PartialEq)]
17022    #[non_exhaustive]
17023    pub struct HttpCheck {
17024        /// The HTTP request method to use for the check. If set to
17025        /// `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`.
17026        pub request_method: crate::model::uptime_check_config::http_check::RequestMethod,
17027
17028        /// If `true`, use HTTPS instead of HTTP to run the check.
17029        pub use_ssl: bool,
17030
17031        /// Optional (defaults to "/"). The path to the page against which to run
17032        /// the check. Will be combined with the `host` (specified within the
17033        /// `monitored_resource`) and `port` to construct the full URL. If the
17034        /// provided path does not begin with "/", a "/" will be prepended
17035        /// automatically.
17036        pub path: std::string::String,
17037
17038        /// Optional (defaults to 80 when `use_ssl` is `false`, and 443 when
17039        /// `use_ssl` is `true`). The TCP port on the HTTP server against which to
17040        /// run the check. Will be combined with host (specified within the
17041        /// `monitored_resource`) and `path` to construct the full URL.
17042        pub port: i32,
17043
17044        /// The authentication information. Optional when creating an HTTP check;
17045        /// defaults to empty.
17046        /// Do not set both `auth_method` and `auth_info`.
17047        pub auth_info:
17048            std::option::Option<crate::model::uptime_check_config::http_check::BasicAuthentication>,
17049
17050        /// Boolean specifying whether to encrypt the header information.
17051        /// Encryption should be specified for any headers related to authentication
17052        /// that you do not wish to be seen when retrieving the configuration. The
17053        /// server will be responsible for encrypting the headers.
17054        /// On Get/List calls, if `mask_headers` is set to `true` then the headers
17055        /// will be obscured with `******.`
17056        pub mask_headers: bool,
17057
17058        /// The list of headers to send as part of the Uptime check request.
17059        /// If two headers have the same key and different values, they should
17060        /// be entered as a single header, with the value being a comma-separated
17061        /// list of all the desired values as described at
17062        /// <https://www.w3.org/Protocols/rfc2616/rfc2616.txt> (page 31).
17063        /// Entering two separate headers with the same key in a Create call will
17064        /// cause the first to be overwritten by the second.
17065        /// The maximum number of headers allowed is 100.
17066        pub headers: std::collections::HashMap<std::string::String, std::string::String>,
17067
17068        /// The content type header to use for the check. The following
17069        /// configurations result in errors:
17070        ///
17071        /// 1. Content type is specified in both the `headers` field and the
17072        ///    `content_type` field.
17073        /// 1. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED`
17074        /// 1. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`.
17075        /// 1. Request method is `POST` and a "Content-Type" header is provided via
17076        ///    `headers` field. The `content_type` field should be used instead.
17077        pub content_type: crate::model::uptime_check_config::http_check::ContentType,
17078
17079        /// A user provided content type header to use for the check. The invalid
17080        /// configurations outlined in the `content_type` field apply to
17081        /// `custom_content_type`, as well as the following:
17082        ///
17083        /// 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set.
17084        /// 1. `content_type` is `USER_PROVIDED` and `custom_content_type` is not
17085        ///    set.
17086        pub custom_content_type: std::string::String,
17087
17088        /// Boolean specifying whether to include SSL certificate validation as a
17089        /// part of the Uptime check. Only applies to checks where
17090        /// `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
17091        /// setting `validate_ssl` to `true` has no effect.
17092        pub validate_ssl: bool,
17093
17094        /// The request body associated with the HTTP POST request. If `content_type`
17095        /// is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
17096        /// provide a `Content-Length` header via the `headers` field or the API will
17097        /// do so. If the `request_method` is `GET` and `body` is not empty, the API
17098        /// will return an error. The maximum byte size is 1 megabyte.
17099        ///
17100        /// Note: If client libraries aren't used (which performs the conversion
17101        /// automatically) base64 encode your `body` data since the field is of
17102        /// `bytes` type.
17103        pub body: ::bytes::Bytes,
17104
17105        /// If present, the check will only pass if the HTTP response status code is
17106        /// in this set of status codes. If empty, the HTTP status code will only
17107        /// pass if the HTTP status code is 200-299.
17108        pub accepted_response_status_codes:
17109            std::vec::Vec<crate::model::uptime_check_config::http_check::ResponseStatusCode>,
17110
17111        /// Contains information needed to add pings to an HTTP check.
17112        pub ping_config: std::option::Option<crate::model::uptime_check_config::PingConfig>,
17113
17114        /// This field is optional and should be set only by users interested in
17115        /// an authenticated uptime check.
17116        /// Do not set both `auth_method` and `auth_info`.
17117        pub auth_method:
17118            std::option::Option<crate::model::uptime_check_config::http_check::AuthMethod>,
17119
17120        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17121    }
17122
17123    impl HttpCheck {
17124        pub fn new() -> Self {
17125            std::default::Default::default()
17126        }
17127
17128        /// Sets the value of [request_method][crate::model::uptime_check_config::HttpCheck::request_method].
17129        ///
17130        /// # Example
17131        /// ```ignore,no_run
17132        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17133        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::RequestMethod;
17134        /// let x0 = HttpCheck::new().set_request_method(RequestMethod::Get);
17135        /// let x1 = HttpCheck::new().set_request_method(RequestMethod::Post);
17136        /// ```
17137        pub fn set_request_method<
17138            T: std::convert::Into<crate::model::uptime_check_config::http_check::RequestMethod>,
17139        >(
17140            mut self,
17141            v: T,
17142        ) -> Self {
17143            self.request_method = v.into();
17144            self
17145        }
17146
17147        /// Sets the value of [use_ssl][crate::model::uptime_check_config::HttpCheck::use_ssl].
17148        ///
17149        /// # Example
17150        /// ```ignore,no_run
17151        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17152        /// let x = HttpCheck::new().set_use_ssl(true);
17153        /// ```
17154        pub fn set_use_ssl<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17155            self.use_ssl = v.into();
17156            self
17157        }
17158
17159        /// Sets the value of [path][crate::model::uptime_check_config::HttpCheck::path].
17160        ///
17161        /// # Example
17162        /// ```ignore,no_run
17163        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17164        /// let x = HttpCheck::new().set_path("example");
17165        /// ```
17166        pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17167            self.path = v.into();
17168            self
17169        }
17170
17171        /// Sets the value of [port][crate::model::uptime_check_config::HttpCheck::port].
17172        ///
17173        /// # Example
17174        /// ```ignore,no_run
17175        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17176        /// let x = HttpCheck::new().set_port(42);
17177        /// ```
17178        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17179            self.port = v.into();
17180            self
17181        }
17182
17183        /// Sets the value of [auth_info][crate::model::uptime_check_config::HttpCheck::auth_info].
17184        ///
17185        /// # Example
17186        /// ```ignore,no_run
17187        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17188        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::BasicAuthentication;
17189        /// let x = HttpCheck::new().set_auth_info(BasicAuthentication::default()/* use setters */);
17190        /// ```
17191        pub fn set_auth_info<T>(mut self, v: T) -> Self
17192        where
17193            T: std::convert::Into<
17194                    crate::model::uptime_check_config::http_check::BasicAuthentication,
17195                >,
17196        {
17197            self.auth_info = std::option::Option::Some(v.into());
17198            self
17199        }
17200
17201        /// Sets or clears the value of [auth_info][crate::model::uptime_check_config::HttpCheck::auth_info].
17202        ///
17203        /// # Example
17204        /// ```ignore,no_run
17205        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17206        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::BasicAuthentication;
17207        /// let x = HttpCheck::new().set_or_clear_auth_info(Some(BasicAuthentication::default()/* use setters */));
17208        /// let x = HttpCheck::new().set_or_clear_auth_info(None::<BasicAuthentication>);
17209        /// ```
17210        pub fn set_or_clear_auth_info<T>(mut self, v: std::option::Option<T>) -> Self
17211        where
17212            T: std::convert::Into<
17213                    crate::model::uptime_check_config::http_check::BasicAuthentication,
17214                >,
17215        {
17216            self.auth_info = v.map(|x| x.into());
17217            self
17218        }
17219
17220        /// Sets the value of [mask_headers][crate::model::uptime_check_config::HttpCheck::mask_headers].
17221        ///
17222        /// # Example
17223        /// ```ignore,no_run
17224        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17225        /// let x = HttpCheck::new().set_mask_headers(true);
17226        /// ```
17227        pub fn set_mask_headers<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17228            self.mask_headers = v.into();
17229            self
17230        }
17231
17232        /// Sets the value of [headers][crate::model::uptime_check_config::HttpCheck::headers].
17233        ///
17234        /// # Example
17235        /// ```ignore,no_run
17236        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17237        /// let x = HttpCheck::new().set_headers([
17238        ///     ("key0", "abc"),
17239        ///     ("key1", "xyz"),
17240        /// ]);
17241        /// ```
17242        pub fn set_headers<T, K, V>(mut self, v: T) -> Self
17243        where
17244            T: std::iter::IntoIterator<Item = (K, V)>,
17245            K: std::convert::Into<std::string::String>,
17246            V: std::convert::Into<std::string::String>,
17247        {
17248            use std::iter::Iterator;
17249            self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17250            self
17251        }
17252
17253        /// Sets the value of [content_type][crate::model::uptime_check_config::HttpCheck::content_type].
17254        ///
17255        /// # Example
17256        /// ```ignore,no_run
17257        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17258        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ContentType;
17259        /// let x0 = HttpCheck::new().set_content_type(ContentType::UrlEncoded);
17260        /// let x1 = HttpCheck::new().set_content_type(ContentType::UserProvided);
17261        /// ```
17262        pub fn set_content_type<
17263            T: std::convert::Into<crate::model::uptime_check_config::http_check::ContentType>,
17264        >(
17265            mut self,
17266            v: T,
17267        ) -> Self {
17268            self.content_type = v.into();
17269            self
17270        }
17271
17272        /// Sets the value of [custom_content_type][crate::model::uptime_check_config::HttpCheck::custom_content_type].
17273        ///
17274        /// # Example
17275        /// ```ignore,no_run
17276        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17277        /// let x = HttpCheck::new().set_custom_content_type("example");
17278        /// ```
17279        pub fn set_custom_content_type<T: std::convert::Into<std::string::String>>(
17280            mut self,
17281            v: T,
17282        ) -> Self {
17283            self.custom_content_type = v.into();
17284            self
17285        }
17286
17287        /// Sets the value of [validate_ssl][crate::model::uptime_check_config::HttpCheck::validate_ssl].
17288        ///
17289        /// # Example
17290        /// ```ignore,no_run
17291        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17292        /// let x = HttpCheck::new().set_validate_ssl(true);
17293        /// ```
17294        pub fn set_validate_ssl<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17295            self.validate_ssl = v.into();
17296            self
17297        }
17298
17299        /// Sets the value of [body][crate::model::uptime_check_config::HttpCheck::body].
17300        ///
17301        /// # Example
17302        /// ```ignore,no_run
17303        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17304        /// let x = HttpCheck::new().set_body(bytes::Bytes::from_static(b"example"));
17305        /// ```
17306        pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17307            self.body = v.into();
17308            self
17309        }
17310
17311        /// Sets the value of [accepted_response_status_codes][crate::model::uptime_check_config::HttpCheck::accepted_response_status_codes].
17312        ///
17313        /// # Example
17314        /// ```ignore,no_run
17315        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17316        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ResponseStatusCode;
17317        /// let x = HttpCheck::new()
17318        ///     .set_accepted_response_status_codes([
17319        ///         ResponseStatusCode::default()/* use setters */,
17320        ///         ResponseStatusCode::default()/* use (different) setters */,
17321        ///     ]);
17322        /// ```
17323        pub fn set_accepted_response_status_codes<T, V>(mut self, v: T) -> Self
17324        where
17325            T: std::iter::IntoIterator<Item = V>,
17326            V: std::convert::Into<
17327                    crate::model::uptime_check_config::http_check::ResponseStatusCode,
17328                >,
17329        {
17330            use std::iter::Iterator;
17331            self.accepted_response_status_codes = v.into_iter().map(|i| i.into()).collect();
17332            self
17333        }
17334
17335        /// Sets the value of [ping_config][crate::model::uptime_check_config::HttpCheck::ping_config].
17336        ///
17337        /// # Example
17338        /// ```ignore,no_run
17339        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17340        /// use google_cloud_monitoring_v3::model::uptime_check_config::PingConfig;
17341        /// let x = HttpCheck::new().set_ping_config(PingConfig::default()/* use setters */);
17342        /// ```
17343        pub fn set_ping_config<T>(mut self, v: T) -> Self
17344        where
17345            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
17346        {
17347            self.ping_config = std::option::Option::Some(v.into());
17348            self
17349        }
17350
17351        /// Sets or clears the value of [ping_config][crate::model::uptime_check_config::HttpCheck::ping_config].
17352        ///
17353        /// # Example
17354        /// ```ignore,no_run
17355        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17356        /// use google_cloud_monitoring_v3::model::uptime_check_config::PingConfig;
17357        /// let x = HttpCheck::new().set_or_clear_ping_config(Some(PingConfig::default()/* use setters */));
17358        /// let x = HttpCheck::new().set_or_clear_ping_config(None::<PingConfig>);
17359        /// ```
17360        pub fn set_or_clear_ping_config<T>(mut self, v: std::option::Option<T>) -> Self
17361        where
17362            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
17363        {
17364            self.ping_config = v.map(|x| x.into());
17365            self
17366        }
17367
17368        /// Sets the value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method].
17369        ///
17370        /// Note that all the setters affecting `auth_method` are mutually
17371        /// exclusive.
17372        ///
17373        /// # Example
17374        /// ```ignore,no_run
17375        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17376        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ServiceAgentAuthentication;
17377        /// let x = HttpCheck::new().set_auth_method(Some(
17378        ///     google_cloud_monitoring_v3::model::uptime_check_config::http_check::AuthMethod::ServiceAgentAuthentication(ServiceAgentAuthentication::default().into())));
17379        /// ```
17380        pub fn set_auth_method<
17381            T: std::convert::Into<
17382                    std::option::Option<crate::model::uptime_check_config::http_check::AuthMethod>,
17383                >,
17384        >(
17385            mut self,
17386            v: T,
17387        ) -> Self {
17388            self.auth_method = v.into();
17389            self
17390        }
17391
17392        /// The value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method]
17393        /// if it holds a `ServiceAgentAuthentication`, `None` if the field is not set or
17394        /// holds a different branch.
17395        pub fn service_agent_authentication(
17396            &self,
17397        ) -> std::option::Option<
17398            &std::boxed::Box<
17399                crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
17400            >,
17401        > {
17402            #[allow(unreachable_patterns)]
17403            self.auth_method.as_ref().and_then(|v| match v {
17404                crate::model::uptime_check_config::http_check::AuthMethod::ServiceAgentAuthentication(v) => std::option::Option::Some(v),
17405                _ => std::option::Option::None,
17406            })
17407        }
17408
17409        /// Sets the value of [auth_method][crate::model::uptime_check_config::HttpCheck::auth_method]
17410        /// to hold a `ServiceAgentAuthentication`.
17411        ///
17412        /// Note that all the setters affecting `auth_method` are
17413        /// mutually exclusive.
17414        ///
17415        /// # Example
17416        /// ```ignore,no_run
17417        /// # use google_cloud_monitoring_v3::model::uptime_check_config::HttpCheck;
17418        /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ServiceAgentAuthentication;
17419        /// let x = HttpCheck::new().set_service_agent_authentication(ServiceAgentAuthentication::default()/* use setters */);
17420        /// assert!(x.service_agent_authentication().is_some());
17421        /// ```
17422        pub fn set_service_agent_authentication<
17423            T: std::convert::Into<
17424                    std::boxed::Box<
17425                        crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
17426                    >,
17427                >,
17428        >(
17429            mut self,
17430            v: T,
17431        ) -> Self {
17432            self.auth_method = std::option::Option::Some(
17433                crate::model::uptime_check_config::http_check::AuthMethod::ServiceAgentAuthentication(
17434                    v.into()
17435                )
17436            );
17437            self
17438        }
17439    }
17440
17441    impl wkt::message::Message for HttpCheck {
17442        fn typename() -> &'static str {
17443            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck"
17444        }
17445    }
17446
17447    /// Defines additional types related to [HttpCheck].
17448    pub mod http_check {
17449        #[allow(unused_imports)]
17450        use super::*;
17451
17452        /// The authentication parameters to provide to the specified resource or
17453        /// URL that requires a username and password. Currently, only
17454        /// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
17455        /// supported in Uptime checks.
17456        #[derive(Clone, Default, PartialEq)]
17457        #[non_exhaustive]
17458        pub struct BasicAuthentication {
17459            /// The username to use when authenticating with the HTTP server.
17460            pub username: std::string::String,
17461
17462            /// The password to use when authenticating with the HTTP server.
17463            pub password: std::string::String,
17464
17465            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17466        }
17467
17468        impl BasicAuthentication {
17469            pub fn new() -> Self {
17470                std::default::Default::default()
17471            }
17472
17473            /// Sets the value of [username][crate::model::uptime_check_config::http_check::BasicAuthentication::username].
17474            ///
17475            /// # Example
17476            /// ```ignore,no_run
17477            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::BasicAuthentication;
17478            /// let x = BasicAuthentication::new().set_username("example");
17479            /// ```
17480            pub fn set_username<T: std::convert::Into<std::string::String>>(
17481                mut self,
17482                v: T,
17483            ) -> Self {
17484                self.username = v.into();
17485                self
17486            }
17487
17488            /// Sets the value of [password][crate::model::uptime_check_config::http_check::BasicAuthentication::password].
17489            ///
17490            /// # Example
17491            /// ```ignore,no_run
17492            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::BasicAuthentication;
17493            /// let x = BasicAuthentication::new().set_password("example");
17494            /// ```
17495            pub fn set_password<T: std::convert::Into<std::string::String>>(
17496                mut self,
17497                v: T,
17498            ) -> Self {
17499                self.password = v.into();
17500                self
17501            }
17502        }
17503
17504        impl wkt::message::Message for BasicAuthentication {
17505            fn typename() -> &'static str {
17506                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication"
17507            }
17508        }
17509
17510        /// A status to accept. Either a status code class like "2xx", or an integer
17511        /// status code like "200".
17512        #[derive(Clone, Default, PartialEq)]
17513        #[non_exhaustive]
17514        pub struct ResponseStatusCode {
17515            /// Either a specific value or a class of status codes.
17516            pub status_code: std::option::Option<
17517                crate::model::uptime_check_config::http_check::response_status_code::StatusCode,
17518            >,
17519
17520            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17521        }
17522
17523        impl ResponseStatusCode {
17524            pub fn new() -> Self {
17525                std::default::Default::default()
17526            }
17527
17528            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code].
17529            ///
17530            /// Note that all the setters affecting `status_code` are mutually
17531            /// exclusive.
17532            ///
17533            /// # Example
17534            /// ```ignore,no_run
17535            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ResponseStatusCode;
17536            /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::response_status_code::StatusCode;
17537            /// let x = ResponseStatusCode::new().set_status_code(Some(StatusCode::StatusValue(42)));
17538            /// ```
17539            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
17540            {
17541                self.status_code = v.into();
17542                self
17543            }
17544
17545            /// The value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
17546            /// if it holds a `StatusValue`, `None` if the field is not set or
17547            /// holds a different branch.
17548            pub fn status_value(&self) -> std::option::Option<&i32> {
17549                #[allow(unreachable_patterns)]
17550                self.status_code.as_ref().and_then(|v| match v {
17551                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusValue(v) => std::option::Option::Some(v),
17552                    _ => std::option::Option::None,
17553                })
17554            }
17555
17556            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
17557            /// to hold a `StatusValue`.
17558            ///
17559            /// Note that all the setters affecting `status_code` are
17560            /// mutually exclusive.
17561            ///
17562            /// # Example
17563            /// ```ignore,no_run
17564            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ResponseStatusCode;
17565            /// let x = ResponseStatusCode::new().set_status_value(42);
17566            /// assert!(x.status_value().is_some());
17567            /// assert!(x.status_class().is_none());
17568            /// ```
17569            pub fn set_status_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17570                self.status_code = std::option::Option::Some(
17571                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusValue(
17572                        v.into()
17573                    )
17574                );
17575                self
17576            }
17577
17578            /// The value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
17579            /// if it holds a `StatusClass`, `None` if the field is not set or
17580            /// holds a different branch.
17581            pub fn status_class(
17582                &self,
17583            ) -> std::option::Option<
17584                &crate::model::uptime_check_config::http_check::response_status_code::StatusClass,
17585            > {
17586                #[allow(unreachable_patterns)]
17587                self.status_code.as_ref().and_then(|v| match v {
17588                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusClass(v) => std::option::Option::Some(v),
17589                    _ => std::option::Option::None,
17590                })
17591            }
17592
17593            /// Sets the value of [status_code][crate::model::uptime_check_config::http_check::ResponseStatusCode::status_code]
17594            /// to hold a `StatusClass`.
17595            ///
17596            /// Note that all the setters affecting `status_code` are
17597            /// mutually exclusive.
17598            ///
17599            /// # Example
17600            /// ```ignore,no_run
17601            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ResponseStatusCode;
17602            /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::response_status_code::StatusClass;
17603            /// let x0 = ResponseStatusCode::new().set_status_class(StatusClass::StatusClass1Xx);
17604            /// let x1 = ResponseStatusCode::new().set_status_class(StatusClass::StatusClass2Xx);
17605            /// let x2 = ResponseStatusCode::new().set_status_class(StatusClass::StatusClass3Xx);
17606            /// assert!(x0.status_class().is_some());
17607            /// assert!(x0.status_value().is_none());
17608            /// assert!(x1.status_class().is_some());
17609            /// assert!(x1.status_value().is_none());
17610            /// assert!(x2.status_class().is_some());
17611            /// assert!(x2.status_value().is_none());
17612            /// ```
17613            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{
17614                self.status_code = std::option::Option::Some(
17615                    crate::model::uptime_check_config::http_check::response_status_code::StatusCode::StatusClass(
17616                        v.into()
17617                    )
17618                );
17619                self
17620            }
17621        }
17622
17623        impl wkt::message::Message for ResponseStatusCode {
17624            fn typename() -> &'static str {
17625                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode"
17626            }
17627        }
17628
17629        /// Defines additional types related to [ResponseStatusCode].
17630        pub mod response_status_code {
17631            #[allow(unused_imports)]
17632            use super::*;
17633
17634            /// An HTTP status code class.
17635            ///
17636            /// # Working with unknown values
17637            ///
17638            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17639            /// additional enum variants at any time. Adding new variants is not considered
17640            /// a breaking change. Applications should write their code in anticipation of:
17641            ///
17642            /// - New values appearing in future releases of the client library, **and**
17643            /// - New values received dynamically, without application changes.
17644            ///
17645            /// Please consult the [Working with enums] section in the user guide for some
17646            /// guidelines.
17647            ///
17648            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17649            #[derive(Clone, Debug, PartialEq)]
17650            #[non_exhaustive]
17651            pub enum StatusClass {
17652                /// Default value that matches no status codes.
17653                Unspecified,
17654                /// The class of status codes between 100 and 199.
17655                StatusClass1Xx,
17656                /// The class of status codes between 200 and 299.
17657                StatusClass2Xx,
17658                /// The class of status codes between 300 and 399.
17659                StatusClass3Xx,
17660                /// The class of status codes between 400 and 499.
17661                StatusClass4Xx,
17662                /// The class of status codes between 500 and 599.
17663                StatusClass5Xx,
17664                /// The class of all status codes.
17665                Any,
17666                /// If set, the enum was initialized with an unknown value.
17667                ///
17668                /// Applications can examine the value using [StatusClass::value] or
17669                /// [StatusClass::name].
17670                UnknownValue(status_class::UnknownValue),
17671            }
17672
17673            #[doc(hidden)]
17674            pub mod status_class {
17675                #[allow(unused_imports)]
17676                use super::*;
17677                #[derive(Clone, Debug, PartialEq)]
17678                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17679            }
17680
17681            impl StatusClass {
17682                /// Gets the enum value.
17683                ///
17684                /// Returns `None` if the enum contains an unknown value deserialized from
17685                /// the string representation of enums.
17686                pub fn value(&self) -> std::option::Option<i32> {
17687                    match self {
17688                        Self::Unspecified => std::option::Option::Some(0),
17689                        Self::StatusClass1Xx => std::option::Option::Some(100),
17690                        Self::StatusClass2Xx => std::option::Option::Some(200),
17691                        Self::StatusClass3Xx => std::option::Option::Some(300),
17692                        Self::StatusClass4Xx => std::option::Option::Some(400),
17693                        Self::StatusClass5Xx => std::option::Option::Some(500),
17694                        Self::Any => std::option::Option::Some(1000),
17695                        Self::UnknownValue(u) => u.0.value(),
17696                    }
17697                }
17698
17699                /// Gets the enum value as a string.
17700                ///
17701                /// Returns `None` if the enum contains an unknown value deserialized from
17702                /// the integer representation of enums.
17703                pub fn name(&self) -> std::option::Option<&str> {
17704                    match self {
17705                        Self::Unspecified => std::option::Option::Some("STATUS_CLASS_UNSPECIFIED"),
17706                        Self::StatusClass1Xx => std::option::Option::Some("STATUS_CLASS_1XX"),
17707                        Self::StatusClass2Xx => std::option::Option::Some("STATUS_CLASS_2XX"),
17708                        Self::StatusClass3Xx => std::option::Option::Some("STATUS_CLASS_3XX"),
17709                        Self::StatusClass4Xx => std::option::Option::Some("STATUS_CLASS_4XX"),
17710                        Self::StatusClass5Xx => std::option::Option::Some("STATUS_CLASS_5XX"),
17711                        Self::Any => std::option::Option::Some("STATUS_CLASS_ANY"),
17712                        Self::UnknownValue(u) => u.0.name(),
17713                    }
17714                }
17715            }
17716
17717            impl std::default::Default for StatusClass {
17718                fn default() -> Self {
17719                    use std::convert::From;
17720                    Self::from(0)
17721                }
17722            }
17723
17724            impl std::fmt::Display for StatusClass {
17725                fn fmt(
17726                    &self,
17727                    f: &mut std::fmt::Formatter<'_>,
17728                ) -> std::result::Result<(), std::fmt::Error> {
17729                    wkt::internal::display_enum(f, self.name(), self.value())
17730                }
17731            }
17732
17733            impl std::convert::From<i32> for StatusClass {
17734                fn from(value: i32) -> Self {
17735                    match value {
17736                        0 => Self::Unspecified,
17737                        100 => Self::StatusClass1Xx,
17738                        200 => Self::StatusClass2Xx,
17739                        300 => Self::StatusClass3Xx,
17740                        400 => Self::StatusClass4Xx,
17741                        500 => Self::StatusClass5Xx,
17742                        1000 => Self::Any,
17743                        _ => Self::UnknownValue(status_class::UnknownValue(
17744                            wkt::internal::UnknownEnumValue::Integer(value),
17745                        )),
17746                    }
17747                }
17748            }
17749
17750            impl std::convert::From<&str> for StatusClass {
17751                fn from(value: &str) -> Self {
17752                    use std::string::ToString;
17753                    match value {
17754                        "STATUS_CLASS_UNSPECIFIED" => Self::Unspecified,
17755                        "STATUS_CLASS_1XX" => Self::StatusClass1Xx,
17756                        "STATUS_CLASS_2XX" => Self::StatusClass2Xx,
17757                        "STATUS_CLASS_3XX" => Self::StatusClass3Xx,
17758                        "STATUS_CLASS_4XX" => Self::StatusClass4Xx,
17759                        "STATUS_CLASS_5XX" => Self::StatusClass5Xx,
17760                        "STATUS_CLASS_ANY" => Self::Any,
17761                        _ => Self::UnknownValue(status_class::UnknownValue(
17762                            wkt::internal::UnknownEnumValue::String(value.to_string()),
17763                        )),
17764                    }
17765                }
17766            }
17767
17768            impl serde::ser::Serialize for StatusClass {
17769                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17770                where
17771                    S: serde::Serializer,
17772                {
17773                    match self {
17774                        Self::Unspecified => serializer.serialize_i32(0),
17775                        Self::StatusClass1Xx => serializer.serialize_i32(100),
17776                        Self::StatusClass2Xx => serializer.serialize_i32(200),
17777                        Self::StatusClass3Xx => serializer.serialize_i32(300),
17778                        Self::StatusClass4Xx => serializer.serialize_i32(400),
17779                        Self::StatusClass5Xx => serializer.serialize_i32(500),
17780                        Self::Any => serializer.serialize_i32(1000),
17781                        Self::UnknownValue(u) => u.0.serialize(serializer),
17782                    }
17783                }
17784            }
17785
17786            impl<'de> serde::de::Deserialize<'de> for StatusClass {
17787                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17788                where
17789                    D: serde::Deserializer<'de>,
17790                {
17791                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<StatusClass>::new(
17792                        ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ResponseStatusCode.StatusClass"))
17793                }
17794            }
17795
17796            /// Either a specific value or a class of status codes.
17797            #[derive(Clone, Debug, PartialEq)]
17798            #[non_exhaustive]
17799            pub enum StatusCode {
17800                /// A status code to accept.
17801                StatusValue(i32),
17802                /// A class of status codes to accept.
17803                StatusClass(crate::model::uptime_check_config::http_check::response_status_code::StatusClass),
17804            }
17805        }
17806
17807        /// Contains information needed for generating either an
17808        /// [OpenID Connect
17809        /// token](https://developers.google.com/identity/protocols/OpenIDConnect) or
17810        /// [OAuth token](https://developers.google.com/identity/protocols/oauth2).
17811        /// The token will be generated for the Monitoring service agent service
17812        /// account.
17813        #[derive(Clone, Default, PartialEq)]
17814        #[non_exhaustive]
17815        pub struct ServiceAgentAuthentication {
17816
17817            /// Type of authentication.
17818            pub r#type: crate::model::uptime_check_config::http_check::service_agent_authentication::ServiceAgentAuthenticationType,
17819
17820            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17821        }
17822
17823        impl ServiceAgentAuthentication {
17824            pub fn new() -> Self {
17825                std::default::Default::default()
17826            }
17827
17828            /// Sets the value of [r#type][crate::model::uptime_check_config::http_check::ServiceAgentAuthentication::type].
17829            ///
17830            /// # Example
17831            /// ```ignore,no_run
17832            /// # use google_cloud_monitoring_v3::model::uptime_check_config::http_check::ServiceAgentAuthentication;
17833            /// use google_cloud_monitoring_v3::model::uptime_check_config::http_check::service_agent_authentication::ServiceAgentAuthenticationType;
17834            /// let x0 = ServiceAgentAuthentication::new().set_type(ServiceAgentAuthenticationType::OidcToken);
17835            /// ```
17836            pub fn set_type<T: std::convert::Into<crate::model::uptime_check_config::http_check::service_agent_authentication::ServiceAgentAuthenticationType>>(mut self, v: T) -> Self{
17837                self.r#type = v.into();
17838                self
17839            }
17840        }
17841
17842        impl wkt::message::Message for ServiceAgentAuthentication {
17843            fn typename() -> &'static str {
17844                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication"
17845            }
17846        }
17847
17848        /// Defines additional types related to [ServiceAgentAuthentication].
17849        pub mod service_agent_authentication {
17850            #[allow(unused_imports)]
17851            use super::*;
17852
17853            /// Type of authentication.
17854            ///
17855            /// # Working with unknown values
17856            ///
17857            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17858            /// additional enum variants at any time. Adding new variants is not considered
17859            /// a breaking change. Applications should write their code in anticipation of:
17860            ///
17861            /// - New values appearing in future releases of the client library, **and**
17862            /// - New values received dynamically, without application changes.
17863            ///
17864            /// Please consult the [Working with enums] section in the user guide for some
17865            /// guidelines.
17866            ///
17867            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17868            #[derive(Clone, Debug, PartialEq)]
17869            #[non_exhaustive]
17870            pub enum ServiceAgentAuthenticationType {
17871                /// Default value, will result in OIDC Authentication.
17872                Unspecified,
17873                /// OIDC Authentication
17874                OidcToken,
17875                /// If set, the enum was initialized with an unknown value.
17876                ///
17877                /// Applications can examine the value using [ServiceAgentAuthenticationType::value] or
17878                /// [ServiceAgentAuthenticationType::name].
17879                UnknownValue(service_agent_authentication_type::UnknownValue),
17880            }
17881
17882            #[doc(hidden)]
17883            pub mod service_agent_authentication_type {
17884                #[allow(unused_imports)]
17885                use super::*;
17886                #[derive(Clone, Debug, PartialEq)]
17887                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17888            }
17889
17890            impl ServiceAgentAuthenticationType {
17891                /// Gets the enum value.
17892                ///
17893                /// Returns `None` if the enum contains an unknown value deserialized from
17894                /// the string representation of enums.
17895                pub fn value(&self) -> std::option::Option<i32> {
17896                    match self {
17897                        Self::Unspecified => std::option::Option::Some(0),
17898                        Self::OidcToken => std::option::Option::Some(1),
17899                        Self::UnknownValue(u) => u.0.value(),
17900                    }
17901                }
17902
17903                /// Gets the enum value as a string.
17904                ///
17905                /// Returns `None` if the enum contains an unknown value deserialized from
17906                /// the integer representation of enums.
17907                pub fn name(&self) -> std::option::Option<&str> {
17908                    match self {
17909                        Self::Unspecified => std::option::Option::Some(
17910                            "SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED",
17911                        ),
17912                        Self::OidcToken => std::option::Option::Some("OIDC_TOKEN"),
17913                        Self::UnknownValue(u) => u.0.name(),
17914                    }
17915                }
17916            }
17917
17918            impl std::default::Default for ServiceAgentAuthenticationType {
17919                fn default() -> Self {
17920                    use std::convert::From;
17921                    Self::from(0)
17922                }
17923            }
17924
17925            impl std::fmt::Display for ServiceAgentAuthenticationType {
17926                fn fmt(
17927                    &self,
17928                    f: &mut std::fmt::Formatter<'_>,
17929                ) -> std::result::Result<(), std::fmt::Error> {
17930                    wkt::internal::display_enum(f, self.name(), self.value())
17931                }
17932            }
17933
17934            impl std::convert::From<i32> for ServiceAgentAuthenticationType {
17935                fn from(value: i32) -> Self {
17936                    match value {
17937                        0 => Self::Unspecified,
17938                        1 => Self::OidcToken,
17939                        _ => Self::UnknownValue(service_agent_authentication_type::UnknownValue(
17940                            wkt::internal::UnknownEnumValue::Integer(value),
17941                        )),
17942                    }
17943                }
17944            }
17945
17946            impl std::convert::From<&str> for ServiceAgentAuthenticationType {
17947                fn from(value: &str) -> Self {
17948                    use std::string::ToString;
17949                    match value {
17950                        "SERVICE_AGENT_AUTHENTICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17951                        "OIDC_TOKEN" => Self::OidcToken,
17952                        _ => Self::UnknownValue(service_agent_authentication_type::UnknownValue(
17953                            wkt::internal::UnknownEnumValue::String(value.to_string()),
17954                        )),
17955                    }
17956                }
17957            }
17958
17959            impl serde::ser::Serialize for ServiceAgentAuthenticationType {
17960                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17961                where
17962                    S: serde::Serializer,
17963                {
17964                    match self {
17965                        Self::Unspecified => serializer.serialize_i32(0),
17966                        Self::OidcToken => serializer.serialize_i32(1),
17967                        Self::UnknownValue(u) => u.0.serialize(serializer),
17968                    }
17969                }
17970            }
17971
17972            impl<'de> serde::de::Deserialize<'de> for ServiceAgentAuthenticationType {
17973                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17974                where
17975                    D: serde::Deserializer<'de>,
17976                {
17977                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceAgentAuthenticationType>::new(
17978                        ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ServiceAgentAuthentication.ServiceAgentAuthenticationType"))
17979                }
17980            }
17981        }
17982
17983        /// The HTTP request method options.
17984        ///
17985        /// # Working with unknown values
17986        ///
17987        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17988        /// additional enum variants at any time. Adding new variants is not considered
17989        /// a breaking change. Applications should write their code in anticipation of:
17990        ///
17991        /// - New values appearing in future releases of the client library, **and**
17992        /// - New values received dynamically, without application changes.
17993        ///
17994        /// Please consult the [Working with enums] section in the user guide for some
17995        /// guidelines.
17996        ///
17997        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17998        #[derive(Clone, Debug, PartialEq)]
17999        #[non_exhaustive]
18000        pub enum RequestMethod {
18001            /// No request method specified.
18002            MethodUnspecified,
18003            /// GET request.
18004            Get,
18005            /// POST request.
18006            Post,
18007            /// If set, the enum was initialized with an unknown value.
18008            ///
18009            /// Applications can examine the value using [RequestMethod::value] or
18010            /// [RequestMethod::name].
18011            UnknownValue(request_method::UnknownValue),
18012        }
18013
18014        #[doc(hidden)]
18015        pub mod request_method {
18016            #[allow(unused_imports)]
18017            use super::*;
18018            #[derive(Clone, Debug, PartialEq)]
18019            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18020        }
18021
18022        impl RequestMethod {
18023            /// Gets the enum value.
18024            ///
18025            /// Returns `None` if the enum contains an unknown value deserialized from
18026            /// the string representation of enums.
18027            pub fn value(&self) -> std::option::Option<i32> {
18028                match self {
18029                    Self::MethodUnspecified => std::option::Option::Some(0),
18030                    Self::Get => std::option::Option::Some(1),
18031                    Self::Post => std::option::Option::Some(2),
18032                    Self::UnknownValue(u) => u.0.value(),
18033                }
18034            }
18035
18036            /// Gets the enum value as a string.
18037            ///
18038            /// Returns `None` if the enum contains an unknown value deserialized from
18039            /// the integer representation of enums.
18040            pub fn name(&self) -> std::option::Option<&str> {
18041                match self {
18042                    Self::MethodUnspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
18043                    Self::Get => std::option::Option::Some("GET"),
18044                    Self::Post => std::option::Option::Some("POST"),
18045                    Self::UnknownValue(u) => u.0.name(),
18046                }
18047            }
18048        }
18049
18050        impl std::default::Default for RequestMethod {
18051            fn default() -> Self {
18052                use std::convert::From;
18053                Self::from(0)
18054            }
18055        }
18056
18057        impl std::fmt::Display for RequestMethod {
18058            fn fmt(
18059                &self,
18060                f: &mut std::fmt::Formatter<'_>,
18061            ) -> std::result::Result<(), std::fmt::Error> {
18062                wkt::internal::display_enum(f, self.name(), self.value())
18063            }
18064        }
18065
18066        impl std::convert::From<i32> for RequestMethod {
18067            fn from(value: i32) -> Self {
18068                match value {
18069                    0 => Self::MethodUnspecified,
18070                    1 => Self::Get,
18071                    2 => Self::Post,
18072                    _ => Self::UnknownValue(request_method::UnknownValue(
18073                        wkt::internal::UnknownEnumValue::Integer(value),
18074                    )),
18075                }
18076            }
18077        }
18078
18079        impl std::convert::From<&str> for RequestMethod {
18080            fn from(value: &str) -> Self {
18081                use std::string::ToString;
18082                match value {
18083                    "METHOD_UNSPECIFIED" => Self::MethodUnspecified,
18084                    "GET" => Self::Get,
18085                    "POST" => Self::Post,
18086                    _ => Self::UnknownValue(request_method::UnknownValue(
18087                        wkt::internal::UnknownEnumValue::String(value.to_string()),
18088                    )),
18089                }
18090            }
18091        }
18092
18093        impl serde::ser::Serialize for RequestMethod {
18094            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18095            where
18096                S: serde::Serializer,
18097            {
18098                match self {
18099                    Self::MethodUnspecified => serializer.serialize_i32(0),
18100                    Self::Get => serializer.serialize_i32(1),
18101                    Self::Post => serializer.serialize_i32(2),
18102                    Self::UnknownValue(u) => u.0.serialize(serializer),
18103                }
18104            }
18105        }
18106
18107        impl<'de> serde::de::Deserialize<'de> for RequestMethod {
18108            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18109            where
18110                D: serde::Deserializer<'de>,
18111            {
18112                deserializer.deserialize_any(wkt::internal::EnumVisitor::<RequestMethod>::new(
18113                    ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod",
18114                ))
18115            }
18116        }
18117
18118        /// Header options corresponding to the content type of a HTTP request body.
18119        ///
18120        /// # Working with unknown values
18121        ///
18122        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18123        /// additional enum variants at any time. Adding new variants is not considered
18124        /// a breaking change. Applications should write their code in anticipation of:
18125        ///
18126        /// - New values appearing in future releases of the client library, **and**
18127        /// - New values received dynamically, without application changes.
18128        ///
18129        /// Please consult the [Working with enums] section in the user guide for some
18130        /// guidelines.
18131        ///
18132        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18133        #[derive(Clone, Debug, PartialEq)]
18134        #[non_exhaustive]
18135        pub enum ContentType {
18136            /// No content type specified.
18137            TypeUnspecified,
18138            /// `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
18139            /// to `application/x-www-form-urlencoded` in the HTTP request.
18140            UrlEncoded,
18141            /// `body` is in `custom_content_type` form. Equivalent to setting the
18142            /// `Content-Type` to the contents of `custom_content_type` in the HTTP
18143            /// request.
18144            UserProvided,
18145            /// If set, the enum was initialized with an unknown value.
18146            ///
18147            /// Applications can examine the value using [ContentType::value] or
18148            /// [ContentType::name].
18149            UnknownValue(content_type::UnknownValue),
18150        }
18151
18152        #[doc(hidden)]
18153        pub mod content_type {
18154            #[allow(unused_imports)]
18155            use super::*;
18156            #[derive(Clone, Debug, PartialEq)]
18157            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18158        }
18159
18160        impl ContentType {
18161            /// Gets the enum value.
18162            ///
18163            /// Returns `None` if the enum contains an unknown value deserialized from
18164            /// the string representation of enums.
18165            pub fn value(&self) -> std::option::Option<i32> {
18166                match self {
18167                    Self::TypeUnspecified => std::option::Option::Some(0),
18168                    Self::UrlEncoded => std::option::Option::Some(1),
18169                    Self::UserProvided => std::option::Option::Some(2),
18170                    Self::UnknownValue(u) => u.0.value(),
18171                }
18172            }
18173
18174            /// Gets the enum value as a string.
18175            ///
18176            /// Returns `None` if the enum contains an unknown value deserialized from
18177            /// the integer representation of enums.
18178            pub fn name(&self) -> std::option::Option<&str> {
18179                match self {
18180                    Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
18181                    Self::UrlEncoded => std::option::Option::Some("URL_ENCODED"),
18182                    Self::UserProvided => std::option::Option::Some("USER_PROVIDED"),
18183                    Self::UnknownValue(u) => u.0.name(),
18184                }
18185            }
18186        }
18187
18188        impl std::default::Default for ContentType {
18189            fn default() -> Self {
18190                use std::convert::From;
18191                Self::from(0)
18192            }
18193        }
18194
18195        impl std::fmt::Display for ContentType {
18196            fn fmt(
18197                &self,
18198                f: &mut std::fmt::Formatter<'_>,
18199            ) -> std::result::Result<(), std::fmt::Error> {
18200                wkt::internal::display_enum(f, self.name(), self.value())
18201            }
18202        }
18203
18204        impl std::convert::From<i32> for ContentType {
18205            fn from(value: i32) -> Self {
18206                match value {
18207                    0 => Self::TypeUnspecified,
18208                    1 => Self::UrlEncoded,
18209                    2 => Self::UserProvided,
18210                    _ => Self::UnknownValue(content_type::UnknownValue(
18211                        wkt::internal::UnknownEnumValue::Integer(value),
18212                    )),
18213                }
18214            }
18215        }
18216
18217        impl std::convert::From<&str> for ContentType {
18218            fn from(value: &str) -> Self {
18219                use std::string::ToString;
18220                match value {
18221                    "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
18222                    "URL_ENCODED" => Self::UrlEncoded,
18223                    "USER_PROVIDED" => Self::UserProvided,
18224                    _ => Self::UnknownValue(content_type::UnknownValue(
18225                        wkt::internal::UnknownEnumValue::String(value.to_string()),
18226                    )),
18227                }
18228            }
18229        }
18230
18231        impl serde::ser::Serialize for ContentType {
18232            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18233            where
18234                S: serde::Serializer,
18235            {
18236                match self {
18237                    Self::TypeUnspecified => serializer.serialize_i32(0),
18238                    Self::UrlEncoded => serializer.serialize_i32(1),
18239                    Self::UserProvided => serializer.serialize_i32(2),
18240                    Self::UnknownValue(u) => u.0.serialize(serializer),
18241                }
18242            }
18243        }
18244
18245        impl<'de> serde::de::Deserialize<'de> for ContentType {
18246            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18247            where
18248                D: serde::Deserializer<'de>,
18249            {
18250                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentType>::new(
18251                    ".google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType",
18252                ))
18253            }
18254        }
18255
18256        /// This field is optional and should be set only by users interested in
18257        /// an authenticated uptime check.
18258        /// Do not set both `auth_method` and `auth_info`.
18259        #[derive(Clone, Debug, PartialEq)]
18260        #[non_exhaustive]
18261        pub enum AuthMethod {
18262            /// If specified, Uptime will generate and attach an OIDC JWT token for the
18263            /// Monitoring service agent service account as an `Authorization` header
18264            /// in the HTTP request when probing.
18265            ServiceAgentAuthentication(
18266                std::boxed::Box<
18267                    crate::model::uptime_check_config::http_check::ServiceAgentAuthentication,
18268                >,
18269            ),
18270        }
18271    }
18272
18273    /// Information required for a TCP Uptime check request.
18274    #[derive(Clone, Default, PartialEq)]
18275    #[non_exhaustive]
18276    pub struct TcpCheck {
18277        /// The TCP port on the server against which to run the check. Will be
18278        /// combined with host (specified within the `monitored_resource`) to
18279        /// construct the full URL. Required.
18280        pub port: i32,
18281
18282        /// Contains information needed to add pings to a TCP check.
18283        pub ping_config: std::option::Option<crate::model::uptime_check_config::PingConfig>,
18284
18285        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18286    }
18287
18288    impl TcpCheck {
18289        pub fn new() -> Self {
18290            std::default::Default::default()
18291        }
18292
18293        /// Sets the value of [port][crate::model::uptime_check_config::TcpCheck::port].
18294        ///
18295        /// # Example
18296        /// ```ignore,no_run
18297        /// # use google_cloud_monitoring_v3::model::uptime_check_config::TcpCheck;
18298        /// let x = TcpCheck::new().set_port(42);
18299        /// ```
18300        pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18301            self.port = v.into();
18302            self
18303        }
18304
18305        /// Sets the value of [ping_config][crate::model::uptime_check_config::TcpCheck::ping_config].
18306        ///
18307        /// # Example
18308        /// ```ignore,no_run
18309        /// # use google_cloud_monitoring_v3::model::uptime_check_config::TcpCheck;
18310        /// use google_cloud_monitoring_v3::model::uptime_check_config::PingConfig;
18311        /// let x = TcpCheck::new().set_ping_config(PingConfig::default()/* use setters */);
18312        /// ```
18313        pub fn set_ping_config<T>(mut self, v: T) -> Self
18314        where
18315            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
18316        {
18317            self.ping_config = std::option::Option::Some(v.into());
18318            self
18319        }
18320
18321        /// Sets or clears the value of [ping_config][crate::model::uptime_check_config::TcpCheck::ping_config].
18322        ///
18323        /// # Example
18324        /// ```ignore,no_run
18325        /// # use google_cloud_monitoring_v3::model::uptime_check_config::TcpCheck;
18326        /// use google_cloud_monitoring_v3::model::uptime_check_config::PingConfig;
18327        /// let x = TcpCheck::new().set_or_clear_ping_config(Some(PingConfig::default()/* use setters */));
18328        /// let x = TcpCheck::new().set_or_clear_ping_config(None::<PingConfig>);
18329        /// ```
18330        pub fn set_or_clear_ping_config<T>(mut self, v: std::option::Option<T>) -> Self
18331        where
18332            T: std::convert::Into<crate::model::uptime_check_config::PingConfig>,
18333        {
18334            self.ping_config = v.map(|x| x.into());
18335            self
18336        }
18337    }
18338
18339    impl wkt::message::Message for TcpCheck {
18340        fn typename() -> &'static str {
18341            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.TcpCheck"
18342        }
18343    }
18344
18345    /// Optional. Used to perform content matching. This allows matching based on
18346    /// substrings and regular expressions, together with their negations. Only the
18347    /// first 4&nbsp;MB of an HTTP or HTTPS check's response (and the first
18348    /// 1&nbsp;MB of a TCP check's response) are examined for purposes of content
18349    /// matching.
18350    #[derive(Clone, Default, PartialEq)]
18351    #[non_exhaustive]
18352    pub struct ContentMatcher {
18353        /// String, regex or JSON content to match. Maximum 1024 bytes. An empty
18354        /// `content` string indicates no content matching is to be performed.
18355        pub content: std::string::String,
18356
18357        /// The type of content matcher that will be applied to the server output,
18358        /// compared to the `content` string when the check is run.
18359        pub matcher: crate::model::uptime_check_config::content_matcher::ContentMatcherOption,
18360
18361        /// Certain `ContentMatcherOption` types require additional information.
18362        /// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
18363        /// `JsonPathMatcher`; not used for other options.
18364        pub additional_matcher_info: std::option::Option<
18365            crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo,
18366        >,
18367
18368        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18369    }
18370
18371    impl ContentMatcher {
18372        pub fn new() -> Self {
18373            std::default::Default::default()
18374        }
18375
18376        /// Sets the value of [content][crate::model::uptime_check_config::ContentMatcher::content].
18377        ///
18378        /// # Example
18379        /// ```ignore,no_run
18380        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ContentMatcher;
18381        /// let x = ContentMatcher::new().set_content("example");
18382        /// ```
18383        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18384            self.content = v.into();
18385            self
18386        }
18387
18388        /// Sets the value of [matcher][crate::model::uptime_check_config::ContentMatcher::matcher].
18389        ///
18390        /// # Example
18391        /// ```ignore,no_run
18392        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ContentMatcher;
18393        /// use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::ContentMatcherOption;
18394        /// let x0 = ContentMatcher::new().set_matcher(ContentMatcherOption::ContainsString);
18395        /// let x1 = ContentMatcher::new().set_matcher(ContentMatcherOption::NotContainsString);
18396        /// let x2 = ContentMatcher::new().set_matcher(ContentMatcherOption::MatchesRegex);
18397        /// ```
18398        pub fn set_matcher<
18399            T: std::convert::Into<
18400                    crate::model::uptime_check_config::content_matcher::ContentMatcherOption,
18401                >,
18402        >(
18403            mut self,
18404            v: T,
18405        ) -> Self {
18406            self.matcher = v.into();
18407            self
18408        }
18409
18410        /// Sets the value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info].
18411        ///
18412        /// Note that all the setters affecting `additional_matcher_info` are mutually
18413        /// exclusive.
18414        ///
18415        /// # Example
18416        /// ```ignore,no_run
18417        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ContentMatcher;
18418        /// use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::JsonPathMatcher;
18419        /// let x = ContentMatcher::new().set_additional_matcher_info(Some(
18420        ///     google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::AdditionalMatcherInfo::JsonPathMatcher(JsonPathMatcher::default().into())));
18421        /// ```
18422        pub fn set_additional_matcher_info<
18423            T: std::convert::Into<
18424                    std::option::Option<
18425                        crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo,
18426                    >,
18427                >,
18428        >(
18429            mut self,
18430            v: T,
18431        ) -> Self {
18432            self.additional_matcher_info = v.into();
18433            self
18434        }
18435
18436        /// The value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info]
18437        /// if it holds a `JsonPathMatcher`, `None` if the field is not set or
18438        /// holds a different branch.
18439        pub fn json_path_matcher(
18440            &self,
18441        ) -> std::option::Option<
18442            &std::boxed::Box<crate::model::uptime_check_config::content_matcher::JsonPathMatcher>,
18443        > {
18444            #[allow(unreachable_patterns)]
18445            self.additional_matcher_info.as_ref().and_then(|v| match v {
18446                crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo::JsonPathMatcher(v) => std::option::Option::Some(v),
18447                _ => std::option::Option::None,
18448            })
18449        }
18450
18451        /// Sets the value of [additional_matcher_info][crate::model::uptime_check_config::ContentMatcher::additional_matcher_info]
18452        /// to hold a `JsonPathMatcher`.
18453        ///
18454        /// Note that all the setters affecting `additional_matcher_info` are
18455        /// mutually exclusive.
18456        ///
18457        /// # Example
18458        /// ```ignore,no_run
18459        /// # use google_cloud_monitoring_v3::model::uptime_check_config::ContentMatcher;
18460        /// use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::JsonPathMatcher;
18461        /// let x = ContentMatcher::new().set_json_path_matcher(JsonPathMatcher::default()/* use setters */);
18462        /// assert!(x.json_path_matcher().is_some());
18463        /// ```
18464        pub fn set_json_path_matcher<
18465            T: std::convert::Into<
18466                    std::boxed::Box<
18467                        crate::model::uptime_check_config::content_matcher::JsonPathMatcher,
18468                    >,
18469                >,
18470        >(
18471            mut self,
18472            v: T,
18473        ) -> Self {
18474            self.additional_matcher_info = std::option::Option::Some(
18475                crate::model::uptime_check_config::content_matcher::AdditionalMatcherInfo::JsonPathMatcher(
18476                    v.into()
18477                )
18478            );
18479            self
18480        }
18481    }
18482
18483    impl wkt::message::Message for ContentMatcher {
18484        fn typename() -> &'static str {
18485            "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ContentMatcher"
18486        }
18487    }
18488
18489    /// Defines additional types related to [ContentMatcher].
18490    pub mod content_matcher {
18491        #[allow(unused_imports)]
18492        use super::*;
18493
18494        /// Information needed to perform a JSONPath content match.
18495        /// Used for `ContentMatcherOption::MATCHES_JSON_PATH` and
18496        /// `ContentMatcherOption::NOT_MATCHES_JSON_PATH`.
18497        #[derive(Clone, Default, PartialEq)]
18498        #[non_exhaustive]
18499        pub struct JsonPathMatcher {
18500
18501            /// JSONPath within the response output pointing to the expected
18502            /// `ContentMatcher::content` to match against.
18503            pub json_path: std::string::String,
18504
18505            /// The type of JSONPath match that will be applied to the JSON output
18506            /// (`ContentMatcher.content`)
18507            pub json_matcher: crate::model::uptime_check_config::content_matcher::json_path_matcher::JsonPathMatcherOption,
18508
18509            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18510        }
18511
18512        impl JsonPathMatcher {
18513            pub fn new() -> Self {
18514                std::default::Default::default()
18515            }
18516
18517            /// Sets the value of [json_path][crate::model::uptime_check_config::content_matcher::JsonPathMatcher::json_path].
18518            ///
18519            /// # Example
18520            /// ```ignore,no_run
18521            /// # use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::JsonPathMatcher;
18522            /// let x = JsonPathMatcher::new().set_json_path("example");
18523            /// ```
18524            pub fn set_json_path<T: std::convert::Into<std::string::String>>(
18525                mut self,
18526                v: T,
18527            ) -> Self {
18528                self.json_path = v.into();
18529                self
18530            }
18531
18532            /// Sets the value of [json_matcher][crate::model::uptime_check_config::content_matcher::JsonPathMatcher::json_matcher].
18533            ///
18534            /// # Example
18535            /// ```ignore,no_run
18536            /// # use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::JsonPathMatcher;
18537            /// use google_cloud_monitoring_v3::model::uptime_check_config::content_matcher::json_path_matcher::JsonPathMatcherOption;
18538            /// let x0 = JsonPathMatcher::new().set_json_matcher(JsonPathMatcherOption::ExactMatch);
18539            /// let x1 = JsonPathMatcher::new().set_json_matcher(JsonPathMatcherOption::RegexMatch);
18540            /// ```
18541            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{
18542                self.json_matcher = v.into();
18543                self
18544            }
18545        }
18546
18547        impl wkt::message::Message for JsonPathMatcher {
18548            fn typename() -> &'static str {
18549                "type.googleapis.com/google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher"
18550            }
18551        }
18552
18553        /// Defines additional types related to [JsonPathMatcher].
18554        pub mod json_path_matcher {
18555            #[allow(unused_imports)]
18556            use super::*;
18557
18558            /// Options to perform JSONPath content matching.
18559            ///
18560            /// # Working with unknown values
18561            ///
18562            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18563            /// additional enum variants at any time. Adding new variants is not considered
18564            /// a breaking change. Applications should write their code in anticipation of:
18565            ///
18566            /// - New values appearing in future releases of the client library, **and**
18567            /// - New values received dynamically, without application changes.
18568            ///
18569            /// Please consult the [Working with enums] section in the user guide for some
18570            /// guidelines.
18571            ///
18572            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18573            #[derive(Clone, Debug, PartialEq)]
18574            #[non_exhaustive]
18575            pub enum JsonPathMatcherOption {
18576                /// No JSONPath matcher type specified (not valid).
18577                Unspecified,
18578                /// Selects 'exact string' matching. The match succeeds if the content at
18579                /// the `json_path` within the output is exactly the same as the
18580                /// `content` string.
18581                ExactMatch,
18582                /// Selects regular-expression matching. The match succeeds if the
18583                /// content at the `json_path` within the output matches the regular
18584                /// expression specified in the `content` string.
18585                RegexMatch,
18586                /// If set, the enum was initialized with an unknown value.
18587                ///
18588                /// Applications can examine the value using [JsonPathMatcherOption::value] or
18589                /// [JsonPathMatcherOption::name].
18590                UnknownValue(json_path_matcher_option::UnknownValue),
18591            }
18592
18593            #[doc(hidden)]
18594            pub mod json_path_matcher_option {
18595                #[allow(unused_imports)]
18596                use super::*;
18597                #[derive(Clone, Debug, PartialEq)]
18598                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18599            }
18600
18601            impl JsonPathMatcherOption {
18602                /// Gets the enum value.
18603                ///
18604                /// Returns `None` if the enum contains an unknown value deserialized from
18605                /// the string representation of enums.
18606                pub fn value(&self) -> std::option::Option<i32> {
18607                    match self {
18608                        Self::Unspecified => std::option::Option::Some(0),
18609                        Self::ExactMatch => std::option::Option::Some(1),
18610                        Self::RegexMatch => std::option::Option::Some(2),
18611                        Self::UnknownValue(u) => u.0.value(),
18612                    }
18613                }
18614
18615                /// Gets the enum value as a string.
18616                ///
18617                /// Returns `None` if the enum contains an unknown value deserialized from
18618                /// the integer representation of enums.
18619                pub fn name(&self) -> std::option::Option<&str> {
18620                    match self {
18621                        Self::Unspecified => {
18622                            std::option::Option::Some("JSON_PATH_MATCHER_OPTION_UNSPECIFIED")
18623                        }
18624                        Self::ExactMatch => std::option::Option::Some("EXACT_MATCH"),
18625                        Self::RegexMatch => std::option::Option::Some("REGEX_MATCH"),
18626                        Self::UnknownValue(u) => u.0.name(),
18627                    }
18628                }
18629            }
18630
18631            impl std::default::Default for JsonPathMatcherOption {
18632                fn default() -> Self {
18633                    use std::convert::From;
18634                    Self::from(0)
18635                }
18636            }
18637
18638            impl std::fmt::Display for JsonPathMatcherOption {
18639                fn fmt(
18640                    &self,
18641                    f: &mut std::fmt::Formatter<'_>,
18642                ) -> std::result::Result<(), std::fmt::Error> {
18643                    wkt::internal::display_enum(f, self.name(), self.value())
18644                }
18645            }
18646
18647            impl std::convert::From<i32> for JsonPathMatcherOption {
18648                fn from(value: i32) -> Self {
18649                    match value {
18650                        0 => Self::Unspecified,
18651                        1 => Self::ExactMatch,
18652                        2 => Self::RegexMatch,
18653                        _ => Self::UnknownValue(json_path_matcher_option::UnknownValue(
18654                            wkt::internal::UnknownEnumValue::Integer(value),
18655                        )),
18656                    }
18657                }
18658            }
18659
18660            impl std::convert::From<&str> for JsonPathMatcherOption {
18661                fn from(value: &str) -> Self {
18662                    use std::string::ToString;
18663                    match value {
18664                        "JSON_PATH_MATCHER_OPTION_UNSPECIFIED" => Self::Unspecified,
18665                        "EXACT_MATCH" => Self::ExactMatch,
18666                        "REGEX_MATCH" => Self::RegexMatch,
18667                        _ => Self::UnknownValue(json_path_matcher_option::UnknownValue(
18668                            wkt::internal::UnknownEnumValue::String(value.to_string()),
18669                        )),
18670                    }
18671                }
18672            }
18673
18674            impl serde::ser::Serialize for JsonPathMatcherOption {
18675                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18676                where
18677                    S: serde::Serializer,
18678                {
18679                    match self {
18680                        Self::Unspecified => serializer.serialize_i32(0),
18681                        Self::ExactMatch => serializer.serialize_i32(1),
18682                        Self::RegexMatch => serializer.serialize_i32(2),
18683                        Self::UnknownValue(u) => u.0.serialize(serializer),
18684                    }
18685                }
18686            }
18687
18688            impl<'de> serde::de::Deserialize<'de> for JsonPathMatcherOption {
18689                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18690                where
18691                    D: serde::Deserializer<'de>,
18692                {
18693                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonPathMatcherOption>::new(
18694                        ".google.monitoring.v3.UptimeCheckConfig.ContentMatcher.JsonPathMatcher.JsonPathMatcherOption"))
18695                }
18696            }
18697        }
18698
18699        /// Options to perform content matching.
18700        ///
18701        /// # Working with unknown values
18702        ///
18703        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18704        /// additional enum variants at any time. Adding new variants is not considered
18705        /// a breaking change. Applications should write their code in anticipation of:
18706        ///
18707        /// - New values appearing in future releases of the client library, **and**
18708        /// - New values received dynamically, without application changes.
18709        ///
18710        /// Please consult the [Working with enums] section in the user guide for some
18711        /// guidelines.
18712        ///
18713        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18714        #[derive(Clone, Debug, PartialEq)]
18715        #[non_exhaustive]
18716        pub enum ContentMatcherOption {
18717            /// No content matcher type specified (maintained for backward
18718            /// compatibility, but deprecated for future use).
18719            /// Treated as `CONTAINS_STRING`.
18720            Unspecified,
18721            /// Selects substring matching. The match succeeds if the output contains
18722            /// the `content` string.  This is the default value for checks without
18723            /// a `matcher` option, or where the value of `matcher` is
18724            /// `CONTENT_MATCHER_OPTION_UNSPECIFIED`.
18725            ContainsString,
18726            /// Selects negation of substring matching. The match succeeds if the
18727            /// output does _NOT_ contain the `content` string.
18728            NotContainsString,
18729            /// Selects regular-expression matching. The match succeeds if the output
18730            /// matches the regular expression specified in the `content` string.
18731            /// Regex matching is only supported for HTTP/HTTPS checks.
18732            MatchesRegex,
18733            /// Selects negation of regular-expression matching. The match succeeds if
18734            /// the output does _NOT_ match the regular expression specified in the
18735            /// `content` string. Regex matching is only supported for HTTP/HTTPS
18736            /// checks.
18737            NotMatchesRegex,
18738            /// Selects JSONPath matching. See `JsonPathMatcher` for details on when
18739            /// the match succeeds. JSONPath matching is only supported for HTTP/HTTPS
18740            /// checks.
18741            MatchesJsonPath,
18742            /// Selects JSONPath matching. See `JsonPathMatcher` for details on when
18743            /// the match succeeds. Succeeds when output does _NOT_ match as specified.
18744            /// JSONPath is only supported for HTTP/HTTPS checks.
18745            NotMatchesJsonPath,
18746            /// If set, the enum was initialized with an unknown value.
18747            ///
18748            /// Applications can examine the value using [ContentMatcherOption::value] or
18749            /// [ContentMatcherOption::name].
18750            UnknownValue(content_matcher_option::UnknownValue),
18751        }
18752
18753        #[doc(hidden)]
18754        pub mod content_matcher_option {
18755            #[allow(unused_imports)]
18756            use super::*;
18757            #[derive(Clone, Debug, PartialEq)]
18758            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18759        }
18760
18761        impl ContentMatcherOption {
18762            /// Gets the enum value.
18763            ///
18764            /// Returns `None` if the enum contains an unknown value deserialized from
18765            /// the string representation of enums.
18766            pub fn value(&self) -> std::option::Option<i32> {
18767                match self {
18768                    Self::Unspecified => std::option::Option::Some(0),
18769                    Self::ContainsString => std::option::Option::Some(1),
18770                    Self::NotContainsString => std::option::Option::Some(2),
18771                    Self::MatchesRegex => std::option::Option::Some(3),
18772                    Self::NotMatchesRegex => std::option::Option::Some(4),
18773                    Self::MatchesJsonPath => std::option::Option::Some(5),
18774                    Self::NotMatchesJsonPath => std::option::Option::Some(6),
18775                    Self::UnknownValue(u) => u.0.value(),
18776                }
18777            }
18778
18779            /// Gets the enum value as a string.
18780            ///
18781            /// Returns `None` if the enum contains an unknown value deserialized from
18782            /// the integer representation of enums.
18783            pub fn name(&self) -> std::option::Option<&str> {
18784                match self {
18785                    Self::Unspecified => {
18786                        std::option::Option::Some("CONTENT_MATCHER_OPTION_UNSPECIFIED")
18787                    }
18788                    Self::ContainsString => std::option::Option::Some("CONTAINS_STRING"),
18789                    Self::NotContainsString => std::option::Option::Some("NOT_CONTAINS_STRING"),
18790                    Self::MatchesRegex => std::option::Option::Some("MATCHES_REGEX"),
18791                    Self::NotMatchesRegex => std::option::Option::Some("NOT_MATCHES_REGEX"),
18792                    Self::MatchesJsonPath => std::option::Option::Some("MATCHES_JSON_PATH"),
18793                    Self::NotMatchesJsonPath => std::option::Option::Some("NOT_MATCHES_JSON_PATH"),
18794                    Self::UnknownValue(u) => u.0.name(),
18795                }
18796            }
18797        }
18798
18799        impl std::default::Default for ContentMatcherOption {
18800            fn default() -> Self {
18801                use std::convert::From;
18802                Self::from(0)
18803            }
18804        }
18805
18806        impl std::fmt::Display for ContentMatcherOption {
18807            fn fmt(
18808                &self,
18809                f: &mut std::fmt::Formatter<'_>,
18810            ) -> std::result::Result<(), std::fmt::Error> {
18811                wkt::internal::display_enum(f, self.name(), self.value())
18812            }
18813        }
18814
18815        impl std::convert::From<i32> for ContentMatcherOption {
18816            fn from(value: i32) -> Self {
18817                match value {
18818                    0 => Self::Unspecified,
18819                    1 => Self::ContainsString,
18820                    2 => Self::NotContainsString,
18821                    3 => Self::MatchesRegex,
18822                    4 => Self::NotMatchesRegex,
18823                    5 => Self::MatchesJsonPath,
18824                    6 => Self::NotMatchesJsonPath,
18825                    _ => Self::UnknownValue(content_matcher_option::UnknownValue(
18826                        wkt::internal::UnknownEnumValue::Integer(value),
18827                    )),
18828                }
18829            }
18830        }
18831
18832        impl std::convert::From<&str> for ContentMatcherOption {
18833            fn from(value: &str) -> Self {
18834                use std::string::ToString;
18835                match value {
18836                    "CONTENT_MATCHER_OPTION_UNSPECIFIED" => Self::Unspecified,
18837                    "CONTAINS_STRING" => Self::ContainsString,
18838                    "NOT_CONTAINS_STRING" => Self::NotContainsString,
18839                    "MATCHES_REGEX" => Self::MatchesRegex,
18840                    "NOT_MATCHES_REGEX" => Self::NotMatchesRegex,
18841                    "MATCHES_JSON_PATH" => Self::MatchesJsonPath,
18842                    "NOT_MATCHES_JSON_PATH" => Self::NotMatchesJsonPath,
18843                    _ => Self::UnknownValue(content_matcher_option::UnknownValue(
18844                        wkt::internal::UnknownEnumValue::String(value.to_string()),
18845                    )),
18846                }
18847            }
18848        }
18849
18850        impl serde::ser::Serialize for ContentMatcherOption {
18851            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18852            where
18853                S: serde::Serializer,
18854            {
18855                match self {
18856                    Self::Unspecified => serializer.serialize_i32(0),
18857                    Self::ContainsString => serializer.serialize_i32(1),
18858                    Self::NotContainsString => serializer.serialize_i32(2),
18859                    Self::MatchesRegex => serializer.serialize_i32(3),
18860                    Self::NotMatchesRegex => serializer.serialize_i32(4),
18861                    Self::MatchesJsonPath => serializer.serialize_i32(5),
18862                    Self::NotMatchesJsonPath => serializer.serialize_i32(6),
18863                    Self::UnknownValue(u) => u.0.serialize(serializer),
18864                }
18865            }
18866        }
18867
18868        impl<'de> serde::de::Deserialize<'de> for ContentMatcherOption {
18869            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18870            where
18871                D: serde::Deserializer<'de>,
18872            {
18873                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentMatcherOption>::new(
18874                    ".google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption"))
18875            }
18876        }
18877
18878        /// Certain `ContentMatcherOption` types require additional information.
18879        /// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
18880        /// `JsonPathMatcher`; not used for other options.
18881        #[derive(Clone, Debug, PartialEq)]
18882        #[non_exhaustive]
18883        pub enum AdditionalMatcherInfo {
18884            /// Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH`
18885            JsonPathMatcher(
18886                std::boxed::Box<
18887                    crate::model::uptime_check_config::content_matcher::JsonPathMatcher,
18888                >,
18889            ),
18890        }
18891    }
18892
18893    /// What kind of checkers are available to be used by the check.
18894    ///
18895    /// # Working with unknown values
18896    ///
18897    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18898    /// additional enum variants at any time. Adding new variants is not considered
18899    /// a breaking change. Applications should write their code in anticipation of:
18900    ///
18901    /// - New values appearing in future releases of the client library, **and**
18902    /// - New values received dynamically, without application changes.
18903    ///
18904    /// Please consult the [Working with enums] section in the user guide for some
18905    /// guidelines.
18906    ///
18907    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18908    #[derive(Clone, Debug, PartialEq)]
18909    #[non_exhaustive]
18910    pub enum CheckerType {
18911        /// The default checker type. Currently converted to `STATIC_IP_CHECKERS`
18912        /// on creation, the default conversion behavior may change in the future.
18913        Unspecified,
18914        /// `STATIC_IP_CHECKERS` are used for uptime checks that perform egress
18915        /// across the public internet. `STATIC_IP_CHECKERS` use the static IP
18916        /// addresses returned by `ListUptimeCheckIps`.
18917        StaticIpCheckers,
18918        /// `VPC_CHECKERS` are used for uptime checks that perform egress using
18919        /// Service Directory and private network access. When using `VPC_CHECKERS`,
18920        /// the monitored resource type must be `servicedirectory_service`.
18921        VpcCheckers,
18922        /// If set, the enum was initialized with an unknown value.
18923        ///
18924        /// Applications can examine the value using [CheckerType::value] or
18925        /// [CheckerType::name].
18926        UnknownValue(checker_type::UnknownValue),
18927    }
18928
18929    #[doc(hidden)]
18930    pub mod checker_type {
18931        #[allow(unused_imports)]
18932        use super::*;
18933        #[derive(Clone, Debug, PartialEq)]
18934        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18935    }
18936
18937    impl CheckerType {
18938        /// Gets the enum value.
18939        ///
18940        /// Returns `None` if the enum contains an unknown value deserialized from
18941        /// the string representation of enums.
18942        pub fn value(&self) -> std::option::Option<i32> {
18943            match self {
18944                Self::Unspecified => std::option::Option::Some(0),
18945                Self::StaticIpCheckers => std::option::Option::Some(1),
18946                Self::VpcCheckers => std::option::Option::Some(3),
18947                Self::UnknownValue(u) => u.0.value(),
18948            }
18949        }
18950
18951        /// Gets the enum value as a string.
18952        ///
18953        /// Returns `None` if the enum contains an unknown value deserialized from
18954        /// the integer representation of enums.
18955        pub fn name(&self) -> std::option::Option<&str> {
18956            match self {
18957                Self::Unspecified => std::option::Option::Some("CHECKER_TYPE_UNSPECIFIED"),
18958                Self::StaticIpCheckers => std::option::Option::Some("STATIC_IP_CHECKERS"),
18959                Self::VpcCheckers => std::option::Option::Some("VPC_CHECKERS"),
18960                Self::UnknownValue(u) => u.0.name(),
18961            }
18962        }
18963    }
18964
18965    impl std::default::Default for CheckerType {
18966        fn default() -> Self {
18967            use std::convert::From;
18968            Self::from(0)
18969        }
18970    }
18971
18972    impl std::fmt::Display for CheckerType {
18973        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18974            wkt::internal::display_enum(f, self.name(), self.value())
18975        }
18976    }
18977
18978    impl std::convert::From<i32> for CheckerType {
18979        fn from(value: i32) -> Self {
18980            match value {
18981                0 => Self::Unspecified,
18982                1 => Self::StaticIpCheckers,
18983                3 => Self::VpcCheckers,
18984                _ => Self::UnknownValue(checker_type::UnknownValue(
18985                    wkt::internal::UnknownEnumValue::Integer(value),
18986                )),
18987            }
18988        }
18989    }
18990
18991    impl std::convert::From<&str> for CheckerType {
18992        fn from(value: &str) -> Self {
18993            use std::string::ToString;
18994            match value {
18995                "CHECKER_TYPE_UNSPECIFIED" => Self::Unspecified,
18996                "STATIC_IP_CHECKERS" => Self::StaticIpCheckers,
18997                "VPC_CHECKERS" => Self::VpcCheckers,
18998                _ => Self::UnknownValue(checker_type::UnknownValue(
18999                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19000                )),
19001            }
19002        }
19003    }
19004
19005    impl serde::ser::Serialize for CheckerType {
19006        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19007        where
19008            S: serde::Serializer,
19009        {
19010            match self {
19011                Self::Unspecified => serializer.serialize_i32(0),
19012                Self::StaticIpCheckers => serializer.serialize_i32(1),
19013                Self::VpcCheckers => serializer.serialize_i32(3),
19014                Self::UnknownValue(u) => u.0.serialize(serializer),
19015            }
19016        }
19017    }
19018
19019    impl<'de> serde::de::Deserialize<'de> for CheckerType {
19020        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19021        where
19022            D: serde::Deserializer<'de>,
19023        {
19024            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CheckerType>::new(
19025                ".google.monitoring.v3.UptimeCheckConfig.CheckerType",
19026            ))
19027        }
19028    }
19029
19030    /// The resource the check is checking. Required.
19031    #[derive(Clone, Debug, PartialEq)]
19032    #[non_exhaustive]
19033    pub enum Resource {
19034        /// The [monitored
19035        /// resource](https://cloud.google.com/monitoring/api/resources) associated
19036        /// with the configuration.
19037        /// The following monitored resource types are valid for this field:
19038        /// `uptime_url`,
19039        /// `gce_instance`,
19040        /// `gae_app`,
19041        /// `aws_ec2_instance`,
19042        /// `aws_elb_load_balancer`
19043        /// `k8s_service`
19044        /// `servicedirectory_service`
19045        /// `cloud_run_revision`
19046        MonitoredResource(std::boxed::Box<api::model::MonitoredResource>),
19047        /// The group resource associated with the configuration.
19048        ResourceGroup(std::boxed::Box<crate::model::uptime_check_config::ResourceGroup>),
19049        /// Specifies a Synthetic Monitor to invoke.
19050        SyntheticMonitor(std::boxed::Box<crate::model::SyntheticMonitorTarget>),
19051    }
19052
19053    /// The type of Uptime check request.
19054    #[derive(Clone, Debug, PartialEq)]
19055    #[non_exhaustive]
19056    pub enum CheckRequestType {
19057        /// Contains information needed to make an HTTP or HTTPS check.
19058        HttpCheck(std::boxed::Box<crate::model::uptime_check_config::HttpCheck>),
19059        /// Contains information needed to make a TCP check.
19060        TcpCheck(std::boxed::Box<crate::model::uptime_check_config::TcpCheck>),
19061    }
19062}
19063
19064/// Contains the region, location, and list of IP
19065/// addresses where checkers in the location run from.
19066#[derive(Clone, Default, PartialEq)]
19067#[non_exhaustive]
19068pub struct UptimeCheckIp {
19069    /// A broad region category in which the IP address is located.
19070    pub region: crate::model::UptimeCheckRegion,
19071
19072    /// A more specific location within the region that typically encodes
19073    /// a particular city/town/metro (and its containing state/province or country)
19074    /// within the broader umbrella region category.
19075    pub location: std::string::String,
19076
19077    /// The IP address from which the Uptime check originates. This is a fully
19078    /// specified IP address (not an IP address range). Most IP addresses, as of
19079    /// this publication, are in IPv4 format; however, one should not rely on the
19080    /// IP addresses being in IPv4 format indefinitely, and should support
19081    /// interpreting this field in either IPv4 or IPv6 format.
19082    pub ip_address: std::string::String,
19083
19084    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19085}
19086
19087impl UptimeCheckIp {
19088    pub fn new() -> Self {
19089        std::default::Default::default()
19090    }
19091
19092    /// Sets the value of [region][crate::model::UptimeCheckIp::region].
19093    ///
19094    /// # Example
19095    /// ```ignore,no_run
19096    /// # use google_cloud_monitoring_v3::model::UptimeCheckIp;
19097    /// use google_cloud_monitoring_v3::model::UptimeCheckRegion;
19098    /// let x0 = UptimeCheckIp::new().set_region(UptimeCheckRegion::Usa);
19099    /// let x1 = UptimeCheckIp::new().set_region(UptimeCheckRegion::Europe);
19100    /// let x2 = UptimeCheckIp::new().set_region(UptimeCheckRegion::SouthAmerica);
19101    /// ```
19102    pub fn set_region<T: std::convert::Into<crate::model::UptimeCheckRegion>>(
19103        mut self,
19104        v: T,
19105    ) -> Self {
19106        self.region = v.into();
19107        self
19108    }
19109
19110    /// Sets the value of [location][crate::model::UptimeCheckIp::location].
19111    ///
19112    /// # Example
19113    /// ```ignore,no_run
19114    /// # use google_cloud_monitoring_v3::model::UptimeCheckIp;
19115    /// let x = UptimeCheckIp::new().set_location("example");
19116    /// ```
19117    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19118        self.location = v.into();
19119        self
19120    }
19121
19122    /// Sets the value of [ip_address][crate::model::UptimeCheckIp::ip_address].
19123    ///
19124    /// # Example
19125    /// ```ignore,no_run
19126    /// # use google_cloud_monitoring_v3::model::UptimeCheckIp;
19127    /// let x = UptimeCheckIp::new().set_ip_address("example");
19128    /// ```
19129    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19130        self.ip_address = v.into();
19131        self
19132    }
19133}
19134
19135impl wkt::message::Message for UptimeCheckIp {
19136    fn typename() -> &'static str {
19137        "type.googleapis.com/google.monitoring.v3.UptimeCheckIp"
19138    }
19139}
19140
19141/// The protocol for the `ListUptimeCheckConfigs` request.
19142#[derive(Clone, Default, PartialEq)]
19143#[non_exhaustive]
19144pub struct ListUptimeCheckConfigsRequest {
19145    /// Required. The
19146    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) whose
19147    /// Uptime check configurations are listed. The format is:
19148    ///
19149    /// ```norust
19150    /// projects/[PROJECT_ID_OR_NUMBER]
19151    /// ```
19152    pub parent: std::string::String,
19153
19154    /// If provided, this field specifies the criteria that must be met by
19155    /// uptime checks to be included in the response.
19156    ///
19157    /// For more details, see [Filtering
19158    /// syntax](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering#filter_syntax).
19159    pub filter: std::string::String,
19160
19161    /// The maximum number of results to return in a single response. The server
19162    /// may further constrain the maximum number of results returned in a single
19163    /// page. If the page_size is <=0, the server will decide the number of results
19164    /// to be returned.
19165    pub page_size: i32,
19166
19167    /// If this field is not empty then it must contain the `nextPageToken` value
19168    /// returned by a previous call to this method.  Using this field causes the
19169    /// method to return more results from the previous method call.
19170    pub page_token: std::string::String,
19171
19172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19173}
19174
19175impl ListUptimeCheckConfigsRequest {
19176    pub fn new() -> Self {
19177        std::default::Default::default()
19178    }
19179
19180    /// Sets the value of [parent][crate::model::ListUptimeCheckConfigsRequest::parent].
19181    ///
19182    /// # Example
19183    /// ```ignore,no_run
19184    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsRequest;
19185    /// let x = ListUptimeCheckConfigsRequest::new().set_parent("example");
19186    /// ```
19187    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19188        self.parent = v.into();
19189        self
19190    }
19191
19192    /// Sets the value of [filter][crate::model::ListUptimeCheckConfigsRequest::filter].
19193    ///
19194    /// # Example
19195    /// ```ignore,no_run
19196    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsRequest;
19197    /// let x = ListUptimeCheckConfigsRequest::new().set_filter("example");
19198    /// ```
19199    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19200        self.filter = v.into();
19201        self
19202    }
19203
19204    /// Sets the value of [page_size][crate::model::ListUptimeCheckConfigsRequest::page_size].
19205    ///
19206    /// # Example
19207    /// ```ignore,no_run
19208    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsRequest;
19209    /// let x = ListUptimeCheckConfigsRequest::new().set_page_size(42);
19210    /// ```
19211    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19212        self.page_size = v.into();
19213        self
19214    }
19215
19216    /// Sets the value of [page_token][crate::model::ListUptimeCheckConfigsRequest::page_token].
19217    ///
19218    /// # Example
19219    /// ```ignore,no_run
19220    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsRequest;
19221    /// let x = ListUptimeCheckConfigsRequest::new().set_page_token("example");
19222    /// ```
19223    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19224        self.page_token = v.into();
19225        self
19226    }
19227}
19228
19229impl wkt::message::Message for ListUptimeCheckConfigsRequest {
19230    fn typename() -> &'static str {
19231        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckConfigsRequest"
19232    }
19233}
19234
19235/// The protocol for the `ListUptimeCheckConfigs` response.
19236#[derive(Clone, Default, PartialEq)]
19237#[non_exhaustive]
19238pub struct ListUptimeCheckConfigsResponse {
19239    /// The returned Uptime check configurations.
19240    pub uptime_check_configs: std::vec::Vec<crate::model::UptimeCheckConfig>,
19241
19242    /// This field represents the pagination token to retrieve the next page of
19243    /// results. If the value is empty, it means no further results for the
19244    /// request. To retrieve the next page of results, the value of the
19245    /// next_page_token is passed to the subsequent List method call (in the
19246    /// request message's page_token field).
19247    pub next_page_token: std::string::String,
19248
19249    /// The total number of Uptime check configurations for the project,
19250    /// irrespective of any pagination.
19251    pub total_size: i32,
19252
19253    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19254}
19255
19256impl ListUptimeCheckConfigsResponse {
19257    pub fn new() -> Self {
19258        std::default::Default::default()
19259    }
19260
19261    /// Sets the value of [uptime_check_configs][crate::model::ListUptimeCheckConfigsResponse::uptime_check_configs].
19262    ///
19263    /// # Example
19264    /// ```ignore,no_run
19265    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsResponse;
19266    /// use google_cloud_monitoring_v3::model::UptimeCheckConfig;
19267    /// let x = ListUptimeCheckConfigsResponse::new()
19268    ///     .set_uptime_check_configs([
19269    ///         UptimeCheckConfig::default()/* use setters */,
19270    ///         UptimeCheckConfig::default()/* use (different) setters */,
19271    ///     ]);
19272    /// ```
19273    pub fn set_uptime_check_configs<T, V>(mut self, v: T) -> Self
19274    where
19275        T: std::iter::IntoIterator<Item = V>,
19276        V: std::convert::Into<crate::model::UptimeCheckConfig>,
19277    {
19278        use std::iter::Iterator;
19279        self.uptime_check_configs = v.into_iter().map(|i| i.into()).collect();
19280        self
19281    }
19282
19283    /// Sets the value of [next_page_token][crate::model::ListUptimeCheckConfigsResponse::next_page_token].
19284    ///
19285    /// # Example
19286    /// ```ignore,no_run
19287    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsResponse;
19288    /// let x = ListUptimeCheckConfigsResponse::new().set_next_page_token("example");
19289    /// ```
19290    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19291        self.next_page_token = v.into();
19292        self
19293    }
19294
19295    /// Sets the value of [total_size][crate::model::ListUptimeCheckConfigsResponse::total_size].
19296    ///
19297    /// # Example
19298    /// ```ignore,no_run
19299    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckConfigsResponse;
19300    /// let x = ListUptimeCheckConfigsResponse::new().set_total_size(42);
19301    /// ```
19302    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19303        self.total_size = v.into();
19304        self
19305    }
19306}
19307
19308impl wkt::message::Message for ListUptimeCheckConfigsResponse {
19309    fn typename() -> &'static str {
19310        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckConfigsResponse"
19311    }
19312}
19313
19314#[doc(hidden)]
19315impl gax::paginator::internal::PageableResponse for ListUptimeCheckConfigsResponse {
19316    type PageItem = crate::model::UptimeCheckConfig;
19317
19318    fn items(self) -> std::vec::Vec<Self::PageItem> {
19319        self.uptime_check_configs
19320    }
19321
19322    fn next_page_token(&self) -> std::string::String {
19323        use std::clone::Clone;
19324        self.next_page_token.clone()
19325    }
19326}
19327
19328/// The protocol for the `GetUptimeCheckConfig` request.
19329#[derive(Clone, Default, PartialEq)]
19330#[non_exhaustive]
19331pub struct GetUptimeCheckConfigRequest {
19332    /// Required. The Uptime check configuration to retrieve. The format is:
19333    ///
19334    /// ```norust
19335    /// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
19336    /// ```
19337    pub name: std::string::String,
19338
19339    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19340}
19341
19342impl GetUptimeCheckConfigRequest {
19343    pub fn new() -> Self {
19344        std::default::Default::default()
19345    }
19346
19347    /// Sets the value of [name][crate::model::GetUptimeCheckConfigRequest::name].
19348    ///
19349    /// # Example
19350    /// ```ignore,no_run
19351    /// # use google_cloud_monitoring_v3::model::GetUptimeCheckConfigRequest;
19352    /// let x = GetUptimeCheckConfigRequest::new().set_name("example");
19353    /// ```
19354    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19355        self.name = v.into();
19356        self
19357    }
19358}
19359
19360impl wkt::message::Message for GetUptimeCheckConfigRequest {
19361    fn typename() -> &'static str {
19362        "type.googleapis.com/google.monitoring.v3.GetUptimeCheckConfigRequest"
19363    }
19364}
19365
19366/// The protocol for the `CreateUptimeCheckConfig` request.
19367#[derive(Clone, Default, PartialEq)]
19368#[non_exhaustive]
19369pub struct CreateUptimeCheckConfigRequest {
19370    /// Required. The
19371    /// [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
19372    /// to create the Uptime check. The format is:
19373    ///
19374    /// ```norust
19375    /// projects/[PROJECT_ID_OR_NUMBER]
19376    /// ```
19377    pub parent: std::string::String,
19378
19379    /// Required. The new Uptime check configuration.
19380    pub uptime_check_config: std::option::Option<crate::model::UptimeCheckConfig>,
19381
19382    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19383}
19384
19385impl CreateUptimeCheckConfigRequest {
19386    pub fn new() -> Self {
19387        std::default::Default::default()
19388    }
19389
19390    /// Sets the value of [parent][crate::model::CreateUptimeCheckConfigRequest::parent].
19391    ///
19392    /// # Example
19393    /// ```ignore,no_run
19394    /// # use google_cloud_monitoring_v3::model::CreateUptimeCheckConfigRequest;
19395    /// let x = CreateUptimeCheckConfigRequest::new().set_parent("example");
19396    /// ```
19397    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19398        self.parent = v.into();
19399        self
19400    }
19401
19402    /// Sets the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
19403    ///
19404    /// # Example
19405    /// ```ignore,no_run
19406    /// # use google_cloud_monitoring_v3::model::CreateUptimeCheckConfigRequest;
19407    /// use google_cloud_monitoring_v3::model::UptimeCheckConfig;
19408    /// let x = CreateUptimeCheckConfigRequest::new().set_uptime_check_config(UptimeCheckConfig::default()/* use setters */);
19409    /// ```
19410    pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
19411    where
19412        T: std::convert::Into<crate::model::UptimeCheckConfig>,
19413    {
19414        self.uptime_check_config = std::option::Option::Some(v.into());
19415        self
19416    }
19417
19418    /// Sets or clears the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
19419    ///
19420    /// # Example
19421    /// ```ignore,no_run
19422    /// # use google_cloud_monitoring_v3::model::CreateUptimeCheckConfigRequest;
19423    /// use google_cloud_monitoring_v3::model::UptimeCheckConfig;
19424    /// let x = CreateUptimeCheckConfigRequest::new().set_or_clear_uptime_check_config(Some(UptimeCheckConfig::default()/* use setters */));
19425    /// let x = CreateUptimeCheckConfigRequest::new().set_or_clear_uptime_check_config(None::<UptimeCheckConfig>);
19426    /// ```
19427    pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
19428    where
19429        T: std::convert::Into<crate::model::UptimeCheckConfig>,
19430    {
19431        self.uptime_check_config = v.map(|x| x.into());
19432        self
19433    }
19434}
19435
19436impl wkt::message::Message for CreateUptimeCheckConfigRequest {
19437    fn typename() -> &'static str {
19438        "type.googleapis.com/google.monitoring.v3.CreateUptimeCheckConfigRequest"
19439    }
19440}
19441
19442/// The protocol for the `UpdateUptimeCheckConfig` request.
19443#[derive(Clone, Default, PartialEq)]
19444#[non_exhaustive]
19445pub struct UpdateUptimeCheckConfigRequest {
19446    /// Optional. If present, only the listed fields in the current Uptime check
19447    /// configuration are updated with values from the new configuration. If this
19448    /// field is empty, then the current configuration is completely replaced with
19449    /// the new configuration.
19450    pub update_mask: std::option::Option<wkt::FieldMask>,
19451
19452    /// Required. If an `updateMask` has been specified, this field gives
19453    /// the values for the set of fields mentioned in the `updateMask`. If an
19454    /// `updateMask` has not been given, this Uptime check configuration replaces
19455    /// the current configuration. If a field is mentioned in `updateMask` but
19456    /// the corresponding field is omitted in this partial Uptime check
19457    /// configuration, it has the effect of deleting/clearing the field from the
19458    /// configuration on the server.
19459    ///
19460    /// The following fields can be updated: `display_name`,
19461    /// `http_check`, `tcp_check`, `timeout`, `content_matchers`, and
19462    /// `selected_regions`.
19463    pub uptime_check_config: std::option::Option<crate::model::UptimeCheckConfig>,
19464
19465    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19466}
19467
19468impl UpdateUptimeCheckConfigRequest {
19469    pub fn new() -> Self {
19470        std::default::Default::default()
19471    }
19472
19473    /// Sets the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
19474    ///
19475    /// # Example
19476    /// ```ignore,no_run
19477    /// # use google_cloud_monitoring_v3::model::UpdateUptimeCheckConfigRequest;
19478    /// use wkt::FieldMask;
19479    /// let x = UpdateUptimeCheckConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
19480    /// ```
19481    pub fn set_update_mask<T>(mut self, v: T) -> Self
19482    where
19483        T: std::convert::Into<wkt::FieldMask>,
19484    {
19485        self.update_mask = std::option::Option::Some(v.into());
19486        self
19487    }
19488
19489    /// Sets or clears the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
19490    ///
19491    /// # Example
19492    /// ```ignore,no_run
19493    /// # use google_cloud_monitoring_v3::model::UpdateUptimeCheckConfigRequest;
19494    /// use wkt::FieldMask;
19495    /// let x = UpdateUptimeCheckConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
19496    /// let x = UpdateUptimeCheckConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
19497    /// ```
19498    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19499    where
19500        T: std::convert::Into<wkt::FieldMask>,
19501    {
19502        self.update_mask = v.map(|x| x.into());
19503        self
19504    }
19505
19506    /// Sets the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
19507    ///
19508    /// # Example
19509    /// ```ignore,no_run
19510    /// # use google_cloud_monitoring_v3::model::UpdateUptimeCheckConfigRequest;
19511    /// use google_cloud_monitoring_v3::model::UptimeCheckConfig;
19512    /// let x = UpdateUptimeCheckConfigRequest::new().set_uptime_check_config(UptimeCheckConfig::default()/* use setters */);
19513    /// ```
19514    pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
19515    where
19516        T: std::convert::Into<crate::model::UptimeCheckConfig>,
19517    {
19518        self.uptime_check_config = std::option::Option::Some(v.into());
19519        self
19520    }
19521
19522    /// Sets or clears the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
19523    ///
19524    /// # Example
19525    /// ```ignore,no_run
19526    /// # use google_cloud_monitoring_v3::model::UpdateUptimeCheckConfigRequest;
19527    /// use google_cloud_monitoring_v3::model::UptimeCheckConfig;
19528    /// let x = UpdateUptimeCheckConfigRequest::new().set_or_clear_uptime_check_config(Some(UptimeCheckConfig::default()/* use setters */));
19529    /// let x = UpdateUptimeCheckConfigRequest::new().set_or_clear_uptime_check_config(None::<UptimeCheckConfig>);
19530    /// ```
19531    pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
19532    where
19533        T: std::convert::Into<crate::model::UptimeCheckConfig>,
19534    {
19535        self.uptime_check_config = v.map(|x| x.into());
19536        self
19537    }
19538}
19539
19540impl wkt::message::Message for UpdateUptimeCheckConfigRequest {
19541    fn typename() -> &'static str {
19542        "type.googleapis.com/google.monitoring.v3.UpdateUptimeCheckConfigRequest"
19543    }
19544}
19545
19546/// The protocol for the `DeleteUptimeCheckConfig` request.
19547#[derive(Clone, Default, PartialEq)]
19548#[non_exhaustive]
19549pub struct DeleteUptimeCheckConfigRequest {
19550    /// Required. The Uptime check configuration to delete. The format is:
19551    ///
19552    /// ```norust
19553    /// projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
19554    /// ```
19555    pub name: std::string::String,
19556
19557    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19558}
19559
19560impl DeleteUptimeCheckConfigRequest {
19561    pub fn new() -> Self {
19562        std::default::Default::default()
19563    }
19564
19565    /// Sets the value of [name][crate::model::DeleteUptimeCheckConfigRequest::name].
19566    ///
19567    /// # Example
19568    /// ```ignore,no_run
19569    /// # use google_cloud_monitoring_v3::model::DeleteUptimeCheckConfigRequest;
19570    /// let x = DeleteUptimeCheckConfigRequest::new().set_name("example");
19571    /// ```
19572    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19573        self.name = v.into();
19574        self
19575    }
19576}
19577
19578impl wkt::message::Message for DeleteUptimeCheckConfigRequest {
19579    fn typename() -> &'static str {
19580        "type.googleapis.com/google.monitoring.v3.DeleteUptimeCheckConfigRequest"
19581    }
19582}
19583
19584/// The protocol for the `ListUptimeCheckIps` request.
19585#[derive(Clone, Default, PartialEq)]
19586#[non_exhaustive]
19587pub struct ListUptimeCheckIpsRequest {
19588    /// The maximum number of results to return in a single response. The server
19589    /// may further constrain the maximum number of results returned in a single
19590    /// page. If the page_size is <=0, the server will decide the number of results
19591    /// to be returned.
19592    /// NOTE: this field is not yet implemented
19593    pub page_size: i32,
19594
19595    /// If this field is not empty then it must contain the `nextPageToken` value
19596    /// returned by a previous call to this method.  Using this field causes the
19597    /// method to return more results from the previous method call.
19598    /// NOTE: this field is not yet implemented
19599    pub page_token: std::string::String,
19600
19601    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19602}
19603
19604impl ListUptimeCheckIpsRequest {
19605    pub fn new() -> Self {
19606        std::default::Default::default()
19607    }
19608
19609    /// Sets the value of [page_size][crate::model::ListUptimeCheckIpsRequest::page_size].
19610    ///
19611    /// # Example
19612    /// ```ignore,no_run
19613    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckIpsRequest;
19614    /// let x = ListUptimeCheckIpsRequest::new().set_page_size(42);
19615    /// ```
19616    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19617        self.page_size = v.into();
19618        self
19619    }
19620
19621    /// Sets the value of [page_token][crate::model::ListUptimeCheckIpsRequest::page_token].
19622    ///
19623    /// # Example
19624    /// ```ignore,no_run
19625    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckIpsRequest;
19626    /// let x = ListUptimeCheckIpsRequest::new().set_page_token("example");
19627    /// ```
19628    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19629        self.page_token = v.into();
19630        self
19631    }
19632}
19633
19634impl wkt::message::Message for ListUptimeCheckIpsRequest {
19635    fn typename() -> &'static str {
19636        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckIpsRequest"
19637    }
19638}
19639
19640/// The protocol for the `ListUptimeCheckIps` response.
19641#[derive(Clone, Default, PartialEq)]
19642#[non_exhaustive]
19643pub struct ListUptimeCheckIpsResponse {
19644    /// The returned list of IP addresses (including region and location) that the
19645    /// checkers run from.
19646    pub uptime_check_ips: std::vec::Vec<crate::model::UptimeCheckIp>,
19647
19648    /// This field represents the pagination token to retrieve the next page of
19649    /// results. If the value is empty, it means no further results for the
19650    /// request. To retrieve the next page of results, the value of the
19651    /// next_page_token is passed to the subsequent List method call (in the
19652    /// request message's page_token field).
19653    /// NOTE: this field is not yet implemented
19654    pub next_page_token: std::string::String,
19655
19656    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19657}
19658
19659impl ListUptimeCheckIpsResponse {
19660    pub fn new() -> Self {
19661        std::default::Default::default()
19662    }
19663
19664    /// Sets the value of [uptime_check_ips][crate::model::ListUptimeCheckIpsResponse::uptime_check_ips].
19665    ///
19666    /// # Example
19667    /// ```ignore,no_run
19668    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckIpsResponse;
19669    /// use google_cloud_monitoring_v3::model::UptimeCheckIp;
19670    /// let x = ListUptimeCheckIpsResponse::new()
19671    ///     .set_uptime_check_ips([
19672    ///         UptimeCheckIp::default()/* use setters */,
19673    ///         UptimeCheckIp::default()/* use (different) setters */,
19674    ///     ]);
19675    /// ```
19676    pub fn set_uptime_check_ips<T, V>(mut self, v: T) -> Self
19677    where
19678        T: std::iter::IntoIterator<Item = V>,
19679        V: std::convert::Into<crate::model::UptimeCheckIp>,
19680    {
19681        use std::iter::Iterator;
19682        self.uptime_check_ips = v.into_iter().map(|i| i.into()).collect();
19683        self
19684    }
19685
19686    /// Sets the value of [next_page_token][crate::model::ListUptimeCheckIpsResponse::next_page_token].
19687    ///
19688    /// # Example
19689    /// ```ignore,no_run
19690    /// # use google_cloud_monitoring_v3::model::ListUptimeCheckIpsResponse;
19691    /// let x = ListUptimeCheckIpsResponse::new().set_next_page_token("example");
19692    /// ```
19693    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19694        self.next_page_token = v.into();
19695        self
19696    }
19697}
19698
19699impl wkt::message::Message for ListUptimeCheckIpsResponse {
19700    fn typename() -> &'static str {
19701        "type.googleapis.com/google.monitoring.v3.ListUptimeCheckIpsResponse"
19702    }
19703}
19704
19705#[doc(hidden)]
19706impl gax::paginator::internal::PageableResponse for ListUptimeCheckIpsResponse {
19707    type PageItem = crate::model::UptimeCheckIp;
19708
19709    fn items(self) -> std::vec::Vec<Self::PageItem> {
19710        self.uptime_check_ips
19711    }
19712
19713    fn next_page_token(&self) -> std::string::String {
19714        use std::clone::Clone;
19715        self.next_page_token.clone()
19716    }
19717}
19718
19719/// Specifies an ordering relationship on two arguments, called `left` and
19720/// `right`.
19721///
19722/// # Working with unknown values
19723///
19724/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19725/// additional enum variants at any time. Adding new variants is not considered
19726/// a breaking change. Applications should write their code in anticipation of:
19727///
19728/// - New values appearing in future releases of the client library, **and**
19729/// - New values received dynamically, without application changes.
19730///
19731/// Please consult the [Working with enums] section in the user guide for some
19732/// guidelines.
19733///
19734/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19735#[derive(Clone, Debug, PartialEq)]
19736#[non_exhaustive]
19737pub enum ComparisonType {
19738    /// No ordering relationship is specified.
19739    ComparisonUnspecified,
19740    /// True if the left argument is greater than the right argument.
19741    ComparisonGt,
19742    /// True if the left argument is greater than or equal to the right argument.
19743    ComparisonGe,
19744    /// True if the left argument is less than the right argument.
19745    ComparisonLt,
19746    /// True if the left argument is less than or equal to the right argument.
19747    ComparisonLe,
19748    /// True if the left argument is equal to the right argument.
19749    ComparisonEq,
19750    /// True if the left argument is not equal to the right argument.
19751    ComparisonNe,
19752    /// If set, the enum was initialized with an unknown value.
19753    ///
19754    /// Applications can examine the value using [ComparisonType::value] or
19755    /// [ComparisonType::name].
19756    UnknownValue(comparison_type::UnknownValue),
19757}
19758
19759#[doc(hidden)]
19760pub mod comparison_type {
19761    #[allow(unused_imports)]
19762    use super::*;
19763    #[derive(Clone, Debug, PartialEq)]
19764    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19765}
19766
19767impl ComparisonType {
19768    /// Gets the enum value.
19769    ///
19770    /// Returns `None` if the enum contains an unknown value deserialized from
19771    /// the string representation of enums.
19772    pub fn value(&self) -> std::option::Option<i32> {
19773        match self {
19774            Self::ComparisonUnspecified => std::option::Option::Some(0),
19775            Self::ComparisonGt => std::option::Option::Some(1),
19776            Self::ComparisonGe => std::option::Option::Some(2),
19777            Self::ComparisonLt => std::option::Option::Some(3),
19778            Self::ComparisonLe => std::option::Option::Some(4),
19779            Self::ComparisonEq => std::option::Option::Some(5),
19780            Self::ComparisonNe => std::option::Option::Some(6),
19781            Self::UnknownValue(u) => u.0.value(),
19782        }
19783    }
19784
19785    /// Gets the enum value as a string.
19786    ///
19787    /// Returns `None` if the enum contains an unknown value deserialized from
19788    /// the integer representation of enums.
19789    pub fn name(&self) -> std::option::Option<&str> {
19790        match self {
19791            Self::ComparisonUnspecified => std::option::Option::Some("COMPARISON_UNSPECIFIED"),
19792            Self::ComparisonGt => std::option::Option::Some("COMPARISON_GT"),
19793            Self::ComparisonGe => std::option::Option::Some("COMPARISON_GE"),
19794            Self::ComparisonLt => std::option::Option::Some("COMPARISON_LT"),
19795            Self::ComparisonLe => std::option::Option::Some("COMPARISON_LE"),
19796            Self::ComparisonEq => std::option::Option::Some("COMPARISON_EQ"),
19797            Self::ComparisonNe => std::option::Option::Some("COMPARISON_NE"),
19798            Self::UnknownValue(u) => u.0.name(),
19799        }
19800    }
19801}
19802
19803impl std::default::Default for ComparisonType {
19804    fn default() -> Self {
19805        use std::convert::From;
19806        Self::from(0)
19807    }
19808}
19809
19810impl std::fmt::Display for ComparisonType {
19811    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19812        wkt::internal::display_enum(f, self.name(), self.value())
19813    }
19814}
19815
19816impl std::convert::From<i32> for ComparisonType {
19817    fn from(value: i32) -> Self {
19818        match value {
19819            0 => Self::ComparisonUnspecified,
19820            1 => Self::ComparisonGt,
19821            2 => Self::ComparisonGe,
19822            3 => Self::ComparisonLt,
19823            4 => Self::ComparisonLe,
19824            5 => Self::ComparisonEq,
19825            6 => Self::ComparisonNe,
19826            _ => Self::UnknownValue(comparison_type::UnknownValue(
19827                wkt::internal::UnknownEnumValue::Integer(value),
19828            )),
19829        }
19830    }
19831}
19832
19833impl std::convert::From<&str> for ComparisonType {
19834    fn from(value: &str) -> Self {
19835        use std::string::ToString;
19836        match value {
19837            "COMPARISON_UNSPECIFIED" => Self::ComparisonUnspecified,
19838            "COMPARISON_GT" => Self::ComparisonGt,
19839            "COMPARISON_GE" => Self::ComparisonGe,
19840            "COMPARISON_LT" => Self::ComparisonLt,
19841            "COMPARISON_LE" => Self::ComparisonLe,
19842            "COMPARISON_EQ" => Self::ComparisonEq,
19843            "COMPARISON_NE" => Self::ComparisonNe,
19844            _ => Self::UnknownValue(comparison_type::UnknownValue(
19845                wkt::internal::UnknownEnumValue::String(value.to_string()),
19846            )),
19847        }
19848    }
19849}
19850
19851impl serde::ser::Serialize for ComparisonType {
19852    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19853    where
19854        S: serde::Serializer,
19855    {
19856        match self {
19857            Self::ComparisonUnspecified => serializer.serialize_i32(0),
19858            Self::ComparisonGt => serializer.serialize_i32(1),
19859            Self::ComparisonGe => serializer.serialize_i32(2),
19860            Self::ComparisonLt => serializer.serialize_i32(3),
19861            Self::ComparisonLe => serializer.serialize_i32(4),
19862            Self::ComparisonEq => serializer.serialize_i32(5),
19863            Self::ComparisonNe => serializer.serialize_i32(6),
19864            Self::UnknownValue(u) => u.0.serialize(serializer),
19865        }
19866    }
19867}
19868
19869impl<'de> serde::de::Deserialize<'de> for ComparisonType {
19870    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19871    where
19872        D: serde::Deserializer<'de>,
19873    {
19874        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComparisonType>::new(
19875            ".google.monitoring.v3.ComparisonType",
19876        ))
19877    }
19878}
19879
19880/// The tier of service for a Metrics Scope. Please see the
19881/// [service tiers
19882/// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more
19883/// details.
19884///
19885/// # Working with unknown values
19886///
19887/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19888/// additional enum variants at any time. Adding new variants is not considered
19889/// a breaking change. Applications should write their code in anticipation of:
19890///
19891/// - New values appearing in future releases of the client library, **and**
19892/// - New values received dynamically, without application changes.
19893///
19894/// Please consult the [Working with enums] section in the user guide for some
19895/// guidelines.
19896///
19897/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19898#[derive(Clone, Debug, PartialEq)]
19899#[non_exhaustive]
19900#[deprecated]
19901pub enum ServiceTier {
19902    /// An invalid sentinel value, used to indicate that a tier has not
19903    /// been provided explicitly.
19904    Unspecified,
19905    /// The Cloud Monitoring Basic tier, a free tier of service that provides basic
19906    /// features, a moderate allotment of logs, and access to built-in metrics.
19907    /// A number of features are not available in this tier. For more details,
19908    /// see [the service tiers
19909    /// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
19910    Basic,
19911    /// The Cloud Monitoring Premium tier, a higher, more expensive tier of service
19912    /// that provides access to all Cloud Monitoring features, lets you use Cloud
19913    /// Monitoring with AWS accounts, and has a larger allotments for logs and
19914    /// metrics. For more details, see [the service tiers
19915    /// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
19916    Premium,
19917    /// If set, the enum was initialized with an unknown value.
19918    ///
19919    /// Applications can examine the value using [ServiceTier::value] or
19920    /// [ServiceTier::name].
19921    UnknownValue(service_tier::UnknownValue),
19922}
19923
19924#[doc(hidden)]
19925pub mod service_tier {
19926    #[allow(unused_imports)]
19927    use super::*;
19928    #[derive(Clone, Debug, PartialEq)]
19929    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19930}
19931
19932impl ServiceTier {
19933    /// Gets the enum value.
19934    ///
19935    /// Returns `None` if the enum contains an unknown value deserialized from
19936    /// the string representation of enums.
19937    pub fn value(&self) -> std::option::Option<i32> {
19938        match self {
19939            Self::Unspecified => std::option::Option::Some(0),
19940            Self::Basic => std::option::Option::Some(1),
19941            Self::Premium => std::option::Option::Some(2),
19942            Self::UnknownValue(u) => u.0.value(),
19943        }
19944    }
19945
19946    /// Gets the enum value as a string.
19947    ///
19948    /// Returns `None` if the enum contains an unknown value deserialized from
19949    /// the integer representation of enums.
19950    pub fn name(&self) -> std::option::Option<&str> {
19951        match self {
19952            Self::Unspecified => std::option::Option::Some("SERVICE_TIER_UNSPECIFIED"),
19953            Self::Basic => std::option::Option::Some("SERVICE_TIER_BASIC"),
19954            Self::Premium => std::option::Option::Some("SERVICE_TIER_PREMIUM"),
19955            Self::UnknownValue(u) => u.0.name(),
19956        }
19957    }
19958}
19959
19960impl std::default::Default for ServiceTier {
19961    fn default() -> Self {
19962        use std::convert::From;
19963        Self::from(0)
19964    }
19965}
19966
19967impl std::fmt::Display for ServiceTier {
19968    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19969        wkt::internal::display_enum(f, self.name(), self.value())
19970    }
19971}
19972
19973impl std::convert::From<i32> for ServiceTier {
19974    fn from(value: i32) -> Self {
19975        match value {
19976            0 => Self::Unspecified,
19977            1 => Self::Basic,
19978            2 => Self::Premium,
19979            _ => Self::UnknownValue(service_tier::UnknownValue(
19980                wkt::internal::UnknownEnumValue::Integer(value),
19981            )),
19982        }
19983    }
19984}
19985
19986impl std::convert::From<&str> for ServiceTier {
19987    fn from(value: &str) -> Self {
19988        use std::string::ToString;
19989        match value {
19990            "SERVICE_TIER_UNSPECIFIED" => Self::Unspecified,
19991            "SERVICE_TIER_BASIC" => Self::Basic,
19992            "SERVICE_TIER_PREMIUM" => Self::Premium,
19993            _ => Self::UnknownValue(service_tier::UnknownValue(
19994                wkt::internal::UnknownEnumValue::String(value.to_string()),
19995            )),
19996        }
19997    }
19998}
19999
20000impl serde::ser::Serialize for ServiceTier {
20001    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20002    where
20003        S: serde::Serializer,
20004    {
20005        match self {
20006            Self::Unspecified => serializer.serialize_i32(0),
20007            Self::Basic => serializer.serialize_i32(1),
20008            Self::Premium => serializer.serialize_i32(2),
20009            Self::UnknownValue(u) => u.0.serialize(serializer),
20010        }
20011    }
20012}
20013
20014impl<'de> serde::de::Deserialize<'de> for ServiceTier {
20015    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20016    where
20017        D: serde::Deserializer<'de>,
20018    {
20019        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceTier>::new(
20020            ".google.monitoring.v3.ServiceTier",
20021        ))
20022    }
20023}
20024
20025/// The regions from which an Uptime check can be run.
20026///
20027/// # Working with unknown values
20028///
20029/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20030/// additional enum variants at any time. Adding new variants is not considered
20031/// a breaking change. Applications should write their code in anticipation of:
20032///
20033/// - New values appearing in future releases of the client library, **and**
20034/// - New values received dynamically, without application changes.
20035///
20036/// Please consult the [Working with enums] section in the user guide for some
20037/// guidelines.
20038///
20039/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20040#[derive(Clone, Debug, PartialEq)]
20041#[non_exhaustive]
20042pub enum UptimeCheckRegion {
20043    /// Default value if no region is specified. Will result in Uptime checks
20044    /// running from all regions.
20045    RegionUnspecified,
20046    /// Allows checks to run from locations within the United States of America.
20047    Usa,
20048    /// Allows checks to run from locations within the continent of Europe.
20049    Europe,
20050    /// Allows checks to run from locations within the continent of South
20051    /// America.
20052    SouthAmerica,
20053    /// Allows checks to run from locations within the Asia Pacific area (ex:
20054    /// Singapore).
20055    AsiaPacific,
20056    /// Allows checks to run from locations within the western United States of
20057    /// America
20058    UsaOregon,
20059    /// Allows checks to run from locations within the central United States of
20060    /// America
20061    UsaIowa,
20062    /// Allows checks to run from locations within the eastern United States of
20063    /// America
20064    UsaVirginia,
20065    /// If set, the enum was initialized with an unknown value.
20066    ///
20067    /// Applications can examine the value using [UptimeCheckRegion::value] or
20068    /// [UptimeCheckRegion::name].
20069    UnknownValue(uptime_check_region::UnknownValue),
20070}
20071
20072#[doc(hidden)]
20073pub mod uptime_check_region {
20074    #[allow(unused_imports)]
20075    use super::*;
20076    #[derive(Clone, Debug, PartialEq)]
20077    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20078}
20079
20080impl UptimeCheckRegion {
20081    /// Gets the enum value.
20082    ///
20083    /// Returns `None` if the enum contains an unknown value deserialized from
20084    /// the string representation of enums.
20085    pub fn value(&self) -> std::option::Option<i32> {
20086        match self {
20087            Self::RegionUnspecified => std::option::Option::Some(0),
20088            Self::Usa => std::option::Option::Some(1),
20089            Self::Europe => std::option::Option::Some(2),
20090            Self::SouthAmerica => std::option::Option::Some(3),
20091            Self::AsiaPacific => std::option::Option::Some(4),
20092            Self::UsaOregon => std::option::Option::Some(5),
20093            Self::UsaIowa => std::option::Option::Some(6),
20094            Self::UsaVirginia => std::option::Option::Some(7),
20095            Self::UnknownValue(u) => u.0.value(),
20096        }
20097    }
20098
20099    /// Gets the enum value as a string.
20100    ///
20101    /// Returns `None` if the enum contains an unknown value deserialized from
20102    /// the integer representation of enums.
20103    pub fn name(&self) -> std::option::Option<&str> {
20104        match self {
20105            Self::RegionUnspecified => std::option::Option::Some("REGION_UNSPECIFIED"),
20106            Self::Usa => std::option::Option::Some("USA"),
20107            Self::Europe => std::option::Option::Some("EUROPE"),
20108            Self::SouthAmerica => std::option::Option::Some("SOUTH_AMERICA"),
20109            Self::AsiaPacific => std::option::Option::Some("ASIA_PACIFIC"),
20110            Self::UsaOregon => std::option::Option::Some("USA_OREGON"),
20111            Self::UsaIowa => std::option::Option::Some("USA_IOWA"),
20112            Self::UsaVirginia => std::option::Option::Some("USA_VIRGINIA"),
20113            Self::UnknownValue(u) => u.0.name(),
20114        }
20115    }
20116}
20117
20118impl std::default::Default for UptimeCheckRegion {
20119    fn default() -> Self {
20120        use std::convert::From;
20121        Self::from(0)
20122    }
20123}
20124
20125impl std::fmt::Display for UptimeCheckRegion {
20126    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20127        wkt::internal::display_enum(f, self.name(), self.value())
20128    }
20129}
20130
20131impl std::convert::From<i32> for UptimeCheckRegion {
20132    fn from(value: i32) -> Self {
20133        match value {
20134            0 => Self::RegionUnspecified,
20135            1 => Self::Usa,
20136            2 => Self::Europe,
20137            3 => Self::SouthAmerica,
20138            4 => Self::AsiaPacific,
20139            5 => Self::UsaOregon,
20140            6 => Self::UsaIowa,
20141            7 => Self::UsaVirginia,
20142            _ => Self::UnknownValue(uptime_check_region::UnknownValue(
20143                wkt::internal::UnknownEnumValue::Integer(value),
20144            )),
20145        }
20146    }
20147}
20148
20149impl std::convert::From<&str> for UptimeCheckRegion {
20150    fn from(value: &str) -> Self {
20151        use std::string::ToString;
20152        match value {
20153            "REGION_UNSPECIFIED" => Self::RegionUnspecified,
20154            "USA" => Self::Usa,
20155            "EUROPE" => Self::Europe,
20156            "SOUTH_AMERICA" => Self::SouthAmerica,
20157            "ASIA_PACIFIC" => Self::AsiaPacific,
20158            "USA_OREGON" => Self::UsaOregon,
20159            "USA_IOWA" => Self::UsaIowa,
20160            "USA_VIRGINIA" => Self::UsaVirginia,
20161            _ => Self::UnknownValue(uptime_check_region::UnknownValue(
20162                wkt::internal::UnknownEnumValue::String(value.to_string()),
20163            )),
20164        }
20165    }
20166}
20167
20168impl serde::ser::Serialize for UptimeCheckRegion {
20169    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20170    where
20171        S: serde::Serializer,
20172    {
20173        match self {
20174            Self::RegionUnspecified => serializer.serialize_i32(0),
20175            Self::Usa => serializer.serialize_i32(1),
20176            Self::Europe => serializer.serialize_i32(2),
20177            Self::SouthAmerica => serializer.serialize_i32(3),
20178            Self::AsiaPacific => serializer.serialize_i32(4),
20179            Self::UsaOregon => serializer.serialize_i32(5),
20180            Self::UsaIowa => serializer.serialize_i32(6),
20181            Self::UsaVirginia => serializer.serialize_i32(7),
20182            Self::UnknownValue(u) => u.0.serialize(serializer),
20183        }
20184    }
20185}
20186
20187impl<'de> serde::de::Deserialize<'de> for UptimeCheckRegion {
20188    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20189    where
20190        D: serde::Deserializer<'de>,
20191    {
20192        deserializer.deserialize_any(wkt::internal::EnumVisitor::<UptimeCheckRegion>::new(
20193            ".google.monitoring.v3.UptimeCheckRegion",
20194        ))
20195    }
20196}
20197
20198/// The supported resource types that can be used as values of
20199/// `group_resource.resource_type`.
20200/// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
20201/// The resource types `gae_app` and `uptime_url` are not valid here because
20202/// group checks on App Engine modules and URLs are not allowed.
20203///
20204/// # Working with unknown values
20205///
20206/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20207/// additional enum variants at any time. Adding new variants is not considered
20208/// a breaking change. Applications should write their code in anticipation of:
20209///
20210/// - New values appearing in future releases of the client library, **and**
20211/// - New values received dynamically, without application changes.
20212///
20213/// Please consult the [Working with enums] section in the user guide for some
20214/// guidelines.
20215///
20216/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20217#[derive(Clone, Debug, PartialEq)]
20218#[non_exhaustive]
20219pub enum GroupResourceType {
20220    /// Default value (not valid).
20221    ResourceTypeUnspecified,
20222    /// A group of instances from Google Cloud Platform (GCP) or
20223    /// Amazon Web Services (AWS).
20224    Instance,
20225    /// A group of Amazon ELB load balancers.
20226    AwsElbLoadBalancer,
20227    /// If set, the enum was initialized with an unknown value.
20228    ///
20229    /// Applications can examine the value using [GroupResourceType::value] or
20230    /// [GroupResourceType::name].
20231    UnknownValue(group_resource_type::UnknownValue),
20232}
20233
20234#[doc(hidden)]
20235pub mod group_resource_type {
20236    #[allow(unused_imports)]
20237    use super::*;
20238    #[derive(Clone, Debug, PartialEq)]
20239    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20240}
20241
20242impl GroupResourceType {
20243    /// Gets the enum value.
20244    ///
20245    /// Returns `None` if the enum contains an unknown value deserialized from
20246    /// the string representation of enums.
20247    pub fn value(&self) -> std::option::Option<i32> {
20248        match self {
20249            Self::ResourceTypeUnspecified => std::option::Option::Some(0),
20250            Self::Instance => std::option::Option::Some(1),
20251            Self::AwsElbLoadBalancer => std::option::Option::Some(2),
20252            Self::UnknownValue(u) => u.0.value(),
20253        }
20254    }
20255
20256    /// Gets the enum value as a string.
20257    ///
20258    /// Returns `None` if the enum contains an unknown value deserialized from
20259    /// the integer representation of enums.
20260    pub fn name(&self) -> std::option::Option<&str> {
20261        match self {
20262            Self::ResourceTypeUnspecified => std::option::Option::Some("RESOURCE_TYPE_UNSPECIFIED"),
20263            Self::Instance => std::option::Option::Some("INSTANCE"),
20264            Self::AwsElbLoadBalancer => std::option::Option::Some("AWS_ELB_LOAD_BALANCER"),
20265            Self::UnknownValue(u) => u.0.name(),
20266        }
20267    }
20268}
20269
20270impl std::default::Default for GroupResourceType {
20271    fn default() -> Self {
20272        use std::convert::From;
20273        Self::from(0)
20274    }
20275}
20276
20277impl std::fmt::Display for GroupResourceType {
20278    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20279        wkt::internal::display_enum(f, self.name(), self.value())
20280    }
20281}
20282
20283impl std::convert::From<i32> for GroupResourceType {
20284    fn from(value: i32) -> Self {
20285        match value {
20286            0 => Self::ResourceTypeUnspecified,
20287            1 => Self::Instance,
20288            2 => Self::AwsElbLoadBalancer,
20289            _ => Self::UnknownValue(group_resource_type::UnknownValue(
20290                wkt::internal::UnknownEnumValue::Integer(value),
20291            )),
20292        }
20293    }
20294}
20295
20296impl std::convert::From<&str> for GroupResourceType {
20297    fn from(value: &str) -> Self {
20298        use std::string::ToString;
20299        match value {
20300            "RESOURCE_TYPE_UNSPECIFIED" => Self::ResourceTypeUnspecified,
20301            "INSTANCE" => Self::Instance,
20302            "AWS_ELB_LOAD_BALANCER" => Self::AwsElbLoadBalancer,
20303            _ => Self::UnknownValue(group_resource_type::UnknownValue(
20304                wkt::internal::UnknownEnumValue::String(value.to_string()),
20305            )),
20306        }
20307    }
20308}
20309
20310impl serde::ser::Serialize for GroupResourceType {
20311    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20312    where
20313        S: serde::Serializer,
20314    {
20315        match self {
20316            Self::ResourceTypeUnspecified => serializer.serialize_i32(0),
20317            Self::Instance => serializer.serialize_i32(1),
20318            Self::AwsElbLoadBalancer => serializer.serialize_i32(2),
20319            Self::UnknownValue(u) => u.0.serialize(serializer),
20320        }
20321    }
20322}
20323
20324impl<'de> serde::de::Deserialize<'de> for GroupResourceType {
20325    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20326    where
20327        D: serde::Deserializer<'de>,
20328    {
20329        deserializer.deserialize_any(wkt::internal::EnumVisitor::<GroupResourceType>::new(
20330            ".google.monitoring.v3.GroupResourceType",
20331        ))
20332    }
20333}